Help us shape the future of Go! Take the 2026 Go Developer Survey

services

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: Apache-2.0 Imports: 1 Imported by: 13

README

services

さくらのクラウド高レベルAPIライブラリ向け基盤

さくらのクラウドAPIライブラリをラップし、各リソースに対する統一的な操作インターフェースを提供します。

License

sacloud/services Copyright (C) 2022 The sacloud/services Authors.

This project is published under Apache 2.0 License.

Documentation

Index

Constants

View Source
const Version = "0.0.1"

Version バージョン

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	OptionDefs             []*meta.Option
	FormatErrorFieldNameFn func(name string) string
	MetaTagName            string // デフォルト: meta.DefaultTagName
}

Config サービスのバリデーションやメタデータ出力のためのコンフィグ

type Info

type Info struct {
	// サービスの名前
	Name string

	// サービスの説明
	Description string

	// 親リソースを特定するために必要なフィールドの名前
	//
	// 例えばサーバの配下のリソースであれば"ServerId"などが指定される
	ParentKeys []string
}

Info サービスについての情報

type Operations

type Operations int

Operations サービスがサポートする操作の種別

const (
	OperationsUnknown Operations = iota
	OperationsCreate             // Id:不要	/ 戻り値:単体
	OperationsRead               // Id:要 	/ 戻り値:単体
	OperationsUpdate             // Id:要 	/ 戻り値:単体
	OperationsDelete             // Id:要 	/ 戻り値:なし
	OperationsList               // Id:不要	/ 戻り値: スライス
	OperationsAction             // Id:要 	/ 戻り値: なし
)

func (Operations) String

func (o Operations) String() string

type ParameterInitializer

type ParameterInitializer interface {
	// Initialize パラメータの初期カスタマイズ
	Initialize()
}

ParameterInitializer パラメータの初期化時に特別な処理を行いたい場合に実装すべきインターフェース

type ParameterValidator

type ParameterValidator interface {
	Validate() error
}

ParameterValidator パラメータが独自のバリデーションを実装する場合に実装すべきインターフェース

type Service

type Service interface {
	// Info サービスについての情報を返す
	Info() *Info

	// Operations サポートしている操作のメタデータ一覧
	// この要素それぞれに対しxxxWithContext()が存在することが期待される
	Operations() []SupportedOperation

	// Config コンフィグ
	Config() *Config
}

Service 各サービスが実装すべきインターフェース

type SupportedOperation

type SupportedOperation struct {
	// 操作(メソッド)の名前
	Name string

	// 操作種別、種別によりIdが必要/不要が決定される
	OperationType Operations
}

SupportedOperation サービスが提供する操作のメタデータ

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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