Documentation ¶
Index ¶
- Variables
- func NewDefaultConf(ctx context.Context) (cfg aws.Config, err error)
- type Address
- type CreateGroupRequest
- type CreateGroupResponse
- type CreateUserRequest
- type CreateUserResponse
- type Email
- type GetGroupResponse
- type GetUserResponse
- type Group
- type HTTPClient
- type HTTPResponseError
- type ListGroupsResponse
- type ListResponse
- type ListUsersResponse
- type Manager
- type Member
- type Meta
- type Name
- type Operation
- type Patch
- type PatchGroupRequest
- type PatchUserRequest
- type PatchUserResponse
- type PhoneNumber
- type PutUserRequest
- type PutUserResponse
- type SCIMService
- func (s *SCIMService) CreateGroup(ctx context.Context, cgr *CreateGroupRequest) (*CreateGroupResponse, error)
- func (s *SCIMService) CreateOrGetGroup(ctx context.Context, cgr *CreateGroupRequest) (*CreateGroupResponse, error)
- func (s *SCIMService) CreateOrGetUser(ctx context.Context, cur *CreateUserRequest) (*CreateUserResponse, error)
- func (s *SCIMService) CreateUser(ctx context.Context, cur *CreateUserRequest) (*CreateUserResponse, error)
- func (s *SCIMService) DeleteGroup(ctx context.Context, id string) error
- func (s *SCIMService) DeleteUser(ctx context.Context, id string) error
- func (s *SCIMService) GetGroupByDisplayName(ctx context.Context, displayName string) (*GetGroupResponse, error)
- func (s *SCIMService) GetUser(ctx context.Context, userID string) (*GetUserResponse, error)
- func (s *SCIMService) GetUserByUserName(ctx context.Context, userName string) (*GetUserResponse, error)
- func (s *SCIMService) ListGroups(ctx context.Context, filter string) (*ListGroupsResponse, error)
- func (s *SCIMService) ListUsers(ctx context.Context, filter string) (*ListUsersResponse, error)
- func (s *SCIMService) PatchGroup(ctx context.Context, pgr *PatchGroupRequest) error
- func (s *SCIMService) PatchUser(ctx context.Context, pur *PatchUserRequest) error
- func (s *SCIMService) PutUser(ctx context.Context, pur *PutUserRequest) (*PutUserResponse, error)
- func (s *SCIMService) ServiceProviderConfig(ctx context.Context) (*ServiceProviderConfig, error)
- type SchemaEnterpriseUser
- type SecretsManagerClientAPI
- type SecretsManagerService
- type ServiceProviderConfig
- type User
Constants ¶
This section is empty.
Variables ¶
var ( // ErrURLEmpty is returned when the URL is empty. ErrURLEmpty = errors.Errorf("aws: url may not be empty") // ErrCreateGroupRequestEmpty is returned when the create group request is empty. ErrCreateGroupRequestEmpty = errors.Errorf("aws: create group request may not be empty") // ErrCreateUserRequestEmpty is returned when the create user request is empty. ErrCreateUserRequestEmpty = errors.Errorf("aws: create user request may not be empty") // ErrPatchGroupRequestEmpty is returned when the patch group request is empty. ErrPatchGroupRequestEmpty = errors.Errorf("aws: patch group request may not be empty") // ErrGroupIDEmpty is returned when the group id is empty. ErrGroupIDEmpty = errors.Errorf("aws: group id may not be empty") // ErrPatchUserRequestEmpty is returned when the patch user request is empty. ErrPatchUserRequestEmpty = errors.Errorf("aws: patch user request may not be empty") // ErrPutUserRequestEmpty is returned when the put user request is empty. ErrPutUserRequestEmpty = errors.Errorf("aws: put user request may not be empty") // ErrUserExternalIDEmpty is returned when the user externalId is empty. ErrUserExternalIDEmpty = errors.Errorf("aws: externalId may not be empty") // ErrGroupDisplayNameEmpty is returned when the userName is empty. ErrGroupDisplayNameEmpty = errors.Errorf("aws: displayName may not be empty") // ErrGroupExternalIDEmpty is returned when the userName is empty. ErrGroupExternalIDEmpty = errors.Errorf("aws: externalId may not be empty") // ErrBearerTokenEmpty is returned when the bearer token is empty. ErrBearerTokenEmpty = errors.Errorf("aws: bearer token may not be empty") )
var ( // ErrUserIDEmpty is returned when the user id is empty. ErrUserIDEmpty = errors.Errorf("aws: user id may not be empty") // ErrEmailsTooMany is returned when the emails has more than one entity. ErrEmailsTooMany = errors.Errorf("aws: emails may not be more than 1") // ErrEmailsEmpty ErrEmailsEmpty = errors.Errorf("aws: emails may not be empty") // ErrFamilyNameEmpty is returned when the family name is empty. ErrFamilyNameEmpty = errors.Errorf("aws: family name may not be empty") // ErrDisplayNameEmpty is returned when the display name is empty. ErrDisplayNameEmpty = errors.Errorf("aws: display name may not be empty") // ErrGivenNameEmpty is returned when the given name is empty. ErrGivenNameEmpty = errors.Errorf("aws: given name may not be empty") // ErrUserNameEmpty is returned when the user name is empty. ErrUserNameEmpty = errors.Errorf("aws: user name may not be empty") // ErrUserUserNameEmpty is returned when the userName is empty. ErrUserUserNameEmpty = errors.Errorf("aws: userName may not be empty") // ErrPrimaryEmailEmpty is returned when the primary email is empty. ErrPrimaryEmailEmpty = errors.Errorf("aws: primary email may not be empty") // ErrAddressesTooMany is returned when the addresses has more than one entity. ErrAddressesTooMany = errors.Errorf("aws: addresses may not be more than 1") // ErrPhoneNumbersTooMany is returned when the phone numbers has more than one entity. ErrPhoneNumbersTooMany = errors.Errorf("aws: phone numbers may not be more than 1") // ErrTooManyPrimaryEmails when there are more than one primary email ErrTooManyPrimaryEmails = errors.Errorf("aws: there can only be one primary email") )
var ErrSecretManagerClientNil = errors.New("aws: AWS SecretsManager Client cannot be nil")
ErrSecretManagerClientNil is returned when the SecretsManagerClientAPI is nil.
Functions ¶
Types ¶
type Address ¶ added in v0.1.0
type Address struct { Formatted string `json:"formatted,omitempty"` StreetAddress string `json:"streetAddress,omitempty"` Locality string `json:"locality,omitempty"` Region string `json:"region,omitempty"` PostalCode string `json:"postalCode,omitempty"` Country string `json:"country,omitempty"` }
Addresses represent an address entity
type CreateGroupRequest ¶
type CreateGroupRequest Group
CreateGroupRequest represent a create group request entity
func (*CreateGroupRequest) Validate ¶ added in v0.1.0
func (g *CreateGroupRequest) Validate() error
type CreateGroupResponse ¶
type CreateGroupResponse Group
CreateGroupResponse represent a create group response entity
type CreateUserRequest ¶
type CreateUserRequest User
CreateUserRequest represent a create user request entity
func (*CreateUserRequest) Validate ¶ added in v0.1.0
func (u *CreateUserRequest) Validate() error
type CreateUserResponse ¶
type CreateUserResponse User
CreateUserResponse represent a create user response entity
type Email ¶
type Email struct { Value string `json:"value,omitempty"` Type string `json:"type,omitempty"` Primary bool `json:"primary,omitempty"` }
Email represent an email entity
type GetGroupResponse ¶ added in v0.0.10
type GetGroupResponse Group
GetGroupResponse represent a group user response entity
type GetUserResponse ¶
type GetUserResponse User
GetUserResponse represent a get user response entity
type Group ¶
type Group struct { ID string `json:"id"` Meta Meta `json:"meta,omitempty"` Schemas []string `json:"schemas,omitempty"` DisplayName string `json:"displayName"` ExternalID string `json:"externalId,omitempty"` Members []*Member `json:"members,omitempty"` }
Group represent a group entity
func (*Group) Validate ¶ added in v0.1.0
Validate check if the group entity is valid according to the SCIM spec constraints Reference: https://docs.aws.amazon.com/singlesignon/latest/developerguide/creategroup.html
type HTTPClient ¶
HTTPClient is an interface for sending HTTP requests.
type HTTPResponseError ¶ added in v0.0.10
type HTTPResponseError struct { StatusCode int `json:"StatusCode"` // Http status code Code string `json:"ErrorCode"` // Datahub error code Message string `json:"ErrorMessage"` // Error msg of the error code }
func (*HTTPResponseError) Error ¶ added in v0.0.10
func (e *HTTPResponseError) Error() string
type ListGroupsResponse ¶
type ListGroupsResponse struct { ListResponse Resources []*Group `json:"Resources"` }
ListGroupsResponse represent a list groups response entity
type ListResponse ¶ added in v0.0.13
type ListResponse struct { TotalResults int `json:"totalResults"` ItemsPerPage int `json:"itemsPerPage"` StartIndex int `json:"startIndex"` Schemas []string `json:"schemas"` }
ListResponse represent a general response entity
type ListUsersResponse ¶
type ListUsersResponse struct { ListResponse Resources []*User `json:"Resources"` }
ListUsersResponse represent a list users response entity
type Member ¶
type Member struct { Value string `json:"value"` Ref string `json:"$ref"` Type string `json:"type"` }
Member represent a member group entity
type Meta ¶
type Meta struct { ResourceType string `json:"resourceType,omitempty"` Created string `json:"created,omitempty"` LastModified string `json:"lastModified,omitempty"` }
Meta represent a meta entity
type Name ¶
type Name struct { Formatted string `json:"formatted,omitempty"` FamilyName string `json:"familyName,omitempty"` GivenName string `json:"givenName,omitempty"` MiddleName string `json:"middleName,omitempty"` HonorificPrefix string `json:"honorificPrefix,omitempty"` HonorificSuffix string `json:"honorificSuffix,omitempty"` }
Name represent a name entity
type Operation ¶
type Operation struct { OP string `json:"op,omitempty"` Path string `json:"path,omitempty"` Value interface{} `json:"value,omitempty"` }
Operation represent an operation entity
type PatchGroupRequest ¶
PatchGroupRequest represent a patch group request entity
type PatchUserRequest ¶
PatchUserRequest represent a patch user request entity
func (*PatchUserRequest) Validate ¶ added in v0.1.0
func (u *PatchUserRequest) Validate() error
type PatchUserResponse ¶ added in v0.0.13
type PatchUserResponse User
PatchUserResponse represent a put user response entity
type PhoneNumber ¶ added in v0.1.0
type PutUserRequest ¶
type PutUserRequest User
PutUserRequest represent a put user request entity
func (*PutUserRequest) Validate ¶ added in v0.1.0
func (u *PutUserRequest) Validate() error
type PutUserResponse ¶
type PutUserResponse User
PutUserResponse represent a put user response entity
type SCIMService ¶
type SCIMService struct { UserAgent string // contains filtered or unexported fields }
SCIMService is an AWS SCIM Service.
func NewSCIMService ¶
func NewSCIMService(httpClient HTTPClient, urlStr, token string) (*SCIMService, error)
NewSCIMService creates a new AWS SCIM Service.
func (*SCIMService) CreateGroup ¶
func (s *SCIMService) CreateGroup(ctx context.Context, cgr *CreateGroupRequest) (*CreateGroupResponse, error)
CreateGroup creates a new group in the AWS SSO Using the API reference: + https://docs.aws.amazon.com/singlesignon/latest/developerguide/creategroup.html
func (*SCIMService) CreateOrGetGroup ¶ added in v0.0.10
func (s *SCIMService) CreateOrGetGroup(ctx context.Context, cgr *CreateGroupRequest) (*CreateGroupResponse, error)
CreateOrGetGroup creates a new group in the AWS SSO Using the API This function will try to create a new group but if received a 409 http error (ConflictException User already exists.) execute a request to get the group information and return it.
NOTE: this function is created to avoid the existing problem with the limitation of the AWS SCIM API about retrieve a maximum of 50 groups at a time.
references: + https://docs.aws.amazon.com/singlesignon/latest/developerguide/creategroup.html + https://docs.aws.amazon.com/singlesignon/latest/developerguide/getgroup.html
func (*SCIMService) CreateOrGetUser ¶ added in v0.0.10
func (s *SCIMService) CreateOrGetUser(ctx context.Context, cur *CreateUserRequest) (*CreateUserResponse, error)
CreateOrGetUser creates a new user or get the user information in the AWS SSO Using the API. This function will try to create a new user but if received a 409 http error (ConflictException User already exists.) execute a request to get the user information and return it.
NOTE: this function is created to avoid the existing problem with the limitation of the AWS SCIM API about retrieve a maximum of 50 users at a time.
references: + https://docs.aws.amazon.com/singlesignon/latest/developerguide/createuser.html + https://docs.aws.amazon.com/singlesignon/latest/developerguide/getuser.html
func (*SCIMService) CreateUser ¶
func (s *SCIMService) CreateUser(ctx context.Context, cur *CreateUserRequest) (*CreateUserResponse, error)
CreateUser creates a new user in the AWS SSO Using the API. references: + https://docs.aws.amazon.com/singlesignon/latest/developerguide/createuser.html
func (*SCIMService) DeleteGroup ¶
func (s *SCIMService) DeleteGroup(ctx context.Context, id string) error
DeleteGroup deletes a group from the AWS SSO Using the API
func (*SCIMService) DeleteUser ¶
func (s *SCIMService) DeleteUser(ctx context.Context, id string) error
DeleteUser deletes a user in the AWS SSO Using the API.
func (*SCIMService) GetGroupByDisplayName ¶ added in v0.0.10
func (s *SCIMService) GetGroupByDisplayName(ctx context.Context, displayName string) (*GetGroupResponse, error)
GetGroupByDisplayName gets a group by display name from AWS SSO Using the API.
func (*SCIMService) GetUser ¶
func (s *SCIMService) GetUser(ctx context.Context, userID string) (*GetUserResponse, error)
GetUser returns an user from the AWS SSO Using the API
func (*SCIMService) GetUserByUserName ¶
func (s *SCIMService) GetUserByUserName(ctx context.Context, userName string) (*GetUserResponse, error)
GetUserByUserName gets a user by username in the AWS SSO Using the API.
func (*SCIMService) ListGroups ¶
func (s *SCIMService) ListGroups(ctx context.Context, filter string) (*ListGroupsResponse, error)
ListGroups returns a list of groups from the AWS SSO Using the API
func (*SCIMService) ListUsers ¶
func (s *SCIMService) ListUsers(ctx context.Context, filter string) (*ListUsersResponse, error)
ListUsers returns a list of users from the AWS SSO Using the API
func (*SCIMService) PatchGroup ¶
func (s *SCIMService) PatchGroup(ctx context.Context, pgr *PatchGroupRequest) error
PatchGroup updates a group in the AWS SSO Using the API
func (*SCIMService) PatchUser ¶
func (s *SCIMService) PatchUser(ctx context.Context, pur *PatchUserRequest) error
PatchUser updates a user in the AWS SSO Using the API
func (*SCIMService) PutUser ¶
func (s *SCIMService) PutUser(ctx context.Context, pur *PutUserRequest) (*PutUserResponse, error)
PutUser creates a new user in the AWS SSO Using the API.
func (*SCIMService) ServiceProviderConfig ¶
func (s *SCIMService) ServiceProviderConfig(ctx context.Context) (*ServiceProviderConfig, error)
ServiceProviderConfig returns additional information about the AWS SSO SCIM implementation references: + https://docs.aws.amazon.com/singlesignon/latest/developerguide/serviceproviderconfig.html
type SchemaEnterpriseUser ¶ added in v0.1.0
type SchemaEnterpriseUser struct { EmployeeNumber string `json:"employeeNumber,omitempty"` CostCenter string `json:"costCenter,omitempty"` Organization string `json:"organization,omitempty"` Division string `json:"division,omitempty"` Department string `json:"department,omitempty"` Manager *Manager `json:"manager,omitempty"` }
type SecretsManagerClientAPI ¶
type SecretsManagerClientAPI interface {
GetSecretValue(ctx context.Context, params *secretsmanager.GetSecretValueInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.GetSecretValueOutput, error)
}
SecretsManagerClientAPI is the interface to consume the secretsmanager client methods.
type SecretsManagerService ¶
type SecretsManagerService struct {
// contains filtered or unexported fields
}
SecretsManagerService is the wrapper for the AWS SecretsManager client.
func NewSecretsManagerService ¶
func NewSecretsManagerService(svc SecretsManagerClientAPI) (*SecretsManagerService, error)
NewSecretsManagerService returns a new SecretsManagerService.
func (*SecretsManagerService) GetSecretValue ¶
func (s *SecretsManagerService) GetSecretValue(ctx context.Context, secretKey string) (string, error)
GetSecretValue returns the secret value for the given secret name or arn.
type ServiceProviderConfig ¶
type ServiceProviderConfig struct { Schemas []string `json:"schemas"` DocumentationURI string `json:"documentationUri"` AuthenticationSchemes []struct { Type string `json:"type"` Name string `json:"name"` Description string `json:"description"` SpecURI string `json:"specURI"` DocumentationURI string `json:"documentationUri"` Primary bool `json:"primary"` } `json:"authenticationSchemes"` Patch struct { Supported bool `json:"supported"` } `json:"patch"` Bulk struct { Supported bool `json:"supported"` MaxOperations int `json:"maxOperations"` MaxPayloadSize int `json:"maxPayloadSize"` } `json:"bulk"` Filter struct { Supported bool `json:"supported"` MaxResults int `json:"maxResults"` } `json:"filter"` ChangePassword struct { Supported bool `json:"supported"` } `json:"changePassword"` Sort struct { Supported bool `json:"supported"` } `json:"sort"` Etag struct { Supported bool `json:"supported"` } `json:"etag"` }
ServiceProviderConfig represent a service provider config entity
type User ¶
type User struct { ID string `json:"id,omitempty"` ExternalID string `json:"externalId,omitempty"` UserName string `json:"userName,omitempty"` DisplayName string `json:"displayName,omitempty"` NickName string `json:"nickName,omitempty"` ProfileURL string `json:"profileURL,omitempty"` UserType string `json:"userType,omitempty"` Title string `json:"title,omitempty"` PreferredLanguage string `json:"preferredLanguage,omitempty"` Locale string `json:"locale,omitempty"` Timezone string `json:"timezone,omitempty"` Name *Name `json:"name,omitempty"` Meta *Meta `json:"meta,omitempty"` SchemaEnterpriseUser *SchemaEnterpriseUser `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User,omitempty"` Schemas []string `json:"schemas,omitempty"` Addresses []Address `json:"addresses,omitempty"` Emails []Email `json:"emails,omitempty"` PhoneNumbers []PhoneNumber `json:"phoneNumbers,omitempty"` Active bool `json:"active,omitempty"` }
User represent a user entity
func (*User) GetPrimaryAddress ¶ added in v0.1.0
GetPrimaryAddress returns the primary address of the user
func (*User) GetPrimaryEmail ¶ added in v0.1.0
GetPrimaryEmail returns the primary email of the user
func (*User) GetPrimaryEmailAddress ¶ added in v0.1.0
GetPrimaryEmailAddress returns the primary email address of the user
func (*User) Validate ¶ added in v0.1.0
Validate check if the user entity is valid according to the SCIM spec constraints Reference: https://docs.aws.amazon.com/singlesignon/latest/developerguide/createuser.html