serviceusage

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// StateEnabled is Stateに設定するEnableの文字列
	StateEnabled = "ENABLED"

	// StateDisabled is Stateに設定するDisableの文字列
	StateDisabled = "DISABLED"
)

Variables

View Source
var ErrUnsupportedState = &Error{
	Code:    "UnsupportedState",
	Message: "unsupported state",
	KV:      map[string]interface{}{},
}

ErrUnsupportedState is サポートしていないStateが渡された

Functions

func NewUnsupportedState

func NewUnsupportedState(state string) error

NewUnsupportedState is return ErrNotFound

Types

type Error

type Error struct {
	Code    string
	Message string
	KV      map[string]interface{}
	// contains filtered or unexported fields
}

Error is Error情報を保持する struct

func (*Error) Error

func (e *Error) Error() string

Error is error interface func

func (*Error) Is

func (e *Error) Is(target error) bool

Is is err equal check

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap is return unwrap error

type Service

type Service struct {
	Name    string // ex. projects/{$PROJECT_NUMBER}/services/bigquery.googleapis.com
	APIName string // ex. bigquery.googleapis.com
	Parent  string // ex. projects/{$PROJECT_NUMBER}
	State   string // ENABLED or DISABLED
}

Service is ServiceUsage service model https://cloud.google.com/service-usage/docs/reference/rest/v1/Service の内容を格納するためのもの config は現状では使ってないので、入れていない

type ServiceDiff

type ServiceDiff struct {
	Base         *Service
	Target       *Service
	ExistsTarget bool // Targetが存在する場合はtrue. 基本的にはtrueのはずだが、αのものとかでもしかしたら、baseにはあるけど、targetにはないみたいなのがあるかもしれないので、存在している
}

ServiceDiff is ServiceのDiffがある時に返す struct

type ServiceUsageService

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

ServiceUsageService is ServiceUsage Service https://cloud.google.com/service-usage/docs/overview

func NewService

func NewService(ctx context.Context, client *serviceusage.Service, crmv1Client *crmv1.Service) (*ServiceUsageService, error)

NewService is return ServiceUsageService

func (*ServiceUsageService) ListAll

func (s *ServiceUsageService) ListAll(ctx context.Context, projectID string) ([]*Service, error)

ListAll is 指定した ProjectID の ServiceUsage を全件取得する

func (*ServiceUsageService) ListByDiff

func (s *ServiceUsageService) ListByDiff(ctx context.Context, baseProjectID string, targetProjectID string) ([]*ServiceDiff, error)

ListByDiff is base と target のServiceUsageを比較して、Stateの差がある場合、target の ServiceUsage を返す

func (*ServiceUsageService) ListByStateDisabled

func (s *ServiceUsageService) ListByStateDisabled(ctx context.Context, projectID string) ([]*Service, error)

ListByStateDisabled is 指定した ProjectID の Disable になっている ServiceUsage を取得する

func (*ServiceUsageService) ListByStateEnabled

func (s *ServiceUsageService) ListByStateEnabled(ctx context.Context, projectID string) ([]*Service, error)

ListByStateEnabled is 指定した ProjectID の Enable になっている ServiceUsage を取得する

func (*ServiceUsageService) SetState

func (s *ServiceUsageService) SetState(ctx context.Context, name string, state string) error

SetState is APIをEnable/Disable にする name : projects/{$PROJECT_NUMBER}/services/bigquery.googleapis.com 形式の文字列 state : StateEnabled or StateDisabled

Jump to

Keyboard shortcuts

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