Documentation
¶
Overview ¶
Package cloud — вызовы API cloud.ru поверх клиентов internal/gen. Запрос собирает сгенерированный клиент; ответ 2xx отдаётся телом как есть — вывод --json без потерь полей, которых нет в спецификации; не 2xx — *APIError.
Index ¶
- Variables
- func IsNotFound(err error) bool
- func ParseOperation(raw []byte) (op operation.Operation, ok bool)
- func ParseVPCOperation(raw []byte) (op operation.Operation, ok bool)
- func PollError(err error) error
- type APIError
- type ClickHouse
- func (h *ClickHouse) Cluster(ctx context.Context, id string) ([]byte, error)
- func (h *ClickHouse) ClusterOperations(ctx context.Context, id string) ([]byte, error)
- func (h *ClickHouse) Clusters(ctx context.Context, project string) ([]byte, error)
- func (h *ClickHouse) CreateCluster(ctx context.Context, c ClickHouseClusterCreate) ([]byte, error)
- func (h *ClickHouse) CreateDatabase(ctx context.Context, cluster, name string) ([]byte, error)
- func (h *ClickHouse) CreateUser(ctx context.Context, cluster, name, password string, roles []string) ([]byte, error)
- func (h *ClickHouse) Database(ctx context.Context, cluster, name string) ([]byte, error)
- func (h *ClickHouse) Databases(ctx context.Context, cluster string) ([]byte, error)
- func (h *ClickHouse) DeleteCluster(ctx context.Context, id string) ([]byte, error)
- func (h *ClickHouse) DeleteDatabase(ctx context.Context, cluster, name string) ([]byte, error)
- func (h *ClickHouse) DeleteUser(ctx context.Context, cluster, name string) ([]byte, error)
- func (h *ClickHouse) GrantRole(ctx context.Context, cluster, name, role string) ([]byte, error)
- func (h *ClickHouse) Operation(ctx context.Context, id string) ([]byte, error)
- func (h *ClickHouse) Operations() operation.Getter
- func (h *ClickHouse) ProbeProject(ctx context.Context, project string) ([]byte, error)
- func (h *ClickHouse) RevokeRole(ctx context.Context, cluster, name, role string) ([]byte, error)
- func (h *ClickHouse) Roles(ctx context.Context, cluster string) ([]byte, error)
- func (h *ClickHouse) Specs(ctx context.Context, version, zone, role string) ([]byte, error)
- func (h *ClickHouse) UpdateCluster(ctx context.Context, id string, u ClickHouseClusterUpdate) ([]byte, error)
- func (h *ClickHouse) UpdateUser(ctx context.Context, cluster, name string, password *string, roles []string) ([]byte, error)
- func (h *ClickHouse) User(ctx context.Context, cluster, name string) ([]byte, error)
- func (h *ClickHouse) Users(ctx context.Context, cluster string) ([]byte, error)
- func (h *ClickHouse) Versions(ctx context.Context) ([]byte, error)
- type ClickHouseClusterCreate
- type ClickHouseClusterUpdate
- type ClickHouseConfig
- type ClickHouseKeeper
- type Compute
- func (c *Compute) CreateSubnet(ctx context.Context, s SubnetCreate) ([]byte, error)
- func (c *Compute) DeleteSubnet(ctx context.Context, id string) ([]byte, error)
- func (c *Compute) Subnet(ctx context.Context, id string) ([]byte, error)
- func (c *Compute) Subnets(ctx context.Context, f SubnetFilter) ([]byte, error)
- func (c *Compute) Zones(ctx context.Context) ([]byte, error)
- type IAM
- func (s *IAM) AccessKey(ctx context.Context, account, id string) ([]byte, error)
- func (s *IAM) AccessKeys(ctx context.Context, account string) ([]byte, error)
- func (s *IAM) CreateAccessKey(ctx context.Context, account, description, ttl string) ([]byte, error)
- func (s *IAM) CreateServiceAccount(ctx context.Context, project, name, description string) ([]byte, error)
- func (s *IAM) DeleteAccessKey(ctx context.Context, account, id string) ([]byte, error)
- func (s *IAM) DeleteServiceAccount(ctx context.Context, id string) ([]byte, error)
- func (s *IAM) Grant(ctx context.Context, project, subject, role, expires string) ([]byte, error)
- func (s *IAM) Permission(ctx context.Context, id string) ([]byte, error)
- func (s *IAM) Permissions(ctx context.Context, filter string) ([]byte, error)
- func (s *IAM) Revoke(ctx context.Context, id string) ([]byte, error)
- func (s *IAM) ServiceAccount(ctx context.Context, id string) ([]byte, error)
- func (s *IAM) ServiceAccounts(ctx context.Context, project string) ([]byte, error)
- type Kafka
- func (k *Kafka) Cluster(ctx context.Context, id string) ([]byte, error)
- func (k *Kafka) ClusterOperations(ctx context.Context, id string) ([]byte, error)
- func (k *Kafka) Clusters(ctx context.Context, project string) ([]byte, error)
- func (k *Kafka) CreateCluster(ctx context.Context, c KafkaClusterCreate) ([]byte, error)
- func (k *Kafka) CreateTopic(ctx context.Context, cluster, name string, partitions, replication int32, ...) ([]byte, error)
- func (k *Kafka) CreateUser(ctx context.Context, cluster, name, password string, roles []string) ([]byte, error)
- func (k *Kafka) DeleteCluster(ctx context.Context, id string) ([]byte, error)
- func (k *Kafka) DeleteTopic(ctx context.Context, cluster, name string) ([]byte, error)
- func (k *Kafka) DeleteUser(ctx context.Context, cluster, name string) ([]byte, error)
- func (k *Kafka) Operation(ctx context.Context, id string) ([]byte, error)
- func (k *Kafka) Operations() operation.Getter
- func (k *Kafka) Roles(ctx context.Context, cluster string) ([]byte, error)
- func (k *Kafka) Specs(ctx context.Context, f KafkaSpecFilter) ([]byte, error)
- func (k *Kafka) Topic(ctx context.Context, cluster, name string) ([]byte, error)
- func (k *Kafka) Topics(ctx context.Context, cluster, filter string) ([]byte, error)
- func (k *Kafka) UpdateCluster(ctx context.Context, id string, u KafkaClusterUpdate) ([]byte, error)
- func (k *Kafka) UpdateTopic(ctx context.Context, cluster, name string, u KafkaTopicUpdate) ([]byte, error)
- func (k *Kafka) UpdateUser(ctx context.Context, cluster, name string, password *string, roles []string) ([]byte, error)
- func (k *Kafka) User(ctx context.Context, cluster, name string) ([]byte, error)
- func (k *Kafka) Users(ctx context.Context, cluster string) ([]byte, error)
- func (k *Kafka) Versions(ctx context.Context) ([]byte, error)
- type KafkaClusterCreate
- type KafkaClusterUpdate
- type KafkaSpecFilter
- type KafkaTopicUpdate
- type Logging
- type Options
- type Redis
- func (r *Redis) Cluster(ctx context.Context, id string) ([]byte, error)
- func (r *Redis) ClusterOperations(ctx context.Context, id string) ([]byte, error)
- func (r *Redis) Clusters(ctx context.Context, project string) ([]byte, error)
- func (r *Redis) CreateCluster(ctx context.Context, c RedisClusterCreate) ([]byte, error)
- func (r *Redis) CreateUser(ctx context.Context, cluster, name, password string, roles []string) ([]byte, error)
- func (r *Redis) DeleteCluster(ctx context.Context, id string) ([]byte, error)
- func (r *Redis) DeleteUser(ctx context.Context, cluster, name string) ([]byte, error)
- func (r *Redis) Operation(ctx context.Context, id string) ([]byte, error)
- func (r *Redis) Operations() operation.Getter
- func (r *Redis) Roles(ctx context.Context, cluster string) ([]byte, error)
- func (r *Redis) Specs(ctx context.Context, f RedisSpecFilter) ([]byte, error)
- func (r *Redis) UpdateCluster(ctx context.Context, id string, u RedisClusterUpdate) ([]byte, error)
- func (r *Redis) UpdateUser(ctx context.Context, cluster, name string, password *string, roles []string) ([]byte, error)
- func (r *Redis) User(ctx context.Context, cluster, name string) ([]byte, error)
- func (r *Redis) Users(ctx context.Context, cluster string) ([]byte, error)
- func (r *Redis) Versions(ctx context.Context) ([]byte, error)
- type RedisClusterCreate
- type RedisClusterUpdate
- type RedisSpecFilter
- type SubnetCreate
- type SubnetFilter
- type VPC
- func (v *VPC) Create(ctx context.Context, req VPCCreate) ([]byte, error)
- func (v *VPC) Delete(ctx context.Context, id string) ([]byte, error)
- func (v *VPC) Get(ctx context.Context, id string) ([]byte, error)
- func (v *VPC) List(ctx context.Context, project string) ([]byte, error)
- func (v *VPC) Operation(ctx context.Context, id string) ([]byte, error)
- func (v *VPC) Operations() operation.Getter
- type VPCCreate
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotUUID = i18n.Sentinel("cloud.err.not_uuid") ErrBadID = i18n.Sentinel("cloud.err.bad_id") ErrBadExpires = i18n.Sentinel("cloud.err.bad_expires") )
Ошибки ввода, отказанные до запроса; текст для человека — в обёртке.
var ErrList = i18n.Sentinel("cloud.err.list")
ErrList — ответ списка, который нельзя склеить: null, нет поля, токен по кругу, предел.
Functions ¶
func ParseOperation ¶
ParseOperation разбирает ответ DBaaS в операцию; ok — в теле операция с id.
func ParseVPCOperation ¶
ParseVPCOperation разбирает операцию VPC; ok — в теле операция с id.
Types ¶
type ClickHouse ¶
type ClickHouse struct {
// contains filtered or unexported fields
}
ClickHouse — Public API Managed ClickHouse.
func NewClickHouse ¶
func NewClickHouse(server string, o Options) (*ClickHouse, error)
NewClickHouse — клиент API ClickHouse по адресу server.
func (*ClickHouse) ClusterOperations ¶
ClusterOperations — все операции кластера: {"operations": [...]}.
func (*ClickHouse) Clusters ¶
Clusters — все кластеры проекта: {"clusters": [...]} со всех страниц. page_size не отправляем: ClickHouse отвечает и без него.
func (*ClickHouse) CreateCluster ¶
func (h *ClickHouse) CreateCluster(ctx context.Context, c ClickHouseClusterCreate) ([]byte, error)
CreateCluster возвращает операцию создания.
func (*ClickHouse) CreateDatabase ¶
func (*ClickHouse) CreateUser ¶
func (h *ClickHouse) CreateUser(ctx context.Context, cluster, name, password string, roles []string) ([]byte, error)
CreateUser — пустой roles: поле не отправляется.
func (*ClickHouse) DeleteCluster ¶
DeleteCluster возвращает операцию удаления.
func (*ClickHouse) DeleteDatabase ¶
func (*ClickHouse) DeleteUser ¶
func (*ClickHouse) Operations ¶
func (h *ClickHouse) Operations() operation.Getter
Operations — опрос операций ClickHouse для operation.Waiter.
func (*ClickHouse) ProbeProject ¶
ProbeProject — первая страница из одного кластера: проверка доступа к проекту.
func (*ClickHouse) RevokeRole ¶
func (*ClickHouse) UpdateCluster ¶
func (h *ClickHouse) UpdateCluster(ctx context.Context, id string, u ClickHouseClusterUpdate) ([]byte, error)
UpdateCluster возвращает операцию изменения.
func (*ClickHouse) UpdateUser ¶
func (h *ClickHouse) UpdateUser(ctx context.Context, cluster, name string, password *string, roles []string) ([]byte, error)
UpdateUser — nil password: не менять, пустой roles: не менять.
type ClickHouseClusterCreate ¶
type ClickHouseClusterCreate struct {
Project, Name, Description, Version, Spec, KeeperMode string
Shards, Replicas, StorageGiB int32
Subnets []string
Keeper ClickHouseKeeper
Config *ClickHouseConfig
Logging Logging
Body []byte
}
ClickHouseClusterCreate — новый кластер; KeeperMode — embedded | standalone | "" (legacy). Body — сырой JSON поверх собранного: ключи верхнего уровня заменяют поля.
type ClickHouseClusterUpdate ¶
type ClickHouseClusterUpdate struct {
Spec string
StorageGiB int32
Keeper ClickHouseKeeper
Config *ClickHouseConfig
Body []byte
}
ClickHouseClusterUpdate — изменение кластера; нулевые поля не отправляются.
type ClickHouseConfig ¶
type ClickHouseConfig = clickhouse.CloudruDbaasClickhouseV1ClusterConfig
ClickHouseConfig — серверные параметры кластера.
func ParseClickHouseConfig ¶
func ParseClickHouseConfig(flag string, kvs map[string]string) (*ClickHouseConfig, error)
ParseClickHouseConfig — --config ключ=число. Неизвестный ключ отклоняется по полям структуры, а не молча теряется.
type ClickHouseKeeper ¶
ClickHouseKeeper — выделенный Keeper (standalone_keeper); пустой — поле не отправляется.
type Compute ¶
type Compute struct {
// contains filtered or unexported fields
}
Compute — API виртуальных машин: подсети и зоны. Идентификаторы в нём — UUID, не UUID отказываем до запроса.
func NewCompute ¶
NewCompute — клиент API виртуальных машин по адресу server.
func (*Compute) CreateSubnet ¶
CreateSubnet создаёт подсеть. Зона — только id: availability_zone_name в спецификации есть, но API его отвергает (422 extra_forbidden, 14.10). Зона и VPC в теле — строки по спецификации, их формат проверяет API; UUID — только там, где его требует сгенерированный клиент (проект, путь, фильтр списка).
func (*Compute) DeleteSubnet ¶
type IAM ¶
type IAM struct {
// contains filtered or unexported fields
}
IAM — сервисные аккаунты, их ключи доступа и роли в проекте. Отвечает snake_case, хотя в спецификации camelCase, — тела ответов не разбираем сгенерированными типами (docs/api-coverage.md, «Расхождения»).
func (*IAM) AccessKeys ¶
func (*IAM) CreateAccessKey ¶
func (s *IAM) CreateAccessKey(ctx context.Context, account, description, ttl string) ([]byte, error)
CreateAccessKey выпускает ключ; секрет — в ответе, один раз. Пустые description и ttl не отправляются.
func (*IAM) CreateServiceAccount ¶
func (s *IAM) CreateServiceAccount(ctx context.Context, project, name, description string) ([]byte, error)
CreateServiceAccount — аккаунт name в проекте project; description "" — без описания.
func (*IAM) DeleteAccessKey ¶
func (*IAM) DeleteServiceAccount ¶
func (*IAM) Grant ¶
Grant выдаёт роль role субъекту subject в проекте project; expires — RFC 3339 или "" (бессрочно).
func (*IAM) Permissions ¶
Permissions — выданные роли по фильтру IAM, все страницы.
func (*IAM) ServiceAccount ¶
type Kafka ¶
type Kafka struct {
// contains filtered or unexported fields
}
Kafka — Public API Managed Kafka.
func (*Kafka) ClusterOperations ¶
ClusterOperations — все операции кластера: {"operations": [...]}.
func (*Kafka) CreateCluster ¶
CreateCluster возвращает операцию создания.
func (*Kafka) CreateTopic ¶
func (k *Kafka) CreateTopic(ctx context.Context, cluster, name string, partitions, replication int32, params map[string]string) ([]byte, error)
CreateTopic возвращает операцию; params уходят всегда, пустые — «{}» (поле обязательно).
func (*Kafka) CreateUser ¶
func (k *Kafka) CreateUser(ctx context.Context, cluster, name, password string, roles []string) ([]byte, error)
CreateUser возвращает операцию; пустой roles — поле не отправляется.
func (*Kafka) DeleteCluster ¶
DeleteCluster возвращает операцию удаления.
func (*Kafka) DeleteTopic ¶
func (*Kafka) DeleteUser ¶
func (*Kafka) Operations ¶
Operations — опрос операций Kafka для operation.Waiter.
func (*Kafka) UpdateCluster ¶
UpdateCluster возвращает операцию изменения.
func (*Kafka) UpdateTopic ¶
func (k *Kafka) UpdateTopic(ctx context.Context, cluster, name string, u KafkaTopicUpdate) ([]byte, error)
UpdateTopic возвращает операцию изменения.
func (*Kafka) UpdateUser ¶
func (k *Kafka) UpdateUser(ctx context.Context, cluster, name string, password *string, roles []string) ([]byte, error)
UpdateUser возвращает операцию: nil password — не менять, пустой roles — не менять.
type KafkaClusterCreate ¶
type KafkaClusterCreate struct {
Project, Name, Description, Version, Spec, Subnet string
Brokers, StorageGiB int32
UI, CruiseControl, AutoRebalance bool
Params map[string]string
Logging Logging
Body []byte
}
KafkaClusterCreate — новый кластер. Body — сырой JSON поверх собранного: ключи верхнего уровня заменяют поля.
type KafkaClusterUpdate ¶
type KafkaClusterUpdate struct {
Spec string
StorageGiB int32
Params map[string]string
Body []byte
}
KafkaClusterUpdate — изменение кластера; нулевые поля не отправляются.
type KafkaSpecFilter ¶
type KafkaSpecFilter struct {
Version, Zone, Cluster string
}
KafkaSpecFilter — отбор спецификаций: версия и зона или кластер (для resize).
type KafkaTopicUpdate ¶
KafkaTopicUpdate — изменение топика; нулевые поля не отправляются.
type Logging ¶
Logging — интеграция с Клиентским логированием; без Enabled поле не отправляется, пустая группа — по умолчанию.
type Options ¶
type Options struct {
HTTPClient *http.Client
// Auth ставит токен в запрос.
Auth func(ctx context.Context, req *http.Request) error
}
Options — общее для клиентов всех API.
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis — Public API Managed Redis.
func (*Redis) ClusterOperations ¶
ClusterOperations — все операции кластера: {"operations": [...]}.
func (*Redis) CreateCluster ¶
CreateCluster возвращает операцию создания.
func (*Redis) CreateUser ¶
func (r *Redis) CreateUser(ctx context.Context, cluster, name, password string, roles []string) ([]byte, error)
CreateUser возвращает операцию; пустой roles — поле не отправляется.
func (*Redis) DeleteCluster ¶
DeleteCluster возвращает операцию удаления.
func (*Redis) DeleteUser ¶
func (*Redis) Operations ¶
Operations — опрос операций Redis для operation.Waiter.
func (*Redis) UpdateCluster ¶
UpdateCluster возвращает операцию изменения.
func (*Redis) UpdateUser ¶
func (r *Redis) UpdateUser(ctx context.Context, cluster, name string, password *string, roles []string) ([]byte, error)
UpdateUser заменяет пользователя целиком (PUT): nil password — не менять.
type RedisClusterCreate ¶
type RedisClusterCreate struct {
Project, Name, Description, Version, Spec, Type string
Shards, Replicas, StorageGiB int32
Subnets []string
Params map[string]string
Logging Logging
Body []byte
}
RedisClusterCreate — новый кластер. Type — standalone | master-replica. Body — сырой JSON поверх собранного: ключи верхнего уровня заменяют поля.
type RedisClusterUpdate ¶
type RedisClusterUpdate struct {
Spec string
StorageGiB int32
Params map[string]string
Body []byte
}
RedisClusterUpdate — изменение кластера; нулевые поля не отправляются.
type RedisSpecFilter ¶
type RedisSpecFilter struct {
Version, Zone, Cluster string
}
RedisSpecFilter — отбор спецификаций: версия и зона или кластер (для resize).
type SubnetCreate ¶
type SubnetCreate struct {
Project, Name, Zone, CIDR, VPC, Description, Gateway string
DNS []string
Isolated bool
}
SubnetCreate — новая подсеть; пустые необязательные поля не отправляются.
type SubnetFilter ¶
type SubnetFilter struct {
Project, Zone, VPC, Name string
}
SubnetFilter — отбор подсетей; пустые поля не отправляются.
type VPC ¶
type VPC struct {
// contains filtered or unexported fields
}
VPC — Evolution VPC API: сети проекта и их операции.
func (*VPC) Operations ¶
Operations — опрос операций VPC для operation.Waiter.