client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ZonePK = schema.Column{
		Name:     "zone",
		Type:     schema.TypeString,
		Resolver: ResolveClientZone,
		CreationOptions: schema.ColumnCreationOptions{
			PrimaryKey: true,
		},
	}

	RegionPK = schema.Column{
		Name:     "region",
		Type:     schema.TypeString,
		Resolver: ResolveClientRegion,
		CreationOptions: schema.ColumnCreationOptions{
			PrimaryKey: true,
		},
	}
)
View Source
var TestOrgID = "DECAF000-CAFE-0000-0000-000000000000"

Functions

func RegionMultiplex

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

func RegionMultiplexExcept

func RegionMultiplexExcept(except ...scw.Region) schema.Multiplexer

func RegionMultiplexSelective

func RegionMultiplexSelective(list ...scw.Region) schema.Multiplexer

func RegionMultiplexService

func RegionMultiplexService(service string) schema.Multiplexer

func ResolveClientRegion

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

func ResolveClientZone

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

func TestHelper

func TestHelper(t *testing.T, table *schema.Table, createServices func(*mux.Router) error)

func ZoneMultiplex

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

func ZoneMultiplexExcept

func ZoneMultiplexExcept(except ...scw.Zone) schema.Multiplexer

func ZoneMultiplexSelective

func ZoneMultiplexSelective(list ...scw.Zone) schema.Multiplexer

func ZoneMultiplexService

func ZoneMultiplexService(service string) schema.Multiplexer

Types

type Client

type Client struct {
	Logger    zerolog.Logger
	SCWClient *scw.Client
	Backend   backend.Backend
	OrgID     string
	Region    scw.Region
	Zone      scw.Zone

	Spec Spec
	// contains filtered or unexported fields
}

func (*Client) ID

func (c *Client) ID() string

func (*Client) WithRegion

func (c *Client) WithRegion(r scw.Region) *Client

func (*Client) WithZone

func (c *Client) WithZone(z scw.Zone) *Client

type Spec

type Spec struct {
	Regions []scw.Region `json:"regions,omitempty"`
	Zones   []scw.Zone   `json:"zones,omitempty"`

	// Optional
	Timeout int64 `json:"timeout_secs,omitempty"`
}

func (*Spec) SetDefaults

func (s *Spec) SetDefaults()

func (Spec) Validate

func (Spec) Validate() error

Jump to

Keyboard shortcuts

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