Documentation
¶
Index ¶
- Constants
- Variables
- type APIResponse
- type Backup
- type BillingHandler
- type Card
- type CardListResponse
- type CardsHandler
- type Client
- type ConsumerGroup
- type CreateDatabaseRequest
- type CreateKafkaTopicRequest
- type CreateProjectRequest
- type CreateServiceRequest
- type CreateServiceUserRequest
- type Database
- type DatabasesHandler
- type Error
- type KafkaListTopic
- type KafkaTopic
- type KafkaTopicResponse
- type KafkaTopicsHandler
- func (h *KafkaTopicsHandler) Create(project, service string, req CreateKafkaTopicRequest) error
- func (h *KafkaTopicsHandler) Delete(project, service, topic string) error
- func (h *KafkaTopicsHandler) Get(project, service, topic string) (*KafkaTopic, error)
- func (h *KafkaTopicsHandler) List(project, service string) ([]*KafkaListTopic, error)
- func (h *KafkaTopicsHandler) Update(project, service, topic string, req UpdateKafkaTopicRequest) error
- type KafkaTopicsResponse
- type Partition
- type Project
- type ProjectListResponse
- type ProjectResponse
- type ProjectsHandler
- func (h *ProjectsHandler) Create(req CreateProjectRequest) (*Project, error)
- func (h *ProjectsHandler) Delete(project string) error
- func (h *ProjectsHandler) Get(project string) (*Project, error)
- func (h *ProjectsHandler) List() ([]*Project, error)
- func (h *ProjectsHandler) Update(project string, req UpdateProjectRequest) (*Project, error)
- type Service
- type ServiceListResponse
- type ServiceResponse
- type ServiceUser
- type ServiceUserResponse
- type ServiceUsersHandler
- type ServicesHandler
- func (h *ServicesHandler) Create(project string, req CreateServiceRequest) (*Service, error)
- func (h *ServicesHandler) Delete(project, service string) error
- func (h *ServicesHandler) Get(project, service string) (*Service, error)
- func (h *ServicesHandler) List(project string) ([]*Service, error)
- func (h *ServicesHandler) Update(project, service string, req UpdateServiceRequest) (*Service, error)
- type Token
- type UpdateKafkaTopicRequest
- type UpdateProjectRequest
- type UpdateServiceRequest
- type User
Constants ¶
const APIURL = "https://api.aiven.io/v1beta"
APIURL is the URL we'll use to speak to Aiven. This can be overwritten.
Variables ¶
var ( // ErrNoResponseData is uses when there is no data available in the response. ErrNoResponseData = errors.New("No response data available") // ErrInvalidHost is used when the provided host is formatted incorrectly. ErrInvalidHost = errors.New("Host doesn't isn't in the correct format: `hostname:port`") )
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct {
Errors []Error `json:"errors,omitempty"`
Message string `json:"message,omitempty"`
}
APIResponse represents a response returned by the Aiven API.
type BillingHandler ¶
type BillingHandler struct {
Cards *CardsHandler
// contains filtered or unexported fields
}
BillingHandler is the client that interacts with the Aiven Billing endpoints.
type Card ¶
type Card struct {
Brand string `json:"brand"`
CardID string `json:"card_id"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
ExpMonth int `json:"exp_month"`
ExpYear int `json:"exp_year"`
Last4 string `json:"last4"`
Name string `json:"name"`
ProjectNames []string `json:"projects"`
}
Card represents the card model on Aiven.
type CardListResponse ¶
type CardListResponse struct {
APIResponse
Cards []*Card `json:"cards"`
}
CardListResponse is the response for listing cards.
type CardsHandler ¶
type CardsHandler struct {
// contains filtered or unexported fields
}
CardsHandler is the client that interacts with the cards endpoints on Aiven.
func (*CardsHandler) List ¶
func (h *CardsHandler) List() ([]*Card, error)
List lists all the cards linked to the authenticated account/
type Client ¶
type Client struct {
APIKey string
Client *http.Client
Projects *ProjectsHandler
Services *ServicesHandler
Databases *DatabasesHandler
ServiceUsers *ServiceUsersHandler
KafkaTopics *KafkaTopicsHandler
Billing *BillingHandler
}
Client represents the instance that does all the calls to the Aiven API.
func NewMFAUserClient ¶ added in v0.0.2
NewMFAUserClient creates a new client based on email, one-time password and password.
func NewTokenClient ¶
NewTokenClient creates a new client based on a given token.
func NewUserClient ¶
NewUserClient creates a new client based on email and password.
type ConsumerGroup ¶ added in v0.0.2
ConsumerGroup is the group used in partitions.
type CreateDatabaseRequest ¶
type CreateDatabaseRequest struct {
Database string `json:"database"`
LcCollate string `json:"lc_collate,omitempty"`
LcType string `json:"lc_type,omitempty"`
}
CreateDatabaseRequest are the parameters used to create a database.
type CreateKafkaTopicRequest ¶ added in v0.0.2
type CreateKafkaTopicRequest struct {
CleanupPolicy *string `json:"cleanup_policy,omitempty"`
MinimumInSyncReplicas *int `json:"min_insync_replicas,omitempty"`
Partitions *int `json:"partitions,omitempty"`
Replication *int `json:"replication,omitempty"`
RetentionBytes *int `json:"retention_bytes,omitempty"`
RetentionHours *int `json:"retention_hours,omitempty"`
TopicName string `json:"topic_name"`
}
CreateKafkaTopicRequest are the parameters used to create a kafka topic.
type CreateProjectRequest ¶
type CreateProjectRequest struct {
CardID string `json:"card_id,omitempty"`
Cloud string `json:"cloud,omitempty"`
Project string `json:"project"`
}
CreateProjectRequest are the parameters for creating a project.
type CreateServiceRequest ¶
type CreateServiceRequest struct {
Cloud string `json:"cloud,omitempty"`
GroupName string `json:"group_name,omitempty"`
Plan string `json:"plan,omitempty"`
ServiceName string `json:"service_name"`
ServiceType string `json:"service_type"`
}
CreateServiceRequest are the parameters to create a Service.
type CreateServiceUserRequest ¶
type CreateServiceUserRequest struct {
Username string `json:"username"`
}
CreateServiceUserRequest are the parameters required to create a ServiceUser.
type Database ¶
type Database struct {
Database string `json:"database"`
LcCollate string `json:"lc_collate,omitempty"`
LcType string `json:"lc_type,omitempty"`
}
Database represents a database type on Aiven.
type DatabasesHandler ¶
type DatabasesHandler struct {
// contains filtered or unexported fields
}
DatabasesHandler is the client which interacts with the Aiven database endpoints.
func (*DatabasesHandler) Create ¶
func (h *DatabasesHandler) Create(project, service string, req CreateDatabaseRequest) (*Database, error)
Create creates a database with the given parameters.
func (*DatabasesHandler) Delete ¶
func (h *DatabasesHandler) Delete(project, service, database string) error
Delete deletes the specified database.
type Error ¶
type Error struct {
Message string `json:"message"`
MoreInfo string `json:"more_info"`
Status int `json:"status"`
}
Error represents an Aiven API Error.
type KafkaListTopic ¶ added in v0.0.2
type KafkaListTopic struct {
CleanupPolicy string `json:"cleanup_policy"`
MinimumInSyncReplicas int `json:"min_insync_replicas"`
Partitions int `json:"partitions"`
Replication int `json:"replication"`
RetentionBytes int `json:"retention_bytes"`
RetentionHours int `json:"retention_hours"`
State string `json:"state"`
TopicName string `json:"topic_name"`
}
KafkaListTopic represents kafka list topic model on Aiven.
type KafkaTopic ¶ added in v0.0.2
type KafkaTopic struct {
CleanupPolicy string `json:"cleanup_policy"`
MinimumInSyncReplicas int `json:"min_insync_replicas"`
Partitions []*Partition `json:"partitions"`
Replication int `json:"replication"`
RetentionBytes int `json:"retention_bytes"`
RetentionHours int `json:"retention_hours"`
State string `json:"state"`
TopicName string `json:"topic_name"`
}
KafkaTopic represents a Kafka Topic on Aiven.
type KafkaTopicResponse ¶ added in v0.0.2
type KafkaTopicResponse struct {
APIResponse
Topic *KafkaTopic `json:"topic"`
}
KafkaTopicResponse is the response for Kafka Topic requests.
type KafkaTopicsHandler ¶ added in v0.0.2
type KafkaTopicsHandler struct {
// contains filtered or unexported fields
}
KafkaTopicsHandler is the client which interacts with the kafka endpoints on Aiven.
func (*KafkaTopicsHandler) Create ¶ added in v0.0.2
func (h *KafkaTopicsHandler) Create(project, service string, req CreateKafkaTopicRequest) error
Create creats a specific kafka topic.
func (*KafkaTopicsHandler) Delete ¶ added in v0.0.2
func (h *KafkaTopicsHandler) Delete(project, service, topic string) error
Delete deletes a specific kafka topic.
func (*KafkaTopicsHandler) Get ¶ added in v0.0.2
func (h *KafkaTopicsHandler) Get(project, service, topic string) (*KafkaTopic, error)
Get gets a specific kafka topic.
func (*KafkaTopicsHandler) List ¶ added in v0.0.2
func (h *KafkaTopicsHandler) List(project, service string) ([]*KafkaListTopic, error)
List lists all the kafka topics.
func (*KafkaTopicsHandler) Update ¶ added in v0.0.2
func (h *KafkaTopicsHandler) Update(project, service, topic string, req UpdateKafkaTopicRequest) error
Update updates a specific topic with the given parameters.
type KafkaTopicsResponse ¶ added in v0.0.2
type KafkaTopicsResponse struct {
APIResponse
Topics []*KafkaListTopic `json:"topics"`
}
KafkaTopicsResponse is the response for listing kafka topics.
type Partition ¶ added in v0.0.2
type Partition struct {
ConsumerGroups []*ConsumerGroup `json:"consumer_groups"`
EarliestOffset int `json:"earliest_offset"`
ISR int `json:"isr"`
LatestOffset int `json:"latest_offset"`
Partition int `json:"partition"`
Size int `json:"size"`
}
Partition represents a Kafka partition.
type Project ¶
type Project struct {
AvailableCredits string `json:"available_credits"`
BillingAddress string `json:"billing_address"`
Card Card `json:"card_info"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
DefaultCloud string `json:"default_cloud"`
EstimatedBalance string `json:"estimated_balance"`
PaymentMethod string `json:"payment_method"`
Name string `json:"project_name"`
VatID string `json:"vat_id"`
}
Project represents the Project model on Aiven.
type ProjectListResponse ¶
type ProjectListResponse struct {
APIResponse
Projects []*Project `json:"projects"`
}
ProjectListResponse is the response from Aiven for listing projects.
type ProjectResponse ¶
type ProjectResponse struct {
APIResponse
Project *Project `json:"project"`
}
ProjectResponse is the response from Aiven for the project endpoints.
type ProjectsHandler ¶
type ProjectsHandler struct {
// contains filtered or unexported fields
}
ProjectsHandler is the client which interacts with the Projects endpoints on Aiven.
func (*ProjectsHandler) Create ¶
func (h *ProjectsHandler) Create(req CreateProjectRequest) (*Project, error)
Create creates a new project.
func (*ProjectsHandler) Delete ¶
func (h *ProjectsHandler) Delete(project string) error
Delete deletes the given project.
func (*ProjectsHandler) Get ¶
func (h *ProjectsHandler) Get(project string) (*Project, error)
Get gets the specified project.
func (*ProjectsHandler) List ¶
func (h *ProjectsHandler) List() ([]*Project, error)
List lists all the available projects linked to the account.
func (*ProjectsHandler) Update ¶
func (h *ProjectsHandler) Update(project string, req UpdateProjectRequest) (*Project, error)
Update updates the specified project with the given parameters.
type Service ¶
type Service struct {
CloudName string `json:"cloud_name"`
CreateTime string `json:"create_time"`
UpdateTime string `json:"update_time"`
GroupList []string `json:"group_list"`
NodeCount int `json:"node_count"`
Plan string `json:"plan"`
Name string `json:"service_name"`
Type string `json:"service_type"`
URI string `json:"service_uri"`
State string `json:"state"`
Metadata interface{} `json:"metadata"`
Users []*ServiceUser `json:"users"`
}
Service represents the Service model on Aiven.
type ServiceListResponse ¶
type ServiceListResponse struct {
APIResponse
Services []*Service `json:"services"`
}
ServiceListResponse represents the response from Aiven for listing services.
type ServiceResponse ¶
type ServiceResponse struct {
APIResponse
Service *Service `json:"service"`
}
ServiceResponse represents the response from Aiven after interacting with the Service API.
type ServiceUser ¶
type ServiceUser struct {
Username string `json:"username"`
Password string `json:"password"`
Type string `json:"type"`
AccessCert string `json:"access_cert"`
AccessKey string `json:"access_key"`
}
ServiceUser is the representation of a Service User in the Aiven API.
type ServiceUserResponse ¶
type ServiceUserResponse struct {
APIResponse
User *ServiceUser `json:"user"`
}
ServiceUserResponse represents the response after creating a ServiceUser.
type ServiceUsersHandler ¶
type ServiceUsersHandler struct {
// contains filtered or unexported fields
}
ServiceUsersHandler is the client that interacts with the ServiceUsers endpoints.
func (*ServiceUsersHandler) Create ¶
func (h *ServiceUsersHandler) Create(project, service string, req CreateServiceUserRequest) (*ServiceUser, error)
Create creates the given User on Aiven.
func (*ServiceUsersHandler) Delete ¶
func (h *ServiceUsersHandler) Delete(project, service, user string) error
Delete deletes the given Service User in Aiven.
type ServicesHandler ¶
type ServicesHandler struct {
// contains filtered or unexported fields
}
ServicesHandler is the client that interacts with the Service API endpoints on Aiven.
func (*ServicesHandler) Create ¶
func (h *ServicesHandler) Create(project string, req CreateServiceRequest) (*Service, error)
Create creates the given Service on Aiven.
func (*ServicesHandler) Delete ¶
func (h *ServicesHandler) Delete(project, service string) error
Delete will delete the given service from Aiven.
func (*ServicesHandler) Get ¶
func (h *ServicesHandler) Get(project, service string) (*Service, error)
Get gets a specific service from Aiven.
func (*ServicesHandler) List ¶
func (h *ServicesHandler) List(project string) ([]*Service, error)
List will fetch all services for a given project.
func (*ServicesHandler) Update ¶
func (h *ServicesHandler) Update(project, service string, req UpdateServiceRequest) (*Service, error)
Update will update the given service with the given parameters.
type Token ¶
Token represents a user token.
func MFAUserToken ¶ added in v0.0.2
MFAUserToken retrieves a User Auth Token for a given email/password pair.
type UpdateKafkaTopicRequest ¶ added in v0.0.2
type UpdateKafkaTopicRequest struct {
MinimumInSyncReplicas *int `json:"min_insync_replicas,omitempty"`
Partitions *int `json:"partitions,omitempty"`
RetentionBytes *int `json:"retention_bytes,omitempty"`
RetentionHours *int `json:"retention_hours,omitempty"`
}
UpdateKafkaTopicRequest are the parameters used to update a kafka topic.
type UpdateProjectRequest ¶
type UpdateProjectRequest struct {
CardID string `json:"card_id,omitempty"`
Cloud string `json:"cloud,omitempty"`
BillingAddress string `json:"billing_address"`
}
UpdateProjectRequest are the parameters for updating a project.
type UpdateServiceRequest ¶
type UpdateServiceRequest struct {
Cloud string `json:"cloud,omitempty"`
GroupName string `json:"group_name,omitempty"`
Plan string `json:"plan,omitempty"`
Powered bool `json:"powered"` // TODO: figure out if we can overwrite the default?
}
UpdateServiceRequest are the parameters to update a Service.