support

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: 22 Imported by: 0

README

Support

Parity grade: A · SDK aws-sdk-go-v2/service/support@v1.31.23 · last audited 2026-07-13 (139000b9)

Coverage

Metric Value
Operations audited 16 (16 ok)
Feature families 3 (3 ok)
Known gaps none
Deferred items 1
Resource leaks clean
Deferred
  • integration test suite (test/integration/*_parity_test.go) was not run this pass — only unit tests; see parity-principles.md note 3 that unit tests are not full proof. No SDK client round-trip was exercised.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when a support case is not found.
	ErrNotFound = awserr.New("CaseIdNotFound", awserr.ErrNotFound)
	// ErrAttachmentNotFound is returned when an attachment is not found.
	ErrAttachmentNotFound = awserr.New("AttachmentIdNotFound", awserr.ErrNotFound)
	// ErrValidation is returned when required input fields are missing or invalid.
	ErrValidation = awserr.New("ValidationError", awserr.ErrInvalidParameter)
	// ErrAttachmentSetNotFound indicates an unknown staged attachment set.
	ErrAttachmentSetNotFound = awserr.New("AttachmentSetIdNotFound", awserr.ErrNotFound)
	// ErrAttachmentSetExpired indicates a staged attachment set passed its one-hour lifetime.
	ErrAttachmentSetExpired = awserr.New("AttachmentSetExpired", awserr.ErrInvalidParameter)
)
View Source
var ErrNilAppContext = errors.New("support: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

Functions

This section is empty.

Types

type AddCommunicationOptions

type AddCommunicationOptions struct {
	CaseID            string
	CommunicationBody string
	AttachmentSetID   string
	CCEmails          []string
}

AddCommunicationOptions contains API-visible communication input data.

type Attachment

type Attachment struct {
	AttachmentID string `json:"attachmentId"`
	FileName     string `json:"fileName"`
	Data         []byte `json:"data"`
}

Attachment represents a file attachment for a support case communication.

type AttachmentRef

type AttachmentRef struct {
	AttachmentID string `json:"attachmentId"`
	FileName     string `json:"fileName"`
}

AttachmentRef identifies an attachment included in a communication.

type AttachmentSet

type AttachmentSet struct {
	// ID is the attachment set ID this value is keyed by in the
	// attachmentSets Table (see store_setup.go). It is tagged json:"-"
	// because attachmentSets is a "dirty" table -- persistence.go instead
	// round-trips it through a dedicated attachmentSetSnapshot DTO that
	// carries the ID as a real JSON field, so it survives the round trip
	// despite being excluded here. It must never change after the set is
	// created (store.Table's keyFn purity requirement).
	ID            string    `json:"-"`
	Expiry        time.Time `json:"expiry"`
	AttachmentIDs []string  `json:"attachmentIds"`
}

AttachmentSet holds staged attachments until a case communication consumes them.

type Case

type Case struct {
	CreatedTime  time.Time  `json:"createdTime"`
	ResolvedTime *time.Time `json:"resolvedTime,omitempty"`
	ServiceCode  string     `json:"serviceCode"`
	DisplayID    string     `json:"displayId"`
	Subject      string     `json:"subject"`
	Status       string     `json:"status"`
	CaseID       string     `json:"caseID"`
	CategoryCode string     `json:"categoryCode"`
	SeverityCode string     `json:"severityCode"`
	Language     string     `json:"language"`
	IssueType    string     `json:"issueType"`
	SubmittedBy  string     `json:"submittedBy"`
	Body         string     `json:"body"`
	CCEmails     []string   `json:"ccEmailAddresses"`
}

Case represents an AWS Support case.

type Communication

type Communication struct {
	TimeCreated     time.Time       `json:"timeCreated"`
	SubmittedBy     string          `json:"submittedBy"`
	Body            string          `json:"body"`
	CaseID          string          `json:"caseId"`
	AttachmentSetID string          `json:"attachmentSetId,omitempty"`
	AttachmentSet   []AttachmentRef `json:"attachmentSet,omitempty"`
	CCEmails        []string        `json:"ccEmailAddresses,omitempty"`
}

Communication represents a message added to a support case.

type CommunicationTypeOptions

type CommunicationTypeOptions struct {
	Type                string          `json:"type"`
	SupportedHours      []SupportedHour `json:"supportedHours"`
	DatesWithoutSupport []DateInterval  `json:"datesWithoutSupport"`
}

CommunicationTypeOptions represents communication options for a case type.

type CreateCaseOptions

type CreateCaseOptions struct {
	Subject           string
	ServiceCode       string
	CategoryCode      string
	SeverityCode      string
	CommunicationBody string
	AttachmentSetID   string
	Language          string
	IssueType         string
	CCEmails          []string
}

CreateCaseOptions contains API-visible case creation data.

type DateInterval

type DateInterval struct {
	StartDateTime string `json:"startDateTime"`
	EndDateTime   string `json:"endDateTime"`
}

DateInterval represents a start/end date range.

type DescribeCasesOptions

type DescribeCasesOptions struct {
	AfterTime             *time.Time
	BeforeTime            *time.Time
	DisplayID             string
	Language              string
	NextToken             string
	CaseIDs               []string
	MaxResults            int
	IncludeResolvedCases  bool
	IncludeCommunications bool
}

DescribeCasesOptions contains supported case query and pagination filters.

type DescribeCommunicationsOptions

type DescribeCommunicationsOptions struct {
	AfterTime  *time.Time
	BeforeTime *time.Time
	CaseID     string
	NextToken  string
	MaxResults int
}

DescribeCommunicationsOptions contains communication filters and pagination data.

type DescribeCreateCaseOptionsResult

type DescribeCreateCaseOptionsResult struct {
	LanguageAvailability string                     `json:"languageAvailability"`
	CommunicationTypes   []CommunicationTypeOptions `json:"communicationTypes"`
}

DescribeCreateCaseOptionsResult is the result from DescribeCreateCaseOptions.

type Handler

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

Handler is the Echo HTTP handler for AWS Support operations.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new Support handler.

func (*Handler) ChaosOperations

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

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

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

ChaosRegions returns all regions this Support instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

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

ExtractOperation extracts the Support action from the X-Amz-Target header.

func (*Handler) ExtractResource

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

ExtractResource extracts the case ID from the request body.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns the list of supported Support 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 the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears the handler's 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 returns a function that matches Support requests.

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context)

Shutdown stops the background janitor.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker starts the background janitor for attachment sets.

type InMemoryBackend

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

InMemoryBackend is the in-memory store for Support cases.

func NewInMemoryBackend

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates a new InMemoryBackend.

func (*InMemoryBackend) AddAttachmentInternal

func (b *InMemoryBackend) AddAttachmentInternal(a *Attachment)

AddAttachmentInternal seeds an attachment directly into the backend (for testing).

func (*InMemoryBackend) AddAttachmentsToSet

func (b *InMemoryBackend) AddAttachmentsToSet(attachmentSetID string) (string, time.Time, error)

AddAttachmentsToSet creates a new attachment set and returns its ID.

func (*InMemoryBackend) AddAttachmentsToSetWithAttachments

func (b *InMemoryBackend) AddAttachmentsToSetWithAttachments(
	attachmentSetID string,
	attachments []Attachment,
) (string, time.Time, error)

AddAttachmentsToSetWithAttachments stages uploaded files for single-use consumption.

func (*InMemoryBackend) AddCaseInternal

func (b *InMemoryBackend) AddCaseInternal(c *Case)

AddCaseInternal seeds a case directly into the backend (for testing).

func (*InMemoryBackend) AddCommunicationToCase

func (b *InMemoryBackend) AddCommunicationToCase(caseID, body, attachmentSetID string) error

AddCommunicationToCase adds a communication to an existing support case.

func (*InMemoryBackend) AddCommunicationWithOptions

func (b *InMemoryBackend) AddCommunicationWithOptions(in AddCommunicationOptions) error

AddCommunicationWithOptions stores a customer response and reopens a resolved case.

func (*InMemoryBackend) CreateCase

func (b *InMemoryBackend) CreateCase(subject, serviceCode, categoryCode, severityCode, body string) (*Case, error)

CreateCase creates a new support case.

func (*InMemoryBackend) CreateCaseWithOptions

func (b *InMemoryBackend) CreateCaseWithOptions(in CreateCaseOptions) (*Case, error)

CreateCaseWithOptions stores an AWS-shaped support case and its initial communication.

func (*InMemoryBackend) DescribeAttachment

func (b *InMemoryBackend) DescribeAttachment(attachmentID string) (*Attachment, error)

DescribeAttachment returns the attachment with the given ID.

func (*InMemoryBackend) DescribeCases

func (b *InMemoryBackend) DescribeCases(caseIDs []string, includeResolvedCases bool) []Case

DescribeCases returns all support cases, optionally filtered by caseIds. When includeResolvedCases is false, resolved cases are excluded.

Fast path: when caseIDs are supplied, look them up directly in the case-ID-keyed map instead of scanning every case in the backend.

func (*InMemoryBackend) DescribeCasesWithOptions

func (b *InMemoryBackend) DescribeCasesWithOptions(in DescribeCasesOptions) ([]Case, string, error)

DescribeCasesWithOptions returns ordered and paginated cases matching API filters.

func (*InMemoryBackend) DescribeCommunications

func (b *InMemoryBackend) DescribeCommunications(caseID string) ([]Communication, error)

DescribeCommunications returns communications for the given case.

func (*InMemoryBackend) DescribeCommunicationsWithOptions

func (b *InMemoryBackend) DescribeCommunicationsWithOptions(
	in DescribeCommunicationsOptions,
) ([]Communication, string, error)

DescribeCommunicationsWithOptions returns ordered communications matching API filters.

func (*InMemoryBackend) DescribeCreateCaseOptions

func (b *InMemoryBackend) DescribeCreateCaseOptions(_, _, _, language string) *DescribeCreateCaseOptionsResult

DescribeCreateCaseOptions returns available case creation options. Chat support hours differ by locale: Japanese support runs 07:00–21:00 JST, all other locales use 06:00–22:00 UTC.

func (*InMemoryBackend) DescribeServices

func (b *InMemoryBackend) DescribeServices(serviceCodeList []string, language string) []Service

DescribeServices returns AWS services, optionally filtered by service codes.

func (*InMemoryBackend) DescribeSeverityLevels

func (b *InMemoryBackend) DescribeSeverityLevels(language string) []SeverityLevel

DescribeSeverityLevels returns the available severity levels.

func (*InMemoryBackend) DescribeSupportedLanguages

func (b *InMemoryBackend) DescribeSupportedLanguages(issueType, _, _ string) []SupportedLanguage

DescribeSupportedLanguages returns languages supported for the given parameters. The account-and-billing issue type is handled exclusively in English.

func (*InMemoryBackend) DescribeTrustedAdvisorCheckRefreshStatuses

func (b *InMemoryBackend) DescribeTrustedAdvisorCheckRefreshStatuses(
	checkIDs []string,
) []TrustedAdvisorCheckRefreshStatus

DescribeTrustedAdvisorCheckRefreshStatuses returns refresh statuses for the given check IDs. Uses RLock for the common read-only case; upgrades to a write lock only when state advancement is required (simulates the async progression: enqueued → processing → success).

func (*InMemoryBackend) DescribeTrustedAdvisorCheckResult

func (b *InMemoryBackend) DescribeTrustedAdvisorCheckResult(checkID, _ string) *TrustedAdvisorCheckResult

DescribeTrustedAdvisorCheckResult returns the result for the given Trusted Advisor check. Stored results (written by RefreshTrustedAdvisorCheck) take precedence over the static default.

func (*InMemoryBackend) DescribeTrustedAdvisorCheckSummaries

func (b *InMemoryBackend) DescribeTrustedAdvisorCheckSummaries(checkIDs []string) []TrustedAdvisorCheckSummary

DescribeTrustedAdvisorCheckSummaries returns summaries for the given check IDs, derived from stored check results where available.

func (*InMemoryBackend) DescribeTrustedAdvisorChecks

func (b *InMemoryBackend) DescribeTrustedAdvisorChecks() []TrustedAdvisorCheck

DescribeTrustedAdvisorChecks returns the static list of Trusted Advisor checks.

func (*InMemoryBackend) RecentCommunications

func (b *InMemoryBackend) RecentCommunications(caseID string) ([]Communication, string)

RecentCommunications returns up to five newest communications for DescribeCases.

func (*InMemoryBackend) RefreshTrustedAdvisorCheck

func (b *InMemoryBackend) RefreshTrustedAdvisorCheck(checkID string) (*TrustedAdvisorCheckRefreshStatus, error)

RefreshTrustedAdvisorCheck enqueues a refresh for the given Trusted Advisor check. Evicts a random entry when the status map is at capacity to prevent unbounded growth.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state.

func (*InMemoryBackend) ResolveCase

func (b *InMemoryBackend) ResolveCase(caseID string) (*Case, error)

ResolveCase resolves a support case by caseId. Resolving an already-resolved case is a no-op (see ResolveCaseWithStatus): real AWS Support has no "already resolved" error for this operation.

func (*InMemoryBackend) ResolveCaseWithStatus

func (b *InMemoryBackend) ResolveCaseWithStatus(caseID string) (string, *Case, error)

ResolveCaseWithStatus resolves a case and returns its real prior status. Real AWS Support has no "already resolved" error for ResolveCase: the operation's modeled exceptions are only CaseIdNotFound and InternalServerError, and resolving an already-resolved case is a no-op that reports resolved for both initialCaseStatus and finalCaseStatus.

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) RunJanitor

func (b *InMemoryBackend) RunJanitor(ctx context.Context, interval time.Duration)

RunJanitor periodically cleans up expired attachment sets and their associated attachments. It blocks until the context is cancelled.

func (*InMemoryBackend) Snapshot

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

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

type Provider

type Provider struct{}

Provider implements service.Provider for AWS Support.

func (*Provider) Init

Init initializes the Support service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Service

type Service struct {
	Code       string            `json:"code"`
	Name       string            `json:"name"`
	Categories []ServiceCategory `json:"categories"`
}

Service represents an AWS service for the support case.

type ServiceCategory

type ServiceCategory struct {
	Code string `json:"code"`
	Name string `json:"name"`
}

ServiceCategory represents a category within an AWS service.

type SeverityLevel

type SeverityLevel struct {
	Code string `json:"code"`
	Name string `json:"name"`
}

SeverityLevel represents a support case severity level.

type StorageBackend

type StorageBackend interface {
	Reset()
	CreateCase(subject, serviceCode, categoryCode, severityCode, body string) (*Case, error)
	CreateCaseWithOptions(in CreateCaseOptions) (*Case, error)
	DescribeCases(caseIDs []string, includeResolvedCases bool) []Case
	DescribeCasesWithOptions(in DescribeCasesOptions) ([]Case, string, error)
	RecentCommunications(caseID string) ([]Communication, string)
	ResolveCase(caseID string) (*Case, error)
	ResolveCaseWithStatus(caseID string) (string, *Case, error)
	AddCommunicationToCase(caseID, body, attachmentSetID string) error
	AddCommunicationWithOptions(in AddCommunicationOptions) error
	DescribeCommunications(caseID string) ([]Communication, error)
	DescribeCommunicationsWithOptions(in DescribeCommunicationsOptions) ([]Communication, string, error)
	DescribeTrustedAdvisorChecks() []TrustedAdvisorCheck
	AddAttachmentsToSet(attachmentSetID string) (string, time.Time, error)
	AddAttachmentsToSetWithAttachments(attachmentSetID string, attachments []Attachment) (string, time.Time, error)
	DescribeAttachment(attachmentID string) (*Attachment, error)
	DescribeCreateCaseOptions(issueType, serviceCode, categoryCode, language string) *DescribeCreateCaseOptionsResult
	DescribeServices(serviceCodeList []string, language string) []Service
	DescribeSeverityLevels(language string) []SeverityLevel
	DescribeSupportedLanguages(issueType, serviceCode, categoryCode string) []SupportedLanguage
	DescribeTrustedAdvisorCheckRefreshStatuses(checkIDs []string) []TrustedAdvisorCheckRefreshStatus
	DescribeTrustedAdvisorCheckResult(checkID, language string) *TrustedAdvisorCheckResult
	DescribeTrustedAdvisorCheckSummaries(checkIDs []string) []TrustedAdvisorCheckSummary
	RefreshTrustedAdvisorCheck(checkID string) (*TrustedAdvisorCheckRefreshStatus, error)
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend defines the interface for Support backend implementations. All mutating methods must be safe for concurrent use.

type SupportedHour

type SupportedHour struct {
	StartTime string `json:"startTime"`
	EndTime   string `json:"endTime"`
}

SupportedHour represents a time range when support is available.

type SupportedLanguage

type SupportedLanguage struct {
	Code     string `json:"code"`
	Display  string `json:"display"`
	Language string `json:"language"`
}

SupportedLanguage represents a language supported for a support case.

type TrustedAdvisorCategorySpecificSummary

type TrustedAdvisorCategorySpecificSummary struct {
	CostOptimizing TrustedAdvisorCostOptimizingSummary `json:"costOptimizing"`
}

TrustedAdvisorCategorySpecificSummary provides cost optimization estimates.

type TrustedAdvisorCheck

type TrustedAdvisorCheck struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Category    string   `json:"category"`
	Metadata    []string `json:"metadata"`
}

TrustedAdvisorCheck represents a Trusted Advisor check.

type TrustedAdvisorCheckRefreshStatus

type TrustedAdvisorCheckRefreshStatus struct {
	RefreshTime                time.Time `json:"refreshTime,omitzero"`
	CheckID                    string    `json:"checkId"`
	Status                     string    `json:"status"`
	MillisUntilNextRefreshable int64     `json:"millisUntilNextRefreshable"`
	PollCount                  int       `json:"pollCount,omitempty"`
}

TrustedAdvisorCheckRefreshStatus represents the refresh status for a Trusted Advisor check.

type TrustedAdvisorCheckResult

type TrustedAdvisorCheckResult struct {
	CategorySpecificSummary *TrustedAdvisorCategorySpecificSummary `json:"categorySpecificSummary"`
	CheckID                 string                                 `json:"checkId"`
	Status                  string                                 `json:"status"`
	Timestamp               string                                 `json:"timestamp"`
	FlaggedResources        []TrustedAdvisorResourceDetail         `json:"flaggedResources"`
	ResourcesSummary        TrustedAdvisorResourcesSummary         `json:"resourcesSummary"`
}

TrustedAdvisorCheckResult represents the full result of a Trusted Advisor check.

type TrustedAdvisorCheckSummary

type TrustedAdvisorCheckSummary struct {
	CategorySpecificSummary *TrustedAdvisorCategorySpecificSummary `json:"categorySpecificSummary"`
	CheckID                 string                                 `json:"checkId"`
	Status                  string                                 `json:"status"`
	Timestamp               string                                 `json:"timestamp"`
	ResourcesSummary        TrustedAdvisorResourcesSummary         `json:"resourcesSummary"`
	HasFlaggedResources     bool                                   `json:"hasFlaggedResources"`
}

TrustedAdvisorCheckSummary represents a summary of a Trusted Advisor check result.

type TrustedAdvisorCostOptimizingSummary

type TrustedAdvisorCostOptimizingSummary struct {
	EstimatedMonthlySavings        float64 `json:"estimatedMonthlySavings"`
	EstimatedPercentMonthlySavings float64 `json:"estimatedPercentMonthlySavings"`
}

TrustedAdvisorCostOptimizingSummary estimates possible monthly savings.

type TrustedAdvisorResourceDetail

type TrustedAdvisorResourceDetail struct {
	ResourceID   string   `json:"resourceId"`
	Status       string   `json:"status"`
	Region       string   `json:"region"`
	Metadata     []string `json:"metadata"`
	IsSuppressed bool     `json:"isSuppressed"`
}

TrustedAdvisorResourceDetail represents a single resource flagged by a Trusted Advisor check.

type TrustedAdvisorResourcesSummary

type TrustedAdvisorResourcesSummary struct {
	ResourcesFlagged    int64 `json:"resourcesFlagged"`
	ResourcesIgnored    int64 `json:"resourcesIgnored"`
	ResourcesProcessed  int64 `json:"resourcesProcessed"`
	ResourcesSuppressed int64 `json:"resourcesSuppressed"`
}

TrustedAdvisorResourcesSummary holds counts of resources examined by a Trusted Advisor check.

Jump to

Keyboard shortcuts

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