simplemq

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README

sacloud/simplemq-api-go

Go言語向けのさくらのクラウド SimpleMQ APIライブラリ

SimpleMQ APIドキュメント: https://manual.sakura.ad.jp/api/cloud/simplemq/

概要

sacloud/simplemq-api-goはさくらのクラウド SimpleMQ APIをGo言語から利用するためのAPIライブラリです。

キューの作成や削除などリソース管理のためのQueue APIと、メッセージの送受信を行うMessage APIに分かれています。

使い方

queue_test.go / message_test.go を参照。

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

TODO

  • Testの追加

License

simplemq-api-go Copyright (C) 2025- The sacloud/simplemq-api-go authors. This project is published under Apache 2.0 License.

Documentation

Index

Constants

View Source
const DefaultMessageAPIRootURL = "https://simplemq.tk1b.api.sacloud.jp"

DefaultMessageAPIRootURL デフォルトのMessage APIルートURL

View Source
const DefaultQueueAPIRootURL = "https://secure.sakura.ad.jp/cloud/zone/tk1b/api/cloud/1.1"

DefaultQueueAPIRootURL デフォルトのQueue APIルートURL

View Source
const Version = "0.2.0"

Variables

View Source
var UserAgent = fmt.Sprintf(
	"simplemq-api-go/%s (%s/%s; +https://github.com/sacloud/simplemq-api-go) %s",
	Version,
	runtime.GOOS,
	runtime.GOARCH,
	client.DefaultUserAgent,
)

UserAgent APIリクエスト時のユーザーエージェント

Functions

func GetQueueID

func GetQueueID(q *queue.CommonServiceItem) string

func GetQueueName

func GetQueueName(q *queue.CommonServiceItem) string

func NewMessageClient

func NewMessageClient(apiKey string, params ...client.ClientParam) (*message.Client, error)

func NewMessageClientWithApiUrl

func NewMessageClientWithApiUrl(apiUrl, apiKey string, params ...client.ClientParam) (*message.Client, error)

func NewQueueClient

func NewQueueClient(params ...client.ClientParam) (*queue.Client, error)

func NewQueueClientWithApiUrl

func NewQueueClientWithApiUrl(apiUrl string, params ...client.ClientParam) (*queue.Client, error)

Types

type ApiKeySecuritySource

type ApiKeySecuritySource struct {
	Token string
}

func (ApiKeySecuritySource) ApiKeyAuth

func (ss ApiKeySecuritySource) ApiKeyAuth(ctx context.Context, operationName message.OperationName) (message.ApiKeyAuth, error)

type DummySecuritySource

type DummySecuritySource struct {
	Token string
}

SecuritySourceはOpenAPI定義で使用されている認証のための仕組み。api-client-goが処理するので、ogen用はダミーで誤魔化す

func (DummySecuritySource) ApiKeyAuth

func (ss DummySecuritySource) ApiKeyAuth(ctx context.Context, operationName queue.OperationName) (queue.ApiKeyAuth, error)

type Error added in v0.2.0

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

func NewAPIError added in v0.2.0

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

func NewError added in v0.2.0

func NewError(msg string, err error) *Error

func (*Error) Error added in v0.2.0

func (e *Error) Error() string

func (*Error) Unwrap added in v0.2.0

func (e *Error) Unwrap() error

type MessageAPI

type MessageAPI interface {
	Send(_ context.Context, content string) (*message.NewMessage, error)
	Receive(_ context.Context) ([]message.Message, error)
	ExtendTimeout(_ context.Context, messageID string) (*message.Message, error)
	Delete(_ context.Context, messageID string) error
}

func NewMessageOp

func NewMessageOp(client *message.Client, queueName string) MessageAPI

type QueueAPI

func NewQueueOp

func NewQueueOp(client *queue.Client) QueueAPI

Directories

Path Synopsis
apis
v1/message
Code generated by ogen, DO NOT EDIT.
Code generated by ogen, DO NOT EDIT.
v1/queue
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