orders

package
Version: v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 4 Imported by: 12

Documentation

Overview

Package orders manages and retrieves orders in the OpenStack Key Manager Service.

Example to List Orders

allPages, err := orders.List(client, nil).AllPages()
if err != nil {
	panic(err)
}

allOrders, err := orders.ExtractOrders(allPages)
if err != nil {
	panic(err)
}

fmt.Printf("%v\n", allOrders)

Example to Create a Order

createOpts := orders.CreateOpts{
	Type: orders.KeyOrder,
	Meta: orders.MetaOpts{
		Name:      "order-name",
		Algorithm: "aes",
		BitLength: 256,
		Mode:      "cbc",
	},
}

order, err := orders.Create(client, createOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%v\n", order)

Example to Delete a Order

err := orders.Delete(client, orderID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List retrieves a list of orders.

Types

type CreateOpts

type CreateOpts struct {
	// Type is the type of order to create.
	Type OrderType `json:"type"`

	// Meta contains secrets data to create a secret.
	Meta MetaOpts `json:"meta"`
}

CreateOpts provides options used to create a orders.

func (CreateOpts) ToOrderCreateMap

func (opts CreateOpts) ToOrderCreateMap() (map[string]interface{}, error)

ToOrderCreateMap formats a CreateOpts into a create request.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToOrderCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult is the response from a Create operation. Call its Extract method to interpret it as a orders.

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create creates a new orders.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Order, error)

Extract interprets any commonResult as a Order.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.

func Delete

func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete deletes a orders.

type GetResult

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

GetResult is the response from a Get operation. Call its Extract method to interpret it as a orders.

func Get

func Get(client *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves details of a orders.

func (GetResult) Extract

func (r GetResult) Extract() (*Order, error)

Extract interprets any commonResult as a Order.

type ListOpts

type ListOpts struct {
	// Limit is the amount of containers to retrieve.
	Limit int `q:"limit"`

	// Offset is the index within the list to retrieve.
	Offset int `q:"offset"`
}

ListOpts provides options to filter the List results.

func (ListOpts) ToOrderListQuery

func (opts ListOpts) ToOrderListQuery() (string, error)

ToOrderListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToOrderListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request

type Meta

type Meta struct {
	// Algorithm is the algorithm of the secret.
	Algorithm string `json:"algorithm"`

	// BitLength is the bit length of the secret.
	BitLength int `json:"bit_length"`

	// Expiration is the expiration date of the order.
	Expiration time.Time `json:"-"`

	// Mode is the mode of the secret.
	Mode string `json:"mode"`

	// Name is the name of the secret.
	Name string `json:"name"`

	// PayloadContentType is the content type of the secret payload.
	PayloadContentType string `json:"payload_content_type"`
}

func (*Meta) UnmarshalJSON

func (r *Meta) UnmarshalJSON(b []byte) error

type MetaOpts

type MetaOpts struct {
	// Algorithm is the algorithm of the secret.
	Algorithm string `json:"algorithm"`

	// BitLength is the bit length of the secret.
	BitLength int `json:"bit_length"`

	// Expiration is the expiration date of the order.
	Expiration *time.Time `json:"-"`

	// Mode is the mode of the secret.
	Mode string `json:"mode"`

	// Name is the name of the secret.
	Name string `json:"name,omitempty"`

	// PayloadContentType is the content type of the secret payload.
	PayloadContentType string `json:"payload_content_type,omitempty"`
}

MetaOpts represents options used for creating an order.

type Order

type Order struct {
	// ContainerRef is the container URL.
	ContainerRef string `json:"container_ref"`

	// Created is when the order was created.
	Created time.Time `json:"-"`

	// CreatorID is the creator of the order.
	CreatorID string `json:"creator_id"`

	// ErrorReason is the reason of the error.
	ErrorReason string `json:"error_reason"`

	// ErrorStatusCode is the error status code.
	ErrorStatusCode string `json:"error_status_code"`

	// OrderRef is the order URL.
	OrderRef string `json:"order_ref"`

	// Meta is secret data about the order.
	Meta Meta `json:"meta"`

	// SecretRef is the secret URL.
	SecretRef string `json:"secret_ref"`

	// Status is the status of the order.
	Status string `json:"status"`

	// SubStatus is the status of the order.
	SubStatus string `json:"sub_status"`

	// SubStatusMessage is the message of the sub status.
	SubStatusMessage string `json:"sub_status_message"`

	// Type is the order type.
	Type string `json:"type"`

	// Updated is when the order was updated.
	Updated time.Time `json:"-"`
}

Order represents an order in the key manager service.

func ExtractOrders

func ExtractOrders(r pagination.Page) ([]Order, error)

ExtractOrders returns a slice of Orders contained in a single page of results.

func (*Order) UnmarshalJSON

func (r *Order) UnmarshalJSON(b []byte) error

type OrderPage

type OrderPage struct {
	pagination.LinkedPageBase
}

OrderPage is a single page of orders results.

func (OrderPage) IsEmpty

func (r OrderPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of ordersS contains any results.

func (OrderPage) NextPageURL

func (r OrderPage) NextPageURL() (string, error)

NextPageURL extracts the "next" link from the links section of the result.

type OrderType

type OrderType string

OrderType represents the valid types of orders.

const (
	KeyOrder        OrderType = "key"
	AsymmetricOrder OrderType = "asymmetric"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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