// CreateAwsCredentials returns aws credentials.Credentials for active settings
972479
func (cred *AwsCredentials) CreateAwsCredentials() (*credentials.Credentials, error) {
	switch cred.credentialType {
	case credentialTypeEnv:
		return credentials.NewEnvCredentials(), nil

	case credentialTypeStatic:
		return credentials.NewStaticCredentials(cred.staticID, cred.staticSecret, cred.staticToken), nil

	case credentialTypeShared:
		return credentials.NewSharedCredentials(cred.sharedFile, cred.sharedProfile), nil

	case credentialTypeNone:
		return credentials.AnonymousCredentials, nil

	default:
		return credentials.AnonymousCredentials, fmt.Errorf("unknown CredentialType: %s", cred.credentialType)
	}
}
295548
func (c *sSHCredentials) Create(sSHCredential *v1alpha1.SSHCredential) (result *v1alpha1.SSHCredential, err error) {
	result = &v1alpha1.SSHCredential{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("sshcredentials").
		Body(sSHCredential).
		Do().
		Into(result)
	return
}
1328808
func initializeAWSAccount(region string) (*aws.Config, error) {
	cfg, err := external.LoadDefaultAWSConfig()
	if err != nil {
		return nil, fmt.Errorf("Cannot initialize aws connector: %s", err)
	}
	cfg.Region = region
	cfg.LogLevel = awsLogLevel
	return &cfg, nil
}
1285590
func NewCredentials(u, p string) *Credentials {
	return &Credentials{
		Username: u,
		Password: p,
	}
}
1130429
func (c *Client) CreateOWASP(i *CreateOWASPInput) (*OWASP, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.ID == "" {
		return nil, ErrMissingWAFID
	}

	path := fmt.Sprintf("/service/%s/wafs/%s/owasp", i.Service, i.ID)
	resp, err := c.PostJSONAPI(path, i, nil)
	if err != nil {
		return nil, err
	}

	var owasp OWASP
	if err := jsonapi.UnmarshalPayload(resp.Body, &owasp); err != nil {
		return nil, err
	}
	return &owasp, nil
}
647405
func resourceAwsLambdaAliasCreate(d *schema.ResourceData, meta interface{}) error {
	conn := meta.(*AWSClient).lambdaconn

	functionName := d.Get("function_name").(string)
	aliasName := d.Get("name").(string)

	log.Printf("[DEBUG] Creating Lambda alias: alias %s for function %s", aliasName, functionName)

	params := &lambda.CreateAliasInput{
		Description:     aws.String(d.Get("description").(string)),
		FunctionName:    aws.String(functionName),
		FunctionVersion: aws.String(d.Get("function_version").(string)),
		Name:            aws.String(aliasName),
		RoutingConfig:   expandLambdaAliasRoutingConfiguration(d.Get("routing_config").([]interface{})),
	}

	aliasConfiguration, err := conn.CreateAlias(params)
	if err != nil {
		return fmt.Errorf("Error creating Lambda alias: %s", err)
	}

	d.SetId(*aliasConfiguration.AliasArn)

	return resourceAwsLambdaAliasRead(d, meta)
}
1307105
func (s *AddPermissionInput) SetAWSAccountIds(v []*string) *AddPermissionInput {
	s.AWSAccountIds = v
	return s
}
1353786
func (t *Template) GetAllAWSIAMRoleResources() map[string]*resources.AWSIAMRole {
	results := map[string]*resources.AWSIAMRole{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSIAMRole:
			results[name] = resource
		}
	}
	return results
}
1185131
func (s *ListGroupsInput) SetAwsAccountId(v string) *ListGroupsInput {
	s.AwsAccountId = &v
	return s
}
1298222
func (b *backend) nonLockedSetAWSRole(ctx context.Context, s logical.Storage, roleName string,
	roleEntry *awsRoleEntry) error {
	if roleName == "" {
		return fmt.Errorf("missing role name")
	}

	if roleEntry == nil {
		return fmt.Errorf("nil role entry")
	}

	entry, err := logical.StorageEntryJSON("role/"+strings.ToLower(roleName), roleEntry)
	if err != nil {
		return err
	}

	if err := s.Put(ctx, entry); err != nil {
		return err
	}

	return nil
}
1325579
public static AWSCredentialsProvider createAwsCredentialsProvider(
      UnderFileSystemConfiguration conf) {
    // Set the aws credential system properties based on Alluxio properties, if they are set;
    // otherwise, use the default credential provider.
    if (conf.isSet(PropertyKey.S3A_ACCESS_KEY)
        && conf.isSet(PropertyKey.S3A_SECRET_KEY)) {
      return new AWSStaticCredentialsProvider(new BasicAWSCredentials(
          conf.get(PropertyKey.S3A_ACCESS_KEY), conf.get(PropertyKey.S3A_SECRET_KEY)));
    }
    // Checks, in order, env variables, system properties, profile file, and instance profile.
    return new DefaultAWSCredentialsProviderChain();
  }
165497
func (aws *TestingAWSService) CreateLoadBalancer(lbd *LoadBalancerDefinition) (string, error) {
	aws.Log = append(aws.Log, AWSActionLog{
		Action: "CreateLoadBalancer",
		NotableParams: map[string]string{
			"name":            lbd.Name,
			"security_groups": fmt.Sprintf("%v", lbd.SecurityGroups),
			"scheme":          lbd.Scheme,
			"subnets":         fmt.Sprintf("%v", lbd.Subnets),
			"listeners":       fmt.Sprintf("%v", lbd.Listeners),
		},
	})
	return "", nil
}
561079
func NewFileAWSCredentials(filename string, profile string) *Credentials {
	return New(&FileAWSCredentials{
		filename: filename,
		profile:  profile,
	})
}
635605
func (t *Template) GetAWSIAMInstanceProfileWithName(name string) (*resources.AWSIAMInstanceProfile, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSIAMInstanceProfile:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSIAMInstanceProfile not found", name)
}
821174
func (c *Credentials) Create(ctx context.Context, creds []envelope.CredentialInf) ([]*envelope.Credential, error) {
	resp := []*envelope.Credential{}
	err := c.client.RoundTrip(ctx, "POST", "/credentials", nil, creds, &resp)
	return resp, err
}
1316537
func CreateDsnForRole(existingDsn, role, password string) string {
	dsnMap := parseDsn(existingDsn)
	dsnMap["user"] = role
	if password != "" {
		dsnMap["password"] = password
	}
	return buildDsn(dsnMap)
}
167552
func (t *Template) GetAWSSecretsManagerSecretWithName(name string) (*resources.AWSSecretsManagerSecret, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSSecretsManagerSecret:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSSecretsManagerSecret not found", name)
}