client

package
v0.0.0-...-0c6783f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceECS = "ecs"

Variables

View Source
var JSONSchema string
View Source
var ServiceRegions = map[string][]string{
	ServiceECS: {
		"cn-hangzhou",
		"cn-qingdao",
		"cn-beijing",
		"cn-zhangjiakou",
		"cn-huhehaote",
		"cn-shanghai",
		"cn-shenzhen",
		"cn-hongkong",
		"ap-southeast-1",
		"ap-southeast-2",
		"ap-southeast-3",
		"ap-southeast-5",
		"ap-northeast-1",
		"eu-west-1",
		"us-west-1",
		"us-east-1",
		"eu-central-1",
		"me-east-1",
		"ap-south-1",
		"cn-shanghai-finance-1",
		"cn-shenzhen-finance-1",
		"cn-chengdu",
		"cn-heyuan",
		"cn-wulanchabu",
		"rus-west-1",
		"cn-guangzhou",
		"ap-southeast-6",
		"cn-nanjing",
	},
}

ServiceRegions maps service name to a list of regions where the service is available. Extracted from https://api.aliyun.com/#/region

Functions

func AccountMultiplex

func AccountMultiplex(meta schema.ClientMeta) []schema.ClientMeta

func MockTestHelper

func MockTestHelper(t *testing.T, table *schema.Table, builder func(*testing.T, *gomock.Controller) Services, _ TestOptions)

func New

func New(logger zerolog.Logger, spec Spec) (schema.ClientMeta, error)

func ResolveAccount

func ResolveAccount(_ context.Context, meta schema.ClientMeta, r *schema.Resource, _ schema.Column) error

func ResolveRegion

func ResolveRegion(_ context.Context, meta schema.ClientMeta, r *schema.Resource, _ schema.Column) error

func ServiceAccountRegionMultiplexer

func ServiceAccountRegionMultiplexer(service string) func(meta schema.ClientMeta) []schema.ClientMeta

func TimestampResolver

func TimestampResolver(layout, path string) schema.ColumnResolver

Types

type AccountSpec

type AccountSpec struct {
	Name      string   `json:"name,omitempty" jsonschema:"required,minLength=1"`
	Regions   []string `json:"regions,omitempty" jsonschema:"required,minItems=1"`
	AccessKey string   `json:"access_key,omitempty" jsonschema:"required,minLength=1"`
	SecretKey string   `json:"secret_key,omitempty" jsonschema:"required,minLength=1"`
}

type Client

type Client struct {
	Spec      Spec
	AccountID string
	Region    string
	// contains filtered or unexported fields
}

func (*Client) ID

func (c *Client) ID() string

func (*Client) Logger

func (c *Client) Logger() *zerolog.Logger

func (*Client) Services

func (c *Client) Services() *Services

func (*Client) WithAccountIDAndRegion

func (c *Client) WithAccountIDAndRegion(accountID, region string) *Client

type Services

type Services struct {
	OSS services.OssClient
	BSS services.BssopenapiClient
	ECS services.EcsClient
}

type Spec

type Spec struct {
	Accounts          []AccountSpec `json:"accounts,omitempty" jsonschema:"required,minItems=1"`
	BillHistoryMonths int           `json:"bill_history_months,omitempty"`
	Concurrency       int           `json:"concurrency,omitempty"`
}

func (*Spec) SetDefaults

func (s *Spec) SetDefaults()

func (*Spec) Validate

func (s *Spec) Validate() error

type TestOptions

type TestOptions struct{}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Code generated by codegen; DO NOT EDIT.
Code generated by codegen; DO NOT EDIT.
spec
gen

Jump to

Keyboard shortcuts

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