accept

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 5 Imported by: 13

Documentation

Overview

Package zones provides information and interaction with the zone API resource for the OpenStack DNS service.

Example to List Zone Transfer Accepts

// Optionaly you can provide Status as query parameter for filtering the result.
allPages, err := transferAccepts.List(dnsClient, nil).AllPages()
if err != nil {
	panic(err)
}

allTransferAccepts, err := transferAccepts.ExtractTransferAccepts(allPages)
if err != nil {
	panic(err)
}

for _, transferAccept := range allTransferAccepts {
	fmt.Printf("%+v\n", transferAccept)
}

Example to Create a Zone Transfer Accept

zoneTransferRequestID := "99d10f68-5623-4491-91a0-6daafa32b60e"
key := "JKHGD2F7"
createOpts := transferAccepts.CreateOpts{
	ZoneTransferRequestID: zoneTransferRequestID,
	Key: key,
}
transferAccept, err := transferAccepts.Create(dnsClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Get a Zone Transfer Accept

transferAcceptID := "99d10f68-5623-4491-91a0-6daafa32b60e"
transferAccept, err := transferAccepts.Get(dnsClient, transferAcceptID).Extract()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List implements a transfer accept List request.

Types

type CreateOpts

type CreateOpts struct {
	// Key is used as part of the zone transfer accept process.
	// This is only shown to the creator, and must be communicated out of band.
	Key string `json:"key" required:"true"`

	// ZoneTransferRequestID is ID for this zone transfer request
	ZoneTransferRequestID string `json:"zone_transfer_request_id" required:"true"`
}

CreateOpts specifies the attributes used to create a transfer accept.

func (CreateOpts) ToTransferAcceptCreateMap

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

ToTransferAcceptCreateMap formats an CreateOpts structure into a request body.

type CreateOptsBuilder

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

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

type CreateResult

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

CreateResult is the result of a Create request. Call its Extract method to interpret the result as a TransferAccept.

func Create

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

Create implements a transfer accept create request.

func (CreateResult) Extract

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

Extract interprets a GetResult, CreateResult as a TransferAccept. An error is returned if the original call or the extraction failed.

type GetResult

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

GetResult is the result of a Get request. Call its Extract method to interpret the result as a TransferAccept.

func Get

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

Get returns information about a transfer accept, given its ID.

func (GetResult) Extract

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

Extract interprets a GetResult, CreateResult as a TransferAccept. An error is returned if the original call or the extraction failed.

type ListOpts

type ListOpts struct {
	Status string `q:"status"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the server attributes you want to see returned. https://developer.openstack.org/api-ref/dns/

func (ListOpts) ToTransferAcceptListQuery

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

ToTransferAcceptListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

ListOptsBuilder allows extensions to add parameters to the List request.

type TransferAccept

type TransferAccept struct {
	// ID for this zone transfer accept.
	ID string `json:"id"`

	// Status is current status of the zone transfer request.
	Status string `json:"status"`

	// ProjectID identifies the project/tenant owning this resource.
	ProjectID string `json:"project_id"`

	// ZoneID is the ID for the zone that was being exported.
	ZoneID string `json:"zone_id"`

	// Key is used as part of the zone transfer accept process.
	// This is only shown to the creator, and must be communicated out of band.
	Key string `json:"key"`

	// ZoneTransferRequestID is ID for this zone transfer request
	ZoneTransferRequestID string `json:"zone_transfer_request_id"`

	// CreatedAt is the date when the zone transfer accept was created.
	CreatedAt time.Time `json:"-"`

	// UpdatedAt is the date when the last change was made to the zone transfer accept.
	UpdatedAt time.Time `json:"-"`

	// Links includes HTTP references to the itself, useful for passing along
	// to other APIs that might want a server reference.
	Links map[string]interface{} `json:"links"`
}

TransferAccept represents a Zone transfer accept task.

func ExtractTransferAccepts

func ExtractTransferAccepts(r pagination.Page) ([]TransferAccept, error)

ExtractTransferAccepts extracts a slice of TransferAccept from a List result.

func (*TransferAccept) UnmarshalJSON

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

type TransferAcceptPage

type TransferAcceptPage struct {
	pagination.LinkedPageBase
}

TransferAcceptPage is a single page of TransferAccept results.

func (TransferAcceptPage) IsEmpty

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

IsEmpty returns true if the page contains no results.

Directories

Path Synopsis
transfer requests unit tests
transfer requests unit tests

Jump to

Keyboard shortcuts

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