simplemq

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 4

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 (
	// DefaultQueueAPIRootURL デフォルトのQueue APIルートURL
	DefaultQueueAPIRootURL = "https://secure.sakura.ad.jp/cloud/zone/is1a/api/cloud/1.1"
	// ServiceKeyQueue SDKの種別を示すキー、プロファイルでのエンドポイント取得に利用するもので、Queue APIのエンドポイント切り替えに利用する
	ServiceKeyQueue = "simple_mq_queue"

	// DefaultMessageAPIRootURL デフォルトのMessage APIルートURL
	DefaultMessageAPIRootURL = "https://simplemq.tk1b.api.sacloud.jp"
	// ServiceKeyMessage SDKの種別を示すキー、プロファイルでのエンドポイント取得に利用するもので、Message APIのエンドポイント切り替えに利用する
	ServiceKeyMessage = "simple_mq_message"
)
View Source
const Version = "0.5.1"

Variables

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

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, client saclient.ClientAPI) (*message.Client, error)

func NewMessageClientWithApiUrl

func NewMessageClientWithApiUrl(apiUrl, apiKey string, client saclient.ClientAPI) (*message.Client, error)

func NewQueueClient

func NewQueueClient(client saclient.ClientAPI) (*queue.Client, error)

func NewQueueClientWithApiUrl

func NewQueueClientWithApiUrl(apiUrl string, client saclient.ClientAPI) (*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定義で使用されている認証のための仕組み。saclient-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