request

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 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 Requests

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

allTransferRequests, err := transferRequests.ExtractTransferRequests(allPages)
if err != nil {
	panic(err)
}

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

Example to Create a Zone Transfer Request

zoneID := "99d10f68-5623-4491-91a0-6daafa32b60e"
targetProjectID := "f977bd7c-6485-4385-b04f-b5af0d186fcc"
createOpts := transferRequests.CreateOpts{
        TargetProjectID: targetProjectID,
	Description: "This is a zone transfer request.",
}
transferRequest, err := transferRequests.Create(dnsClient, zoneID, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Delete a Zone Transfer Request

transferID := "99d10f68-5623-4491-91a0-6daafa32b60e"
err := transferRequests.Delete(dnsClient, transferID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List implements a transfer request List request.

Types

type CreateOpts

type CreateOpts struct {
	// TargetProjectID is ID that the request will be limited to. No other project
	// will be allowed to accept this request.
	TargetProjectID string `json:"target_project_id,omitempty"`

	// Description of the transfer request.
	Description string `json:"description,omitempty"`
}

CreateOpts specifies the attributes used to create a transfer request.

func (CreateOpts) ToTransferRequestCreateMap

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

ToTransferRequestCreateMap formats an CreateOpts structure into a request body.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToTransferRequestCreateMap() (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 TransferRequest.

func Create

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

Create implements a transfer request create request.

func (CreateResult) Extract

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

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

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult is the result of a Delete request. Call its ExtractErr method to determine if the request succeeded or failed.

func Delete

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

Delete implements a transfer request delete request.

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 TransferRequest.

func Get

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

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

func (GetResult) Extract

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

Extract interprets a GetResult, CreateResult or UpdateResult as a TransferRequest. 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) ToTransferRequestListQuery

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

ToTransferRequestListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

ListOptsBuilder allows extensions to add parameters to the List request.

type TransferRequest

type TransferRequest struct {
	// ID uniquely identifies this transfer request zone amongst all other transfer requests,
	// including those not accessible to the current tenant.
	ID string `json:"id"`

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

	// Name is the name of the zone that is being exported.
	ZoneName string `json:"zone_name"`

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

	// TargetProjectID identifies the project/tenant to transfer this resource.
	TargetProjectID string `json:"target_project_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"`

	// Description for the resource.
	Description string `json:"description"`

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

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

	// UpdatedAt is the date when the last change was made to the zone transfer request.
	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"`
}

TransferRequest represents a Zone transfer request task.

func ExtractTransferRequests

func ExtractTransferRequests(r pagination.Page) ([]TransferRequest, error)

ExtractTransferRequests extracts a slice of TransferRequest from a List result.

func (*TransferRequest) UnmarshalJSON

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

type TransferRequestPage

type TransferRequestPage struct {
	pagination.LinkedPageBase
}

TransferRequestPage is a single page of TransferRequest results.

func (TransferRequestPage) IsEmpty

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

IsEmpty returns true if the page contains no results.

type UpdateOpts

type UpdateOpts struct {
	// TargetProjectID is ID that the request will be limited to. No other project
	// will be allowed to accept this request.
	TargetProjectID string `json:"target_project_id,omitempty"`

	// Description of the transfer request.
	Description string `json:"description,omitempty"`
}

UpdateOpts specifies the attributes to update a transfer request.

func (UpdateOpts) ToTransferRequestUpdateMap

func (opts UpdateOpts) ToTransferRequestUpdateMap() (map[string]interface{}, error)

ToTransferRequestUpdateMap formats an UpdateOpts structure into a request body.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToTransferRequestUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional attributes to the Update request.

type UpdateResult

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

UpdateResult is the result of an Update request. Call its Extract method to interpret the result as a TransferRequest.

func Update

func Update(client *gophercloud.ServiceClient, transferID string, opts UpdateOptsBuilder) (r UpdateResult)

Update implements a transfer request update request.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*TransferRequest, error)

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

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