discovery/azure/azure.go
func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
	*c = DefaultSDConfig
	type plain SDConfig
	err := unmarshal((*plain)(c))
	if err != nil {
		return err
	}

	if err = validateAuthParam(c.SubscriptionID, "subscription_id"); err != nil {
		return err
	}

	if c.AuthenticationMethod == authMethodOAuth {
		if err = validateAuthParam(c.TenantID, "tenant_id"); err != nil {
			return err
		}
		if err = validateAuthParam(c.ClientID, "client_id"); err != nil {
			return err
		}
		if err = validateAuthParam(string(c.ClientSecret), "client_secret"); err != nil {
			return err
		}
	}

	if c.AuthenticationMethod != authMethodOAuth && c.AuthenticationMethod != authMethodManagedIdentity {
		return errors.Errorf("unknown authentication_type %q. Supported types are %q or %q", c.AuthenticationMethod, authMethodOAuth, authMethodManagedIdentity)
	}

	return nil
}
func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
	*c = DefaultSDConfig
	type plain SDConfig
	err := unmarshal((*plain)(c))
	if err != nil {
		return err
	}

	if err = validateAuthParam(c.SubscriptionID, "subscription_id"); err != nil {
		return err
	}

	if c.AuthenticationMethod == authMethodOAuth {
		if err = validateAuthParam(c.TenantID, "tenant_id"); err != nil {
			return err
		}
		if err = validateAuthParam(c.ClientID, "client_id"); err != nil {
			return err
		}
		if err = validateAuthParam(string(c.ClientSecret), "client_secret"); err != nil {
			return err
		}
	}

	if c.AuthenticationMethod != authMethodOAuth && c.AuthenticationMethod != authMethodManagedIdentity {
		return errors.Errorf("unknown authentication_type %q. Supported types are %q or %q", c.AuthenticationMethod, authMethodOAuth, authMethodManagedIdentity)
	}

	return nil
}
func ( c * SDConfig ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error { * c = DefaultSDConfig type plain SDConfig err := unmarshal ( ( * plain ) ( c ) ) if err != nil { return err } if err = validateAuthParam ( c . SubscriptionID , " " ) ; err != nil { return err } if c . AuthenticationMethod == authMethodOAuth { if err = validateAuthParam ( c . TenantID , " " ) ; err != nil { return err } if err = validateAuthParam ( c . ClientID , " " ) ; err != nil { return err } if err = validateAuthParam ( string ( c . ClientSecret ) , " " ) ; err != nil { return err } } if c . AuthenticationMethod != authMethodOAuth && c . AuthenticationMethod != authMethodManagedIdentity { return errors . Errorf ( " " , c . AuthenticationMethod , authMethodOAuth , authMethodManagedIdentity ) } return nil }
// UnmarshalYAML implements the yaml.Unmarshaler interface.
UnmarshalYAML implements the yaml . Unmarshaler interface .