// SetUserPolicy - sets policy to given user name.
327008
func (sys *IAMSys) SetUserPolicy(accessKey, policyName string) error {
	objectAPI := newObjectLayerFn()
	if objectAPI == nil {
		return errServerNotInitialized
	}

	sys.Lock()
	defer sys.Unlock()

	if _, ok := sys.iamUsersMap[accessKey]; !ok {
		return errNoSuchUser
	}

	if _, ok := sys.iamCannedPolicyMap[policyName]; !ok {
		return errNoSuchPolicy
	}

	data, err := json.Marshal(policyName)
	if err != nil {
		return err
	}

	configFile := pathJoin(iamConfigUsersPrefix, accessKey, iamPolicyFile)
	if globalEtcdClient != nil {
		err = saveConfigEtcd(context.Background(), globalEtcdClient, configFile, data)
	} else {
		err = saveConfig(context.Background(), objectAPI, configFile, data)
	}
	if err != nil {
		return err
	}

	sys.iamPolicyMap[accessKey] = policyName
	return nil
}
632379
func (s *DescribeEventBusOutput) SetPolicy(v string) *DescribeEventBusOutput {
	s.Policy = &v
	return s
}
1270513
func SetPolicy(statements []Statement, policy BucketPolicy, bucketName string, prefix string) []Statement {
	out := removeStatements(statements, bucketName, prefix)
	// fmt.Println("out = ")
	// printstatement(out)
	ns := newStatements(policy, bucketName, prefix)
	// fmt.Println("ns = ")
	// printstatement(ns)

	rv := appendStatements(out, ns)
	// fmt.Println("rv = ")
	// printstatement(rv)

	return rv
}
1164170
func (s *RestApi) SetPolicy(v string) *RestApi {
	s.Policy = &v
	return s
}
207220
func (s *WorkflowExecutionConfiguration) SetChildPolicy(v string) *WorkflowExecutionConfiguration {
	s.ChildPolicy = &v
	return s
}
529698
func (s *WorkflowExecutionTimedOutEventAttributes) SetChildPolicy(v string) *WorkflowExecutionTimedOutEventAttributes {
	s.ChildPolicy = &v
	return s
}
1335960
func (s *UpdateUserInput) SetPolicy(v string) *UpdateUserInput {
	s.Policy = &v
	return s
}
467350
func (s *SetDataRetrievalPolicyInput) SetPolicy(v *DataRetrievalPolicy) *SetDataRetrievalPolicyInput {
	s.Policy = v
	return s
}
911719
func (s *CPUUtilization) SetUser(v float64) *CPUUtilization {
	s.User = &v
	return s
}
836682
func (s *GetBucketPolicyOutput) SetPolicy(v string) *GetBucketPolicyOutput {
	s.Policy = &v
	return s
}
886061
func (s *DescribeMyUserProfileOutput) SetUserProfile(v *SelfUserProfile) *DescribeMyUserProfileOutput {
	s.UserProfile = v
	return s
}
979012
func (s *RegisterUserInput) SetUserRole(v string) *RegisterUserInput {
	s.UserRole = &v
	return s
}
1176427
func (s *AttachUserPolicyInput) SetPolicyArn(v string) *AttachUserPolicyInput {
	s.PolicyArn = &v
	return s
}
1125974
func (s *PutContainerPolicyInput) SetPolicy(v string) *PutContainerPolicyInput {
	s.Policy = &v
	return s
}
372093
func (s *CreateRestApiInput) SetPolicy(v string) *CreateRestApiInput {
	s.Policy = &v
	return s
}
971555
func (s *PutBackupVaultAccessPolicyInput) SetPolicy(v string) *PutBackupVaultAccessPolicyInput {
	s.Policy = &v
	return s
}
579978
func (s *UpdatePolicyOutput) SetPolicy(v *Policy) *UpdatePolicyOutput {
	s.Policy = v
	return s
}