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(context.TODO()) 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(context.TODO(), identityClient, createOpts).Extract() if err != nil { panic(err) }
Example to Update an Endpoint
endpointID := "ad59deeec5154d1fa0dcff518596f499" updateOpts := endpoints.UpdateOpts{ Region: "RegionTwo", } endpoint, err := endpoints.Update(context.TODO(), identityClient, endpointID, updateOpts).Extract() if err != nil { panic(err) }
Example to Delete an Endpoint
endpointID := "ad59deeec5154d1fa0dcff518596f499" err := endpoints.Delete(context.TODO(), 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]any, error)
ToEndpointCreateMap builds a request body from the Endpoint Create options.
type CreateOptsBuilder ¶
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(ctx context.Context, client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create inserts a new Endpoint into the service catalog.
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.
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 ¶
ToEndpointListParams builds a list request from the List options.
type ListOptsBuilder ¶
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]any, error)
ToEndpointUpdateMap builds an update request body from the Update options.
type UpdateOptsBuilder ¶
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(ctx context.Context, client *gophercloud.ServiceClient, endpointID string, opts UpdateOptsBuilder) (r UpdateResult)
Update changes an existing endpoint with new data.