diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/cloud_consul_service_client.go b/clients/cloud-consul-service/preview/2021-02-04/client/cloud_consul_service_client.go new file mode 100644 index 00000000..60464daa --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/cloud_consul_service_client.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/client/consul_service" +) + +// Default cloud consul service HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "api.cloud.hashicorp.com" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http"} + +// NewHTTPClient creates a new cloud consul service HTTP client. +func NewHTTPClient(formats strfmt.Registry) *CloudConsulService { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new cloud consul service HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *CloudConsulService { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new cloud consul service client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *CloudConsulService { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(CloudConsulService) + cli.Transport = transport + cli.ConsulService = consul_service.New(transport, formats) + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// CloudConsulService is a client for cloud consul service +type CloudConsulService struct { + ConsulService consul_service.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *CloudConsulService) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.ConsulService.SetTransport(transport) +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/consul_service_client.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/consul_service_client.go new file mode 100644 index 00000000..e82bc3e1 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/consul_service_client.go @@ -0,0 +1,612 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new consul service API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for consul service API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientService is the interface for Client methods +type ClientService interface { + Create(params *CreateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateOK, error) + + CreateCustomerMasterACLToken(params *CreateCustomerMasterACLTokenParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCustomerMasterACLTokenOK, error) + + CreateSnapshot(params *CreateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSnapshotOK, error) + + Delete(params *DeleteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteOK, error) + + DeleteSnapshot(params *DeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSnapshotOK, error) + + Get(params *GetParams, authInfo runtime.ClientAuthInfoWriter) (*GetOK, error) + + GetClientConfig(params *GetClientConfigParams, authInfo runtime.ClientAuthInfoWriter) (*GetClientConfigOK, error) + + GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*GetSnapshotOK, error) + + List(params *ListParams, authInfo runtime.ClientAuthInfoWriter) (*ListOK, error) + + ListSnapshots(params *ListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter) (*ListSnapshotsOK, error) + + ListUpgradeVersions(params *ListUpgradeVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ListUpgradeVersionsOK, error) + + ListVersions(params *ListVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ListVersionsOK, error) + + ListVersions2(params *ListVersions2Params, authInfo runtime.ClientAuthInfoWriter) (*ListVersions2OK, error) + + RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*RestoreSnapshotOK, error) + + Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOK, error) + + UpdateSnapshot(params *UpdateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateSnapshotOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + Create creates creates a new h c p consul cluster +*/ +func (a *Client) Create(params *CreateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "Create", + Method: "POST", + PathPattern: "/consul/2021-02-04/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*CreateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + CreateCustomerMasterACLToken creates customer master ACL token creates a new master ACL token for the customer on the specified cluster external clients will invoke this endpoint to re generate new master tokens +*/ +func (a *Client) CreateCustomerMasterACLToken(params *CreateCustomerMasterACLTokenParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCustomerMasterACLTokenOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateCustomerMasterACLTokenParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CreateCustomerMasterACLToken", + Method: "POST", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/master-acl-tokens", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateCustomerMasterACLTokenReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*CreateCustomerMasterACLTokenOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateCustomerMasterACLTokenDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + CreateSnapshot creates snapshot takes a new snapshot asynchronously +*/ +func (a *Client) CreateSnapshot(params *CreateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSnapshotOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateSnapshotParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CreateSnapshot", + Method: "POST", + PathPattern: "/consul/2021-02-04/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateSnapshotReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*CreateSnapshotOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateSnapshotDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + Delete deletes deletes the specified h c p consul cluster +*/ +func (a *Client) Delete(params *DeleteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "Delete", + Method: "DELETE", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + DeleteSnapshot deletes snapshot removes the snapshot from storage asynchronously +*/ +func (a *Client) DeleteSnapshot(params *DeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSnapshotOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteSnapshotParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteSnapshot", + Method: "DELETE", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteSnapshotReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteSnapshotOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteSnapshotDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + Get gets reads a single h c p consul cluster +*/ +func (a *Client) Get(params *GetParams, authInfo runtime.ClientAuthInfoWriter) (*GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "Get", + Method: "GET", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + GetClientConfig gets client config files returns the config files for a consul agent running in client mode the files are base64 encoded +*/ +func (a *Client) GetClientConfig(params *GetClientConfigParams, authInfo runtime.ClientAuthInfoWriter) (*GetClientConfigOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetClientConfigParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetClientConfig", + Method: "GET", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/client-config", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetClientConfigReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetClientConfigOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetClientConfigDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + GetSnapshot gets snapshot retrieves an existing snapshot +*/ +func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*GetSnapshotOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetSnapshotParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetSnapshot", + Method: "GET", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetSnapshotReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetSnapshotOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetSnapshotDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + List lists lists all h c p consul clusters +*/ +func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter) (*ListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "List", + Method: "GET", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + ListSnapshots lists snapshots lists snapshots +*/ +func (a *Client) ListSnapshots(params *ListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter) (*ListSnapshotsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListSnapshotsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "ListSnapshots", + Method: "GET", + PathPattern: "/consul/2021-02-04/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListSnapshotsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListSnapshotsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListSnapshotsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + ListUpgradeVersions lists upgrade versions returns the versions available for this consul cluster to upgrade to +*/ +func (a *Client) ListUpgradeVersions(params *ListUpgradeVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ListUpgradeVersionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListUpgradeVersionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "ListUpgradeVersions", + Method: "GET", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/upgrade-versions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListUpgradeVersionsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListUpgradeVersionsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListUpgradeVersionsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + ListVersions lists versions returns the versions available for this org and project +*/ +func (a *Client) ListVersions(params *ListVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ListVersionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListVersionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "ListVersions", + Method: "GET", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/versions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListVersionsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListVersionsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListVersionsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + ListVersions2 lists versions returns the versions available for this org and project +*/ +func (a *Client) ListVersions2(params *ListVersions2Params, authInfo runtime.ClientAuthInfoWriter) (*ListVersions2OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListVersions2Params() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "ListVersions2", + Method: "GET", + PathPattern: "/consul/2021-02-04/versions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListVersions2Reader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListVersions2OK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListVersions2Default) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + RestoreSnapshot restores snapshot restores a snapshot on a given cluster asynchronously +*/ +func (a *Client) RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*RestoreSnapshotOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRestoreSnapshotParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "RestoreSnapshot", + Method: "POST", + PathPattern: "/consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/restore", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &RestoreSnapshotReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*RestoreSnapshotOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*RestoreSnapshotDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + Update updates updates the properties of an existing h c p consul cluster +*/ +func (a *Client) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "Update", + Method: "PATCH", + PathPattern: "/consul/2021-02-04/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters/{cluster.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* + UpdateSnapshot updates snapshot updates an existing snapshot + + Right now only the name can be changed. +*/ +func (a *Client) UpdateSnapshot(params *UpdateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateSnapshotOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateSnapshotParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "UpdateSnapshot", + Method: "PATCH", + PathPattern: "/consul/2021-02-04/organizations/{snapshot.location.organization_id}/projects/{snapshot.location.project_id}/snapshots/{snapshot.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UpdateSnapshotReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateSnapshotOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateSnapshotDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_customer_master_acl_token_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_customer_master_acl_token_parameters.go new file mode 100644 index 00000000..2625676c --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_customer_master_acl_token_parameters.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// NewCreateCustomerMasterACLTokenParams creates a new CreateCustomerMasterACLTokenParams object +// with the default values initialized. +func NewCreateCustomerMasterACLTokenParams() *CreateCustomerMasterACLTokenParams { + var () + return &CreateCustomerMasterACLTokenParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateCustomerMasterACLTokenParamsWithTimeout creates a new CreateCustomerMasterACLTokenParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateCustomerMasterACLTokenParamsWithTimeout(timeout time.Duration) *CreateCustomerMasterACLTokenParams { + var () + return &CreateCustomerMasterACLTokenParams{ + + timeout: timeout, + } +} + +// NewCreateCustomerMasterACLTokenParamsWithContext creates a new CreateCustomerMasterACLTokenParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateCustomerMasterACLTokenParamsWithContext(ctx context.Context) *CreateCustomerMasterACLTokenParams { + var () + return &CreateCustomerMasterACLTokenParams{ + + Context: ctx, + } +} + +// NewCreateCustomerMasterACLTokenParamsWithHTTPClient creates a new CreateCustomerMasterACLTokenParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateCustomerMasterACLTokenParamsWithHTTPClient(client *http.Client) *CreateCustomerMasterACLTokenParams { + var () + return &CreateCustomerMasterACLTokenParams{ + HTTPClient: client, + } +} + +/*CreateCustomerMasterACLTokenParams contains all the parameters to send to the API endpoint +for the create customer master ACL token operation typically these are written to a http.Request +*/ +type CreateCustomerMasterACLTokenParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest + /*ID + id is the ID of the cluster to create a token on. + + */ + ID string + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) WithTimeout(timeout time.Duration) *CreateCustomerMasterACLTokenParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) WithContext(ctx context.Context) *CreateCustomerMasterACLTokenParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) WithHTTPClient(client *http.Client) *CreateCustomerMasterACLTokenParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) WithBody(body *models.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest) *CreateCustomerMasterACLTokenParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) SetBody(body *models.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest) { + o.Body = body +} + +// WithID adds the id to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) WithID(id string) *CreateCustomerMasterACLTokenParams { + o.SetID(id) + return o +} + +// SetID adds the id to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) WithLocationOrganizationID(locationOrganizationID string) *CreateCustomerMasterACLTokenParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) WithLocationProjectID(locationProjectID string) *CreateCustomerMasterACLTokenParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the create customer master ACL token params +func (o *CreateCustomerMasterACLTokenParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateCustomerMasterACLTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_customer_master_acl_token_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_customer_master_acl_token_responses.go new file mode 100644 index 00000000..4f3d7e88 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_customer_master_acl_token_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// CreateCustomerMasterACLTokenReader is a Reader for the CreateCustomerMasterACLToken structure. +type CreateCustomerMasterACLTokenReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateCustomerMasterACLTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateCustomerMasterACLTokenOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateCustomerMasterACLTokenDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewCreateCustomerMasterACLTokenOK creates a CreateCustomerMasterACLTokenOK with default headers values +func NewCreateCustomerMasterACLTokenOK() *CreateCustomerMasterACLTokenOK { + return &CreateCustomerMasterACLTokenOK{} +} + +/*CreateCustomerMasterACLTokenOK handles this case with default header values. + +A successful response. +*/ +type CreateCustomerMasterACLTokenOK struct { + Payload *models.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse +} + +func (o *CreateCustomerMasterACLTokenOK) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/master-acl-tokens][%d] createCustomerMasterAclTokenOK %+v", 200, o.Payload) +} + +func (o *CreateCustomerMasterACLTokenOK) GetPayload() *models.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse { + return o.Payload +} + +func (o *CreateCustomerMasterACLTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateCustomerMasterACLTokenDefault creates a CreateCustomerMasterACLTokenDefault with default headers values +func NewCreateCustomerMasterACLTokenDefault(code int) *CreateCustomerMasterACLTokenDefault { + return &CreateCustomerMasterACLTokenDefault{ + _statusCode: code, + } +} + +/*CreateCustomerMasterACLTokenDefault handles this case with default header values. + +An unexpected error response. +*/ +type CreateCustomerMasterACLTokenDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the create customer master ACL token default response +func (o *CreateCustomerMasterACLTokenDefault) Code() int { + return o._statusCode +} + +func (o *CreateCustomerMasterACLTokenDefault) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/master-acl-tokens][%d] CreateCustomerMasterACLToken default %+v", o._statusCode, o.Payload) +} + +func (o *CreateCustomerMasterACLTokenDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *CreateCustomerMasterACLTokenDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_parameters.go new file mode 100644 index 00000000..334c3e14 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_parameters.go @@ -0,0 +1,177 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// NewCreateParams creates a new CreateParams object +// with the default values initialized. +func NewCreateParams() *CreateParams { + var () + return &CreateParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateParamsWithTimeout creates a new CreateParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateParamsWithTimeout(timeout time.Duration) *CreateParams { + var () + return &CreateParams{ + + timeout: timeout, + } +} + +// NewCreateParamsWithContext creates a new CreateParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateParamsWithContext(ctx context.Context) *CreateParams { + var () + return &CreateParams{ + + Context: ctx, + } +} + +// NewCreateParamsWithHTTPClient creates a new CreateParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateParamsWithHTTPClient(client *http.Client) *CreateParams { + var () + return &CreateParams{ + HTTPClient: client, + } +} + +/*CreateParams contains all the parameters to send to the API endpoint +for the create operation typically these are written to a http.Request +*/ +type CreateParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20210204CreateRequest + /*ClusterLocationOrganizationID + organization_id is the id of the organization. + + */ + ClusterLocationOrganizationID string + /*ClusterLocationProjectID + project_id is the projects id. + + */ + ClusterLocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create params +func (o *CreateParams) WithTimeout(timeout time.Duration) *CreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create params +func (o *CreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create params +func (o *CreateParams) WithContext(ctx context.Context) *CreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create params +func (o *CreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create params +func (o *CreateParams) WithHTTPClient(client *http.Client) *CreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create params +func (o *CreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create params +func (o *CreateParams) WithBody(body *models.HashicorpCloudConsul20210204CreateRequest) *CreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create params +func (o *CreateParams) SetBody(body *models.HashicorpCloudConsul20210204CreateRequest) { + o.Body = body +} + +// WithClusterLocationOrganizationID adds the clusterLocationOrganizationID to the create params +func (o *CreateParams) WithClusterLocationOrganizationID(clusterLocationOrganizationID string) *CreateParams { + o.SetClusterLocationOrganizationID(clusterLocationOrganizationID) + return o +} + +// SetClusterLocationOrganizationID adds the clusterLocationOrganizationId to the create params +func (o *CreateParams) SetClusterLocationOrganizationID(clusterLocationOrganizationID string) { + o.ClusterLocationOrganizationID = clusterLocationOrganizationID +} + +// WithClusterLocationProjectID adds the clusterLocationProjectID to the create params +func (o *CreateParams) WithClusterLocationProjectID(clusterLocationProjectID string) *CreateParams { + o.SetClusterLocationProjectID(clusterLocationProjectID) + return o +} + +// SetClusterLocationProjectID adds the clusterLocationProjectId to the create params +func (o *CreateParams) SetClusterLocationProjectID(clusterLocationProjectID string) { + o.ClusterLocationProjectID = clusterLocationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster.location.organization_id + if err := r.SetPathParam("cluster.location.organization_id", o.ClusterLocationOrganizationID); err != nil { + return err + } + + // path param cluster.location.project_id + if err := r.SetPathParam("cluster.location.project_id", o.ClusterLocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_responses.go new file mode 100644 index 00000000..3dca4c56 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// CreateReader is a Reader for the Create structure. +type CreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewCreateOK creates a CreateOK with default headers values +func NewCreateOK() *CreateOK { + return &CreateOK{} +} + +/*CreateOK handles this case with default header values. + +A successful response. +*/ +type CreateOK struct { + Payload *models.HashicorpCloudConsul20210204CreateResponse +} + +func (o *CreateOK) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters][%d] createOK %+v", 200, o.Payload) +} + +func (o *CreateOK) GetPayload() *models.HashicorpCloudConsul20210204CreateResponse { + return o.Payload +} + +func (o *CreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204CreateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateDefault creates a CreateDefault with default headers values +func NewCreateDefault(code int) *CreateDefault { + return &CreateDefault{ + _statusCode: code, + } +} + +/*CreateDefault handles this case with default header values. + +An unexpected error response. +*/ +type CreateDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the create default response +func (o *CreateDefault) Code() int { + return o._statusCode +} + +func (o *CreateDefault) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters][%d] Create default %+v", o._statusCode, o.Payload) +} + +func (o *CreateDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *CreateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_snapshot_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_snapshot_parameters.go new file mode 100644 index 00000000..333e458a --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_snapshot_parameters.go @@ -0,0 +1,177 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// NewCreateSnapshotParams creates a new CreateSnapshotParams object +// with the default values initialized. +func NewCreateSnapshotParams() *CreateSnapshotParams { + var () + return &CreateSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateSnapshotParamsWithTimeout creates a new CreateSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateSnapshotParamsWithTimeout(timeout time.Duration) *CreateSnapshotParams { + var () + return &CreateSnapshotParams{ + + timeout: timeout, + } +} + +// NewCreateSnapshotParamsWithContext creates a new CreateSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateSnapshotParamsWithContext(ctx context.Context) *CreateSnapshotParams { + var () + return &CreateSnapshotParams{ + + Context: ctx, + } +} + +// NewCreateSnapshotParamsWithHTTPClient creates a new CreateSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateSnapshotParamsWithHTTPClient(client *http.Client) *CreateSnapshotParams { + var () + return &CreateSnapshotParams{ + HTTPClient: client, + } +} + +/*CreateSnapshotParams contains all the parameters to send to the API endpoint +for the create snapshot operation typically these are written to a http.Request +*/ +type CreateSnapshotParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20210204CreateSnapshotRequest + /*ResourceLocationOrganizationID + organization_id is the id of the organization. + + */ + ResourceLocationOrganizationID string + /*ResourceLocationProjectID + project_id is the projects id. + + */ + ResourceLocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create snapshot params +func (o *CreateSnapshotParams) WithTimeout(timeout time.Duration) *CreateSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create snapshot params +func (o *CreateSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create snapshot params +func (o *CreateSnapshotParams) WithContext(ctx context.Context) *CreateSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create snapshot params +func (o *CreateSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create snapshot params +func (o *CreateSnapshotParams) WithHTTPClient(client *http.Client) *CreateSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create snapshot params +func (o *CreateSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create snapshot params +func (o *CreateSnapshotParams) WithBody(body *models.HashicorpCloudConsul20210204CreateSnapshotRequest) *CreateSnapshotParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create snapshot params +func (o *CreateSnapshotParams) SetBody(body *models.HashicorpCloudConsul20210204CreateSnapshotRequest) { + o.Body = body +} + +// WithResourceLocationOrganizationID adds the resourceLocationOrganizationID to the create snapshot params +func (o *CreateSnapshotParams) WithResourceLocationOrganizationID(resourceLocationOrganizationID string) *CreateSnapshotParams { + o.SetResourceLocationOrganizationID(resourceLocationOrganizationID) + return o +} + +// SetResourceLocationOrganizationID adds the resourceLocationOrganizationId to the create snapshot params +func (o *CreateSnapshotParams) SetResourceLocationOrganizationID(resourceLocationOrganizationID string) { + o.ResourceLocationOrganizationID = resourceLocationOrganizationID +} + +// WithResourceLocationProjectID adds the resourceLocationProjectID to the create snapshot params +func (o *CreateSnapshotParams) WithResourceLocationProjectID(resourceLocationProjectID string) *CreateSnapshotParams { + o.SetResourceLocationProjectID(resourceLocationProjectID) + return o +} + +// SetResourceLocationProjectID adds the resourceLocationProjectId to the create snapshot params +func (o *CreateSnapshotParams) SetResourceLocationProjectID(resourceLocationProjectID string) { + o.ResourceLocationProjectID = resourceLocationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param resource.location.organization_id + if err := r.SetPathParam("resource.location.organization_id", o.ResourceLocationOrganizationID); err != nil { + return err + } + + // path param resource.location.project_id + if err := r.SetPathParam("resource.location.project_id", o.ResourceLocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_snapshot_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_snapshot_responses.go new file mode 100644 index 00000000..602f8f94 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/create_snapshot_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// CreateSnapshotReader is a Reader for the CreateSnapshot structure. +type CreateSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateSnapshotDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewCreateSnapshotOK creates a CreateSnapshotOK with default headers values +func NewCreateSnapshotOK() *CreateSnapshotOK { + return &CreateSnapshotOK{} +} + +/*CreateSnapshotOK handles this case with default header values. + +A successful response. +*/ +type CreateSnapshotOK struct { + Payload *models.HashicorpCloudConsul20210204CreateSnapshotResponse +} + +func (o *CreateSnapshotOK) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] createSnapshotOK %+v", 200, o.Payload) +} + +func (o *CreateSnapshotOK) GetPayload() *models.HashicorpCloudConsul20210204CreateSnapshotResponse { + return o.Payload +} + +func (o *CreateSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204CreateSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateSnapshotDefault creates a CreateSnapshotDefault with default headers values +func NewCreateSnapshotDefault(code int) *CreateSnapshotDefault { + return &CreateSnapshotDefault{ + _statusCode: code, + } +} + +/*CreateSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type CreateSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the create snapshot default response +func (o *CreateSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *CreateSnapshotDefault) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] CreateSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *CreateSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *CreateSnapshotDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_parameters.go new file mode 100644 index 00000000..d5bec239 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_parameters.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeleteParams creates a new DeleteParams object +// with the default values initialized. +func NewDeleteParams() *DeleteParams { + var () + return &DeleteParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteParamsWithTimeout creates a new DeleteParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteParamsWithTimeout(timeout time.Duration) *DeleteParams { + var () + return &DeleteParams{ + + timeout: timeout, + } +} + +// NewDeleteParamsWithContext creates a new DeleteParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteParamsWithContext(ctx context.Context) *DeleteParams { + var () + return &DeleteParams{ + + Context: ctx, + } +} + +// NewDeleteParamsWithHTTPClient creates a new DeleteParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteParamsWithHTTPClient(client *http.Client) *DeleteParams { + var () + return &DeleteParams{ + HTTPClient: client, + } +} + +/*DeleteParams contains all the parameters to send to the API endpoint +for the delete operation typically these are written to a http.Request +*/ +type DeleteParams struct { + + /*ID + id is the unique ID of the HCC cluster to get + + */ + ID string + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete params +func (o *DeleteParams) WithTimeout(timeout time.Duration) *DeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete params +func (o *DeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete params +func (o *DeleteParams) WithContext(ctx context.Context) *DeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete params +func (o *DeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete params +func (o *DeleteParams) WithHTTPClient(client *http.Client) *DeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete params +func (o *DeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete params +func (o *DeleteParams) WithID(id string) *DeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete params +func (o *DeleteParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the delete params +func (o *DeleteParams) WithLocationOrganizationID(locationOrganizationID string) *DeleteParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the delete params +func (o *DeleteParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the delete params +func (o *DeleteParams) WithLocationProjectID(locationProjectID string) *DeleteParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the delete params +func (o *DeleteParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the delete params +func (o *DeleteParams) WithLocationRegionProvider(locationRegionProvider *string) *DeleteParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the delete params +func (o *DeleteParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the delete params +func (o *DeleteParams) WithLocationRegionRegion(locationRegionRegion *string) *DeleteParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the delete params +func (o *DeleteParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_responses.go new file mode 100644 index 00000000..14d2448a --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// DeleteReader is a Reader for the Delete structure. +type DeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeleteDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeleteOK creates a DeleteOK with default headers values +func NewDeleteOK() *DeleteOK { + return &DeleteOK{} +} + +/*DeleteOK handles this case with default header values. + +A successful response. +*/ +type DeleteOK struct { + Payload *models.HashicorpCloudConsul20210204DeleteResponse +} + +func (o *DeleteOK) Error() string { + return fmt.Sprintf("[DELETE /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] deleteOK %+v", 200, o.Payload) +} + +func (o *DeleteOK) GetPayload() *models.HashicorpCloudConsul20210204DeleteResponse { + return o.Payload +} + +func (o *DeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204DeleteResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteDefault creates a DeleteDefault with default headers values +func NewDeleteDefault(code int) *DeleteDefault { + return &DeleteDefault{ + _statusCode: code, + } +} + +/*DeleteDefault handles this case with default header values. + +An unexpected error response. +*/ +type DeleteDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the delete default response +func (o *DeleteDefault) Code() int { + return o._statusCode +} + +func (o *DeleteDefault) Error() string { + return fmt.Sprintf("[DELETE /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] Delete default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *DeleteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_snapshot_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_snapshot_parameters.go new file mode 100644 index 00000000..d95a6f57 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_snapshot_parameters.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeleteSnapshotParams creates a new DeleteSnapshotParams object +// with the default values initialized. +func NewDeleteSnapshotParams() *DeleteSnapshotParams { + var () + return &DeleteSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteSnapshotParamsWithTimeout creates a new DeleteSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteSnapshotParamsWithTimeout(timeout time.Duration) *DeleteSnapshotParams { + var () + return &DeleteSnapshotParams{ + + timeout: timeout, + } +} + +// NewDeleteSnapshotParamsWithContext creates a new DeleteSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteSnapshotParamsWithContext(ctx context.Context) *DeleteSnapshotParams { + var () + return &DeleteSnapshotParams{ + + Context: ctx, + } +} + +// NewDeleteSnapshotParamsWithHTTPClient creates a new DeleteSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteSnapshotParamsWithHTTPClient(client *http.Client) *DeleteSnapshotParams { + var () + return &DeleteSnapshotParams{ + HTTPClient: client, + } +} + +/*DeleteSnapshotParams contains all the parameters to send to the API endpoint +for the delete snapshot operation typically these are written to a http.Request +*/ +type DeleteSnapshotParams struct { + + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + /*SnapshotID + snapshot_id represents the snapshot to delete. + + */ + SnapshotID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete snapshot params +func (o *DeleteSnapshotParams) WithTimeout(timeout time.Duration) *DeleteSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete snapshot params +func (o *DeleteSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete snapshot params +func (o *DeleteSnapshotParams) WithContext(ctx context.Context) *DeleteSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete snapshot params +func (o *DeleteSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete snapshot params +func (o *DeleteSnapshotParams) WithHTTPClient(client *http.Client) *DeleteSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete snapshot params +func (o *DeleteSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLocationOrganizationID adds the locationOrganizationID to the delete snapshot params +func (o *DeleteSnapshotParams) WithLocationOrganizationID(locationOrganizationID string) *DeleteSnapshotParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the delete snapshot params +func (o *DeleteSnapshotParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the delete snapshot params +func (o *DeleteSnapshotParams) WithLocationProjectID(locationProjectID string) *DeleteSnapshotParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the delete snapshot params +func (o *DeleteSnapshotParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the delete snapshot params +func (o *DeleteSnapshotParams) WithLocationRegionProvider(locationRegionProvider *string) *DeleteSnapshotParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the delete snapshot params +func (o *DeleteSnapshotParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the delete snapshot params +func (o *DeleteSnapshotParams) WithLocationRegionRegion(locationRegionRegion *string) *DeleteSnapshotParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the delete snapshot params +func (o *DeleteSnapshotParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WithSnapshotID adds the snapshotID to the delete snapshot params +func (o *DeleteSnapshotParams) WithSnapshotID(snapshotID string) *DeleteSnapshotParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the delete snapshot params +func (o *DeleteSnapshotParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + // path param snapshot_id + if err := r.SetPathParam("snapshot_id", o.SnapshotID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_snapshot_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_snapshot_responses.go new file mode 100644 index 00000000..76bf97b6 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/delete_snapshot_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// DeleteSnapshotReader is a Reader for the DeleteSnapshot structure. +type DeleteSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeleteSnapshotDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeleteSnapshotOK creates a DeleteSnapshotOK with default headers values +func NewDeleteSnapshotOK() *DeleteSnapshotOK { + return &DeleteSnapshotOK{} +} + +/*DeleteSnapshotOK handles this case with default header values. + +A successful response. +*/ +type DeleteSnapshotOK struct { + Payload *models.HashicorpCloudConsul20210204DeleteSnapshotResponse +} + +func (o *DeleteSnapshotOK) Error() string { + return fmt.Sprintf("[DELETE /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] deleteSnapshotOK %+v", 200, o.Payload) +} + +func (o *DeleteSnapshotOK) GetPayload() *models.HashicorpCloudConsul20210204DeleteSnapshotResponse { + return o.Payload +} + +func (o *DeleteSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204DeleteSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteSnapshotDefault creates a DeleteSnapshotDefault with default headers values +func NewDeleteSnapshotDefault(code int) *DeleteSnapshotDefault { + return &DeleteSnapshotDefault{ + _statusCode: code, + } +} + +/*DeleteSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type DeleteSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the delete snapshot default response +func (o *DeleteSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *DeleteSnapshotDefault) Error() string { + return fmt.Sprintf("[DELETE /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] DeleteSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *DeleteSnapshotDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_client_config_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_client_config_parameters.go new file mode 100644 index 00000000..64301b47 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_client_config_parameters.go @@ -0,0 +1,274 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewGetClientConfigParams creates a new GetClientConfigParams object +// with the default values initialized. +func NewGetClientConfigParams() *GetClientConfigParams { + var () + return &GetClientConfigParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetClientConfigParamsWithTimeout creates a new GetClientConfigParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetClientConfigParamsWithTimeout(timeout time.Duration) *GetClientConfigParams { + var () + return &GetClientConfigParams{ + + timeout: timeout, + } +} + +// NewGetClientConfigParamsWithContext creates a new GetClientConfigParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetClientConfigParamsWithContext(ctx context.Context) *GetClientConfigParams { + var () + return &GetClientConfigParams{ + + Context: ctx, + } +} + +// NewGetClientConfigParamsWithHTTPClient creates a new GetClientConfigParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetClientConfigParamsWithHTTPClient(client *http.Client) *GetClientConfigParams { + var () + return &GetClientConfigParams{ + HTTPClient: client, + } +} + +/*GetClientConfigParams contains all the parameters to send to the API endpoint +for the get client config operation typically these are written to a http.Request +*/ +type GetClientConfigParams struct { + + /*Bundle + bundle asks the service to respond with a file bundle as a zip archive. + + */ + Bundle *bool + /*ID + id is the unique ID of the HCP Consul cluster to get + + */ + ID string + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get client config params +func (o *GetClientConfigParams) WithTimeout(timeout time.Duration) *GetClientConfigParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get client config params +func (o *GetClientConfigParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get client config params +func (o *GetClientConfigParams) WithContext(ctx context.Context) *GetClientConfigParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get client config params +func (o *GetClientConfigParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get client config params +func (o *GetClientConfigParams) WithHTTPClient(client *http.Client) *GetClientConfigParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get client config params +func (o *GetClientConfigParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBundle adds the bundle to the get client config params +func (o *GetClientConfigParams) WithBundle(bundle *bool) *GetClientConfigParams { + o.SetBundle(bundle) + return o +} + +// SetBundle adds the bundle to the get client config params +func (o *GetClientConfigParams) SetBundle(bundle *bool) { + o.Bundle = bundle +} + +// WithID adds the id to the get client config params +func (o *GetClientConfigParams) WithID(id string) *GetClientConfigParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get client config params +func (o *GetClientConfigParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the get client config params +func (o *GetClientConfigParams) WithLocationOrganizationID(locationOrganizationID string) *GetClientConfigParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the get client config params +func (o *GetClientConfigParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the get client config params +func (o *GetClientConfigParams) WithLocationProjectID(locationProjectID string) *GetClientConfigParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the get client config params +func (o *GetClientConfigParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the get client config params +func (o *GetClientConfigParams) WithLocationRegionProvider(locationRegionProvider *string) *GetClientConfigParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the get client config params +func (o *GetClientConfigParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the get client config params +func (o *GetClientConfigParams) WithLocationRegionRegion(locationRegionRegion *string) *GetClientConfigParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the get client config params +func (o *GetClientConfigParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *GetClientConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Bundle != nil { + + // query param bundle + var qrBundle bool + if o.Bundle != nil { + qrBundle = *o.Bundle + } + qBundle := swag.FormatBool(qrBundle) + if qBundle != "" { + if err := r.SetQueryParam("bundle", qBundle); err != nil { + return err + } + } + + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_client_config_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_client_config_responses.go new file mode 100644 index 00000000..40621eb1 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_client_config_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// GetClientConfigReader is a Reader for the GetClientConfig structure. +type GetClientConfigReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetClientConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetClientConfigOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetClientConfigDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetClientConfigOK creates a GetClientConfigOK with default headers values +func NewGetClientConfigOK() *GetClientConfigOK { + return &GetClientConfigOK{} +} + +/*GetClientConfigOK handles this case with default header values. + +A successful response. +*/ +type GetClientConfigOK struct { + Payload *models.HashicorpCloudConsul20210204GetClientConfigResponse +} + +func (o *GetClientConfigOK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/client-config][%d] getClientConfigOK %+v", 200, o.Payload) +} + +func (o *GetClientConfigOK) GetPayload() *models.HashicorpCloudConsul20210204GetClientConfigResponse { + return o.Payload +} + +func (o *GetClientConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204GetClientConfigResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetClientConfigDefault creates a GetClientConfigDefault with default headers values +func NewGetClientConfigDefault(code int) *GetClientConfigDefault { + return &GetClientConfigDefault{ + _statusCode: code, + } +} + +/*GetClientConfigDefault handles this case with default header values. + +An unexpected error response. +*/ +type GetClientConfigDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the get client config default response +func (o *GetClientConfigDefault) Code() int { + return o._statusCode +} + +func (o *GetClientConfigDefault) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/client-config][%d] GetClientConfig default %+v", o._statusCode, o.Payload) +} + +func (o *GetClientConfigDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *GetClientConfigDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_parameters.go new file mode 100644 index 00000000..c1b05854 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_parameters.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetParams creates a new GetParams object +// with the default values initialized. +func NewGetParams() *GetParams { + var () + return &GetParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetParamsWithTimeout creates a new GetParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetParamsWithTimeout(timeout time.Duration) *GetParams { + var () + return &GetParams{ + + timeout: timeout, + } +} + +// NewGetParamsWithContext creates a new GetParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetParamsWithContext(ctx context.Context) *GetParams { + var () + return &GetParams{ + + Context: ctx, + } +} + +// NewGetParamsWithHTTPClient creates a new GetParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetParamsWithHTTPClient(client *http.Client) *GetParams { + var () + return &GetParams{ + HTTPClient: client, + } +} + +/*GetParams contains all the parameters to send to the API endpoint +for the get operation typically these are written to a http.Request +*/ +type GetParams struct { + + /*ID + id is the unique ID of the HCC cluster to get + + */ + ID string + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get params +func (o *GetParams) WithTimeout(timeout time.Duration) *GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get params +func (o *GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get params +func (o *GetParams) WithContext(ctx context.Context) *GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get params +func (o *GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get params +func (o *GetParams) WithHTTPClient(client *http.Client) *GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get params +func (o *GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get params +func (o *GetParams) WithID(id string) *GetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get params +func (o *GetParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the get params +func (o *GetParams) WithLocationOrganizationID(locationOrganizationID string) *GetParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the get params +func (o *GetParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the get params +func (o *GetParams) WithLocationProjectID(locationProjectID string) *GetParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the get params +func (o *GetParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the get params +func (o *GetParams) WithLocationRegionProvider(locationRegionProvider *string) *GetParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the get params +func (o *GetParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the get params +func (o *GetParams) WithLocationRegionRegion(locationRegionRegion *string) *GetParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the get params +func (o *GetParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_responses.go new file mode 100644 index 00000000..e4616302 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// GetReader is a Reader for the Get structure. +type GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetOK creates a GetOK with default headers values +func NewGetOK() *GetOK { + return &GetOK{} +} + +/*GetOK handles this case with default header values. + +A successful response. +*/ +type GetOK struct { + Payload *models.HashicorpCloudConsul20210204GetResponse +} + +func (o *GetOK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] getOK %+v", 200, o.Payload) +} + +func (o *GetOK) GetPayload() *models.HashicorpCloudConsul20210204GetResponse { + return o.Payload +} + +func (o *GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204GetResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetDefault creates a GetDefault with default headers values +func NewGetDefault(code int) *GetDefault { + return &GetDefault{ + _statusCode: code, + } +} + +/*GetDefault handles this case with default header values. + +An unexpected error response. +*/ +type GetDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the get default response +func (o *GetDefault) Code() int { + return o._statusCode +} + +func (o *GetDefault) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] Get default %+v", o._statusCode, o.Payload) +} + +func (o *GetDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *GetDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_snapshot_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_snapshot_parameters.go new file mode 100644 index 00000000..e64091cb --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_snapshot_parameters.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetSnapshotParams creates a new GetSnapshotParams object +// with the default values initialized. +func NewGetSnapshotParams() *GetSnapshotParams { + var () + return &GetSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetSnapshotParamsWithTimeout creates a new GetSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetSnapshotParamsWithTimeout(timeout time.Duration) *GetSnapshotParams { + var () + return &GetSnapshotParams{ + + timeout: timeout, + } +} + +// NewGetSnapshotParamsWithContext creates a new GetSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetSnapshotParamsWithContext(ctx context.Context) *GetSnapshotParams { + var () + return &GetSnapshotParams{ + + Context: ctx, + } +} + +// NewGetSnapshotParamsWithHTTPClient creates a new GetSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetSnapshotParamsWithHTTPClient(client *http.Client) *GetSnapshotParams { + var () + return &GetSnapshotParams{ + HTTPClient: client, + } +} + +/*GetSnapshotParams contains all the parameters to send to the API endpoint +for the get snapshot operation typically these are written to a http.Request +*/ +type GetSnapshotParams struct { + + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + /*SnapshotID + snapshot_id represents the snapshot to get. + + */ + SnapshotID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get snapshot params +func (o *GetSnapshotParams) WithTimeout(timeout time.Duration) *GetSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get snapshot params +func (o *GetSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get snapshot params +func (o *GetSnapshotParams) WithContext(ctx context.Context) *GetSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get snapshot params +func (o *GetSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get snapshot params +func (o *GetSnapshotParams) WithHTTPClient(client *http.Client) *GetSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get snapshot params +func (o *GetSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLocationOrganizationID adds the locationOrganizationID to the get snapshot params +func (o *GetSnapshotParams) WithLocationOrganizationID(locationOrganizationID string) *GetSnapshotParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the get snapshot params +func (o *GetSnapshotParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the get snapshot params +func (o *GetSnapshotParams) WithLocationProjectID(locationProjectID string) *GetSnapshotParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the get snapshot params +func (o *GetSnapshotParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the get snapshot params +func (o *GetSnapshotParams) WithLocationRegionProvider(locationRegionProvider *string) *GetSnapshotParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the get snapshot params +func (o *GetSnapshotParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the get snapshot params +func (o *GetSnapshotParams) WithLocationRegionRegion(locationRegionRegion *string) *GetSnapshotParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the get snapshot params +func (o *GetSnapshotParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WithSnapshotID adds the snapshotID to the get snapshot params +func (o *GetSnapshotParams) WithSnapshotID(snapshotID string) *GetSnapshotParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the get snapshot params +func (o *GetSnapshotParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + // path param snapshot_id + if err := r.SetPathParam("snapshot_id", o.SnapshotID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_snapshot_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_snapshot_responses.go new file mode 100644 index 00000000..a4843818 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/get_snapshot_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// GetSnapshotReader is a Reader for the GetSnapshot structure. +type GetSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetSnapshotDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetSnapshotOK creates a GetSnapshotOK with default headers values +func NewGetSnapshotOK() *GetSnapshotOK { + return &GetSnapshotOK{} +} + +/*GetSnapshotOK handles this case with default header values. + +A successful response. +*/ +type GetSnapshotOK struct { + Payload *models.HashicorpCloudConsul20210204GetSnapshotResponse +} + +func (o *GetSnapshotOK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] getSnapshotOK %+v", 200, o.Payload) +} + +func (o *GetSnapshotOK) GetPayload() *models.HashicorpCloudConsul20210204GetSnapshotResponse { + return o.Payload +} + +func (o *GetSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204GetSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetSnapshotDefault creates a GetSnapshotDefault with default headers values +func NewGetSnapshotDefault(code int) *GetSnapshotDefault { + return &GetSnapshotDefault{ + _statusCode: code, + } +} + +/*GetSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type GetSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the get snapshot default response +func (o *GetSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *GetSnapshotDefault) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] GetSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *GetSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *GetSnapshotDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_parameters.go new file mode 100644 index 00000000..686caf45 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_parameters.go @@ -0,0 +1,324 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListParams creates a new ListParams object +// with the default values initialized. +func NewListParams() *ListParams { + var () + return &ListParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListParamsWithTimeout creates a new ListParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewListParamsWithTimeout(timeout time.Duration) *ListParams { + var () + return &ListParams{ + + timeout: timeout, + } +} + +// NewListParamsWithContext creates a new ListParams object +// with the default values initialized, and the ability to set a context for a request +func NewListParamsWithContext(ctx context.Context) *ListParams { + var () + return &ListParams{ + + Context: ctx, + } +} + +// NewListParamsWithHTTPClient creates a new ListParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListParamsWithHTTPClient(client *http.Client) *ListParams { + var () + return &ListParams{ + HTTPClient: client, + } +} + +/*ListParams contains all the parameters to send to the API endpoint +for the list operation typically these are written to a http.Request +*/ +type ListParams struct { + + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + /*PaginationNextPageToken + Specifies a page token to use to retrieve the next page. Set this to the + `next_page_token` returned by previous list requests to get the next page of + results. If set, `previous_page_token` must not be set. + + */ + PaginationNextPageToken *string + /*PaginationPageSize + The max number of results per page that should be returned. If the number + of available results is larger than `page_size`, a `next_page_token` is + returned which can be used to get the next page of results in subsequent + requests. A value of zero will cause `page_size` to be defaulted. + + */ + PaginationPageSize *int64 + /*PaginationPreviousPageToken + Specifies a page token to use to retrieve the previous page. Set this to + the `previous_page_token` returned by previous list requests to get the + previous page of results. If set, `next_page_token` must not be set. + + */ + PaginationPreviousPageToken *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list params +func (o *ListParams) WithTimeout(timeout time.Duration) *ListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list params +func (o *ListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list params +func (o *ListParams) WithContext(ctx context.Context) *ListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list params +func (o *ListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list params +func (o *ListParams) WithHTTPClient(client *http.Client) *ListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list params +func (o *ListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLocationOrganizationID adds the locationOrganizationID to the list params +func (o *ListParams) WithLocationOrganizationID(locationOrganizationID string) *ListParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the list params +func (o *ListParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the list params +func (o *ListParams) WithLocationProjectID(locationProjectID string) *ListParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the list params +func (o *ListParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the list params +func (o *ListParams) WithLocationRegionProvider(locationRegionProvider *string) *ListParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the list params +func (o *ListParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the list params +func (o *ListParams) WithLocationRegionRegion(locationRegionRegion *string) *ListParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the list params +func (o *ListParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WithPaginationNextPageToken adds the paginationNextPageToken to the list params +func (o *ListParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListParams { + o.SetPaginationNextPageToken(paginationNextPageToken) + return o +} + +// SetPaginationNextPageToken adds the paginationNextPageToken to the list params +func (o *ListParams) SetPaginationNextPageToken(paginationNextPageToken *string) { + o.PaginationNextPageToken = paginationNextPageToken +} + +// WithPaginationPageSize adds the paginationPageSize to the list params +func (o *ListParams) WithPaginationPageSize(paginationPageSize *int64) *ListParams { + o.SetPaginationPageSize(paginationPageSize) + return o +} + +// SetPaginationPageSize adds the paginationPageSize to the list params +func (o *ListParams) SetPaginationPageSize(paginationPageSize *int64) { + o.PaginationPageSize = paginationPageSize +} + +// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list params +func (o *ListParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListParams { + o.SetPaginationPreviousPageToken(paginationPreviousPageToken) + return o +} + +// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list params +func (o *ListParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { + o.PaginationPreviousPageToken = paginationPreviousPageToken +} + +// WriteToRequest writes these params to a swagger request +func (o *ListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + if o.PaginationNextPageToken != nil { + + // query param pagination.next_page_token + var qrPaginationNextPageToken string + if o.PaginationNextPageToken != nil { + qrPaginationNextPageToken = *o.PaginationNextPageToken + } + qPaginationNextPageToken := qrPaginationNextPageToken + if qPaginationNextPageToken != "" { + if err := r.SetQueryParam("pagination.next_page_token", qPaginationNextPageToken); err != nil { + return err + } + } + + } + + if o.PaginationPageSize != nil { + + // query param pagination.page_size + var qrPaginationPageSize int64 + if o.PaginationPageSize != nil { + qrPaginationPageSize = *o.PaginationPageSize + } + qPaginationPageSize := swag.FormatInt64(qrPaginationPageSize) + if qPaginationPageSize != "" { + if err := r.SetQueryParam("pagination.page_size", qPaginationPageSize); err != nil { + return err + } + } + + } + + if o.PaginationPreviousPageToken != nil { + + // query param pagination.previous_page_token + var qrPaginationPreviousPageToken string + if o.PaginationPreviousPageToken != nil { + qrPaginationPreviousPageToken = *o.PaginationPreviousPageToken + } + qPaginationPreviousPageToken := qrPaginationPreviousPageToken + if qPaginationPreviousPageToken != "" { + if err := r.SetQueryParam("pagination.previous_page_token", qPaginationPreviousPageToken); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_responses.go new file mode 100644 index 00000000..20156181 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// ListReader is a Reader for the List structure. +type ListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListOK creates a ListOK with default headers values +func NewListOK() *ListOK { + return &ListOK{} +} + +/*ListOK handles this case with default header values. + +A successful response. +*/ +type ListOK struct { + Payload *models.HashicorpCloudConsul20210204ListResponse +} + +func (o *ListOK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters][%d] listOK %+v", 200, o.Payload) +} + +func (o *ListOK) GetPayload() *models.HashicorpCloudConsul20210204ListResponse { + return o.Payload +} + +func (o *ListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204ListResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListDefault creates a ListDefault with default headers values +func NewListDefault(code int) *ListDefault { + return &ListDefault{ + _statusCode: code, + } +} + +/*ListDefault handles this case with default header values. + +An unexpected error response. +*/ +type ListDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the list default response +func (o *ListDefault) Code() int { + return o._statusCode +} + +func (o *ListDefault) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters][%d] List default %+v", o._statusCode, o.Payload) +} + +func (o *ListDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ListDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_snapshots_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_snapshots_parameters.go new file mode 100644 index 00000000..876cc4a4 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_snapshots_parameters.go @@ -0,0 +1,456 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListSnapshotsParams creates a new ListSnapshotsParams object +// with the default values initialized. +func NewListSnapshotsParams() *ListSnapshotsParams { + var () + return &ListSnapshotsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListSnapshotsParamsWithTimeout creates a new ListSnapshotsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewListSnapshotsParamsWithTimeout(timeout time.Duration) *ListSnapshotsParams { + var () + return &ListSnapshotsParams{ + + timeout: timeout, + } +} + +// NewListSnapshotsParamsWithContext creates a new ListSnapshotsParams object +// with the default values initialized, and the ability to set a context for a request +func NewListSnapshotsParamsWithContext(ctx context.Context) *ListSnapshotsParams { + var () + return &ListSnapshotsParams{ + + Context: ctx, + } +} + +// NewListSnapshotsParamsWithHTTPClient creates a new ListSnapshotsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListSnapshotsParamsWithHTTPClient(client *http.Client) *ListSnapshotsParams { + var () + return &ListSnapshotsParams{ + HTTPClient: client, + } +} + +/*ListSnapshotsParams contains all the parameters to send to the API endpoint +for the list snapshots operation typically these are written to a http.Request +*/ +type ListSnapshotsParams struct { + + /*PaginationNextPageToken + Specifies a page token to use to retrieve the next page. Set this to the + `next_page_token` returned by previous list requests to get the next page of + results. If set, `previous_page_token` must not be set. + + */ + PaginationNextPageToken *string + /*PaginationPageSize + The max number of results per page that should be returned. If the number + of available results is larger than `page_size`, a `next_page_token` is + returned which can be used to get the next page of results in subsequent + requests. A value of zero will cause `page_size` to be defaulted. + + */ + PaginationPageSize *int64 + /*PaginationPreviousPageToken + Specifies a page token to use to retrieve the previous page. Set this to + the `previous_page_token` returned by previous list requests to get the + previous page of results. If set, `next_page_token` must not be set. + + */ + PaginationPreviousPageToken *string + /*ResourceDescription + description is a human-friendly description for this link. This is + used primarily for informational purposes such as error messages. + + */ + ResourceDescription *string + /*ResourceID + id is the identifier for this resource. + + */ + ResourceID *string + /*ResourceLocationOrganizationID + organization_id is the id of the organization. + + */ + ResourceLocationOrganizationID string + /*ResourceLocationProjectID + project_id is the projects id. + + */ + ResourceLocationProjectID string + /*ResourceLocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + ResourceLocationRegionProvider *string + /*ResourceLocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + ResourceLocationRegionRegion *string + /*ResourceType + type is the unique type of the resource. Each service publishes a + unique set of types. The type value is recommended to be formatted + in "." such as "hashicorp.hvn". This is to prevent conflicts + in the future, but any string value will work. + + */ + ResourceType *string + /*ResourceUUID + uuid is the unique UUID for this resource. + + */ + ResourceUUID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list snapshots params +func (o *ListSnapshotsParams) WithTimeout(timeout time.Duration) *ListSnapshotsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list snapshots params +func (o *ListSnapshotsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list snapshots params +func (o *ListSnapshotsParams) WithContext(ctx context.Context) *ListSnapshotsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list snapshots params +func (o *ListSnapshotsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list snapshots params +func (o *ListSnapshotsParams) WithHTTPClient(client *http.Client) *ListSnapshotsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list snapshots params +func (o *ListSnapshotsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPaginationNextPageToken adds the paginationNextPageToken to the list snapshots params +func (o *ListSnapshotsParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListSnapshotsParams { + o.SetPaginationNextPageToken(paginationNextPageToken) + return o +} + +// SetPaginationNextPageToken adds the paginationNextPageToken to the list snapshots params +func (o *ListSnapshotsParams) SetPaginationNextPageToken(paginationNextPageToken *string) { + o.PaginationNextPageToken = paginationNextPageToken +} + +// WithPaginationPageSize adds the paginationPageSize to the list snapshots params +func (o *ListSnapshotsParams) WithPaginationPageSize(paginationPageSize *int64) *ListSnapshotsParams { + o.SetPaginationPageSize(paginationPageSize) + return o +} + +// SetPaginationPageSize adds the paginationPageSize to the list snapshots params +func (o *ListSnapshotsParams) SetPaginationPageSize(paginationPageSize *int64) { + o.PaginationPageSize = paginationPageSize +} + +// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list snapshots params +func (o *ListSnapshotsParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListSnapshotsParams { + o.SetPaginationPreviousPageToken(paginationPreviousPageToken) + return o +} + +// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list snapshots params +func (o *ListSnapshotsParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { + o.PaginationPreviousPageToken = paginationPreviousPageToken +} + +// WithResourceDescription adds the resourceDescription to the list snapshots params +func (o *ListSnapshotsParams) WithResourceDescription(resourceDescription *string) *ListSnapshotsParams { + o.SetResourceDescription(resourceDescription) + return o +} + +// SetResourceDescription adds the resourceDescription to the list snapshots params +func (o *ListSnapshotsParams) SetResourceDescription(resourceDescription *string) { + o.ResourceDescription = resourceDescription +} + +// WithResourceID adds the resourceID to the list snapshots params +func (o *ListSnapshotsParams) WithResourceID(resourceID *string) *ListSnapshotsParams { + o.SetResourceID(resourceID) + return o +} + +// SetResourceID adds the resourceId to the list snapshots params +func (o *ListSnapshotsParams) SetResourceID(resourceID *string) { + o.ResourceID = resourceID +} + +// WithResourceLocationOrganizationID adds the resourceLocationOrganizationID to the list snapshots params +func (o *ListSnapshotsParams) WithResourceLocationOrganizationID(resourceLocationOrganizationID string) *ListSnapshotsParams { + o.SetResourceLocationOrganizationID(resourceLocationOrganizationID) + return o +} + +// SetResourceLocationOrganizationID adds the resourceLocationOrganizationId to the list snapshots params +func (o *ListSnapshotsParams) SetResourceLocationOrganizationID(resourceLocationOrganizationID string) { + o.ResourceLocationOrganizationID = resourceLocationOrganizationID +} + +// WithResourceLocationProjectID adds the resourceLocationProjectID to the list snapshots params +func (o *ListSnapshotsParams) WithResourceLocationProjectID(resourceLocationProjectID string) *ListSnapshotsParams { + o.SetResourceLocationProjectID(resourceLocationProjectID) + return o +} + +// SetResourceLocationProjectID adds the resourceLocationProjectId to the list snapshots params +func (o *ListSnapshotsParams) SetResourceLocationProjectID(resourceLocationProjectID string) { + o.ResourceLocationProjectID = resourceLocationProjectID +} + +// WithResourceLocationRegionProvider adds the resourceLocationRegionProvider to the list snapshots params +func (o *ListSnapshotsParams) WithResourceLocationRegionProvider(resourceLocationRegionProvider *string) *ListSnapshotsParams { + o.SetResourceLocationRegionProvider(resourceLocationRegionProvider) + return o +} + +// SetResourceLocationRegionProvider adds the resourceLocationRegionProvider to the list snapshots params +func (o *ListSnapshotsParams) SetResourceLocationRegionProvider(resourceLocationRegionProvider *string) { + o.ResourceLocationRegionProvider = resourceLocationRegionProvider +} + +// WithResourceLocationRegionRegion adds the resourceLocationRegionRegion to the list snapshots params +func (o *ListSnapshotsParams) WithResourceLocationRegionRegion(resourceLocationRegionRegion *string) *ListSnapshotsParams { + o.SetResourceLocationRegionRegion(resourceLocationRegionRegion) + return o +} + +// SetResourceLocationRegionRegion adds the resourceLocationRegionRegion to the list snapshots params +func (o *ListSnapshotsParams) SetResourceLocationRegionRegion(resourceLocationRegionRegion *string) { + o.ResourceLocationRegionRegion = resourceLocationRegionRegion +} + +// WithResourceType adds the resourceType to the list snapshots params +func (o *ListSnapshotsParams) WithResourceType(resourceType *string) *ListSnapshotsParams { + o.SetResourceType(resourceType) + return o +} + +// SetResourceType adds the resourceType to the list snapshots params +func (o *ListSnapshotsParams) SetResourceType(resourceType *string) { + o.ResourceType = resourceType +} + +// WithResourceUUID adds the resourceUUID to the list snapshots params +func (o *ListSnapshotsParams) WithResourceUUID(resourceUUID *string) *ListSnapshotsParams { + o.SetResourceUUID(resourceUUID) + return o +} + +// SetResourceUUID adds the resourceUuid to the list snapshots params +func (o *ListSnapshotsParams) SetResourceUUID(resourceUUID *string) { + o.ResourceUUID = resourceUUID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListSnapshotsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.PaginationNextPageToken != nil { + + // query param pagination.next_page_token + var qrPaginationNextPageToken string + if o.PaginationNextPageToken != nil { + qrPaginationNextPageToken = *o.PaginationNextPageToken + } + qPaginationNextPageToken := qrPaginationNextPageToken + if qPaginationNextPageToken != "" { + if err := r.SetQueryParam("pagination.next_page_token", qPaginationNextPageToken); err != nil { + return err + } + } + + } + + if o.PaginationPageSize != nil { + + // query param pagination.page_size + var qrPaginationPageSize int64 + if o.PaginationPageSize != nil { + qrPaginationPageSize = *o.PaginationPageSize + } + qPaginationPageSize := swag.FormatInt64(qrPaginationPageSize) + if qPaginationPageSize != "" { + if err := r.SetQueryParam("pagination.page_size", qPaginationPageSize); err != nil { + return err + } + } + + } + + if o.PaginationPreviousPageToken != nil { + + // query param pagination.previous_page_token + var qrPaginationPreviousPageToken string + if o.PaginationPreviousPageToken != nil { + qrPaginationPreviousPageToken = *o.PaginationPreviousPageToken + } + qPaginationPreviousPageToken := qrPaginationPreviousPageToken + if qPaginationPreviousPageToken != "" { + if err := r.SetQueryParam("pagination.previous_page_token", qPaginationPreviousPageToken); err != nil { + return err + } + } + + } + + if o.ResourceDescription != nil { + + // query param resource.description + var qrResourceDescription string + if o.ResourceDescription != nil { + qrResourceDescription = *o.ResourceDescription + } + qResourceDescription := qrResourceDescription + if qResourceDescription != "" { + if err := r.SetQueryParam("resource.description", qResourceDescription); err != nil { + return err + } + } + + } + + if o.ResourceID != nil { + + // query param resource.id + var qrResourceID string + if o.ResourceID != nil { + qrResourceID = *o.ResourceID + } + qResourceID := qrResourceID + if qResourceID != "" { + if err := r.SetQueryParam("resource.id", qResourceID); err != nil { + return err + } + } + + } + + // path param resource.location.organization_id + if err := r.SetPathParam("resource.location.organization_id", o.ResourceLocationOrganizationID); err != nil { + return err + } + + // path param resource.location.project_id + if err := r.SetPathParam("resource.location.project_id", o.ResourceLocationProjectID); err != nil { + return err + } + + if o.ResourceLocationRegionProvider != nil { + + // query param resource.location.region.provider + var qrResourceLocationRegionProvider string + if o.ResourceLocationRegionProvider != nil { + qrResourceLocationRegionProvider = *o.ResourceLocationRegionProvider + } + qResourceLocationRegionProvider := qrResourceLocationRegionProvider + if qResourceLocationRegionProvider != "" { + if err := r.SetQueryParam("resource.location.region.provider", qResourceLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.ResourceLocationRegionRegion != nil { + + // query param resource.location.region.region + var qrResourceLocationRegionRegion string + if o.ResourceLocationRegionRegion != nil { + qrResourceLocationRegionRegion = *o.ResourceLocationRegionRegion + } + qResourceLocationRegionRegion := qrResourceLocationRegionRegion + if qResourceLocationRegionRegion != "" { + if err := r.SetQueryParam("resource.location.region.region", qResourceLocationRegionRegion); err != nil { + return err + } + } + + } + + if o.ResourceType != nil { + + // query param resource.type + var qrResourceType string + if o.ResourceType != nil { + qrResourceType = *o.ResourceType + } + qResourceType := qrResourceType + if qResourceType != "" { + if err := r.SetQueryParam("resource.type", qResourceType); err != nil { + return err + } + } + + } + + if o.ResourceUUID != nil { + + // query param resource.uuid + var qrResourceUUID string + if o.ResourceUUID != nil { + qrResourceUUID = *o.ResourceUUID + } + qResourceUUID := qrResourceUUID + if qResourceUUID != "" { + if err := r.SetQueryParam("resource.uuid", qResourceUUID); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_snapshots_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_snapshots_responses.go new file mode 100644 index 00000000..b149fce1 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_snapshots_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// ListSnapshotsReader is a Reader for the ListSnapshots structure. +type ListSnapshotsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListSnapshotsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListSnapshotsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListSnapshotsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListSnapshotsOK creates a ListSnapshotsOK with default headers values +func NewListSnapshotsOK() *ListSnapshotsOK { + return &ListSnapshotsOK{} +} + +/*ListSnapshotsOK handles this case with default header values. + +A successful response. +*/ +type ListSnapshotsOK struct { + Payload *models.HashicorpCloudConsul20210204ListSnapshotsResponse +} + +func (o *ListSnapshotsOK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] listSnapshotsOK %+v", 200, o.Payload) +} + +func (o *ListSnapshotsOK) GetPayload() *models.HashicorpCloudConsul20210204ListSnapshotsResponse { + return o.Payload +} + +func (o *ListSnapshotsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204ListSnapshotsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListSnapshotsDefault creates a ListSnapshotsDefault with default headers values +func NewListSnapshotsDefault(code int) *ListSnapshotsDefault { + return &ListSnapshotsDefault{ + _statusCode: code, + } +} + +/*ListSnapshotsDefault handles this case with default header values. + +An unexpected error response. +*/ +type ListSnapshotsDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the list snapshots default response +func (o *ListSnapshotsDefault) Code() int { + return o._statusCode +} + +func (o *ListSnapshotsDefault) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] ListSnapshots default %+v", o._statusCode, o.Payload) +} + +func (o *ListSnapshotsDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ListSnapshotsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_upgrade_versions_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_upgrade_versions_parameters.go new file mode 100644 index 00000000..ab212c9c --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_upgrade_versions_parameters.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListUpgradeVersionsParams creates a new ListUpgradeVersionsParams object +// with the default values initialized. +func NewListUpgradeVersionsParams() *ListUpgradeVersionsParams { + var () + return &ListUpgradeVersionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListUpgradeVersionsParamsWithTimeout creates a new ListUpgradeVersionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewListUpgradeVersionsParamsWithTimeout(timeout time.Duration) *ListUpgradeVersionsParams { + var () + return &ListUpgradeVersionsParams{ + + timeout: timeout, + } +} + +// NewListUpgradeVersionsParamsWithContext creates a new ListUpgradeVersionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewListUpgradeVersionsParamsWithContext(ctx context.Context) *ListUpgradeVersionsParams { + var () + return &ListUpgradeVersionsParams{ + + Context: ctx, + } +} + +// NewListUpgradeVersionsParamsWithHTTPClient creates a new ListUpgradeVersionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListUpgradeVersionsParamsWithHTTPClient(client *http.Client) *ListUpgradeVersionsParams { + var () + return &ListUpgradeVersionsParams{ + HTTPClient: client, + } +} + +/*ListUpgradeVersionsParams contains all the parameters to send to the API endpoint +for the list upgrade versions operation typically these are written to a http.Request +*/ +type ListUpgradeVersionsParams struct { + + /*ID + id of the Consul cluster to list versions for. + + */ + ID string + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithTimeout(timeout time.Duration) *ListUpgradeVersionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithContext(ctx context.Context) *ListUpgradeVersionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithHTTPClient(client *http.Client) *ListUpgradeVersionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithID(id string) *ListUpgradeVersionsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithLocationOrganizationID(locationOrganizationID string) *ListUpgradeVersionsParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithLocationProjectID(locationProjectID string) *ListUpgradeVersionsParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithLocationRegionProvider(locationRegionProvider *string) *ListUpgradeVersionsParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the list upgrade versions params +func (o *ListUpgradeVersionsParams) WithLocationRegionRegion(locationRegionRegion *string) *ListUpgradeVersionsParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the list upgrade versions params +func (o *ListUpgradeVersionsParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *ListUpgradeVersionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_upgrade_versions_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_upgrade_versions_responses.go new file mode 100644 index 00000000..4a6b58f2 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_upgrade_versions_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// ListUpgradeVersionsReader is a Reader for the ListUpgradeVersions structure. +type ListUpgradeVersionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListUpgradeVersionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListUpgradeVersionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListUpgradeVersionsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListUpgradeVersionsOK creates a ListUpgradeVersionsOK with default headers values +func NewListUpgradeVersionsOK() *ListUpgradeVersionsOK { + return &ListUpgradeVersionsOK{} +} + +/*ListUpgradeVersionsOK handles this case with default header values. + +A successful response. +*/ +type ListUpgradeVersionsOK struct { + Payload *models.HashicorpCloudConsul20210204ListUpgradeVersionsResponse +} + +func (o *ListUpgradeVersionsOK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/upgrade-versions][%d] listUpgradeVersionsOK %+v", 200, o.Payload) +} + +func (o *ListUpgradeVersionsOK) GetPayload() *models.HashicorpCloudConsul20210204ListUpgradeVersionsResponse { + return o.Payload +} + +func (o *ListUpgradeVersionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204ListUpgradeVersionsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListUpgradeVersionsDefault creates a ListUpgradeVersionsDefault with default headers values +func NewListUpgradeVersionsDefault(code int) *ListUpgradeVersionsDefault { + return &ListUpgradeVersionsDefault{ + _statusCode: code, + } +} + +/*ListUpgradeVersionsDefault handles this case with default header values. + +An unexpected error response. +*/ +type ListUpgradeVersionsDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the list upgrade versions default response +func (o *ListUpgradeVersionsDefault) Code() int { + return o._statusCode +} + +func (o *ListUpgradeVersionsDefault) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/upgrade-versions][%d] ListUpgradeVersions default %+v", o._statusCode, o.Payload) +} + +func (o *ListUpgradeVersionsDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ListUpgradeVersionsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions2_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions2_parameters.go new file mode 100644 index 00000000..2013eea1 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions2_parameters.go @@ -0,0 +1,242 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListVersions2Params creates a new ListVersions2Params object +// with the default values initialized. +func NewListVersions2Params() *ListVersions2Params { + var () + return &ListVersions2Params{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListVersions2ParamsWithTimeout creates a new ListVersions2Params object +// with the default values initialized, and the ability to set a timeout on a request +func NewListVersions2ParamsWithTimeout(timeout time.Duration) *ListVersions2Params { + var () + return &ListVersions2Params{ + + timeout: timeout, + } +} + +// NewListVersions2ParamsWithContext creates a new ListVersions2Params object +// with the default values initialized, and the ability to set a context for a request +func NewListVersions2ParamsWithContext(ctx context.Context) *ListVersions2Params { + var () + return &ListVersions2Params{ + + Context: ctx, + } +} + +// NewListVersions2ParamsWithHTTPClient creates a new ListVersions2Params object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListVersions2ParamsWithHTTPClient(client *http.Client) *ListVersions2Params { + var () + return &ListVersions2Params{ + HTTPClient: client, + } +} + +/*ListVersions2Params contains all the parameters to send to the API endpoint +for the list versions2 operation typically these are written to a http.Request +*/ +type ListVersions2Params struct { + + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID *string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID *string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list versions2 params +func (o *ListVersions2Params) WithTimeout(timeout time.Duration) *ListVersions2Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list versions2 params +func (o *ListVersions2Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list versions2 params +func (o *ListVersions2Params) WithContext(ctx context.Context) *ListVersions2Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list versions2 params +func (o *ListVersions2Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list versions2 params +func (o *ListVersions2Params) WithHTTPClient(client *http.Client) *ListVersions2Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list versions2 params +func (o *ListVersions2Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLocationOrganizationID adds the locationOrganizationID to the list versions2 params +func (o *ListVersions2Params) WithLocationOrganizationID(locationOrganizationID *string) *ListVersions2Params { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the list versions2 params +func (o *ListVersions2Params) SetLocationOrganizationID(locationOrganizationID *string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the list versions2 params +func (o *ListVersions2Params) WithLocationProjectID(locationProjectID *string) *ListVersions2Params { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the list versions2 params +func (o *ListVersions2Params) SetLocationProjectID(locationProjectID *string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the list versions2 params +func (o *ListVersions2Params) WithLocationRegionProvider(locationRegionProvider *string) *ListVersions2Params { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the list versions2 params +func (o *ListVersions2Params) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the list versions2 params +func (o *ListVersions2Params) WithLocationRegionRegion(locationRegionRegion *string) *ListVersions2Params { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the list versions2 params +func (o *ListVersions2Params) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *ListVersions2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.LocationOrganizationID != nil { + + // query param location.organization_id + var qrLocationOrganizationID string + if o.LocationOrganizationID != nil { + qrLocationOrganizationID = *o.LocationOrganizationID + } + qLocationOrganizationID := qrLocationOrganizationID + if qLocationOrganizationID != "" { + if err := r.SetQueryParam("location.organization_id", qLocationOrganizationID); err != nil { + return err + } + } + + } + + if o.LocationProjectID != nil { + + // query param location.project_id + var qrLocationProjectID string + if o.LocationProjectID != nil { + qrLocationProjectID = *o.LocationProjectID + } + qLocationProjectID := qrLocationProjectID + if qLocationProjectID != "" { + if err := r.SetQueryParam("location.project_id", qLocationProjectID); err != nil { + return err + } + } + + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions2_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions2_responses.go new file mode 100644 index 00000000..97f74740 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions2_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// ListVersions2Reader is a Reader for the ListVersions2 structure. +type ListVersions2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListVersions2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListVersions2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListVersions2Default(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListVersions2OK creates a ListVersions2OK with default headers values +func NewListVersions2OK() *ListVersions2OK { + return &ListVersions2OK{} +} + +/*ListVersions2OK handles this case with default header values. + +A successful response. +*/ +type ListVersions2OK struct { + Payload *models.HashicorpCloudConsul20210204ListVersionsResponse +} + +func (o *ListVersions2OK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/versions][%d] listVersions2OK %+v", 200, o.Payload) +} + +func (o *ListVersions2OK) GetPayload() *models.HashicorpCloudConsul20210204ListVersionsResponse { + return o.Payload +} + +func (o *ListVersions2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204ListVersionsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListVersions2Default creates a ListVersions2Default with default headers values +func NewListVersions2Default(code int) *ListVersions2Default { + return &ListVersions2Default{ + _statusCode: code, + } +} + +/*ListVersions2Default handles this case with default header values. + +An unexpected error response. +*/ +type ListVersions2Default struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the list versions2 default response +func (o *ListVersions2Default) Code() int { + return o._statusCode +} + +func (o *ListVersions2Default) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/versions][%d] ListVersions2 default %+v", o._statusCode, o.Payload) +} + +func (o *ListVersions2Default) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ListVersions2Default) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions_parameters.go new file mode 100644 index 00000000..68f62d8a --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions_parameters.go @@ -0,0 +1,220 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListVersionsParams creates a new ListVersionsParams object +// with the default values initialized. +func NewListVersionsParams() *ListVersionsParams { + var () + return &ListVersionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListVersionsParamsWithTimeout creates a new ListVersionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewListVersionsParamsWithTimeout(timeout time.Duration) *ListVersionsParams { + var () + return &ListVersionsParams{ + + timeout: timeout, + } +} + +// NewListVersionsParamsWithContext creates a new ListVersionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewListVersionsParamsWithContext(ctx context.Context) *ListVersionsParams { + var () + return &ListVersionsParams{ + + Context: ctx, + } +} + +// NewListVersionsParamsWithHTTPClient creates a new ListVersionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListVersionsParamsWithHTTPClient(client *http.Client) *ListVersionsParams { + var () + return &ListVersionsParams{ + HTTPClient: client, + } +} + +/*ListVersionsParams contains all the parameters to send to the API endpoint +for the list versions operation typically these are written to a http.Request +*/ +type ListVersionsParams struct { + + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + /*LocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + LocationRegionProvider *string + /*LocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list versions params +func (o *ListVersionsParams) WithTimeout(timeout time.Duration) *ListVersionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list versions params +func (o *ListVersionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list versions params +func (o *ListVersionsParams) WithContext(ctx context.Context) *ListVersionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list versions params +func (o *ListVersionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list versions params +func (o *ListVersionsParams) WithHTTPClient(client *http.Client) *ListVersionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list versions params +func (o *ListVersionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLocationOrganizationID adds the locationOrganizationID to the list versions params +func (o *ListVersionsParams) WithLocationOrganizationID(locationOrganizationID string) *ListVersionsParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the list versions params +func (o *ListVersionsParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the list versions params +func (o *ListVersionsParams) WithLocationProjectID(locationProjectID string) *ListVersionsParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the list versions params +func (o *ListVersionsParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the list versions params +func (o *ListVersionsParams) WithLocationRegionProvider(locationRegionProvider *string) *ListVersionsParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the list versions params +func (o *ListVersionsParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the list versions params +func (o *ListVersionsParams) WithLocationRegionRegion(locationRegionRegion *string) *ListVersionsParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the list versions params +func (o *ListVersionsParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *ListVersionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions_responses.go new file mode 100644 index 00000000..d8619f71 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/list_versions_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// ListVersionsReader is a Reader for the ListVersions structure. +type ListVersionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListVersionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListVersionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListVersionsDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListVersionsOK creates a ListVersionsOK with default headers values +func NewListVersionsOK() *ListVersionsOK { + return &ListVersionsOK{} +} + +/*ListVersionsOK handles this case with default header values. + +A successful response. +*/ +type ListVersionsOK struct { + Payload *models.HashicorpCloudConsul20210204ListVersionsResponse +} + +func (o *ListVersionsOK) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/versions][%d] listVersionsOK %+v", 200, o.Payload) +} + +func (o *ListVersionsOK) GetPayload() *models.HashicorpCloudConsul20210204ListVersionsResponse { + return o.Payload +} + +func (o *ListVersionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204ListVersionsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListVersionsDefault creates a ListVersionsDefault with default headers values +func NewListVersionsDefault(code int) *ListVersionsDefault { + return &ListVersionsDefault{ + _statusCode: code, + } +} + +/*ListVersionsDefault handles this case with default header values. + +An unexpected error response. +*/ +type ListVersionsDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the list versions default response +func (o *ListVersionsDefault) Code() int { + return o._statusCode +} + +func (o *ListVersionsDefault) Error() string { + return fmt.Sprintf("[GET /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/versions][%d] ListVersions default %+v", o._statusCode, o.Payload) +} + +func (o *ListVersionsDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ListVersionsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/restore_snapshot_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/restore_snapshot_parameters.go new file mode 100644 index 00000000..d58c50ef --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/restore_snapshot_parameters.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// NewRestoreSnapshotParams creates a new RestoreSnapshotParams object +// with the default values initialized. +func NewRestoreSnapshotParams() *RestoreSnapshotParams { + var () + return &RestoreSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewRestoreSnapshotParamsWithTimeout creates a new RestoreSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewRestoreSnapshotParamsWithTimeout(timeout time.Duration) *RestoreSnapshotParams { + var () + return &RestoreSnapshotParams{ + + timeout: timeout, + } +} + +// NewRestoreSnapshotParamsWithContext creates a new RestoreSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewRestoreSnapshotParamsWithContext(ctx context.Context) *RestoreSnapshotParams { + var () + return &RestoreSnapshotParams{ + + Context: ctx, + } +} + +// NewRestoreSnapshotParamsWithHTTPClient creates a new RestoreSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewRestoreSnapshotParamsWithHTTPClient(client *http.Client) *RestoreSnapshotParams { + var () + return &RestoreSnapshotParams{ + HTTPClient: client, + } +} + +/*RestoreSnapshotParams contains all the parameters to send to the API endpoint +for the restore snapshot operation typically these are written to a http.Request +*/ +type RestoreSnapshotParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20210204RestoreSnapshotRequest + /*ClusterID + cluster_id represents the cluster to restore to. + + */ + ClusterID string + /*LocationOrganizationID + organization_id is the id of the organization. + + */ + LocationOrganizationID string + /*LocationProjectID + project_id is the projects id. + + */ + LocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the restore snapshot params +func (o *RestoreSnapshotParams) WithTimeout(timeout time.Duration) *RestoreSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the restore snapshot params +func (o *RestoreSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the restore snapshot params +func (o *RestoreSnapshotParams) WithContext(ctx context.Context) *RestoreSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the restore snapshot params +func (o *RestoreSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the restore snapshot params +func (o *RestoreSnapshotParams) WithHTTPClient(client *http.Client) *RestoreSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the restore snapshot params +func (o *RestoreSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the restore snapshot params +func (o *RestoreSnapshotParams) WithBody(body *models.HashicorpCloudConsul20210204RestoreSnapshotRequest) *RestoreSnapshotParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the restore snapshot params +func (o *RestoreSnapshotParams) SetBody(body *models.HashicorpCloudConsul20210204RestoreSnapshotRequest) { + o.Body = body +} + +// WithClusterID adds the clusterID to the restore snapshot params +func (o *RestoreSnapshotParams) WithClusterID(clusterID string) *RestoreSnapshotParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the restore snapshot params +func (o *RestoreSnapshotParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the restore snapshot params +func (o *RestoreSnapshotParams) WithLocationOrganizationID(locationOrganizationID string) *RestoreSnapshotParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the restore snapshot params +func (o *RestoreSnapshotParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the restore snapshot params +func (o *RestoreSnapshotParams) WithLocationProjectID(locationProjectID string) *RestoreSnapshotParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the restore snapshot params +func (o *RestoreSnapshotParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *RestoreSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/restore_snapshot_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/restore_snapshot_responses.go new file mode 100644 index 00000000..1b8de836 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/restore_snapshot_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// RestoreSnapshotReader is a Reader for the RestoreSnapshot structure. +type RestoreSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RestoreSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRestoreSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewRestoreSnapshotDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewRestoreSnapshotOK creates a RestoreSnapshotOK with default headers values +func NewRestoreSnapshotOK() *RestoreSnapshotOK { + return &RestoreSnapshotOK{} +} + +/*RestoreSnapshotOK handles this case with default header values. + +A successful response. +*/ +type RestoreSnapshotOK struct { + Payload *models.HashicorpCloudConsul20210204RestoreSnapshotResponse +} + +func (o *RestoreSnapshotOK) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/restore][%d] restoreSnapshotOK %+v", 200, o.Payload) +} + +func (o *RestoreSnapshotOK) GetPayload() *models.HashicorpCloudConsul20210204RestoreSnapshotResponse { + return o.Payload +} + +func (o *RestoreSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204RestoreSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRestoreSnapshotDefault creates a RestoreSnapshotDefault with default headers values +func NewRestoreSnapshotDefault(code int) *RestoreSnapshotDefault { + return &RestoreSnapshotDefault{ + _statusCode: code, + } +} + +/*RestoreSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type RestoreSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the restore snapshot default response +func (o *RestoreSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *RestoreSnapshotDefault) Error() string { + return fmt.Sprintf("[POST /consul/2021-02-04/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/restore][%d] RestoreSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *RestoreSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *RestoreSnapshotDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_parameters.go new file mode 100644 index 00000000..f615f9a1 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_parameters.go @@ -0,0 +1,226 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// NewUpdateParams creates a new UpdateParams object +// with the default values initialized. +func NewUpdateParams() *UpdateParams { + var () + return &UpdateParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateParamsWithTimeout creates a new UpdateParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateParamsWithTimeout(timeout time.Duration) *UpdateParams { + var () + return &UpdateParams{ + + timeout: timeout, + } +} + +// NewUpdateParamsWithContext creates a new UpdateParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateParamsWithContext(ctx context.Context) *UpdateParams { + var () + return &UpdateParams{ + + Context: ctx, + } +} + +// NewUpdateParamsWithHTTPClient creates a new UpdateParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateParamsWithHTTPClient(client *http.Client) *UpdateParams { + var () + return &UpdateParams{ + HTTPClient: client, + } +} + +/*UpdateParams contains all the parameters to send to the API endpoint +for the update operation typically these are written to a http.Request +*/ +type UpdateParams struct { + + /*Body + cluster is the complete cluster resource to be updated. + + */ + Body *models.HashicorpCloudConsul20210204Cluster + /*ClusterID + id is ID of the Consul cluster. + + */ + ClusterID string + /*ClusterLocationOrganizationID + organization_id is the id of the organization. + + */ + ClusterLocationOrganizationID string + /*ClusterLocationProjectID + project_id is the projects id. + + */ + ClusterLocationProjectID string + /*UpdateMaskPaths + The set of field mask paths. + + */ + UpdateMaskPaths []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update params +func (o *UpdateParams) WithTimeout(timeout time.Duration) *UpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update params +func (o *UpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update params +func (o *UpdateParams) WithContext(ctx context.Context) *UpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update params +func (o *UpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update params +func (o *UpdateParams) WithHTTPClient(client *http.Client) *UpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update params +func (o *UpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update params +func (o *UpdateParams) WithBody(body *models.HashicorpCloudConsul20210204Cluster) *UpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update params +func (o *UpdateParams) SetBody(body *models.HashicorpCloudConsul20210204Cluster) { + o.Body = body +} + +// WithClusterID adds the clusterID to the update params +func (o *UpdateParams) WithClusterID(clusterID string) *UpdateParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the update params +func (o *UpdateParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithClusterLocationOrganizationID adds the clusterLocationOrganizationID to the update params +func (o *UpdateParams) WithClusterLocationOrganizationID(clusterLocationOrganizationID string) *UpdateParams { + o.SetClusterLocationOrganizationID(clusterLocationOrganizationID) + return o +} + +// SetClusterLocationOrganizationID adds the clusterLocationOrganizationId to the update params +func (o *UpdateParams) SetClusterLocationOrganizationID(clusterLocationOrganizationID string) { + o.ClusterLocationOrganizationID = clusterLocationOrganizationID +} + +// WithClusterLocationProjectID adds the clusterLocationProjectID to the update params +func (o *UpdateParams) WithClusterLocationProjectID(clusterLocationProjectID string) *UpdateParams { + o.SetClusterLocationProjectID(clusterLocationProjectID) + return o +} + +// SetClusterLocationProjectID adds the clusterLocationProjectId to the update params +func (o *UpdateParams) SetClusterLocationProjectID(clusterLocationProjectID string) { + o.ClusterLocationProjectID = clusterLocationProjectID +} + +// WithUpdateMaskPaths adds the updateMaskPaths to the update params +func (o *UpdateParams) WithUpdateMaskPaths(updateMaskPaths []string) *UpdateParams { + o.SetUpdateMaskPaths(updateMaskPaths) + return o +} + +// SetUpdateMaskPaths adds the updateMaskPaths to the update params +func (o *UpdateParams) SetUpdateMaskPaths(updateMaskPaths []string) { + o.UpdateMaskPaths = updateMaskPaths +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster.id + if err := r.SetPathParam("cluster.id", o.ClusterID); err != nil { + return err + } + + // path param cluster.location.organization_id + if err := r.SetPathParam("cluster.location.organization_id", o.ClusterLocationOrganizationID); err != nil { + return err + } + + // path param cluster.location.project_id + if err := r.SetPathParam("cluster.location.project_id", o.ClusterLocationProjectID); err != nil { + return err + } + + valuesUpdateMaskPaths := o.UpdateMaskPaths + + joinedUpdateMaskPaths := swag.JoinByFormat(valuesUpdateMaskPaths, "multi") + // query array param update_mask.paths + if err := r.SetQueryParam("update_mask.paths", joinedUpdateMaskPaths...); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_responses.go new file mode 100644 index 00000000..5dd52d77 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// UpdateReader is a Reader for the Update structure. +type UpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUpdateOK creates a UpdateOK with default headers values +func NewUpdateOK() *UpdateOK { + return &UpdateOK{} +} + +/*UpdateOK handles this case with default header values. + +A successful response. +*/ +type UpdateOK struct { + Payload *models.HashicorpCloudConsul20210204UpdateResponse +} + +func (o *UpdateOK) Error() string { + return fmt.Sprintf("[PATCH /consul/2021-02-04/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters/{cluster.id}][%d] updateOK %+v", 200, o.Payload) +} + +func (o *UpdateOK) GetPayload() *models.HashicorpCloudConsul20210204UpdateResponse { + return o.Payload +} + +func (o *UpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204UpdateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateDefault creates a UpdateDefault with default headers values +func NewUpdateDefault(code int) *UpdateDefault { + return &UpdateDefault{ + _statusCode: code, + } +} + +/*UpdateDefault handles this case with default header values. + +An unexpected error response. +*/ +type UpdateDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the update default response +func (o *UpdateDefault) Code() int { + return o._statusCode +} + +func (o *UpdateDefault) Error() string { + return fmt.Sprintf("[PATCH /consul/2021-02-04/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters/{cluster.id}][%d] Update default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *UpdateDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_snapshot_parameters.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_snapshot_parameters.go new file mode 100644 index 00000000..6a0d6bcd --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_snapshot_parameters.go @@ -0,0 +1,228 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// NewUpdateSnapshotParams creates a new UpdateSnapshotParams object +// with the default values initialized. +func NewUpdateSnapshotParams() *UpdateSnapshotParams { + var () + return &UpdateSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateSnapshotParamsWithTimeout creates a new UpdateSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewUpdateSnapshotParamsWithTimeout(timeout time.Duration) *UpdateSnapshotParams { + var () + return &UpdateSnapshotParams{ + + timeout: timeout, + } +} + +// NewUpdateSnapshotParamsWithContext creates a new UpdateSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewUpdateSnapshotParamsWithContext(ctx context.Context) *UpdateSnapshotParams { + var () + return &UpdateSnapshotParams{ + + Context: ctx, + } +} + +// NewUpdateSnapshotParamsWithHTTPClient creates a new UpdateSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewUpdateSnapshotParamsWithHTTPClient(client *http.Client) *UpdateSnapshotParams { + var () + return &UpdateSnapshotParams{ + HTTPClient: client, + } +} + +/*UpdateSnapshotParams contains all the parameters to send to the API endpoint +for the update snapshot operation typically these are written to a http.Request +*/ +type UpdateSnapshotParams struct { + + /*Body + snapshot contains the fields to update. + + Supported fields: name + + */ + Body *models.HashicorpCloudConsul20210204Snapshot + /*MaskPaths + The set of field mask paths. + + */ + MaskPaths []string + /*SnapshotID + id is the snapshot’s ID. + + */ + SnapshotID string + /*SnapshotLocationOrganizationID + organization_id is the id of the organization. + + */ + SnapshotLocationOrganizationID string + /*SnapshotLocationProjectID + project_id is the projects id. + + */ + SnapshotLocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the update snapshot params +func (o *UpdateSnapshotParams) WithTimeout(timeout time.Duration) *UpdateSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update snapshot params +func (o *UpdateSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update snapshot params +func (o *UpdateSnapshotParams) WithContext(ctx context.Context) *UpdateSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update snapshot params +func (o *UpdateSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update snapshot params +func (o *UpdateSnapshotParams) WithHTTPClient(client *http.Client) *UpdateSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update snapshot params +func (o *UpdateSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update snapshot params +func (o *UpdateSnapshotParams) WithBody(body *models.HashicorpCloudConsul20210204Snapshot) *UpdateSnapshotParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update snapshot params +func (o *UpdateSnapshotParams) SetBody(body *models.HashicorpCloudConsul20210204Snapshot) { + o.Body = body +} + +// WithMaskPaths adds the maskPaths to the update snapshot params +func (o *UpdateSnapshotParams) WithMaskPaths(maskPaths []string) *UpdateSnapshotParams { + o.SetMaskPaths(maskPaths) + return o +} + +// SetMaskPaths adds the maskPaths to the update snapshot params +func (o *UpdateSnapshotParams) SetMaskPaths(maskPaths []string) { + o.MaskPaths = maskPaths +} + +// WithSnapshotID adds the snapshotID to the update snapshot params +func (o *UpdateSnapshotParams) WithSnapshotID(snapshotID string) *UpdateSnapshotParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the update snapshot params +func (o *UpdateSnapshotParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WithSnapshotLocationOrganizationID adds the snapshotLocationOrganizationID to the update snapshot params +func (o *UpdateSnapshotParams) WithSnapshotLocationOrganizationID(snapshotLocationOrganizationID string) *UpdateSnapshotParams { + o.SetSnapshotLocationOrganizationID(snapshotLocationOrganizationID) + return o +} + +// SetSnapshotLocationOrganizationID adds the snapshotLocationOrganizationId to the update snapshot params +func (o *UpdateSnapshotParams) SetSnapshotLocationOrganizationID(snapshotLocationOrganizationID string) { + o.SnapshotLocationOrganizationID = snapshotLocationOrganizationID +} + +// WithSnapshotLocationProjectID adds the snapshotLocationProjectID to the update snapshot params +func (o *UpdateSnapshotParams) WithSnapshotLocationProjectID(snapshotLocationProjectID string) *UpdateSnapshotParams { + o.SetSnapshotLocationProjectID(snapshotLocationProjectID) + return o +} + +// SetSnapshotLocationProjectID adds the snapshotLocationProjectId to the update snapshot params +func (o *UpdateSnapshotParams) SetSnapshotLocationProjectID(snapshotLocationProjectID string) { + o.SnapshotLocationProjectID = snapshotLocationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + valuesMaskPaths := o.MaskPaths + + joinedMaskPaths := swag.JoinByFormat(valuesMaskPaths, "multi") + // query array param mask.paths + if err := r.SetQueryParam("mask.paths", joinedMaskPaths...); err != nil { + return err + } + + // path param snapshot.id + if err := r.SetPathParam("snapshot.id", o.SnapshotID); err != nil { + return err + } + + // path param snapshot.location.organization_id + if err := r.SetPathParam("snapshot.location.organization_id", o.SnapshotLocationOrganizationID); err != nil { + return err + } + + // path param snapshot.location.project_id + if err := r.SetPathParam("snapshot.location.project_id", o.SnapshotLocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_snapshot_responses.go b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_snapshot_responses.go new file mode 100644 index 00000000..460391cf --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/client/consul_service/update_snapshot_responses.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package consul_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models" +) + +// UpdateSnapshotReader is a Reader for the UpdateSnapshot structure. +type UpdateSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateSnapshotDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUpdateSnapshotOK creates a UpdateSnapshotOK with default headers values +func NewUpdateSnapshotOK() *UpdateSnapshotOK { + return &UpdateSnapshotOK{} +} + +/*UpdateSnapshotOK handles this case with default header values. + +A successful response. +*/ +type UpdateSnapshotOK struct { + Payload *models.HashicorpCloudConsul20210204UpdateSnapshotResponse +} + +func (o *UpdateSnapshotOK) Error() string { + return fmt.Sprintf("[PATCH /consul/2021-02-04/organizations/{snapshot.location.organization_id}/projects/{snapshot.location.project_id}/snapshots/{snapshot.id}][%d] updateSnapshotOK %+v", 200, o.Payload) +} + +func (o *UpdateSnapshotOK) GetPayload() *models.HashicorpCloudConsul20210204UpdateSnapshotResponse { + return o.Payload +} + +func (o *UpdateSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20210204UpdateSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateSnapshotDefault creates a UpdateSnapshotDefault with default headers values +func NewUpdateSnapshotDefault(code int) *UpdateSnapshotDefault { + return &UpdateSnapshotDefault{ + _statusCode: code, + } +} + +/*UpdateSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type UpdateSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the update snapshot default response +func (o *UpdateSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *UpdateSnapshotDefault) Error() string { + return fmt.Sprintf("[PATCH /consul/2021-02-04/organizations/{snapshot.location.organization_id}/projects/{snapshot.location.project_id}/snapshots/{snapshot.id}][%d] UpdateSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *UpdateSnapshotDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/google_protobuf_field_mask.go b/clients/cloud-consul-service/preview/2021-02-04/models/google_protobuf_field_mask.go new file mode 100644 index 00000000..f2c471b0 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/google_protobuf_field_mask.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// GoogleProtobufFieldMask `FieldMask` represents a set of symbolic field paths, for example: +// +// paths: "f.a" +// paths: "f.b.d" +// +// Here `f` represents a field in some root message, `a` and `b` +// fields in the message found in `f`, and `d` a field found in the +// message in `f.b`. +// +// Field masks are used to specify a subset of fields that should be +// returned by a get operation or modified by an update operation. +// Field masks also have a custom JSON encoding (see below). +// +// # Field Masks in Projections +// +// When used in the context of a projection, a response message or +// sub-message is filtered by the API to only contain those fields as +// specified in the mask. For example, if the mask in the previous +// example is applied to a response message as follows: +// +// f { +// a : 22 +// b { +// d : 1 +// x : 2 +// } +// y : 13 +// } +// z: 8 +// +// The result will not contain specific values for fields x,y and z +// (their value will be set to the default, and omitted in proto text +// output): +// +// +// f { +// a : 22 +// b { +// d : 1 +// } +// } +// +// A repeated field is not allowed except at the last position of a +// paths string. +// +// If a FieldMask object is not present in a get operation, the +// operation applies to all fields (as if a FieldMask of all fields +// had been specified). +// +// Note that a field mask does not necessarily apply to the +// top-level response message. In case of a REST get operation, the +// field mask applies directly to the response, but in case of a REST +// list operation, the mask instead applies to each individual message +// in the returned resource list. In case of a REST custom method, +// other definitions may be used. Where the mask applies will be +// clearly documented together with its declaration in the API. In +// any case, the effect on the returned resource/resources is required +// behavior for APIs. +// +// # Field Masks in Update Operations +// +// A field mask in update operations specifies which fields of the +// targeted resource are going to be updated. The API is required +// to only change the values of the fields as specified in the mask +// and leave the others untouched. If a resource is passed in to +// describe the updated values, the API ignores the values of all +// fields not covered by the mask. +// +// If a repeated field is specified for an update operation, new values will +// be appended to the existing repeated field in the target resource. Note that +// a repeated field is only allowed in the last position of a `paths` string. +// +// If a sub-message is specified in the last position of the field mask for an +// update operation, then new value will be merged into the existing sub-message +// in the target resource. +// +// For example, given the target message: +// +// f { +// b { +// d: 1 +// x: 2 +// } +// c: [1] +// } +// +// And an update message: +// +// f { +// b { +// d: 10 +// } +// c: [2] +// } +// +// then if the field mask is: +// +// paths: ["f.b", "f.c"] +// +// then the result will be: +// +// f { +// b { +// d: 10 +// x: 2 +// } +// c: [1, 2] +// } +// +// An implementation may provide options to override this default behavior for +// repeated and message fields. +// +// In order to reset a field's value to the default, the field must +// be in the mask and set to the default value in the provided resource. +// Hence, in order to reset all fields of a resource, provide a default +// instance of the resource and set all fields in the mask, or do +// not provide a mask as described below. +// +// If a field mask is not present on update, the operation applies to +// all fields (as if a field mask of all fields has been specified). +// Note that in the presence of schema evolution, this may mean that +// fields the client does not know and has therefore not filled into +// the request will be reset to their default. If this is unwanted +// behavior, a specific service may require a client to always specify +// a field mask, producing an error if not. +// +// As with get operations, the location of the resource which +// describes the updated values in the request message depends on the +// operation kind. In any case, the effect of the field mask is +// required to be honored by the API. +// +// ## Considerations for HTTP REST +// +// The HTTP kind of an update operation which uses a field mask must +// be set to PATCH instead of PUT in order to satisfy HTTP semantics +// (PUT must only be used for full updates). +// +// # JSON Encoding of Field Masks +// +// In JSON, a field mask is encoded as a single string where paths are +// separated by a comma. Fields name in each path are converted +// to/from lower-camel naming conventions. +// +// As an example, consider the following message declarations: +// +// message Profile { +// User user = 1; +// Photo photo = 2; +// } +// message User { +// string display_name = 1; +// string address = 2; +// } +// +// In proto a field mask for `Profile` may look as such: +// +// mask { +// paths: "user.display_name" +// paths: "photo" +// } +// +// In JSON, the same mask is represented as below: +// +// { +// mask: "user.displayName,photo" +// } +// +// # Field Masks and Oneof Fields +// +// Field masks treat fields in oneofs just as regular fields. Consider the +// following message: +// +// message SampleMessage { +// oneof test_oneof { +// string name = 4; +// SubMessage sub_message = 9; +// } +// } +// +// The field mask can be: +// +// mask { +// paths: "name" +// } +// +// Or: +// +// mask { +// paths: "sub_message" +// } +// +// Note that oneof type names ("test_oneof" in this case) cannot be used in +// paths. +// +// ## Field Mask Verification +// +// The implementation of any API method which has a FieldMask type field in the +// request should verify the included field paths, and return an +// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. +// +// swagger:model google.protobuf.FieldMask +type GoogleProtobufFieldMask struct { + + // The set of field mask paths. + Paths []string `json:"paths"` +} + +// Validate validates this google protobuf field mask +func (m *GoogleProtobufFieldMask) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *GoogleProtobufFieldMask) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GoogleProtobufFieldMask) UnmarshalBinary(b []byte) error { + var res GoogleProtobufFieldMask + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/grpc_gateway_runtime_error.go b/clients/cloud-consul-service/preview/2021-02-04/models/grpc_gateway_runtime_error.go new file mode 100644 index 00000000..b3843c79 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/grpc_gateway_runtime_error.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// GrpcGatewayRuntimeError grpc gateway runtime error +// +// swagger:model grpc.gateway.runtime.Error +type GrpcGatewayRuntimeError struct { + + // code + Code int32 `json:"code,omitempty"` + + // details + Details []*cloud.GoogleProtobufAny `json:"details"` + + // error + Error string `json:"error,omitempty"` + + // message + Message string `json:"message,omitempty"` +} + +// Validate validates this grpc gateway runtime error +func (m *GrpcGatewayRuntimeError) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDetails(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GrpcGatewayRuntimeError) validateDetails(formats strfmt.Registry) error { + + if swag.IsZero(m.Details) { // not required + return nil + } + + for i := 0; i < len(m.Details); i++ { + if swag.IsZero(m.Details[i]) { // not required + continue + } + + if m.Details[i] != nil { + if err := m.Details[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("details" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GrpcGatewayRuntimeError) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GrpcGatewayRuntimeError) UnmarshalBinary(b []byte) error { + var res GrpcGatewayRuntimeError + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_acl_token.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_acl_token.go new file mode 100644 index 00000000..90a94b56 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_acl_token.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204ACLToken ACLToken is represents a single ACL token for a cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.ACLToken +type HashicorpCloudConsul20210204ACLToken struct { + + // accessor_id is the Consul Accessor ID for this ACL token. + AccessorID string `json:"accessor_id,omitempty"` + + // secret_id is the Consul Secret ID for this ACL Token, it is sensitive. + SecretID string `json:"secret_id,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 ACL token +func (m *HashicorpCloudConsul20210204ACLToken) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ACLToken) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ACLToken) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ACLToken + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_capacity_config.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_capacity_config.go new file mode 100644 index 00000000..8ce4558c --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_capacity_config.go @@ -0,0 +1,73 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204CapacityConfig CapacityConfig configures capacity settings like number of nodes and vm sizes. +// +// swagger:model hashicorp.cloud.consul_20210204.CapacityConfig +type HashicorpCloudConsul20210204CapacityConfig struct { + + // scale is the number of nodes this Consul cluster is provisioned with. + Scale int32 `json:"scale,omitempty"` + + // size is the t-shirt size representation of the VM that this Consul cluster + // is provisioned with. + Size HashicorpCloudConsul20210204CapacityConfigSize `json:"size,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 capacity config +func (m *HashicorpCloudConsul20210204CapacityConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204CapacityConfig) validateSize(formats strfmt.Registry) error { + + if swag.IsZero(m.Size) { // not required + return nil + } + + if err := m.Size.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("size") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CapacityConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CapacityConfig) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204CapacityConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_capacity_config_size.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_capacity_config_size.go new file mode 100644 index 00000000..dff46164 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_capacity_config_size.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudConsul20210204CapacityConfigSize Size represents the different VM sizes a Consul cluster can be provisioned with. +// These are bucketed as "t-shirt" sizes which each correspond to a specific +// instance type depending on the cloud provider. +// +// swagger:model hashicorp.cloud.consul_20210204.CapacityConfig.Size +type HashicorpCloudConsul20210204CapacityConfigSize string + +const ( + + // HashicorpCloudConsul20210204CapacityConfigSizeUNSET captures enum value "UNSET" + HashicorpCloudConsul20210204CapacityConfigSizeUNSET HashicorpCloudConsul20210204CapacityConfigSize = "UNSET" + + // HashicorpCloudConsul20210204CapacityConfigSizeXSMALL captures enum value "X_SMALL" + HashicorpCloudConsul20210204CapacityConfigSizeXSMALL HashicorpCloudConsul20210204CapacityConfigSize = "X_SMALL" + + // HashicorpCloudConsul20210204CapacityConfigSizeSMALL captures enum value "SMALL" + HashicorpCloudConsul20210204CapacityConfigSizeSMALL HashicorpCloudConsul20210204CapacityConfigSize = "SMALL" + + // HashicorpCloudConsul20210204CapacityConfigSizeMEDIUM captures enum value "MEDIUM" + HashicorpCloudConsul20210204CapacityConfigSizeMEDIUM HashicorpCloudConsul20210204CapacityConfigSize = "MEDIUM" + + // HashicorpCloudConsul20210204CapacityConfigSizeLARGE captures enum value "LARGE" + HashicorpCloudConsul20210204CapacityConfigSizeLARGE HashicorpCloudConsul20210204CapacityConfigSize = "LARGE" +) + +// for schema +var hashicorpCloudConsul20210204CapacityConfigSizeEnum []interface{} + +func init() { + var res []HashicorpCloudConsul20210204CapacityConfigSize + if err := json.Unmarshal([]byte(`["UNSET","X_SMALL","SMALL","MEDIUM","LARGE"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudConsul20210204CapacityConfigSizeEnum = append(hashicorpCloudConsul20210204CapacityConfigSizeEnum, v) + } +} + +func (m HashicorpCloudConsul20210204CapacityConfigSize) validateHashicorpCloudConsul20210204CapacityConfigSizeEnum(path, location string, value HashicorpCloudConsul20210204CapacityConfigSize) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudConsul20210204CapacityConfigSizeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud consul 20210204 capacity config size +func (m HashicorpCloudConsul20210204CapacityConfigSize) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudConsul20210204CapacityConfigSizeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster.go new file mode 100644 index 00000000..7160e34e --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204Cluster Cluster represents a single Consul cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.Cluster +type HashicorpCloudConsul20210204Cluster struct { + + // config holds the configuration of the cluster. + Config *HashicorpCloudConsul20210204ClusterConfig `json:"config,omitempty"` + + // consul_version is the current Consul version the server nodes are running. + ConsulVersion string `json:"consul_version,omitempty"` + + // created_at is the timestamp of when the cluster was first created. + // Output only. + // Read Only: true + // Format: date-time + CreatedAt strfmt.DateTime `json:"created_at,omitempty"` + + // dns_names holds the cluster's public and private DNS names. + // Output only. + // Read Only: true + DNSNames *HashicorpCloudConsul20210204ClusterDNSNames `json:"dns_names,omitempty"` + + // id is ID of the Consul cluster. + ID string `json:"id,omitempty"` + + // location is the location of the cluster. + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + + // state is the current state of the cluster. + // Output only. + // Read Only: true + State HashicorpCloudConsul20210204ClusterState `json:"state,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 cluster +func (m *HashicorpCloudConsul20210204Cluster) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateConfig(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDNSNames(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204Cluster) validateConfig(formats strfmt.Registry) error { + + if swag.IsZero(m.Config) { // not required + return nil + } + + if m.Config != nil { + if err := m.Config.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("config") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Cluster) validateCreatedAt(formats strfmt.Registry) error { + + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Cluster) validateDNSNames(formats strfmt.Registry) error { + + if swag.IsZero(m.DNSNames) { // not required + return nil + } + + if m.DNSNames != nil { + if err := m.DNSNames.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dns_names") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Cluster) validateLocation(formats strfmt.Registry) error { + + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Cluster) validateState(formats strfmt.Registry) error { + + if swag.IsZero(m.State) { // not required + return nil + } + + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204Cluster) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204Cluster) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204Cluster + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_config.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_config.go new file mode 100644 index 00000000..b140c809 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_config.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204ClusterConfig ClusterConfig holds the configuration for a Consul cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.ClusterConfig +type HashicorpCloudConsul20210204ClusterConfig struct { + + // capacity_config contains the configuration for the cluster size settings. + CapacityConfig *HashicorpCloudConsul20210204CapacityConfig `json:"capacity_config,omitempty"` + + // consul_config allows altering certain fields relating to the Consul + // cluster’s configuration. + ConsulConfig *HashicorpCloudConsul20210204ConsulConfig `json:"consul_config,omitempty"` + + // maintenance_config contains the configuration for maintenance events such as + // auto upgrades. + MaintenanceConfig HashicorpCloudConsul20210204MaintenanceConfig `json:"maintenance_config,omitempty"` + + // NetworkConfig contains the network to launch the Consul cluster into. + NetworkConfig *HashicorpCloudConsul20210204NetworkConfig `json:"network_config,omitempty"` + + // snapshot_config contains the configuration for how often to snapshot and + // how many to maintain. + SnapshotConfig HashicorpCloudConsul20210204SnapshotConfig `json:"snapshot_config,omitempty"` + + // tier is the type of tier this Consul cluster should be provisioned as. + Tier HashicorpCloudConsul20210204ClusterConfigTier `json:"tier,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 cluster config +func (m *HashicorpCloudConsul20210204ClusterConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCapacityConfig(formats); err != nil { + res = append(res, err) + } + + if err := m.validateConsulConfig(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworkConfig(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTier(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204ClusterConfig) validateCapacityConfig(formats strfmt.Registry) error { + + if swag.IsZero(m.CapacityConfig) { // not required + return nil + } + + if m.CapacityConfig != nil { + if err := m.CapacityConfig.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity_config") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204ClusterConfig) validateConsulConfig(formats strfmt.Registry) error { + + if swag.IsZero(m.ConsulConfig) { // not required + return nil + } + + if m.ConsulConfig != nil { + if err := m.ConsulConfig.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consul_config") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204ClusterConfig) validateNetworkConfig(formats strfmt.Registry) error { + + if swag.IsZero(m.NetworkConfig) { // not required + return nil + } + + if m.NetworkConfig != nil { + if err := m.NetworkConfig.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network_config") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204ClusterConfig) validateTier(formats strfmt.Registry) error { + + if swag.IsZero(m.Tier) { // not required + return nil + } + + if err := m.Tier.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tier") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ClusterConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ClusterConfig) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ClusterConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_config_tier.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_config_tier.go new file mode 100644 index 00000000..1ff33765 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_config_tier.go @@ -0,0 +1,66 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudConsul20210204ClusterConfigTier Tier represents the different tiers a Consul cluster can be provisioned as. +// +// swagger:model hashicorp.cloud.consul_20210204.ClusterConfig.Tier +type HashicorpCloudConsul20210204ClusterConfigTier string + +const ( + + // HashicorpCloudConsul20210204ClusterConfigTierUNSET captures enum value "UNSET" + HashicorpCloudConsul20210204ClusterConfigTierUNSET HashicorpCloudConsul20210204ClusterConfigTier = "UNSET" + + // HashicorpCloudConsul20210204ClusterConfigTierDEVELOPMENT captures enum value "DEVELOPMENT" + HashicorpCloudConsul20210204ClusterConfigTierDEVELOPMENT HashicorpCloudConsul20210204ClusterConfigTier = "DEVELOPMENT" + + // HashicorpCloudConsul20210204ClusterConfigTierSTANDARD captures enum value "STANDARD" + HashicorpCloudConsul20210204ClusterConfigTierSTANDARD HashicorpCloudConsul20210204ClusterConfigTier = "STANDARD" +) + +// for schema +var hashicorpCloudConsul20210204ClusterConfigTierEnum []interface{} + +func init() { + var res []HashicorpCloudConsul20210204ClusterConfigTier + if err := json.Unmarshal([]byte(`["UNSET","DEVELOPMENT","STANDARD"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudConsul20210204ClusterConfigTierEnum = append(hashicorpCloudConsul20210204ClusterConfigTierEnum, v) + } +} + +func (m HashicorpCloudConsul20210204ClusterConfigTier) validateHashicorpCloudConsul20210204ClusterConfigTierEnum(path, location string, value HashicorpCloudConsul20210204ClusterConfigTier) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudConsul20210204ClusterConfigTierEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud consul 20210204 cluster config tier +func (m HashicorpCloudConsul20210204ClusterConfigTier) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudConsul20210204ClusterConfigTierEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_dns_names.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_dns_names.go new file mode 100644 index 00000000..6367f88b --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_dns_names.go @@ -0,0 +1,46 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204ClusterDNSNames DNSNames holds all of the cluster's DNS names. +// +// swagger:model hashicorp.cloud.consul_20210204.Cluster.DNSNames +type HashicorpCloudConsul20210204ClusterDNSNames struct { + + // private is the DNS name pointing to the cluster's private IP addresses. + Private string `json:"private,omitempty"` + + // public is the DNS name pointing to the cluster's public IP addresses. + Public string `json:"public,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 cluster DNS names +func (m *HashicorpCloudConsul20210204ClusterDNSNames) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ClusterDNSNames) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ClusterDNSNames) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ClusterDNSNames + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_state.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_state.go new file mode 100644 index 00000000..9f47da0c --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_cluster_state.go @@ -0,0 +1,101 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudConsul20210204ClusterState State is the state of the Consul cluster. Note that this state +// represents the abstract Consul cluster itself, not necessarily whether +// Consul cluster is currently available or not. +// +// - UNSET: UNSET is a sentinel zero value so that an uninitialized value can be +// detected. +// - PENDING: PENDING is the state the cluster is in while it is waiting to be created. +// - CREATING: CREATING is the state the cluster is in while it is being provisioned for +// the first time. +// - RUNNING: RUNNING is the steady state while the cluster is running. +// - FAILED: FAILED is a failure state in which the cluster is unavailable and may +// required an operator restore action to recover. +// - UPDATING: UPDATING is the state the cluster is in while undergoing a version +// update. +// - RESTORING: RESTORING is the state the cluster is in while restoring from a snapshot. +// - DELETING: DELETING is the state the cluster is in while it is being de-provisioned. +// - DELETED: DELETED is the state the cluster is in when it has been de-provisioned. At +// this point, the cluster is eligible for garbage collection. +// +// swagger:model hashicorp.cloud.consul_20210204.Cluster.State +type HashicorpCloudConsul20210204ClusterState string + +const ( + + // HashicorpCloudConsul20210204ClusterStateUNSET captures enum value "UNSET" + HashicorpCloudConsul20210204ClusterStateUNSET HashicorpCloudConsul20210204ClusterState = "UNSET" + + // HashicorpCloudConsul20210204ClusterStatePENDING captures enum value "PENDING" + HashicorpCloudConsul20210204ClusterStatePENDING HashicorpCloudConsul20210204ClusterState = "PENDING" + + // HashicorpCloudConsul20210204ClusterStateCREATING captures enum value "CREATING" + HashicorpCloudConsul20210204ClusterStateCREATING HashicorpCloudConsul20210204ClusterState = "CREATING" + + // HashicorpCloudConsul20210204ClusterStateRUNNING captures enum value "RUNNING" + HashicorpCloudConsul20210204ClusterStateRUNNING HashicorpCloudConsul20210204ClusterState = "RUNNING" + + // HashicorpCloudConsul20210204ClusterStateFAILED captures enum value "FAILED" + HashicorpCloudConsul20210204ClusterStateFAILED HashicorpCloudConsul20210204ClusterState = "FAILED" + + // HashicorpCloudConsul20210204ClusterStateUPDATING captures enum value "UPDATING" + HashicorpCloudConsul20210204ClusterStateUPDATING HashicorpCloudConsul20210204ClusterState = "UPDATING" + + // HashicorpCloudConsul20210204ClusterStateRESTORING captures enum value "RESTORING" + HashicorpCloudConsul20210204ClusterStateRESTORING HashicorpCloudConsul20210204ClusterState = "RESTORING" + + // HashicorpCloudConsul20210204ClusterStateDELETING captures enum value "DELETING" + HashicorpCloudConsul20210204ClusterStateDELETING HashicorpCloudConsul20210204ClusterState = "DELETING" + + // HashicorpCloudConsul20210204ClusterStateDELETED captures enum value "DELETED" + HashicorpCloudConsul20210204ClusterStateDELETED HashicorpCloudConsul20210204ClusterState = "DELETED" +) + +// for schema +var hashicorpCloudConsul20210204ClusterStateEnum []interface{} + +func init() { + var res []HashicorpCloudConsul20210204ClusterState + if err := json.Unmarshal([]byte(`["UNSET","PENDING","CREATING","RUNNING","FAILED","UPDATING","RESTORING","DELETING","DELETED"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudConsul20210204ClusterStateEnum = append(hashicorpCloudConsul20210204ClusterStateEnum, v) + } +} + +func (m HashicorpCloudConsul20210204ClusterState) validateHashicorpCloudConsul20210204ClusterStateEnum(path, location string, value HashicorpCloudConsul20210204ClusterState) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudConsul20210204ClusterStateEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud consul 20210204 cluster state +func (m HashicorpCloudConsul20210204ClusterState) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudConsul20210204ClusterStateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_consul_config.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_consul_config.go new file mode 100644 index 00000000..b72dffc8 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_consul_config.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204ConsulConfig ConsulConfig exposes user settable configurations for a Consul cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.ConsulConfig +type HashicorpCloudConsul20210204ConsulConfig struct { + + // connect_enabled toggles Consul Connect on the Consul servers. + ConnectEnabled bool `json:"connect_enabled,omitempty"` + + // datacenter sets the datacenter the Consul servers will be running in. If + // not set, a default value will be used. + // + // https://www.consul.io/docs/agent/options.html#datacenter + Datacenter string `json:"datacenter,omitempty"` + + // primary contains a link to the primary consul cluster in a federation. + Primary *cloud.HashicorpCloudLocationLink `json:"primary,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 consul config +func (m *HashicorpCloudConsul20210204ConsulConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePrimary(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204ConsulConfig) validatePrimary(formats strfmt.Registry) error { + + if swag.IsZero(m.Primary) { // not required + return nil + } + + if m.Primary != nil { + if err := m.Primary.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("primary") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ConsulConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ConsulConfig) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ConsulConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_customer_master_acl_token_request.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_customer_master_acl_token_request.go new file mode 100644 index 00000000..87363873 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_customer_master_acl_token_request.go @@ -0,0 +1,75 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest CreateCustomerMasterACLTokenRequest is used to create a master token on a specific cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.CreateCustomerMasterACLTokenRequest +type HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest struct { + + // id is the ID of the cluster to create a token on. + ID string `json:"id,omitempty"` + + // location is the location of the cluster. + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 create customer master ACL token request +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest) validateLocation(formats strfmt.Registry) error { + + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204CreateCustomerMasterACLTokenRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_customer_master_acl_token_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_customer_master_acl_token_response.go new file mode 100644 index 00000000..e1070fec --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_customer_master_acl_token_response.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse CreateCustomerMasterACLTokenResponse contains the newly created customer master ACL token. +// +// swagger:model hashicorp.cloud.consul_20210204.CreateCustomerMasterACLTokenResponse +type HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse struct { + + // acl_token is the newly created master token. + ACLToken *HashicorpCloudConsul20210204ACLToken `json:"acl_token,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 create customer master ACL token response +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateACLToken(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse) validateACLToken(formats strfmt.Registry) error { + + if swag.IsZero(m.ACLToken) { // not required + return nil + } + + if m.ACLToken != nil { + if err := m.ACLToken.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("acl_token") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_request.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_request.go new file mode 100644 index 00000000..3fe7e181 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_request.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204CreateRequest hashicorp cloud consul 20210204 create request +// +// swagger:model hashicorp.cloud.consul_20210204.CreateRequest +type HashicorpCloudConsul20210204CreateRequest struct { + + // Cluster is the Consul Cluster to create. + Cluster *HashicorpCloudConsul20210204Cluster `json:"cluster,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 create request +func (m *HashicorpCloudConsul20210204CreateRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCluster(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204CreateRequest) validateCluster(formats strfmt.Registry) error { + + if swag.IsZero(m.Cluster) { // not required + return nil + } + + if m.Cluster != nil { + if err := m.Cluster.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cluster") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204CreateRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_response.go new file mode 100644 index 00000000..fe2ae1a0 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_response.go @@ -0,0 +1,97 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204CreateResponse hashicorp cloud consul 20210204 create response +// +// swagger:model hashicorp.cloud.consul_20210204.CreateResponse +type HashicorpCloudConsul20210204CreateResponse struct { + + // cluster is the newly created Consul cluster. + Cluster *HashicorpCloudConsul20210204Cluster `json:"cluster,omitempty"` + + // operation tracks the asynchronous creation of the Consul cluster. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 create response +func (m *HashicorpCloudConsul20210204CreateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCluster(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204CreateResponse) validateCluster(formats strfmt.Registry) error { + + if swag.IsZero(m.Cluster) { // not required + return nil + } + + if m.Cluster != nil { + if err := m.Cluster.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cluster") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204CreateResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204CreateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_snapshot_request.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_snapshot_request.go new file mode 100644 index 00000000..902217be --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_snapshot_request.go @@ -0,0 +1,75 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204CreateSnapshotRequest CreateSnapshotRequest is a request to create a new snapshot. +// +// swagger:model hashicorp.cloud.consul_20210204.CreateSnapshotRequest +type HashicorpCloudConsul20210204CreateSnapshotRequest struct { + + // name identifies the name of the snapshot. + Name string `json:"name,omitempty"` + + // resource identifies what resource to take a snapshot from. + Resource *cloud.HashicorpCloudLocationLink `json:"resource,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 create snapshot request +func (m *HashicorpCloudConsul20210204CreateSnapshotRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204CreateSnapshotRequest) validateResource(formats strfmt.Registry) error { + + if swag.IsZero(m.Resource) { // not required + return nil + } + + if m.Resource != nil { + if err := m.Resource.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resource") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateSnapshotRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateSnapshotRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204CreateSnapshotRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_snapshot_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_snapshot_response.go new file mode 100644 index 00000000..ceacb436 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_create_snapshot_response.go @@ -0,0 +1,75 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204CreateSnapshotResponse CreateSnapshotResponse is a response from creating a snapshot. +// +// swagger:model hashicorp.cloud.consul_20210204.CreateSnapshotResponse +type HashicorpCloudConsul20210204CreateSnapshotResponse struct { + + // operation represents the newly created snapshot. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` + + // snapshot_id is the identifer of the newly created snapshot. + SnapshotID string `json:"snapshot_id,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 create snapshot response +func (m *HashicorpCloudConsul20210204CreateSnapshotResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204CreateSnapshotResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateSnapshotResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204CreateSnapshotResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204CreateSnapshotResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_delete_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_delete_response.go new file mode 100644 index 00000000..8e1a68d6 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_delete_response.go @@ -0,0 +1,73 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204DeleteResponse hashicorp cloud consul 20210204 delete response +// +// swagger:model hashicorp.cloud.consul_20210204.DeleteResponse +type HashicorpCloudConsul20210204DeleteResponse struct { + + // operation is the operation used to track the deletion of the Consul + // cluster. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 delete response +func (m *HashicorpCloudConsul20210204DeleteResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204DeleteResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204DeleteResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204DeleteResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204DeleteResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_delete_snapshot_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_delete_snapshot_response.go new file mode 100644 index 00000000..cda262f2 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_delete_snapshot_response.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204DeleteSnapshotResponse DeleteSnapshotResponse is a response to deleting a snapshot. +// +// swagger:model hashicorp.cloud.consul_20210204.DeleteSnapshotResponse +type HashicorpCloudConsul20210204DeleteSnapshotResponse struct { + + // operation represents the deletion of the requested snapshot. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 delete snapshot response +func (m *HashicorpCloudConsul20210204DeleteSnapshotResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204DeleteSnapshotResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204DeleteSnapshotResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204DeleteSnapshotResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204DeleteSnapshotResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_client_config_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_client_config_response.go new file mode 100644 index 00000000..616a9b12 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_client_config_response.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204GetClientConfigResponse GetClientConfigResponse the client config files for a Consul agent. +// +// swagger:model hashicorp.cloud.consul_20210204.GetClientConfigResponse +type HashicorpCloudConsul20210204GetClientConfigResponse struct { + + // ca_file is the body of an intermediate certificate authority file. + // Format: byte + CaFile strfmt.Base64 `json:"ca_file,omitempty"` + + // consul_config_file is the body of JSON config file. + // Format: byte + ConsulConfigFile strfmt.Base64 `json:"consul_config_file,omitempty"` + + // file_bundle_zip is the contents of a zip archive containing the other + // two files, if the request specified it. + // Format: byte + FileBundleZip strfmt.Base64 `json:"file_bundle_zip,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 get client config response +func (m *HashicorpCloudConsul20210204GetClientConfigResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204GetClientConfigResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204GetClientConfigResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204GetClientConfigResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_response.go new file mode 100644 index 00000000..01711aaa --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_response.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204GetResponse hashicorp cloud consul 20210204 get response +// +// swagger:model hashicorp.cloud.consul_20210204.GetResponse +type HashicorpCloudConsul20210204GetResponse struct { + + // cluster is the retrieved Consul cluster. + Cluster *HashicorpCloudConsul20210204Cluster `json:"cluster,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 get response +func (m *HashicorpCloudConsul20210204GetResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCluster(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204GetResponse) validateCluster(formats strfmt.Registry) error { + + if swag.IsZero(m.Cluster) { // not required + return nil + } + + if m.Cluster != nil { + if err := m.Cluster.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cluster") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204GetResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204GetResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204GetResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_snapshot_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_snapshot_response.go new file mode 100644 index 00000000..85bd5329 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_get_snapshot_response.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204GetSnapshotResponse GetSnapshotResponse is a response for retrieving a snapshot's information. +// +// swagger:model hashicorp.cloud.consul_20210204.GetSnapshotResponse +type HashicorpCloudConsul20210204GetSnapshotResponse struct { + + // snapshot is the requested snapshot. + Snapshot *HashicorpCloudConsul20210204Snapshot `json:"snapshot,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 get snapshot response +func (m *HashicorpCloudConsul20210204GetSnapshotResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSnapshot(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204GetSnapshotResponse) validateSnapshot(formats strfmt.Registry) error { + + if swag.IsZero(m.Snapshot) { // not required + return nil + } + + if m.Snapshot != nil { + if err := m.Snapshot.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("snapshot") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204GetSnapshotResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204GetSnapshotResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204GetSnapshotResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_response.go new file mode 100644 index 00000000..f4d37890 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_response.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204ListResponse hashicorp cloud consul 20210204 list response +// +// swagger:model hashicorp.cloud.consul_20210204.ListResponse +type HashicorpCloudConsul20210204ListResponse struct { + + // clusters are the retrieved Consul clusters. + Clusters []*HashicorpCloudConsul20210204Cluster `json:"clusters"` + + // Pagination contains the pagination tokens for a subsequent request. + Pagination *cloud.HashicorpCloudCommonPaginationResponse `json:"pagination,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 list response +func (m *HashicorpCloudConsul20210204ListResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClusters(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePagination(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204ListResponse) validateClusters(formats strfmt.Registry) error { + + if swag.IsZero(m.Clusters) { // not required + return nil + } + + for i := 0; i < len(m.Clusters); i++ { + if swag.IsZero(m.Clusters[i]) { // not required + continue + } + + if m.Clusters[i] != nil { + if err := m.Clusters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clusters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HashicorpCloudConsul20210204ListResponse) validatePagination(formats strfmt.Registry) error { + + if swag.IsZero(m.Pagination) { // not required + return nil + } + + if m.Pagination != nil { + if err := m.Pagination.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pagination") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ListResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_snapshots_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_snapshots_response.go new file mode 100644 index 00000000..47795168 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_snapshots_response.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204ListSnapshotsResponse ListSnapshotsResponse is a response from listing snapshots. +// +// swagger:model hashicorp.cloud.consul_20210204.ListSnapshotsResponse +type HashicorpCloudConsul20210204ListSnapshotsResponse struct { + + // Pagination contains the pagination tokens for a subsequent request. + Pagination *cloud.HashicorpCloudCommonPaginationResponse `json:"pagination,omitempty"` + + // snapshots is a list of available snapshots. + Snapshots []*HashicorpCloudConsul20210204Snapshot `json:"snapshots"` +} + +// Validate validates this hashicorp cloud consul 20210204 list snapshots response +func (m *HashicorpCloudConsul20210204ListSnapshotsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePagination(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSnapshots(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204ListSnapshotsResponse) validatePagination(formats strfmt.Registry) error { + + if swag.IsZero(m.Pagination) { // not required + return nil + } + + if m.Pagination != nil { + if err := m.Pagination.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pagination") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204ListSnapshotsResponse) validateSnapshots(formats strfmt.Registry) error { + + if swag.IsZero(m.Snapshots) { // not required + return nil + } + + for i := 0; i < len(m.Snapshots); i++ { + if swag.IsZero(m.Snapshots[i]) { // not required + continue + } + + if m.Snapshots[i] != nil { + if err := m.Snapshots[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListSnapshotsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListSnapshotsResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ListSnapshotsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_upgrade_versions_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_upgrade_versions_response.go new file mode 100644 index 00000000..16ec5c9b --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_upgrade_versions_response.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204ListUpgradeVersionsResponse hashicorp cloud consul 20210204 list upgrade versions response +// +// swagger:model hashicorp.cloud.consul_20210204.ListUpgradeVersionsResponse +type HashicorpCloudConsul20210204ListUpgradeVersionsResponse struct { + + // versions + Versions []*HashicorpCloudConsul20210204Version `json:"versions"` +} + +// Validate validates this hashicorp cloud consul 20210204 list upgrade versions response +func (m *HashicorpCloudConsul20210204ListUpgradeVersionsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVersions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204ListUpgradeVersionsResponse) validateVersions(formats strfmt.Registry) error { + + if swag.IsZero(m.Versions) { // not required + return nil + } + + for i := 0; i < len(m.Versions); i++ { + if swag.IsZero(m.Versions[i]) { // not required + continue + } + + if m.Versions[i] != nil { + if err := m.Versions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListUpgradeVersionsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListUpgradeVersionsResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ListUpgradeVersionsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_versions_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_versions_response.go new file mode 100644 index 00000000..4183731d --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_list_versions_response.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204ListVersionsResponse hashicorp cloud consul 20210204 list versions response +// +// swagger:model hashicorp.cloud.consul_20210204.ListVersionsResponse +type HashicorpCloudConsul20210204ListVersionsResponse struct { + + // versions + Versions []*HashicorpCloudConsul20210204Version `json:"versions"` +} + +// Validate validates this hashicorp cloud consul 20210204 list versions response +func (m *HashicorpCloudConsul20210204ListVersionsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVersions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204ListVersionsResponse) validateVersions(formats strfmt.Registry) error { + + if swag.IsZero(m.Versions) { // not required + return nil + } + + for i := 0; i < len(m.Versions); i++ { + if swag.IsZero(m.Versions[i]) { // not required + continue + } + + if m.Versions[i] != nil { + if err := m.Versions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListVersionsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204ListVersionsResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204ListVersionsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_maintenance_config.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_maintenance_config.go new file mode 100644 index 00000000..af9de169 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_maintenance_config.go @@ -0,0 +1,12 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// HashicorpCloudConsul20210204MaintenanceConfig MaintenanceConfig configures when maintenance events should be taken on the +// Consul cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.MaintenanceConfig +type HashicorpCloudConsul20210204MaintenanceConfig interface{} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_network_config.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_network_config.go new file mode 100644 index 00000000..95dc1b81 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_network_config.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204NetworkConfig NetworkConfig configures the network of the Consul cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.NetworkConfig +type HashicorpCloudConsul20210204NetworkConfig struct { + + // network is the link of the HVN to launch the Consul cluster in. + // The network cannot be updated once the cluster is created. + Network *cloud.HashicorpCloudLocationLink `json:"network,omitempty"` + + // private indicates if this cluster's instances should be configured in a + // non-externally accessible way. + Private bool `json:"private,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 network config +func (m *HashicorpCloudConsul20210204NetworkConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetwork(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204NetworkConfig) validateNetwork(formats strfmt.Registry) error { + + if swag.IsZero(m.Network) { // not required + return nil + } + + if m.Network != nil { + if err := m.Network.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204NetworkConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204NetworkConfig) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204NetworkConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_restore_snapshot_request.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_restore_snapshot_request.go new file mode 100644 index 00000000..4517f40b --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_restore_snapshot_request.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204RestoreSnapshotRequest RestoreSnapshotRequest is a request to restore a snapshot to a cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.RestoreSnapshotRequest +type HashicorpCloudConsul20210204RestoreSnapshotRequest struct { + + // cluster_id represents the cluster to restore to. + ClusterID string `json:"cluster_id,omitempty"` + + // location specifies the location to the cluster is in. + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + + // snapshot represents the snapshot to restore. + Snapshot *cloud.HashicorpCloudLocationLink `json:"snapshot,omitempty"` + + // take_snapshot determines if a snapshot should be taken before performing a restore. + TakeSnapshot bool `json:"take_snapshot,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 restore snapshot request +func (m *HashicorpCloudConsul20210204RestoreSnapshotRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSnapshot(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204RestoreSnapshotRequest) validateLocation(formats strfmt.Registry) error { + + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204RestoreSnapshotRequest) validateSnapshot(formats strfmt.Registry) error { + + if swag.IsZero(m.Snapshot) { // not required + return nil + } + + if m.Snapshot != nil { + if err := m.Snapshot.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("snapshot") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204RestoreSnapshotRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204RestoreSnapshotRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204RestoreSnapshotRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_restore_snapshot_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_restore_snapshot_response.go new file mode 100644 index 00000000..1b11beb2 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_restore_snapshot_response.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204RestoreSnapshotResponse RestoreSnapshotResponse is a response to restoring a snapshot. +// +// swagger:model hashicorp.cloud.consul_20210204.RestoreSnapshotResponse +type HashicorpCloudConsul20210204RestoreSnapshotResponse struct { + + // operation represents the restore operation acting on the specified cluster. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 restore snapshot response +func (m *HashicorpCloudConsul20210204RestoreSnapshotResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204RestoreSnapshotResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204RestoreSnapshotResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204RestoreSnapshotResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204RestoreSnapshotResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot.go new file mode 100644 index 00000000..c6da04ce --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204Snapshot Snapshot is our representation needed to back-up a cluster. +// +// swagger:model hashicorp.cloud.consul_20210204.Snapshot +type HashicorpCloudConsul20210204Snapshot struct { + + // created_at is the time that this snapshot was requested. + // Format: date-time + CreatedAt strfmt.DateTime `json:"created_at,omitempty"` + + // finished_at is the time that this snapshot was finished. + // Format: date-time + FinishedAt strfmt.DateTime `json:"finished_at,omitempty"` + + // id is the snapshot’s ID. + ID string `json:"id,omitempty"` + + // location is the snapshot’s location. + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + + // meta is the snapshot metadata. + Meta *HashicorpCloudConsul20210204SnapshotSnapshotMeta `json:"meta,omitempty"` + + // name is the name of the snapshot. + Name string `json:"name,omitempty"` + + // resource is the resource the snapshot was taken from. + Resource *cloud.HashicorpCloudLocationLink `json:"resource,omitempty"` + + // running_operation_id is the ID of an operation performing work related to the current state of the snapshot. + RunningOperationID string `json:"running_operation_id,omitempty"` + + // self_link is a link referring to this snapshot. + SelfLink *cloud.HashicorpCloudLocationLink `json:"self_link,omitempty"` + + // state represents the current status for this snapshot. + State HashicorpCloudConsul20210204SnapshotSnapshotState `json:"state,omitempty"` + + // type represents the type of this snapshot. + Type HashicorpCloudConsul20210204SnapshotSnapshotType `json:"type,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 snapshot +func (m *HashicorpCloudConsul20210204Snapshot) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFinishedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMeta(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSelfLink(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateCreatedAt(formats strfmt.Registry) error { + + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateFinishedAt(formats strfmt.Registry) error { + + if swag.IsZero(m.FinishedAt) { // not required + return nil + } + + if err := validate.FormatOf("finished_at", "body", "date-time", m.FinishedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateLocation(formats strfmt.Registry) error { + + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateMeta(formats strfmt.Registry) error { + + if swag.IsZero(m.Meta) { // not required + return nil + } + + if m.Meta != nil { + if err := m.Meta.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateResource(formats strfmt.Registry) error { + + if swag.IsZero(m.Resource) { // not required + return nil + } + + if m.Resource != nil { + if err := m.Resource.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resource") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateSelfLink(formats strfmt.Registry) error { + + if swag.IsZero(m.SelfLink) { // not required + return nil + } + + if m.SelfLink != nil { + if err := m.SelfLink.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("self_link") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateState(formats strfmt.Registry) error { + + if swag.IsZero(m.State) { // not required + return nil + } + + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } + return err + } + + return nil +} + +func (m *HashicorpCloudConsul20210204Snapshot) validateType(formats strfmt.Registry) error { + + if swag.IsZero(m.Type) { // not required + return nil + } + + if err := m.Type.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("type") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204Snapshot) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204Snapshot) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204Snapshot + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_config.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_config.go new file mode 100644 index 00000000..bcdf0453 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_config.go @@ -0,0 +1,12 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// HashicorpCloudConsul20210204SnapshotConfig SnapshotConfig configures how often cluster snapshot should be taken and how +// long they should be retained. +// +// swagger:model hashicorp.cloud.consul_20210204.SnapshotConfig +type HashicorpCloudConsul20210204SnapshotConfig interface{} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_meta.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_meta.go new file mode 100644 index 00000000..53d3fb16 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_meta.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// HashicorpCloudConsul20210204SnapshotSnapshotMeta hashicorp cloud consul 20210204 snapshot snapshot meta +// +// swagger:model hashicorp.cloud.consul_20210204.Snapshot.SnapshotMeta +type HashicorpCloudConsul20210204SnapshotSnapshotMeta struct { + + // additional_meta contains additional metadata of the snapshot. + AdditionalMeta map[string]string `json:"additional_meta,omitempty"` + + // product_version is the version of the product of the cluster at creation. + ProductVersion string `json:"product_version,omitempty"` + + // restored_at notes the time that this snapshot was restored. + // Format: date-time + RestoredAt strfmt.DateTime `json:"restored_at,omitempty"` + + // size is the size of the snapshot in bytes. + Size string `json:"size,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 snapshot snapshot meta +func (m *HashicorpCloudConsul20210204SnapshotSnapshotMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRestoredAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204SnapshotSnapshotMeta) validateRestoredAt(formats strfmt.Registry) error { + + if swag.IsZero(m.RestoredAt) { // not required + return nil + } + + if err := validate.FormatOf("restored_at", "body", "date-time", m.RestoredAt.String(), formats); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204SnapshotSnapshotMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204SnapshotSnapshotMeta) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204SnapshotSnapshotMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_state.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_state.go new file mode 100644 index 00000000..bb0ecff9 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_state.go @@ -0,0 +1,91 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudConsul20210204SnapshotSnapshotState SnapshotState represents the different states a snapshot can be in. +// +// - QUEUED: QUEUED is used for snapshots that haven’t started and are waiting for a cluster operation to finish before starting. +// - CREATING: CREATING is used for snapshots that are creating. +// - CREATING_FAILED: CREATING_FAILED is used for snapshots that failed creating. +// - READY: READY is used for snapshots that are ready to be restored. +// - DELETING: DELETING is used for snapshots that are deleting. +// - DELETING_FAILED: DELETING_FAILED is used for snapshots that failed deleting. +// - RESTORING: RESTORING is used for snapshots that are being restored. +// +// Progress can be tracked using cluster operations. +// +// swagger:model hashicorp.cloud.consul_20210204.Snapshot.SnapshotState +type HashicorpCloudConsul20210204SnapshotSnapshotState string + +const ( + + // HashicorpCloudConsul20210204SnapshotSnapshotStateSTATEUNSET captures enum value "STATE_UNSET" + HashicorpCloudConsul20210204SnapshotSnapshotStateSTATEUNSET HashicorpCloudConsul20210204SnapshotSnapshotState = "STATE_UNSET" + + // HashicorpCloudConsul20210204SnapshotSnapshotStateQUEUED captures enum value "QUEUED" + HashicorpCloudConsul20210204SnapshotSnapshotStateQUEUED HashicorpCloudConsul20210204SnapshotSnapshotState = "QUEUED" + + // HashicorpCloudConsul20210204SnapshotSnapshotStateCREATING captures enum value "CREATING" + HashicorpCloudConsul20210204SnapshotSnapshotStateCREATING HashicorpCloudConsul20210204SnapshotSnapshotState = "CREATING" + + // HashicorpCloudConsul20210204SnapshotSnapshotStateCREATINGFAILED captures enum value "CREATING_FAILED" + HashicorpCloudConsul20210204SnapshotSnapshotStateCREATINGFAILED HashicorpCloudConsul20210204SnapshotSnapshotState = "CREATING_FAILED" + + // HashicorpCloudConsul20210204SnapshotSnapshotStateREADY captures enum value "READY" + HashicorpCloudConsul20210204SnapshotSnapshotStateREADY HashicorpCloudConsul20210204SnapshotSnapshotState = "READY" + + // HashicorpCloudConsul20210204SnapshotSnapshotStateDELETING captures enum value "DELETING" + HashicorpCloudConsul20210204SnapshotSnapshotStateDELETING HashicorpCloudConsul20210204SnapshotSnapshotState = "DELETING" + + // HashicorpCloudConsul20210204SnapshotSnapshotStateDELETINGFAILED captures enum value "DELETING_FAILED" + HashicorpCloudConsul20210204SnapshotSnapshotStateDELETINGFAILED HashicorpCloudConsul20210204SnapshotSnapshotState = "DELETING_FAILED" + + // HashicorpCloudConsul20210204SnapshotSnapshotStateRESTORING captures enum value "RESTORING" + HashicorpCloudConsul20210204SnapshotSnapshotStateRESTORING HashicorpCloudConsul20210204SnapshotSnapshotState = "RESTORING" +) + +// for schema +var hashicorpCloudConsul20210204SnapshotSnapshotStateEnum []interface{} + +func init() { + var res []HashicorpCloudConsul20210204SnapshotSnapshotState + if err := json.Unmarshal([]byte(`["STATE_UNSET","QUEUED","CREATING","CREATING_FAILED","READY","DELETING","DELETING_FAILED","RESTORING"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudConsul20210204SnapshotSnapshotStateEnum = append(hashicorpCloudConsul20210204SnapshotSnapshotStateEnum, v) + } +} + +func (m HashicorpCloudConsul20210204SnapshotSnapshotState) validateHashicorpCloudConsul20210204SnapshotSnapshotStateEnum(path, location string, value HashicorpCloudConsul20210204SnapshotSnapshotState) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudConsul20210204SnapshotSnapshotStateEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud consul 20210204 snapshot snapshot state +func (m HashicorpCloudConsul20210204SnapshotSnapshotState) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudConsul20210204SnapshotSnapshotStateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_type.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_type.go new file mode 100644 index 00000000..25ad0f83 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_snapshot_snapshot_type.go @@ -0,0 +1,73 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudConsul20210204SnapshotSnapshotType SnapshotType represents the type of a snapshot. +// +// - AUTOMATIC: AUTOMATIC is used for snapshots generated automatically, like a snapshot before update. +// - MANUAL: MANUAL is used for snapshots that are initiated by a user's actions. +// - SCHEDULED: SCHEDULED is used for snapshots that are generated based on a schedule. +// +// swagger:model hashicorp.cloud.consul_20210204.Snapshot.SnapshotType +type HashicorpCloudConsul20210204SnapshotSnapshotType string + +const ( + + // HashicorpCloudConsul20210204SnapshotSnapshotTypeTYPEUNSET captures enum value "TYPE_UNSET" + HashicorpCloudConsul20210204SnapshotSnapshotTypeTYPEUNSET HashicorpCloudConsul20210204SnapshotSnapshotType = "TYPE_UNSET" + + // HashicorpCloudConsul20210204SnapshotSnapshotTypeAUTOMATIC captures enum value "AUTOMATIC" + HashicorpCloudConsul20210204SnapshotSnapshotTypeAUTOMATIC HashicorpCloudConsul20210204SnapshotSnapshotType = "AUTOMATIC" + + // HashicorpCloudConsul20210204SnapshotSnapshotTypeMANUAL captures enum value "MANUAL" + HashicorpCloudConsul20210204SnapshotSnapshotTypeMANUAL HashicorpCloudConsul20210204SnapshotSnapshotType = "MANUAL" + + // HashicorpCloudConsul20210204SnapshotSnapshotTypeSCHEDULED captures enum value "SCHEDULED" + HashicorpCloudConsul20210204SnapshotSnapshotTypeSCHEDULED HashicorpCloudConsul20210204SnapshotSnapshotType = "SCHEDULED" +) + +// for schema +var hashicorpCloudConsul20210204SnapshotSnapshotTypeEnum []interface{} + +func init() { + var res []HashicorpCloudConsul20210204SnapshotSnapshotType + if err := json.Unmarshal([]byte(`["TYPE_UNSET","AUTOMATIC","MANUAL","SCHEDULED"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudConsul20210204SnapshotSnapshotTypeEnum = append(hashicorpCloudConsul20210204SnapshotSnapshotTypeEnum, v) + } +} + +func (m HashicorpCloudConsul20210204SnapshotSnapshotType) validateHashicorpCloudConsul20210204SnapshotSnapshotTypeEnum(path, location string, value HashicorpCloudConsul20210204SnapshotSnapshotType) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudConsul20210204SnapshotSnapshotTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud consul 20210204 snapshot snapshot type +func (m HashicorpCloudConsul20210204SnapshotSnapshotType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudConsul20210204SnapshotSnapshotTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_update_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_update_response.go new file mode 100644 index 00000000..c9b43e6e --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_update_response.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudConsul20210204UpdateResponse hashicorp cloud consul 20210204 update response +// +// swagger:model hashicorp.cloud.consul_20210204.UpdateResponse +type HashicorpCloudConsul20210204UpdateResponse struct { + + // operation is used to track the progress of the asynchronous update. + // Depending on what was updated in the configuration the update may + // require deploying new server nodes which may take some time to complete. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 update response +func (m *HashicorpCloudConsul20210204UpdateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204UpdateResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204UpdateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204UpdateResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204UpdateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_update_snapshot_response.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_update_snapshot_response.go new file mode 100644 index 00000000..27676082 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_update_snapshot_response.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204UpdateSnapshotResponse UpdateSnapshotResponse is a response to updating a snapshot. +// +// swagger:model hashicorp.cloud.consul_20210204.UpdateSnapshotResponse +type HashicorpCloudConsul20210204UpdateSnapshotResponse struct { + + // snapshot is the updated snapshot. + Snapshot *HashicorpCloudConsul20210204Snapshot `json:"snapshot,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 update snapshot response +func (m *HashicorpCloudConsul20210204UpdateSnapshotResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSnapshot(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204UpdateSnapshotResponse) validateSnapshot(formats strfmt.Registry) error { + + if swag.IsZero(m.Snapshot) { // not required + return nil + } + + if m.Snapshot != nil { + if err := m.Snapshot.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("snapshot") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204UpdateSnapshotResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204UpdateSnapshotResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204UpdateSnapshotResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_version.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_version.go new file mode 100644 index 00000000..00a00d5a --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_version.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudConsul20210204Version hashicorp cloud consul 20210204 version +// +// swagger:model hashicorp.cloud.consul_20210204.Version +type HashicorpCloudConsul20210204Version struct { + + // status defines the version availability. + Status HashicorpCloudConsul20210204VersionStatus `json:"status,omitempty"` + + // version is the string representation of the Consul version. + Version string `json:"version,omitempty"` +} + +// Validate validates this hashicorp cloud consul 20210204 version +func (m *HashicorpCloudConsul20210204Version) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudConsul20210204Version) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status) { // not required + return nil + } + + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204Version) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudConsul20210204Version) UnmarshalBinary(b []byte) error { + var res HashicorpCloudConsul20210204Version + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_version_status.go b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_version_status.go new file mode 100644 index 00000000..5006b150 --- /dev/null +++ b/clients/cloud-consul-service/preview/2021-02-04/models/hashicorp_cloud_consul20210204_version_status.go @@ -0,0 +1,70 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudConsul20210204VersionStatus - AVAILABLE: AVAILABLE represents a version that is generally available +// but no longer the preferred/recommended version. +// - RECOMMENDED: RECOMMENDED represents a version that is generally available +// and recommended by HashiCorp. +// - PREVIEW: PREVIEW represents a version that is not generally available. +// +// swagger:model hashicorp.cloud.consul_20210204.Version.Status +type HashicorpCloudConsul20210204VersionStatus string + +const ( + + // HashicorpCloudConsul20210204VersionStatusAVAILABLE captures enum value "AVAILABLE" + HashicorpCloudConsul20210204VersionStatusAVAILABLE HashicorpCloudConsul20210204VersionStatus = "AVAILABLE" + + // HashicorpCloudConsul20210204VersionStatusRECOMMENDED captures enum value "RECOMMENDED" + HashicorpCloudConsul20210204VersionStatusRECOMMENDED HashicorpCloudConsul20210204VersionStatus = "RECOMMENDED" + + // HashicorpCloudConsul20210204VersionStatusPREVIEW captures enum value "PREVIEW" + HashicorpCloudConsul20210204VersionStatusPREVIEW HashicorpCloudConsul20210204VersionStatus = "PREVIEW" +) + +// for schema +var hashicorpCloudConsul20210204VersionStatusEnum []interface{} + +func init() { + var res []HashicorpCloudConsul20210204VersionStatus + if err := json.Unmarshal([]byte(`["AVAILABLE","RECOMMENDED","PREVIEW"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudConsul20210204VersionStatusEnum = append(hashicorpCloudConsul20210204VersionStatusEnum, v) + } +} + +func (m HashicorpCloudConsul20210204VersionStatus) validateHashicorpCloudConsul20210204VersionStatusEnum(path, location string, value HashicorpCloudConsul20210204VersionStatus) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudConsul20210204VersionStatusEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud consul 20210204 version status +func (m HashicorpCloudConsul20210204VersionStatus) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudConsul20210204VersionStatusEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +}