openapi

package module
v0.0.0-...-4d1605e Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

README

Go API client for openapi

The Open Service Broker API defines an HTTP(S) interface between Platforms and Service Brokers.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: master - might contain changes that are not yet released
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.openservicebrokerapi.org/

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./openapi"

Documentation for API Endpoints

All URIs are relative to http://localhost:3000

Class Method HTTP request Description
CatalogApi CatalogGet Get /v2/catalog get the catalog of services that the service broker offers
ServiceBindingsApi ServiceBindingBinding Put /v2/service_instances/{instance_id}/service_bindings/{binding_id} generation of a service binding
ServiceBindingsApi ServiceBindingGet Get /v2/service_instances/{instance_id}/service_bindings/{binding_id} gets a service binding
ServiceBindingsApi ServiceBindingLastOperationGet Get /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation last requested operation state for service binding
ServiceBindingsApi ServiceBindingUnbinding Delete /v2/service_instances/{instance_id}/service_bindings/{binding_id} deprovision of a service binding
ServiceInstancesApi ServiceInstanceDeprovision Delete /v2/service_instances/{instance_id} deprovision a service instance
ServiceInstancesApi ServiceInstanceGet Get /v2/service_instances/{instance_id} gets a service instance
ServiceInstancesApi ServiceInstanceLastOperationGet Get /v2/service_instances/{instance_id}/last_operation last requested operation state for service instance
ServiceInstancesApi ServiceInstanceProvision Put /v2/service_instances/{instance_id} provision a service instance
ServiceInstancesApi ServiceInstanceUpdate Patch /v2/service_instances/{instance_id} update a service instance

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

Author

open-service-broker-api@googlegroups.com

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	CatalogApi *CatalogApiService

	ServiceBindingsApi *ServiceBindingsApiService

	ServiceInstancesApi *ServiceInstancesApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Open Service Broker API API vmaster - might contain changes that are not yet released In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AsyncOperation

type AsyncOperation struct {
	Operation string `json:"operation,omitempty"`
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Catalog

type Catalog struct {
	Services []Service `json:"services,omitempty"`
}

type CatalogApiService

type CatalogApiService service

func (*CatalogApiService) CatalogGet

func (a *CatalogApiService) CatalogGet(ctx context.Context, xBrokerAPIVersion string, localVarOptionals *CatalogGetOpts) (Catalog, *http.Response, error)

type CatalogGetOpts

type CatalogGetOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
}

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type DashboardClient

type DashboardClient struct {
	Id          string `json:"id"`
	Secret      string `json:"secret"`
	RedirectUri string `json:"redirect_uri,omitempty"`
}

type Error

type Error struct {
	Error            string `json:"error,omitempty"`
	Description      string `json:"description,omitempty"`
	InstanceUsable   bool   `json:"instance_usable,omitempty"`
	UpdateRepeatable bool   `json:"update_repeatable,omitempty"`
}

type GenericOpenAPIError

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

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type LastOperationResource

type LastOperationResource struct {
	State            string `json:"state"`
	Description      string `json:"description,omitempty"`
	InstanceUsable   bool   `json:"instance_usable,omitempty"`
	UpdateRepeatable bool   `json:"update_repeatable,omitempty"`
}

type MaintenanceInfo

type MaintenanceInfo struct {
	Version     string `json:"version,omitempty"`
	Description string `json:"description,omitempty"`
}

type Plan

type Plan struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	// See [Service Metadata Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#service-metadata) for more details.
	Metadata               map[string]interface{} `json:"metadata,omitempty"`
	Free                   bool                   `json:"free,omitempty"`
	Bindable               bool                   `json:"bindable,omitempty"`
	PlanUpdateable         bool                   `json:"plan_updateable,omitempty"`
	Schemas                SchemasObject          `json:"schemas,omitempty"`
	MaximumPollingDuration int32                  `json:"maximum_polling_duration,omitempty"`
	MaintenanceInfo        MaintenanceInfo        `json:"maintenance_info,omitempty"`
}

type SchemaParameters

type SchemaParameters struct {
	Parameters map[string]interface{} `json:"parameters,omitempty"`
}

type SchemasObject

type SchemasObject struct {
	ServiceInstance ServiceInstanceSchemaObject `json:"service_instance,omitempty"`
	ServiceBinding  ServiceBindingSchemaObject  `json:"service_binding,omitempty"`
}

type Service

type Service struct {
	Name                 string   `json:"name"`
	Id                   string   `json:"id"`
	Description          string   `json:"description"`
	Tags                 []string `json:"tags,omitempty"`
	Requires             []string `json:"requires,omitempty"`
	Bindable             bool     `json:"bindable"`
	InstancesRetrievable bool     `json:"instances_retrievable,omitempty"`
	BindingsRetrievable  bool     `json:"bindings_retrievable,omitempty"`
	AllowContextUpdates  bool     `json:"allow_context_updates,omitempty"`
	// See [Service Metadata Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#service-metadata) for more details.
	Metadata        map[string]interface{} `json:"metadata,omitempty"`
	DashboardClient DashboardClient        `json:"dashboard_client,omitempty"`
	PlanUpdateable  bool                   `json:"plan_updateable,omitempty"`
	Plans           []Plan                 `json:"plans"`
}

type ServiceBindingBindingOpts

type ServiceBindingBindingOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	AcceptsIncomplete             optional.Bool
}

type ServiceBindingGetOpts

type ServiceBindingGetOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	ServiceId                     optional.String
	PlanId                        optional.String
}

type ServiceBindingLastOperationGetOpts

type ServiceBindingLastOperationGetOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	ServiceId                     optional.String
	PlanId                        optional.String
	Operation                     optional.String
}

type ServiceBindingRequest

type ServiceBindingRequest struct {
	// See [Context Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#context-object) for more details.
	Context      map[string]interface{}       `json:"context,omitempty"`
	ServiceId    string                       `json:"service_id"`
	PlanId       string                       `json:"plan_id"`
	AppGuid      string                       `json:"app_guid,omitempty"`
	BindResource ServiceBindingResourceObject `json:"bind_resource,omitempty"`
	Parameters   map[string]interface{}       `json:"parameters,omitempty"`
}

type ServiceBindingResource

type ServiceBindingResource struct {
	Credentials     map[string]interface{}      `json:"credentials,omitempty"`
	SyslogDrainUrl  string                      `json:"syslog_drain_url,omitempty"`
	RouteServiceUrl string                      `json:"route_service_url,omitempty"`
	VolumeMounts    []ServiceBindingVolumeMount `json:"volume_mounts,omitempty"`
	Parameters      map[string]interface{}      `json:"parameters,omitempty"`
}

type ServiceBindingResourceObject

type ServiceBindingResourceObject struct {
	AppGuid string `json:"app_guid,omitempty"`
	Route   string `json:"route,omitempty"`
}

type ServiceBindingResponse

type ServiceBindingResponse struct {
	Credentials     map[string]interface{}      `json:"credentials,omitempty"`
	SyslogDrainUrl  string                      `json:"syslog_drain_url,omitempty"`
	RouteServiceUrl string                      `json:"route_service_url,omitempty"`
	VolumeMounts    []ServiceBindingVolumeMount `json:"volume_mounts,omitempty"`
}

type ServiceBindingSchemaObject

type ServiceBindingSchemaObject struct {
	Create SchemaParameters `json:"create,omitempty"`
}

type ServiceBindingUnbindingOpts

type ServiceBindingUnbindingOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	AcceptsIncomplete             optional.Bool
}

type ServiceBindingVolumeMount

type ServiceBindingVolumeMount struct {
	Driver       string                          `json:"driver"`
	ContainerDir string                          `json:"container_dir"`
	Mode         string                          `json:"mode"`
	DeviceType   string                          `json:"device_type"`
	Device       ServiceBindingVolumeMountDevice `json:"device"`
}

type ServiceBindingVolumeMountDevice

type ServiceBindingVolumeMountDevice struct {
	VolumeId    string                 `json:"volume_id"`
	MountConfig map[string]interface{} `json:"mount_config,omitempty"`
}

type ServiceBindingsApiService

type ServiceBindingsApiService service

func (*ServiceBindingsApiService) ServiceBindingBinding

func (a *ServiceBindingsApiService) ServiceBindingBinding(ctx context.Context, xBrokerAPIVersion string, instanceId string, bindingId string, body ServiceBindingRequest, localVarOptionals *ServiceBindingBindingOpts) (ServiceBindingResponse, *http.Response, error)

func (*ServiceBindingsApiService) ServiceBindingGet

func (a *ServiceBindingsApiService) ServiceBindingGet(ctx context.Context, xBrokerAPIVersion string, instanceId string, bindingId string, localVarOptionals *ServiceBindingGetOpts) (ServiceBindingResource, *http.Response, error)

func (*ServiceBindingsApiService) ServiceBindingLastOperationGet

func (a *ServiceBindingsApiService) ServiceBindingLastOperationGet(ctx context.Context, xBrokerAPIVersion string, instanceId string, bindingId string, localVarOptionals *ServiceBindingLastOperationGetOpts) (LastOperationResource, *http.Response, error)

func (*ServiceBindingsApiService) ServiceBindingUnbinding

func (a *ServiceBindingsApiService) ServiceBindingUnbinding(ctx context.Context, xBrokerAPIVersion string, instanceId string, bindingId string, serviceId string, planId string, localVarOptionals *ServiceBindingUnbindingOpts) (map[string]interface{}, *http.Response, error)

type ServiceInstanceAsyncOperation

type ServiceInstanceAsyncOperation struct {
	DashboardUrl string `json:"dashboard_url,omitempty"`
	Operation    string `json:"operation,omitempty"`
}

type ServiceInstanceDeprovisionOpts

type ServiceInstanceDeprovisionOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	AcceptsIncomplete             optional.Bool
}

type ServiceInstanceGetOpts

type ServiceInstanceGetOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	ServiceId                     optional.String
	PlanId                        optional.String
}

type ServiceInstanceLastOperationGetOpts

type ServiceInstanceLastOperationGetOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	ServiceId                     optional.String
	PlanId                        optional.String
	Operation                     optional.String
}

type ServiceInstancePreviousValues

type ServiceInstancePreviousValues struct {
	ServiceId       string          `json:"service_id,omitempty"`
	PlanId          string          `json:"plan_id,omitempty"`
	OrganizationId  string          `json:"organization_id,omitempty"`
	SpaceId         string          `json:"space_id,omitempty"`
	MaintenanceInfo MaintenanceInfo `json:"maintenance_info,omitempty"`
}

type ServiceInstanceProvisionOpts

type ServiceInstanceProvisionOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	AcceptsIncomplete             optional.Bool
}

type ServiceInstanceProvisionRequest

type ServiceInstanceProvisionRequest struct {
	ServiceId string `json:"service_id"`
	PlanId    string `json:"plan_id"`
	// See [Context Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#context-object) for more details.
	Context          map[string]interface{} `json:"context,omitempty"`
	OrganizationGuid string                 `json:"organization_guid"`
	SpaceGuid        string                 `json:"space_guid"`
	Parameters       map[string]interface{} `json:"parameters,omitempty"`
	MaintenanceInfo  MaintenanceInfo        `json:"maintenance_info,omitempty"`
}

type ServiceInstanceProvisionResponse

type ServiceInstanceProvisionResponse struct {
	DashboardUrl string `json:"dashboard_url,omitempty"`
}

type ServiceInstanceResource

type ServiceInstanceResource struct {
	ServiceId    string                 `json:"service_id,omitempty"`
	PlanId       string                 `json:"plan_id,omitempty"`
	DashboardUrl string                 `json:"dashboard_url,omitempty"`
	Parameters   map[string]interface{} `json:"parameters,omitempty"`
}

type ServiceInstanceSchemaObject

type ServiceInstanceSchemaObject struct {
	Create SchemaParameters `json:"create,omitempty"`
	Update SchemaParameters `json:"update,omitempty"`
}

type ServiceInstanceUpdateOpts

type ServiceInstanceUpdateOpts struct {
	XBrokerAPIOriginatingIdentity optional.String
	XBrokerAPIRequestIdentity     optional.String
	AcceptsIncomplete             optional.Bool
}

type ServiceInstanceUpdateRequest

type ServiceInstanceUpdateRequest struct {
	// See [Context Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#context-object) for more details.
	Context         map[string]interface{}        `json:"context,omitempty"`
	ServiceId       string                        `json:"service_id"`
	PlanId          string                        `json:"plan_id,omitempty"`
	Parameters      map[string]interface{}        `json:"parameters,omitempty"`
	PreviousValues  ServiceInstancePreviousValues `json:"previous_values,omitempty"`
	MaintenanceInfo MaintenanceInfo               `json:"maintenance_info,omitempty"`
}

type ServiceInstancesApiService

type ServiceInstancesApiService service

func (*ServiceInstancesApiService) ServiceInstanceDeprovision

func (a *ServiceInstancesApiService) ServiceInstanceDeprovision(ctx context.Context, xBrokerAPIVersion string, instanceId string, serviceId string, planId string, localVarOptionals *ServiceInstanceDeprovisionOpts) (map[string]interface{}, *http.Response, error)

func (*ServiceInstancesApiService) ServiceInstanceGet

func (a *ServiceInstancesApiService) ServiceInstanceGet(ctx context.Context, xBrokerAPIVersion string, instanceId string, localVarOptionals *ServiceInstanceGetOpts) (ServiceInstanceResource, *http.Response, error)

func (*ServiceInstancesApiService) ServiceInstanceLastOperationGet

func (a *ServiceInstancesApiService) ServiceInstanceLastOperationGet(ctx context.Context, xBrokerAPIVersion string, instanceId string, localVarOptionals *ServiceInstanceLastOperationGetOpts) (LastOperationResource, *http.Response, error)

func (*ServiceInstancesApiService) ServiceInstanceProvision

func (a *ServiceInstancesApiService) ServiceInstanceProvision(ctx context.Context, xBrokerAPIVersion string, instanceId string, body ServiceInstanceProvisionRequest, localVarOptionals *ServiceInstanceProvisionOpts) (ServiceInstanceProvisionResponse, *http.Response, error)

func (*ServiceInstancesApiService) ServiceInstanceUpdate

func (a *ServiceInstancesApiService) ServiceInstanceUpdate(ctx context.Context, xBrokerAPIVersion string, instanceId string, body ServiceInstanceUpdateRequest, localVarOptionals *ServiceInstanceUpdateOpts) (map[string]interface{}, *http.Response, error)

Jump to

Keyboard shortcuts

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