monitoringsuite

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

[!WARNING]

このレポジトリの内容は下記に集約・移転しました。 github.com/sacloud/sacloud-sdk-go

今後は上記のレポジトリで開発を行います。 このライブラリを使用している方は、importを変更していただきますようお願いいたします。

// 変更前
import "github.com/sacloud/monitoring-suite-api-go"

// 変更後
import "github.com/sacloud/sacloud-sdk-go/api/monitoring-suite"

monitoring-suite-api-go

Go Reference Tests Go Report Card

さくらのクラウド「モニタリングスイート」APIのGoクライアントライブラリ

概要

このライブラリは、さくらのクラウド「モニタリングスイート」APIをGo言語から利用するためのクライアントです。 OpenAPI仕様から自動生成された型安全なAPIクライアントと、それをラップして使い勝手を向上させたクライアントを提供します。

[!WARNING] v1.0に達するまでは互換性のない形で変更される可能性がありますのでご注意ください。

インストール

go get github.com/sacloud/monitoring-suite-api-go

使い方

package main

import (
    "context"
    "os"

    monitoringsuite "github.com/sacloud/monitoring-suite-api-go"
    "github.com/sacloud/saclient-go"
)

var theClient saclient.Client

func main() {
    ctx := context.Background()
    err := theClient.FlagSet(flag.PanicOnError).Parse(os.Args[1:])
    if err != nil {
        // エラーハンドリング
    }

    err = theClient.SetEnviron(os.Environ())
    if err != nil {
        // エラーハンドリング
    }

    client, err := monitoringsuite.NewClient(&theClient)
    if err != nil {
        // エラーハンドリング
    }

    // 例: アラートプロジェクト一覧取得
    projects, err := monitoringsuite.NewAlertProjectOp(client).List(ctx, nil, nil)
    if err != nil {
        // エラーハンドリング
    }
}

APIの詳細はGoDocやapis/v1/配下の型定義を参照してください。

認証情報

APIを実行するには認証が必要です。インタラクティブな環境の場合おすすめは usacloud を使って設定ファイルを作成することです。たとえば

usacloud config create --name production

にて作成したプロファイル production があるとすると、上記のmain関数をもつバイナリは

./a.out --profile=production

のようにして設定を読み込むことができます。

一方でCI環境のようにファイルに書き出すのが適切ではない場合、環境変数経由で

export SAKURA_ACCESS_TOKEN=TOKEN
export SAKURA_ACCESS_TOKEN_SECRET=SECRET

./a.out

のように指定できます。

OpenAPI仕様について

openapi/openapi.jsonはモニタリングスイート API ドキュメントからダウンロードしたものを一部加工しています。

$ jq 'del(.paths.[].[].requestBody.content.["application/x-www-form-urlencoded", "multipart/form-data"])' openapi.json

開発

ビルドやテストはMakefile経由で実行できます。

make
make test

ライセンス

Copyright (C) 2022-2025 The sacloud/monitoring-suite-api-go Authors. このプロジェクトはApache 2.0 Licenseの下で公開されています。

Documentation

Overview

Deprecated: This module has moved to github.com/sacloud/sacloud-sdk-go. Please migrate to that module. This repository will be archived.

Index

Constants

View Source
const (
	// DefaultAPIRootURL デフォルトのAPIルートURL
	DefaultAPIRootURL = "https://secure.sakura.ad.jp/cloud/zone/is1a/api/monitoring/1.0/"

	// エンドポイントサービスキー
	ServiceKey = "monitoring_suite"
)
View Source
const Version = "0.2.3"

Variables

View Source
var (
	// UserAgent APIリクエスト時のユーザーエージェント
	UserAgent = fmt.Sprintf(
		"monitoring-suite-api-go/%s (%s/%s; +https://github.com/sacloud/monitoring-suite-api-go)",
		Version,
		runtime.GOOS,
		runtime.GOARCH,
	)
)

Functions

func NewClient

func NewClient(client saclient.ClientAPI) (*v1.Client, error)

func NewClientWithApiUrl

func NewClientWithApiUrl(apiUrl string, client saclient.ClientAPI) (*v1.Client, error)

func Unwrap

func Unwrap[T json.Unmarshaler, U json.Marshaler](dst T, src U) (T, error)

Types

type AlertProjectAPI

type AlertProjectAPI interface {
	List(ctx context.Context, count *int, from *int) ([]v1.AlertProject, error)
	Create(ctx context.Context, params AlertProjectCreateParams) (*v1.AlertProject, error)
	Read(ctx context.Context, id string) (*v1.AlertProject, error)
	Update(ctx context.Context, id string, request AlertProjectUpdateParams) (*v1.AlertProject, error)
	Delete(ctx context.Context, id string) error

	ListHistories(ctx context.Context, params AlertsProjectsHistoriesListParams) ([]v1.History, error)
	ReadHistory(ctx context.Context, projectId string, historyId uuid.UUID) (*v1.History, error)
}

func NewAlertProjectOp

func NewAlertProjectOp(client *v1.Client) AlertProjectAPI

type AlertProjectCreateParams

type AlertProjectCreateParams struct {
	Name        string
	Description *string
}

type AlertProjectUpdateParams

type AlertProjectUpdateParams struct {
	Name        *string
	Description *string
}

type AlertRuleAPI

type AlertRuleAPI interface {
	List(ctx context.Context, projectId string, count *int, from *int) ([]v1.AlertRule, error)
	Create(ctx context.Context, projectId string, params AlertRuleCreateParams) (*v1.AlertRule, error)
	Read(ctx context.Context, projectId string, ruleId uuid.UUID) (*v1.AlertRule, error)
	Update(ctx context.Context, projectId string, ruleId uuid.UUID, params AlertRuleUpdateParams) (*v1.AlertRule, error)
	Delete(ctx context.Context, projectId string, ruleId uuid.UUID) error

	ListHistories(ctx context.Context, projectId string, ruleId uuid.UUID, params AlertRuleListHistoriesParams) ([]v1.History, error)
	ReadHistory(ctx context.Context, projectId string, ruleId uuid.UUID, historyId uuid.UUID) (*v1.History, error)
}

func NewAlertRuleOp

func NewAlertRuleOp(client *v1.Client) AlertRuleAPI

type AlertRuleCreateParams

type AlertRuleCreateParams struct {
	MetricsStorageID          string // mandatory
	Name                      *string
	Query                     string // mandatory
	Format                    *string
	Template                  *string
	EnabledWarning            *bool
	EnabledCritical           *bool
	ThresholdWarning          *string
	ThresholdCritical         *string
	ThresholdDurationWarning  *int64
	ThresholdDurationCritical *int64
}

type AlertRuleListHistoriesParams

type AlertRuleListHistoriesParams struct {
	Count    *int
	From     *int
	Open     *bool
	Severity *v1.AlertsProjectsRulesHistoriesListSeverity
	StartsAt *time.Time
}

type AlertRuleUpdateParams

type AlertRuleUpdateParams struct {
	MetricsStorageID          *string
	Name                      *string
	Query                     *string
	Format                    *string
	Template                  *string
	EnabledWarning            *bool
	EnabledCritical           *bool
	ThresholdWarning          *string
	ThresholdCritical         *string
	ThresholdDurationWarning  *int64
	ThresholdDurationCritical *int64
}

type AlertsProjectsHistoriesListParams

type AlertsProjectsHistoriesListParams struct {
	ProjectID string // mandatory
	Count     *int
	From      *int
	Open      *bool
	Severity  *v1.AlertsProjectsHistoriesListSeverity
	StartsAt  *time.Time
}

type DashboardProjectAPI

type DashboardProjectAPI interface {
	List(ctx context.Context, count *int, from *int) ([]v1.DashboardProject, error)
	Create(ctx context.Context, request DashboardProjectCreateParams) (*v1.DashboardProject, error)
	Read(ctx context.Context, id string) (*v1.DashboardProject, error)
	Update(ctx context.Context, id string, params DashboardProjectUpdateParams) (*v1.DashboardProject, error)
	Delete(ctx context.Context, id string) error
}

func NewDashboardOp

func NewDashboardOp(client *v1.Client) DashboardProjectAPI

type DashboardProjectCreateParams

type DashboardProjectCreateParams struct {
	Name        string
	Description *string
}

type DashboardProjectUpdateParams

type DashboardProjectUpdateParams struct {
	Name        *string
	Description *string
}

type Error

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

func NewAPIError

func NewAPIError(method string, code int, err error) *Error

func NewError

func NewError(msg string, err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type LogMeasureRuleAPI

type LogMeasureRuleAPI interface {
	List(ctx context.Context, projectId string, count *int, from *int) ([]v1.LogMeasureRule, error)
	Create(ctx context.Context, projectId string, params LogMeasureRuleCreateParams) (*v1.LogMeasureRule, error)
	Read(ctx context.Context, projectId string, ruleId uuid.UUID) (*v1.LogMeasureRule, error)
	Update(ctx context.Context, projectId string, ruleId uuid.UUID, params LogMeasureRuleUpdateParams) (*v1.LogMeasureRule, error)
	Delete(ctx context.Context, projectId string, ruleId uuid.UUID) error

	ListHistories(ctx context.Context, projectId string, params LogMeasureRuleListHistoriesParams) ([]v1.History, error)
	ReadHistory(ctx context.Context, projectId string, historyId uuid.UUID) (*v1.History, error)
}

func NewLogMeasureRuleOp

func NewLogMeasureRuleOp(client *v1.Client) LogMeasureRuleAPI

type LogMeasureRuleCreateParams

type LogMeasureRuleCreateParams struct {
	LogStorageID     string
	MetricsStorageID string
	Name             *string
	Description      *string
	Rule             v1.LogMeasureRuleModel
}

type LogMeasureRuleListHistoriesParams

type LogMeasureRuleListHistoriesParams struct {
	Count    *int
	From     *int
	Open     *bool
	Severity *v1.AlertsProjectsHistoriesListSeverity
	StartsAt *time.Time
}

type LogMeasureRuleUpdateParams

type LogMeasureRuleUpdateParams struct {
	LogStorageID     *string
	MetricsStorageID *string
	Name             *string
	Description      *string
	Rule             *v1.LogMeasureRuleModel
}

type LogRoutingAPI

type LogRoutingAPI interface {
	List(ctx context.Context, params LogsRoutingsListParams) ([]v1.LogRouting, error)
	Create(ctx context.Context, params LogsRoutingCreateParams) (*v1.LogRouting, error)
	Read(ctx context.Context, id uuid.UUID) (*v1.LogRouting, error)
	Update(ctx context.Context, id uuid.UUID, params LogsRoutingUpdateParams) (*v1.LogRouting, error)
	Delete(ctx context.Context, id uuid.UUID) error
}

func NewLogRoutingOp

func NewLogRoutingOp(client *v1.Client) LogRoutingAPI

type LogStorageCreateParams

type LogStorageCreateParams struct {
	Name           string
	Description    *string
	IsSystem       bool
	Classification *v1.LogStorageCreateRequestClassification
}

type LogStorageUpdateParams

type LogStorageUpdateParams struct {
	Name        *string
	Description *string
}

type LogsRoutingCreateParams

type LogsRoutingCreateParams struct {
	PublisherCode string
	ResourceID    *string
	Variant       string
	LogStorageID  string
}

type LogsRoutingUpdateParams

type LogsRoutingUpdateParams struct {
	PublisherCode *string
	ResourceID    *string
	Variant       *string
	LogStorageID  *string
}

type LogsRoutingsListParams

type LogsRoutingsListParams struct {
	Count         *int
	From          *int
	PublisherCode *string
	ResourceID    *int64
	Variant       *string
}

type LogsStorageAPI

type LogsStorageAPI interface {
	List(ctx context.Context, params LogsStoragesListParams) ([]v1.LogStorage, error)
	Create(ctx context.Context, params LogStorageCreateParams) (*v1.LogStorage, error)
	Read(ctx context.Context, id string) (*v1.LogStorage, error)
	Update(ctx context.Context, id string, params LogStorageUpdateParams) (*v1.LogStorage, error)
	Delete(ctx context.Context, id string) error

	SetExpire(ctx context.Context, resourceID string, days int) (*v1.LogStorage, error)
	ReadDailyStats(ctx context.Context, resourceID string, startDate, endDate *time.Time) ([]v1.LogStorageDailyUsage, error)
	ReadMonthlyStats(ctx context.Context, resourceID string, year int) ([]v1.LogStorageMonthlyUsage, error)

	ListKeys(ctx context.Context, logResourceId string, count *int, from *int) ([]v1.LogStorageAccessKey, error)
	CreateKey(ctx context.Context, logResourceId string, description *string) (*v1.LogStorageAccessKey, error)
	ReadKey(ctx context.Context, logResourceId string, id uuid.UUID) (*v1.LogStorageAccessKey, error)
	UpdateKey(ctx context.Context, logResourceId string, id uuid.UUID, description *string) (*v1.LogStorageAccessKey, error)
	DeleteKey(ctx context.Context, logResourceId string, id uuid.UUID) error
}

func NewLogsStorageOp

func NewLogsStorageOp(client *v1.Client) LogsStorageAPI

type LogsStoragesListParams

type LogsStoragesListParams struct {
	AccountID            *string
	BucketClassification *v1.LogsStoragesListBucketClassification
	Count                *int
	From                 *int
	IsSystem             *bool
	ResourceID           *string
	Status               *v1.LogsStoragesListStatus
}

type ManagementAPI

type ManagementAPI interface {
	ResourceLimits(ctx context.Context) (*v1.ResourcesLimits, error)
	ReadProvisioning(ctx context.Context) (*v1.Provisioning, error)
	CreateProvisioning(ctx context.Context, request ProvisioningCreateParam) (*v1.Provisioning, error)
}

func NewManagementOp

func NewManagementOp(client *v1.Client) ManagementAPI

type MetricsRoutingAPI

type MetricsRoutingAPI interface {
	List(ctx context.Context, params MetricsRoutingsListParams) ([]v1.MetricsRouting, error)
	Create(ctx context.Context, params MetricsRoutingCreateParams) (*v1.MetricsRouting, error)
	Read(ctx context.Context, id uuid.UUID) (*v1.MetricsRouting, error)
	Update(ctx context.Context, id uuid.UUID, params MetricsRoutingUpdateParams) (*v1.MetricsRouting, error)
	Delete(ctx context.Context, id uuid.UUID) error
}

func NewMetricsRoutingOp

func NewMetricsRoutingOp(client *v1.Client) MetricsRoutingAPI

type MetricsRoutingCreateParams

type MetricsRoutingCreateParams struct {
	PublisherCode    string
	ResourceID       *string
	Variant          string
	MetricsStorageID string
}

type MetricsRoutingUpdateParams

type MetricsRoutingUpdateParams struct {
	PublisherCode    *string
	ResourceID       *string
	Variant          *string
	MetricsStorageID *string
}

type MetricsRoutingsListParams

type MetricsRoutingsListParams struct {
	Count         *int
	From          *int
	PublisherCode *string
	ResourceID    *int64
	Variant       *string
}

type MetricsStorageAPI

type MetricsStorageAPI interface {
	List(ctx context.Context, params MetricsStorageListParams) ([]v1.MetricsStorage, error)
	Create(ctx context.Context, request MetricsStorageCreateParams) (*v1.MetricsStorage, error)
	Read(ctx context.Context, id string) (*v1.MetricsStorage, error)
	Update(ctx context.Context, id string, request MetricsStorageUpdateParams) (*v1.MetricsStorage, error)
	Delete(ctx context.Context, id string) error

	ReadDailyStats(ctx context.Context, resourceID string, startDate, endDate *time.Time) ([]v1.MetricsStorageDailyUsage, error)
	ReadMonthlyStats(ctx context.Context, resourceID string, year int) ([]v1.MetricsStorageMonthlyUsage, error)

	ListKeys(ctx context.Context, metricsResourceId string, count *int, from *int) ([]v1.MetricsStorageAccessKey, error)
	CreateKey(ctx context.Context, metricsResourceId string, description *string) (*v1.MetricsStorageAccessKey, error)
	ReadKey(ctx context.Context, metricsResourceId string, id uuid.UUID) (*v1.MetricsStorageAccessKey, error)
	UpdateKey(ctx context.Context, metricsResourceId string, id uuid.UUID, description *string) (*v1.MetricsStorageAccessKey, error)
	DeleteKey(ctx context.Context, metricsResourceId string, id uuid.UUID) error
}

func NewMetricsStorageOp

func NewMetricsStorageOp(client *v1.Client) MetricsStorageAPI

type MetricsStorageCreateParams

type MetricsStorageCreateParams struct {
	Name        string
	Description *string
	IsSystem    bool
}

type MetricsStorageListParams

type MetricsStorageListParams struct {
	Count      *int
	From       *int
	AccountID  *string
	ResourceID *string
	IsSystem   *bool
}

type MetricsStorageUpdateParams

type MetricsStorageUpdateParams struct {
	Name        *string
	Description *string
}

type NotificationRoutingAPI

type NotificationRoutingAPI interface {
	List(ctx context.Context, projectId string, count, from *int) ([]v1.NotificationRouting, error)
	Create(ctx context.Context, projectId string, params NotificationRoutingCreateParams) (*v1.NotificationRouting, error)
	Read(ctx context.Context, projectId string, id uuid.UUID) (*v1.NotificationRouting, error)
	Update(ctx context.Context, projectId string, id uuid.UUID, params NotificationRoutingUpdateParams) (*v1.NotificationRouting, error)
	Delete(ctx context.Context, projectId string, id uuid.UUID) error

	Reorder(ctx context.Context, projectId string, orders []v1.NotificationRoutingOrderRequest) error
}

func NewNotificationRoutingOp

func NewNotificationRoutingOp(client *v1.Client) NotificationRoutingAPI

type NotificationRoutingCreateParams

type NotificationRoutingCreateParams struct {
	// Fields based on v1.NotificationRouting
	NotificationTargetUID uuid.UUID
	MatchLabels           []v1.MatchLabelsItem
	ResendIntervalMinutes *int
}

type NotificationRoutingUpdateParams

type NotificationRoutingUpdateParams struct {
	// Fields based on v1.PatchedNotificationRouting
	NotificationTargetUID *uuid.UUID
	MatchLabels           []v1.MatchLabelsItem
	ResendIntervalMinutes *int
}

type NotificationTargetAPI

type NotificationTargetAPI interface {
	List(ctx context.Context, projectId string, params NotificationTargetsListParams) ([]v1.NotificationTarget, error)
	Create(ctx context.Context, projectId string, params NotificationTargetCreateParams) (*v1.NotificationTarget, error)
	Read(ctx context.Context, projectId string, id uuid.UUID) (*v1.NotificationTarget, error)
	Update(ctx context.Context, projectId string, id uuid.UUID, params NotificationTargetUpdateParams) (*v1.NotificationTarget, error)
	Delete(ctx context.Context, projectId string, id uuid.UUID) error
}

func NewNotificationTargetOp

func NewNotificationTargetOp(client *v1.Client) NotificationTargetAPI

type NotificationTargetCreateParams

type NotificationTargetCreateParams struct {
	ServiceType v1.NotificationTargetServiceType
	URL         *url.URL
	Description *string
}

type NotificationTargetUpdateParams

type NotificationTargetUpdateParams struct {
	ServiceType *v1.PatchedNotificationTargetRequestServiceType
	URL         *string
	Description *string
}

type NotificationTargetsListParams

type NotificationTargetsListParams struct {
	Count *int
	From  *int
}

type ProvisioningCreateParam

type ProvisioningCreateParam struct {
	Logs    *v1.ProvisioningExist
	Metrics *v1.ProvisioningExist
}

type PublisherAPI

type PublisherAPI interface {
	List(ctx context.Context, count *int, from *int) ([]v1.Publisher, error)
	Read(ctx context.Context, code string) (*v1.Publisher, error)
}

func NewPublisherOp

func NewPublisherOp(client *v1.Client) PublisherAPI

type TracesStorageAPI

type TracesStorageAPI interface {
	List(ctx context.Context, params TracesStorageListParams) ([]v1.TraceStorage, error)
	Create(ctx context.Context, request TracesStorageCreateParams) (*v1.TraceStorage, error)
	Read(ctx context.Context, id string) (*v1.TraceStorage, error)
	Update(ctx context.Context, id string, request TracesStorageUpdateParams) (*v1.TraceStorage, error)
	Delete(ctx context.Context, id string) error

	SetExpire(ctx context.Context, resourceID string, days int) (*v1.TraceStorage, error)
	ReadDailyStats(ctx context.Context, resourceID string, startDate, endDate *time.Time) ([]v1.LogStorageDailyUsage, error)
	ReadMonthlyStats(ctx context.Context, resourceID string, year int) ([]v1.LogStorageMonthlyUsage, error)

	ListKeys(ctx context.Context, tracesResourceId string, count *int, from *int) ([]v1.TraceStorageAccessKey, error)
	CreateKey(ctx context.Context, tracesResourceId string, description *string) (*v1.TraceStorageAccessKey, error)
	ReadKey(ctx context.Context, tracesResourceId string, id uuid.UUID) (*v1.TraceStorageAccessKey, error)
	UpdateKey(ctx context.Context, tracesResourceId string, id uuid.UUID, description *string) (*v1.TraceStorageAccessKey, error)
	DeleteKey(ctx context.Context, tracesResourceId string, id uuid.UUID) error
}

func NewTracesStorageOp

func NewTracesStorageOp(client *v1.Client) TracesStorageAPI

type TracesStorageCreateParams

type TracesStorageCreateParams struct {
	Name           string
	Description    *string
	Classification *v1.TraceStorageCreateRequestClassification
}

type TracesStorageListParams

type TracesStorageListParams struct {
	Count                *int
	From                 *int
	AccountID            *string
	ResourceID           *string
	BucketClassification *v1.TracesStoragesListLogStorageBucketClassification
}

type TracesStorageUpdateParams

type TracesStorageUpdateParams struct {
	Name        *string
	Description *string
}

Directories

Path Synopsis
apis
v1
Code generated by ogen, DO NOT EDIT.
Code generated by ogen, DO NOT EDIT.

Jump to

Keyboard shortcuts

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