services

package
v0.0.0-...-8db8df1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package services provides information and interaction with the services API resource for the OpenStack Identity service.

Example to List Services

listOpts := services.ListOpts{
	ServiceType: "compute",
}

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

allServices, err := services.ExtractServices(allPages)
if err != nil {
	panic(err)
}

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

Example to Create a Service

service, err := services.Create(identityClient, "compute").Extract()
if err != nil {
	panic(err)
}

Example to Delete a Service

serviceID := "3c7bbe9a6ecb453ca1789586291380ed"
err := services.Delete(identityClient, serviceID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List enumerates the services available to a specific user.

Types

type CreateResult

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

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

func Create

func Create(client *gophercloud.ServiceClient, serviceType string) (r CreateResult)

Create adds a new service of the requested type to the catalog.

func (CreateResult) Extract

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

Extract interprets a GetResult, CreateResult or UpdateResult as a concrete Service. 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 request. Call its ExtractErr method to interpret it as a Service.

func Delete

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

Delete removes an existing service. It either deletes all associated endpoints, or fails until all endpoints are deleted.

type GetResult

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

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

func Get

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

Get returns additional information about a service, given its ID.

func (GetResult) Extract

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

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

type ListOpts

type ListOpts struct {
	ServiceType string `q:"type"`
	PerPage     int    `q:"perPage"`
	Page        int    `q:"page"`
}

ListOpts provides options for filtering the List results.

func (ListOpts) ToServiceListMap

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

ToServiceListMap builds a list query from the list options.

type ListOptsBuilder

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

ListOptsBuilder enables extensions to add additional parameters to the List request.

type Service

type Service struct {
	// Description is a description of the service.
	Description string `json:"description"`

	// ID is the unique ID of the service.
	ID string `json:"id"`

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

	// Type is the type of the service.
	Type string `json:"type"`
}

Service represents an OpenStack Service.

func ExtractServices

func ExtractServices(r pagination.Page) ([]Service, error)

ExtractServices extracts a slice of Services from a Collection acquired from List.

type ServicePage

type ServicePage struct {
	pagination.LinkedPageBase
}

ServicePage is a single page of Service results.

func (ServicePage) IsEmpty

func (p ServicePage) IsEmpty() (bool, error)

IsEmpty returns true if the ServicePage contains no results.

type UpdateResult

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

UpdateResult is the response from an Update request. Call its Extract method to interpret it as a Service.

func Update

func Update(client *gophercloud.ServiceClient, serviceID string, serviceType string) (r UpdateResult)

Update changes the service type of an existing service.

func (UpdateResult) Extract

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

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

Directories

Path Synopsis
services unit tests
services unit tests

Jump to

Keyboard shortcuts

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