From 8e45722dd4947fb97ade66b64291bdf217a5bada Mon Sep 17 00:00:00 2001 From: HashiCorp Cloud Services Date: Fri, 4 Aug 2023 11:58:55 +0000 Subject: [PATCH] Update cloud-vault-link-service SDK --- ...authenticate_user_to_cluster_parameters.go | 209 +++++++++ .../authenticate_user_to_cluster_responses.go | 422 ++++++++++++++++++ .../enable_d_r_parameters.go | 209 +++++++++ .../enable_d_r_responses.go | 362 +++++++++++++++ .../get_linked_cluster_parameters.go | 4 +- .../get_linked_cluster_policy_parameters.go | 28 +- .../get_linked_cluster_policy_responses.go | 8 +- .../get_vault_policies_parameters.go | 260 +++++++++++ .../get_vault_policies_responses.go | 178 ++++++++ .../inspect_router_parameters.go | 260 +++++++++++ .../inspect_router_responses.go | 178 ++++++++ ...e_linked_cluster_credentials_parameters.go | 4 +- ...e_linked_cluster_credentials_parameters.go | 68 +++ .../vault_link_service_client.go | 162 ++++++- ...p_cloud_vault_link20221107_api_response.go | 11 + ...107_authenticate_user_request_auth_type.go | 81 ++++ ...link20221107_authenticate_user_response.go | 62 +++ ...lt_link20221107_inspect_router_response.go | 116 +++++ ...cloud_vault_link20221107_linked_cluster.go | 27 +- ..._vault_link20221107_linked_cluster_node.go | 8 +- ...21107_linked_cluster_node_leader_status.go | 14 +- ...vault_link20221107_linked_cluster_state.go | 5 +- ...orp_cloud_vault_link20221107_route_path.go | 68 +++ ...ault_link20221107_vault_policy_response.go | 50 +++ 24 files changed, 2756 insertions(+), 38 deletions(-) create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_parameters.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_responses.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_parameters.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_responses.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_parameters.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_responses.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_parameters.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_responses.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_api_response.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_request_auth_type.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_response.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_inspect_router_response.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_route_path.go create mode 100644 clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_vault_policy_response.go diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_parameters.go new file mode 100644 index 00000000..67c9ebc1 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_parameters.go @@ -0,0 +1,209 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" +) + +// NewAuthenticateUserToClusterParams creates a new AuthenticateUserToClusterParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewAuthenticateUserToClusterParams() *AuthenticateUserToClusterParams { + return &AuthenticateUserToClusterParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAuthenticateUserToClusterParamsWithTimeout creates a new AuthenticateUserToClusterParams object +// with the ability to set a timeout on a request. +func NewAuthenticateUserToClusterParamsWithTimeout(timeout time.Duration) *AuthenticateUserToClusterParams { + return &AuthenticateUserToClusterParams{ + timeout: timeout, + } +} + +// NewAuthenticateUserToClusterParamsWithContext creates a new AuthenticateUserToClusterParams object +// with the ability to set a context for a request. +func NewAuthenticateUserToClusterParamsWithContext(ctx context.Context) *AuthenticateUserToClusterParams { + return &AuthenticateUserToClusterParams{ + Context: ctx, + } +} + +// NewAuthenticateUserToClusterParamsWithHTTPClient creates a new AuthenticateUserToClusterParams object +// with the ability to set a custom HTTPClient for a request. +func NewAuthenticateUserToClusterParamsWithHTTPClient(client *http.Client) *AuthenticateUserToClusterParams { + return &AuthenticateUserToClusterParams{ + HTTPClient: client, + } +} + +/* +AuthenticateUserToClusterParams contains all the parameters to send to the API endpoint + + for the authenticate user to cluster operation. + + Typically these are written to a http.Request. +*/ +type AuthenticateUserToClusterParams struct { + + // Body. + Body AuthenticateUserToClusterBody + + // ClusterID. + 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 +} + +// WithDefaults hydrates default values in the authenticate user to cluster params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthenticateUserToClusterParams) WithDefaults() *AuthenticateUserToClusterParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the authenticate user to cluster params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthenticateUserToClusterParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) WithTimeout(timeout time.Duration) *AuthenticateUserToClusterParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) WithContext(ctx context.Context) *AuthenticateUserToClusterParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) WithHTTPClient(client *http.Client) *AuthenticateUserToClusterParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) WithBody(body AuthenticateUserToClusterBody) *AuthenticateUserToClusterParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) SetBody(body AuthenticateUserToClusterBody) { + o.Body = body +} + +// WithClusterID adds the clusterID to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) WithClusterID(clusterID string) *AuthenticateUserToClusterParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) WithLocationOrganizationID(locationOrganizationID string) *AuthenticateUserToClusterParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) WithLocationProjectID(locationProjectID string) *AuthenticateUserToClusterParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the authenticate user to cluster params +func (o *AuthenticateUserToClusterParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *AuthenticateUserToClusterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + 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-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_responses.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_responses.go new file mode 100644 index 00000000..ad9c2905 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/authenticate_user_to_cluster_responses.go @@ -0,0 +1,422 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-link-service/preview/2022-11-07/models" +) + +// AuthenticateUserToClusterReader is a Reader for the AuthenticateUserToCluster structure. +type AuthenticateUserToClusterReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AuthenticateUserToClusterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAuthenticateUserToClusterOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewAuthenticateUserToClusterDefault(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 + } +} + +// NewAuthenticateUserToClusterOK creates a AuthenticateUserToClusterOK with default headers values +func NewAuthenticateUserToClusterOK() *AuthenticateUserToClusterOK { + return &AuthenticateUserToClusterOK{} +} + +/* +AuthenticateUserToClusterOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type AuthenticateUserToClusterOK struct { + Payload *models.HashicorpCloudVaultLink20221107AuthenticateUserResponse +} + +// IsSuccess returns true when this authenticate user to cluster o k response has a 2xx status code +func (o *AuthenticateUserToClusterOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this authenticate user to cluster o k response has a 3xx status code +func (o *AuthenticateUserToClusterOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authenticate user to cluster o k response has a 4xx status code +func (o *AuthenticateUserToClusterOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this authenticate user to cluster o k response has a 5xx status code +func (o *AuthenticateUserToClusterOK) IsServerError() bool { + return false +} + +// IsCode returns true when this authenticate user to cluster o k response a status code equal to that given +func (o *AuthenticateUserToClusterOK) IsCode(code int) bool { + return code == 200 +} + +func (o *AuthenticateUserToClusterOK) Error() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/authenticate-user/{cluster_id}][%d] authenticateUserToClusterOK %+v", 200, o.Payload) +} + +func (o *AuthenticateUserToClusterOK) String() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/authenticate-user/{cluster_id}][%d] authenticateUserToClusterOK %+v", 200, o.Payload) +} + +func (o *AuthenticateUserToClusterOK) GetPayload() *models.HashicorpCloudVaultLink20221107AuthenticateUserResponse { + return o.Payload +} + +func (o *AuthenticateUserToClusterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVaultLink20221107AuthenticateUserResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAuthenticateUserToClusterDefault creates a AuthenticateUserToClusterDefault with default headers values +func NewAuthenticateUserToClusterDefault(code int) *AuthenticateUserToClusterDefault { + return &AuthenticateUserToClusterDefault{ + _statusCode: code, + } +} + +/* +AuthenticateUserToClusterDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type AuthenticateUserToClusterDefault struct { + _statusCode int + + Payload *cloud.GoogleRPCStatus +} + +// Code gets the status code for the authenticate user to cluster default response +func (o *AuthenticateUserToClusterDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this authenticate user to cluster default response has a 2xx status code +func (o *AuthenticateUserToClusterDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this authenticate user to cluster default response has a 3xx status code +func (o *AuthenticateUserToClusterDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this authenticate user to cluster default response has a 4xx status code +func (o *AuthenticateUserToClusterDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this authenticate user to cluster default response has a 5xx status code +func (o *AuthenticateUserToClusterDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this authenticate user to cluster default response a status code equal to that given +func (o *AuthenticateUserToClusterDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *AuthenticateUserToClusterDefault) Error() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/authenticate-user/{cluster_id}][%d] AuthenticateUserToCluster default %+v", o._statusCode, o.Payload) +} + +func (o *AuthenticateUserToClusterDefault) String() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/authenticate-user/{cluster_id}][%d] AuthenticateUserToCluster default %+v", o._statusCode, o.Payload) +} + +func (o *AuthenticateUserToClusterDefault) GetPayload() *cloud.GoogleRPCStatus { + return o.Payload +} + +func (o *AuthenticateUserToClusterDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GoogleRPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +AuthenticateUserToClusterBody authenticate user to cluster body +swagger:model AuthenticateUserToClusterBody +*/ +type AuthenticateUserToClusterBody struct { + + // auth type + AuthType *models.HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType `json:"auth_type,omitempty"` + + // For LDAP/USERPASS this credential is a password. For TOKEN, this is a token. + Credential string `json:"credential,omitempty"` + + // location + Location *AuthenticateUserToClusterParamsBodyLocation `json:"location,omitempty"` + + // Path where the auth mount is located + MountPath string `json:"mount_path,omitempty"` + + // namespace + Namespace string `json:"namespace,omitempty"` + + // Username is used for LDAP/USERPASS + Username string `json:"username,omitempty"` +} + +// Validate validates this authenticate user to cluster body +func (o *AuthenticateUserToClusterBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateAuthType(formats); err != nil { + res = append(res, err) + } + + if err := o.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *AuthenticateUserToClusterBody) validateAuthType(formats strfmt.Registry) error { + if swag.IsZero(o.AuthType) { // not required + return nil + } + + if o.AuthType != nil { + if err := o.AuthType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "auth_type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "auth_type") + } + return err + } + } + + return nil +} + +func (o *AuthenticateUserToClusterBody) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(o.Location) { // not required + return nil + } + + if o.Location != nil { + if err := o.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this authenticate user to cluster body based on the context it is used +func (o *AuthenticateUserToClusterBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateAuthType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *AuthenticateUserToClusterBody) contextValidateAuthType(ctx context.Context, formats strfmt.Registry) error { + + if o.AuthType != nil { + if err := o.AuthType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "auth_type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "auth_type") + } + return err + } + } + + return nil +} + +func (o *AuthenticateUserToClusterBody) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if o.Location != nil { + if err := o.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *AuthenticateUserToClusterBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *AuthenticateUserToClusterBody) UnmarshalBinary(b []byte) error { + var res AuthenticateUserToClusterBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +AuthenticateUserToClusterParamsBodyLocation Location represents a target for an operation in HCP. +swagger:model AuthenticateUserToClusterParamsBodyLocation +*/ +type AuthenticateUserToClusterParamsBodyLocation struct { + + // region is the region that the resource is located in. It is + // optional if the object being referenced is a global object. + Region *cloud.HashicorpCloudLocationRegion `json:"region,omitempty"` +} + +// Validate validates this authenticate user to cluster params body location +func (o *AuthenticateUserToClusterParamsBodyLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *AuthenticateUserToClusterParamsBodyLocation) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(o.Region) { // not required + return nil + } + + if o.Region != nil { + if err := o.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location" + "." + "region") + } + return err + } + } + + return nil +} + +// ContextValidate validate this authenticate user to cluster params body location based on the context it is used +func (o *AuthenticateUserToClusterParamsBodyLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *AuthenticateUserToClusterParamsBodyLocation) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if o.Region != nil { + if err := o.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location" + "." + "region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *AuthenticateUserToClusterParamsBodyLocation) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *AuthenticateUserToClusterParamsBodyLocation) UnmarshalBinary(b []byte) error { + var res AuthenticateUserToClusterParamsBodyLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_parameters.go new file mode 100644 index 00000000..68b84647 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_parameters.go @@ -0,0 +1,209 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" +) + +// NewEnableDRParams creates a new EnableDRParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewEnableDRParams() *EnableDRParams { + return &EnableDRParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEnableDRParamsWithTimeout creates a new EnableDRParams object +// with the ability to set a timeout on a request. +func NewEnableDRParamsWithTimeout(timeout time.Duration) *EnableDRParams { + return &EnableDRParams{ + timeout: timeout, + } +} + +// NewEnableDRParamsWithContext creates a new EnableDRParams object +// with the ability to set a context for a request. +func NewEnableDRParamsWithContext(ctx context.Context) *EnableDRParams { + return &EnableDRParams{ + Context: ctx, + } +} + +// NewEnableDRParamsWithHTTPClient creates a new EnableDRParams object +// with the ability to set a custom HTTPClient for a request. +func NewEnableDRParamsWithHTTPClient(client *http.Client) *EnableDRParams { + return &EnableDRParams{ + HTTPClient: client, + } +} + +/* +EnableDRParams contains all the parameters to send to the API endpoint + + for the enable d r operation. + + Typically these are written to a http.Request. +*/ +type EnableDRParams struct { + + // Body. + Body EnableDRBody + + // ClusterID. + 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 +} + +// WithDefaults hydrates default values in the enable d r params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EnableDRParams) WithDefaults() *EnableDRParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the enable d r params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EnableDRParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the enable d r params +func (o *EnableDRParams) WithTimeout(timeout time.Duration) *EnableDRParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the enable d r params +func (o *EnableDRParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the enable d r params +func (o *EnableDRParams) WithContext(ctx context.Context) *EnableDRParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the enable d r params +func (o *EnableDRParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the enable d r params +func (o *EnableDRParams) WithHTTPClient(client *http.Client) *EnableDRParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the enable d r params +func (o *EnableDRParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the enable d r params +func (o *EnableDRParams) WithBody(body EnableDRBody) *EnableDRParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the enable d r params +func (o *EnableDRParams) SetBody(body EnableDRBody) { + o.Body = body +} + +// WithClusterID adds the clusterID to the enable d r params +func (o *EnableDRParams) WithClusterID(clusterID string) *EnableDRParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the enable d r params +func (o *EnableDRParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the enable d r params +func (o *EnableDRParams) WithLocationOrganizationID(locationOrganizationID string) *EnableDRParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the enable d r params +func (o *EnableDRParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the enable d r params +func (o *EnableDRParams) WithLocationProjectID(locationProjectID string) *EnableDRParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the enable d r params +func (o *EnableDRParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *EnableDRParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + 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-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_responses.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_responses.go new file mode 100644 index 00000000..b18a927d --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/enable_d_r_responses.go @@ -0,0 +1,362 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" + "fmt" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-link-service/preview/2022-11-07/models" +) + +// EnableDRReader is a Reader for the EnableDR structure. +type EnableDRReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EnableDRReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEnableDROK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewEnableDRDefault(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 + } +} + +// NewEnableDROK creates a EnableDROK with default headers values +func NewEnableDROK() *EnableDROK { + return &EnableDROK{} +} + +/* +EnableDROK describes a response with status code 200, with default header values. + +A successful response. +*/ +type EnableDROK struct { + Payload models.HashicorpCloudVaultLink20221107APIResponse +} + +// IsSuccess returns true when this enable d r o k response has a 2xx status code +func (o *EnableDROK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this enable d r o k response has a 3xx status code +func (o *EnableDROK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this enable d r o k response has a 4xx status code +func (o *EnableDROK) IsClientError() bool { + return false +} + +// IsServerError returns true when this enable d r o k response has a 5xx status code +func (o *EnableDROK) IsServerError() bool { + return false +} + +// IsCode returns true when this enable d r o k response a status code equal to that given +func (o *EnableDROK) IsCode(code int) bool { + return code == 200 +} + +func (o *EnableDROK) Error() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/enable-dr][%d] enableDROK %+v", 200, o.Payload) +} + +func (o *EnableDROK) String() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/enable-dr][%d] enableDROK %+v", 200, o.Payload) +} + +func (o *EnableDROK) GetPayload() models.HashicorpCloudVaultLink20221107APIResponse { + return o.Payload +} + +func (o *EnableDROK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEnableDRDefault creates a EnableDRDefault with default headers values +func NewEnableDRDefault(code int) *EnableDRDefault { + return &EnableDRDefault{ + _statusCode: code, + } +} + +/* +EnableDRDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type EnableDRDefault struct { + _statusCode int + + Payload *cloud.GoogleRPCStatus +} + +// Code gets the status code for the enable d r default response +func (o *EnableDRDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this enable d r default response has a 2xx status code +func (o *EnableDRDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this enable d r default response has a 3xx status code +func (o *EnableDRDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this enable d r default response has a 4xx status code +func (o *EnableDRDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this enable d r default response has a 5xx status code +func (o *EnableDRDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this enable d r default response a status code equal to that given +func (o *EnableDRDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *EnableDRDefault) Error() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/enable-dr][%d] EnableDR default %+v", o._statusCode, o.Payload) +} + +func (o *EnableDRDefault) String() string { + return fmt.Sprintf("[POST /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/enable-dr][%d] EnableDR default %+v", o._statusCode, o.Payload) +} + +func (o *EnableDRDefault) GetPayload() *cloud.GoogleRPCStatus { + return o.Payload +} + +func (o *EnableDRDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GoogleRPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +EnableDRBody enable d r body +swagger:model EnableDRBody +*/ +type EnableDRBody struct { + + // location + Location *EnableDRParamsBodyLocation `json:"location,omitempty"` +} + +// Validate validates this enable d r body +func (o *EnableDRBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *EnableDRBody) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(o.Location) { // not required + return nil + } + + if o.Location != nil { + if err := o.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this enable d r body based on the context it is used +func (o *EnableDRBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *EnableDRBody) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if o.Location != nil { + if err := o.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *EnableDRBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *EnableDRBody) UnmarshalBinary(b []byte) error { + var res EnableDRBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +EnableDRParamsBodyLocation Location represents a target for an operation in HCP. +swagger:model EnableDRParamsBodyLocation +*/ +type EnableDRParamsBodyLocation struct { + + // region is the region that the resource is located in. It is + // optional if the object being referenced is a global object. + Region *cloud.HashicorpCloudLocationRegion `json:"region,omitempty"` +} + +// Validate validates this enable d r params body location +func (o *EnableDRParamsBodyLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *EnableDRParamsBodyLocation) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(o.Region) { // not required + return nil + } + + if o.Region != nil { + if err := o.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location" + "." + "region") + } + return err + } + } + + return nil +} + +// ContextValidate validate this enable d r params body location based on the context it is used +func (o *EnableDRParamsBodyLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *EnableDRParamsBodyLocation) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if o.Region != nil { + if err := o.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("body" + "." + "location" + "." + "region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("body" + "." + "location" + "." + "region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *EnableDRParamsBodyLocation) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *EnableDRParamsBodyLocation) UnmarshalBinary(b []byte) error { + var res EnableDRParamsBodyLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_parameters.go index 383b71df..3330e1d2 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_parameters.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_parameters.go @@ -78,13 +78,13 @@ type GetLinkedClusterParams struct { /* LocationRegionProvider. - provider is the named cloud provider ("aws", "gcp", "azure"). + provider is the named cloud provider ("aws", "gcp", "azure") */ LocationRegionProvider *string /* LocationRegionRegion. - region is the cloud region ("us-west1", "us-east1"). + region is the cloud region ("us-west1", "us-east1") */ LocationRegionRegion *string diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_parameters.go index cb54d5af..76af3864 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_parameters.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_parameters.go @@ -62,7 +62,7 @@ GetLinkedClusterPolicyParams contains all the parameters to send to the API endp type GetLinkedClusterPolicyParams struct { // ClusterID. - ClusterID *string + ClusterID string /* LocationOrganizationID. @@ -78,13 +78,13 @@ type GetLinkedClusterPolicyParams struct { /* LocationRegionProvider. - provider is the named cloud provider ("aws", "gcp", "azure"). + provider is the named cloud provider ("aws", "gcp", "azure") */ LocationRegionProvider *string /* LocationRegionRegion. - region is the cloud region ("us-west1", "us-east1"). + region is the cloud region ("us-west1", "us-east1") */ LocationRegionRegion *string @@ -142,13 +142,13 @@ func (o *GetLinkedClusterPolicyParams) SetHTTPClient(client *http.Client) { } // WithClusterID adds the clusterID to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithClusterID(clusterID *string) *GetLinkedClusterPolicyParams { +func (o *GetLinkedClusterPolicyParams) WithClusterID(clusterID string) *GetLinkedClusterPolicyParams { o.SetClusterID(clusterID) return o } // SetClusterID adds the clusterId to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetClusterID(clusterID *string) { +func (o *GetLinkedClusterPolicyParams) SetClusterID(clusterID string) { o.ClusterID = clusterID } @@ -204,21 +204,9 @@ func (o *GetLinkedClusterPolicyParams) WriteToRequest(r runtime.ClientRequest, r } var res []error - if o.ClusterID != nil { - - // query param cluster_id - var qrClusterID string - - if o.ClusterID != nil { - qrClusterID = *o.ClusterID - } - qClusterID := qrClusterID - if qClusterID != "" { - - if err := r.SetQueryParam("cluster_id", qClusterID); 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 diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_responses.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_responses.go index 1c729fe6..d66e1f4d 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_responses.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_linked_cluster_policy_responses.go @@ -82,11 +82,11 @@ func (o *GetLinkedClusterPolicyOK) IsCode(code int) bool { } func (o *GetLinkedClusterPolicyOK) Error() string { - return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/clusters/policy/{cluster_id}][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) } func (o *GetLinkedClusterPolicyOK) String() string { - return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/clusters/policy/{cluster_id}][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) } func (o *GetLinkedClusterPolicyOK) GetPayload() *models.HashicorpCloudVaultLink20221107GetLinkedClusterPolicyResponse { @@ -154,11 +154,11 @@ func (o *GetLinkedClusterPolicyDefault) IsCode(code int) bool { } func (o *GetLinkedClusterPolicyDefault) Error() string { - return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/clusters/policy/{cluster_id}][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) } func (o *GetLinkedClusterPolicyDefault) String() string { - return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/clusters/policy/{cluster_id}][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) } func (o *GetLinkedClusterPolicyDefault) GetPayload() *cloud.GoogleRPCStatus { diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_parameters.go new file mode 100644 index 00000000..ac3b03a0 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_parameters.go @@ -0,0 +1,260 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" +) + +// NewGetVaultPoliciesParams creates a new GetVaultPoliciesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetVaultPoliciesParams() *GetVaultPoliciesParams { + return &GetVaultPoliciesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetVaultPoliciesParamsWithTimeout creates a new GetVaultPoliciesParams object +// with the ability to set a timeout on a request. +func NewGetVaultPoliciesParamsWithTimeout(timeout time.Duration) *GetVaultPoliciesParams { + return &GetVaultPoliciesParams{ + timeout: timeout, + } +} + +// NewGetVaultPoliciesParamsWithContext creates a new GetVaultPoliciesParams object +// with the ability to set a context for a request. +func NewGetVaultPoliciesParamsWithContext(ctx context.Context) *GetVaultPoliciesParams { + return &GetVaultPoliciesParams{ + Context: ctx, + } +} + +// NewGetVaultPoliciesParamsWithHTTPClient creates a new GetVaultPoliciesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetVaultPoliciesParamsWithHTTPClient(client *http.Client) *GetVaultPoliciesParams { + return &GetVaultPoliciesParams{ + HTTPClient: client, + } +} + +/* +GetVaultPoliciesParams contains all the parameters to send to the API endpoint + + for the get vault policies operation. + + Typically these are written to a http.Request. +*/ +type GetVaultPoliciesParams struct { + + // ClusterID. + ClusterID 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 +} + +// WithDefaults hydrates default values in the get vault policies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetVaultPoliciesParams) WithDefaults() *GetVaultPoliciesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get vault policies params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetVaultPoliciesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get vault policies params +func (o *GetVaultPoliciesParams) WithTimeout(timeout time.Duration) *GetVaultPoliciesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get vault policies params +func (o *GetVaultPoliciesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get vault policies params +func (o *GetVaultPoliciesParams) WithContext(ctx context.Context) *GetVaultPoliciesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get vault policies params +func (o *GetVaultPoliciesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get vault policies params +func (o *GetVaultPoliciesParams) WithHTTPClient(client *http.Client) *GetVaultPoliciesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get vault policies params +func (o *GetVaultPoliciesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClusterID adds the clusterID to the get vault policies params +func (o *GetVaultPoliciesParams) WithClusterID(clusterID string) *GetVaultPoliciesParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the get vault policies params +func (o *GetVaultPoliciesParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the get vault policies params +func (o *GetVaultPoliciesParams) WithLocationOrganizationID(locationOrganizationID string) *GetVaultPoliciesParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the get vault policies params +func (o *GetVaultPoliciesParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the get vault policies params +func (o *GetVaultPoliciesParams) WithLocationProjectID(locationProjectID string) *GetVaultPoliciesParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the get vault policies params +func (o *GetVaultPoliciesParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the get vault policies params +func (o *GetVaultPoliciesParams) WithLocationRegionProvider(locationRegionProvider *string) *GetVaultPoliciesParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the get vault policies params +func (o *GetVaultPoliciesParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the get vault policies params +func (o *GetVaultPoliciesParams) WithLocationRegionRegion(locationRegionRegion *string) *GetVaultPoliciesParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the get vault policies params +func (o *GetVaultPoliciesParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *GetVaultPoliciesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // 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 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-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_responses.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_responses.go new file mode 100644 index 00000000..3db1bbf0 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/get_vault_policies_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-link-service/preview/2022-11-07/models" +) + +// GetVaultPoliciesReader is a Reader for the GetVaultPolicies structure. +type GetVaultPoliciesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetVaultPoliciesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetVaultPoliciesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetVaultPoliciesDefault(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 + } +} + +// NewGetVaultPoliciesOK creates a GetVaultPoliciesOK with default headers values +func NewGetVaultPoliciesOK() *GetVaultPoliciesOK { + return &GetVaultPoliciesOK{} +} + +/* +GetVaultPoliciesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetVaultPoliciesOK struct { + Payload *models.HashicorpCloudVaultLink20221107VaultPolicyResponse +} + +// IsSuccess returns true when this get vault policies o k response has a 2xx status code +func (o *GetVaultPoliciesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get vault policies o k response has a 3xx status code +func (o *GetVaultPoliciesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get vault policies o k response has a 4xx status code +func (o *GetVaultPoliciesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get vault policies o k response has a 5xx status code +func (o *GetVaultPoliciesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get vault policies o k response a status code equal to that given +func (o *GetVaultPoliciesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetVaultPoliciesOK) Error() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/policies][%d] getVaultPoliciesOK %+v", 200, o.Payload) +} + +func (o *GetVaultPoliciesOK) String() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/policies][%d] getVaultPoliciesOK %+v", 200, o.Payload) +} + +func (o *GetVaultPoliciesOK) GetPayload() *models.HashicorpCloudVaultLink20221107VaultPolicyResponse { + return o.Payload +} + +func (o *GetVaultPoliciesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVaultLink20221107VaultPolicyResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetVaultPoliciesDefault creates a GetVaultPoliciesDefault with default headers values +func NewGetVaultPoliciesDefault(code int) *GetVaultPoliciesDefault { + return &GetVaultPoliciesDefault{ + _statusCode: code, + } +} + +/* +GetVaultPoliciesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetVaultPoliciesDefault struct { + _statusCode int + + Payload *cloud.GoogleRPCStatus +} + +// Code gets the status code for the get vault policies default response +func (o *GetVaultPoliciesDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this get vault policies default response has a 2xx status code +func (o *GetVaultPoliciesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get vault policies default response has a 3xx status code +func (o *GetVaultPoliciesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get vault policies default response has a 4xx status code +func (o *GetVaultPoliciesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get vault policies default response has a 5xx status code +func (o *GetVaultPoliciesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get vault policies default response a status code equal to that given +func (o *GetVaultPoliciesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *GetVaultPoliciesDefault) Error() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/policies][%d] GetVaultPolicies default %+v", o._statusCode, o.Payload) +} + +func (o *GetVaultPoliciesDefault) String() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/policies][%d] GetVaultPolicies default %+v", o._statusCode, o.Payload) +} + +func (o *GetVaultPoliciesDefault) GetPayload() *cloud.GoogleRPCStatus { + return o.Payload +} + +func (o *GetVaultPoliciesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GoogleRPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_parameters.go new file mode 100644 index 00000000..6010e57f --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_parameters.go @@ -0,0 +1,260 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" +) + +// NewInspectRouterParams creates a new InspectRouterParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewInspectRouterParams() *InspectRouterParams { + return &InspectRouterParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInspectRouterParamsWithTimeout creates a new InspectRouterParams object +// with the ability to set a timeout on a request. +func NewInspectRouterParamsWithTimeout(timeout time.Duration) *InspectRouterParams { + return &InspectRouterParams{ + timeout: timeout, + } +} + +// NewInspectRouterParamsWithContext creates a new InspectRouterParams object +// with the ability to set a context for a request. +func NewInspectRouterParamsWithContext(ctx context.Context) *InspectRouterParams { + return &InspectRouterParams{ + Context: ctx, + } +} + +// NewInspectRouterParamsWithHTTPClient creates a new InspectRouterParams object +// with the ability to set a custom HTTPClient for a request. +func NewInspectRouterParamsWithHTTPClient(client *http.Client) *InspectRouterParams { + return &InspectRouterParams{ + HTTPClient: client, + } +} + +/* +InspectRouterParams contains all the parameters to send to the API endpoint + + for the inspect router operation. + + Typically these are written to a http.Request. +*/ +type InspectRouterParams struct { + + // ClusterID. + ClusterID 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 +} + +// WithDefaults hydrates default values in the inspect router params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InspectRouterParams) WithDefaults() *InspectRouterParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the inspect router params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InspectRouterParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the inspect router params +func (o *InspectRouterParams) WithTimeout(timeout time.Duration) *InspectRouterParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the inspect router params +func (o *InspectRouterParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the inspect router params +func (o *InspectRouterParams) WithContext(ctx context.Context) *InspectRouterParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the inspect router params +func (o *InspectRouterParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the inspect router params +func (o *InspectRouterParams) WithHTTPClient(client *http.Client) *InspectRouterParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the inspect router params +func (o *InspectRouterParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClusterID adds the clusterID to the inspect router params +func (o *InspectRouterParams) WithClusterID(clusterID string) *InspectRouterParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the inspect router params +func (o *InspectRouterParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the inspect router params +func (o *InspectRouterParams) WithLocationOrganizationID(locationOrganizationID string) *InspectRouterParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the inspect router params +func (o *InspectRouterParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the inspect router params +func (o *InspectRouterParams) WithLocationProjectID(locationProjectID string) *InspectRouterParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the inspect router params +func (o *InspectRouterParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the inspect router params +func (o *InspectRouterParams) WithLocationRegionProvider(locationRegionProvider *string) *InspectRouterParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the inspect router params +func (o *InspectRouterParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the inspect router params +func (o *InspectRouterParams) WithLocationRegionRegion(locationRegionRegion *string) *InspectRouterParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the inspect router params +func (o *InspectRouterParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *InspectRouterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // 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 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-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_responses.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_responses.go new file mode 100644 index 00000000..8ff54510 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/inspect_router_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_link_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" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-link-service/preview/2022-11-07/models" +) + +// InspectRouterReader is a Reader for the InspectRouter structure. +type InspectRouterReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InspectRouterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInspectRouterOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewInspectRouterDefault(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 + } +} + +// NewInspectRouterOK creates a InspectRouterOK with default headers values +func NewInspectRouterOK() *InspectRouterOK { + return &InspectRouterOK{} +} + +/* +InspectRouterOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type InspectRouterOK struct { + Payload *models.HashicorpCloudVaultLink20221107InspectRouterResponse +} + +// IsSuccess returns true when this inspect router o k response has a 2xx status code +func (o *InspectRouterOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this inspect router o k response has a 3xx status code +func (o *InspectRouterOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this inspect router o k response has a 4xx status code +func (o *InspectRouterOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this inspect router o k response has a 5xx status code +func (o *InspectRouterOK) IsServerError() bool { + return false +} + +// IsCode returns true when this inspect router o k response a status code equal to that given +func (o *InspectRouterOK) IsCode(code int) bool { + return code == 200 +} + +func (o *InspectRouterOK) Error() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/inspect-router][%d] inspectRouterOK %+v", 200, o.Payload) +} + +func (o *InspectRouterOK) String() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/inspect-router][%d] inspectRouterOK %+v", 200, o.Payload) +} + +func (o *InspectRouterOK) GetPayload() *models.HashicorpCloudVaultLink20221107InspectRouterResponse { + return o.Payload +} + +func (o *InspectRouterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVaultLink20221107InspectRouterResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInspectRouterDefault creates a InspectRouterDefault with default headers values +func NewInspectRouterDefault(code int) *InspectRouterDefault { + return &InspectRouterDefault{ + _statusCode: code, + } +} + +/* +InspectRouterDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type InspectRouterDefault struct { + _statusCode int + + Payload *cloud.GoogleRPCStatus +} + +// Code gets the status code for the inspect router default response +func (o *InspectRouterDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this inspect router default response has a 2xx status code +func (o *InspectRouterDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this inspect router default response has a 3xx status code +func (o *InspectRouterDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this inspect router default response has a 4xx status code +func (o *InspectRouterDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this inspect router default response has a 5xx status code +func (o *InspectRouterDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this inspect router default response a status code equal to that given +func (o *InspectRouterDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *InspectRouterDefault) Error() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/inspect-router][%d] InspectRouter default %+v", o._statusCode, o.Payload) +} + +func (o *InspectRouterDefault) String() string { + return fmt.Sprintf("[GET /vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/inspect-router][%d] InspectRouter default %+v", o._statusCode, o.Payload) +} + +func (o *InspectRouterDefault) GetPayload() *cloud.GoogleRPCStatus { + return o.Payload +} + +func (o *InspectRouterDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GoogleRPCStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/revoke_linked_cluster_credentials_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/revoke_linked_cluster_credentials_parameters.go index f88acd39..843af7e6 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/revoke_linked_cluster_credentials_parameters.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/revoke_linked_cluster_credentials_parameters.go @@ -78,13 +78,13 @@ type RevokeLinkedClusterCredentialsParams struct { /* LocationRegionProvider. - provider is the named cloud provider ("aws", "gcp", "azure"). + provider is the named cloud provider ("aws", "gcp", "azure") */ LocationRegionProvider *string /* LocationRegionRegion. - region is the cloud region ("us-west1", "us-east1"). + region is the cloud region ("us-west1", "us-east1") */ LocationRegionRegion *string diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/rotate_linked_cluster_credentials_parameters.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/rotate_linked_cluster_credentials_parameters.go index 516d6402..b6e79ff6 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/rotate_linked_cluster_credentials_parameters.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/rotate_linked_cluster_credentials_parameters.go @@ -76,6 +76,18 @@ type RotateLinkedClusterCredentialsParams struct { */ 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 @@ -162,6 +174,28 @@ func (o *RotateLinkedClusterCredentialsParams) SetLocationProjectID(locationProj o.LocationProjectID = locationProjectID } +// WithLocationRegionProvider adds the locationRegionProvider to the rotate linked cluster credentials params +func (o *RotateLinkedClusterCredentialsParams) WithLocationRegionProvider(locationRegionProvider *string) *RotateLinkedClusterCredentialsParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the rotate linked cluster credentials params +func (o *RotateLinkedClusterCredentialsParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the rotate linked cluster credentials params +func (o *RotateLinkedClusterCredentialsParams) WithLocationRegionRegion(locationRegionRegion *string) *RotateLinkedClusterCredentialsParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the rotate linked cluster credentials params +func (o *RotateLinkedClusterCredentialsParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + // WriteToRequest writes these params to a swagger request func (o *RotateLinkedClusterCredentialsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -185,6 +219,40 @@ func (o *RotateLinkedClusterCredentialsParams) WriteToRequest(r runtime.ClientRe 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...) } diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/vault_link_service_client.go b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/vault_link_service_client.go index 16e53e36..822b5919 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/vault_link_service_client.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/client/vault_link_service/vault_link_service_client.go @@ -28,10 +28,18 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { + AuthenticateUserToCluster(params *AuthenticateUserToClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthenticateUserToClusterOK, error) + + EnableDR(params *EnableDRParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnableDROK, error) + GetLinkedCluster(params *GetLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterOK, error) GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterPolicyOK, error) + GetVaultPolicies(params *GetVaultPoliciesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVaultPoliciesOK, error) + + InspectRouter(params *InspectRouterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InspectRouterOK, error) + RevokeLinkedClusterCredentials(params *RevokeLinkedClusterCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeLinkedClusterCredentialsOK, error) RotateLinkedClusterCredentials(params *RotateLinkedClusterCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RotateLinkedClusterCredentialsOK, error) @@ -39,6 +47,82 @@ type ClientService interface { SetTransport(transport runtime.ClientTransport) } +/* +AuthenticateUserToCluster authenticate user to cluster API +*/ +func (a *Client) AuthenticateUserToCluster(params *AuthenticateUserToClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthenticateUserToClusterOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAuthenticateUserToClusterParams() + } + op := &runtime.ClientOperation{ + ID: "AuthenticateUserToCluster", + Method: "POST", + PathPattern: "/vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/authenticate-user/{cluster_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &AuthenticateUserToClusterReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AuthenticateUserToClusterOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*AuthenticateUserToClusterDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +EnableDR this is a p o c method and should not be used in production +*/ +func (a *Client) EnableDR(params *EnableDRParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnableDROK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEnableDRParams() + } + op := &runtime.ClientOperation{ + ID: "EnableDR", + Method: "POST", + PathPattern: "/vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/enable-dr", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &EnableDRReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*EnableDROK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*EnableDRDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* GetLinkedCluster get linked cluster API */ @@ -88,7 +172,7 @@ func (a *Client) GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, au op := &runtime.ClientOperation{ ID: "GetLinkedClusterPolicy", Method: "GET", - PathPattern: "/vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/policy", + PathPattern: "/vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/link/clusters/policy/{cluster_id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, @@ -115,6 +199,82 @@ func (a *Client) GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, au return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +GetVaultPolicies this is a p o c method and should not be used in production +*/ +func (a *Client) GetVaultPolicies(params *GetVaultPoliciesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVaultPoliciesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetVaultPoliciesParams() + } + op := &runtime.ClientOperation{ + ID: "GetVaultPolicies", + Method: "GET", + PathPattern: "/vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetVaultPoliciesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetVaultPoliciesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetVaultPoliciesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +InspectRouter this is a p o c method and should not be used in production +*/ +func (a *Client) InspectRouter(params *InspectRouterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InspectRouterOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInspectRouterParams() + } + op := &runtime.ClientOperation{ + ID: "InspectRouter", + Method: "GET", + PathPattern: "/vault-link/2022-11-07/organizations/{location.organization_id}/projects/{location.project_id}/{cluster_id}/inspect-router", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &InspectRouterReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*InspectRouterOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*InspectRouterDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* RevokeLinkedClusterCredentials revoke linked cluster credentials API */ diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_api_response.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_api_response.go new file mode 100644 index 00000000..9b3e8458 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_api_response.go @@ -0,0 +1,11 @@ +// 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 + +// HashicorpCloudVaultLink20221107APIResponse hashicorp cloud vault link 20221107 Api response +// +// swagger:model hashicorp.cloud.vault_link_20221107.ApiResponse +type HashicorpCloudVaultLink20221107APIResponse interface{} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_request_auth_type.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_request_auth_type.go new file mode 100644 index 00000000..0bb155d3 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_request_auth_type.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType hashicorp cloud vault link 20221107 authenticate user request auth type +// +// swagger:model hashicorp.cloud.vault_link_20221107.AuthenticateUserRequest.AuthType +type HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType string + +func NewHashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType(value HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType) *HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType { + return &value +} + +// Pointer returns a pointer to a freshly-allocated HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType. +func (m HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType) Pointer() *HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType { + return &m +} + +const ( + + // HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeTOKEN captures enum value "TOKEN" + HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeTOKEN HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType = "TOKEN" + + // HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeUSERPASS captures enum value "USERPASS" + HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeUSERPASS HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType = "USERPASS" + + // HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeLDAP captures enum value "LDAP" + HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeLDAP HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType = "LDAP" +) + +// for schema +var hashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeEnum []interface{} + +func init() { + var res []HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType + if err := json.Unmarshal([]byte(`["TOKEN","USERPASS","LDAP"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeEnum = append(hashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeEnum, v) + } +} + +func (m HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType) validateHashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeEnum(path, location string, value HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud vault link 20221107 authenticate user request auth type +func (m HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudVaultLink20221107AuthenticateUserRequestAuthTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this hashicorp cloud vault link 20221107 authenticate user request auth type based on context it is used +func (m HashicorpCloudVaultLink20221107AuthenticateUserRequestAuthType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_response.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_response.go new file mode 100644 index 00000000..a1a1508a --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_authenticate_user_response.go @@ -0,0 +1,62 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVaultLink20221107AuthenticateUserResponse hashicorp cloud vault link 20221107 authenticate user response +// +// swagger:model hashicorp.cloud.vault_link_20221107.AuthenticateUserResponse +type HashicorpCloudVaultLink20221107AuthenticateUserResponse struct { + + // error + Error string `json:"error,omitempty"` + + // namespace + Namespace string `json:"namespace,omitempty"` + + // path + Path string `json:"path,omitempty"` + + // status code + StatusCode int32 `json:"status_code,omitempty"` + + // token + Token string `json:"token,omitempty"` +} + +// Validate validates this hashicorp cloud vault link 20221107 authenticate user response +func (m *HashicorpCloudVaultLink20221107AuthenticateUserResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault link 20221107 authenticate user response based on context it is used +func (m *HashicorpCloudVaultLink20221107AuthenticateUserResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107AuthenticateUserResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107AuthenticateUserResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVaultLink20221107AuthenticateUserResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_inspect_router_response.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_inspect_router_response.go new file mode 100644 index 00000000..1b66bc15 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_inspect_router_response.go @@ -0,0 +1,116 @@ +// 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 ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVaultLink20221107InspectRouterResponse hashicorp cloud vault link 20221107 inspect router response +// +// swagger:model hashicorp.cloud.vault_link_20221107.InspectRouterResponse +type HashicorpCloudVaultLink20221107InspectRouterResponse struct { + + // routes + Routes []*HashicorpCloudVaultLink20221107RoutePath `json:"routes"` +} + +// Validate validates this hashicorp cloud vault link 20221107 inspect router response +func (m *HashicorpCloudVaultLink20221107InspectRouterResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRoutes(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVaultLink20221107InspectRouterResponse) validateRoutes(formats strfmt.Registry) error { + if swag.IsZero(m.Routes) { // not required + return nil + } + + for i := 0; i < len(m.Routes); i++ { + if swag.IsZero(m.Routes[i]) { // not required + continue + } + + if m.Routes[i] != nil { + if err := m.Routes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("routes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("routes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault link 20221107 inspect router response based on the context it is used +func (m *HashicorpCloudVaultLink20221107InspectRouterResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRoutes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVaultLink20221107InspectRouterResponse) contextValidateRoutes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Routes); i++ { + + if m.Routes[i] != nil { + if err := m.Routes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("routes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("routes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107InspectRouterResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107InspectRouterResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVaultLink20221107InspectRouterResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster.go index 0d532e06..c2f9e2f1 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster.go @@ -28,6 +28,13 @@ type HashicorpCloudVaultLink20221107LinkedCluster struct { // it is configured directly in the self-managed cluster. ClusterName string `json:"cluster_name,omitempty"` + // created at + // Format: date-time + CreatedAt strfmt.DateTime `json:"created_at,omitempty"` + + // credentials revoked + CredentialsRevoked bool `json:"credentials_revoked,omitempty"` + // current version CurrentVersion string `json:"current_version,omitempty"` @@ -40,7 +47,9 @@ type HashicorpCloudVaultLink20221107LinkedCluster struct { // internal id InternalID string `json:"internal_id,omitempty"` - // is sealed + // we don't support this since we cannot determine when a cluster is completely sealed + // due to not having access to the total number of nodes in a cluster when all connected nodes + // are sealed, including the active one. IsSealed bool `json:"is_sealed,omitempty"` // linked at @@ -67,6 +76,10 @@ type HashicorpCloudVaultLink20221107LinkedCluster struct { func (m *HashicorpCloudVaultLink20221107LinkedCluster) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + if err := m.validateLinkedAt(formats); err != nil { res = append(res, err) } @@ -93,6 +106,18 @@ func (m *HashicorpCloudVaultLink20221107LinkedCluster) Validate(formats strfmt.R return nil } +func (m *HashicorpCloudVaultLink20221107LinkedCluster) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + func (m *HashicorpCloudVaultLink20221107LinkedCluster) validateLinkedAt(formats strfmt.Registry) error { if swag.IsZero(m.LinkedAt) { // not required return nil diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node.go index 49e75559..ce10761d 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node.go @@ -65,10 +65,14 @@ type HashicorpCloudVaultLink20221107LinkedClusterNode struct { // node_initialized indicates if the node has been initialized. NodeInitialized bool `json:"node_initialized,omitempty"` - // node_os is the lower-case name of the operating system the client is - // running on (e.g. linux, windows). + // node_os is the lower-case name of the operating system platform the client is + // running on (e.g. ubuntu). NodeOs string `json:"node_os,omitempty"` + // node_os_version is the lower-case name of the operating system platform version the client is + // running on (e.g. 22.04). + NodeOsVersion string `json:"node_os_version,omitempty"` + // node_sealed indicates if the node is sealed. NodeSealed bool `json:"node_sealed,omitempty"` diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node_leader_status.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node_leader_status.go index dd5f8162..b6d9117e 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node_leader_status.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_node_leader_status.go @@ -14,7 +14,8 @@ import ( "github.com/go-openapi/validate" ) -// HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus hashicorp cloud vault link 20221107 linked cluster node leader status +// HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus - LEADER: Deprecated values +// - ACTIVE: Valid values // // swagger:model hashicorp.cloud.vault_link_20221107.LinkedClusterNode.LeaderStatus type HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus string @@ -38,6 +39,15 @@ const ( // HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusFOLLOWER captures enum value "FOLLOWER" HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusFOLLOWER HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus = "FOLLOWER" + + // HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusACTIVE captures enum value "ACTIVE" + HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusACTIVE HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus = "ACTIVE" + + // HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusSTANDBY captures enum value "STANDBY" + HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusSTANDBY HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus = "STANDBY" + + // HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusPERFSTANDBY captures enum value "PERF_STANDBY" + HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusPERFSTANDBY HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus = "PERF_STANDBY" ) // for schema @@ -45,7 +55,7 @@ var hashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatusEnum []interface func init() { var res []HashicorpCloudVaultLink20221107LinkedClusterNodeLeaderStatus - if err := json.Unmarshal([]byte(`["LEADER_STATUS_CLUSTER_STATE_INVALID","LEADER","FOLLOWER"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["LEADER_STATUS_CLUSTER_STATE_INVALID","LEADER","FOLLOWER","ACTIVE","STANDBY","PERF_STANDBY"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_state.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_state.go index d699796b..05a8ac66 100644 --- a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_state.go +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_linked_cluster_state.go @@ -39,9 +39,6 @@ const ( // HashicorpCloudVaultLink20221107LinkedClusterStateLINKED captures enum value "LINKED" HashicorpCloudVaultLink20221107LinkedClusterStateLINKED HashicorpCloudVaultLink20221107LinkedClusterState = "LINKED" - // HashicorpCloudVaultLink20221107LinkedClusterStateSEALED captures enum value "SEALED" - HashicorpCloudVaultLink20221107LinkedClusterStateSEALED HashicorpCloudVaultLink20221107LinkedClusterState = "SEALED" - // HashicorpCloudVaultLink20221107LinkedClusterStateUNLINKING captures enum value "UNLINKING" HashicorpCloudVaultLink20221107LinkedClusterStateUNLINKING HashicorpCloudVaultLink20221107LinkedClusterState = "UNLINKING" @@ -54,7 +51,7 @@ var hashicorpCloudVaultLink20221107LinkedClusterStateEnum []interface{} func init() { var res []HashicorpCloudVaultLink20221107LinkedClusterState - if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","SEALED","UNLINKING","UNLINKED"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","UNLINKING","UNLINKED"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_route_path.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_route_path.go new file mode 100644 index 00000000..870e388a --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_route_path.go @@ -0,0 +1,68 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVaultLink20221107RoutePath hashicorp cloud vault link 20221107 route path +// +// swagger:model hashicorp.cloud.vault_link_20221107.RoutePath +type HashicorpCloudVaultLink20221107RoutePath struct { + + // accessor + Accessor string `json:"accessor,omitempty"` + + // mount namespace + MountNamespace string `json:"mount_namespace,omitempty"` + + // mount path + MountPath string `json:"mount_path,omitempty"` + + // mount type + MountType string `json:"mount_type,omitempty"` + + // storage prefix + StoragePrefix string `json:"storage_prefix,omitempty"` + + // tainted + Tainted bool `json:"tainted,omitempty"` + + // uuid + UUID string `json:"uuid,omitempty"` +} + +// Validate validates this hashicorp cloud vault link 20221107 route path +func (m *HashicorpCloudVaultLink20221107RoutePath) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault link 20221107 route path based on context it is used +func (m *HashicorpCloudVaultLink20221107RoutePath) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107RoutePath) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107RoutePath) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVaultLink20221107RoutePath + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_vault_policy_response.go b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_vault_policy_response.go new file mode 100644 index 00000000..94fc1f70 --- /dev/null +++ b/clients/cloud-vault-link-service/preview/2022-11-07/models/hashicorp_cloud_vault_link20221107_vault_policy_response.go @@ -0,0 +1,50 @@ +// 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 ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVaultLink20221107VaultPolicyResponse hashicorp cloud vault link 20221107 vault policy response +// +// swagger:model hashicorp.cloud.vault_link_20221107.VaultPolicyResponse +type HashicorpCloudVaultLink20221107VaultPolicyResponse struct { + + // policies + Policies []string `json:"policies"` +} + +// Validate validates this hashicorp cloud vault link 20221107 vault policy response +func (m *HashicorpCloudVaultLink20221107VaultPolicyResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault link 20221107 vault policy response based on context it is used +func (m *HashicorpCloudVaultLink20221107VaultPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107VaultPolicyResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVaultLink20221107VaultPolicyResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVaultLink20221107VaultPolicyResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}