Update vendor dir and Godeps.json with new Godep

This commit is contained in:
saadali
2016-05-11 16:59:55 -07:00
parent b83af3d481
commit c708e2cc82
2053 changed files with 955 additions and 140589 deletions

View File

@@ -1,6 +0,0 @@
// 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
package endpoints

View File

@@ -1,21 +0,0 @@
package endpoints
import "fmt"
func requiredAttribute(attribute string) error {
return fmt.Errorf("You must specify %s for this endpoint.", attribute)
}
var (
// ErrAvailabilityRequired is reported if an Endpoint is created without an Availability.
ErrAvailabilityRequired = requiredAttribute("an availability")
// ErrNameRequired is reported if an Endpoint is created without a Name.
ErrNameRequired = requiredAttribute("a name")
// ErrURLRequired is reported if an Endpoint is created without a URL.
ErrURLRequired = requiredAttribute("a URL")
// ErrServiceIDRequired is reported if an Endpoint is created without a ServiceID.
ErrServiceIDRequired = requiredAttribute("a serviceID")
)

View File

@@ -1,123 +0,0 @@
package endpoints
import (
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
// EndpointOpts contains the subset of Endpoint attributes that should be used to create or update an Endpoint.
type EndpointOpts struct {
Availability gophercloud.Availability
Name string
Region string
URL string
ServiceID string
}
// Create inserts a new Endpoint into the service catalog.
// Within EndpointOpts, Region may be omitted by being left as "", but all other fields are required.
func Create(client *gophercloud.ServiceClient, opts EndpointOpts) CreateResult {
// Redefined so that Region can be re-typed as a *string, which can be omitted from the JSON output.
type endpoint struct {
Interface string `json:"interface"`
Name string `json:"name"`
Region *string `json:"region,omitempty"`
URL string `json:"url"`
ServiceID string `json:"service_id"`
}
type request struct {
Endpoint endpoint `json:"endpoint"`
}
// Ensure that EndpointOpts is fully populated.
if opts.Availability == "" {
return createErr(ErrAvailabilityRequired)
}
if opts.Name == "" {
return createErr(ErrNameRequired)
}
if opts.URL == "" {
return createErr(ErrURLRequired)
}
if opts.ServiceID == "" {
return createErr(ErrServiceIDRequired)
}
// Populate the request body.
reqBody := request{
Endpoint: endpoint{
Interface: string(opts.Availability),
Name: opts.Name,
URL: opts.URL,
ServiceID: opts.ServiceID,
},
}
reqBody.Endpoint.Region = gophercloud.MaybeString(opts.Region)
var result CreateResult
_, result.Err = client.Post(listURL(client), reqBody, &result.Body, nil)
return result
}
// ListOpts allows finer control over the endpoints returned by a List call.
// All fields are optional.
type ListOpts struct {
Availability gophercloud.Availability `q:"interface"`
ServiceID string `q:"service_id"`
Page int `q:"page"`
PerPage int `q:"per_page"`
}
// List enumerates endpoints in a paginated collection, optionally filtered by ListOpts criteria.
func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
u := listURL(client)
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return pagination.Pager{Err: err}
}
u += q.String()
createPage := func(r pagination.PageResult) pagination.Page {
return EndpointPage{pagination.LinkedPageBase{PageResult: r}}
}
return pagination.NewPager(client, u, createPage)
}
// Update changes an existing endpoint with new data.
// All fields are optional in the provided EndpointOpts.
func Update(client *gophercloud.ServiceClient, endpointID string, opts EndpointOpts) UpdateResult {
type endpoint struct {
Interface *string `json:"interface,omitempty"`
Name *string `json:"name,omitempty"`
Region *string `json:"region,omitempty"`
URL *string `json:"url,omitempty"`
ServiceID *string `json:"service_id,omitempty"`
}
type request struct {
Endpoint endpoint `json:"endpoint"`
}
reqBody := request{Endpoint: endpoint{}}
reqBody.Endpoint.Interface = gophercloud.MaybeString(string(opts.Availability))
reqBody.Endpoint.Name = gophercloud.MaybeString(opts.Name)
reqBody.Endpoint.Region = gophercloud.MaybeString(opts.Region)
reqBody.Endpoint.URL = gophercloud.MaybeString(opts.URL)
reqBody.Endpoint.ServiceID = gophercloud.MaybeString(opts.ServiceID)
var result UpdateResult
_, result.Err = client.Request("PATCH", endpointURL(client, endpointID), gophercloud.RequestOpts{
JSONBody: &reqBody,
JSONResponse: &result.Body,
OkCodes: []int{200},
})
return result
}
// Delete removes an endpoint from the service catalog.
func Delete(client *gophercloud.ServiceClient, endpointID string) DeleteResult {
var res DeleteResult
_, res.Err = client.Delete(endpointURL(client, endpointID), nil)
return res
}

View File

@@ -1,82 +0,0 @@
package endpoints
import (
"github.com/mitchellh/mapstructure"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
type commonResult struct {
gophercloud.Result
}
// Extract interprets a GetResult, CreateResult or UpdateResult as a concrete Endpoint.
// An error is returned if the original call or the extraction failed.
func (r commonResult) Extract() (*Endpoint, error) {
if r.Err != nil {
return nil, r.Err
}
var res struct {
Endpoint `json:"endpoint"`
}
err := mapstructure.Decode(r.Body, &res)
return &res.Endpoint, err
}
// CreateResult is the deferred result of a Create call.
type CreateResult struct {
commonResult
}
// createErr quickly wraps an error in a CreateResult.
func createErr(err error) CreateResult {
return CreateResult{commonResult{gophercloud.Result{Err: err}}}
}
// UpdateResult is the deferred result of an Update call.
type UpdateResult struct {
commonResult
}
// DeleteResult is the deferred result of an Delete call.
type DeleteResult struct {
gophercloud.ErrResult
}
// Endpoint describes the entry point for another service's API.
type Endpoint struct {
ID string `mapstructure:"id" json:"id"`
Availability gophercloud.Availability `mapstructure:"interface" json:"interface"`
Name string `mapstructure:"name" json:"name"`
Region string `mapstructure:"region" json:"region"`
ServiceID string `mapstructure:"service_id" json:"service_id"`
URL string `mapstructure:"url" json:"url"`
}
// EndpointPage is a single page of Endpoint results.
type EndpointPage struct {
pagination.LinkedPageBase
}
// IsEmpty returns true if no Endpoints were returned.
func (p EndpointPage) IsEmpty() (bool, error) {
es, err := ExtractEndpoints(p)
if err != nil {
return true, err
}
return len(es) == 0, nil
}
// ExtractEndpoints extracts an Endpoint slice from a Page.
func ExtractEndpoints(page pagination.Page) ([]Endpoint, error) {
var response struct {
Endpoints []Endpoint `mapstructure:"endpoints"`
}
err := mapstructure.Decode(page.(EndpointPage).Body, &response)
return response.Endpoints, err
}

View File

@@ -1,11 +0,0 @@
package endpoints
import "github.com/rackspace/gophercloud"
func listURL(client *gophercloud.ServiceClient) string {
return client.ServiceURL("endpoints")
}
func endpointURL(client *gophercloud.ServiceClient, endpointID string) string {
return client.ServiceURL("endpoints", endpointID)
}

View File

@@ -1,3 +0,0 @@
// Package roles provides information and interaction with the roles API
// resource for the OpenStack Identity service.
package roles

View File

@@ -1,50 +0,0 @@
package roles
import (
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
// ListAssignmentsOptsBuilder allows extensions to add additional parameters to
// the ListAssignments request.
type ListAssignmentsOptsBuilder interface {
ToRolesListAssignmentsQuery() (string, error)
}
// ListAssignmentsOpts allows you to query the ListAssignments method.
// Specify one of or a combination of GroupId, RoleId, ScopeDomainId, ScopeProjectId,
// and/or UserId to search for roles assigned to corresponding entities.
// Effective lists effective assignments at the user, project, and domain level,
// allowing for the effects of group membership.
type ListAssignmentsOpts struct {
GroupId string `q:"group.id"`
RoleId string `q:"role.id"`
ScopeDomainId string `q:"scope.domain.id"`
ScopeProjectId string `q:"scope.project.id"`
UserId string `q:"user.id"`
Effective bool `q:"effective"`
}
// ToRolesListAssignmentsQuery formats a ListAssignmentsOpts into a query string.
func (opts ListAssignmentsOpts) ToRolesListAssignmentsQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return "", err
}
return q.String(), nil
}
// ListAssignments enumerates the roles assigned to a specified resource.
func ListAssignments(client *gophercloud.ServiceClient, opts ListAssignmentsOptsBuilder) pagination.Pager {
url := listAssignmentsURL(client)
query, err := opts.ToRolesListAssignmentsQuery()
if err != nil {
return pagination.Pager{Err: err}
}
url += query
createPage := func(r pagination.PageResult) pagination.Page {
return RoleAssignmentsPage{pagination.LinkedPageBase{PageResult: r}}
}
return pagination.NewPager(client, url, createPage)
}

View File

@@ -1,81 +0,0 @@
package roles
import (
"github.com/rackspace/gophercloud/pagination"
"github.com/mitchellh/mapstructure"
)
// RoleAssignment is the result of a role assignments query.
type RoleAssignment struct {
Role Role `json:"role,omitempty"`
Scope Scope `json:"scope,omitempty"`
User User `json:"user,omitempty"`
Group Group `json:"group,omitempty"`
}
type Role struct {
ID string `json:"id,omitempty"`
}
type Scope struct {
Domain Domain `json:"domain,omitempty"`
Project Project `json:"domain,omitempty"`
}
type Domain struct {
ID string `json:"id,omitempty"`
}
type Project struct {
ID string `json:"id,omitempty"`
}
type User struct {
ID string `json:"id,omitempty"`
}
type Group struct {
ID string `json:"id,omitempty"`
}
// RoleAssignmentsPage is a single page of RoleAssignments results.
type RoleAssignmentsPage struct {
pagination.LinkedPageBase
}
// IsEmpty returns true if the page contains no results.
func (p RoleAssignmentsPage) IsEmpty() (bool, error) {
roleAssignments, err := ExtractRoleAssignments(p)
if err != nil {
return true, err
}
return len(roleAssignments) == 0, nil
}
// NextPageURL uses the response's embedded link reference to navigate to the next page of results.
func (page RoleAssignmentsPage) NextPageURL() (string, error) {
type resp struct {
Links struct {
Next string `mapstructure:"next"`
} `mapstructure:"links"`
}
var r resp
err := mapstructure.Decode(page.Body, &r)
if err != nil {
return "", err
}
return r.Links.Next, nil
}
// ExtractRoleAssignments extracts a slice of RoleAssignments from a Collection acquired from List.
func ExtractRoleAssignments(page pagination.Page) ([]RoleAssignment, error) {
var response struct {
RoleAssignments []RoleAssignment `mapstructure:"role_assignments"`
}
err := mapstructure.Decode(page.(RoleAssignmentsPage).Body, &response)
return response.RoleAssignments, err
}

View File

@@ -1,7 +0,0 @@
package roles
import "github.com/rackspace/gophercloud"
func listAssignmentsURL(client *gophercloud.ServiceClient) string {
return client.ServiceURL("role_assignments")
}

View File

@@ -1,3 +0,0 @@
// Package services provides information and interaction with the services API
// resource for the OpenStack Identity service.
package services

View File

@@ -1,77 +0,0 @@
package services
import (
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
)
type response struct {
Service Service `json:"service"`
}
// Create adds a new service of the requested type to the catalog.
func Create(client *gophercloud.ServiceClient, serviceType string) CreateResult {
type request struct {
Type string `json:"type"`
}
req := request{Type: serviceType}
var result CreateResult
_, result.Err = client.Post(listURL(client), req, &result.Body, nil)
return result
}
// ListOpts allows you to query the List method.
type ListOpts struct {
ServiceType string `q:"type"`
PerPage int `q:"perPage"`
Page int `q:"page"`
}
// List enumerates the services available to a specific user.
func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
u := listURL(client)
q, err := gophercloud.BuildQueryString(opts)
if err != nil {
return pagination.Pager{Err: err}
}
u += q.String()
createPage := func(r pagination.PageResult) pagination.Page {
return ServicePage{pagination.LinkedPageBase{PageResult: r}}
}
return pagination.NewPager(client, u, createPage)
}
// Get returns additional information about a service, given its ID.
func Get(client *gophercloud.ServiceClient, serviceID string) GetResult {
var result GetResult
_, result.Err = client.Get(serviceURL(client, serviceID), &result.Body, nil)
return result
}
// Update changes the service type of an existing service.
func Update(client *gophercloud.ServiceClient, serviceID string, serviceType string) UpdateResult {
type request struct {
Type string `json:"type"`
}
req := request{Type: serviceType}
var result UpdateResult
_, result.Err = client.Request("PATCH", serviceURL(client, serviceID), gophercloud.RequestOpts{
JSONBody: &req,
JSONResponse: &result.Body,
OkCodes: []int{200},
})
return result
}
// Delete removes an existing service.
// It either deletes all associated endpoints, or fails until all endpoints are deleted.
func Delete(client *gophercloud.ServiceClient, serviceID string) DeleteResult {
var res DeleteResult
_, res.Err = client.Delete(serviceURL(client, serviceID), nil)
return res
}

View File

@@ -1,80 +0,0 @@
package services
import (
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
"github.com/mitchellh/mapstructure"
)
type commonResult struct {
gophercloud.Result
}
// Extract interprets a GetResult, CreateResult or UpdateResult as a concrete Service.
// An error is returned if the original call or the extraction failed.
func (r commonResult) Extract() (*Service, error) {
if r.Err != nil {
return nil, r.Err
}
var res struct {
Service `json:"service"`
}
err := mapstructure.Decode(r.Body, &res)
return &res.Service, err
}
// CreateResult is the deferred result of a Create call.
type CreateResult struct {
commonResult
}
// GetResult is the deferred result of a Get call.
type GetResult struct {
commonResult
}
// UpdateResult is the deferred result of an Update call.
type UpdateResult struct {
commonResult
}
// DeleteResult is the deferred result of an Delete call.
type DeleteResult struct {
gophercloud.ErrResult
}
// Service is the result of a list or information query.
type Service struct {
Description *string `json:"description,omitempty"`
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
}
// ServicePage is a single page of Service results.
type ServicePage struct {
pagination.LinkedPageBase
}
// IsEmpty returns true if the page contains no results.
func (p ServicePage) IsEmpty() (bool, error) {
services, err := ExtractServices(p)
if err != nil {
return true, err
}
return len(services) == 0, nil
}
// ExtractServices extracts a slice of Services from a Collection acquired from List.
func ExtractServices(page pagination.Page) ([]Service, error) {
var response struct {
Services []Service `mapstructure:"services"`
}
err := mapstructure.Decode(page.(ServicePage).Body, &response)
return response.Services, err
}

View File

@@ -1,11 +0,0 @@
package services
import "github.com/rackspace/gophercloud"
func listURL(client *gophercloud.ServiceClient) string {
return client.ServiceURL("services")
}
func serviceURL(client *gophercloud.ServiceClient, serviceID string) string {
return client.ServiceURL("services", serviceID)
}