client

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MPL-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGcpMetadata

func AddGcpMetadata(ctx context.Context, c schema.ClientMeta, r *schema.Resource) error

func AllowEmptyStringIPNetResolver

func AllowEmptyStringIPNetResolver(path string) schema.ColumnResolver

func Configure

func Configure(logger hclog.Logger, config interface{}) (schema.ClientMeta, diag.Diagnostics)

func DeleteProjectFilter

func DeleteProjectFilter(meta schema.ClientMeta, _ *schema.Resource) []interface{}

func ErrorClassifier

func ErrorClassifier(meta schema.ClientMeta, resourceName string, err error) diag.Diagnostics

func GcpMockTestHelper

func GcpMockTestHelper(t *testing.T, table *schema.Table, createService func() (*Services, error), options TestOptions)

func IgnoreErrorHandler

func IgnoreErrorHandler(err error) bool

func ProjectMultiplex

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

func RedactError

func RedactError(projects []string, e diag.Diagnostic) diag.Diagnostic

RedactError redacts a given diagnostic and returns a redacted diagnostic containing both original and redacted versions

func ResolveProject

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

Types

type BackoffSettings

type BackoffSettings struct {
	Gax        gax.Backoff
	Backoff    backoff.Config
	MaxRetries int
}

type Client

type Client struct {

	// All gcp services initialized by client
	Services *Services
	// this is set by table client multiplexer
	ProjectId string
	// contains filtered or unexported fields
}

func NewGcpClient

func NewGcpClient(log hclog.Logger, bo BackoffSettings, projects []string, services *Services) *Client

func (Client) Logger

func (c Client) Logger() hclog.Logger

func (*Client) RetryingDo

func (c *Client) RetryingDo(ctx context.Context, doerIface interface{}, opts ...googleapi.CallOption) (interface{}, error)

RetryingDo runs the given doerIface with retry doerIface needs to have two methods: `Call(...googleapi.CallOption) (T, error)` and `Context(ctx.Context) T`

type Config

type Config struct {
	ProjectFilter         string   `yaml:"project_filter,omitempty" hcl:"project_filter,optional"` // Deprecated
	ProjectIDs            []string `yaml:"project_ids,omitempty" hcl:"project_ids,optional"`
	FolderIDs             []string `yaml:"folder_ids,omitempty" hcl:"folder_ids,optional"`
	FolderMaxDepth        uint     `yaml:"folders_max_depth,omitempty" hcl:"folders_max_depth,optional"`
	ServiceAccountKeyJSON string   `yaml:"service_account_key_json,omitempty" hcl:"service_account_key_json,optional"`

	BaseDelay         int     `yaml:"backoff_base_delay,omitempty" hcl:"backoff_base_delay,optional" default:"-1"`
	Multiplier        float64 `yaml:"backoff_multiplier,omitempty" hcl:"backoff_multiplier,optional"`
	MaxDelay          int     `yaml:"backoff_max_delay,omitempty" hcl:"backoff_max_delay,optional"`
	Jitter            float64 `yaml:"backoff_jitter,omitempty" hcl:"backoff_jitter,optional"`
	MinConnectTimeout int     `yaml:"backoff_min_connect_timeout,omitempty" hcl:"backoff_min_connect_timeout,optional"`
	MaxRetries        int     `yaml:"max_retries,omitempty" hcl:"max_retries,optional" default:"3"`
}

Config defines Provider Configuration

func (Config) Backoff

func (c Config) Backoff() BackoffSettings

func (Config) ClientOptions

func (c Config) ClientOptions() []option.ClientOption

func (Config) Example

func (Config) Example() string

type GcpService

type GcpService string
const (
	BigQueryService             GcpService = "bigquery.googleapis.com"
	CloudBillingService         GcpService = "cloudbilling.googleapis.com"
	CloudFunctionsService       GcpService = "cloudfunctions.googleapis.com"
	CloudKmsService             GcpService = "cloudkms.googleapis.com"
	CloudResourceManagerService GcpService = "cloudresourcemanager.googleapis.com"
	ComputeService              GcpService = "compute.googleapis.com"
	DnsService                  GcpService = "dns.googleapis.com"
	DomainsService              GcpService = "domains.googleapis.com"
	IamService                  GcpService = "iam.googleapis.com"
	LoggingService              GcpService = "logging.googleapis.com"
	RedisService                GcpService = "redis.googleapis.com"
	MonitoringService           GcpService = "monitoring.googleapis.com"
	SqlAdminService             GcpService = "sqladmin.googleapis.com"
	StorageService              GcpService = "storage-api.googleapis.com"
)

type Services

type Services struct {
	BigQuery        *bigquery.Service
	CloudBilling    *cloudbilling.APIService
	CloudFunctions  *cloudfunctions.Service
	CloudRun        *run.APIService
	Compute         *compute.Service
	Container       *container.Service
	Dns             *dns.Service
	Domain          *domains.Service
	Iam             *iam.Service
	Kms             *kms.Service
	Logging         *logging.Service
	Monitoring      *monitoring.Service
	Redis           *redis.Service
	ResourceManager *cloudresourcemanager.Service
	ServiceUsage    *serviceusage.Service
	SecretManager   *secretmanager.Service
	Sql             *sql.Service
	Storage         *storage.Service
}

type TestOptions

type TestOptions struct {
	SkipEmptyJsonB bool
}

Jump to

Keyboard shortcuts

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