// EncodeUserdata implements renderers.ProviderRenderer.
14482
func (lxdRenderer) Render(cfg cloudinit.CloudConfig, os jujuos.OSType) ([]byte, error) {
	switch os {
	case jujuos.Ubuntu, jujuos.CentOS, jujuos.OpenSUSE:
		bytes, err := renderers.RenderYAML(cfg)
		return bytes, errors.Trace(err)
	default:
		return nil, errors.Errorf("cannot encode userdata for OS %q", os)
	}
}
833439
func (userdata VirtualMachineUserData) Decode() (string, error) {
	data, err := base64.StdEncoding.DecodeString(userdata.UserData)
	if err != nil {
		return "", err
	}
	// 0x1f8b is the magic number for gzip
	if len(data) < 2 || data[0] != 0x1f || data[1] != 0x8b {
		return string(data), nil
	}
	gr, err := gzip.NewReader(bytes.NewBuffer(data))
	if err != nil {
		return "", err
	}
	defer gr.Close() // nolint: errcheck

	str, err := ioutil.ReadAll(gr)
	if err != nil {
		return "", err
	}
	return string(str), nil
}
114724
func (r Hardware_SecurityModule) SetUserMetadata(metadata []string) (resp []datatypes.Hardware_Attribute, err error) {
	params := []interface{}{
		metadata,
	}
	err = r.Session.DoRequest("SoftLayer_Hardware_SecurityModule", "setUserMetadata", params, &r.Options, &resp)
	return
}
446021
func Convert_v1alpha2_UserData_To_kops_UserData(in *UserData, out *kops.UserData, s conversion.Scope) error {
	return autoConvert_v1alpha2_UserData_To_kops_UserData(in, out, s)
}
548100
func (s *CreateInstancesInput) SetUserData(v string) *CreateInstancesInput {
	s.UserData = &v
	return s
}
1253624
func (p *JSONFormat) TransformData(data interface{}) (string, error) {
	var buf bytes.Buffer
	enc := codec.NewEncoder(&buf, jsonHandlePretty)
	err := enc.Encode(data)
	if err != nil {
		return "", err
	}

	return buf.String(), nil
}
1141288
func encodeAuth(authConfig *types.AuthConfig) string {
	if authConfig.Username == "" && authConfig.Password == "" {
		return ""
	}

	authStr := authConfig.Username + ":" + authConfig.Password
	msg := []byte(authStr)
	encoded := make([]byte, base64.StdEncoding.EncodedLen(len(msg)))
	base64.StdEncoding.Encode(encoded, msg)
	return string(encoded)
}
249014
func (s *Session) UserAvatarDecode(u *User) (img image.Image, err error) {
	body, err := s.RequestWithBucketID("GET", EndpointUserAvatar(u.ID, u.Avatar), nil, EndpointUserAvatar("", ""))
	if err != nil {
		return
	}

	img, _, err = image.Decode(bytes.NewReader(body))
	return
}
887570
func (c *Context) WriteData(data interface{}) (err error) {
	var bytes []byte
	if bytes, err = c.Serialize(data); err == nil {
		_, err = c.Write(bytes)
	}
	return
}
204638
func (s *InitiateAuthInput) SetUserContextData(v *UserContextDataType) *InitiateAuthInput {
	s.UserContextData = v
	return s
}
825848
func (s *ServerLaunchConfiguration) SetUserData(v *UserData) *ServerLaunchConfiguration {
	s.UserData = v
	return s
}
537456
func (provider *InstagramProvider) PublicData(options map[string]interface{}) (interface{}, error) {
	return gomniauth.ProviderPublicData(provider, options)
}
917057
func (u *SessionStateUpdate) Encode(w io.Writer) error {
	return WriteElements(w,
		u.ID,
		u.SeqNum,
		u.LastApplied,
		u.Hint,
		u.EncryptedBlob,
	)
}
231361
func (s *SignUpInput) SetUserContextData(v *UserContextDataType) *SignUpInput {
	s.UserContextData = v
	return s
}
169314
func (u *User) Encode() string {
	values := url.Values{}

	// add custom attributes
	if u.Attrs != nil {
		for key, val := range u.Attrs {
			values.Set(key, val)
		}
	}

	values.Set("id", u.Id)
	values.Set("name", u.Name)
	values.Set("email", u.Email)
	values.Set("photo", u.Photo)
	return values.Encode()
}
756930
func (s *SessionInfo) Encode(w io.Writer) error {
	return WriteElements(w,
		s.ID,
		s.Policy,
		s.LastApplied,
		s.ClientLastApplied,
		s.RewardAddress,
	)
}
959335
func (s *Location) SetUserMetadata(v []*MetadataEntry) *Location {
	s.UserMetadata = v
	return s
}