Documentation
¶
Index ¶
- Constants
- Variables
- func OpenAPIOperationName(product OpenAPIProduct, operation string) (string, bool)
- func VerifyRegion(profileName, configPath, region, serviceCode string, ...) error
- type CLICommandCaller
- type CLICommandRunner
- type OSSUtilCaller
- type OpenAPICaller
- func (c *OpenAPICaller) Call(ctx context.Context, operation string, request map[string]any) (map[string]any, error)
- func (c *OpenAPICaller) CallRaw(ctx context.Context, operation string, request map[string]any) (map[string]any, error)
- func (c *OpenAPICaller) PrepareOperationContext(ctx context.Context) (context.Context, error)
- type OpenAPIEndpoint
- type OpenAPIMetadataResolver
- type OpenAPIOperationDetail
- type OpenAPIOperationSummary
- type OpenAPIParameter
- type OpenAPIProduct
- type RegionVerifier
Constants ¶
const ( // ErrCodeInvalidRegion is returned by RegionVerifier.Verify when the // Location service reports no endpoints for a region. Treat this as a // hard failure — the user almost certainly typed the region wrong. ErrCodeInvalidRegion = "InvalidRegion" // cannot be performed (missing credentials, network error, etc.). Callers // should fall back to a warning rather than blocking the operation. ErrCodeVerificationUnavailable = "VerificationUnavailable" )
Location service used to validate region IDs without depending on a static list. The API is public but undocumented; the call shape mirrors what the aliyun-cli does internally.
Variables ¶
var ErrCredentialAccountMismatch = errors.New("credential account does not match the configured account")
var ErrCredentialIdentityChanged = errors.New("credential identity changed during operation")
var ErrCredentialLeaseExpired = errors.New("credential lease expired")
var ErrCredentialProfileChanged = errors.New("credential profile changed during refresh")
var ErrCredentialStatePersistenceFailed = errors.New("credential state could not be persisted")
Functions ¶
func OpenAPIOperationName ¶
func OpenAPIOperationName(product OpenAPIProduct, operation string) (string, bool)
Types ¶
type CLICommandCaller ¶
type CLICommandCaller struct {
Product string
Region string
Profile string
ConfigPath string
// contains filtered or unexported fields
}
func NewCLICommandCaller ¶
func NewCLICommandCaller(profileName, configPath, product, region string, getenv func(string) string) (*CLICommandCaller, error)
type CLICommandRunner ¶
type OSSUtilCaller ¶ added in v0.2.0
type OSSUtilCaller struct {
Region string
Profile resolvedOpenAPIProfile
// contains filtered or unexported fields
}
OSSUtilCaller adapts the OSSUtil API commands exposed by aliyun CLI to the generic ecctl call contract. Credentials are resolved by ecctl and passed to the child process through environment variables, never command arguments.
func NewOSSUtilCaller ¶ added in v0.2.0
func NewOSSUtilCaller(profileName, configPath, region string, getenv func(string) string) (*OSSUtilCaller, error)
func NewOSSUtilCallerWithRegionSource ¶ added in v0.2.1
func NewOSSUtilCallerWithRegionSource(profileName, configPath string, region ecconfig.ResolvedRegion, getenv func(string) string) (*OSSUtilCaller, error)
type OpenAPICaller ¶
type OpenAPICaller struct {
Product string
Resource string
Region string
Profile resolvedOpenAPIProfile
// contains filtered or unexported fields
}
func NewOpenAPICaller ¶
func NewOpenAPICaller(profileName, configPath, product, region string, getenv func(string) string) (*OpenAPICaller, error)
func NewOpenAPICallerWithRegionSource ¶ added in v0.2.1
func NewOpenAPICallerWithRegionSource(profileName, configPath, product string, region ecconfig.ResolvedRegion, getenv func(string) string) (*OpenAPICaller, error)
func (*OpenAPICaller) PrepareOperationContext ¶ added in v0.2.1
PrepareOperationContext pins one logical credential source and executor for the complete engine operation. Temporary material may renew before later requests, while profile identity and endpoint policy remain fixed.
type OpenAPIEndpoint ¶
type OpenAPIMetadataResolver ¶ added in v0.2.1
type OpenAPIMetadataResolver struct {
// contains filtered or unexported fields
}
OpenAPIMetadataResolver is an immutable, fail-closed view of the current OpenAPI metadata for a declared product set. Construct it with NewOpenAPIMetadataResolver so current-versus-legacy provenance cannot be lost by copying or reconstructing individual OpenAPIProduct values.
func NewOpenAPIMetadataResolver ¶ added in v0.2.1
func NewOpenAPIMetadataResolver(lang string, requiredCodes []string) (*OpenAPIMetadataResolver, error)
NewOpenAPIMetadataResolver loads every required product from the current catalog. Missing products and broken current version manifests are fatal; unrelated incomplete catalog entries are not read.
func (*OpenAPIMetadataResolver) OperationLeaves ¶ added in v0.2.1
func (r *OpenAPIMetadataResolver) OperationLeaves(productCode, operation string, allowLegacy bool) ([]OpenAPIParameter, string, error)
OperationLeaves resolves and flattens one operation from the immutable snapshot. allowLegacy must be true only for an explicitly reviewed legacy-only operation; an unapproved omission from the current manifest is treated as metadata corruption.
type OpenAPIOperationDetail ¶
type OpenAPIOperationDetail struct {
Name string
Deprecated bool
Protocol string
Method string
PathPattern string
Style string
Parameters []OpenAPIParameter
}
func OpenAPIOperationDetailFor ¶
func OpenAPIOperationDetailFor(lang string, product OpenAPIProduct, operation string) (OpenAPIOperationDetail, bool)
func (*OpenAPIOperationDetail) FindParameter ¶
func (d *OpenAPIOperationDetail) FindParameter(name string) *OpenAPIParameter
type OpenAPIOperationSummary ¶
func OpenAPIOperationSummaryFor ¶
func OpenAPIOperationSummaryFor(lang string, productCode string, operation string) (OpenAPIOperationSummary, bool)
type OpenAPIParameter ¶
type OpenAPIParameter struct {
Name string
Description string
Position string
Type string
Required bool
SubParameters []OpenAPIParameter
}
func OpenAPIOperationLeaves ¶ added in v0.2.1
func OpenAPIOperationLeaves(lang string, product OpenAPIProduct, operation string) ([]OpenAPIParameter, bool)
OpenAPIOperationLeaves returns the flattened leaf request parameters of an OpenAPI operation. Group parameters are expanded into their children:
- a parameter with sub-parameters (for example RepeatList groups such as DataDisk) contributes one leaf per child, named Parent.Child;
- a Struct placeholder whose children are declared as dotted flat names (for example SystemDisk plus SystemDisk.Category) contributes only the dotted leaves, not the bare parent;
- a parameter with no child information (a bare Struct or RepeatList) contributes a single leaf under its own name.
OpenAPIOperationDetailFor supplies the authoritative current parameter set and falls back to legacy metadata only when the current operation is absent. When the current detail exposes a bare group without dotted children, the legacy subtree enriches that group so drift detection retains field-level coverage. Legacy-only top-level parameters are never copied into the current set, so newly added and removed parameters remain observable.
type OpenAPIProduct ¶
type OpenAPIProduct struct {
Code string
Name string
Version string
EndpointType string
Style string
Endpoints map[string]OpenAPIEndpoint
APINames []string
// contains filtered or unexported fields
}
func OpenAPIProductByCode ¶
func OpenAPIProductByCode(code string, lang string) (OpenAPIProduct, bool)
func OpenAPIProducts ¶
func OpenAPIProducts(lang string) ([]OpenAPIProduct, error)
type RegionVerifier ¶
type RegionVerifier struct {
// contains filtered or unexported fields
}
RegionVerifier checks that a region ID is recognized by the Alibaba Cloud Location service. Build one with NewRegionVerifier; inject a fake processor via newRegionVerifierWithProcessor in tests.
func NewRegionVerifier ¶
func NewRegionVerifier(profileName, configPath string, getenv func(string) string) (*RegionVerifier, error)
NewRegionVerifier constructs a RegionVerifier using the dynamic credential provider from the resolved profile. Returns a typed VerificationUnavailable error when no credentials are available — the CLI should treat that as a soft skip rather than a hard failure during initial setup.
func (*RegionVerifier) Verify ¶
func (v *RegionVerifier) Verify(region, serviceCode string) error
Verify calls Location/DescribeEndpoints and reports whether the region is known to Alibaba Cloud. serviceCode defaults to "ecs" — the universal probe because every region with any public API exposes ECS endpoints.
func (*RegionVerifier) VerifyContext ¶ added in v0.2.0
func (v *RegionVerifier) VerifyContext(ctx context.Context, region, serviceCode string) error
VerifyContext is Verify with the command context used for telemetry parentage and cancellation.
Source Files
¶
- agentrun_metadata.go
- caller.go
- cli_caller.go
- create_helpers.go
- credential_broker.go
- credential_cache.go
- credential_gate.go
- credential_identity_policy.go
- credential_profile_refresh.go
- credentials.go
- ecs_credentials.go
- external_process_unix.go
- flatten.go
- identity.go
- location.go
- openapi_metadata.go
- openapi_newmeta.go
- openapi_request.go
- ossutil_caller.go
- ossutil_metadata.go