conoha

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package conoha implements ConoHa API client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access struct {
	Token          *Token                 `json:"token"`
	ServiceCatalog []*serviceCatalog      `json:"serviceCatalog"`
	User           *user                  `json:"user"`
	Metadata       *identityTokenMetadata `json:"metadata"`
}

Access represents data contains token and metadata.

type BillingInvoice

type BillingInvoice struct {
	Items             []*BillingInvoiceItem `json:"items"`
	InvoiceID         int                   `json:"invoice_id"`
	PaymentMethodType string                `json:"payment_method_type"`
	InvoiceDate       string                `json:"invoice_date"`
	BillPlasTax       int                   `json:"bill_plas_tax"`
	DueDate           string                `json:"due_date"`
}

BillingInvoice represents invoice information.

type BillingInvoiceItem

type BillingInvoiceItem struct {
	InvoiceDetailID int     `json:"invoice_detail_id"`
	ProductName     string  `json:"product_name"`
	UnitPrice       float32 `json:"unit_price"`
	Quantity        int     `json:"quantity"`
	StartDate       string  `json:"start_date"`
	EndDate         string  `json:"EndDate"`
}

BillingInvoiceItem represents detailed information of the invoice.

type ComputeFlavor

type ComputeFlavor struct {
	OsFlvDisabled          bool    `json:"OS-FLV-DISABLED:disabled"`
	OsFlvExtData           int     `json:"OS-FLV-EXT-DATA:ephemeral"`
	Disk                   int     `json:"disk"`
	ID                     string  `json:"id"`
	Links                  []*Link `json:"links"`
	Name                   string  `json:"name"`
	OsFlavorAccessIsPublic bool    `json:"os-flavor-access:is_public"`
	RAM                    int     `json:"ram"`
	RxtxFactor             int     `json:"rxtx_factor"`
	Swap                   string  `json:"swap"`
	Vcpus                  int     `json:"vcpus"`
}

ComputeFlavor represents the plan's information.

type ComputeImage

type ComputeImage struct {
	OsExtImgSize int                   `json:"OS-EXT-IMG-SIZE:size"`
	Created      string                `json:"created"`
	ID           string                `json:"id"`
	Links        []*Link               `json:"links"`
	Metadata     *ComputeImageMetadata `json:"metadata"`
	MinDisk      int                   `json:"minDisk"`
	MinRAM       int                   `json:"minRam"`
	Name         string                `json:"name"`
	Progress     int                   `json:"progress"`
	Status       string                `json:"status"`
	Updated      string                `json:"updated"`
}

ComputeImage represents the server information.

type ComputeImageMetadata

type ComputeImageMetadata struct {
	DisplayOrder     string `json:"display_order"`
	GncApp           string `json:"gnc_app"`
	HwQemuGuestAgent string `json:"hw_qemu_guest_agent"`
	OsType           string `json:"os_type"`
}

ComputeImageMetadata represents metadata for the server.

type ComputeSecurityGroup

type ComputeSecurityGroup struct {
	Name string `json:"name,omitempty"`
}

ComputeSecurityGroup represents the security group applied to the server.

type ComputeServer

type ComputeServer struct {
	OsDcfDiskConfig                string                             `json:"OS-DCF:diskConfig,omitempty"`
	OsExtAzAvailabilityZone        string                             `json:"OS-EXT-AZ:availability_zone,omitempty"`
	OsExtSrvAttrHost               string                             `json:"OS-EXT-SRV-ATTR:host,omitempty"`
	OsExtSrvAttrHypervisorHostname string                             `json:"OS-EXT-SRV-ATTR:hypervisor_hostname,omitempty"`
	OsExtSrvAttrInstanceName       string                             `json:"OS-EXT-SRV-ATTR:instance_name,omitempty"`
	OsExtStsPowerState             int                                `json:"OS-EXT-STS:power_state,omitempty"`
	OsExtStsTaskState              string                             `json:"OS-EXT-STS:task_state,omitempty"`
	OsExtStsVMState                string                             `json:"OS-EXT-STS:vm_state,omitempty"`
	OsSrvUsgLaunchedAt             string                             `json:"OS-SRV-USG:launched_at,omitempty"`
	OsSrvUsgTerminatedAt           string                             `json:"OS-SRV-USG:terminated_at,omitempty"`
	AccessIPv4                     string                             `json:"accessIPv4,omitempty"`
	AccessIPv6                     string                             `json:"accessIPv6,omitempty"`
	Addresses                      map[string][]*ComputeServerAddress `json:"addresses,omitempty"`
	ConfigDrive                    string                             `json:"config_drive,omitempty"`
	Created                        string                             `json:"created,omitempty"`
	Flavor                         *ComputeFlavor                     `json:"flavor,omitempty"`
	HostID                         string                             `json:"hostId,omitempty"`
	ID                             string                             `json:"id,omitempty"`
	Image                          *ComputeImage                      `json:"image,omitempty"`
	KeyName                        string                             `json:"key_name,omitempty"`
	Links                          []*ComputeServerLink               `json:"links,omitempty"`
	Metadata                       *ComputeServerMetadata             `json:"metadata,omitempty"`
	Name                           string                             `json:"name,omitempty"`
	Status                         string                             `json:"status,omitempty"`
	TenantID                       string                             `json:"tenant_id,omitempty"`
	Updated                        string                             `json:"updated"`
	UserID                         string                             `json:"user_id"`
	ImageRef                       string                             `json:"imageRef,omitempty"`
	FlavorRef                      string                             `json:"flavorRef,omitempty"`
	AdminPass                      string                             `json:"adminPass,omitempty"`
	SecurityGroups                 []*ComputeSecurityGroup            `json:"security_groups,omitempty"`
}

ComputeServer represents the server information.

type ComputeServerAddress

type ComputeServerAddress struct {
	Addr string `json:"addr"`
}

ComputeServerAddress represents the server's address information.

type ComputeServerLink struct {
}

ComputeServerLink represents the link for the server.

type ComputeServerMetadata

type ComputeServerMetadata struct {
	BackupID        string `json:"backup_id"`
	BackupSet       string `json:"backup_set"`
	BackupStatus    string `json:"backup_status"`
	InstanceNameTag string `json:"instance_name_tag"`
	Properties      string `json:"properties"`
}

ComputeServerMetadata represents the metadata for the server.

type Conoha

type Conoha struct {
	IdentityServiceURL      string
	AccountServiceURL       string
	ComputeServiceURL       string
	BlockStorageServiceURL  string
	ImageServiceURL         string
	NetworkServiceURL       string
	ObjectStorageServiceURL string
	DatabaseServiceURL      string
	DNSServiceURL           string
	MailServiceURL          string
	Username                string
	Password                string
	TenantID                string
	Token                   string
	Client                  *http.Client
}

Conoha represents ConoHa APi Client.

ConoHa API docs: https://www.conoha.jp/docs/

func NewConoha

func NewConoha(
	identityServiceURL,
	accountServiceURL,
	computeServiceURL,
	blockStorageServiceURL,
	imageServiceURL,
	networkServiceURL,
	objectStorageServiceURL,
	databaseServiceURL,
	dnsServiceURL,
	mailServiceURL,
	username,
	password,
	tenantID,
	token string,
) *Conoha

NewConoha creates ConoHa API client.

func (*Conoha) AccountAPIVersions

func (c *Conoha) AccountAPIVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

AccountAPIVersions fetches Account API versions list.

ConoHa API docs: https://www.conoha.jp/docs/account-get_version_list.html

func (*Conoha) AccountVersion

func (c *Conoha) AccountVersion(ctx context.Context) (*Version, *ResponseMeta, error)

AccountVersion fetches the Account API information.

ConoHa API docs: https://www.conoha.jp/docs/account-get_version_detail.html

func (*Conoha) AddComputeServer

func (c *Conoha) AddComputeServer(
	ctx context.Context,
	imageRef,
	flavorRef,
	adminPass,
	keyName,
	securityGroupName string,
) (*ComputeServer, *ResponseMeta, error)

AddComputeServer adds new server.

ConoHa API docs: https://www.conoha.jp/docs/compute-create_vm.html

func (*Conoha) BillingInvoice

func (c *Conoha) BillingInvoice(ctx context.Context, invoiceID string) (BillingInvoice, *ResponseMeta, error)

BillingInvoice fetches invoice information.

ConoHa API docs: https://www.conoha.jp/docs/account-billing-invoices-detail-specified.html

func (*Conoha) BillingInvoices

func (c *Conoha) BillingInvoices(ctx context.Context) ([]*BillingInvoice, *ResponseMeta, error)

BillingInvoices fetches invoices list.

ConoHa API docs: https://www.conoha.jp/docs/account-billing-invoices-list.html

func (*Conoha) ComputeFlavor

func (c *Conoha) ComputeFlavor(ctx context.Context, flavorID string) (*ComputeFlavor, *ResponseMeta, error)

ComputeFlavor fetches the plan's information.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_flavors_detail_specified.html

func (*Conoha) ComputeFlavors

func (c *Conoha) ComputeFlavors(ctx context.Context) ([]*ComputeFlavor, *ResponseMeta, error)

ComputeFlavors fetches plans list.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_flavors_list.html

func (*Conoha) ComputeFlavorsDetail

func (c *Conoha) ComputeFlavorsDetail(ctx context.Context) ([]*ComputeFlavor, *ResponseMeta, error)

ComputeFlavorsDetail fetches detailed plans list.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_flavors_detail.html

func (*Conoha) ComputeImage

func (c *Conoha) ComputeImage(ctx context.Context, imageID string) (*ComputeImage, *ResponseMeta, error)

ComputeImage fetches summarized information of the server.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_images_detail_specified.html

func (*Conoha) ComputeImages

func (c *Conoha) ComputeImages(ctx context.Context) ([]*ComputeImage, *ResponseMeta, error)

ComputeImages fetches server images list.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_images_list.html

func (*Conoha) ComputeKeypair

func (c *Conoha) ComputeKeypair(ctx context.Context, keypairName string) (*Keypair, *ResponseMeta, error)

ComputeKeypair fetches the key pair information.

https://www.conoha.jp/docs/compute-get_keypairs_detail_specified.html

func (*Conoha) ComputeKeypairs

func (c *Conoha) ComputeKeypairs(ctx context.Context) ([]*KeypairParent, *ResponseMeta, error)

ComputeKeypairs fetches key pairs list.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_keypairs.html

func (*Conoha) ComputeServer

func (c *Conoha) ComputeServer(ctx context.Context, serverID string) (*ComputeServer, *ResponseMeta, error)

ComputeServer fetches the server information.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_vms_detail_specified.html

func (*Conoha) ComputeServers

func (c *Conoha) ComputeServers(ctx context.Context) ([]*ComputeServer, *ResponseMeta, error)

ComputeServers fetches servers list. Each information is summarized.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_vms_list.html

func (*Conoha) ComputeServersDetail

func (c *Conoha) ComputeServersDetail(ctx context.Context) ([]*ComputeServer, *ResponseMeta, error)

ComputeServersDetail fetches server's detailed information (e.g. IP address).

ConoHa API docs: https://www.conoha.jp/docs/compute-get_vms_detail_specified.html

func (*Conoha) ComputeVersion

func (c *Conoha) ComputeVersion(ctx context.Context) (*Version, *ResponseMeta, error)

ComputeVersion fetches Compute API information.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_version_detail.html

func (*Conoha) ComputeVersions

func (c *Conoha) ComputeVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

ComputeVersions fetches Compute API versions list.

ConoHa API docs: https://www.conoha.jp/docs/compute-get_version_list.html

func (*Conoha) DNSVersions

func (c *Conoha) DNSVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

DNSVersions fetches DNS API versions list.

ConoHa API docs: https://www.conoha.jp/docs/paas-dns-get-version-list.html

func (*Conoha) DatabaseVersion

func (c *Conoha) DatabaseVersion(ctx context.Context) (*Version, *ResponseMeta, error)

DatabaseVersion fetches Database API information.

ConoHa API docs: https://www.conoha.jp/docs/paas-database-get-version-detail.html

func (*Conoha) DatabaseVersions

func (c *Conoha) DatabaseVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

DatabaseVersions fetches Database API versions list.

ConoHa API docs: https://www.conoha.jp/docs/paas-database-get-version-list.html

func (*Conoha) DeleteComputeServer

func (c *Conoha) DeleteComputeServer(ctx context.Context, serverID string) (*ResponseMeta, error)

DeleteComputeServer deletes the server.

ConoHa API docs: https://www.conoha.jp/docs/compute-delete_vm.html

func (*Conoha) ForceShutdownServer

func (c *Conoha) ForceShutdownServer(ctx context.Context, serverID string) (*ResponseMeta, error)

ForceShutdownServer shutdowns the server forcefully.

ConoHa API docs: https://www.conoha.jp/docs/compute-stop_forcibly_vm.html

func (*Conoha) IdentityAPIVersion

func (c *Conoha) IdentityAPIVersion(ctx context.Context) (*Version, *ResponseMeta, error)

IdentityAPIVersion fetches Identity API information.

ConoHa API docs: https://www.conoha.jp/docs/identity-get_version_detail.html

func (*Conoha) IdentityAPIVersions

func (c *Conoha) IdentityAPIVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

IdentityAPIVersions fetches Identity API versions list.

ConoHa API docs: https://www.conoha.jp/docs/identity-get_version_list.html

func (*Conoha) IdentityToken

func (c *Conoha) IdentityToken(ctx context.Context) (*Access, *ResponseMeta, error)

IdentityToken issues ConoHa API access token.

ConoHa API docs: https://www.conoha.jp/docs/identity-post_tokens.html

func (*Conoha) ImageVersions

func (c *Conoha) ImageVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

ImageVersions fetches Image API versions list.

ConoHa API docs: https://www.conoha.jp/docs/image-get_version_list.html

func (*Conoha) IsoImages

func (c *Conoha) IsoImages(ctx context.Context) ([]*IsoImage, *ResponseMeta, error)

IsoImages fetches ISO images list.

ConoHa API docs: https://www.conoha.jp/docs/compute-iso-list-show.html

func (*Conoha) MailVersion

func (c *Conoha) MailVersion(ctx context.Context) (*Version, *ResponseMeta, error)

MailVersion fetches Mail API information.

ConoHa API docs: https://www.conoha.jp/docs/paas-mail-get-version-detail.html

func (*Conoha) MailVersions

func (c *Conoha) MailVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

MailVersions fetches Mail API versions list.

ConoHa API docs: https://www.conoha.jp/docs/paas-mail-get-version-list.html

func (*Conoha) NetworkVersion

func (c *Conoha) NetworkVersion(ctx context.Context) (*Version, *ResponseMeta, error)

NetworkVersion fetches Network API information.

ConoHa API docs: https://www.conoha.jp/docs/neutron-get_version_detail.html

func (*Conoha) NetworkVersions

func (c *Conoha) NetworkVersions(ctx context.Context) ([]*Version, *ResponseMeta, error)

NetworkVersions fetches Network API versions list.

ConoHa API docs: https://www.conoha.jp/docs/neutron-get_version_list.html

func (*Conoha) Notification

func (c *Conoha) Notification(ctx context.Context, notificationCode string) (*Notification, *ResponseMeta, error)

Notification fetches notifications list.

ConoHa API docs: https://www.conoha.jp/docs/account-informations-detail-specified.html

func (*Conoha) Notifications

func (c *Conoha) Notifications(ctx context.Context) ([]*Notification, *ResponseMeta, error)

Notifications fetches notifications list for the user.

ConoHa API docs: https://www.conoha.jp/docs/account-informations-list.html

func (*Conoha) OrderItem

func (c *Conoha) OrderItem(ctx context.Context, itemID string) (*OrderItem, *ResponseMeta, error)

OrderItem fetches the order's detailed information.

ConoHa API docs: https://www.conoha.jp/docs/account-order-item-detail-specified.html

func (*Conoha) OrderItems

func (c *Conoha) OrderItems(ctx context.Context) ([]*OrderItem, *ResponseMeta, error)

OrderItems fetches the orders list.

ConoHa API docs: https://www.conoha.jp/docs/account-order-item-list.html

func (*Conoha) PaymentHistory

func (c *Conoha) PaymentHistory(ctx context.Context) ([]*PaymentHistory, *ResponseMeta, error)

PaymentHistory fetches payment history.

ConoHa API docs: https://www.conoha.jp/docs/account-payment-histories.html

func (*Conoha) PaymentSummary

func (c *Conoha) PaymentSummary(ctx context.Context) (*PaymentSummary, *ResponseMeta, error)

PaymentSummary fetches summarized information of the payment.

ConoHa API docs: https://www.conoha.jp/docs/account-payment-summary.html

func (*Conoha) RebootComputeServer

func (c *Conoha) RebootComputeServer(ctx context.Context, serverID string, isSoft bool) (*ResponseMeta, error)

RebootComputeServer reboots the server.

ConoHa API docs: https://www.conoha.jp/docs/compute-reboot_vm.html

func (*Conoha) StartComputeServer

func (c *Conoha) StartComputeServer(ctx context.Context, serverID string) (*ResponseMeta, error)

StartComputeServer starts the serer.

ConoHa API docs: https://www.conoha.jp/docs/compute-power_on_vm.html

func (*Conoha) StopComputeServer

func (c *Conoha) StopComputeServer(ctx context.Context, serverID string) (*ResponseMeta, error)

StopComputeServer stops the server.

ConoHa API docs: https://www.conoha.jp/docs/compute-stop_cleanly_vm.html

type ErrUnauthorized

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

ErrUnauthorized will used when unauthorized response returned.

func (*ErrUnauthorized) Error

func (e *ErrUnauthorized) Error() string

type IsoImage

type IsoImage struct {
	URL   string `json:"url"`
	Path  string `json:"path"`
	Ctime string `json:"ctime"`
	Name  string `json:"name"`
	Size  int    `json:"size"`
}

IsoImage represents ISO image.

type Keypair

type Keypair struct {
	PublicKey   string `json:"public_key"`
	UserID      string `json:"user_id"`
	Name        string `json:"name"`
	Deleted     bool   `json:"deleted"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	FingerPrint string `json:"fingerprint"`
	DeletedAt   string `json:"deleted_at"`
	ID          int    `json:"id"`
}

Keypair represents key pair information.

type KeypairParent

type KeypairParent struct {
	Value *Keypair `json:"keypair"`
}

KeypairParent represents keypair data wrapper.

type Link struct {
	Href string `json:"href"`
	Type string `json:"type"`
	Rel  string `json:"rel"`
}

Link represents the information of the link.

type Notification

type Notification struct {
	NotificationCode int    `json:"notification_code"`
	Title            string `json:"title"`
	Type             string `json:"type"`
	Contents         string `json:"contents"`
	ReadStatus       string `json:"read_status"`
	StartDate        string `json:"start_date"`
}

Notification represents notification from ConoHa to the users.

type OrderItem

type OrderItem struct {
	UUID             string  `json:"uu_id"`
	ServiceName      string  `json:"service_name"`
	ProductName      string  `json:"product_name"`
	Status           string  `json:"status"`
	UnitPrice        float32 `json:"unit_price"`
	ServiceStartDate string  `json:"service_start_date"`
	BillStartDate    string  `json:"bill_start_date"`
	CancelDate       string  `json:"cancel_date"`
}

OrderItem represents the services/products ordered by the user.

type PaymentHistory

type PaymentHistory struct {
	MoneyType     string `json:"money_type"`
	DepositAmount int    `json:"deposit_amount"`
	ReceivedDate  string `json:"received_date"`
}

PaymentHistory represents payment history.

type PaymentSummary

type PaymentSummary struct {
	TotalDepositAmount int `json:"total_deposit_amount"`
}

PaymentSummary represencts summarized information of the payment.

type ResponseMeta

type ResponseMeta struct {
	Method     string
	StatusCode int
}

ResponseMeta represents response information (i.e status code).

type Token

type Token struct {
	IssuedAt string   `json:"issued_at"`
	Expires  string   `json:"expires"`
	ID       string   `json:"id"`
	Tenant   *tenant  `json:"tenant"`
	AuditIds []string `json:"audit_ids"`
}

Token represents the ConoHa API access token.

type Version

type Version struct {
	Status     string       `json:"status,omitempty"`
	Updated    string       `json:"updated,omitempty"`
	MediaTypes []*mediaType `json:"media-types,omitempty"`
	ID         string       `json:"id,omitempty"`
	Links      []*Link      `json:"links,omitempty"`
}

Version represents API version for each endpoint.

Jump to

Keyboard shortcuts

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