diff --git a/README.md b/README.md index 60d10003..f99683c4 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,11 @@ Once the service principal is created, navigate to its detail page by selecting Set the client ID and secret as the environment variables HCP_CLIENT_ID and HCP_CLIENT_SECRET. +``` +export HCP_CLIENT_ID="service-principal-key-client-id" +export HCP_CLIENT_SECRET="service-principal-key-client-secret" +``` + ## Usage Import the desired version of each service SDK. diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/cloud_consul_service_client.go b/clients/cloud-consul-service/preview/2020-08-26/client/cloud_consul_service_client.go index b0838826..4a670ddc 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/cloud_consul_service_client.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/cloud_consul_service_client.go @@ -26,7 +26,7 @@ const ( ) // DefaultSchemes are the default schemes found in Meta (info) section of spec file -var DefaultSchemes = []string{"http", "https"} +var DefaultSchemes = []string{"http"} // NewHTTPClient creates a new cloud consul service HTTP client. func NewHTTPClient(formats strfmt.Registry) *CloudConsulService { diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_client.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_client.go index ac01f843..3b871e40 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_client.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_client.go @@ -6,8 +6,6 @@ package consul_service // Editing this file might prove futile when you re-run the swagger generate command import ( - "fmt" - "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" ) @@ -27,59 +25,59 @@ type Client struct { // ClientService is the interface for Client methods type ClientService interface { - Create(params *CreateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateOK, error) + ConsulServiceCreate(params *ConsulServiceCreateParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceCreateOK, error) - CreateCustomerMasterACLToken(params *CreateCustomerMasterACLTokenParams, authInfo runtime.ClientAuthInfoWriter) (*CreateCustomerMasterACLTokenOK, error) + ConsulServiceCreateCustomerMasterACLToken(params *ConsulServiceCreateCustomerMasterACLTokenParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceCreateCustomerMasterACLTokenOK, error) - CreateSnapshot(params *CreateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSnapshotOK, error) + ConsulServiceCreateSnapshot(params *ConsulServiceCreateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceCreateSnapshotOK, error) - Delete(params *DeleteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteOK, error) + ConsulServiceDelete(params *ConsulServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceDeleteOK, error) - DeleteSnapshot(params *DeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSnapshotOK, error) + ConsulServiceDeleteSnapshot(params *ConsulServiceDeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceDeleteSnapshotOK, error) - Get(params *GetParams, authInfo runtime.ClientAuthInfoWriter) (*GetOK, error) + ConsulServiceGet(params *ConsulServiceGetParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceGetOK, error) - GetClientConfig(params *GetClientConfigParams, authInfo runtime.ClientAuthInfoWriter) (*GetClientConfigOK, error) + ConsulServiceGetClientConfig(params *ConsulServiceGetClientConfigParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceGetClientConfigOK, error) - GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*GetSnapshotOK, error) + ConsulServiceGetSnapshot(params *ConsulServiceGetSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceGetSnapshotOK, error) - List(params *ListParams, authInfo runtime.ClientAuthInfoWriter) (*ListOK, error) + ConsulServiceList(params *ConsulServiceListParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListOK, error) - ListSnapshots(params *ListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter) (*ListSnapshotsOK, error) + ConsulServiceListSnapshots(params *ConsulServiceListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListSnapshotsOK, error) - ListUpgradeVersions(params *ListUpgradeVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ListUpgradeVersionsOK, error) + ConsulServiceListUpgradeVersions(params *ConsulServiceListUpgradeVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListUpgradeVersionsOK, error) - ListVersions(params *ListVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ListVersionsOK, error) + ConsulServiceListVersions(params *ConsulServiceListVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListVersionsOK, error) - ListVersions2(params *ListVersions2Params, authInfo runtime.ClientAuthInfoWriter) (*ListVersions2OK, error) + ConsulServiceListVersions2(params *ConsulServiceListVersions2Params, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListVersions2OK, error) - RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*RestoreSnapshotOK, error) + ConsulServiceRestoreSnapshot(params *ConsulServiceRestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceRestoreSnapshotOK, error) - Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOK, error) + ConsulServiceUpdate(params *ConsulServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceUpdateOK, error) - UpdateSnapshot(params *UpdateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateSnapshotOK, error) + ConsulServiceUpdateSnapshot(params *ConsulServiceUpdateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceUpdateSnapshotOK, error) SetTransport(transport runtime.ClientTransport) } /* - Create creates creates a new h c p consul cluster + ConsulServiceCreate creates creates a new h c p consul cluster */ -func (a *Client) Create(params *CreateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateOK, error) { +func (a *Client) ConsulServiceCreate(params *ConsulServiceCreateParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceCreateOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewCreateParams() + params = NewConsulServiceCreateParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "Create", + ID: "ConsulService_Create", Method: "POST", PathPattern: "/consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &CreateReader{formats: a.formats}, + Reader: &ConsulServiceCreateReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -87,34 +85,33 @@ func (a *Client) Create(params *CreateParams, authInfo runtime.ClientAuthInfoWri if err != nil { return nil, err } - success, ok := result.(*CreateOK) + success, ok := result.(*ConsulServiceCreateOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for Create: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceCreateDefault) + 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 + ConsulServiceCreateCustomerMasterACLToken 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) { +func (a *Client) ConsulServiceCreateCustomerMasterACLToken(params *ConsulServiceCreateCustomerMasterACLTokenParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceCreateCustomerMasterACLTokenOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewCreateCustomerMasterACLTokenParams() + params = NewConsulServiceCreateCustomerMasterACLTokenParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "CreateCustomerMasterACLToken", + ID: "ConsulService_CreateCustomerMasterACLToken", Method: "POST", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/master-acl-tokens", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &CreateCustomerMasterACLTokenReader{formats: a.formats}, + Reader: &ConsulServiceCreateCustomerMasterACLTokenReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -122,34 +119,33 @@ func (a *Client) CreateCustomerMasterACLToken(params *CreateCustomerMasterACLTok if err != nil { return nil, err } - success, ok := result.(*CreateCustomerMasterACLTokenOK) + success, ok := result.(*ConsulServiceCreateCustomerMasterACLTokenOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for CreateCustomerMasterACLToken: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceCreateCustomerMasterACLTokenDefault) + 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 + ConsulServiceCreateSnapshot creates snapshot takes a new snapshot asynchronously */ -func (a *Client) CreateSnapshot(params *CreateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*CreateSnapshotOK, error) { +func (a *Client) ConsulServiceCreateSnapshot(params *ConsulServiceCreateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceCreateSnapshotOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewCreateSnapshotParams() + params = NewConsulServiceCreateSnapshotParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "CreateSnapshot", + ID: "ConsulService_CreateSnapshot", Method: "POST", PathPattern: "/consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &CreateSnapshotReader{formats: a.formats}, + Reader: &ConsulServiceCreateSnapshotReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -157,34 +153,33 @@ func (a *Client) CreateSnapshot(params *CreateSnapshotParams, authInfo runtime.C if err != nil { return nil, err } - success, ok := result.(*CreateSnapshotOK) + success, ok := result.(*ConsulServiceCreateSnapshotOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for CreateSnapshot: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceCreateSnapshotDefault) + 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 + ConsulServiceDelete deletes deletes the specified h c p consul cluster */ -func (a *Client) Delete(params *DeleteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteOK, error) { +func (a *Client) ConsulServiceDelete(params *ConsulServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceDeleteOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewDeleteParams() + params = NewConsulServiceDeleteParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "Delete", + ID: "ConsulService_Delete", Method: "DELETE", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &DeleteReader{formats: a.formats}, + Reader: &ConsulServiceDeleteReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -192,34 +187,33 @@ func (a *Client) Delete(params *DeleteParams, authInfo runtime.ClientAuthInfoWri if err != nil { return nil, err } - success, ok := result.(*DeleteOK) + success, ok := result.(*ConsulServiceDeleteOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for Delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceDeleteDefault) + 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 + ConsulServiceDeleteSnapshot deletes snapshot removes the snapshot from storage asynchronously */ -func (a *Client) DeleteSnapshot(params *DeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteSnapshotOK, error) { +func (a *Client) ConsulServiceDeleteSnapshot(params *ConsulServiceDeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceDeleteSnapshotOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewDeleteSnapshotParams() + params = NewConsulServiceDeleteSnapshotParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "DeleteSnapshot", + ID: "ConsulService_DeleteSnapshot", Method: "DELETE", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &DeleteSnapshotReader{formats: a.formats}, + Reader: &ConsulServiceDeleteSnapshotReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -227,34 +221,33 @@ func (a *Client) DeleteSnapshot(params *DeleteSnapshotParams, authInfo runtime.C if err != nil { return nil, err } - success, ok := result.(*DeleteSnapshotOK) + success, ok := result.(*ConsulServiceDeleteSnapshotOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for DeleteSnapshot: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceDeleteSnapshotDefault) + 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 + ConsulServiceGet gets reads a single h c p consul cluster */ -func (a *Client) Get(params *GetParams, authInfo runtime.ClientAuthInfoWriter) (*GetOK, error) { +func (a *Client) ConsulServiceGet(params *ConsulServiceGetParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceGetOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetParams() + params = NewConsulServiceGetParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "Get", + ID: "ConsulService_Get", Method: "GET", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &GetReader{formats: a.formats}, + Reader: &ConsulServiceGetReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -262,34 +255,33 @@ func (a *Client) Get(params *GetParams, authInfo runtime.ClientAuthInfoWriter) ( if err != nil { return nil, err } - success, ok := result.(*GetOK) + success, ok := result.(*ConsulServiceGetOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceGetDefault) + 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 + ConsulServiceGetClientConfig 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) { +func (a *Client) ConsulServiceGetClientConfig(params *ConsulServiceGetClientConfigParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceGetClientConfigOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetClientConfigParams() + params = NewConsulServiceGetClientConfigParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetClientConfig", + ID: "ConsulService_GetClientConfig", Method: "GET", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/client-config", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &GetClientConfigReader{formats: a.formats}, + Reader: &ConsulServiceGetClientConfigReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -297,34 +289,33 @@ func (a *Client) GetClientConfig(params *GetClientConfigParams, authInfo runtime if err != nil { return nil, err } - success, ok := result.(*GetClientConfigOK) + success, ok := result.(*ConsulServiceGetClientConfigOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetClientConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceGetClientConfigDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* - GetSnapshot gets snapshot retrieves an existing snapshot + ConsulServiceGetSnapshot gets snapshot retrieves an existing snapshot */ -func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*GetSnapshotOK, error) { +func (a *Client) ConsulServiceGetSnapshot(params *ConsulServiceGetSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceGetSnapshotOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetSnapshotParams() + params = NewConsulServiceGetSnapshotParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetSnapshot", + ID: "ConsulService_GetSnapshot", Method: "GET", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &GetSnapshotReader{formats: a.formats}, + Reader: &ConsulServiceGetSnapshotReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -332,34 +323,33 @@ func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientA if err != nil { return nil, err } - success, ok := result.(*GetSnapshotOK) + success, ok := result.(*ConsulServiceGetSnapshotOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for GetSnapshot: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceGetSnapshotDefault) + 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 + ConsulServiceList lists lists all h c p consul clusters */ -func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter) (*ListOK, error) { +func (a *Client) ConsulServiceList(params *ConsulServiceListParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewListParams() + params = NewConsulServiceListParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "List", + ID: "ConsulService_List", Method: "GET", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &ListReader{formats: a.formats}, + Reader: &ConsulServiceListReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -367,34 +357,33 @@ func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter) if err != nil { return nil, err } - success, ok := result.(*ListOK) + success, ok := result.(*ConsulServiceListOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for List: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceListDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* - ListSnapshots lists snapshots lists snapshots + ConsulServiceListSnapshots lists snapshots lists snapshots */ -func (a *Client) ListSnapshots(params *ListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter) (*ListSnapshotsOK, error) { +func (a *Client) ConsulServiceListSnapshots(params *ConsulServiceListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListSnapshotsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewListSnapshotsParams() + params = NewConsulServiceListSnapshotsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "ListSnapshots", + ID: "ConsulService_ListSnapshots", Method: "GET", PathPattern: "/consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &ListSnapshotsReader{formats: a.formats}, + Reader: &ConsulServiceListSnapshotsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -402,34 +391,33 @@ func (a *Client) ListSnapshots(params *ListSnapshotsParams, authInfo runtime.Cli if err != nil { return nil, err } - success, ok := result.(*ListSnapshotsOK) + success, ok := result.(*ConsulServiceListSnapshotsOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for ListSnapshots: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceListSnapshotsDefault) + 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 + ConsulServiceListUpgradeVersions 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) { +func (a *Client) ConsulServiceListUpgradeVersions(params *ConsulServiceListUpgradeVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListUpgradeVersionsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewListUpgradeVersionsParams() + params = NewConsulServiceListUpgradeVersionsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "ListUpgradeVersions", + ID: "ConsulService_ListUpgradeVersions", Method: "GET", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/upgrade-versions", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &ListUpgradeVersionsReader{formats: a.formats}, + Reader: &ConsulServiceListUpgradeVersionsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -437,34 +425,33 @@ func (a *Client) ListUpgradeVersions(params *ListUpgradeVersionsParams, authInfo if err != nil { return nil, err } - success, ok := result.(*ListUpgradeVersionsOK) + success, ok := result.(*ConsulServiceListUpgradeVersionsOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for ListUpgradeVersions: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceListUpgradeVersionsDefault) + 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 + ConsulServiceListVersions lists versions returns the versions available for this org and project */ -func (a *Client) ListVersions(params *ListVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ListVersionsOK, error) { +func (a *Client) ConsulServiceListVersions(params *ConsulServiceListVersionsParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListVersionsOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewListVersionsParams() + params = NewConsulServiceListVersionsParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "ListVersions", + ID: "ConsulService_ListVersions", Method: "GET", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/versions", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &ListVersionsReader{formats: a.formats}, + Reader: &ConsulServiceListVersionsReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -472,34 +459,33 @@ func (a *Client) ListVersions(params *ListVersionsParams, authInfo runtime.Clien if err != nil { return nil, err } - success, ok := result.(*ListVersionsOK) + success, ok := result.(*ConsulServiceListVersionsOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for ListVersions: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceListVersionsDefault) + 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 + ConsulServiceListVersions2 lists versions returns the versions available for this org and project */ -func (a *Client) ListVersions2(params *ListVersions2Params, authInfo runtime.ClientAuthInfoWriter) (*ListVersions2OK, error) { +func (a *Client) ConsulServiceListVersions2(params *ConsulServiceListVersions2Params, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceListVersions2OK, error) { // TODO: Validate the params before sending if params == nil { - params = NewListVersions2Params() + params = NewConsulServiceListVersions2Params() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "ListVersions2", + ID: "ConsulService_ListVersions2", Method: "GET", PathPattern: "/consul/2020-08-26/versions", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &ListVersions2Reader{formats: a.formats}, + Reader: &ConsulServiceListVersions2Reader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -507,34 +493,33 @@ func (a *Client) ListVersions2(params *ListVersions2Params, authInfo runtime.Cli if err != nil { return nil, err } - success, ok := result.(*ListVersions2OK) + success, ok := result.(*ConsulServiceListVersions2OK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for ListVersions2: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceListVersions2Default) + 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 + ConsulServiceRestoreSnapshot restores snapshot restores a snapshot on a given cluster asynchronously */ -func (a *Client) RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*RestoreSnapshotOK, error) { +func (a *Client) ConsulServiceRestoreSnapshot(params *ConsulServiceRestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceRestoreSnapshotOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewRestoreSnapshotParams() + params = NewConsulServiceRestoreSnapshotParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "RestoreSnapshot", + ID: "ConsulService_RestoreSnapshot", Method: "POST", PathPattern: "/consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/restore", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &RestoreSnapshotReader{formats: a.formats}, + Reader: &ConsulServiceRestoreSnapshotReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -542,34 +527,33 @@ func (a *Client) RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime if err != nil { return nil, err } - success, ok := result.(*RestoreSnapshotOK) + success, ok := result.(*ConsulServiceRestoreSnapshotOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for RestoreSnapshot: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceRestoreSnapshotDefault) + 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 + ConsulServiceUpdate updates updates the properties of an existing h c p consul cluster */ -func (a *Client) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOK, error) { +func (a *Client) ConsulServiceUpdate(params *ConsulServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceUpdateOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewUpdateParams() + params = NewConsulServiceUpdateParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "Update", + ID: "ConsulService_Update", Method: "PATCH", PathPattern: "/consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters/{cluster.id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &UpdateReader{formats: a.formats}, + Reader: &ConsulServiceUpdateReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -577,36 +561,35 @@ func (a *Client) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWri if err != nil { return nil, err } - success, ok := result.(*UpdateOK) + success, ok := result.(*ConsulServiceUpdateOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for Update: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceUpdateDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* - UpdateSnapshot updates snapshot updates an existing snapshot + ConsulServiceUpdateSnapshot 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) { +func (a *Client) ConsulServiceUpdateSnapshot(params *ConsulServiceUpdateSnapshotParams, authInfo runtime.ClientAuthInfoWriter) (*ConsulServiceUpdateSnapshotOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewUpdateSnapshotParams() + params = NewConsulServiceUpdateSnapshotParams() } result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "UpdateSnapshot", + ID: "ConsulService_UpdateSnapshot", Method: "PATCH", PathPattern: "/consul/2020-08-26/organizations/{snapshot.location.organization_id}/projects/{snapshot.location.project_id}/snapshots/{snapshot.id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http", "https"}, + Schemes: []string{"http"}, Params: params, - Reader: &UpdateSnapshotReader{formats: a.formats}, + Reader: &ConsulServiceUpdateSnapshotReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -614,14 +597,13 @@ func (a *Client) UpdateSnapshot(params *UpdateSnapshotParams, authInfo runtime.C if err != nil { return nil, err } - success, ok := result.(*UpdateSnapshotOK) + success, ok := result.(*ConsulServiceUpdateSnapshotOK) if ok { return success, nil } // unexpected success response - // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for UpdateSnapshot: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) + unexpectedSuccess := result.(*ConsulServiceUpdateSnapshotDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } // SetTransport changes the transport on the client diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_create_customer_master_acl_token_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_create_customer_master_acl_token_parameters.go new file mode 100644 index 00000000..137b97ae --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// NewConsulServiceCreateCustomerMasterACLTokenParams creates a new ConsulServiceCreateCustomerMasterACLTokenParams object +// with the default values initialized. +func NewConsulServiceCreateCustomerMasterACLTokenParams() *ConsulServiceCreateCustomerMasterACLTokenParams { + var () + return &ConsulServiceCreateCustomerMasterACLTokenParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceCreateCustomerMasterACLTokenParamsWithTimeout creates a new ConsulServiceCreateCustomerMasterACLTokenParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceCreateCustomerMasterACLTokenParamsWithTimeout(timeout time.Duration) *ConsulServiceCreateCustomerMasterACLTokenParams { + var () + return &ConsulServiceCreateCustomerMasterACLTokenParams{ + + timeout: timeout, + } +} + +// NewConsulServiceCreateCustomerMasterACLTokenParamsWithContext creates a new ConsulServiceCreateCustomerMasterACLTokenParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceCreateCustomerMasterACLTokenParamsWithContext(ctx context.Context) *ConsulServiceCreateCustomerMasterACLTokenParams { + var () + return &ConsulServiceCreateCustomerMasterACLTokenParams{ + + Context: ctx, + } +} + +// NewConsulServiceCreateCustomerMasterACLTokenParamsWithHTTPClient creates a new ConsulServiceCreateCustomerMasterACLTokenParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceCreateCustomerMasterACLTokenParamsWithHTTPClient(client *http.Client) *ConsulServiceCreateCustomerMasterACLTokenParams { + var () + return &ConsulServiceCreateCustomerMasterACLTokenParams{ + HTTPClient: client, + } +} + +/*ConsulServiceCreateCustomerMasterACLTokenParams contains all the parameters to send to the API endpoint +for the consul service create customer master ACL token operation typically these are written to a http.Request +*/ +type ConsulServiceCreateCustomerMasterACLTokenParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenRequest + /*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 consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) WithTimeout(timeout time.Duration) *ConsulServiceCreateCustomerMasterACLTokenParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) WithContext(ctx context.Context) *ConsulServiceCreateCustomerMasterACLTokenParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) WithHTTPClient(client *http.Client) *ConsulServiceCreateCustomerMasterACLTokenParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) WithBody(body *models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenRequest) *ConsulServiceCreateCustomerMasterACLTokenParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) SetBody(body *models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenRequest) { + o.Body = body +} + +// WithID adds the id to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) WithID(id string) *ConsulServiceCreateCustomerMasterACLTokenParams { + o.SetID(id) + return o +} + +// SetID adds the id to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceCreateCustomerMasterACLTokenParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) WithLocationProjectID(locationProjectID string) *ConsulServiceCreateCustomerMasterACLTokenParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the consul service create customer master ACL token params +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceCreateCustomerMasterACLTokenParams) 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/2020-08-26/client/consul_service/consul_service_create_customer_master_acl_token_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_create_customer_master_acl_token_responses.go new file mode 100644 index 00000000..ad250646 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceCreateCustomerMasterACLTokenReader is a Reader for the ConsulServiceCreateCustomerMasterACLToken structure. +type ConsulServiceCreateCustomerMasterACLTokenReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceCreateCustomerMasterACLTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceCreateCustomerMasterACLTokenOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceCreateCustomerMasterACLTokenDefault(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 + } +} + +// NewConsulServiceCreateCustomerMasterACLTokenOK creates a ConsulServiceCreateCustomerMasterACLTokenOK with default headers values +func NewConsulServiceCreateCustomerMasterACLTokenOK() *ConsulServiceCreateCustomerMasterACLTokenOK { + return &ConsulServiceCreateCustomerMasterACLTokenOK{} +} + +/*ConsulServiceCreateCustomerMasterACLTokenOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceCreateCustomerMasterACLTokenOK struct { + Payload *models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenResponse +} + +func (o *ConsulServiceCreateCustomerMasterACLTokenOK) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/master-acl-tokens][%d] consulServiceCreateCustomerMasterAclTokenOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceCreateCustomerMasterACLTokenOK) GetPayload() *models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenResponse { + return o.Payload +} + +func (o *ConsulServiceCreateCustomerMasterACLTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceCreateCustomerMasterACLTokenDefault creates a ConsulServiceCreateCustomerMasterACLTokenDefault with default headers values +func NewConsulServiceCreateCustomerMasterACLTokenDefault(code int) *ConsulServiceCreateCustomerMasterACLTokenDefault { + return &ConsulServiceCreateCustomerMasterACLTokenDefault{ + _statusCode: code, + } +} + +/*ConsulServiceCreateCustomerMasterACLTokenDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceCreateCustomerMasterACLTokenDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service create customer master ACL token default response +func (o *ConsulServiceCreateCustomerMasterACLTokenDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceCreateCustomerMasterACLTokenDefault) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/master-acl-tokens][%d] ConsulService_CreateCustomerMasterACLToken default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceCreateCustomerMasterACLTokenDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceCreateCustomerMasterACLTokenDefault) 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/2020-08-26/client/consul_service/consul_service_create_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_create_parameters.go new file mode 100644 index 00000000..63ea2fd3 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// NewConsulServiceCreateParams creates a new ConsulServiceCreateParams object +// with the default values initialized. +func NewConsulServiceCreateParams() *ConsulServiceCreateParams { + var () + return &ConsulServiceCreateParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceCreateParamsWithTimeout creates a new ConsulServiceCreateParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceCreateParamsWithTimeout(timeout time.Duration) *ConsulServiceCreateParams { + var () + return &ConsulServiceCreateParams{ + + timeout: timeout, + } +} + +// NewConsulServiceCreateParamsWithContext creates a new ConsulServiceCreateParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceCreateParamsWithContext(ctx context.Context) *ConsulServiceCreateParams { + var () + return &ConsulServiceCreateParams{ + + Context: ctx, + } +} + +// NewConsulServiceCreateParamsWithHTTPClient creates a new ConsulServiceCreateParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceCreateParamsWithHTTPClient(client *http.Client) *ConsulServiceCreateParams { + var () + return &ConsulServiceCreateParams{ + HTTPClient: client, + } +} + +/*ConsulServiceCreateParams contains all the parameters to send to the API endpoint +for the consul service create operation typically these are written to a http.Request +*/ +type ConsulServiceCreateParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20200826CreateRequest + /*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 consul service create params +func (o *ConsulServiceCreateParams) WithTimeout(timeout time.Duration) *ConsulServiceCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service create params +func (o *ConsulServiceCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service create params +func (o *ConsulServiceCreateParams) WithContext(ctx context.Context) *ConsulServiceCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service create params +func (o *ConsulServiceCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service create params +func (o *ConsulServiceCreateParams) WithHTTPClient(client *http.Client) *ConsulServiceCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service create params +func (o *ConsulServiceCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the consul service create params +func (o *ConsulServiceCreateParams) WithBody(body *models.HashicorpCloudConsul20200826CreateRequest) *ConsulServiceCreateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the consul service create params +func (o *ConsulServiceCreateParams) SetBody(body *models.HashicorpCloudConsul20200826CreateRequest) { + o.Body = body +} + +// WithClusterLocationOrganizationID adds the clusterLocationOrganizationID to the consul service create params +func (o *ConsulServiceCreateParams) WithClusterLocationOrganizationID(clusterLocationOrganizationID string) *ConsulServiceCreateParams { + o.SetClusterLocationOrganizationID(clusterLocationOrganizationID) + return o +} + +// SetClusterLocationOrganizationID adds the clusterLocationOrganizationId to the consul service create params +func (o *ConsulServiceCreateParams) SetClusterLocationOrganizationID(clusterLocationOrganizationID string) { + o.ClusterLocationOrganizationID = clusterLocationOrganizationID +} + +// WithClusterLocationProjectID adds the clusterLocationProjectID to the consul service create params +func (o *ConsulServiceCreateParams) WithClusterLocationProjectID(clusterLocationProjectID string) *ConsulServiceCreateParams { + o.SetClusterLocationProjectID(clusterLocationProjectID) + return o +} + +// SetClusterLocationProjectID adds the clusterLocationProjectId to the consul service create params +func (o *ConsulServiceCreateParams) SetClusterLocationProjectID(clusterLocationProjectID string) { + o.ClusterLocationProjectID = clusterLocationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceCreateParams) 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/2020-08-26/client/consul_service/consul_service_create_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_create_responses.go new file mode 100644 index 00000000..0457feb4 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceCreateReader is a Reader for the ConsulServiceCreate structure. +type ConsulServiceCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceCreateDefault(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 + } +} + +// NewConsulServiceCreateOK creates a ConsulServiceCreateOK with default headers values +func NewConsulServiceCreateOK() *ConsulServiceCreateOK { + return &ConsulServiceCreateOK{} +} + +/*ConsulServiceCreateOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceCreateOK struct { + Payload *models.HashicorpCloudConsul20200826CreateResponse +} + +func (o *ConsulServiceCreateOK) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters][%d] consulServiceCreateOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceCreateOK) GetPayload() *models.HashicorpCloudConsul20200826CreateResponse { + return o.Payload +} + +func (o *ConsulServiceCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826CreateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceCreateDefault creates a ConsulServiceCreateDefault with default headers values +func NewConsulServiceCreateDefault(code int) *ConsulServiceCreateDefault { + return &ConsulServiceCreateDefault{ + _statusCode: code, + } +} + +/*ConsulServiceCreateDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceCreateDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service create default response +func (o *ConsulServiceCreateDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceCreateDefault) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters][%d] ConsulService_Create default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceCreateDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceCreateDefault) 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/2020-08-26/client/consul_service/consul_service_create_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_create_snapshot_parameters.go new file mode 100644 index 00000000..98ca75c6 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// NewConsulServiceCreateSnapshotParams creates a new ConsulServiceCreateSnapshotParams object +// with the default values initialized. +func NewConsulServiceCreateSnapshotParams() *ConsulServiceCreateSnapshotParams { + var () + return &ConsulServiceCreateSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceCreateSnapshotParamsWithTimeout creates a new ConsulServiceCreateSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceCreateSnapshotParamsWithTimeout(timeout time.Duration) *ConsulServiceCreateSnapshotParams { + var () + return &ConsulServiceCreateSnapshotParams{ + + timeout: timeout, + } +} + +// NewConsulServiceCreateSnapshotParamsWithContext creates a new ConsulServiceCreateSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceCreateSnapshotParamsWithContext(ctx context.Context) *ConsulServiceCreateSnapshotParams { + var () + return &ConsulServiceCreateSnapshotParams{ + + Context: ctx, + } +} + +// NewConsulServiceCreateSnapshotParamsWithHTTPClient creates a new ConsulServiceCreateSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceCreateSnapshotParamsWithHTTPClient(client *http.Client) *ConsulServiceCreateSnapshotParams { + var () + return &ConsulServiceCreateSnapshotParams{ + HTTPClient: client, + } +} + +/*ConsulServiceCreateSnapshotParams contains all the parameters to send to the API endpoint +for the consul service create snapshot operation typically these are written to a http.Request +*/ +type ConsulServiceCreateSnapshotParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20200826CreateSnapshotRequest + /*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 consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) WithTimeout(timeout time.Duration) *ConsulServiceCreateSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) WithContext(ctx context.Context) *ConsulServiceCreateSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) WithHTTPClient(client *http.Client) *ConsulServiceCreateSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) WithBody(body *models.HashicorpCloudConsul20200826CreateSnapshotRequest) *ConsulServiceCreateSnapshotParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) SetBody(body *models.HashicorpCloudConsul20200826CreateSnapshotRequest) { + o.Body = body +} + +// WithResourceLocationOrganizationID adds the resourceLocationOrganizationID to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) WithResourceLocationOrganizationID(resourceLocationOrganizationID string) *ConsulServiceCreateSnapshotParams { + o.SetResourceLocationOrganizationID(resourceLocationOrganizationID) + return o +} + +// SetResourceLocationOrganizationID adds the resourceLocationOrganizationId to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) SetResourceLocationOrganizationID(resourceLocationOrganizationID string) { + o.ResourceLocationOrganizationID = resourceLocationOrganizationID +} + +// WithResourceLocationProjectID adds the resourceLocationProjectID to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) WithResourceLocationProjectID(resourceLocationProjectID string) *ConsulServiceCreateSnapshotParams { + o.SetResourceLocationProjectID(resourceLocationProjectID) + return o +} + +// SetResourceLocationProjectID adds the resourceLocationProjectId to the consul service create snapshot params +func (o *ConsulServiceCreateSnapshotParams) SetResourceLocationProjectID(resourceLocationProjectID string) { + o.ResourceLocationProjectID = resourceLocationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceCreateSnapshotParams) 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/2020-08-26/client/consul_service/consul_service_create_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_create_snapshot_responses.go new file mode 100644 index 00000000..e00d9729 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceCreateSnapshotReader is a Reader for the ConsulServiceCreateSnapshot structure. +type ConsulServiceCreateSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceCreateSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceCreateSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceCreateSnapshotDefault(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 + } +} + +// NewConsulServiceCreateSnapshotOK creates a ConsulServiceCreateSnapshotOK with default headers values +func NewConsulServiceCreateSnapshotOK() *ConsulServiceCreateSnapshotOK { + return &ConsulServiceCreateSnapshotOK{} +} + +/*ConsulServiceCreateSnapshotOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceCreateSnapshotOK struct { + Payload *models.HashicorpCloudConsul20200826CreateSnapshotResponse +} + +func (o *ConsulServiceCreateSnapshotOK) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] consulServiceCreateSnapshotOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceCreateSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826CreateSnapshotResponse { + return o.Payload +} + +func (o *ConsulServiceCreateSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826CreateSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceCreateSnapshotDefault creates a ConsulServiceCreateSnapshotDefault with default headers values +func NewConsulServiceCreateSnapshotDefault(code int) *ConsulServiceCreateSnapshotDefault { + return &ConsulServiceCreateSnapshotDefault{ + _statusCode: code, + } +} + +/*ConsulServiceCreateSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceCreateSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service create snapshot default response +func (o *ConsulServiceCreateSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceCreateSnapshotDefault) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] ConsulService_CreateSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceCreateSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceCreateSnapshotDefault) 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/2020-08-26/client/consul_service/list_upgrade_versions_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_delete_parameters.go similarity index 54% rename from clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_upgrade_versions_parameters.go rename to clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_delete_parameters.go index ab212c9c..4618082b 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_upgrade_versions_parameters.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_delete_parameters.go @@ -16,52 +16,52 @@ import ( "github.com/go-openapi/strfmt" ) -// NewListUpgradeVersionsParams creates a new ListUpgradeVersionsParams object +// NewConsulServiceDeleteParams creates a new ConsulServiceDeleteParams object // with the default values initialized. -func NewListUpgradeVersionsParams() *ListUpgradeVersionsParams { +func NewConsulServiceDeleteParams() *ConsulServiceDeleteParams { var () - return &ListUpgradeVersionsParams{ + return &ConsulServiceDeleteParams{ timeout: cr.DefaultTimeout, } } -// NewListUpgradeVersionsParamsWithTimeout creates a new ListUpgradeVersionsParams object +// NewConsulServiceDeleteParamsWithTimeout creates a new ConsulServiceDeleteParams object // with the default values initialized, and the ability to set a timeout on a request -func NewListUpgradeVersionsParamsWithTimeout(timeout time.Duration) *ListUpgradeVersionsParams { +func NewConsulServiceDeleteParamsWithTimeout(timeout time.Duration) *ConsulServiceDeleteParams { var () - return &ListUpgradeVersionsParams{ + return &ConsulServiceDeleteParams{ timeout: timeout, } } -// NewListUpgradeVersionsParamsWithContext creates a new ListUpgradeVersionsParams object +// NewConsulServiceDeleteParamsWithContext creates a new ConsulServiceDeleteParams object // with the default values initialized, and the ability to set a context for a request -func NewListUpgradeVersionsParamsWithContext(ctx context.Context) *ListUpgradeVersionsParams { +func NewConsulServiceDeleteParamsWithContext(ctx context.Context) *ConsulServiceDeleteParams { var () - return &ListUpgradeVersionsParams{ + return &ConsulServiceDeleteParams{ Context: ctx, } } -// NewListUpgradeVersionsParamsWithHTTPClient creates a new ListUpgradeVersionsParams object +// NewConsulServiceDeleteParamsWithHTTPClient creates a new ConsulServiceDeleteParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewListUpgradeVersionsParamsWithHTTPClient(client *http.Client) *ListUpgradeVersionsParams { +func NewConsulServiceDeleteParamsWithHTTPClient(client *http.Client) *ConsulServiceDeleteParams { var () - return &ListUpgradeVersionsParams{ + return &ConsulServiceDeleteParams{ 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 +/*ConsulServiceDeleteParams contains all the parameters to send to the API endpoint +for the consul service delete operation typically these are written to a http.Request */ -type ListUpgradeVersionsParams struct { +type ConsulServiceDeleteParams struct { /*ID - id of the Consul cluster to list versions for. + id is the unique ID of the HCC cluster to get */ ID string @@ -91,96 +91,96 @@ type ListUpgradeVersionsParams struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the list upgrade versions params -func (o *ListUpgradeVersionsParams) WithTimeout(timeout time.Duration) *ListUpgradeVersionsParams { +// WithTimeout adds the timeout to the consul service delete params +func (o *ConsulServiceDeleteParams) WithTimeout(timeout time.Duration) *ConsulServiceDeleteParams { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the consul service delete params +func (o *ConsulServiceDeleteParams) 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 { +// WithContext adds the context to the consul service delete params +func (o *ConsulServiceDeleteParams) WithContext(ctx context.Context) *ConsulServiceDeleteParams { o.SetContext(ctx) return o } -// SetContext adds the context to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetContext(ctx context.Context) { +// SetContext adds the context to the consul service delete params +func (o *ConsulServiceDeleteParams) 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 { +// WithHTTPClient adds the HTTPClient to the consul service delete params +func (o *ConsulServiceDeleteParams) WithHTTPClient(client *http.Client) *ConsulServiceDeleteParams { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the consul service delete params +func (o *ConsulServiceDeleteParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithID adds the id to the list upgrade versions params -func (o *ListUpgradeVersionsParams) WithID(id string) *ListUpgradeVersionsParams { +// WithID adds the id to the consul service delete params +func (o *ConsulServiceDeleteParams) WithID(id string) *ConsulServiceDeleteParams { o.SetID(id) return o } -// SetID adds the id to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetID(id string) { +// SetID adds the id to the consul service delete params +func (o *ConsulServiceDeleteParams) SetID(id string) { o.ID = id } -// WithLocationOrganizationID adds the locationOrganizationID to the list upgrade versions params -func (o *ListUpgradeVersionsParams) WithLocationOrganizationID(locationOrganizationID string) *ListUpgradeVersionsParams { +// WithLocationOrganizationID adds the locationOrganizationID to the consul service delete params +func (o *ConsulServiceDeleteParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceDeleteParams { o.SetLocationOrganizationID(locationOrganizationID) return o } -// SetLocationOrganizationID adds the locationOrganizationId to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetLocationOrganizationID(locationOrganizationID string) { +// SetLocationOrganizationID adds the locationOrganizationId to the consul service delete params +func (o *ConsulServiceDeleteParams) SetLocationOrganizationID(locationOrganizationID string) { o.LocationOrganizationID = locationOrganizationID } -// WithLocationProjectID adds the locationProjectID to the list upgrade versions params -func (o *ListUpgradeVersionsParams) WithLocationProjectID(locationProjectID string) *ListUpgradeVersionsParams { +// WithLocationProjectID adds the locationProjectID to the consul service delete params +func (o *ConsulServiceDeleteParams) WithLocationProjectID(locationProjectID string) *ConsulServiceDeleteParams { o.SetLocationProjectID(locationProjectID) return o } -// SetLocationProjectID adds the locationProjectId to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetLocationProjectID(locationProjectID string) { +// SetLocationProjectID adds the locationProjectId to the consul service delete params +func (o *ConsulServiceDeleteParams) SetLocationProjectID(locationProjectID string) { o.LocationProjectID = locationProjectID } -// WithLocationRegionProvider adds the locationRegionProvider to the list upgrade versions params -func (o *ListUpgradeVersionsParams) WithLocationRegionProvider(locationRegionProvider *string) *ListUpgradeVersionsParams { +// WithLocationRegionProvider adds the locationRegionProvider to the consul service delete params +func (o *ConsulServiceDeleteParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceDeleteParams { o.SetLocationRegionProvider(locationRegionProvider) return o } -// SetLocationRegionProvider adds the locationRegionProvider to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetLocationRegionProvider(locationRegionProvider *string) { +// SetLocationRegionProvider adds the locationRegionProvider to the consul service delete params +func (o *ConsulServiceDeleteParams) SetLocationRegionProvider(locationRegionProvider *string) { o.LocationRegionProvider = locationRegionProvider } -// WithLocationRegionRegion adds the locationRegionRegion to the list upgrade versions params -func (o *ListUpgradeVersionsParams) WithLocationRegionRegion(locationRegionRegion *string) *ListUpgradeVersionsParams { +// WithLocationRegionRegion adds the locationRegionRegion to the consul service delete params +func (o *ConsulServiceDeleteParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceDeleteParams { o.SetLocationRegionRegion(locationRegionRegion) return o } -// SetLocationRegionRegion adds the locationRegionRegion to the list upgrade versions params -func (o *ListUpgradeVersionsParams) SetLocationRegionRegion(locationRegionRegion *string) { +// SetLocationRegionRegion adds the locationRegionRegion to the consul service delete params +func (o *ConsulServiceDeleteParams) 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 { +func (o *ConsulServiceDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_delete_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_delete_responses.go new file mode 100644 index 00000000..7082b48b --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceDeleteReader is a Reader for the ConsulServiceDelete structure. +type ConsulServiceDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceDeleteDefault(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 + } +} + +// NewConsulServiceDeleteOK creates a ConsulServiceDeleteOK with default headers values +func NewConsulServiceDeleteOK() *ConsulServiceDeleteOK { + return &ConsulServiceDeleteOK{} +} + +/*ConsulServiceDeleteOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceDeleteOK struct { + Payload *models.HashicorpCloudConsul20200826DeleteResponse +} + +func (o *ConsulServiceDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] consulServiceDeleteOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceDeleteOK) GetPayload() *models.HashicorpCloudConsul20200826DeleteResponse { + return o.Payload +} + +func (o *ConsulServiceDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826DeleteResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceDeleteDefault creates a ConsulServiceDeleteDefault with default headers values +func NewConsulServiceDeleteDefault(code int) *ConsulServiceDeleteDefault { + return &ConsulServiceDeleteDefault{ + _statusCode: code, + } +} + +/*ConsulServiceDeleteDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceDeleteDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service delete default response +func (o *ConsulServiceDeleteDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceDeleteDefault) Error() string { + return fmt.Sprintf("[DELETE /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] ConsulService_Delete default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceDeleteDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceDeleteDefault) 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/2020-08-26/client/consul_service/consul_service_delete_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_delete_snapshot_parameters.go new file mode 100644 index 00000000..ddb2ef92 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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" +) + +// NewConsulServiceDeleteSnapshotParams creates a new ConsulServiceDeleteSnapshotParams object +// with the default values initialized. +func NewConsulServiceDeleteSnapshotParams() *ConsulServiceDeleteSnapshotParams { + var () + return &ConsulServiceDeleteSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceDeleteSnapshotParamsWithTimeout creates a new ConsulServiceDeleteSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceDeleteSnapshotParamsWithTimeout(timeout time.Duration) *ConsulServiceDeleteSnapshotParams { + var () + return &ConsulServiceDeleteSnapshotParams{ + + timeout: timeout, + } +} + +// NewConsulServiceDeleteSnapshotParamsWithContext creates a new ConsulServiceDeleteSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceDeleteSnapshotParamsWithContext(ctx context.Context) *ConsulServiceDeleteSnapshotParams { + var () + return &ConsulServiceDeleteSnapshotParams{ + + Context: ctx, + } +} + +// NewConsulServiceDeleteSnapshotParamsWithHTTPClient creates a new ConsulServiceDeleteSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceDeleteSnapshotParamsWithHTTPClient(client *http.Client) *ConsulServiceDeleteSnapshotParams { + var () + return &ConsulServiceDeleteSnapshotParams{ + HTTPClient: client, + } +} + +/*ConsulServiceDeleteSnapshotParams contains all the parameters to send to the API endpoint +for the consul service delete snapshot operation typically these are written to a http.Request +*/ +type ConsulServiceDeleteSnapshotParams 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 consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithTimeout(timeout time.Duration) *ConsulServiceDeleteSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithContext(ctx context.Context) *ConsulServiceDeleteSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithHTTPClient(client *http.Client) *ConsulServiceDeleteSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLocationOrganizationID adds the locationOrganizationID to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceDeleteSnapshotParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithLocationProjectID(locationProjectID string) *ConsulServiceDeleteSnapshotParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceDeleteSnapshotParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceDeleteSnapshotParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WithSnapshotID adds the snapshotID to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) WithSnapshotID(snapshotID string) *ConsulServiceDeleteSnapshotParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the consul service delete snapshot params +func (o *ConsulServiceDeleteSnapshotParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceDeleteSnapshotParams) 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/2020-08-26/client/consul_service/consul_service_delete_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_delete_snapshot_responses.go new file mode 100644 index 00000000..f4c756eb --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceDeleteSnapshotReader is a Reader for the ConsulServiceDeleteSnapshot structure. +type ConsulServiceDeleteSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceDeleteSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceDeleteSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceDeleteSnapshotDefault(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 + } +} + +// NewConsulServiceDeleteSnapshotOK creates a ConsulServiceDeleteSnapshotOK with default headers values +func NewConsulServiceDeleteSnapshotOK() *ConsulServiceDeleteSnapshotOK { + return &ConsulServiceDeleteSnapshotOK{} +} + +/*ConsulServiceDeleteSnapshotOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceDeleteSnapshotOK struct { + Payload *models.HashicorpCloudConsul20200826DeleteSnapshotResponse +} + +func (o *ConsulServiceDeleteSnapshotOK) Error() string { + return fmt.Sprintf("[DELETE /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] consulServiceDeleteSnapshotOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceDeleteSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826DeleteSnapshotResponse { + return o.Payload +} + +func (o *ConsulServiceDeleteSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826DeleteSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceDeleteSnapshotDefault creates a ConsulServiceDeleteSnapshotDefault with default headers values +func NewConsulServiceDeleteSnapshotDefault(code int) *ConsulServiceDeleteSnapshotDefault { + return &ConsulServiceDeleteSnapshotDefault{ + _statusCode: code, + } +} + +/*ConsulServiceDeleteSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceDeleteSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service delete snapshot default response +func (o *ConsulServiceDeleteSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceDeleteSnapshotDefault) Error() string { + return fmt.Sprintf("[DELETE /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] ConsulService_DeleteSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceDeleteSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceDeleteSnapshotDefault) 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/2020-08-26/client/consul_service/consul_service_get_client_config_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_client_config_parameters.go new file mode 100644 index 00000000..0125234d --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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" +) + +// NewConsulServiceGetClientConfigParams creates a new ConsulServiceGetClientConfigParams object +// with the default values initialized. +func NewConsulServiceGetClientConfigParams() *ConsulServiceGetClientConfigParams { + var () + return &ConsulServiceGetClientConfigParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceGetClientConfigParamsWithTimeout creates a new ConsulServiceGetClientConfigParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceGetClientConfigParamsWithTimeout(timeout time.Duration) *ConsulServiceGetClientConfigParams { + var () + return &ConsulServiceGetClientConfigParams{ + + timeout: timeout, + } +} + +// NewConsulServiceGetClientConfigParamsWithContext creates a new ConsulServiceGetClientConfigParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceGetClientConfigParamsWithContext(ctx context.Context) *ConsulServiceGetClientConfigParams { + var () + return &ConsulServiceGetClientConfigParams{ + + Context: ctx, + } +} + +// NewConsulServiceGetClientConfigParamsWithHTTPClient creates a new ConsulServiceGetClientConfigParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceGetClientConfigParamsWithHTTPClient(client *http.Client) *ConsulServiceGetClientConfigParams { + var () + return &ConsulServiceGetClientConfigParams{ + HTTPClient: client, + } +} + +/*ConsulServiceGetClientConfigParams contains all the parameters to send to the API endpoint +for the consul service get client config operation typically these are written to a http.Request +*/ +type ConsulServiceGetClientConfigParams 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 consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithTimeout(timeout time.Duration) *ConsulServiceGetClientConfigParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithContext(ctx context.Context) *ConsulServiceGetClientConfigParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithHTTPClient(client *http.Client) *ConsulServiceGetClientConfigParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBundle adds the bundle to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithBundle(bundle *bool) *ConsulServiceGetClientConfigParams { + o.SetBundle(bundle) + return o +} + +// SetBundle adds the bundle to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetBundle(bundle *bool) { + o.Bundle = bundle +} + +// WithID adds the id to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithID(id string) *ConsulServiceGetClientConfigParams { + o.SetID(id) + return o +} + +// SetID adds the id to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceGetClientConfigParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithLocationProjectID(locationProjectID string) *ConsulServiceGetClientConfigParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceGetClientConfigParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceGetClientConfigParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the consul service get client config params +func (o *ConsulServiceGetClientConfigParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceGetClientConfigParams) 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/2020-08-26/client/consul_service/consul_service_get_client_config_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_client_config_responses.go new file mode 100644 index 00000000..f9451a02 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceGetClientConfigReader is a Reader for the ConsulServiceGetClientConfig structure. +type ConsulServiceGetClientConfigReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceGetClientConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceGetClientConfigOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceGetClientConfigDefault(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 + } +} + +// NewConsulServiceGetClientConfigOK creates a ConsulServiceGetClientConfigOK with default headers values +func NewConsulServiceGetClientConfigOK() *ConsulServiceGetClientConfigOK { + return &ConsulServiceGetClientConfigOK{} +} + +/*ConsulServiceGetClientConfigOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceGetClientConfigOK struct { + Payload *models.HashicorpCloudConsul20200826GetClientConfigResponse +} + +func (o *ConsulServiceGetClientConfigOK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/client-config][%d] consulServiceGetClientConfigOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceGetClientConfigOK) GetPayload() *models.HashicorpCloudConsul20200826GetClientConfigResponse { + return o.Payload +} + +func (o *ConsulServiceGetClientConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826GetClientConfigResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceGetClientConfigDefault creates a ConsulServiceGetClientConfigDefault with default headers values +func NewConsulServiceGetClientConfigDefault(code int) *ConsulServiceGetClientConfigDefault { + return &ConsulServiceGetClientConfigDefault{ + _statusCode: code, + } +} + +/*ConsulServiceGetClientConfigDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceGetClientConfigDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service get client config default response +func (o *ConsulServiceGetClientConfigDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceGetClientConfigDefault) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/client-config][%d] ConsulService_GetClientConfig default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceGetClientConfigDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceGetClientConfigDefault) 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/2020-08-26/client/consul_service/get_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_parameters.go similarity index 53% rename from clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_parameters.go rename to clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_parameters.go index c1b05854..7f660d94 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_parameters.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_parameters.go @@ -16,49 +16,49 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetParams creates a new GetParams object +// NewConsulServiceGetParams creates a new ConsulServiceGetParams object // with the default values initialized. -func NewGetParams() *GetParams { +func NewConsulServiceGetParams() *ConsulServiceGetParams { var () - return &GetParams{ + return &ConsulServiceGetParams{ timeout: cr.DefaultTimeout, } } -// NewGetParamsWithTimeout creates a new GetParams object +// NewConsulServiceGetParamsWithTimeout creates a new ConsulServiceGetParams object // with the default values initialized, and the ability to set a timeout on a request -func NewGetParamsWithTimeout(timeout time.Duration) *GetParams { +func NewConsulServiceGetParamsWithTimeout(timeout time.Duration) *ConsulServiceGetParams { var () - return &GetParams{ + return &ConsulServiceGetParams{ timeout: timeout, } } -// NewGetParamsWithContext creates a new GetParams object +// NewConsulServiceGetParamsWithContext creates a new ConsulServiceGetParams object // with the default values initialized, and the ability to set a context for a request -func NewGetParamsWithContext(ctx context.Context) *GetParams { +func NewConsulServiceGetParamsWithContext(ctx context.Context) *ConsulServiceGetParams { var () - return &GetParams{ + return &ConsulServiceGetParams{ Context: ctx, } } -// NewGetParamsWithHTTPClient creates a new GetParams object +// NewConsulServiceGetParamsWithHTTPClient creates a new ConsulServiceGetParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewGetParamsWithHTTPClient(client *http.Client) *GetParams { +func NewConsulServiceGetParamsWithHTTPClient(client *http.Client) *ConsulServiceGetParams { var () - return &GetParams{ + return &ConsulServiceGetParams{ 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 +/*ConsulServiceGetParams contains all the parameters to send to the API endpoint +for the consul service get operation typically these are written to a http.Request */ -type GetParams struct { +type ConsulServiceGetParams struct { /*ID id is the unique ID of the HCC cluster to get @@ -91,96 +91,96 @@ type GetParams struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the get params -func (o *GetParams) WithTimeout(timeout time.Duration) *GetParams { +// WithTimeout adds the timeout to the consul service get params +func (o *ConsulServiceGetParams) WithTimeout(timeout time.Duration) *ConsulServiceGetParams { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the get params -func (o *GetParams) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the consul service get params +func (o *ConsulServiceGetParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the get params -func (o *GetParams) WithContext(ctx context.Context) *GetParams { +// WithContext adds the context to the consul service get params +func (o *ConsulServiceGetParams) WithContext(ctx context.Context) *ConsulServiceGetParams { o.SetContext(ctx) return o } -// SetContext adds the context to the get params -func (o *GetParams) SetContext(ctx context.Context) { +// SetContext adds the context to the consul service get params +func (o *ConsulServiceGetParams) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the get params -func (o *GetParams) WithHTTPClient(client *http.Client) *GetParams { +// WithHTTPClient adds the HTTPClient to the consul service get params +func (o *ConsulServiceGetParams) WithHTTPClient(client *http.Client) *ConsulServiceGetParams { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the get params -func (o *GetParams) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the consul service get params +func (o *ConsulServiceGetParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithID adds the id to the get params -func (o *GetParams) WithID(id string) *GetParams { +// WithID adds the id to the consul service get params +func (o *ConsulServiceGetParams) WithID(id string) *ConsulServiceGetParams { o.SetID(id) return o } -// SetID adds the id to the get params -func (o *GetParams) SetID(id string) { +// SetID adds the id to the consul service get params +func (o *ConsulServiceGetParams) SetID(id string) { o.ID = id } -// WithLocationOrganizationID adds the locationOrganizationID to the get params -func (o *GetParams) WithLocationOrganizationID(locationOrganizationID string) *GetParams { +// WithLocationOrganizationID adds the locationOrganizationID to the consul service get params +func (o *ConsulServiceGetParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceGetParams { o.SetLocationOrganizationID(locationOrganizationID) return o } -// SetLocationOrganizationID adds the locationOrganizationId to the get params -func (o *GetParams) SetLocationOrganizationID(locationOrganizationID string) { +// SetLocationOrganizationID adds the locationOrganizationId to the consul service get params +func (o *ConsulServiceGetParams) SetLocationOrganizationID(locationOrganizationID string) { o.LocationOrganizationID = locationOrganizationID } -// WithLocationProjectID adds the locationProjectID to the get params -func (o *GetParams) WithLocationProjectID(locationProjectID string) *GetParams { +// WithLocationProjectID adds the locationProjectID to the consul service get params +func (o *ConsulServiceGetParams) WithLocationProjectID(locationProjectID string) *ConsulServiceGetParams { o.SetLocationProjectID(locationProjectID) return o } -// SetLocationProjectID adds the locationProjectId to the get params -func (o *GetParams) SetLocationProjectID(locationProjectID string) { +// SetLocationProjectID adds the locationProjectId to the consul service get params +func (o *ConsulServiceGetParams) SetLocationProjectID(locationProjectID string) { o.LocationProjectID = locationProjectID } -// WithLocationRegionProvider adds the locationRegionProvider to the get params -func (o *GetParams) WithLocationRegionProvider(locationRegionProvider *string) *GetParams { +// WithLocationRegionProvider adds the locationRegionProvider to the consul service get params +func (o *ConsulServiceGetParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceGetParams { o.SetLocationRegionProvider(locationRegionProvider) return o } -// SetLocationRegionProvider adds the locationRegionProvider to the get params -func (o *GetParams) SetLocationRegionProvider(locationRegionProvider *string) { +// SetLocationRegionProvider adds the locationRegionProvider to the consul service get params +func (o *ConsulServiceGetParams) SetLocationRegionProvider(locationRegionProvider *string) { o.LocationRegionProvider = locationRegionProvider } -// WithLocationRegionRegion adds the locationRegionRegion to the get params -func (o *GetParams) WithLocationRegionRegion(locationRegionRegion *string) *GetParams { +// WithLocationRegionRegion adds the locationRegionRegion to the consul service get params +func (o *ConsulServiceGetParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceGetParams { o.SetLocationRegionRegion(locationRegionRegion) return o } -// SetLocationRegionRegion adds the locationRegionRegion to the get params -func (o *GetParams) SetLocationRegionRegion(locationRegionRegion *string) { +// SetLocationRegionRegion adds the locationRegionRegion to the consul service get params +func (o *ConsulServiceGetParams) 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 { +func (o *ConsulServiceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_responses.go new file mode 100644 index 00000000..49de2f2f --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceGetReader is a Reader for the ConsulServiceGet structure. +type ConsulServiceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceGetDefault(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 + } +} + +// NewConsulServiceGetOK creates a ConsulServiceGetOK with default headers values +func NewConsulServiceGetOK() *ConsulServiceGetOK { + return &ConsulServiceGetOK{} +} + +/*ConsulServiceGetOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceGetOK struct { + Payload *models.HashicorpCloudConsul20200826GetResponse +} + +func (o *ConsulServiceGetOK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] consulServiceGetOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceGetOK) GetPayload() *models.HashicorpCloudConsul20200826GetResponse { + return o.Payload +} + +func (o *ConsulServiceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826GetResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceGetDefault creates a ConsulServiceGetDefault with default headers values +func NewConsulServiceGetDefault(code int) *ConsulServiceGetDefault { + return &ConsulServiceGetDefault{ + _statusCode: code, + } +} + +/*ConsulServiceGetDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceGetDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service get default response +func (o *ConsulServiceGetDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceGetDefault) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] ConsulService_Get default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceGetDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceGetDefault) 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/2020-08-26/client/consul_service/get_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_snapshot_parameters.go similarity index 50% rename from clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_snapshot_parameters.go rename to clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_snapshot_parameters.go index e64091cb..f3428f49 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_snapshot_parameters.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_snapshot_parameters.go @@ -16,49 +16,49 @@ import ( "github.com/go-openapi/strfmt" ) -// NewGetSnapshotParams creates a new GetSnapshotParams object +// NewConsulServiceGetSnapshotParams creates a new ConsulServiceGetSnapshotParams object // with the default values initialized. -func NewGetSnapshotParams() *GetSnapshotParams { +func NewConsulServiceGetSnapshotParams() *ConsulServiceGetSnapshotParams { var () - return &GetSnapshotParams{ + return &ConsulServiceGetSnapshotParams{ timeout: cr.DefaultTimeout, } } -// NewGetSnapshotParamsWithTimeout creates a new GetSnapshotParams object +// NewConsulServiceGetSnapshotParamsWithTimeout creates a new ConsulServiceGetSnapshotParams object // with the default values initialized, and the ability to set a timeout on a request -func NewGetSnapshotParamsWithTimeout(timeout time.Duration) *GetSnapshotParams { +func NewConsulServiceGetSnapshotParamsWithTimeout(timeout time.Duration) *ConsulServiceGetSnapshotParams { var () - return &GetSnapshotParams{ + return &ConsulServiceGetSnapshotParams{ timeout: timeout, } } -// NewGetSnapshotParamsWithContext creates a new GetSnapshotParams object +// NewConsulServiceGetSnapshotParamsWithContext creates a new ConsulServiceGetSnapshotParams object // with the default values initialized, and the ability to set a context for a request -func NewGetSnapshotParamsWithContext(ctx context.Context) *GetSnapshotParams { +func NewConsulServiceGetSnapshotParamsWithContext(ctx context.Context) *ConsulServiceGetSnapshotParams { var () - return &GetSnapshotParams{ + return &ConsulServiceGetSnapshotParams{ Context: ctx, } } -// NewGetSnapshotParamsWithHTTPClient creates a new GetSnapshotParams object +// NewConsulServiceGetSnapshotParamsWithHTTPClient creates a new ConsulServiceGetSnapshotParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewGetSnapshotParamsWithHTTPClient(client *http.Client) *GetSnapshotParams { +func NewConsulServiceGetSnapshotParamsWithHTTPClient(client *http.Client) *ConsulServiceGetSnapshotParams { var () - return &GetSnapshotParams{ + return &ConsulServiceGetSnapshotParams{ 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 +/*ConsulServiceGetSnapshotParams contains all the parameters to send to the API endpoint +for the consul service get snapshot operation typically these are written to a http.Request */ -type GetSnapshotParams struct { +type ConsulServiceGetSnapshotParams struct { /*LocationOrganizationID organization_id is the id of the organization. @@ -91,96 +91,96 @@ type GetSnapshotParams struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the get snapshot params -func (o *GetSnapshotParams) WithTimeout(timeout time.Duration) *GetSnapshotParams { +// WithTimeout adds the timeout to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithTimeout(timeout time.Duration) *ConsulServiceGetSnapshotParams { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the get snapshot params -func (o *GetSnapshotParams) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the get snapshot params -func (o *GetSnapshotParams) WithContext(ctx context.Context) *GetSnapshotParams { +// WithContext adds the context to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithContext(ctx context.Context) *ConsulServiceGetSnapshotParams { o.SetContext(ctx) return o } -// SetContext adds the context to the get snapshot params -func (o *GetSnapshotParams) SetContext(ctx context.Context) { +// SetContext adds the context to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the get snapshot params -func (o *GetSnapshotParams) WithHTTPClient(client *http.Client) *GetSnapshotParams { +// WithHTTPClient adds the HTTPClient to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithHTTPClient(client *http.Client) *ConsulServiceGetSnapshotParams { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the get snapshot params -func (o *GetSnapshotParams) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithLocationOrganizationID adds the locationOrganizationID to the get snapshot params -func (o *GetSnapshotParams) WithLocationOrganizationID(locationOrganizationID string) *GetSnapshotParams { +// WithLocationOrganizationID adds the locationOrganizationID to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceGetSnapshotParams { o.SetLocationOrganizationID(locationOrganizationID) return o } -// SetLocationOrganizationID adds the locationOrganizationId to the get snapshot params -func (o *GetSnapshotParams) SetLocationOrganizationID(locationOrganizationID string) { +// SetLocationOrganizationID adds the locationOrganizationId to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) SetLocationOrganizationID(locationOrganizationID string) { o.LocationOrganizationID = locationOrganizationID } -// WithLocationProjectID adds the locationProjectID to the get snapshot params -func (o *GetSnapshotParams) WithLocationProjectID(locationProjectID string) *GetSnapshotParams { +// WithLocationProjectID adds the locationProjectID to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithLocationProjectID(locationProjectID string) *ConsulServiceGetSnapshotParams { o.SetLocationProjectID(locationProjectID) return o } -// SetLocationProjectID adds the locationProjectId to the get snapshot params -func (o *GetSnapshotParams) SetLocationProjectID(locationProjectID string) { +// SetLocationProjectID adds the locationProjectId to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) SetLocationProjectID(locationProjectID string) { o.LocationProjectID = locationProjectID } -// WithLocationRegionProvider adds the locationRegionProvider to the get snapshot params -func (o *GetSnapshotParams) WithLocationRegionProvider(locationRegionProvider *string) *GetSnapshotParams { +// WithLocationRegionProvider adds the locationRegionProvider to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceGetSnapshotParams { o.SetLocationRegionProvider(locationRegionProvider) return o } -// SetLocationRegionProvider adds the locationRegionProvider to the get snapshot params -func (o *GetSnapshotParams) SetLocationRegionProvider(locationRegionProvider *string) { +// SetLocationRegionProvider adds the locationRegionProvider to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) SetLocationRegionProvider(locationRegionProvider *string) { o.LocationRegionProvider = locationRegionProvider } -// WithLocationRegionRegion adds the locationRegionRegion to the get snapshot params -func (o *GetSnapshotParams) WithLocationRegionRegion(locationRegionRegion *string) *GetSnapshotParams { +// WithLocationRegionRegion adds the locationRegionRegion to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceGetSnapshotParams { o.SetLocationRegionRegion(locationRegionRegion) return o } -// SetLocationRegionRegion adds the locationRegionRegion to the get snapshot params -func (o *GetSnapshotParams) SetLocationRegionRegion(locationRegionRegion *string) { +// SetLocationRegionRegion adds the locationRegionRegion to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) SetLocationRegionRegion(locationRegionRegion *string) { o.LocationRegionRegion = locationRegionRegion } -// WithSnapshotID adds the snapshotID to the get snapshot params -func (o *GetSnapshotParams) WithSnapshotID(snapshotID string) *GetSnapshotParams { +// WithSnapshotID adds the snapshotID to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) WithSnapshotID(snapshotID string) *ConsulServiceGetSnapshotParams { o.SetSnapshotID(snapshotID) return o } -// SetSnapshotID adds the snapshotId to the get snapshot params -func (o *GetSnapshotParams) SetSnapshotID(snapshotID string) { +// SetSnapshotID adds the snapshotId to the consul service get snapshot params +func (o *ConsulServiceGetSnapshotParams) 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 { +func (o *ConsulServiceGetSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_get_snapshot_responses.go new file mode 100644 index 00000000..573bc885 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceGetSnapshotReader is a Reader for the ConsulServiceGetSnapshot structure. +type ConsulServiceGetSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceGetSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceGetSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceGetSnapshotDefault(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 + } +} + +// NewConsulServiceGetSnapshotOK creates a ConsulServiceGetSnapshotOK with default headers values +func NewConsulServiceGetSnapshotOK() *ConsulServiceGetSnapshotOK { + return &ConsulServiceGetSnapshotOK{} +} + +/*ConsulServiceGetSnapshotOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceGetSnapshotOK struct { + Payload *models.HashicorpCloudConsul20200826GetSnapshotResponse +} + +func (o *ConsulServiceGetSnapshotOK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] consulServiceGetSnapshotOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceGetSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826GetSnapshotResponse { + return o.Payload +} + +func (o *ConsulServiceGetSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826GetSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceGetSnapshotDefault creates a ConsulServiceGetSnapshotDefault with default headers values +func NewConsulServiceGetSnapshotDefault(code int) *ConsulServiceGetSnapshotDefault { + return &ConsulServiceGetSnapshotDefault{ + _statusCode: code, + } +} + +/*ConsulServiceGetSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceGetSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service get snapshot default response +func (o *ConsulServiceGetSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceGetSnapshotDefault) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] ConsulService_GetSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceGetSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceGetSnapshotDefault) 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/2020-08-26/client/consul_service/list_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_parameters.go similarity index 61% rename from clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_parameters.go rename to clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_parameters.go index 686caf45..55912080 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_parameters.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_parameters.go @@ -17,49 +17,49 @@ import ( "github.com/go-openapi/swag" ) -// NewListParams creates a new ListParams object +// NewConsulServiceListParams creates a new ConsulServiceListParams object // with the default values initialized. -func NewListParams() *ListParams { +func NewConsulServiceListParams() *ConsulServiceListParams { var () - return &ListParams{ + return &ConsulServiceListParams{ timeout: cr.DefaultTimeout, } } -// NewListParamsWithTimeout creates a new ListParams object +// NewConsulServiceListParamsWithTimeout creates a new ConsulServiceListParams object // with the default values initialized, and the ability to set a timeout on a request -func NewListParamsWithTimeout(timeout time.Duration) *ListParams { +func NewConsulServiceListParamsWithTimeout(timeout time.Duration) *ConsulServiceListParams { var () - return &ListParams{ + return &ConsulServiceListParams{ timeout: timeout, } } -// NewListParamsWithContext creates a new ListParams object +// NewConsulServiceListParamsWithContext creates a new ConsulServiceListParams object // with the default values initialized, and the ability to set a context for a request -func NewListParamsWithContext(ctx context.Context) *ListParams { +func NewConsulServiceListParamsWithContext(ctx context.Context) *ConsulServiceListParams { var () - return &ListParams{ + return &ConsulServiceListParams{ Context: ctx, } } -// NewListParamsWithHTTPClient creates a new ListParams object +// NewConsulServiceListParamsWithHTTPClient creates a new ConsulServiceListParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewListParamsWithHTTPClient(client *http.Client) *ListParams { +func NewConsulServiceListParamsWithHTTPClient(client *http.Client) *ConsulServiceListParams { var () - return &ListParams{ + return &ConsulServiceListParams{ 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 +/*ConsulServiceListParams contains all the parameters to send to the API endpoint +for the consul service list operation typically these are written to a http.Request */ -type ListParams struct { +type ConsulServiceListParams struct { /*LocationOrganizationID organization_id is the id of the organization. @@ -109,118 +109,118 @@ type ListParams struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the list params -func (o *ListParams) WithTimeout(timeout time.Duration) *ListParams { +// WithTimeout adds the timeout to the consul service list params +func (o *ConsulServiceListParams) WithTimeout(timeout time.Duration) *ConsulServiceListParams { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the list params -func (o *ListParams) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the consul service list params +func (o *ConsulServiceListParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the list params -func (o *ListParams) WithContext(ctx context.Context) *ListParams { +// WithContext adds the context to the consul service list params +func (o *ConsulServiceListParams) WithContext(ctx context.Context) *ConsulServiceListParams { o.SetContext(ctx) return o } -// SetContext adds the context to the list params -func (o *ListParams) SetContext(ctx context.Context) { +// SetContext adds the context to the consul service list params +func (o *ConsulServiceListParams) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the list params -func (o *ListParams) WithHTTPClient(client *http.Client) *ListParams { +// WithHTTPClient adds the HTTPClient to the consul service list params +func (o *ConsulServiceListParams) WithHTTPClient(client *http.Client) *ConsulServiceListParams { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the list params -func (o *ListParams) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the consul service list params +func (o *ConsulServiceListParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithLocationOrganizationID adds the locationOrganizationID to the list params -func (o *ListParams) WithLocationOrganizationID(locationOrganizationID string) *ListParams { +// WithLocationOrganizationID adds the locationOrganizationID to the consul service list params +func (o *ConsulServiceListParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceListParams { o.SetLocationOrganizationID(locationOrganizationID) return o } -// SetLocationOrganizationID adds the locationOrganizationId to the list params -func (o *ListParams) SetLocationOrganizationID(locationOrganizationID string) { +// SetLocationOrganizationID adds the locationOrganizationId to the consul service list params +func (o *ConsulServiceListParams) SetLocationOrganizationID(locationOrganizationID string) { o.LocationOrganizationID = locationOrganizationID } -// WithLocationProjectID adds the locationProjectID to the list params -func (o *ListParams) WithLocationProjectID(locationProjectID string) *ListParams { +// WithLocationProjectID adds the locationProjectID to the consul service list params +func (o *ConsulServiceListParams) WithLocationProjectID(locationProjectID string) *ConsulServiceListParams { o.SetLocationProjectID(locationProjectID) return o } -// SetLocationProjectID adds the locationProjectId to the list params -func (o *ListParams) SetLocationProjectID(locationProjectID string) { +// SetLocationProjectID adds the locationProjectId to the consul service list params +func (o *ConsulServiceListParams) SetLocationProjectID(locationProjectID string) { o.LocationProjectID = locationProjectID } -// WithLocationRegionProvider adds the locationRegionProvider to the list params -func (o *ListParams) WithLocationRegionProvider(locationRegionProvider *string) *ListParams { +// WithLocationRegionProvider adds the locationRegionProvider to the consul service list params +func (o *ConsulServiceListParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceListParams { o.SetLocationRegionProvider(locationRegionProvider) return o } -// SetLocationRegionProvider adds the locationRegionProvider to the list params -func (o *ListParams) SetLocationRegionProvider(locationRegionProvider *string) { +// SetLocationRegionProvider adds the locationRegionProvider to the consul service list params +func (o *ConsulServiceListParams) SetLocationRegionProvider(locationRegionProvider *string) { o.LocationRegionProvider = locationRegionProvider } -// WithLocationRegionRegion adds the locationRegionRegion to the list params -func (o *ListParams) WithLocationRegionRegion(locationRegionRegion *string) *ListParams { +// WithLocationRegionRegion adds the locationRegionRegion to the consul service list params +func (o *ConsulServiceListParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceListParams { o.SetLocationRegionRegion(locationRegionRegion) return o } -// SetLocationRegionRegion adds the locationRegionRegion to the list params -func (o *ListParams) SetLocationRegionRegion(locationRegionRegion *string) { +// SetLocationRegionRegion adds the locationRegionRegion to the consul service list params +func (o *ConsulServiceListParams) SetLocationRegionRegion(locationRegionRegion *string) { o.LocationRegionRegion = locationRegionRegion } -// WithPaginationNextPageToken adds the paginationNextPageToken to the list params -func (o *ListParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListParams { +// WithPaginationNextPageToken adds the paginationNextPageToken to the consul service list params +func (o *ConsulServiceListParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ConsulServiceListParams { o.SetPaginationNextPageToken(paginationNextPageToken) return o } -// SetPaginationNextPageToken adds the paginationNextPageToken to the list params -func (o *ListParams) SetPaginationNextPageToken(paginationNextPageToken *string) { +// SetPaginationNextPageToken adds the paginationNextPageToken to the consul service list params +func (o *ConsulServiceListParams) SetPaginationNextPageToken(paginationNextPageToken *string) { o.PaginationNextPageToken = paginationNextPageToken } -// WithPaginationPageSize adds the paginationPageSize to the list params -func (o *ListParams) WithPaginationPageSize(paginationPageSize *int64) *ListParams { +// WithPaginationPageSize adds the paginationPageSize to the consul service list params +func (o *ConsulServiceListParams) WithPaginationPageSize(paginationPageSize *int64) *ConsulServiceListParams { o.SetPaginationPageSize(paginationPageSize) return o } -// SetPaginationPageSize adds the paginationPageSize to the list params -func (o *ListParams) SetPaginationPageSize(paginationPageSize *int64) { +// SetPaginationPageSize adds the paginationPageSize to the consul service list params +func (o *ConsulServiceListParams) SetPaginationPageSize(paginationPageSize *int64) { o.PaginationPageSize = paginationPageSize } -// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list params -func (o *ListParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListParams { +// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the consul service list params +func (o *ConsulServiceListParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ConsulServiceListParams { o.SetPaginationPreviousPageToken(paginationPreviousPageToken) return o } -// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list params -func (o *ListParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { +// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the consul service list params +func (o *ConsulServiceListParams) 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 { +func (o *ConsulServiceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_responses.go new file mode 100644 index 00000000..90a091ec --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceListReader is a Reader for the ConsulServiceList structure. +type ConsulServiceListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceListDefault(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 + } +} + +// NewConsulServiceListOK creates a ConsulServiceListOK with default headers values +func NewConsulServiceListOK() *ConsulServiceListOK { + return &ConsulServiceListOK{} +} + +/*ConsulServiceListOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceListOK struct { + Payload *models.HashicorpCloudConsul20200826ListResponse +} + +func (o *ConsulServiceListOK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters][%d] consulServiceListOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceListOK) GetPayload() *models.HashicorpCloudConsul20200826ListResponse { + return o.Payload +} + +func (o *ConsulServiceListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826ListResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceListDefault creates a ConsulServiceListDefault with default headers values +func NewConsulServiceListDefault(code int) *ConsulServiceListDefault { + return &ConsulServiceListDefault{ + _statusCode: code, + } +} + +/*ConsulServiceListDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceListDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service list default response +func (o *ConsulServiceListDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceListDefault) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters][%d] ConsulService_List default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceListDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceListDefault) 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/2020-08-26/client/consul_service/list_snapshots_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_snapshots_parameters.go similarity index 59% rename from clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_snapshots_parameters.go rename to clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_snapshots_parameters.go index 876cc4a4..90e8533a 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_snapshots_parameters.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_snapshots_parameters.go @@ -17,49 +17,49 @@ import ( "github.com/go-openapi/swag" ) -// NewListSnapshotsParams creates a new ListSnapshotsParams object +// NewConsulServiceListSnapshotsParams creates a new ConsulServiceListSnapshotsParams object // with the default values initialized. -func NewListSnapshotsParams() *ListSnapshotsParams { +func NewConsulServiceListSnapshotsParams() *ConsulServiceListSnapshotsParams { var () - return &ListSnapshotsParams{ + return &ConsulServiceListSnapshotsParams{ timeout: cr.DefaultTimeout, } } -// NewListSnapshotsParamsWithTimeout creates a new ListSnapshotsParams object +// NewConsulServiceListSnapshotsParamsWithTimeout creates a new ConsulServiceListSnapshotsParams object // with the default values initialized, and the ability to set a timeout on a request -func NewListSnapshotsParamsWithTimeout(timeout time.Duration) *ListSnapshotsParams { +func NewConsulServiceListSnapshotsParamsWithTimeout(timeout time.Duration) *ConsulServiceListSnapshotsParams { var () - return &ListSnapshotsParams{ + return &ConsulServiceListSnapshotsParams{ timeout: timeout, } } -// NewListSnapshotsParamsWithContext creates a new ListSnapshotsParams object +// NewConsulServiceListSnapshotsParamsWithContext creates a new ConsulServiceListSnapshotsParams object // with the default values initialized, and the ability to set a context for a request -func NewListSnapshotsParamsWithContext(ctx context.Context) *ListSnapshotsParams { +func NewConsulServiceListSnapshotsParamsWithContext(ctx context.Context) *ConsulServiceListSnapshotsParams { var () - return &ListSnapshotsParams{ + return &ConsulServiceListSnapshotsParams{ Context: ctx, } } -// NewListSnapshotsParamsWithHTTPClient creates a new ListSnapshotsParams object +// NewConsulServiceListSnapshotsParamsWithHTTPClient creates a new ConsulServiceListSnapshotsParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewListSnapshotsParamsWithHTTPClient(client *http.Client) *ListSnapshotsParams { +func NewConsulServiceListSnapshotsParamsWithHTTPClient(client *http.Client) *ConsulServiceListSnapshotsParams { var () - return &ListSnapshotsParams{ + return &ConsulServiceListSnapshotsParams{ 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 +/*ConsulServiceListSnapshotsParams contains all the parameters to send to the API endpoint +for the consul service list snapshots operation typically these are written to a http.Request */ -type ListSnapshotsParams struct { +type ConsulServiceListSnapshotsParams struct { /*PaginationNextPageToken Specifies a page token to use to retrieve the next page. Set this to the @@ -133,162 +133,162 @@ type ListSnapshotsParams struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the list snapshots params -func (o *ListSnapshotsParams) WithTimeout(timeout time.Duration) *ListSnapshotsParams { +// WithTimeout adds the timeout to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithTimeout(timeout time.Duration) *ConsulServiceListSnapshotsParams { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the list snapshots params -func (o *ListSnapshotsParams) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the list snapshots params -func (o *ListSnapshotsParams) WithContext(ctx context.Context) *ListSnapshotsParams { +// WithContext adds the context to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithContext(ctx context.Context) *ConsulServiceListSnapshotsParams { o.SetContext(ctx) return o } -// SetContext adds the context to the list snapshots params -func (o *ListSnapshotsParams) SetContext(ctx context.Context) { +// SetContext adds the context to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the list snapshots params -func (o *ListSnapshotsParams) WithHTTPClient(client *http.Client) *ListSnapshotsParams { +// WithHTTPClient adds the HTTPClient to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithHTTPClient(client *http.Client) *ConsulServiceListSnapshotsParams { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the list snapshots params -func (o *ListSnapshotsParams) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithPaginationNextPageToken adds the paginationNextPageToken to the list snapshots params -func (o *ListSnapshotsParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListSnapshotsParams { +// WithPaginationNextPageToken adds the paginationNextPageToken to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ConsulServiceListSnapshotsParams { o.SetPaginationNextPageToken(paginationNextPageToken) return o } -// SetPaginationNextPageToken adds the paginationNextPageToken to the list snapshots params -func (o *ListSnapshotsParams) SetPaginationNextPageToken(paginationNextPageToken *string) { +// SetPaginationNextPageToken adds the paginationNextPageToken to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetPaginationNextPageToken(paginationNextPageToken *string) { o.PaginationNextPageToken = paginationNextPageToken } -// WithPaginationPageSize adds the paginationPageSize to the list snapshots params -func (o *ListSnapshotsParams) WithPaginationPageSize(paginationPageSize *int64) *ListSnapshotsParams { +// WithPaginationPageSize adds the paginationPageSize to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithPaginationPageSize(paginationPageSize *int64) *ConsulServiceListSnapshotsParams { o.SetPaginationPageSize(paginationPageSize) return o } -// SetPaginationPageSize adds the paginationPageSize to the list snapshots params -func (o *ListSnapshotsParams) SetPaginationPageSize(paginationPageSize *int64) { +// SetPaginationPageSize adds the paginationPageSize to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetPaginationPageSize(paginationPageSize *int64) { o.PaginationPageSize = paginationPageSize } -// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list snapshots params -func (o *ListSnapshotsParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListSnapshotsParams { +// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ConsulServiceListSnapshotsParams { o.SetPaginationPreviousPageToken(paginationPreviousPageToken) return o } -// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list snapshots params -func (o *ListSnapshotsParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { +// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { o.PaginationPreviousPageToken = paginationPreviousPageToken } -// WithResourceDescription adds the resourceDescription to the list snapshots params -func (o *ListSnapshotsParams) WithResourceDescription(resourceDescription *string) *ListSnapshotsParams { +// WithResourceDescription adds the resourceDescription to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceDescription(resourceDescription *string) *ConsulServiceListSnapshotsParams { o.SetResourceDescription(resourceDescription) return o } -// SetResourceDescription adds the resourceDescription to the list snapshots params -func (o *ListSnapshotsParams) SetResourceDescription(resourceDescription *string) { +// SetResourceDescription adds the resourceDescription to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetResourceDescription(resourceDescription *string) { o.ResourceDescription = resourceDescription } -// WithResourceID adds the resourceID to the list snapshots params -func (o *ListSnapshotsParams) WithResourceID(resourceID *string) *ListSnapshotsParams { +// WithResourceID adds the resourceID to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceID(resourceID *string) *ConsulServiceListSnapshotsParams { o.SetResourceID(resourceID) return o } -// SetResourceID adds the resourceId to the list snapshots params -func (o *ListSnapshotsParams) SetResourceID(resourceID *string) { +// SetResourceID adds the resourceId to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetResourceID(resourceID *string) { o.ResourceID = resourceID } -// WithResourceLocationOrganizationID adds the resourceLocationOrganizationID to the list snapshots params -func (o *ListSnapshotsParams) WithResourceLocationOrganizationID(resourceLocationOrganizationID string) *ListSnapshotsParams { +// WithResourceLocationOrganizationID adds the resourceLocationOrganizationID to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceLocationOrganizationID(resourceLocationOrganizationID string) *ConsulServiceListSnapshotsParams { o.SetResourceLocationOrganizationID(resourceLocationOrganizationID) return o } -// SetResourceLocationOrganizationID adds the resourceLocationOrganizationId to the list snapshots params -func (o *ListSnapshotsParams) SetResourceLocationOrganizationID(resourceLocationOrganizationID string) { +// SetResourceLocationOrganizationID adds the resourceLocationOrganizationId to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetResourceLocationOrganizationID(resourceLocationOrganizationID string) { o.ResourceLocationOrganizationID = resourceLocationOrganizationID } -// WithResourceLocationProjectID adds the resourceLocationProjectID to the list snapshots params -func (o *ListSnapshotsParams) WithResourceLocationProjectID(resourceLocationProjectID string) *ListSnapshotsParams { +// WithResourceLocationProjectID adds the resourceLocationProjectID to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceLocationProjectID(resourceLocationProjectID string) *ConsulServiceListSnapshotsParams { o.SetResourceLocationProjectID(resourceLocationProjectID) return o } -// SetResourceLocationProjectID adds the resourceLocationProjectId to the list snapshots params -func (o *ListSnapshotsParams) SetResourceLocationProjectID(resourceLocationProjectID string) { +// SetResourceLocationProjectID adds the resourceLocationProjectId to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetResourceLocationProjectID(resourceLocationProjectID string) { o.ResourceLocationProjectID = resourceLocationProjectID } -// WithResourceLocationRegionProvider adds the resourceLocationRegionProvider to the list snapshots params -func (o *ListSnapshotsParams) WithResourceLocationRegionProvider(resourceLocationRegionProvider *string) *ListSnapshotsParams { +// WithResourceLocationRegionProvider adds the resourceLocationRegionProvider to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceLocationRegionProvider(resourceLocationRegionProvider *string) *ConsulServiceListSnapshotsParams { o.SetResourceLocationRegionProvider(resourceLocationRegionProvider) return o } -// SetResourceLocationRegionProvider adds the resourceLocationRegionProvider to the list snapshots params -func (o *ListSnapshotsParams) SetResourceLocationRegionProvider(resourceLocationRegionProvider *string) { +// SetResourceLocationRegionProvider adds the resourceLocationRegionProvider to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetResourceLocationRegionProvider(resourceLocationRegionProvider *string) { o.ResourceLocationRegionProvider = resourceLocationRegionProvider } -// WithResourceLocationRegionRegion adds the resourceLocationRegionRegion to the list snapshots params -func (o *ListSnapshotsParams) WithResourceLocationRegionRegion(resourceLocationRegionRegion *string) *ListSnapshotsParams { +// WithResourceLocationRegionRegion adds the resourceLocationRegionRegion to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceLocationRegionRegion(resourceLocationRegionRegion *string) *ConsulServiceListSnapshotsParams { o.SetResourceLocationRegionRegion(resourceLocationRegionRegion) return o } -// SetResourceLocationRegionRegion adds the resourceLocationRegionRegion to the list snapshots params -func (o *ListSnapshotsParams) SetResourceLocationRegionRegion(resourceLocationRegionRegion *string) { +// SetResourceLocationRegionRegion adds the resourceLocationRegionRegion to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetResourceLocationRegionRegion(resourceLocationRegionRegion *string) { o.ResourceLocationRegionRegion = resourceLocationRegionRegion } -// WithResourceType adds the resourceType to the list snapshots params -func (o *ListSnapshotsParams) WithResourceType(resourceType *string) *ListSnapshotsParams { +// WithResourceType adds the resourceType to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceType(resourceType *string) *ConsulServiceListSnapshotsParams { o.SetResourceType(resourceType) return o } -// SetResourceType adds the resourceType to the list snapshots params -func (o *ListSnapshotsParams) SetResourceType(resourceType *string) { +// SetResourceType adds the resourceType to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) SetResourceType(resourceType *string) { o.ResourceType = resourceType } -// WithResourceUUID adds the resourceUUID to the list snapshots params -func (o *ListSnapshotsParams) WithResourceUUID(resourceUUID *string) *ListSnapshotsParams { +// WithResourceUUID adds the resourceUUID to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) WithResourceUUID(resourceUUID *string) *ConsulServiceListSnapshotsParams { o.SetResourceUUID(resourceUUID) return o } -// SetResourceUUID adds the resourceUuid to the list snapshots params -func (o *ListSnapshotsParams) SetResourceUUID(resourceUUID *string) { +// SetResourceUUID adds the resourceUuid to the consul service list snapshots params +func (o *ConsulServiceListSnapshotsParams) 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 { +func (o *ConsulServiceListSnapshotsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_snapshots_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_snapshots_responses.go new file mode 100644 index 00000000..f4d0c58a --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceListSnapshotsReader is a Reader for the ConsulServiceListSnapshots structure. +type ConsulServiceListSnapshotsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceListSnapshotsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceListSnapshotsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceListSnapshotsDefault(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 + } +} + +// NewConsulServiceListSnapshotsOK creates a ConsulServiceListSnapshotsOK with default headers values +func NewConsulServiceListSnapshotsOK() *ConsulServiceListSnapshotsOK { + return &ConsulServiceListSnapshotsOK{} +} + +/*ConsulServiceListSnapshotsOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceListSnapshotsOK struct { + Payload *models.HashicorpCloudConsul20200826ListSnapshotsResponse +} + +func (o *ConsulServiceListSnapshotsOK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] consulServiceListSnapshotsOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceListSnapshotsOK) GetPayload() *models.HashicorpCloudConsul20200826ListSnapshotsResponse { + return o.Payload +} + +func (o *ConsulServiceListSnapshotsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826ListSnapshotsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceListSnapshotsDefault creates a ConsulServiceListSnapshotsDefault with default headers values +func NewConsulServiceListSnapshotsDefault(code int) *ConsulServiceListSnapshotsDefault { + return &ConsulServiceListSnapshotsDefault{ + _statusCode: code, + } +} + +/*ConsulServiceListSnapshotsDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceListSnapshotsDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service list snapshots default response +func (o *ConsulServiceListSnapshotsDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceListSnapshotsDefault) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] ConsulService_ListSnapshots default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceListSnapshotsDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceListSnapshotsDefault) 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/2020-08-26/client/consul_service/consul_service_list_upgrade_versions_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_upgrade_versions_parameters.go new file mode 100644 index 00000000..16eee166 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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" +) + +// NewConsulServiceListUpgradeVersionsParams creates a new ConsulServiceListUpgradeVersionsParams object +// with the default values initialized. +func NewConsulServiceListUpgradeVersionsParams() *ConsulServiceListUpgradeVersionsParams { + var () + return &ConsulServiceListUpgradeVersionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceListUpgradeVersionsParamsWithTimeout creates a new ConsulServiceListUpgradeVersionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceListUpgradeVersionsParamsWithTimeout(timeout time.Duration) *ConsulServiceListUpgradeVersionsParams { + var () + return &ConsulServiceListUpgradeVersionsParams{ + + timeout: timeout, + } +} + +// NewConsulServiceListUpgradeVersionsParamsWithContext creates a new ConsulServiceListUpgradeVersionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceListUpgradeVersionsParamsWithContext(ctx context.Context) *ConsulServiceListUpgradeVersionsParams { + var () + return &ConsulServiceListUpgradeVersionsParams{ + + Context: ctx, + } +} + +// NewConsulServiceListUpgradeVersionsParamsWithHTTPClient creates a new ConsulServiceListUpgradeVersionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceListUpgradeVersionsParamsWithHTTPClient(client *http.Client) *ConsulServiceListUpgradeVersionsParams { + var () + return &ConsulServiceListUpgradeVersionsParams{ + HTTPClient: client, + } +} + +/*ConsulServiceListUpgradeVersionsParams contains all the parameters to send to the API endpoint +for the consul service list upgrade versions operation typically these are written to a http.Request +*/ +type ConsulServiceListUpgradeVersionsParams 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 consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithTimeout(timeout time.Duration) *ConsulServiceListUpgradeVersionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithContext(ctx context.Context) *ConsulServiceListUpgradeVersionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithHTTPClient(client *http.Client) *ConsulServiceListUpgradeVersionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithID(id string) *ConsulServiceListUpgradeVersionsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetID(id string) { + o.ID = id +} + +// WithLocationOrganizationID adds the locationOrganizationID to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceListUpgradeVersionsParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithLocationProjectID(locationProjectID string) *ConsulServiceListUpgradeVersionsParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceListUpgradeVersionsParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceListUpgradeVersionsParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the consul service list upgrade versions params +func (o *ConsulServiceListUpgradeVersionsParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceListUpgradeVersionsParams) 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/2020-08-26/client/consul_service/consul_service_list_upgrade_versions_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_upgrade_versions_responses.go new file mode 100644 index 00000000..ae5ba0ce --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceListUpgradeVersionsReader is a Reader for the ConsulServiceListUpgradeVersions structure. +type ConsulServiceListUpgradeVersionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceListUpgradeVersionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceListUpgradeVersionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceListUpgradeVersionsDefault(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 + } +} + +// NewConsulServiceListUpgradeVersionsOK creates a ConsulServiceListUpgradeVersionsOK with default headers values +func NewConsulServiceListUpgradeVersionsOK() *ConsulServiceListUpgradeVersionsOK { + return &ConsulServiceListUpgradeVersionsOK{} +} + +/*ConsulServiceListUpgradeVersionsOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceListUpgradeVersionsOK struct { + Payload *models.HashicorpCloudConsul20200826ListUpgradeVersionsResponse +} + +func (o *ConsulServiceListUpgradeVersionsOK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/upgrade-versions][%d] consulServiceListUpgradeVersionsOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceListUpgradeVersionsOK) GetPayload() *models.HashicorpCloudConsul20200826ListUpgradeVersionsResponse { + return o.Payload +} + +func (o *ConsulServiceListUpgradeVersionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826ListUpgradeVersionsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceListUpgradeVersionsDefault creates a ConsulServiceListUpgradeVersionsDefault with default headers values +func NewConsulServiceListUpgradeVersionsDefault(code int) *ConsulServiceListUpgradeVersionsDefault { + return &ConsulServiceListUpgradeVersionsDefault{ + _statusCode: code, + } +} + +/*ConsulServiceListUpgradeVersionsDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceListUpgradeVersionsDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service list upgrade versions default response +func (o *ConsulServiceListUpgradeVersionsDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceListUpgradeVersionsDefault) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/upgrade-versions][%d] ConsulService_ListUpgradeVersions default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceListUpgradeVersionsDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceListUpgradeVersionsDefault) 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/2020-08-26/client/consul_service/list_versions2_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions2_parameters.go similarity index 53% rename from clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions2_parameters.go rename to clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions2_parameters.go index 2013eea1..5a9dfcf4 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions2_parameters.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions2_parameters.go @@ -16,49 +16,49 @@ import ( "github.com/go-openapi/strfmt" ) -// NewListVersions2Params creates a new ListVersions2Params object +// NewConsulServiceListVersions2Params creates a new ConsulServiceListVersions2Params object // with the default values initialized. -func NewListVersions2Params() *ListVersions2Params { +func NewConsulServiceListVersions2Params() *ConsulServiceListVersions2Params { var () - return &ListVersions2Params{ + return &ConsulServiceListVersions2Params{ timeout: cr.DefaultTimeout, } } -// NewListVersions2ParamsWithTimeout creates a new ListVersions2Params object +// NewConsulServiceListVersions2ParamsWithTimeout creates a new ConsulServiceListVersions2Params object // with the default values initialized, and the ability to set a timeout on a request -func NewListVersions2ParamsWithTimeout(timeout time.Duration) *ListVersions2Params { +func NewConsulServiceListVersions2ParamsWithTimeout(timeout time.Duration) *ConsulServiceListVersions2Params { var () - return &ListVersions2Params{ + return &ConsulServiceListVersions2Params{ timeout: timeout, } } -// NewListVersions2ParamsWithContext creates a new ListVersions2Params object +// NewConsulServiceListVersions2ParamsWithContext creates a new ConsulServiceListVersions2Params object // with the default values initialized, and the ability to set a context for a request -func NewListVersions2ParamsWithContext(ctx context.Context) *ListVersions2Params { +func NewConsulServiceListVersions2ParamsWithContext(ctx context.Context) *ConsulServiceListVersions2Params { var () - return &ListVersions2Params{ + return &ConsulServiceListVersions2Params{ Context: ctx, } } -// NewListVersions2ParamsWithHTTPClient creates a new ListVersions2Params object +// NewConsulServiceListVersions2ParamsWithHTTPClient creates a new ConsulServiceListVersions2Params object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewListVersions2ParamsWithHTTPClient(client *http.Client) *ListVersions2Params { +func NewConsulServiceListVersions2ParamsWithHTTPClient(client *http.Client) *ConsulServiceListVersions2Params { var () - return &ListVersions2Params{ + return &ConsulServiceListVersions2Params{ 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 +/*ConsulServiceListVersions2Params contains all the parameters to send to the API endpoint +for the consul service list versions2 operation typically these are written to a http.Request */ -type ListVersions2Params struct { +type ConsulServiceListVersions2Params struct { /*LocationOrganizationID organization_id is the id of the organization. @@ -86,85 +86,85 @@ type ListVersions2Params struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the list versions2 params -func (o *ListVersions2Params) WithTimeout(timeout time.Duration) *ListVersions2Params { +// WithTimeout adds the timeout to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) WithTimeout(timeout time.Duration) *ConsulServiceListVersions2Params { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the list versions2 params -func (o *ListVersions2Params) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the list versions2 params -func (o *ListVersions2Params) WithContext(ctx context.Context) *ListVersions2Params { +// WithContext adds the context to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) WithContext(ctx context.Context) *ConsulServiceListVersions2Params { o.SetContext(ctx) return o } -// SetContext adds the context to the list versions2 params -func (o *ListVersions2Params) SetContext(ctx context.Context) { +// SetContext adds the context to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the list versions2 params -func (o *ListVersions2Params) WithHTTPClient(client *http.Client) *ListVersions2Params { +// WithHTTPClient adds the HTTPClient to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) WithHTTPClient(client *http.Client) *ConsulServiceListVersions2Params { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the list versions2 params -func (o *ListVersions2Params) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithLocationOrganizationID adds the locationOrganizationID to the list versions2 params -func (o *ListVersions2Params) WithLocationOrganizationID(locationOrganizationID *string) *ListVersions2Params { +// WithLocationOrganizationID adds the locationOrganizationID to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) WithLocationOrganizationID(locationOrganizationID *string) *ConsulServiceListVersions2Params { o.SetLocationOrganizationID(locationOrganizationID) return o } -// SetLocationOrganizationID adds the locationOrganizationId to the list versions2 params -func (o *ListVersions2Params) SetLocationOrganizationID(locationOrganizationID *string) { +// SetLocationOrganizationID adds the locationOrganizationId to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) SetLocationOrganizationID(locationOrganizationID *string) { o.LocationOrganizationID = locationOrganizationID } -// WithLocationProjectID adds the locationProjectID to the list versions2 params -func (o *ListVersions2Params) WithLocationProjectID(locationProjectID *string) *ListVersions2Params { +// WithLocationProjectID adds the locationProjectID to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) WithLocationProjectID(locationProjectID *string) *ConsulServiceListVersions2Params { o.SetLocationProjectID(locationProjectID) return o } -// SetLocationProjectID adds the locationProjectId to the list versions2 params -func (o *ListVersions2Params) SetLocationProjectID(locationProjectID *string) { +// SetLocationProjectID adds the locationProjectId to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) SetLocationProjectID(locationProjectID *string) { o.LocationProjectID = locationProjectID } -// WithLocationRegionProvider adds the locationRegionProvider to the list versions2 params -func (o *ListVersions2Params) WithLocationRegionProvider(locationRegionProvider *string) *ListVersions2Params { +// WithLocationRegionProvider adds the locationRegionProvider to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceListVersions2Params { o.SetLocationRegionProvider(locationRegionProvider) return o } -// SetLocationRegionProvider adds the locationRegionProvider to the list versions2 params -func (o *ListVersions2Params) SetLocationRegionProvider(locationRegionProvider *string) { +// SetLocationRegionProvider adds the locationRegionProvider to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) SetLocationRegionProvider(locationRegionProvider *string) { o.LocationRegionProvider = locationRegionProvider } -// WithLocationRegionRegion adds the locationRegionRegion to the list versions2 params -func (o *ListVersions2Params) WithLocationRegionRegion(locationRegionRegion *string) *ListVersions2Params { +// WithLocationRegionRegion adds the locationRegionRegion to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceListVersions2Params { o.SetLocationRegionRegion(locationRegionRegion) return o } -// SetLocationRegionRegion adds the locationRegionRegion to the list versions2 params -func (o *ListVersions2Params) SetLocationRegionRegion(locationRegionRegion *string) { +// SetLocationRegionRegion adds the locationRegionRegion to the consul service list versions2 params +func (o *ConsulServiceListVersions2Params) 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 { +func (o *ConsulServiceListVersions2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions2_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions2_responses.go new file mode 100644 index 00000000..06559c7c --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceListVersions2Reader is a Reader for the ConsulServiceListVersions2 structure. +type ConsulServiceListVersions2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceListVersions2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceListVersions2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceListVersions2Default(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 + } +} + +// NewConsulServiceListVersions2OK creates a ConsulServiceListVersions2OK with default headers values +func NewConsulServiceListVersions2OK() *ConsulServiceListVersions2OK { + return &ConsulServiceListVersions2OK{} +} + +/*ConsulServiceListVersions2OK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceListVersions2OK struct { + Payload *models.HashicorpCloudConsul20200826ListVersionsResponse +} + +func (o *ConsulServiceListVersions2OK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/versions][%d] consulServiceListVersions2OK %+v", 200, o.Payload) +} + +func (o *ConsulServiceListVersions2OK) GetPayload() *models.HashicorpCloudConsul20200826ListVersionsResponse { + return o.Payload +} + +func (o *ConsulServiceListVersions2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826ListVersionsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceListVersions2Default creates a ConsulServiceListVersions2Default with default headers values +func NewConsulServiceListVersions2Default(code int) *ConsulServiceListVersions2Default { + return &ConsulServiceListVersions2Default{ + _statusCode: code, + } +} + +/*ConsulServiceListVersions2Default handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceListVersions2Default struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service list versions2 default response +func (o *ConsulServiceListVersions2Default) Code() int { + return o._statusCode +} + +func (o *ConsulServiceListVersions2Default) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/versions][%d] ConsulService_ListVersions2 default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceListVersions2Default) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceListVersions2Default) 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/2020-08-26/client/consul_service/list_versions_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions_parameters.go similarity index 50% rename from clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions_parameters.go rename to clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions_parameters.go index 68f62d8a..3e69a384 100644 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions_parameters.go +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions_parameters.go @@ -16,49 +16,49 @@ import ( "github.com/go-openapi/strfmt" ) -// NewListVersionsParams creates a new ListVersionsParams object +// NewConsulServiceListVersionsParams creates a new ConsulServiceListVersionsParams object // with the default values initialized. -func NewListVersionsParams() *ListVersionsParams { +func NewConsulServiceListVersionsParams() *ConsulServiceListVersionsParams { var () - return &ListVersionsParams{ + return &ConsulServiceListVersionsParams{ timeout: cr.DefaultTimeout, } } -// NewListVersionsParamsWithTimeout creates a new ListVersionsParams object +// NewConsulServiceListVersionsParamsWithTimeout creates a new ConsulServiceListVersionsParams object // with the default values initialized, and the ability to set a timeout on a request -func NewListVersionsParamsWithTimeout(timeout time.Duration) *ListVersionsParams { +func NewConsulServiceListVersionsParamsWithTimeout(timeout time.Duration) *ConsulServiceListVersionsParams { var () - return &ListVersionsParams{ + return &ConsulServiceListVersionsParams{ timeout: timeout, } } -// NewListVersionsParamsWithContext creates a new ListVersionsParams object +// NewConsulServiceListVersionsParamsWithContext creates a new ConsulServiceListVersionsParams object // with the default values initialized, and the ability to set a context for a request -func NewListVersionsParamsWithContext(ctx context.Context) *ListVersionsParams { +func NewConsulServiceListVersionsParamsWithContext(ctx context.Context) *ConsulServiceListVersionsParams { var () - return &ListVersionsParams{ + return &ConsulServiceListVersionsParams{ Context: ctx, } } -// NewListVersionsParamsWithHTTPClient creates a new ListVersionsParams object +// NewConsulServiceListVersionsParamsWithHTTPClient creates a new ConsulServiceListVersionsParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewListVersionsParamsWithHTTPClient(client *http.Client) *ListVersionsParams { +func NewConsulServiceListVersionsParamsWithHTTPClient(client *http.Client) *ConsulServiceListVersionsParams { var () - return &ListVersionsParams{ + return &ConsulServiceListVersionsParams{ 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 +/*ConsulServiceListVersionsParams contains all the parameters to send to the API endpoint +for the consul service list versions operation typically these are written to a http.Request */ -type ListVersionsParams struct { +type ConsulServiceListVersionsParams struct { /*LocationOrganizationID organization_id is the id of the organization. @@ -86,85 +86,85 @@ type ListVersionsParams struct { HTTPClient *http.Client } -// WithTimeout adds the timeout to the list versions params -func (o *ListVersionsParams) WithTimeout(timeout time.Duration) *ListVersionsParams { +// WithTimeout adds the timeout to the consul service list versions params +func (o *ConsulServiceListVersionsParams) WithTimeout(timeout time.Duration) *ConsulServiceListVersionsParams { o.SetTimeout(timeout) return o } -// SetTimeout adds the timeout to the list versions params -func (o *ListVersionsParams) SetTimeout(timeout time.Duration) { +// SetTimeout adds the timeout to the consul service list versions params +func (o *ConsulServiceListVersionsParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } -// WithContext adds the context to the list versions params -func (o *ListVersionsParams) WithContext(ctx context.Context) *ListVersionsParams { +// WithContext adds the context to the consul service list versions params +func (o *ConsulServiceListVersionsParams) WithContext(ctx context.Context) *ConsulServiceListVersionsParams { o.SetContext(ctx) return o } -// SetContext adds the context to the list versions params -func (o *ListVersionsParams) SetContext(ctx context.Context) { +// SetContext adds the context to the consul service list versions params +func (o *ConsulServiceListVersionsParams) SetContext(ctx context.Context) { o.Context = ctx } -// WithHTTPClient adds the HTTPClient to the list versions params -func (o *ListVersionsParams) WithHTTPClient(client *http.Client) *ListVersionsParams { +// WithHTTPClient adds the HTTPClient to the consul service list versions params +func (o *ConsulServiceListVersionsParams) WithHTTPClient(client *http.Client) *ConsulServiceListVersionsParams { o.SetHTTPClient(client) return o } -// SetHTTPClient adds the HTTPClient to the list versions params -func (o *ListVersionsParams) SetHTTPClient(client *http.Client) { +// SetHTTPClient adds the HTTPClient to the consul service list versions params +func (o *ConsulServiceListVersionsParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithLocationOrganizationID adds the locationOrganizationID to the list versions params -func (o *ListVersionsParams) WithLocationOrganizationID(locationOrganizationID string) *ListVersionsParams { +// WithLocationOrganizationID adds the locationOrganizationID to the consul service list versions params +func (o *ConsulServiceListVersionsParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceListVersionsParams { o.SetLocationOrganizationID(locationOrganizationID) return o } -// SetLocationOrganizationID adds the locationOrganizationId to the list versions params -func (o *ListVersionsParams) SetLocationOrganizationID(locationOrganizationID string) { +// SetLocationOrganizationID adds the locationOrganizationId to the consul service list versions params +func (o *ConsulServiceListVersionsParams) SetLocationOrganizationID(locationOrganizationID string) { o.LocationOrganizationID = locationOrganizationID } -// WithLocationProjectID adds the locationProjectID to the list versions params -func (o *ListVersionsParams) WithLocationProjectID(locationProjectID string) *ListVersionsParams { +// WithLocationProjectID adds the locationProjectID to the consul service list versions params +func (o *ConsulServiceListVersionsParams) WithLocationProjectID(locationProjectID string) *ConsulServiceListVersionsParams { o.SetLocationProjectID(locationProjectID) return o } -// SetLocationProjectID adds the locationProjectId to the list versions params -func (o *ListVersionsParams) SetLocationProjectID(locationProjectID string) { +// SetLocationProjectID adds the locationProjectId to the consul service list versions params +func (o *ConsulServiceListVersionsParams) SetLocationProjectID(locationProjectID string) { o.LocationProjectID = locationProjectID } -// WithLocationRegionProvider adds the locationRegionProvider to the list versions params -func (o *ListVersionsParams) WithLocationRegionProvider(locationRegionProvider *string) *ListVersionsParams { +// WithLocationRegionProvider adds the locationRegionProvider to the consul service list versions params +func (o *ConsulServiceListVersionsParams) WithLocationRegionProvider(locationRegionProvider *string) *ConsulServiceListVersionsParams { o.SetLocationRegionProvider(locationRegionProvider) return o } -// SetLocationRegionProvider adds the locationRegionProvider to the list versions params -func (o *ListVersionsParams) SetLocationRegionProvider(locationRegionProvider *string) { +// SetLocationRegionProvider adds the locationRegionProvider to the consul service list versions params +func (o *ConsulServiceListVersionsParams) SetLocationRegionProvider(locationRegionProvider *string) { o.LocationRegionProvider = locationRegionProvider } -// WithLocationRegionRegion adds the locationRegionRegion to the list versions params -func (o *ListVersionsParams) WithLocationRegionRegion(locationRegionRegion *string) *ListVersionsParams { +// WithLocationRegionRegion adds the locationRegionRegion to the consul service list versions params +func (o *ConsulServiceListVersionsParams) WithLocationRegionRegion(locationRegionRegion *string) *ConsulServiceListVersionsParams { o.SetLocationRegionRegion(locationRegionRegion) return o } -// SetLocationRegionRegion adds the locationRegionRegion to the list versions params -func (o *ListVersionsParams) SetLocationRegionRegion(locationRegionRegion *string) { +// SetLocationRegionRegion adds the locationRegionRegion to the consul service list versions params +func (o *ConsulServiceListVersionsParams) 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 { +func (o *ConsulServiceListVersionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_list_versions_responses.go new file mode 100644 index 00000000..953822f6 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceListVersionsReader is a Reader for the ConsulServiceListVersions structure. +type ConsulServiceListVersionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceListVersionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceListVersionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceListVersionsDefault(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 + } +} + +// NewConsulServiceListVersionsOK creates a ConsulServiceListVersionsOK with default headers values +func NewConsulServiceListVersionsOK() *ConsulServiceListVersionsOK { + return &ConsulServiceListVersionsOK{} +} + +/*ConsulServiceListVersionsOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceListVersionsOK struct { + Payload *models.HashicorpCloudConsul20200826ListVersionsResponse +} + +func (o *ConsulServiceListVersionsOK) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/versions][%d] consulServiceListVersionsOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceListVersionsOK) GetPayload() *models.HashicorpCloudConsul20200826ListVersionsResponse { + return o.Payload +} + +func (o *ConsulServiceListVersionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826ListVersionsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceListVersionsDefault creates a ConsulServiceListVersionsDefault with default headers values +func NewConsulServiceListVersionsDefault(code int) *ConsulServiceListVersionsDefault { + return &ConsulServiceListVersionsDefault{ + _statusCode: code, + } +} + +/*ConsulServiceListVersionsDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceListVersionsDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service list versions default response +func (o *ConsulServiceListVersionsDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceListVersionsDefault) Error() string { + return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/versions][%d] ConsulService_ListVersions default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceListVersionsDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceListVersionsDefault) 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/2020-08-26/client/consul_service/consul_service_restore_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_restore_snapshot_parameters.go new file mode 100644 index 00000000..d1530dfd --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// NewConsulServiceRestoreSnapshotParams creates a new ConsulServiceRestoreSnapshotParams object +// with the default values initialized. +func NewConsulServiceRestoreSnapshotParams() *ConsulServiceRestoreSnapshotParams { + var () + return &ConsulServiceRestoreSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceRestoreSnapshotParamsWithTimeout creates a new ConsulServiceRestoreSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceRestoreSnapshotParamsWithTimeout(timeout time.Duration) *ConsulServiceRestoreSnapshotParams { + var () + return &ConsulServiceRestoreSnapshotParams{ + + timeout: timeout, + } +} + +// NewConsulServiceRestoreSnapshotParamsWithContext creates a new ConsulServiceRestoreSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceRestoreSnapshotParamsWithContext(ctx context.Context) *ConsulServiceRestoreSnapshotParams { + var () + return &ConsulServiceRestoreSnapshotParams{ + + Context: ctx, + } +} + +// NewConsulServiceRestoreSnapshotParamsWithHTTPClient creates a new ConsulServiceRestoreSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceRestoreSnapshotParamsWithHTTPClient(client *http.Client) *ConsulServiceRestoreSnapshotParams { + var () + return &ConsulServiceRestoreSnapshotParams{ + HTTPClient: client, + } +} + +/*ConsulServiceRestoreSnapshotParams contains all the parameters to send to the API endpoint +for the consul service restore snapshot operation typically these are written to a http.Request +*/ +type ConsulServiceRestoreSnapshotParams struct { + + /*Body*/ + Body *models.HashicorpCloudConsul20200826RestoreSnapshotRequest + /*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 consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) WithTimeout(timeout time.Duration) *ConsulServiceRestoreSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) WithContext(ctx context.Context) *ConsulServiceRestoreSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) WithHTTPClient(client *http.Client) *ConsulServiceRestoreSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) WithBody(body *models.HashicorpCloudConsul20200826RestoreSnapshotRequest) *ConsulServiceRestoreSnapshotParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) SetBody(body *models.HashicorpCloudConsul20200826RestoreSnapshotRequest) { + o.Body = body +} + +// WithClusterID adds the clusterID to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) WithClusterID(clusterID string) *ConsulServiceRestoreSnapshotParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) WithLocationOrganizationID(locationOrganizationID string) *ConsulServiceRestoreSnapshotParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) WithLocationProjectID(locationProjectID string) *ConsulServiceRestoreSnapshotParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the consul service restore snapshot params +func (o *ConsulServiceRestoreSnapshotParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceRestoreSnapshotParams) 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/2020-08-26/client/consul_service/consul_service_restore_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_restore_snapshot_responses.go new file mode 100644 index 00000000..87278109 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceRestoreSnapshotReader is a Reader for the ConsulServiceRestoreSnapshot structure. +type ConsulServiceRestoreSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceRestoreSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceRestoreSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceRestoreSnapshotDefault(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 + } +} + +// NewConsulServiceRestoreSnapshotOK creates a ConsulServiceRestoreSnapshotOK with default headers values +func NewConsulServiceRestoreSnapshotOK() *ConsulServiceRestoreSnapshotOK { + return &ConsulServiceRestoreSnapshotOK{} +} + +/*ConsulServiceRestoreSnapshotOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceRestoreSnapshotOK struct { + Payload *models.HashicorpCloudConsul20200826RestoreSnapshotResponse +} + +func (o *ConsulServiceRestoreSnapshotOK) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/restore][%d] consulServiceRestoreSnapshotOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceRestoreSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826RestoreSnapshotResponse { + return o.Payload +} + +func (o *ConsulServiceRestoreSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826RestoreSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceRestoreSnapshotDefault creates a ConsulServiceRestoreSnapshotDefault with default headers values +func NewConsulServiceRestoreSnapshotDefault(code int) *ConsulServiceRestoreSnapshotDefault { + return &ConsulServiceRestoreSnapshotDefault{ + _statusCode: code, + } +} + +/*ConsulServiceRestoreSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceRestoreSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service restore snapshot default response +func (o *ConsulServiceRestoreSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceRestoreSnapshotDefault) Error() string { + return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/restore][%d] ConsulService_RestoreSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceRestoreSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceRestoreSnapshotDefault) 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/2020-08-26/client/consul_service/consul_service_update_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_update_parameters.go new file mode 100644 index 00000000..0770a71d --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// NewConsulServiceUpdateParams creates a new ConsulServiceUpdateParams object +// with the default values initialized. +func NewConsulServiceUpdateParams() *ConsulServiceUpdateParams { + var () + return &ConsulServiceUpdateParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceUpdateParamsWithTimeout creates a new ConsulServiceUpdateParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceUpdateParamsWithTimeout(timeout time.Duration) *ConsulServiceUpdateParams { + var () + return &ConsulServiceUpdateParams{ + + timeout: timeout, + } +} + +// NewConsulServiceUpdateParamsWithContext creates a new ConsulServiceUpdateParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceUpdateParamsWithContext(ctx context.Context) *ConsulServiceUpdateParams { + var () + return &ConsulServiceUpdateParams{ + + Context: ctx, + } +} + +// NewConsulServiceUpdateParamsWithHTTPClient creates a new ConsulServiceUpdateParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceUpdateParamsWithHTTPClient(client *http.Client) *ConsulServiceUpdateParams { + var () + return &ConsulServiceUpdateParams{ + HTTPClient: client, + } +} + +/*ConsulServiceUpdateParams contains all the parameters to send to the API endpoint +for the consul service update operation typically these are written to a http.Request +*/ +type ConsulServiceUpdateParams struct { + + /*Body + cluster is the complete cluster resource to be updated. + + */ + Body *models.HashicorpCloudConsul20200826Cluster + /*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 consul service update params +func (o *ConsulServiceUpdateParams) WithTimeout(timeout time.Duration) *ConsulServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service update params +func (o *ConsulServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service update params +func (o *ConsulServiceUpdateParams) WithContext(ctx context.Context) *ConsulServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service update params +func (o *ConsulServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service update params +func (o *ConsulServiceUpdateParams) WithHTTPClient(client *http.Client) *ConsulServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service update params +func (o *ConsulServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the consul service update params +func (o *ConsulServiceUpdateParams) WithBody(body *models.HashicorpCloudConsul20200826Cluster) *ConsulServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the consul service update params +func (o *ConsulServiceUpdateParams) SetBody(body *models.HashicorpCloudConsul20200826Cluster) { + o.Body = body +} + +// WithClusterID adds the clusterID to the consul service update params +func (o *ConsulServiceUpdateParams) WithClusterID(clusterID string) *ConsulServiceUpdateParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the consul service update params +func (o *ConsulServiceUpdateParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithClusterLocationOrganizationID adds the clusterLocationOrganizationID to the consul service update params +func (o *ConsulServiceUpdateParams) WithClusterLocationOrganizationID(clusterLocationOrganizationID string) *ConsulServiceUpdateParams { + o.SetClusterLocationOrganizationID(clusterLocationOrganizationID) + return o +} + +// SetClusterLocationOrganizationID adds the clusterLocationOrganizationId to the consul service update params +func (o *ConsulServiceUpdateParams) SetClusterLocationOrganizationID(clusterLocationOrganizationID string) { + o.ClusterLocationOrganizationID = clusterLocationOrganizationID +} + +// WithClusterLocationProjectID adds the clusterLocationProjectID to the consul service update params +func (o *ConsulServiceUpdateParams) WithClusterLocationProjectID(clusterLocationProjectID string) *ConsulServiceUpdateParams { + o.SetClusterLocationProjectID(clusterLocationProjectID) + return o +} + +// SetClusterLocationProjectID adds the clusterLocationProjectId to the consul service update params +func (o *ConsulServiceUpdateParams) SetClusterLocationProjectID(clusterLocationProjectID string) { + o.ClusterLocationProjectID = clusterLocationProjectID +} + +// WithUpdateMaskPaths adds the updateMaskPaths to the consul service update params +func (o *ConsulServiceUpdateParams) WithUpdateMaskPaths(updateMaskPaths []string) *ConsulServiceUpdateParams { + o.SetUpdateMaskPaths(updateMaskPaths) + return o +} + +// SetUpdateMaskPaths adds the updateMaskPaths to the consul service update params +func (o *ConsulServiceUpdateParams) SetUpdateMaskPaths(updateMaskPaths []string) { + o.UpdateMaskPaths = updateMaskPaths +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceUpdateParams) 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/2020-08-26/client/consul_service/consul_service_update_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_update_responses.go new file mode 100644 index 00000000..57b0d25c --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceUpdateReader is a Reader for the ConsulServiceUpdate structure. +type ConsulServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceUpdateDefault(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 + } +} + +// NewConsulServiceUpdateOK creates a ConsulServiceUpdateOK with default headers values +func NewConsulServiceUpdateOK() *ConsulServiceUpdateOK { + return &ConsulServiceUpdateOK{} +} + +/*ConsulServiceUpdateOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceUpdateOK struct { + Payload *models.HashicorpCloudConsul20200826UpdateResponse +} + +func (o *ConsulServiceUpdateOK) Error() string { + return fmt.Sprintf("[PATCH /consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters/{cluster.id}][%d] consulServiceUpdateOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceUpdateOK) GetPayload() *models.HashicorpCloudConsul20200826UpdateResponse { + return o.Payload +} + +func (o *ConsulServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826UpdateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceUpdateDefault creates a ConsulServiceUpdateDefault with default headers values +func NewConsulServiceUpdateDefault(code int) *ConsulServiceUpdateDefault { + return &ConsulServiceUpdateDefault{ + _statusCode: code, + } +} + +/*ConsulServiceUpdateDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceUpdateDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service update default response +func (o *ConsulServiceUpdateDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceUpdateDefault) Error() string { + return fmt.Sprintf("[PATCH /consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters/{cluster.id}][%d] ConsulService_Update default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceUpdateDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceUpdateDefault) 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/2020-08-26/client/consul_service/consul_service_update_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_update_snapshot_parameters.go new file mode 100644 index 00000000..10c331ea --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// NewConsulServiceUpdateSnapshotParams creates a new ConsulServiceUpdateSnapshotParams object +// with the default values initialized. +func NewConsulServiceUpdateSnapshotParams() *ConsulServiceUpdateSnapshotParams { + var () + return &ConsulServiceUpdateSnapshotParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewConsulServiceUpdateSnapshotParamsWithTimeout creates a new ConsulServiceUpdateSnapshotParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewConsulServiceUpdateSnapshotParamsWithTimeout(timeout time.Duration) *ConsulServiceUpdateSnapshotParams { + var () + return &ConsulServiceUpdateSnapshotParams{ + + timeout: timeout, + } +} + +// NewConsulServiceUpdateSnapshotParamsWithContext creates a new ConsulServiceUpdateSnapshotParams object +// with the default values initialized, and the ability to set a context for a request +func NewConsulServiceUpdateSnapshotParamsWithContext(ctx context.Context) *ConsulServiceUpdateSnapshotParams { + var () + return &ConsulServiceUpdateSnapshotParams{ + + Context: ctx, + } +} + +// NewConsulServiceUpdateSnapshotParamsWithHTTPClient creates a new ConsulServiceUpdateSnapshotParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewConsulServiceUpdateSnapshotParamsWithHTTPClient(client *http.Client) *ConsulServiceUpdateSnapshotParams { + var () + return &ConsulServiceUpdateSnapshotParams{ + HTTPClient: client, + } +} + +/*ConsulServiceUpdateSnapshotParams contains all the parameters to send to the API endpoint +for the consul service update snapshot operation typically these are written to a http.Request +*/ +type ConsulServiceUpdateSnapshotParams struct { + + /*Body + snapshot contains the fields to update. + + Supported fields: name + + */ + Body *models.HashicorpCloudConsul20200826Snapshot + /*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 consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithTimeout(timeout time.Duration) *ConsulServiceUpdateSnapshotParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithContext(ctx context.Context) *ConsulServiceUpdateSnapshotParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithHTTPClient(client *http.Client) *ConsulServiceUpdateSnapshotParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithBody(body *models.HashicorpCloudConsul20200826Snapshot) *ConsulServiceUpdateSnapshotParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetBody(body *models.HashicorpCloudConsul20200826Snapshot) { + o.Body = body +} + +// WithMaskPaths adds the maskPaths to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithMaskPaths(maskPaths []string) *ConsulServiceUpdateSnapshotParams { + o.SetMaskPaths(maskPaths) + return o +} + +// SetMaskPaths adds the maskPaths to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetMaskPaths(maskPaths []string) { + o.MaskPaths = maskPaths +} + +// WithSnapshotID adds the snapshotID to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithSnapshotID(snapshotID string) *ConsulServiceUpdateSnapshotParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WithSnapshotLocationOrganizationID adds the snapshotLocationOrganizationID to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithSnapshotLocationOrganizationID(snapshotLocationOrganizationID string) *ConsulServiceUpdateSnapshotParams { + o.SetSnapshotLocationOrganizationID(snapshotLocationOrganizationID) + return o +} + +// SetSnapshotLocationOrganizationID adds the snapshotLocationOrganizationId to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetSnapshotLocationOrganizationID(snapshotLocationOrganizationID string) { + o.SnapshotLocationOrganizationID = snapshotLocationOrganizationID +} + +// WithSnapshotLocationProjectID adds the snapshotLocationProjectID to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) WithSnapshotLocationProjectID(snapshotLocationProjectID string) *ConsulServiceUpdateSnapshotParams { + o.SetSnapshotLocationProjectID(snapshotLocationProjectID) + return o +} + +// SetSnapshotLocationProjectID adds the snapshotLocationProjectId to the consul service update snapshot params +func (o *ConsulServiceUpdateSnapshotParams) SetSnapshotLocationProjectID(snapshotLocationProjectID string) { + o.SnapshotLocationProjectID = snapshotLocationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConsulServiceUpdateSnapshotParams) 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/2020-08-26/client/consul_service/consul_service_update_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/consul_service_update_snapshot_responses.go new file mode 100644 index 00000000..1d17b1d8 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/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/2020-08-26/models" +) + +// ConsulServiceUpdateSnapshotReader is a Reader for the ConsulServiceUpdateSnapshot structure. +type ConsulServiceUpdateSnapshotReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConsulServiceUpdateSnapshotReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConsulServiceUpdateSnapshotOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewConsulServiceUpdateSnapshotDefault(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 + } +} + +// NewConsulServiceUpdateSnapshotOK creates a ConsulServiceUpdateSnapshotOK with default headers values +func NewConsulServiceUpdateSnapshotOK() *ConsulServiceUpdateSnapshotOK { + return &ConsulServiceUpdateSnapshotOK{} +} + +/*ConsulServiceUpdateSnapshotOK handles this case with default header values. + +A successful response. +*/ +type ConsulServiceUpdateSnapshotOK struct { + Payload *models.HashicorpCloudConsul20200826UpdateSnapshotResponse +} + +func (o *ConsulServiceUpdateSnapshotOK) Error() string { + return fmt.Sprintf("[PATCH /consul/2020-08-26/organizations/{snapshot.location.organization_id}/projects/{snapshot.location.project_id}/snapshots/{snapshot.id}][%d] consulServiceUpdateSnapshotOK %+v", 200, o.Payload) +} + +func (o *ConsulServiceUpdateSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826UpdateSnapshotResponse { + return o.Payload +} + +func (o *ConsulServiceUpdateSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudConsul20200826UpdateSnapshotResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConsulServiceUpdateSnapshotDefault creates a ConsulServiceUpdateSnapshotDefault with default headers values +func NewConsulServiceUpdateSnapshotDefault(code int) *ConsulServiceUpdateSnapshotDefault { + return &ConsulServiceUpdateSnapshotDefault{ + _statusCode: code, + } +} + +/*ConsulServiceUpdateSnapshotDefault handles this case with default header values. + +An unexpected error response. +*/ +type ConsulServiceUpdateSnapshotDefault struct { + _statusCode int + + Payload *models.GrpcGatewayRuntimeError +} + +// Code gets the status code for the consul service update snapshot default response +func (o *ConsulServiceUpdateSnapshotDefault) Code() int { + return o._statusCode +} + +func (o *ConsulServiceUpdateSnapshotDefault) Error() string { + return fmt.Sprintf("[PATCH /consul/2020-08-26/organizations/{snapshot.location.organization_id}/projects/{snapshot.location.project_id}/snapshots/{snapshot.id}][%d] ConsulService_UpdateSnapshot default %+v", o._statusCode, o.Payload) +} + +func (o *ConsulServiceUpdateSnapshotDefault) GetPayload() *models.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ConsulServiceUpdateSnapshotDefault) 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/2020-08-26/client/consul_service/create_customer_master_acl_token_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_customer_master_acl_token_parameters.go deleted file mode 100644 index bc5feeb2..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_customer_master_acl_token_parameters.go +++ /dev/null @@ -1,198 +0,0 @@ -// 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/2020-08-26/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.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenRequest - /*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.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenRequest) *CreateCustomerMasterACLTokenParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the create customer master ACL token params -func (o *CreateCustomerMasterACLTokenParams) SetBody(body *models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenRequest) { - 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/2020-08-26/client/consul_service/create_customer_master_acl_token_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_customer_master_acl_token_responses.go deleted file mode 100644 index 3f760f8b..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_customer_master_acl_token_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenResponse -} - -func (o *CreateCustomerMasterACLTokenOK) Error() string { - return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/master-acl-tokens][%d] createCustomerMasterAclTokenOK %+v", 200, o.Payload) -} - -func (o *CreateCustomerMasterACLTokenOK) GetPayload() *models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenResponse { - return o.Payload -} - -func (o *CreateCustomerMasterACLTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826CreateCustomerMasterACLTokenResponse) - - // 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/2020-08-26/client/consul_service/create_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_parameters.go deleted file mode 100644 index 68feccd9..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_parameters.go +++ /dev/null @@ -1,177 +0,0 @@ -// 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/2020-08-26/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.HashicorpCloudConsul20200826CreateRequest - /*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.HashicorpCloudConsul20200826CreateRequest) *CreateParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the create params -func (o *CreateParams) SetBody(body *models.HashicorpCloudConsul20200826CreateRequest) { - 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/2020-08-26/client/consul_service/create_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_responses.go deleted file mode 100644 index 83b22764..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826CreateResponse -} - -func (o *CreateOK) Error() string { - return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters][%d] createOK %+v", 200, o.Payload) -} - -func (o *CreateOK) GetPayload() *models.HashicorpCloudConsul20200826CreateResponse { - return o.Payload -} - -func (o *CreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826CreateResponse) - - // 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/2020-08-26/client/consul_service/create_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_snapshot_parameters.go deleted file mode 100644 index 0f47873f..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_snapshot_parameters.go +++ /dev/null @@ -1,177 +0,0 @@ -// 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/2020-08-26/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.HashicorpCloudConsul20200826CreateSnapshotRequest - /*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.HashicorpCloudConsul20200826CreateSnapshotRequest) *CreateSnapshotParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the create snapshot params -func (o *CreateSnapshotParams) SetBody(body *models.HashicorpCloudConsul20200826CreateSnapshotRequest) { - 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/2020-08-26/client/consul_service/create_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_snapshot_responses.go deleted file mode 100644 index a627e583..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/create_snapshot_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826CreateSnapshotResponse -} - -func (o *CreateSnapshotOK) Error() string { - return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] createSnapshotOK %+v", 200, o.Payload) -} - -func (o *CreateSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826CreateSnapshotResponse { - return o.Payload -} - -func (o *CreateSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826CreateSnapshotResponse) - - // 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/2020-08-26/client/consul_service/delete_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_parameters.go deleted file mode 100644 index d5bec239..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_parameters.go +++ /dev/null @@ -1,241 +0,0 @@ -// 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/2020-08-26/client/consul_service/delete_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_responses.go deleted file mode 100644 index 9bcffb1c..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826DeleteResponse -} - -func (o *DeleteOK) Error() string { - return fmt.Sprintf("[DELETE /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] deleteOK %+v", 200, o.Payload) -} - -func (o *DeleteOK) GetPayload() *models.HashicorpCloudConsul20200826DeleteResponse { - return o.Payload -} - -func (o *DeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826DeleteResponse) - - // 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/2020-08-26/client/consul_service/delete_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_snapshot_parameters.go deleted file mode 100644 index d95a6f57..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_snapshot_parameters.go +++ /dev/null @@ -1,241 +0,0 @@ -// 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/2020-08-26/client/consul_service/delete_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_snapshot_responses.go deleted file mode 100644 index af46b1e0..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/delete_snapshot_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826DeleteSnapshotResponse -} - -func (o *DeleteSnapshotOK) Error() string { - return fmt.Sprintf("[DELETE /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] deleteSnapshotOK %+v", 200, o.Payload) -} - -func (o *DeleteSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826DeleteSnapshotResponse { - return o.Payload -} - -func (o *DeleteSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826DeleteSnapshotResponse) - - // 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/2020-08-26/client/consul_service/get_client_config_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_client_config_parameters.go deleted file mode 100644 index 64301b47..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_client_config_parameters.go +++ /dev/null @@ -1,274 +0,0 @@ -// 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/2020-08-26/client/consul_service/get_client_config_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_client_config_responses.go deleted file mode 100644 index 0073ce78..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_client_config_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826GetClientConfigResponse -} - -func (o *GetClientConfigOK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/client-config][%d] getClientConfigOK %+v", 200, o.Payload) -} - -func (o *GetClientConfigOK) GetPayload() *models.HashicorpCloudConsul20200826GetClientConfigResponse { - return o.Payload -} - -func (o *GetClientConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826GetClientConfigResponse) - - // 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/2020-08-26/client/consul_service/get_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_responses.go deleted file mode 100644 index 87d617fc..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826GetResponse -} - -func (o *GetOK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}][%d] getOK %+v", 200, o.Payload) -} - -func (o *GetOK) GetPayload() *models.HashicorpCloudConsul20200826GetResponse { - return o.Payload -} - -func (o *GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826GetResponse) - - // 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/2020-08-26/client/consul_service/get_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_snapshot_responses.go deleted file mode 100644 index c003202c..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/get_snapshot_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826GetSnapshotResponse -} - -func (o *GetSnapshotOK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}][%d] getSnapshotOK %+v", 200, o.Payload) -} - -func (o *GetSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826GetSnapshotResponse { - return o.Payload -} - -func (o *GetSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826GetSnapshotResponse) - - // 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/2020-08-26/client/consul_service/list_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_responses.go deleted file mode 100644 index 4c8dcbcd..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826ListResponse -} - -func (o *ListOK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters][%d] listOK %+v", 200, o.Payload) -} - -func (o *ListOK) GetPayload() *models.HashicorpCloudConsul20200826ListResponse { - return o.Payload -} - -func (o *ListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826ListResponse) - - // 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/2020-08-26/client/consul_service/list_snapshots_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_snapshots_responses.go deleted file mode 100644 index 9665dbb4..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_snapshots_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826ListSnapshotsResponse -} - -func (o *ListSnapshotsOK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{resource.location.organization_id}/projects/{resource.location.project_id}/snapshots][%d] listSnapshotsOK %+v", 200, o.Payload) -} - -func (o *ListSnapshotsOK) GetPayload() *models.HashicorpCloudConsul20200826ListSnapshotsResponse { - return o.Payload -} - -func (o *ListSnapshotsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826ListSnapshotsResponse) - - // 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/2020-08-26/client/consul_service/list_upgrade_versions_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_upgrade_versions_responses.go deleted file mode 100644 index 17874e22..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_upgrade_versions_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826ListUpgradeVersionsResponse -} - -func (o *ListUpgradeVersionsOK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{id}/upgrade-versions][%d] listUpgradeVersionsOK %+v", 200, o.Payload) -} - -func (o *ListUpgradeVersionsOK) GetPayload() *models.HashicorpCloudConsul20200826ListUpgradeVersionsResponse { - return o.Payload -} - -func (o *ListUpgradeVersionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826ListUpgradeVersionsResponse) - - // 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/2020-08-26/client/consul_service/list_versions2_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions2_responses.go deleted file mode 100644 index fa3eb1ca..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions2_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826ListVersionsResponse -} - -func (o *ListVersions2OK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/versions][%d] listVersions2OK %+v", 200, o.Payload) -} - -func (o *ListVersions2OK) GetPayload() *models.HashicorpCloudConsul20200826ListVersionsResponse { - return o.Payload -} - -func (o *ListVersions2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826ListVersionsResponse) - - // 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/2020-08-26/client/consul_service/list_versions_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions_responses.go deleted file mode 100644 index 6e7f9a51..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/list_versions_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826ListVersionsResponse -} - -func (o *ListVersionsOK) Error() string { - return fmt.Sprintf("[GET /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/versions][%d] listVersionsOK %+v", 200, o.Payload) -} - -func (o *ListVersionsOK) GetPayload() *models.HashicorpCloudConsul20200826ListVersionsResponse { - return o.Payload -} - -func (o *ListVersionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826ListVersionsResponse) - - // 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/2020-08-26/client/consul_service/restore_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/restore_snapshot_parameters.go deleted file mode 100644 index 2b902a1d..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/restore_snapshot_parameters.go +++ /dev/null @@ -1,198 +0,0 @@ -// 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/2020-08-26/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.HashicorpCloudConsul20200826RestoreSnapshotRequest - /*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.HashicorpCloudConsul20200826RestoreSnapshotRequest) *RestoreSnapshotParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the restore snapshot params -func (o *RestoreSnapshotParams) SetBody(body *models.HashicorpCloudConsul20200826RestoreSnapshotRequest) { - 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/2020-08-26/client/consul_service/restore_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/restore_snapshot_responses.go deleted file mode 100644 index ac971b23..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/restore_snapshot_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826RestoreSnapshotResponse -} - -func (o *RestoreSnapshotOK) Error() string { - return fmt.Sprintf("[POST /consul/2020-08-26/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/restore][%d] restoreSnapshotOK %+v", 200, o.Payload) -} - -func (o *RestoreSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826RestoreSnapshotResponse { - return o.Payload -} - -func (o *RestoreSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826RestoreSnapshotResponse) - - // 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/2020-08-26/client/consul_service/update_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_parameters.go deleted file mode 100644 index 141f0694..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_parameters.go +++ /dev/null @@ -1,201 +0,0 @@ -// 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/2020-08-26/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.HashicorpCloudConsul20200826Cluster - /*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 - - 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.HashicorpCloudConsul20200826Cluster) *UpdateParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the update params -func (o *UpdateParams) SetBody(body *models.HashicorpCloudConsul20200826Cluster) { - 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 -} - -// 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 - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_responses.go deleted file mode 100644 index 403971de..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826UpdateResponse -} - -func (o *UpdateOK) Error() string { - return fmt.Sprintf("[PATCH /consul/2020-08-26/organizations/{cluster.location.organization_id}/projects/{cluster.location.project_id}/clusters/{cluster.id}][%d] updateOK %+v", 200, o.Payload) -} - -func (o *UpdateOK) GetPayload() *models.HashicorpCloudConsul20200826UpdateResponse { - return o.Payload -} - -func (o *UpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826UpdateResponse) - - // 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/2020-08-26/client/consul_service/update_snapshot_parameters.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_snapshot_parameters.go deleted file mode 100644 index 3a9e17d8..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_snapshot_parameters.go +++ /dev/null @@ -1,203 +0,0 @@ -// 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/2020-08-26/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.HashicorpCloudConsul20200826Snapshot - /*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.HashicorpCloudConsul20200826Snapshot) *UpdateSnapshotParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the update snapshot params -func (o *UpdateSnapshotParams) SetBody(body *models.HashicorpCloudConsul20200826Snapshot) { - o.Body = body -} - -// 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 - } - } - - // 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/2020-08-26/client/consul_service/update_snapshot_responses.go b/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_snapshot_responses.go deleted file mode 100644 index 07ca5284..00000000 --- a/clients/cloud-consul-service/preview/2020-08-26/client/consul_service/update_snapshot_responses.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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/2020-08-26/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: - return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) - } -} - -// 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.HashicorpCloudConsul20200826UpdateSnapshotResponse -} - -func (o *UpdateSnapshotOK) Error() string { - return fmt.Sprintf("[PATCH /consul/2020-08-26/organizations/{snapshot.location.organization_id}/projects/{snapshot.location.project_id}/snapshots/{snapshot.id}][%d] updateSnapshotOK %+v", 200, o.Payload) -} - -func (o *UpdateSnapshotOK) GetPayload() *models.HashicorpCloudConsul20200826UpdateSnapshotResponse { - return o.Payload -} - -func (o *UpdateSnapshotOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudConsul20200826UpdateSnapshotResponse) - - // 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/2020-08-26/models/grpc_gateway_runtime_error.go b/clients/cloud-consul-service/preview/2020-08-26/models/grpc_gateway_runtime_error.go new file mode 100644 index 00000000..b3843c79 --- /dev/null +++ b/clients/cloud-consul-service/preview/2020-08-26/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/cmd/hcp-sdk-go-client/main.go b/cmd/hcp-sdk-go-client/main.go index e982902e..f1dc54ce 100644 --- a/cmd/hcp-sdk-go-client/main.go +++ b/cmd/hcp-sdk-go-client/main.go @@ -42,11 +42,11 @@ func main() { fmt.Printf("Response: %#v\n\n", resp.Payload) } - listParams2 := consul.NewListParams() + listParams2 := consul.NewConsulServiceListParams() listParams2.LocationOrganizationID = orgID listParams2.LocationProjectID = projID - resp2, err := consulClient.List(listParams2, nil) + resp2, err := consulClient.ConsulServiceList(listParams2, nil) if err != nil { log.Fatal(err) } diff --git a/httpclient/httpclient_test.go b/httpclient/httpclient_test.go index 84b7db64..9ac8febd 100644 --- a/httpclient/httpclient_test.go +++ b/httpclient/httpclient_test.go @@ -79,11 +79,11 @@ func TestNew(t *testing.T) { require.NoError(t, err) consulClient := consul.New(cl, nil) - listParams := consul.NewListParams() + listParams := consul.NewConsulServiceListParams() listParams.LocationOrganizationID = orgID listParams.LocationProjectID = projID // This SDK request hits the mock Consul List API handler above ('/consul/2020-08-26/organizations...'). // The handler verifies that the expected bearer token is provided. - consulClient.List(listParams, nil) // nolint:errcheck + consulClient.ConsulServiceList(listParams, nil) // nolint:errcheck }