metricsscope

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GathererService added in v1.20.0

type GathererService struct {
	MetricsScopesService *Service
	AssetService         *assetbox.Service
}

func NewGathererService added in v1.20.0

func NewGathererService(ctx context.Context, metricsScopesService *Service, assetService *assetbox.Service) (*GathererService, error)

func (*GathererService) CleanUp added in v1.21.0

func (s *GathererService) CleanUp(ctx context.Context, scopingProject string) (cleanUpCount int, err error)

CleanUp is 指定したscopingProjectのmetrics scopeをすべて削除して、初期状態にする

func (*GathererService) GatherMonitoredProjects added in v1.20.0

func (s *GathererService) GatherMonitoredProjects(ctx context.Context, scopingProject string, parentScope assetbox.Scope, query string) (gatherCount int, err error)

GatherMonitoredProjects is scopingProjectのMetricsScopeにparentResourceID配下のProjectを追加する

すでに存在しているProjectは無視する queryはCloud Asset APIのquery https://cloud.google.com/asset-inventory/docs/searching-resources?hl=ja#how_to_construct_a_query

type MetricsScope

type MetricsScope struct {
	// Immutable. The resource name of the Monitoring Metrics Scope.
	// On input, the resource name can be specified with the
	// scoping project ID or number. On output, the resource name is
	// specified with the scoping project number.
	// Example:
	// `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
	Name string `json:"name"`

	// Output only. The time when this `Metrics Scope` was created.
	CreateTime time.Time `json:"createTime"`

	// Output only. The time when this `Metrics Scope` record was last updated.
	UpdateTime time.Time `json:"updateTime"`

	// Output only. The list of projects monitored by this `Metrics Scope`.
	MonitoredProjects []*MonitoredProject `json:"monitoredProjects"`
}

func NewMetricsScope

func NewMetricsScope(value *metricsscopepb.MetricsScope) *MetricsScope

func (*MetricsScope) ScopingProjectIDOrNumber

func (ms *MetricsScope) ScopingProjectIDOrNumber() (string, error)

ScopingProjectIDOrNumber is MetricsScope.NameからProjectIDOrNumberを抜き出す 基本、ProjectNumberが返ってくる

type MonitoredProject

type MonitoredProject struct {
	// Immutable. The resource name of the `MonitoredProject`. On input, the resource name
	// includes the scoping project ID and monitored project ID. On output, it
	// contains the equivalent project numbers.
	// Example:
	// `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
	Name string `json:"name"`

	CreateTime time.Time `json:"createTime"`
}

func NewMonitoredProject

func NewMonitoredProject(value *metricsscopepb.MonitoredProject) *MonitoredProject

func (*MonitoredProject) MonitoredProjectIDOrNumber

func (mp *MonitoredProject) MonitoredProjectIDOrNumber() (string, error)

MonitoredProjectIDOrNumber is MonitoredProject.NameからMonitoredProjectIDOrNumberを抜き出す 基本、ProjectNumberが返ってくる

func (*MonitoredProject) ScopingProjectIDOrNumber

func (mp *MonitoredProject) ScopingProjectIDOrNumber() (string, error)

ScopingProjectIDOrNumber is MonitoredProject.NameからScopingProjectIDOrNumberを抜き出す 基本、ProjectNumberが返ってくる

type Service

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

Service is Monitoring Metrics Scope Service

func NewService

func NewService(ctx context.Context, metricsScopeClient *metricsscope.MetricsScopesClient) (*Service, error)

func (*Service) CreateMonitoredProject

func (s *Service) CreateMonitoredProject(ctx context.Context, scopingProject string, monitoredProject string) (ret *MonitoredProject, err error)

CreateMonitoredProject is scopingProjectにmonitoringProjectのmetricsを追加する scopingProject, monitoringProjectはPROJECT_ID or PROJECT_NUMBERを指定する

func (*Service) DeleteMonitoredProject

func (s *Service) DeleteMonitoredProject(ctx context.Context, scopingProject string, monitoredProject string) (err error)

DeleteMonitoredProject is 指定したMonitoredProjectをScoping Projectのmetrics scopeから削除する scopingProject, monitoringProjectはPROJECT_ID or PROJECT_NUMBERを指定する

func (*Service) DeleteMonitoredProjectByMonitoredProjectName

func (s *Service) DeleteMonitoredProjectByMonitoredProjectName(ctx context.Context, monitoredProjectName string) (err error)

DeleteMonitoredProjectByMonitoredProjectName is 指定したMonitoredProjectを削除する

Example:
  `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`

func (*Service) GetMetricsScope

func (s *Service) GetMetricsScope(ctx context.Context, project string) (ret *MetricsScope, err error)

GetMetricsScope is 指定したScopingProjectのMetricsScopeを返す 指定するのはPROJECT_ID or PROJECT_NUMBER

func (*Service) ListMetricsScopesByMonitoredProject

func (s *Service) ListMetricsScopesByMonitoredProject(ctx context.Context, project string) (rets []*MetricsScope, err error)

ListMetricsScopesByMonitoredProject is 指定したProjectを追加しているMetricsScopeの一覧を返す 指定するのはPROJECT_ID or PROJECT_NUMBER

Jump to

Keyboard shortcuts

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