Help us shape the future of Go! Take the 2026 Go Developer Survey

servicequotas

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 28 Imported by: 0

README

Servicequotas

Parity grade: B · SDK aws-sdk-go-v2/service/servicequotas@v1.43.4 · last audited 2026-10-18 (64eb45859)

Coverage

Metric Value
PARITY entries audited 26 (26 ok)
Feature families 5 (5 ok)
Known gaps 8
Structural gaps (can't be emulated) 1
Deferred items 0
Resource leaks clean
Known gaps
  • Catalog: only the 11 services above are catalogued; ListServices omits the rest of AWS and codes outside the catalog return NoSuchResourceException. Codes and defaults come from public AWS documentation and are not verified against the live API.
  • ContextId/QuotaContext: resource-level quotas are not modeled; ContextId is rejected with IllegalArgumentException
  • QuotaUtilization: usage comes from an optional UsageSource that is not wired in production, so Utilization is 0 for every quota
  • AutoManagement: configuration is stored but no automatic quota adjustment or notification is performed
  • AppliedQuotaEnforcement: emulated services do not read the applied quota values when enforcing their own limits
  • Template: associating the template does not file increase requests for accounts that join the organization later
  • RequestStatus: requests always reach APPROVED; DENIED, NOT_APPROVED, CASE_CLOSED and INVALID_REQUEST are never entered
  • Errors: AccessDenied for non-template operations, DependencyAccessDenied, TagPolicyViolation, TemplatesNotAvailableInRegion, TooManyRequests and ServiceException are not raised
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • No AWS Support case system exists in an emulator: CaseId values are synthetic numbers and no support case can be inspected.

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccessDenied                     = errors.New("access denied")
	ErrAWSServiceAccessNotEnabled       = errors.New("service access is not enabled")
	ErrIllegalArgument                  = errors.New("illegal argument")
	ErrInvalidPaginationToken           = errors.New("invalid pagination token")
	ErrInvalidResourceState             = errors.New("invalid resource state")
	ErrNoAvailableOrganization          = errors.New("no available organization")
	ErrNoSuchResource                   = errors.New("no such resource")
	ErrOrganizationNotInAllFeaturesMode = errors.New("organization is not in all features mode")
	ErrQuotaExceeded                    = errors.New("quota exceeded")
	ErrResourceAlreadyExists            = errors.New("resource already exists")
	ErrServiceQuotaTemplateNotInUse     = errors.New("quota request template is not in use")
	ErrTooManyTags                      = errors.New("too many tags")
)

Sentinels, one per exception the pinned SDK models that this service raises.

Functions

This section is empty.

Types

type AppliedValue

type AppliedValue struct {
	Key         string  `json:"key"`
	Account     string  `json:"account"`
	Region      string  `json:"region"`
	ServiceCode string  `json:"serviceCode"`
	QuotaCode   string  `json:"quotaCode"`
	Value       float64 `json:"value"`
}

AppliedValue overrides a quota's default for one account and Region.

type Association

type Association struct {
	Account string `json:"account"`
	Status  string `json:"status"`
}

Association records whether an account's quota request template is associated with its organization.

type AutoManagement

type AutoManagement struct {
	Exclusions      map[string][]string `json:"exclusions,omitempty"`
	Key             string              `json:"key"`
	Account         string              `json:"account"`
	Region          string              `json:"region"`
	OptInLevel      string              `json:"optInLevel"`
	OptInType       string              `json:"optInType"`
	Status          string              `json:"status"`
	NotificationArn string              `json:"notificationArn,omitempty"`
}

AutoManagement is the automatic quota management configuration of an account in a Region.

type AutoManagementInput

type AutoManagementInput struct {
	Exclusions      map[string][]string
	NotificationArn *string
	OptInLevel      string
	OptInType       string
}

AutoManagementInput carries the editable settings of StartAutoManagement and UpdateAutoManagement.

type AutoManagementView

type AutoManagementView struct {
	Exclusions map[string][]ExclusionEntry
	Config     AutoManagement
}

AutoManagementView is the automatic management configuration with resolved exclusion names.

type Catalog

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

Catalog is the set of services and quotas the emulator knows.

func NewCatalog

func NewCatalog(svcs []ServiceDef) *Catalog

NewCatalog builds a catalog from service definitions.

func (*Catalog) Quota

func (c *Catalog) Quota(serviceCode, quotaCode string) (*ServiceDef, *QuotaDef, bool)

Quota looks a quota up by service and quota code.

func (*Catalog) Service

func (c *Catalog) Service(code string) (*ServiceDef, bool)

Service looks a service up by its code.

func (*Catalog) Services

func (c *Catalog) Services() []ServiceDef

Services returns every service in code order.

type ExclusionEntry

type ExclusionEntry struct{ Code, Name string }

ExclusionEntry is an excluded quota with its catalogued name.

type Handler

type Handler struct {
	Backend *InMemoryBackend
}

Handler serves the Service Quotas awsjson1.1 API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

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

ChaosOperations lists the fault-injectable operations.

func (*Handler) ChaosRegions

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

ChaosRegions lists the regions this handler serves.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase service name for fault rules.

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(c *echo.Context) string

ExtractResource returns the operation name; the API has no single resource key.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations lists every routed operation.

func (*Handler) Handler

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

Handler returns the echo handler.

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 all state.

func (*Handler) Restore

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

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

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

RouteMatcher matches the ServiceQuotasV20190624 X-Amz-Target prefix.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable.

type InMemoryBackend

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

InMemoryBackend is the Service Quotas state; one coarse lock guards every table.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the default account.

func (*InMemoryBackend) AssociateTemplate

func (b *InMemoryBackend) AssociateTemplate(ctx context.Context) error

AssociateTemplate associates the template with the organization.

func (*InMemoryBackend) CreateSupportCase

func (b *InMemoryBackend) CreateSupportCase(ctx context.Context, requestID string) error

CreateSupportCase opens a support case for a pending request.

func (*InMemoryBackend) DeleteTemplateItem

func (b *InMemoryBackend) DeleteTemplateItem(ctx context.Context, region, serviceCode, quotaCode string) error

DeleteTemplateItem removes one template entry.

func (*InMemoryBackend) DisassociateTemplate

func (b *InMemoryBackend) DisassociateTemplate(ctx context.Context) error

DisassociateTemplate disassociates the template from the organization.

func (*InMemoryBackend) GetAutoManagement

func (b *InMemoryBackend) GetAutoManagement(ctx context.Context) AutoManagementView

GetAutoManagement returns the configuration; a never-started account reports DISABLED.

func (*InMemoryBackend) GetDefaultQuota

func (b *InMemoryBackend) GetDefaultQuota(ctx context.Context, serviceCode, quotaCode string) (QuotaView, error)

GetDefaultQuota returns the AWS default of one quota.

func (*InMemoryBackend) GetReport

func (b *InMemoryBackend) GetReport(ctx context.Context, id, token string, maxResults *int32) (ReportPage, error)

GetReport returns a report and a page of its quotas.

func (*InMemoryBackend) GetRequest

func (b *InMemoryBackend) GetRequest(ctx context.Context, id string) (RequestView, error)

GetRequest returns one request.

func (*InMemoryBackend) GetServiceQuota

func (b *InMemoryBackend) GetServiceQuota(
	ctx context.Context,
	serviceCode, quotaCode, contextID string,
) (QuotaView, error)

GetServiceQuota returns the applied value of one quota.

func (*InMemoryBackend) GetTemplateItem

func (b *InMemoryBackend) GetTemplateItem(
	ctx context.Context,
	region, serviceCode, quotaCode string,
) (TemplateView, error)

GetTemplateItem returns one template entry.

func (*InMemoryBackend) ListDefaultQuotas

func (b *InMemoryBackend) ListDefaultQuotas(
	ctx context.Context, serviceCode, token string, maxResults *int32,
) (page.Page[QuotaView], error)

ListDefaultQuotas returns the AWS default quotas of a service.

func (*InMemoryBackend) ListRequests

func (b *InMemoryBackend) ListRequests(
	ctx context.Context, f RequestFilter, token string, maxResults *int32,
) (page.Page[RequestView], error)

ListRequests returns the request history, oldest first.

func (*InMemoryBackend) ListServiceQuotas

func (b *InMemoryBackend) ListServiceQuotas(
	ctx context.Context, serviceCode, quotaCode, level, token string, maxResults *int32,
) (page.Page[QuotaView], error)

ListServiceQuotas returns the applied quotas of a service.

func (*InMemoryBackend) ListServices

func (b *InMemoryBackend) ListServices(token string, maxResults *int32) (page.Page[ServiceDef], error)

ListServices returns the services that have quotas.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resource string) (map[string]string, error)

ListTagsForResource returns the tags of an applied quota.

func (*InMemoryBackend) ListTemplateItems

func (b *InMemoryBackend) ListTemplateItems(
	ctx context.Context, region, serviceCode, token string, maxResults *int32,
) (page.Page[TemplateView], error)

ListTemplateItems lists template entries, optionally narrowed by Region and service.

func (*InMemoryBackend) PutTemplateItem

func (b *InMemoryBackend) PutTemplateItem(
	ctx context.Context, region, serviceCode, quotaCode string, desired *float64,
) (TemplateView, error)

PutTemplateItem adds or replaces a quota increase request in the template.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the default region.

func (*InMemoryBackend) RequestIncrease

func (b *InMemoryBackend) RequestIncrease(
	ctx context.Context, serviceCode, quotaCode string, desired *float64, contextID string, caseAllowed *bool,
) (RequestView, error)

RequestIncrease files a quota increase request.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears every table.

func (*InMemoryBackend) Restore

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

Restore loads a snapshot; an incompatible version is discarded.

func (*InMemoryBackend) SetLifecycleDelay

func (b *InMemoryBackend) SetLifecycleDelay(d time.Duration)

SetLifecycleDelay overrides the dwell time of each quota request and report stage.

func (*InMemoryBackend) SetOrgDirectory

func (b *InMemoryBackend) SetOrgDirectory(d OrgDirectory)

SetOrgDirectory wires the Organizations lookup used by the quota request template.

func (*InMemoryBackend) SetUsageSource

func (b *InMemoryBackend) SetUsageSource(u UsageSource)

SetUsageSource wires the usage lookup used by utilization reports.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state.

func (*InMemoryBackend) StartAutoManagement

func (b *InMemoryBackend) StartAutoManagement(ctx context.Context, in AutoManagementInput) error

StartAutoManagement opts the account into automatic quota management.

func (*InMemoryBackend) StartReport

func (b *InMemoryBackend) StartReport(ctx context.Context) (Report, error)

StartReport begins generating a utilization report.

func (*InMemoryBackend) StopAutoManagement

func (b *InMemoryBackend) StopAutoManagement(ctx context.Context) error

StopAutoManagement opts the account out of automatic quota management.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(ctx context.Context, resource string, add map[string]string) error

TagResource adds or replaces tags on an applied quota.

func (*InMemoryBackend) TemplateAssociation

func (b *InMemoryBackend) TemplateAssociation(ctx context.Context) (string, error)

TemplateAssociation returns the association status of the template.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(ctx context.Context, resource string, keys []string) error

UntagResource removes tags by key.

func (*InMemoryBackend) UpdateAutoManagement

func (b *InMemoryBackend) UpdateAutoManagement(ctx context.Context, in AutoManagementInput) error

UpdateAutoManagement changes the settings of an enabled configuration.

type OrgDirectory

type OrgDirectory interface {
	OrganizationOf(accountID string) (OrgInfo, bool)
}

OrgDirectory resolves the organization of an account.

type OrgInfo

type OrgInfo struct {
	ManagementAccountID string
	AllFeatures         bool
	ServiceAccess       bool
}

OrgInfo describes the organization a management account belongs to.

type Provider

type Provider struct{}

Provider implements service.Provider for Service Quotas.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type QuotaDef

type QuotaDef struct {
	Usage       *UsageMetric `json:"usage,omitempty"`
	Code        string       `json:"code"`
	Name        string       `json:"name"`
	Description string       `json:"description,omitempty"`
	Unit        string       `json:"unit"`
	Default     float64      `json:"default"`
	Adjustable  bool         `json:"adjustable"`
	Global      bool         `json:"global,omitempty"`
}

QuotaDef is one catalogued quota with its AWS default.

type QuotaView

type QuotaView struct {
	Service *ServiceDef
	Def     *QuotaDef
	ARN     string
	Value   float64
	Applied bool
}

QuotaView is a catalogued quota with the value that applies to the caller.

type Report

type Report struct {
	Created   time.Time          `json:"created"`
	Generated time.Time          `json:"generated"`
	ID        string             `json:"id"`
	Account   string             `json:"account"`
	Region    string             `json:"region"`
	Status    string             `json:"status"`
	Quotas    []UtilizationEntry `json:"quotas,omitempty"`
	Seq       int64              `json:"seq"`
}

Report is a quota utilization report.

type ReportPage

type ReportPage struct {
	Quotas page.Page[UtilizationEntry]
	Report Report
	Total  int
}

ReportPage is a utilization report with one page of its quotas.

type Request

type Request struct {
	Created      time.Time `json:"created"`
	LastUpdated  time.Time `json:"lastUpdated"`
	CaseOpenedAt time.Time `json:"caseOpenedAt"`
	ID           string    `json:"id"`
	Account      string    `json:"account"`
	Region       string    `json:"region"`
	ServiceCode  string    `json:"serviceCode"`
	QuotaCode    string    `json:"quotaCode"`
	CaseID       string    `json:"caseId,omitempty"`
	Status       string    `json:"status"`
	Requester    string    `json:"requester"`
	DesiredValue float64   `json:"desiredValue"`
	Seq          int64     `json:"seq"`
	CaseAllowed  bool      `json:"caseAllowed"`
}

Request is a quota increase request.

type RequestFilter

type RequestFilter struct {
	ServiceCode string
	QuotaCode   string
	Status      string
	Level       string
}

RequestFilter narrows a request history listing.

type RequestView

type RequestView struct {
	Service *ServiceDef
	Def     *QuotaDef
	ARN     string
	Request Request
}

RequestView is a quota increase request with the quota it targets.

type ResourceTags

type ResourceTags struct {
	Tags map[string]string `json:"tags"`
	ARN  string            `json:"arn"`
}

ResourceTags holds the tags of one applied quota.

type ServiceDef

type ServiceDef struct {
	Code   string     `json:"code"`
	Name   string     `json:"name"`
	Quotas []QuotaDef `json:"quotas"`
}

ServiceDef is one catalogued service and its quotas.

type TemplateItem

type TemplateItem struct {
	Key          string  `json:"key"`
	Account      string  `json:"account"`
	AwsRegion    string  `json:"awsRegion"`
	ServiceCode  string  `json:"serviceCode"`
	QuotaCode    string  `json:"quotaCode"`
	DesiredValue float64 `json:"desiredValue"`
}

TemplateItem is an entry of the quota request template.

type TemplateView

type TemplateView struct {
	Service *ServiceDef
	Def     *QuotaDef
	Item    TemplateItem
}

TemplateView is a template entry with the quota it targets.

type UsageMetric

type UsageMetric struct {
	Dimensions map[string]string `json:"dimensions,omitempty"`
	Namespace  string            `json:"namespace"`
	Name       string            `json:"name"`
	Statistic  string            `json:"statistic"`
}

UsageMetric describes the CloudWatch metric that tracks usage of a quota.

type UsageSource

type UsageSource interface {
	QuotaUsage(account, region, serviceCode, quotaCode string) (float64, bool)
}

UsageSource reports current usage of a quota; ok is false when usage is not tracked.

type UtilizationEntry

type UtilizationEntry struct {
	ServiceCode string  `json:"serviceCode"`
	QuotaCode   string  `json:"quotaCode"`
	Namespace   string  `json:"namespace,omitempty"`
	Applied     float64 `json:"applied"`
	Default     float64 `json:"default"`
	Utilization float64 `json:"utilization"`
	Adjustable  bool    `json:"adjustable"`
}

UtilizationEntry is one quota line of a utilization report.

Jump to

Keyboard shortcuts

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