Documentation ¶
Index ¶
- Variables
- func AccountResources(ctx context.Context, account Account, resourcesToDelete Resources) error
- func GenerateJSONSchema() ([]byte, error)
- type Account
- type AccountAPIClient
- func (c *AccountAPIClient) DeleteAccountPolicy(ctx context.Context, name string) error
- func (c *AccountAPIClient) DeleteEnvironmentPolicy(ctx context.Context, environmentID, name string) error
- func (c *AccountAPIClient) DeleteGroup(ctx context.Context, name string) error
- func (c *AccountAPIClient) DeleteUser(ctx context.Context, email string) error
- type AccountPolicy
- type Client
- type DeleteEntry
- type DeleteEntryParserError
- type Entries
- type EnvironmentPolicy
- type FileDefinition
- type Group
- type GroupDeleteEntry
- type PolicyDeleteEntry
- type PolicyLevel
- type Resources
- type SchemaDef
- type User
- type UserDeleteEntry
Constants ¶
This section is empty.
Variables ¶
var NotFoundErr = errors.New("nothing with given name found")
NotFoundErr is a sentinel error signifying that the resource desired to be deleted was not found. Generally this error can be treated as a succeful "deletion" of the resource.
Functions ¶
func AccountResources ¶
AccountResources removes all given Resources from the given Account Returns an error if any resource fails to be deleted, but attempts to delete as many resources as possible and only returns an error at the end.
func GenerateJSONSchema ¶ added in v2.10.0
Types ¶
type Account ¶
type Account struct { // Name of this account - as defined in the manifest.Manifest Name string // UUID of this account UUID string // APIClient is a Client for authenticated access to delete resources for this Account APIClient Client }
Account defines everything required to access the account management API
type AccountAPIClient ¶
type AccountAPIClient struct {
// contains filtered or unexported fields
}
AccountAPIClient is the default implementation of a delete Client, accessing the Account Management API using an accounts.Client
func (*AccountAPIClient) DeleteAccountPolicy ¶
func (c *AccountAPIClient) DeleteAccountPolicy(ctx context.Context, name string) error
DeleteAccountPolicy removes the account-level policy with the given name from the account If the policy is still bound to any groups, it will be force removed from them. Returns error if any API call fails unless the policy is already not present (HTTP 404)
func (*AccountAPIClient) DeleteEnvironmentPolicy ¶
func (c *AccountAPIClient) DeleteEnvironmentPolicy(ctx context.Context, environmentID, name string) error
DeleteEnvironmentPolicy removes the environment-level policy with the given name from the given environment. If the policy is still bound to any groups, it will be force removed from them. Returns error if any API call fails unless the policy is already not present (HTTP 404)
func (*AccountAPIClient) DeleteGroup ¶
func (c *AccountAPIClient) DeleteGroup(ctx context.Context, name string) error
DeleteGroup removes the group with the given name from the account Returns error if any API call fails unless the group is already not present (HTTP 404)
func (*AccountAPIClient) DeleteUser ¶
func (c *AccountAPIClient) DeleteUser(ctx context.Context, email string) error
DeleteUser removes the user with the given email from the account Returns error if any API call fails unless the user is already not present (HTTP 404)
type AccountPolicy ¶
type AccountPolicy struct {
Name string
}
type Client ¶
type Client interface { DeleteUser(ctx context.Context, email string) error DeleteGroup(ctx context.Context, name string) error DeleteAccountPolicy(ctx context.Context, name string) error DeleteEnvironmentPolicy(ctx context.Context, environment, name string) error }
Client for deleting resources from the Account Management API
type DeleteEntry ¶
type DeleteEntry struct {
Type string `yaml:"type" json:"type" mapstructure:"type" jsonschema:"required,enum=user,enum=group,enum=policy"`
}
DeleteEntry defines the one shared property of account delete entries - their Type Individual entries are to be loaded as UserDeleteEntry, GroupDeleteEntry or PolicyDeleteEntry nased on the content of Type
type DeleteEntryParserError ¶
type DeleteEntryParserError struct { Value string `json:"value"` Index int `json:"index"` Reason string `json:"reason"` }
func (DeleteEntryParserError) Error ¶
func (e DeleteEntryParserError) Error() string
type Entries ¶ added in v2.10.0
type Entries []DeleteEntry
func (Entries) JSONSchema ¶ added in v2.10.0
func (_ Entries) JSONSchema() *jsonschema.Schema
JSONSchema manually defines the schema for account DeleteEntry as the nature of this structs dependent required fields makes it impossible to simply generate the schema via reflection. This definition likely needs to change if the DeleteEntry changes
type EnvironmentPolicy ¶
type FileDefinition ¶
type FileDefinition struct {
DeleteEntries []any `yaml:"delete"`
}
type GroupDeleteEntry ¶
type GroupDeleteEntry struct {
Name string `mapstructure:"name"`
}
type PolicyDeleteEntry ¶
type PolicyDeleteEntry struct { Name string `mapstructure:"name"` Level PolicyLevel `mapstructure:"level"` // either PolicyLevelAccount or PolicyLevelEnvironment }
type PolicyLevel ¶
type Resources ¶
type Resources struct { Users []User Groups []Group AccountPolicies []AccountPolicy EnvironmentPolicies []EnvironmentPolicy }
Resources defines which account resources to delete. Each field defines the information required to delete that type.
type SchemaDef ¶ added in v2.10.0
type SchemaDef struct {
DeleteEntries Entries `json:"delete" jsonschema:"required"`
}
type UserDeleteEntry ¶
type UserDeleteEntry struct {
Email string `mapstructure:"email"`
}