workmail

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 24 Imported by: 0

README

WorkMail

Parity grade: A · SDK aws-sdk-go-v2/service/workmail@v1.37.2 · last audited 2026-07-12 (43c84585)

Coverage

Metric Value
Operations audited 92 (84 ok, 3 partial, 5 deferred)
Feature families 1 (1 ok)
Known gaps 6
Deferred items 1
Resource leaks clean
Known gaps
  • ListUsers/ListGroups/ListResources/ListGroupsForEntity accept a Filters object (name/email prefix, state) on the wire but the backend silently ignores it and returns the full unfiltered page -- a real SDK client doing a prefix search gets more results than AWS would return. Not fixed this pass (interface-signature change across 4 ops); needs a bd issue.
  • PutAccessControlRule/AccessControlRule don't model ImpersonationRoleIds/NotImpersonationRoleIds (added to the real API after impersonation roles shipped).
  • DescribeUser doesn't model the optional profile fields (City, Company, Country, Department, HiddenFromGlobalAddressList, IdentityProviderIdentityStoreId, IdentityProviderUserId, Initials, JobTitle, MailboxDeprovisionedDate, MailboxProvisionedDate, Office, Street, Telephone, ZipCode).
  • GetMailDomain doesn't return DkimVerificationStatus or the Records (recommended DNS record) list.
  • DescribeOrganization doesn't model MigrationAdmin (interoperability/migration feature not simulated).
  • Organization.State is hardcoded to ACTIVE (org creation is synchronous); real AWS transitions through Creating/Active/etc, but nothing in this backend ever leaves an org in a non-terminal state, so this is a non-issue in practice, not a hidden bug.
Deferred
  • Tags (TagResource/UntagResource/ListTagsForResource) use a raw map (b.tags) NOT included in backendSnapshot -- tags are dropped across restart/restore while every other resource type persists. Confirmed by reading persistence.go's backendSnapshot struct and Snapshot/Restore; not fixed this pass (would need a new persisted field + wire-compatible key, and tags aren't in the audit's stated highest-traffic set). Needs a bd issue.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("EntityNotFoundException", awserr.ErrNotFound)
	// ErrConflict is returned when a resource already exists.
	ErrConflict = awserr.New("EntityAlreadyExistsException", awserr.ErrAlreadyExists)
	// ErrValidation is returned for invalid request parameters.
	ErrValidation = awserr.New("InvalidParameterException", awserr.ErrInvalidParameter)
	// ErrLimitExceeded is returned when resource limits are hit.
	ErrLimitExceeded = awserr.New("LimitExceededException", awserr.ErrConflict)
	// ErrMailDomainState is returned for domain state issues.
	ErrMailDomainState = awserr.New("MailDomainStateException", awserr.ErrConflict)
	// ErrEntityState is returned when an operation violates entity state constraints.
	ErrEntityState = awserr.New("EntityStateException", awserr.ErrConflict)
)

Functions

This section is empty.

Types

type AccessControlRule

type AccessControlRule struct {
	DateCreated  time.Time
	DateModified time.Time
	Name         string
	Effect       string
	Description  string

	IPRanges    []string
	NotIPRanges []string
	Actions     []string
	NotActions  []string
	UserIDs     []string
	NotUserIDs  []string
	// contains filtered or unexported fields
}

AccessControlRule represents a WorkMail access control rule.

type AvailabilityConfiguration

type AvailabilityConfiguration struct {
	DateCreated  time.Time
	DateModified time.Time
	DomainName   string
	ProviderType string
	EwsEndpoint  string
	EwsUsername  string
	LambdaARN    string
	// contains filtered or unexported fields
}

AvailabilityConfiguration holds an availability provider config.

type AvailabilityEwsProvider

type AvailabilityEwsProvider struct {
	EwsEndpoint string
	EwsUsername string
	EwsPassword string
}

AvailabilityEwsProvider holds EWS availability provider credentials.

type DNSRecord

type DNSRecord struct {
	Hostname string
	Type     string
	Value    string
}

DNSRecord is a DNS record for domain verification.

type Delegate

type Delegate struct {
	DelegateID   string
	DelegateType string
}

Delegate represents a resource delegate.

type EmailMonitoringConfiguration

type EmailMonitoringConfiguration struct {
	RoleARN     string
	LogGroupARN string
	// contains filtered or unexported fields
}

EmailMonitoringConfiguration holds email monitoring config.

type EntityDescription

type EntityDescription struct {
	EntityID string
	Name     string
	Type     string
	State    string
}

EntityDescription describes an entity (user, group, resource).

type FolderConfiguration

type FolderConfiguration struct {
	Period *int32
	Name   string
	Action string
}

FolderConfiguration holds a retention policy folder config.

type Group

type Group struct {
	CreatedAt    time.Time
	EnabledDate  time.Time
	DisabledDate time.Time
	GroupID      string
	Name         string
	Email        string
	State        string
	ARN          string

	Hidden bool
	// contains filtered or unexported fields
}

Group represents a WorkMail group.

type GroupSummary

type GroupSummary struct {
	GroupID string
	Name    string
	Email   string
	State   string
}

GroupSummary is a summary of a WorkMail group.

type Handler

type Handler struct {
	Backend StorageBackend
	// contains filtered or unexported fields
}

Handler serves Amazon WorkMail JSON operations.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a WorkMail handler backed by the provided storage backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns operations eligible for fault injection.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns configured service regions.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the signing service name.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name from X-Amz-Target.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(_ *echo.Context) string

ExtractResource returns the primary resource identifier from the request body.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of implemented operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Register

func (h *Handler) Register(_ context.Context, _ *echo.Echo) error

Register registers routes (WorkMail uses no static routes).

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears backend state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher matches WorkMail X-Amz-Target headers.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend. Handler previously had no Snapshot/Restore of its own -- and neither did InMemoryBackend -- so cli.go's generic setupPersistence (which type-asserts the registered service.Registerable, i.e. the Handler, for a Snapshot/Restore pair) never picked WorkMail up at all: dead wiring, with no persistence underneath it either. This delegation (matching the codecommit/codepipeline/emr pattern) is what wires WorkMail into persistence for the first time.

type IdentityProviderConfiguration

type IdentityProviderConfiguration struct {
	PATLifetimeDays           *int32
	AuthMode                  string
	IdentityCenterAppARN      string
	IdentityCenterInstanceARN string
	PATStatus                 string
	// contains filtered or unexported fields
}

IdentityProviderConfiguration holds IdP configuration.

type ImpersonationMatchedRule

type ImpersonationMatchedRule struct {
	RuleID string
	Name   string
}

ImpersonationMatchedRule is a matched impersonation rule.

type ImpersonationRole

type ImpersonationRole struct {
	DateCreated  time.Time
	DateModified time.Time
	RoleID       string
	Name         string
	RoleType     string
	Description  string

	Rules []ImpersonationRule
	// contains filtered or unexported fields
}

ImpersonationRole represents a WorkMail impersonation role.

type ImpersonationRule

type ImpersonationRule struct {
	RuleID         string
	Name           string
	Description    string
	Effect         string
	TargetUsers    []string
	NotTargetUsers []string
}

ImpersonationRule is a rule within an impersonation role.

type InMemoryBackend

type InMemoryBackend struct {
	// contains filtered or unexported fields
}

InMemoryBackend stores WorkMail state in memory.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory WorkMail backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the configured account ID.

func (*InMemoryBackend) AssociateDelegateToResource

func (b *InMemoryBackend) AssociateDelegateToResource(orgID, resourceID, entityID string) error

AssociateDelegateToResource adds a delegate to a resource.

func (*InMemoryBackend) AssociateMemberToGroup

func (b *InMemoryBackend) AssociateMemberToGroup(orgID, groupID, memberID string) error

AssociateMemberToGroup adds a member to a group.

func (*InMemoryBackend) AssumeImpersonationRole

func (b *InMemoryBackend) AssumeImpersonationRole(orgID, roleID string) (string, int64, error)

AssumeImpersonationRole issues a validated token for an impersonation role.

func (*InMemoryBackend) CancelMailboxExportJob

func (b *InMemoryBackend) CancelMailboxExportJob(orgID, jobID string) error

CancelMailboxExportJob cancels a running mailbox export job.

func (*InMemoryBackend) CreateAlias

func (b *InMemoryBackend) CreateAlias(orgID, entityID, alias string) error

CreateAlias creates an email alias for an entity.

func (*InMemoryBackend) CreateAvailabilityConfiguration

func (b *InMemoryBackend) CreateAvailabilityConfiguration(
	orgID, domainName string, ewsProvider *AvailabilityEwsProvider, lambdaARN string,
) (*AvailabilityConfiguration, error)

CreateAvailabilityConfiguration creates an availability configuration for a domain.

func (*InMemoryBackend) CreateGroup

func (b *InMemoryBackend) CreateGroup(orgID, name string, hidden bool) (*Group, error)

CreateGroup creates a new WorkMail group.

func (*InMemoryBackend) CreateIdentityCenterApplication

func (b *InMemoryBackend) CreateIdentityCenterApplication(
	instanceARN, name string,
) (string, error)

CreateIdentityCenterApplication creates a new IAM Identity Center application.

func (*InMemoryBackend) CreateImpersonationRole

func (b *InMemoryBackend) CreateImpersonationRole(
	orgID, name, roleType, description string,
	rules []ImpersonationRule,
) (*ImpersonationRole, error)

CreateImpersonationRole creates a new impersonation role.

func (*InMemoryBackend) CreateMobileDeviceAccessRule

func (b *InMemoryBackend) CreateMobileDeviceAccessRule(
	orgID, name, effect, description string,
	deviceModels, notDeviceModels, deviceTypes, notDeviceTypes,
	deviceOperatingSystems, notDeviceOperatingSystems, deviceUserAgents, notDeviceUserAgents []string,
) (*MobileDeviceAccessRule, error)

CreateMobileDeviceAccessRule creates a mobile device access rule.

func (*InMemoryBackend) CreateOrganization

func (b *InMemoryBackend) CreateOrganization(
	ctx context.Context,
	alias string,
	domains []string,
) (*Organization, error)

CreateOrganization creates a new WorkMail organization.

func (*InMemoryBackend) CreatePersonalAccessToken

func (b *InMemoryBackend) CreatePersonalAccessToken(
	orgID, userID, name string,
	scopes []string,
) (*PersonalAccessToken, error)

CreatePersonalAccessToken creates a new personal access token (for testing).

func (*InMemoryBackend) CreateResource

func (b *InMemoryBackend) CreateResource(
	orgID, name, resourceType, description string,
) (*Resource, error)

CreateResource creates a new WorkMail resource.

func (*InMemoryBackend) CreateUser

func (b *InMemoryBackend) CreateUser(
	orgID, name, displayName, password, role string,
) (*User, error)

CreateUser creates a new WorkMail user.

func (*InMemoryBackend) DeleteAccessControlRule

func (b *InMemoryBackend) DeleteAccessControlRule(orgID, name string) error

DeleteAccessControlRule removes an access control rule.

func (*InMemoryBackend) DeleteAlias

func (b *InMemoryBackend) DeleteAlias(orgID, entityID, alias string) error

DeleteAlias removes an email alias.

func (*InMemoryBackend) DeleteAvailabilityConfiguration

func (b *InMemoryBackend) DeleteAvailabilityConfiguration(orgID, domainName string) error

DeleteAvailabilityConfiguration deletes an availability configuration.

func (*InMemoryBackend) DeleteEmailMonitoringConfiguration

func (b *InMemoryBackend) DeleteEmailMonitoringConfiguration(orgID string) error

DeleteEmailMonitoringConfiguration removes email monitoring config for an org.

func (*InMemoryBackend) DeleteGroup

func (b *InMemoryBackend) DeleteGroup(orgID, entityID string) error

DeleteGroup deletes a group.

func (*InMemoryBackend) DeleteIdentityCenterApplication

func (b *InMemoryBackend) DeleteIdentityCenterApplication(applicationARN string) error

DeleteIdentityCenterApplication removes an IAM Identity Center application.

func (*InMemoryBackend) DeleteIdentityProviderConfiguration

func (b *InMemoryBackend) DeleteIdentityProviderConfiguration(orgID string) error

DeleteIdentityProviderConfiguration removes IdP configuration.

func (*InMemoryBackend) DeleteImpersonationRole

func (b *InMemoryBackend) DeleteImpersonationRole(orgID, roleID string) error

DeleteImpersonationRole removes an impersonation role.

func (*InMemoryBackend) DeleteMailboxPermissions

func (b *InMemoryBackend) DeleteMailboxPermissions(orgID, entityID, granteeID string) error

DeleteMailboxPermissions removes mailbox permissions.

func (*InMemoryBackend) DeleteMobileDeviceAccessOverride

func (b *InMemoryBackend) DeleteMobileDeviceAccessOverride(orgID, userID, deviceID string) error

DeleteMobileDeviceAccessOverride removes a per-user per-device override.

func (*InMemoryBackend) DeleteMobileDeviceAccessRule

func (b *InMemoryBackend) DeleteMobileDeviceAccessRule(orgID, ruleID string) error

DeleteMobileDeviceAccessRule deletes a mobile device access rule.

func (*InMemoryBackend) DeleteOrganization

func (b *InMemoryBackend) DeleteOrganization(orgID string, _ bool) error

DeleteOrganization removes a WorkMail organization. It clears exactly the same set of collections the pre-Phase-3.3 map-based implementation did -- globalAliases, availabilityConfigs, mobileDeviceRules, mobileDeviceOverrides, emailMonitoring, inboundDmarc, retentionPolicies, exportJobs, identityCenterApps, idpConfig, personalTokens, tags, and issuedTokens are deliberately left untouched, matching prior behavior.

func (*InMemoryBackend) DeletePersonalAccessToken

func (b *InMemoryBackend) DeletePersonalAccessToken(orgID, tokenID string) error

DeletePersonalAccessToken removes a personal access token.

func (*InMemoryBackend) DeleteResource

func (b *InMemoryBackend) DeleteResource(orgID, entityID string) error

DeleteResource removes a resource.

func (*InMemoryBackend) DeleteRetentionPolicy

func (b *InMemoryBackend) DeleteRetentionPolicy(orgID, id string) error

DeleteRetentionPolicy removes the retention policy from an org.

func (*InMemoryBackend) DeleteUser

func (b *InMemoryBackend) DeleteUser(orgID, entityID string) error

DeleteUser removes a user.

func (*InMemoryBackend) DeregisterFromWorkMail

func (b *InMemoryBackend) DeregisterFromWorkMail(orgID, entityID string) error

DeregisterFromWorkMail removes an email address assignment.

func (*InMemoryBackend) DeregisterMailDomain

func (b *InMemoryBackend) DeregisterMailDomain(orgID, domainName string) error

DeregisterMailDomain removes a domain from the organization.

func (*InMemoryBackend) DescribeEmailMonitoringConfiguration

func (b *InMemoryBackend) DescribeEmailMonitoringConfiguration(
	orgID string,
) (*EmailMonitoringConfiguration, error)

DescribeEmailMonitoringConfiguration returns email monitoring config for an org.

func (*InMemoryBackend) DescribeEntity

func (b *InMemoryBackend) DescribeEntity(orgID, identifier string) (*EntityDescription, error)

DescribeEntity describes an entity looked up by its primary email address (DescribeEntityInput.Email is the only lookup field the real API accepts -- see aws-sdk-go-v2/service/workmail/api_op_DescribeEntity.go). The plain findUser/findGroup/findResource ID-or-name lookup never matches an email (they only check the composite-key ID and the Name field), so email lookup is checked first via the byEmail reverse-index maps; ID/name is kept as a fallback for backward compatibility with any caller that already has the entity's own ID.

func (*InMemoryBackend) DescribeGroup

func (b *InMemoryBackend) DescribeGroup(orgID, entityID string) (*Group, error)

DescribeGroup returns group details.

func (*InMemoryBackend) DescribeIdentityProviderConfiguration

func (b *InMemoryBackend) DescribeIdentityProviderConfiguration(
	orgID string,
) (*IdentityProviderConfiguration, error)

DescribeIdentityProviderConfiguration returns IdP configuration for an org.

func (*InMemoryBackend) DescribeInboundDmarcSettings

func (b *InMemoryBackend) DescribeInboundDmarcSettings(orgID string) (bool, error)

DescribeInboundDmarcSettings returns whether inbound DMARC is enforced for an org.

func (*InMemoryBackend) DescribeMailboxExportJob

func (b *InMemoryBackend) DescribeMailboxExportJob(orgID, jobID string) (*MailboxExportJob, error)

DescribeMailboxExportJob returns details of a mailbox export job.

func (*InMemoryBackend) DescribeOrganization

func (b *InMemoryBackend) DescribeOrganization(orgID string) (*Organization, error)

DescribeOrganization returns details about an organization.

func (*InMemoryBackend) DescribeResource

func (b *InMemoryBackend) DescribeResource(orgID, entityID string) (*Resource, error)

DescribeResource returns resource details.

func (*InMemoryBackend) DescribeUser

func (b *InMemoryBackend) DescribeUser(orgID, entityID string) (*User, error)

DescribeUser returns details about a user.

func (*InMemoryBackend) DisassociateDelegateFromResource

func (b *InMemoryBackend) DisassociateDelegateFromResource(
	orgID, resourceID, entityID string,
) error

DisassociateDelegateFromResource removes a delegate from a resource.

func (*InMemoryBackend) DisassociateMemberFromGroup

func (b *InMemoryBackend) DisassociateMemberFromGroup(orgID, groupID, memberID string) error

DisassociateMemberFromGroup removes a member from a group.

func (*InMemoryBackend) GetAccessControlEffect

func (b *InMemoryBackend) GetAccessControlEffect(
	orgID, ipAddr, action, userID string,
) (string, []string, error)

GetAccessControlEffect evaluates access control rules.

func (*InMemoryBackend) GetDefaultRetentionPolicy

func (b *InMemoryBackend) GetDefaultRetentionPolicy(orgID string) (*RetentionPolicy, error)

GetDefaultRetentionPolicy returns the retention policy for an org.

func (*InMemoryBackend) GetImpersonationRole

func (b *InMemoryBackend) GetImpersonationRole(orgID, roleID string) (*ImpersonationRole, error)

GetImpersonationRole returns an impersonation role.

func (*InMemoryBackend) GetImpersonationRoleEffect

func (b *InMemoryBackend) GetImpersonationRoleEffect(
	orgID, roleID, targetUser string,
) (string, string, []*ImpersonationMatchedRule, error)

GetImpersonationRoleEffect evaluates impersonation rules for a target user.

func (*InMemoryBackend) GetMailDomain

func (b *InMemoryBackend) GetMailDomain(orgID, domainName string) (*MailDomain, error)

GetMailDomain returns details about a registered domain.

func (*InMemoryBackend) GetMailboxDetails

func (b *InMemoryBackend) GetMailboxDetails(orgID, userID string) (*MailboxDetails, error)

GetMailboxDetails returns mailbox quota and usage.

func (*InMemoryBackend) GetMobileDeviceAccessEffect

func (b *InMemoryBackend) GetMobileDeviceAccessEffect(
	orgID, deviceType, deviceModel, deviceOS, deviceUserAgent string,
) (string, []*MobileDeviceMatchedRule, error)

GetMobileDeviceAccessEffect evaluates rules for a simulated device.

func (*InMemoryBackend) GetMobileDeviceAccessOverride

func (b *InMemoryBackend) GetMobileDeviceAccessOverride(
	orgID, userID, deviceID string,
) (*MobileDeviceAccessOverride, error)

GetMobileDeviceAccessOverride retrieves a per-user per-device override.

func (*InMemoryBackend) GetPersonalAccessTokenMetadata

func (b *InMemoryBackend) GetPersonalAccessTokenMetadata(
	orgID, tokenID string,
) (*PersonalAccessToken, error)

GetPersonalAccessTokenMetadata returns metadata for a personal access token.

func (*InMemoryBackend) ListAccessControlRules

func (b *InMemoryBackend) ListAccessControlRules(orgID string) ([]*AccessControlRule, error)

ListAccessControlRules returns all access control rules.

func (*InMemoryBackend) ListAliases

func (b *InMemoryBackend) ListAliases(
	orgID, entityID string,
	maxResults int32,
	nextToken string,
) ([]string, string, error)

ListAliases returns aliases for an entity.

func (*InMemoryBackend) ListAvailabilityConfigurations

func (b *InMemoryBackend) ListAvailabilityConfigurations(
	orgID string, maxResults int32, nextToken string,
) ([]*AvailabilityConfiguration, string, error)

ListAvailabilityConfigurations lists availability configurations for an org.

func (*InMemoryBackend) ListGroupMembers

func (b *InMemoryBackend) ListGroupMembers(
	orgID, groupID string,
	maxResults int32,
	nextToken string,
) ([]*Member, string, error)

ListGroupMembers returns members of a group.

func (*InMemoryBackend) ListGroups

func (b *InMemoryBackend) ListGroups(
	orgID string,
	maxResults int32,
	nextToken string,
) ([]*GroupSummary, string, error)

ListGroups returns a paginated list of groups.

func (*InMemoryBackend) ListGroupsForEntity

func (b *InMemoryBackend) ListGroupsForEntity(
	orgID, entityID string,
	maxResults int32,
	nextToken string,
) ([]*GroupSummary, string, error)

ListGroupsForEntity returns groups containing the given entity.

func (*InMemoryBackend) ListImpersonationRoles

func (b *InMemoryBackend) ListImpersonationRoles(
	orgID string,
	maxResults int32,
	nextToken string,
) ([]*ImpersonationRole, string, error)

ListImpersonationRoles returns impersonation roles.

func (*InMemoryBackend) ListMailDomains

func (b *InMemoryBackend) ListMailDomains(
	orgID string,
	maxResults int32,
	nextToken string,
) ([]*MailDomainSummary, string, error)

ListMailDomains returns a paginated list of mail domains.

func (*InMemoryBackend) ListMailboxExportJobs

func (b *InMemoryBackend) ListMailboxExportJobs(
	orgID string, maxResults int32, nextToken string,
) ([]*MailboxExportJob, string, error)

ListMailboxExportJobs lists mailbox export jobs for an org.

func (*InMemoryBackend) ListMailboxPermissions

func (b *InMemoryBackend) ListMailboxPermissions(
	orgID, entityID string,
	maxResults int32,
	nextToken string,
) ([]*Permission, string, error)

ListMailboxPermissions returns mailbox permissions for an entity.

func (*InMemoryBackend) ListMobileDeviceAccessOverrides

func (b *InMemoryBackend) ListMobileDeviceAccessOverrides(
	orgID, userID, deviceID string, maxResults int32, nextToken string,
) ([]*MobileDeviceAccessOverride, string, error)

ListMobileDeviceAccessOverrides lists overrides filtered by userID and/or deviceID.

func (*InMemoryBackend) ListMobileDeviceAccessRules

func (b *InMemoryBackend) ListMobileDeviceAccessRules(
	orgID string,
) ([]*MobileDeviceAccessRule, error)

ListMobileDeviceAccessRules lists all mobile device access rules for an org.

func (*InMemoryBackend) ListOrganizations

func (b *InMemoryBackend) ListOrganizations(
	ctx context.Context,
	maxResults int32,
	nextToken string,
) ([]*OrgSummary, string, error)

ListOrganizations returns a paginated list of organizations.

func (*InMemoryBackend) ListPersonalAccessTokens

func (b *InMemoryBackend) ListPersonalAccessTokens(
	orgID, userID string, maxResults int32, nextToken string,
) ([]*PersonalAccessToken, string, error)

ListPersonalAccessTokens lists personal access tokens, optionally filtered by userID.

func (*InMemoryBackend) ListResourceDelegates

func (b *InMemoryBackend) ListResourceDelegates(
	orgID, resourceID string,
	maxResults int32,
	nextToken string,
) ([]*Delegate, string, error)

ListResourceDelegates returns delegates of a resource.

func (*InMemoryBackend) ListResources

func (b *InMemoryBackend) ListResources(
	orgID string,
	maxResults int32,
	nextToken string,
) ([]*ResourceSummary, string, error)

ListResources returns a paginated list of resources.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(resourceARN string) ([]Tag, error)

ListTagsForResource returns tags for a resource.

func (*InMemoryBackend) ListUsers

func (b *InMemoryBackend) ListUsers(
	orgID string,
	maxResults int32,
	nextToken string,
) ([]*UserSummary, string, error)

ListUsers returns a paginated list of users.

func (*InMemoryBackend) PutAccessControlRule

func (b *InMemoryBackend) PutAccessControlRule(
	orgID, name, effect, description string,
	ipRanges, notIPRanges []string,
	actions, notActions []string,
	userIDs, notUserIDs []string,
) (*AccessControlRule, error)

PutAccessControlRule creates or updates an access control rule.

func (*InMemoryBackend) PutEmailMonitoringConfiguration

func (b *InMemoryBackend) PutEmailMonitoringConfiguration(
	orgID, roleARN, logGroupARN string,
) error

PutEmailMonitoringConfiguration sets email monitoring config for an org.

func (*InMemoryBackend) PutIdentityProviderConfiguration

func (b *InMemoryBackend) PutIdentityProviderConfiguration(
	orgID, authMode, identityCenterAppARN, identityCenterInstanceARN, patStatus string,
	patLifetimeDays int32,
) error

PutIdentityProviderConfiguration creates or updates IdP configuration.

func (*InMemoryBackend) PutInboundDmarcSettings

func (b *InMemoryBackend) PutInboundDmarcSettings(orgID string, enforced bool) error

PutInboundDmarcSettings sets inbound DMARC enforcement for an org.

func (*InMemoryBackend) PutMailboxPermissions

func (b *InMemoryBackend) PutMailboxPermissions(
	orgID, entityID, granteeID string,
	perms []string,
) error

PutMailboxPermissions creates or updates mailbox permissions.

func (*InMemoryBackend) PutMobileDeviceAccessOverride

func (b *InMemoryBackend) PutMobileDeviceAccessOverride(
	orgID, userID, deviceID, effect, description string,
) error

PutMobileDeviceAccessOverride creates or updates a per-user per-device override.

func (*InMemoryBackend) PutRetentionPolicy

func (b *InMemoryBackend) PutRetentionPolicy(
	orgID, id, name, description string, folderConfigurations []*FolderConfiguration,
) error

PutRetentionPolicy creates or updates a retention policy for an org.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the configured region.

func (*InMemoryBackend) RegisterMailDomain

func (b *InMemoryBackend) RegisterMailDomain(orgID, domainName string) error

RegisterMailDomain registers a domain with the organization.

func (*InMemoryBackend) RegisterToWorkMail

func (b *InMemoryBackend) RegisterToWorkMail(orgID, entityID, email string) error

RegisterToWorkMail assigns an email address to a user/group/resource.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored state.

func (*InMemoryBackend) ResetPassword

func (b *InMemoryBackend) ResetPassword(orgID, userID, _ string) error

ResetPassword updates the user's password (simulated — no-op).

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore deserializes backend state from a snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) StartMailboxExportJob

func (b *InMemoryBackend) StartMailboxExportJob(
	orgID, entityID, description, roleARN, kmsKeyARN, s3BucketName, s3Prefix string,
) (*MailboxExportJob, error)

StartMailboxExportJob starts a mailbox export job.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(resourceARN string, tags []Tag) error

TagResource adds tags to a resource.

func (*InMemoryBackend) TestAvailabilityConfiguration

func (b *InMemoryBackend) TestAvailabilityConfiguration(
	orgID, domainName string,
) (bool, string, error)

TestAvailabilityConfiguration simulates testing a configuration.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(resourceARN string, tagKeys []string) error

UntagResource removes tags from a resource.

func (*InMemoryBackend) UpdateAvailabilityConfiguration

func (b *InMemoryBackend) UpdateAvailabilityConfiguration(
	orgID, domainName string, ewsProvider *AvailabilityEwsProvider, lambdaARN string,
) error

UpdateAvailabilityConfiguration updates an existing availability configuration.

func (*InMemoryBackend) UpdateDefaultMailDomain

func (b *InMemoryBackend) UpdateDefaultMailDomain(orgID, domainName string) error

UpdateDefaultMailDomain changes the default mail domain.

func (*InMemoryBackend) UpdateGroup

func (b *InMemoryBackend) UpdateGroup(orgID, entityID string, hidden bool) error

UpdateGroup updates a group.

func (*InMemoryBackend) UpdateImpersonationRole

func (b *InMemoryBackend) UpdateImpersonationRole(
	orgID, roleID, name, roleType, description string,
	rules []ImpersonationRule,
) error

UpdateImpersonationRole updates an impersonation role.

func (*InMemoryBackend) UpdateMailboxQuota

func (b *InMemoryBackend) UpdateMailboxQuota(orgID, userID string, quota int32) error

UpdateMailboxQuota updates the mailbox quota for a user.

func (*InMemoryBackend) UpdateMobileDeviceAccessRule

func (b *InMemoryBackend) UpdateMobileDeviceAccessRule(
	orgID, ruleID, name, effect, description string,
	deviceModels, notDeviceModels, deviceTypes, notDeviceTypes,
	deviceOperatingSystems, notDeviceOperatingSystems, deviceUserAgents, notDeviceUserAgents []string,
) error

UpdateMobileDeviceAccessRule updates a mobile device access rule.

func (*InMemoryBackend) UpdatePrimaryEmailAddress

func (b *InMemoryBackend) UpdatePrimaryEmailAddress(orgID, entityID, email string) error

UpdatePrimaryEmailAddress updates the primary email of an entity.

func (*InMemoryBackend) UpdateResource

func (b *InMemoryBackend) UpdateResource(orgID, entityID, name, description string) error

UpdateResource updates resource fields.

func (*InMemoryBackend) UpdateUser

func (b *InMemoryBackend) UpdateUser(
	orgID, entityID, displayName, firstName, lastName string,
) error

UpdateUser updates display name and name fields.

type MailDomain

type MailDomain struct {
	DomainName                  string
	OwnershipVerificationStatus string
	MxRecord                    string

	Records      []DNSRecord
	IsDefault    bool
	IsTestDomain bool
	// contains filtered or unexported fields
}

MailDomain represents a registered mail domain.

type MailDomainSummary

type MailDomainSummary struct {
	DomainName   string
	IsDefault    bool
	IsTestDomain bool
}

MailDomainSummary is a summary of a registered mail domain.

type MailboxDetails

type MailboxDetails struct {
	MailboxQuota int32
	MailboxSize  float64
}

MailboxDetails holds mailbox quota/storage info.

type MailboxExportJob

type MailboxExportJob struct {
	StartTime    time.Time
	EndTime      time.Time
	S3Prefix     string
	RoleARN      string
	KmsKeyARN    string
	S3BucketName string
	JobID        string
	S3Path       string
	State        string
	ErrorInfo    string
	Description  string
	EntityID     string

	EstimatedProgress int32
	// contains filtered or unexported fields
}

MailboxExportJob holds a mailbox export job.

type Member

type Member struct {
	EnabledDate  time.Time
	DisabledDate time.Time
	MemberID     string
	Name         string
	State        string
	MemberType   string
}

Member represents a group member.

type MobileDeviceAccessOverride

type MobileDeviceAccessOverride struct {
	DateCreated  time.Time
	DateModified time.Time
	UserID       string
	DeviceID     string
	Effect       string
	Description  string
	// contains filtered or unexported fields
}

MobileDeviceAccessOverride holds a per-user per-device override.

type MobileDeviceAccessRule

type MobileDeviceAccessRule struct {
	DateModified time.Time
	DateCreated  time.Time

	RuleID                    string
	Name                      string
	Effect                    string
	Description               string
	DeviceModels              []string
	DeviceTypes               []string
	NotDeviceTypes            []string
	DeviceOperatingSystems    []string
	NotDeviceOperatingSystems []string
	DeviceUserAgents          []string
	NotDeviceUserAgents       []string
	NotDeviceModels           []string
	// contains filtered or unexported fields
}

MobileDeviceAccessRule holds a mobile device access rule.

type MobileDeviceMatchedRule

type MobileDeviceMatchedRule struct {
	RuleID string
	Name   string
}

MobileDeviceMatchedRule is a matched rule summary.

type OrgSummary

type OrgSummary struct {
	OrgID             string
	Alias             string
	DefaultMailDomain string
	State             string
	ErrorMessage      string
}

OrgSummary is a summary of a WorkMail organization.

type Organization

type Organization struct {
	CreatedAt         time.Time
	CompletedDate     time.Time
	OrgID             string
	Alias             string
	ARN               string
	State             string
	DirectoryID       string
	DirectoryType     string
	DefaultMailDomain string
	ErrorMessage      string
	Region            string
}

Organization represents a WorkMail organization.

type Permission

type Permission struct {
	GranteeID   string
	GranteeType string

	Permissions []string
	// contains filtered or unexported fields
}

Permission represents a mailbox permission.

type PersonalAccessToken

type PersonalAccessToken struct {
	DateCreated  time.Time
	DateLastUsed time.Time
	ExpiresTime  time.Time
	TokenID      string
	UserID       string
	Name         string

	Scopes []string
	// contains filtered or unexported fields
}

PersonalAccessToken holds PAT metadata.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon WorkMail.

func (*Provider) Init

Init creates a WorkMail backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Resource

type Resource struct {
	CreatedAt    time.Time
	EnabledDate  time.Time
	DisabledDate time.Time
	ResourceID   string
	Name         string
	Email        string
	ResourceType string
	Description  string
	State        string
	ARN          string
	// contains filtered or unexported fields
}

Resource represents a WorkMail resource.

type ResourceSummary

type ResourceSummary struct {
	ResourceID   string
	Name         string
	Email        string
	ResourceType string
	State        string
	Description  string
}

ResourceSummary is a summary of a WorkMail resource.

type RetentionPolicy

type RetentionPolicy struct {
	ID          string
	Name        string
	Description string

	FolderConfigurations []*FolderConfiguration
	// contains filtered or unexported fields
}

RetentionPolicy holds a retention policy.

type StorageBackend

type StorageBackend interface {
	// Organizations
	CreateOrganization(ctx context.Context, alias string, domains []string) (*Organization, error)
	DescribeOrganization(orgID string) (*Organization, error)
	DeleteOrganization(orgID string, deleteDirectory bool) error
	ListOrganizations(ctx context.Context, maxResults int32, nextToken string) ([]*OrgSummary, string, error)

	// Users
	CreateUser(orgID, name, displayName, password string, role string) (*User, error)
	DescribeUser(orgID, entityID string) (*User, error)
	UpdateUser(orgID, entityID, displayName, firstName, lastName string) error
	DeleteUser(orgID, entityID string) error
	ListUsers(orgID string, maxResults int32, nextToken string) ([]*UserSummary, string, error)
	RegisterToWorkMail(orgID, entityID, email string) error
	DeregisterFromWorkMail(orgID, entityID string) error
	ResetPassword(orgID, userID, password string) error
	GetMailboxDetails(orgID, userID string) (*MailboxDetails, error)
	UpdateMailboxQuota(orgID, userID string, quota int32) error
	UpdatePrimaryEmailAddress(orgID, entityID, email string) error

	// Groups
	CreateGroup(orgID, name string, hidden bool) (*Group, error)
	DescribeGroup(orgID, entityID string) (*Group, error)
	UpdateGroup(orgID, entityID string, hidden bool) error
	DeleteGroup(orgID, entityID string) error
	ListGroups(orgID string, maxResults int32, nextToken string) ([]*GroupSummary, string, error)
	AssociateMemberToGroup(orgID, groupID, memberID string) error
	DisassociateMemberFromGroup(orgID, groupID, memberID string) error
	ListGroupMembers(orgID, groupID string, maxResults int32, nextToken string) ([]*Member, string, error)
	ListGroupsForEntity(orgID, entityID string, maxResults int32, nextToken string) ([]*GroupSummary, string, error)

	// Resources
	CreateResource(orgID, name, resourceType, description string) (*Resource, error)
	DescribeResource(orgID, entityID string) (*Resource, error)
	UpdateResource(orgID, entityID, name, description string) error
	DeleteResource(orgID, entityID string) error
	ListResources(orgID string, maxResults int32, nextToken string) ([]*ResourceSummary, string, error)
	AssociateDelegateToResource(orgID, resourceID, entityID string) error
	DisassociateDelegateFromResource(orgID, resourceID, entityID string) error
	ListResourceDelegates(orgID, resourceID string, maxResults int32, nextToken string) ([]*Delegate, string, error)

	// Aliases
	CreateAlias(orgID, entityID, alias string) error
	DeleteAlias(orgID, entityID, alias string) error
	ListAliases(orgID, entityID string, maxResults int32, nextToken string) ([]string, string, error)

	// Mailbox permissions
	PutMailboxPermissions(orgID, entityID, granteeID string, perms []string) error
	DeleteMailboxPermissions(orgID, entityID, granteeID string) error
	ListMailboxPermissions(orgID, entityID string, maxResults int32, nextToken string) ([]*Permission, string, error)

	// Mail domains
	RegisterMailDomain(orgID, domainName string) error
	DeregisterMailDomain(orgID, domainName string) error
	GetMailDomain(orgID, domainName string) (*MailDomain, error)
	ListMailDomains(orgID string, maxResults int32, nextToken string) ([]*MailDomainSummary, string, error)
	UpdateDefaultMailDomain(orgID, domainName string) error

	// Access control rules
	PutAccessControlRule(
		orgID, name, effect, description string,
		ipRanges, notIPRanges []string,
		actions, notActions []string,
		userIDs, notUserIDs []string,
	) (*AccessControlRule, error)
	DeleteAccessControlRule(orgID, name string) error
	GetAccessControlEffect(orgID, ipAddr, action, userID string) (string, []string, error)
	ListAccessControlRules(orgID string) ([]*AccessControlRule, error)

	// Impersonation roles
	CreateImpersonationRole(
		orgID, name, roleType, description string,
		rules []ImpersonationRule,
	) (*ImpersonationRole, error)
	GetImpersonationRole(orgID, roleID string) (*ImpersonationRole, error)
	UpdateImpersonationRole(orgID, roleID, name, roleType, description string, rules []ImpersonationRule) error
	DeleteImpersonationRole(orgID, roleID string) error
	ListImpersonationRoles(orgID string, maxResults int32, nextToken string) ([]*ImpersonationRole, string, error)

	// Tags
	TagResource(resourceARN string, tags []Tag) error
	UntagResource(resourceARN string, tagKeys []string) error
	ListTagsForResource(resourceARN string) ([]Tag, error)

	// Describe entity (user, group, or resource by email or ID)
	DescribeEntity(orgID, email string) (*EntityDescription, error)

	// Availability configurations
	CreateAvailabilityConfiguration(
		orgID, domainName string,
		ewsProvider *AvailabilityEwsProvider,
		lambdaARN string,
	) (*AvailabilityConfiguration, error)
	DeleteAvailabilityConfiguration(orgID, domainName string) error
	UpdateAvailabilityConfiguration(
		orgID, domainName string,
		ewsProvider *AvailabilityEwsProvider,
		lambdaARN string,
	) error
	ListAvailabilityConfigurations(
		orgID string,
		maxResults int32,
		nextToken string,
	) ([]*AvailabilityConfiguration, string, error)
	TestAvailabilityConfiguration(orgID, domainName string) (bool, string, error)

	// Mobile device access rules
	CreateMobileDeviceAccessRule(orgID, name, effect, description string,
		deviceModels, notDeviceModels, deviceTypes, notDeviceTypes,
		deviceOperatingSystems, notDeviceOperatingSystems, deviceUserAgents, notDeviceUserAgents []string,
	) (*MobileDeviceAccessRule, error)
	DeleteMobileDeviceAccessRule(orgID, ruleID string) error
	UpdateMobileDeviceAccessRule(orgID, ruleID, name, effect, description string,
		deviceModels, notDeviceModels, deviceTypes, notDeviceTypes,
		deviceOperatingSystems, notDeviceOperatingSystems, deviceUserAgents, notDeviceUserAgents []string,
	) error
	ListMobileDeviceAccessRules(orgID string) ([]*MobileDeviceAccessRule, error)
	GetMobileDeviceAccessEffect(
		orgID, deviceType, deviceModel, deviceOS, deviceUserAgent string,
	) (string, []*MobileDeviceMatchedRule, error)

	// Mobile device access overrides
	PutMobileDeviceAccessOverride(orgID, userID, deviceID, effect, description string) error
	DeleteMobileDeviceAccessOverride(orgID, userID, deviceID string) error
	GetMobileDeviceAccessOverride(orgID, userID, deviceID string) (*MobileDeviceAccessOverride, error)
	ListMobileDeviceAccessOverrides(
		orgID, userID, deviceID string,
		maxResults int32,
		nextToken string,
	) ([]*MobileDeviceAccessOverride, string, error)

	// Email monitoring configuration
	PutEmailMonitoringConfiguration(orgID, roleARN, logGroupARN string) error
	DeleteEmailMonitoringConfiguration(orgID string) error
	DescribeEmailMonitoringConfiguration(orgID string) (*EmailMonitoringConfiguration, error)

	// Inbound DMARC settings
	PutInboundDmarcSettings(orgID string, enforced bool) error
	DescribeInboundDmarcSettings(orgID string) (bool, error)

	// Retention policies
	PutRetentionPolicy(orgID, id, name, description string, folderConfigurations []*FolderConfiguration) error
	DeleteRetentionPolicy(orgID, id string) error
	GetDefaultRetentionPolicy(orgID string) (*RetentionPolicy, error)

	// Mailbox export jobs
	StartMailboxExportJob(
		orgID, entityID, description, roleARN, kmsKeyARN, s3BucketName, s3Prefix string,
	) (*MailboxExportJob, error)
	CancelMailboxExportJob(orgID, jobID string) error
	DescribeMailboxExportJob(orgID, jobID string) (*MailboxExportJob, error)
	ListMailboxExportJobs(orgID string, maxResults int32, nextToken string) ([]*MailboxExportJob, string, error)

	// Identity center applications
	CreateIdentityCenterApplication(instanceARN, name string) (string, error)
	DeleteIdentityCenterApplication(applicationARN string) error

	// Identity provider configuration
	PutIdentityProviderConfiguration(
		orgID, authMode string,
		identityCenterAppARN, identityCenterInstanceARN, patStatus string,
		patLifetimeDays int32,
	) error
	DeleteIdentityProviderConfiguration(orgID string) error
	DescribeIdentityProviderConfiguration(orgID string) (*IdentityProviderConfiguration, error)

	// Personal access tokens
	DeletePersonalAccessToken(orgID, tokenID string) error
	GetPersonalAccessTokenMetadata(orgID, tokenID string) (*PersonalAccessToken, error)
	ListPersonalAccessTokens(
		orgID, userID string,
		maxResults int32,
		nextToken string,
	) ([]*PersonalAccessToken, string, error)

	// Impersonation role effect
	GetImpersonationRoleEffect(orgID, roleID, targetUser string) (string, string, []*ImpersonationMatchedRule, error)

	// Assume impersonation role
	AssumeImpersonationRole(orgID, roleID string) (string, int64, error)

	AccountID() string
	Region() string
	Reset()

	// Snapshot and Restore implement persistence.Persistable. Handler
	// delegates to them (see persistence.go) so cli.go's generic
	// setupPersistence picks WorkMail up.
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend is the interface for WorkMail storage operations.

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is a key-value tag.

type User

type User struct {
	CreatedAt    time.Time
	EnabledDate  time.Time
	DisabledDate time.Time
	UserID       string
	Name         string
	Email        string
	DisplayName  string
	FirstName    string
	LastName     string
	Role         string
	State        string
	ARN          string
	// contains filtered or unexported fields
}

User represents a WorkMail user.

type UserSummary

type UserSummary struct {
	UserID      string
	Name        string
	Email       string
	DisplayName string
	State       string
	Role        string
}

UserSummary is a summary of a WorkMail user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL