endpoints

package
v0.0.0-...-08576c7 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package endpoints provides information and interaction with the service endpoints API resource in the OpenStack Identity service.

For more information, see: http://developer.openstack.org/api-ref-identity-v3.html#endpoints-v3

Example to List Endpoints

serviceID := "e629d6e599d9489fb3ae5d9cc12eaea3"

listOpts := endpoints.ListOpts{
	ServiceID: serviceID,
}

allPages, err := endpoints.List(identityClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allEndpoints, err := endpoints.ExtractEndpoints(allPages)
if err != nil {
	panic(err)
}

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

Example to Create an Endpoint

serviceID := "e629d6e599d9489fb3ae5d9cc12eaea3"

createOpts := endpoints.CreateOpts{
	Availability: gophercloud.AvailabilityPublic,
	Name:         "neutron",
	Region:       "RegionOne",
	URL:          "https://localhost:9696",
	ServiceID:    serviceID,
}

endpoint, err := endpoints.Create(identityClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Update an Endpoint

endpointID := "ad59deeec5154d1fa0dcff518596f499"

updateOpts := endpoints.UpdateOpts{
	Region: "RegionTwo",
}

endpoint, err := endpoints.Update(identityClient, endpointID, updateOpts).Extract()
if err != nil {
	panic(err)
}

Example to Delete an Endpoint

endpointID := "ad59deeec5154d1fa0dcff518596f499"
err := endpoints.Delete(identityClient, endpointID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List enumerates endpoints in a paginated collection, optionally filtered by ListOpts criteria.

Types

type CreateOpts

type CreateOpts struct {
	// Availability is the interface type of the Endpoint (admin, internal,
	// or public), referenced by the gophercloud.Availability type.
	Availability gophercloud.Availability `json:"interface" required:"true"`

	// Name is the name of the Endpoint.
	Name string `json:"name" required:"true"`

	// Region is the region the Endpoint is located in.
	// This field can be omitted or left as a blank string.
	Region string `json:"region,omitempty"`

	// URL is the url of the Endpoint.
	URL string `json:"url" required:"true"`

	// ServiceID is the ID of the service the Endpoint refers to.
	ServiceID string `json:"service_id" required:"true"`
}

CreateOpts contains the subset of Endpoint attributes that should be used to create an Endpoint.

func (CreateOpts) ToEndpointCreateMap

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

ToEndpointCreateMap builds a request body from the Endpoint Create options.

type CreateOptsBuilder

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

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 an Endpoint.

func Create

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

Create inserts a new Endpoint into the service catalog.

func (CreateResult) Extract

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

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

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

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

func Delete

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

Delete removes an endpoint from the service catalog.

type Endpoint

type Endpoint struct {
	// ID is the unique ID of the endpoint.
	ID string `json:"id"`

	// Availability is the interface type of the Endpoint (admin, internal,
	// or public), referenced by the gophercloud.Availability type.
	Availability gophercloud.Availability `json:"interface"`

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

	// Region is the region the Endpoint is located in.
	Region string `json:"region"`

	// ServiceID is the ID of the service the Endpoint refers to.
	ServiceID string `json:"service_id"`

	// URL is the url of the Endpoint.
	URL string `json:"url"`

	// Enabled is whether or not the endpoint is enabled.
	Enabled bool `json:"enabled"`
}

Endpoint describes the entry point for another service's API.

func ExtractEndpoints

func ExtractEndpoints(r pagination.Page) ([]Endpoint, error)

ExtractEndpoints extracts an Endpoint slice from a Page.

type EndpointPage

type EndpointPage struct {
	pagination.LinkedPageBase
}

EndpointPage is a single page of Endpoint results.

func (EndpointPage) IsEmpty

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

IsEmpty returns true if no Endpoints were returned.

type ListOpts

type ListOpts struct {
	// Availability is the interface type of the Endpoint (admin, internal,
	// or public), referenced by the gophercloud.Availability type.
	Availability gophercloud.Availability `q:"interface"`

	// ServiceID is the ID of the service the Endpoint refers to.
	ServiceID string `q:"service_id"`

	// RegionID is the ID of the region the Endpoint refers to.
	RegionID string `q:"region_id"`
}

ListOpts allows finer control over the endpoints returned by a List call. All fields are optional.

func (ListOpts) ToEndpointListParams

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

ToEndpointListParams builds a list request from the List options.

type ListOptsBuilder

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

ListOptsBuilder allows extensions to add parameters to the List request.

type UpdateOpts

type UpdateOpts struct {
	// Availability is the interface type of the Endpoint (admin, internal,
	// or public), referenced by the gophercloud.Availability type.
	Availability gophercloud.Availability `json:"interface,omitempty"`

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

	// Region is the region the Endpoint is located in.
	// This field can be omitted or left as a blank string.
	Region string `json:"region,omitempty"`

	// URL is the url of the Endpoint.
	URL string `json:"url,omitempty"`

	// ServiceID is the ID of the service the Endpoint refers to.
	ServiceID string `json:"service_id,omitempty"`
}

UpdateOpts contains the subset of Endpoint attributes that should be used to update an Endpoint.

func (UpdateOpts) ToEndpointUpdateMap

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

ToEndpointUpdateMap builds an update request body from the Update options.

type UpdateOptsBuilder

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

UpdateOptsBuilder allows extensions to add parameters to the Update request.

type UpdateResult

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

UpdateResult is the response from an Update operation. Call its Extract method to interpret it as an Endpoint.

func Update

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

Update changes an existing endpoint with new data.

func (UpdateResult) Extract

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

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

Directories

Path Synopsis
endpoints unit tests
endpoints unit tests

Jump to

Keyboard shortcuts

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