Documentation
¶
Overview ¶
Package aws provides a high level interface to the AWS part of the RSC platform.
Index ¶
- type API
- func (a API) Account(ctx context.Context, id IdentityFunc, feature core.Feature) (CloudAccount, error)
- func (a API) AccountArtifacts(ctx context.Context, id IdentityFunc) (map[string]string, map[string]string, error)
- func (a API) AccountByID(ctx context.Context, feature core.Feature, id uuid.UUID) (CloudAccount, error)
- func (a API) AccountByName(ctx context.Context, feature core.Feature, name string) (CloudAccount, error)
- func (a API) AccountByNativeID(ctx context.Context, feature core.Feature, nativeID string) (CloudAccount, error)
- func (a API) Accounts(ctx context.Context, feature core.Feature, filter string) ([]CloudAccount, error)
- func (a API) AccountsByFeatureStatus(ctx context.Context, feature core.Feature, filter string, ...) ([]CloudAccount, error)
- func (a API) AddAccount(ctx context.Context, account AccountFunc, features []core.Feature, ...) (uuid.UUID, error)
- func (a API) AddAccountArtifacts(ctx context.Context, id IdentityFunc, features []core.Feature, ...) (uuid.UUID, error)
- func (a API) Artifacts(ctx context.Context, cloud string, features []core.Feature) ([]string, []string, error)
- func (a API) Permissions(ctx context.Context, cloud string, features []core.Feature, ...) ([]CustomerManagedPolicy, []ManagedPolicy, error)
- func (a API) PermissionsUpdated(ctx context.Context, cloudAccountID uuid.UUID, features []core.Feature) error
- func (a API) RemoveAccount(ctx context.Context, account AccountFunc, features []core.Feature, ...) error
- func (a API) TrustPolicies(ctx context.Context, id IdentityFunc, features []core.Feature, ...) (map[string]string, error)
- func (a API) UpdateAccount(ctx context.Context, id IdentityFunc, feature core.Feature, opts ...OptionFunc) error
- func (a API) UpdatePermissions(ctx context.Context, account AccountFunc, features []core.Feature) error
- type AccountFunc
- func Account(cloud, awsAccountID string) AccountFunc
- func AccountWithName(cloud, awsAccountID, name string) AccountFunc
- func Config(config aws.Config) AccountFunc
- func Default() AccountFunc
- func DefaultWithRegion(region string) AccountFunc
- func DefaultWithRegionAndRole(region, roleARN string) AccountFunc
- func DefaultWithRole(roleARN string) AccountFunc
- func Profile(profile string) AccountFunc
- func ProfileWithRegion(profile, region string) AccountFunc
- func ProfileWithRegionAndRole(profile, region, roleARN string) AccountFunc
- func ProfileWithRole(profile string, roleArn string) AccountFunc
- type CloudAccount
- type CustomerManagedPolicy
- type Feature
- type IdentityFunc
- type ManagedPolicy
- type MappedAccount
- type OptionFunc
- type RoleChainingDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API for AWS account management.
func (API) Account ¶
func (a API) Account(ctx context.Context, id IdentityFunc, feature core.Feature) (CloudAccount, error)
Account returns the account with specified id and feature.
func (API) AccountArtifacts ¶ added in v0.9.0
func (a API) AccountArtifacts(ctx context.Context, id IdentityFunc) (map[string]string, map[string]string, error)
AccountArtifacts returns the artifacts added to the cloud account.
func (API) AccountByID ¶ added in v1.1.0
func (a API) AccountByID(ctx context.Context, feature core.Feature, id uuid.UUID) (CloudAccount, error)
AccountByID returns the account with the specified feature and RSC cloud account ID.
func (API) AccountByName ¶ added in v0.10.0
func (a API) AccountByName(ctx context.Context, feature core.Feature, name string) (CloudAccount, error)
AccountByName returns the account with the specified feature and name.
func (API) AccountByNativeID ¶ added in v0.10.0
func (a API) AccountByNativeID(ctx context.Context, feature core.Feature, nativeID string) (CloudAccount, error)
AccountByNativeID returns the account with the specified feature and native ID.
func (API) Accounts ¶
func (a API) Accounts(ctx context.Context, feature core.Feature, filter string) ([]CloudAccount, error)
Accounts return all accounts with the specified feature matching the filter. The filter can be used to search for account id, account name and role arn.
func (API) AccountsByFeatureStatus ¶ added in v1.1.4
func (a API) AccountsByFeatureStatus(ctx context.Context, feature core.Feature, filter string, statusFilters []core.Status) ([]CloudAccount, error)
Accounts return all accounts with the specified feature matching the filter. The filter can be used to search for account id, account name and role arn.
func (API) AddAccount ¶
func (a API) AddAccount(ctx context.Context, account AccountFunc, features []core.Feature, opts ...OptionFunc) (uuid.UUID, error)
AddAccount adds the AWS account to RSC for the given features. Returns the RSC cloud account id of the added account. If name isn't given as an option it's derived from information in the cloud. The result can vary slightly depending on AWS permissions.
If adding the account fails due to permission problems when creating the CloudFormation stack, it's safe to call AddAccount again with the same parameters after the permission problems have been resolved.
func (API) AddAccountArtifacts ¶ added in v0.9.0
func (a API) AddAccountArtifacts(ctx context.Context, id IdentityFunc, features []core.Feature, instanceProfiles map[string]string, roles map[string]string) (uuid.UUID, error)
AddAccountArtifacts adds the specified artifacts, instance profiles and roles, to the cloud account.
func (API) Artifacts ¶ added in v0.9.0
func (a API) Artifacts(ctx context.Context, cloud string, features []core.Feature) ([]string, []string, error)
Artifacts returns the artifacts, instance profiles and roles, required by RSC for the specified features.
func (API) Permissions ¶ added in v0.9.0
func (a API) Permissions(ctx context.Context, cloud string, features []core.Feature, ec2RecoveryRolePath string) ([]CustomerManagedPolicy, []ManagedPolicy, error)
Permissions returns the policies required by RSC for the specified features.
func (API) PermissionsUpdated ¶ added in v0.11.0
func (a API) PermissionsUpdated(ctx context.Context, cloudAccountID uuid.UUID, features []core.Feature) error
PermissionsUpdated notifies RSC that the AWS roles for the RSC cloud account with the specified ID has been updated.
The permissions should be updated when a feature has the status StatusMissingPermissions. Updating the permissions is done outside of this SDK. The feature parameter is allowed to be nil. When features are nil, all features are updated. Note that RSC is only notified about features with status StatusMissingPermissions.
func (API) RemoveAccount ¶
func (a API) RemoveAccount(ctx context.Context, account AccountFunc, features []core.Feature, deleteSnapshots bool) error
RemoveAccount removes the RSC feature from the account with the specified id.
If a Cloud Native Protection feature is being removed and deleteSnapshots is true, the snapshots are deleted otherwise they are kept.
func (API) TrustPolicies ¶ added in v0.9.0
func (a API) TrustPolicies(ctx context.Context, id IdentityFunc, features []core.Feature, externalID string) (map[string]string, error)
TrustPolicies returns the trust policies required by RSC for the specified features. If the external ID is empty, RSC will generate an external ID.
func (API) UpdateAccount ¶
func (a API) UpdateAccount(ctx context.Context, id IdentityFunc, feature core.Feature, opts ...OptionFunc) error
UpdateAccount updates the account with the specified id and feature. Note that the account name is not tied to a specific feature.
func (API) UpdatePermissions ¶ added in v0.3.0
func (a API) UpdatePermissions(ctx context.Context, account AccountFunc, features []core.Feature) error
UpdatePermissions updates the permissions of the CloudFormation stack in AWS.
type AccountFunc ¶
AccountFunc returns an account initialized from the values passed to the function creating the AccountFunc.
func Account ¶ added in v0.9.0
func Account(cloud, awsAccountID string) AccountFunc
Account returns an AccountFunc that initializes the account with specified cloud type and AWS account id.
func AccountWithName ¶ added in v0.9.0
func AccountWithName(cloud, awsAccountID, name string) AccountFunc
AccountWithName returns an AccountFunc that initializes the account with specified cloud type, AWS account id and account name.
func Config ¶
func Config(config aws.Config) AccountFunc
Config returns an AccountFunc that initializes the account with values from the specified AWS configuration and values from the AWS cloud.
func Default ¶
func Default() AccountFunc
Default returns an AccountFunc that initializes the account with values from the default profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. Credentials and region from the profile can be overridden by environment variables.
func DefaultWithRegion ¶ added in v0.5.0
func DefaultWithRegion(region string) AccountFunc
DefaultWithRegion returns an AccountFunc that initializes the account with values from the default profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. Credentials and region from the profile can be overridden by environment variables.
func DefaultWithRegionAndRole ¶ added in v0.5.0
func DefaultWithRegionAndRole(region, roleARN string) AccountFunc
DefaultWithRegionAndRole returns an AccountFunc that initializes the account with values from the default profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. After the account has been initialized it assumes the role specified by the role ARN. Credentials and region from the profile can be overridden by environment variables.
func DefaultWithRole ¶ added in v0.5.0
func DefaultWithRole(roleARN string) AccountFunc
DefaultWithRole returns an AccountFunc that initializes the account with values from the default profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. After the account has been initialized it assumes the role specified by the role ARN. Credentials and region from the profile can be overridden by environment variables.
func Profile ¶
func Profile(profile string) AccountFunc
Profile returns an AccountFunc that initializes the account with values from the named profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. If the profile specified is "default", credentials and region from the profile can be overridden by environment variables.
func ProfileWithRegion ¶ added in v0.5.0
func ProfileWithRegion(profile, region string) AccountFunc
ProfileWithRegion returns an AccountFunc that initializes the account with values from the named profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. If the profile specified is "default", credentials and region from the profile can be overridden by environment variables.
func ProfileWithRegionAndRole ¶ added in v0.5.0
func ProfileWithRegionAndRole(profile, region, roleARN string) AccountFunc
ProfileWithRegionAndRole returns an AccountFunc that initializes the account with values from the named profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. After the account has been initialized it assumes the role specified by the role ARN. If the profile specified is "default", credentials and region from the profile can be overridden by environment variables.
func ProfileWithRole ¶ added in v0.5.0
func ProfileWithRole(profile string, roleArn string) AccountFunc
ProfileWithRole returns an AccountFunc that initializes the account with values from the named profile (~/.aws/credentials and ~/.aws/config) and the AWS cloud. After the account has been initialized it assumes the role specified by the role ARN. If the profile specified is "default", credentials and region from the profile can be overridden by environment variables.
type CloudAccount ¶
type CloudAccount struct { Cloud string ID uuid.UUID NativeID string Name string Features []Feature }
CloudAccount for Amazon Web Services accounts.
type CustomerManagedPolicy ¶ added in v0.9.0
type CustomerManagedPolicy struct { Artifact string Feature core.Feature Name string Policy string }
CustomerManagedPolicy represents a policy that is managed by the customer.
type Feature ¶
type Feature struct { core.Feature Regions []string RoleArn string StackArn string Status core.Status MappedAccounts []MappedAccount RoleChainingDetails []RoleChainingDetails }
Feature for Amazon Web Services accounts.
type IdentityFunc ¶
IdentityFunc returns a project identity initialized from the values passed to the function creating the IdentityFunc.
func AccountID ¶
func AccountID(awsAccountID string) IdentityFunc
AccountID returns an IdentityFunc that initializes the identity with the specified AWS account id.
func CloudAccountID ¶
func CloudAccountID(cloudAccountID uuid.UUID) IdentityFunc
CloudAccountID returns an IdentityFunc that initializes the identity with the specified RSC cloud account id.
func ID ¶
func ID(account AccountFunc) IdentityFunc
ID returns an IdentityFunc that initializes the identity with the id of the specified account.
func Role ¶ added in v0.5.0
func Role(roleARN string) IdentityFunc
Role returns an IdentityFunc that initializes the identity with the specified AWS account id.
type ManagedPolicy ¶ added in v0.9.0
ManagedPolicy represents a policy that is managed by AWS.
type MappedAccount ¶ added in v1.1.4
type OptionFunc ¶
OptionFunc gives the value passed to the function creating the OptionFunc to the specified options instance.
func Name ¶
func Name(name string) OptionFunc
Name returns an OptionFunc that gives the specified name to the options instance.
func OutpostAccount ¶ added in v1.1.4
func OutpostAccount(outpostAccountID string) OptionFunc
OutpostAccount returns an OptionFunc that gives the specified AWS account id for the outpost feature to the options instance.
func OutpostAccountWithProfile ¶ added in v1.1.4
func OutpostAccountWithProfile(outpostAccountID, outpostAccountProfile string) OptionFunc
OutpostAccountWithProfile returns an OptionFunc that gives the specified AWS account id for the outpost feature to the options instance and the aws profile to use to access it.
func Region ¶
func Region(region string) OptionFunc
Region returns an OptionFunc that gives the specified region to the options instance.
func Regions ¶
func Regions(regions ...string) OptionFunc
Regions return an OptionFunc that gives the specified regions to the options instance.