Example #1
0
// Select one of the sample policies, fill in the live metadata, and update
func set_policy(m2m *xrm2m.M2MClient, policy_name string) error {
	policy, ok := policies[policy_name]
	if !ok {
		return errors.New("bad policy name")
	}

	// Add some metadata including the time we're changing policy
	now, _ := time.Now().MarshalText()
	policy.Metadata = &Metadata{
		Script: "Telemetry management bot 0.1",
		Date:   string(now),
	}

	// Set it using the M2M API
	m2m.UpdateTelemetryPolicy(policy)
	return m2m.Error
}