diff --git a/clients/cloud-network/preview/2020-09-07/client/network_service/create_h_v_n_route_parameters.go b/clients/cloud-network/preview/2020-09-07/client/network_service/create_h_v_n_route_parameters.go new file mode 100644 index 00000000..197f91ac --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/client/network_service/create_h_v_n_route_parameters.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-network/preview/2020-09-07/models" +) + +// NewCreateHVNRouteParams creates a new CreateHVNRouteParams object +// with the default values initialized. +func NewCreateHVNRouteParams() *CreateHVNRouteParams { + var () + return &CreateHVNRouteParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewCreateHVNRouteParamsWithTimeout creates a new CreateHVNRouteParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewCreateHVNRouteParamsWithTimeout(timeout time.Duration) *CreateHVNRouteParams { + var () + return &CreateHVNRouteParams{ + + timeout: timeout, + } +} + +// NewCreateHVNRouteParamsWithContext creates a new CreateHVNRouteParams object +// with the default values initialized, and the ability to set a context for a request +func NewCreateHVNRouteParamsWithContext(ctx context.Context) *CreateHVNRouteParams { + var () + return &CreateHVNRouteParams{ + + Context: ctx, + } +} + +// NewCreateHVNRouteParamsWithHTTPClient creates a new CreateHVNRouteParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewCreateHVNRouteParamsWithHTTPClient(client *http.Client) *CreateHVNRouteParams { + var () + return &CreateHVNRouteParams{ + HTTPClient: client, + } +} + +/*CreateHVNRouteParams contains all the parameters to send to the API endpoint +for the create h v n route operation typically these are written to a http.Request +*/ +type CreateHVNRouteParams struct { + + /*Body*/ + Body *models.HashicorpCloudNetwork20200907CreateHVNRouteRequest + /*HvnID + id is the identifier for this resource. + + */ + HvnID string + /*HvnLocationOrganizationID + organization_id is the id of the organization. + + */ + HvnLocationOrganizationID string + /*HvnLocationProjectID + project_id is the projects id. + + */ + HvnLocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the create h v n route params +func (o *CreateHVNRouteParams) WithTimeout(timeout time.Duration) *CreateHVNRouteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create h v n route params +func (o *CreateHVNRouteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create h v n route params +func (o *CreateHVNRouteParams) WithContext(ctx context.Context) *CreateHVNRouteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create h v n route params +func (o *CreateHVNRouteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create h v n route params +func (o *CreateHVNRouteParams) WithHTTPClient(client *http.Client) *CreateHVNRouteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create h v n route params +func (o *CreateHVNRouteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create h v n route params +func (o *CreateHVNRouteParams) WithBody(body *models.HashicorpCloudNetwork20200907CreateHVNRouteRequest) *CreateHVNRouteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create h v n route params +func (o *CreateHVNRouteParams) SetBody(body *models.HashicorpCloudNetwork20200907CreateHVNRouteRequest) { + o.Body = body +} + +// WithHvnID adds the hvnID to the create h v n route params +func (o *CreateHVNRouteParams) WithHvnID(hvnID string) *CreateHVNRouteParams { + o.SetHvnID(hvnID) + return o +} + +// SetHvnID adds the hvnId to the create h v n route params +func (o *CreateHVNRouteParams) SetHvnID(hvnID string) { + o.HvnID = hvnID +} + +// WithHvnLocationOrganizationID adds the hvnLocationOrganizationID to the create h v n route params +func (o *CreateHVNRouteParams) WithHvnLocationOrganizationID(hvnLocationOrganizationID string) *CreateHVNRouteParams { + o.SetHvnLocationOrganizationID(hvnLocationOrganizationID) + return o +} + +// SetHvnLocationOrganizationID adds the hvnLocationOrganizationId to the create h v n route params +func (o *CreateHVNRouteParams) SetHvnLocationOrganizationID(hvnLocationOrganizationID string) { + o.HvnLocationOrganizationID = hvnLocationOrganizationID +} + +// WithHvnLocationProjectID adds the hvnLocationProjectID to the create h v n route params +func (o *CreateHVNRouteParams) WithHvnLocationProjectID(hvnLocationProjectID string) *CreateHVNRouteParams { + o.SetHvnLocationProjectID(hvnLocationProjectID) + return o +} + +// SetHvnLocationProjectID adds the hvnLocationProjectId to the create h v n route params +func (o *CreateHVNRouteParams) SetHvnLocationProjectID(hvnLocationProjectID string) { + o.HvnLocationProjectID = hvnLocationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateHVNRouteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param hvn.id + if err := r.SetPathParam("hvn.id", o.HvnID); err != nil { + return err + } + + // path param hvn.location.organization_id + if err := r.SetPathParam("hvn.location.organization_id", o.HvnLocationOrganizationID); err != nil { + return err + } + + // path param hvn.location.project_id + if err := r.SetPathParam("hvn.location.project_id", o.HvnLocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/client/network_service/create_h_v_n_route_responses.go b/clients/cloud-network/preview/2020-09-07/client/network_service/create_h_v_n_route_responses.go new file mode 100644 index 00000000..9ff1247d --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/client/network_service/create_h_v_n_route_responses.go @@ -0,0 +1,118 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-network/preview/2020-09-07/models" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// CreateHVNRouteReader is a Reader for the CreateHVNRoute structure. +type CreateHVNRouteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateHVNRouteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateHVNRouteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateHVNRouteDefault(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 + } +} + +// NewCreateHVNRouteOK creates a CreateHVNRouteOK with default headers values +func NewCreateHVNRouteOK() *CreateHVNRouteOK { + return &CreateHVNRouteOK{} +} + +/*CreateHVNRouteOK handles this case with default header values. + +A successful response. +*/ +type CreateHVNRouteOK struct { + Payload *models.HashicorpCloudNetwork20200907CreateHVNRouteResponse +} + +func (o *CreateHVNRouteOK) Error() string { + return fmt.Sprintf("[POST /network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes][%d] createHVNRouteOK %+v", 200, o.Payload) +} + +func (o *CreateHVNRouteOK) GetPayload() *models.HashicorpCloudNetwork20200907CreateHVNRouteResponse { + return o.Payload +} + +func (o *CreateHVNRouteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudNetwork20200907CreateHVNRouteResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateHVNRouteDefault creates a CreateHVNRouteDefault with default headers values +func NewCreateHVNRouteDefault(code int) *CreateHVNRouteDefault { + return &CreateHVNRouteDefault{ + _statusCode: code, + } +} + +/*CreateHVNRouteDefault handles this case with default header values. + +An unexpected error response. +*/ +type CreateHVNRouteDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the create h v n route default response +func (o *CreateHVNRouteDefault) Code() int { + return o._statusCode +} + +func (o *CreateHVNRouteDefault) Error() string { + return fmt.Sprintf("[POST /network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes][%d] CreateHVNRoute default %+v", o._statusCode, o.Payload) +} + +func (o *CreateHVNRouteDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *CreateHVNRouteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/client/network_service/delete_h_v_n_route_parameters.go b/clients/cloud-network/preview/2020-09-07/client/network_service/delete_h_v_n_route_parameters.go new file mode 100644 index 00000000..68c2553f --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/client/network_service/delete_h_v_n_route_parameters.go @@ -0,0 +1,362 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_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" +) + +// NewDeleteHVNRouteParams creates a new DeleteHVNRouteParams object +// with the default values initialized. +func NewDeleteHVNRouteParams() *DeleteHVNRouteParams { + var () + return &DeleteHVNRouteParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteHVNRouteParamsWithTimeout creates a new DeleteHVNRouteParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteHVNRouteParamsWithTimeout(timeout time.Duration) *DeleteHVNRouteParams { + var () + return &DeleteHVNRouteParams{ + + timeout: timeout, + } +} + +// NewDeleteHVNRouteParamsWithContext creates a new DeleteHVNRouteParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteHVNRouteParamsWithContext(ctx context.Context) *DeleteHVNRouteParams { + var () + return &DeleteHVNRouteParams{ + + Context: ctx, + } +} + +// NewDeleteHVNRouteParamsWithHTTPClient creates a new DeleteHVNRouteParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteHVNRouteParamsWithHTTPClient(client *http.Client) *DeleteHVNRouteParams { + var () + return &DeleteHVNRouteParams{ + HTTPClient: client, + } +} + +/*DeleteHVNRouteParams contains all the parameters to send to the API endpoint +for the delete h v n route operation typically these are written to a http.Request +*/ +type DeleteHVNRouteParams struct { + + /*HvnDescription + description is a human-friendly description for this link. This is + used primarily for informational purposes such as error messages. + + */ + HvnDescription *string + /*HvnID + id is the identifier for this resource. + + */ + HvnID string + /*HvnLocationOrganizationID + organization_id is the id of the organization. + + */ + HvnLocationOrganizationID string + /*HvnLocationProjectID + project_id is the projects id. + + */ + HvnLocationProjectID string + /*HvnLocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + HvnLocationRegionProvider *string + /*HvnLocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + HvnLocationRegionRegion *string + /*HvnType + type is the unique type of the resource. Each service publishes a + unique set of types. The type value is recommended to be formatted + in "." such as "hashicorp.hvn". This is to prevent conflicts + in the future, but any string value will work. + + */ + HvnType *string + /*HvnUUID + uuid is the unique UUID for this resource. + + */ + HvnUUID *string + /*ID + id of the HVN route to delete. + + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete h v n route params +func (o *DeleteHVNRouteParams) WithTimeout(timeout time.Duration) *DeleteHVNRouteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete h v n route params +func (o *DeleteHVNRouteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete h v n route params +func (o *DeleteHVNRouteParams) WithContext(ctx context.Context) *DeleteHVNRouteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete h v n route params +func (o *DeleteHVNRouteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHTTPClient(client *http.Client) *DeleteHVNRouteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHvnDescription adds the hvnDescription to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnDescription(hvnDescription *string) *DeleteHVNRouteParams { + o.SetHvnDescription(hvnDescription) + return o +} + +// SetHvnDescription adds the hvnDescription to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnDescription(hvnDescription *string) { + o.HvnDescription = hvnDescription +} + +// WithHvnID adds the hvnID to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnID(hvnID string) *DeleteHVNRouteParams { + o.SetHvnID(hvnID) + return o +} + +// SetHvnID adds the hvnId to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnID(hvnID string) { + o.HvnID = hvnID +} + +// WithHvnLocationOrganizationID adds the hvnLocationOrganizationID to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnLocationOrganizationID(hvnLocationOrganizationID string) *DeleteHVNRouteParams { + o.SetHvnLocationOrganizationID(hvnLocationOrganizationID) + return o +} + +// SetHvnLocationOrganizationID adds the hvnLocationOrganizationId to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnLocationOrganizationID(hvnLocationOrganizationID string) { + o.HvnLocationOrganizationID = hvnLocationOrganizationID +} + +// WithHvnLocationProjectID adds the hvnLocationProjectID to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnLocationProjectID(hvnLocationProjectID string) *DeleteHVNRouteParams { + o.SetHvnLocationProjectID(hvnLocationProjectID) + return o +} + +// SetHvnLocationProjectID adds the hvnLocationProjectId to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnLocationProjectID(hvnLocationProjectID string) { + o.HvnLocationProjectID = hvnLocationProjectID +} + +// WithHvnLocationRegionProvider adds the hvnLocationRegionProvider to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnLocationRegionProvider(hvnLocationRegionProvider *string) *DeleteHVNRouteParams { + o.SetHvnLocationRegionProvider(hvnLocationRegionProvider) + return o +} + +// SetHvnLocationRegionProvider adds the hvnLocationRegionProvider to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnLocationRegionProvider(hvnLocationRegionProvider *string) { + o.HvnLocationRegionProvider = hvnLocationRegionProvider +} + +// WithHvnLocationRegionRegion adds the hvnLocationRegionRegion to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnLocationRegionRegion(hvnLocationRegionRegion *string) *DeleteHVNRouteParams { + o.SetHvnLocationRegionRegion(hvnLocationRegionRegion) + return o +} + +// SetHvnLocationRegionRegion adds the hvnLocationRegionRegion to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnLocationRegionRegion(hvnLocationRegionRegion *string) { + o.HvnLocationRegionRegion = hvnLocationRegionRegion +} + +// WithHvnType adds the hvnType to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnType(hvnType *string) *DeleteHVNRouteParams { + o.SetHvnType(hvnType) + return o +} + +// SetHvnType adds the hvnType to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnType(hvnType *string) { + o.HvnType = hvnType +} + +// WithHvnUUID adds the hvnUUID to the delete h v n route params +func (o *DeleteHVNRouteParams) WithHvnUUID(hvnUUID *string) *DeleteHVNRouteParams { + o.SetHvnUUID(hvnUUID) + return o +} + +// SetHvnUUID adds the hvnUuid to the delete h v n route params +func (o *DeleteHVNRouteParams) SetHvnUUID(hvnUUID *string) { + o.HvnUUID = hvnUUID +} + +// WithID adds the id to the delete h v n route params +func (o *DeleteHVNRouteParams) WithID(id string) *DeleteHVNRouteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete h v n route params +func (o *DeleteHVNRouteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteHVNRouteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.HvnDescription != nil { + + // query param hvn.description + var qrHvnDescription string + if o.HvnDescription != nil { + qrHvnDescription = *o.HvnDescription + } + qHvnDescription := qrHvnDescription + if qHvnDescription != "" { + if err := r.SetQueryParam("hvn.description", qHvnDescription); err != nil { + return err + } + } + + } + + // path param hvn.id + if err := r.SetPathParam("hvn.id", o.HvnID); err != nil { + return err + } + + // path param hvn.location.organization_id + if err := r.SetPathParam("hvn.location.organization_id", o.HvnLocationOrganizationID); err != nil { + return err + } + + // path param hvn.location.project_id + if err := r.SetPathParam("hvn.location.project_id", o.HvnLocationProjectID); err != nil { + return err + } + + if o.HvnLocationRegionProvider != nil { + + // query param hvn.location.region.provider + var qrHvnLocationRegionProvider string + if o.HvnLocationRegionProvider != nil { + qrHvnLocationRegionProvider = *o.HvnLocationRegionProvider + } + qHvnLocationRegionProvider := qrHvnLocationRegionProvider + if qHvnLocationRegionProvider != "" { + if err := r.SetQueryParam("hvn.location.region.provider", qHvnLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.HvnLocationRegionRegion != nil { + + // query param hvn.location.region.region + var qrHvnLocationRegionRegion string + if o.HvnLocationRegionRegion != nil { + qrHvnLocationRegionRegion = *o.HvnLocationRegionRegion + } + qHvnLocationRegionRegion := qrHvnLocationRegionRegion + if qHvnLocationRegionRegion != "" { + if err := r.SetQueryParam("hvn.location.region.region", qHvnLocationRegionRegion); err != nil { + return err + } + } + + } + + if o.HvnType != nil { + + // query param hvn.type + var qrHvnType string + if o.HvnType != nil { + qrHvnType = *o.HvnType + } + qHvnType := qrHvnType + if qHvnType != "" { + if err := r.SetQueryParam("hvn.type", qHvnType); err != nil { + return err + } + } + + } + + if o.HvnUUID != nil { + + // query param hvn.uuid + var qrHvnUUID string + if o.HvnUUID != nil { + qrHvnUUID = *o.HvnUUID + } + qHvnUUID := qrHvnUUID + if qHvnUUID != "" { + if err := r.SetQueryParam("hvn.uuid", qHvnUUID); err != nil { + return err + } + } + + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/client/network_service/delete_h_v_n_route_responses.go b/clients/cloud-network/preview/2020-09-07/client/network_service/delete_h_v_n_route_responses.go new file mode 100644 index 00000000..c6609db8 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/client/network_service/delete_h_v_n_route_responses.go @@ -0,0 +1,118 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-network/preview/2020-09-07/models" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// DeleteHVNRouteReader is a Reader for the DeleteHVNRoute structure. +type DeleteHVNRouteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteHVNRouteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteHVNRouteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeleteHVNRouteDefault(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 + } +} + +// NewDeleteHVNRouteOK creates a DeleteHVNRouteOK with default headers values +func NewDeleteHVNRouteOK() *DeleteHVNRouteOK { + return &DeleteHVNRouteOK{} +} + +/*DeleteHVNRouteOK handles this case with default header values. + +A successful response. +*/ +type DeleteHVNRouteOK struct { + Payload *models.HashicorpCloudNetwork20200907DeleteHVNRouteResponse +} + +func (o *DeleteHVNRouteOK) Error() string { + return fmt.Sprintf("[DELETE /network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes/{id}][%d] deleteHVNRouteOK %+v", 200, o.Payload) +} + +func (o *DeleteHVNRouteOK) GetPayload() *models.HashicorpCloudNetwork20200907DeleteHVNRouteResponse { + return o.Payload +} + +func (o *DeleteHVNRouteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudNetwork20200907DeleteHVNRouteResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteHVNRouteDefault creates a DeleteHVNRouteDefault with default headers values +func NewDeleteHVNRouteDefault(code int) *DeleteHVNRouteDefault { + return &DeleteHVNRouteDefault{ + _statusCode: code, + } +} + +/*DeleteHVNRouteDefault handles this case with default header values. + +An unexpected error response. +*/ +type DeleteHVNRouteDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the delete h v n route default response +func (o *DeleteHVNRouteDefault) Code() int { + return o._statusCode +} + +func (o *DeleteHVNRouteDefault) Error() string { + return fmt.Sprintf("[DELETE /network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes/{id}][%d] DeleteHVNRoute default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteHVNRouteDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *DeleteHVNRouteDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/client/network_service/list_h_v_n_routes_parameters.go b/clients/cloud-network/preview/2020-09-07/client/network_service/list_h_v_n_routes_parameters.go new file mode 100644 index 00000000..c9d898c0 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/client/network_service/list_h_v_n_routes_parameters.go @@ -0,0 +1,511 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListHVNRoutesParams creates a new ListHVNRoutesParams object +// with the default values initialized. +func NewListHVNRoutesParams() *ListHVNRoutesParams { + var () + return &ListHVNRoutesParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewListHVNRoutesParamsWithTimeout creates a new ListHVNRoutesParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewListHVNRoutesParamsWithTimeout(timeout time.Duration) *ListHVNRoutesParams { + var () + return &ListHVNRoutesParams{ + + timeout: timeout, + } +} + +// NewListHVNRoutesParamsWithContext creates a new ListHVNRoutesParams object +// with the default values initialized, and the ability to set a context for a request +func NewListHVNRoutesParamsWithContext(ctx context.Context) *ListHVNRoutesParams { + var () + return &ListHVNRoutesParams{ + + Context: ctx, + } +} + +// NewListHVNRoutesParamsWithHTTPClient creates a new ListHVNRoutesParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewListHVNRoutesParamsWithHTTPClient(client *http.Client) *ListHVNRoutesParams { + var () + return &ListHVNRoutesParams{ + HTTPClient: client, + } +} + +/*ListHVNRoutesParams contains all the parameters to send to the API endpoint +for the list h v n routes operation typically these are written to a http.Request +*/ +type ListHVNRoutesParams struct { + + /*HvnDescription + description is a human-friendly description for this link. This is + used primarily for informational purposes such as error messages. + + */ + HvnDescription *string + /*HvnID + id is the identifier for this resource. + + */ + HvnID string + /*HvnLocationOrganizationID + organization_id is the id of the organization. + + */ + HvnLocationOrganizationID string + /*HvnLocationProjectID + project_id is the projects id. + + */ + HvnLocationProjectID string + /*HvnLocationRegionProvider + provider is the named cloud provider ("aws", "gcp", "azure"). + + */ + HvnLocationRegionProvider *string + /*HvnLocationRegionRegion + region is the cloud region ("us-west1", "us-east1"). + + */ + HvnLocationRegionRegion *string + /*HvnType + type is the unique type of the resource. Each service publishes a + unique set of types. The type value is recommended to be formatted + in "." such as "hashicorp.hvn". This is to prevent conflicts + in the future, but any string value will work. + + */ + HvnType *string + /*HvnUUID + uuid is the unique UUID for this resource. + + */ + HvnUUID *string + /*PaginationNextPageToken + Specifies a page token to use to retrieve the next page. Set this to the + `next_page_token` returned by previous list requests to get the next page of + results. If set, `previous_page_token` must not be set. + + */ + PaginationNextPageToken *string + /*PaginationPageSize + The max number of results per page that should be returned. If the number + of available results is larger than `page_size`, a `next_page_token` is + returned which can be used to get the next page of results in subsequent + requests. A value of zero will cause `page_size` to be defaulted. + + */ + PaginationPageSize *int64 + /*PaginationPreviousPageToken + Specifies a page token to use to retrieve the previous page. Set this to + the `previous_page_token` returned by previous list requests to get the + previous page of results. If set, `next_page_token` must not be set. + + */ + PaginationPreviousPageToken *string + /*TargetID + target_id is an optional parameter that allows returning only routes + that has a specific target Id. + + */ + TargetID *string + /*TargetType + target_type is an optional parameter that allows returning only routes + that has a specific target Type. + + */ + TargetType *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the list h v n routes params +func (o *ListHVNRoutesParams) WithTimeout(timeout time.Duration) *ListHVNRoutesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list h v n routes params +func (o *ListHVNRoutesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list h v n routes params +func (o *ListHVNRoutesParams) WithContext(ctx context.Context) *ListHVNRoutesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list h v n routes params +func (o *ListHVNRoutesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list h v n routes params +func (o *ListHVNRoutesParams) WithHTTPClient(client *http.Client) *ListHVNRoutesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list h v n routes params +func (o *ListHVNRoutesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHvnDescription adds the hvnDescription to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnDescription(hvnDescription *string) *ListHVNRoutesParams { + o.SetHvnDescription(hvnDescription) + return o +} + +// SetHvnDescription adds the hvnDescription to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnDescription(hvnDescription *string) { + o.HvnDescription = hvnDescription +} + +// WithHvnID adds the hvnID to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnID(hvnID string) *ListHVNRoutesParams { + o.SetHvnID(hvnID) + return o +} + +// SetHvnID adds the hvnId to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnID(hvnID string) { + o.HvnID = hvnID +} + +// WithHvnLocationOrganizationID adds the hvnLocationOrganizationID to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnLocationOrganizationID(hvnLocationOrganizationID string) *ListHVNRoutesParams { + o.SetHvnLocationOrganizationID(hvnLocationOrganizationID) + return o +} + +// SetHvnLocationOrganizationID adds the hvnLocationOrganizationId to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnLocationOrganizationID(hvnLocationOrganizationID string) { + o.HvnLocationOrganizationID = hvnLocationOrganizationID +} + +// WithHvnLocationProjectID adds the hvnLocationProjectID to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnLocationProjectID(hvnLocationProjectID string) *ListHVNRoutesParams { + o.SetHvnLocationProjectID(hvnLocationProjectID) + return o +} + +// SetHvnLocationProjectID adds the hvnLocationProjectId to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnLocationProjectID(hvnLocationProjectID string) { + o.HvnLocationProjectID = hvnLocationProjectID +} + +// WithHvnLocationRegionProvider adds the hvnLocationRegionProvider to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnLocationRegionProvider(hvnLocationRegionProvider *string) *ListHVNRoutesParams { + o.SetHvnLocationRegionProvider(hvnLocationRegionProvider) + return o +} + +// SetHvnLocationRegionProvider adds the hvnLocationRegionProvider to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnLocationRegionProvider(hvnLocationRegionProvider *string) { + o.HvnLocationRegionProvider = hvnLocationRegionProvider +} + +// WithHvnLocationRegionRegion adds the hvnLocationRegionRegion to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnLocationRegionRegion(hvnLocationRegionRegion *string) *ListHVNRoutesParams { + o.SetHvnLocationRegionRegion(hvnLocationRegionRegion) + return o +} + +// SetHvnLocationRegionRegion adds the hvnLocationRegionRegion to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnLocationRegionRegion(hvnLocationRegionRegion *string) { + o.HvnLocationRegionRegion = hvnLocationRegionRegion +} + +// WithHvnType adds the hvnType to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnType(hvnType *string) *ListHVNRoutesParams { + o.SetHvnType(hvnType) + return o +} + +// SetHvnType adds the hvnType to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnType(hvnType *string) { + o.HvnType = hvnType +} + +// WithHvnUUID adds the hvnUUID to the list h v n routes params +func (o *ListHVNRoutesParams) WithHvnUUID(hvnUUID *string) *ListHVNRoutesParams { + o.SetHvnUUID(hvnUUID) + return o +} + +// SetHvnUUID adds the hvnUuid to the list h v n routes params +func (o *ListHVNRoutesParams) SetHvnUUID(hvnUUID *string) { + o.HvnUUID = hvnUUID +} + +// WithPaginationNextPageToken adds the paginationNextPageToken to the list h v n routes params +func (o *ListHVNRoutesParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListHVNRoutesParams { + o.SetPaginationNextPageToken(paginationNextPageToken) + return o +} + +// SetPaginationNextPageToken adds the paginationNextPageToken to the list h v n routes params +func (o *ListHVNRoutesParams) SetPaginationNextPageToken(paginationNextPageToken *string) { + o.PaginationNextPageToken = paginationNextPageToken +} + +// WithPaginationPageSize adds the paginationPageSize to the list h v n routes params +func (o *ListHVNRoutesParams) WithPaginationPageSize(paginationPageSize *int64) *ListHVNRoutesParams { + o.SetPaginationPageSize(paginationPageSize) + return o +} + +// SetPaginationPageSize adds the paginationPageSize to the list h v n routes params +func (o *ListHVNRoutesParams) SetPaginationPageSize(paginationPageSize *int64) { + o.PaginationPageSize = paginationPageSize +} + +// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list h v n routes params +func (o *ListHVNRoutesParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListHVNRoutesParams { + o.SetPaginationPreviousPageToken(paginationPreviousPageToken) + return o +} + +// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list h v n routes params +func (o *ListHVNRoutesParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { + o.PaginationPreviousPageToken = paginationPreviousPageToken +} + +// WithTargetID adds the targetID to the list h v n routes params +func (o *ListHVNRoutesParams) WithTargetID(targetID *string) *ListHVNRoutesParams { + o.SetTargetID(targetID) + return o +} + +// SetTargetID adds the targetId to the list h v n routes params +func (o *ListHVNRoutesParams) SetTargetID(targetID *string) { + o.TargetID = targetID +} + +// WithTargetType adds the targetType to the list h v n routes params +func (o *ListHVNRoutesParams) WithTargetType(targetType *string) *ListHVNRoutesParams { + o.SetTargetType(targetType) + return o +} + +// SetTargetType adds the targetType to the list h v n routes params +func (o *ListHVNRoutesParams) SetTargetType(targetType *string) { + o.TargetType = targetType +} + +// WriteToRequest writes these params to a swagger request +func (o *ListHVNRoutesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.HvnDescription != nil { + + // query param hvn.description + var qrHvnDescription string + if o.HvnDescription != nil { + qrHvnDescription = *o.HvnDescription + } + qHvnDescription := qrHvnDescription + if qHvnDescription != "" { + if err := r.SetQueryParam("hvn.description", qHvnDescription); err != nil { + return err + } + } + + } + + // path param hvn.id + if err := r.SetPathParam("hvn.id", o.HvnID); err != nil { + return err + } + + // path param hvn.location.organization_id + if err := r.SetPathParam("hvn.location.organization_id", o.HvnLocationOrganizationID); err != nil { + return err + } + + // path param hvn.location.project_id + if err := r.SetPathParam("hvn.location.project_id", o.HvnLocationProjectID); err != nil { + return err + } + + if o.HvnLocationRegionProvider != nil { + + // query param hvn.location.region.provider + var qrHvnLocationRegionProvider string + if o.HvnLocationRegionProvider != nil { + qrHvnLocationRegionProvider = *o.HvnLocationRegionProvider + } + qHvnLocationRegionProvider := qrHvnLocationRegionProvider + if qHvnLocationRegionProvider != "" { + if err := r.SetQueryParam("hvn.location.region.provider", qHvnLocationRegionProvider); err != nil { + return err + } + } + + } + + if o.HvnLocationRegionRegion != nil { + + // query param hvn.location.region.region + var qrHvnLocationRegionRegion string + if o.HvnLocationRegionRegion != nil { + qrHvnLocationRegionRegion = *o.HvnLocationRegionRegion + } + qHvnLocationRegionRegion := qrHvnLocationRegionRegion + if qHvnLocationRegionRegion != "" { + if err := r.SetQueryParam("hvn.location.region.region", qHvnLocationRegionRegion); err != nil { + return err + } + } + + } + + if o.HvnType != nil { + + // query param hvn.type + var qrHvnType string + if o.HvnType != nil { + qrHvnType = *o.HvnType + } + qHvnType := qrHvnType + if qHvnType != "" { + if err := r.SetQueryParam("hvn.type", qHvnType); err != nil { + return err + } + } + + } + + if o.HvnUUID != nil { + + // query param hvn.uuid + var qrHvnUUID string + if o.HvnUUID != nil { + qrHvnUUID = *o.HvnUUID + } + qHvnUUID := qrHvnUUID + if qHvnUUID != "" { + if err := r.SetQueryParam("hvn.uuid", qHvnUUID); err != nil { + return err + } + } + + } + + if o.PaginationNextPageToken != nil { + + // query param pagination.next_page_token + var qrPaginationNextPageToken string + if o.PaginationNextPageToken != nil { + qrPaginationNextPageToken = *o.PaginationNextPageToken + } + qPaginationNextPageToken := qrPaginationNextPageToken + if qPaginationNextPageToken != "" { + if err := r.SetQueryParam("pagination.next_page_token", qPaginationNextPageToken); err != nil { + return err + } + } + + } + + if o.PaginationPageSize != nil { + + // query param pagination.page_size + var qrPaginationPageSize int64 + if o.PaginationPageSize != nil { + qrPaginationPageSize = *o.PaginationPageSize + } + qPaginationPageSize := swag.FormatInt64(qrPaginationPageSize) + if qPaginationPageSize != "" { + if err := r.SetQueryParam("pagination.page_size", qPaginationPageSize); err != nil { + return err + } + } + + } + + if o.PaginationPreviousPageToken != nil { + + // query param pagination.previous_page_token + var qrPaginationPreviousPageToken string + if o.PaginationPreviousPageToken != nil { + qrPaginationPreviousPageToken = *o.PaginationPreviousPageToken + } + qPaginationPreviousPageToken := qrPaginationPreviousPageToken + if qPaginationPreviousPageToken != "" { + if err := r.SetQueryParam("pagination.previous_page_token", qPaginationPreviousPageToken); err != nil { + return err + } + } + + } + + if o.TargetID != nil { + + // query param target_id + var qrTargetID string + if o.TargetID != nil { + qrTargetID = *o.TargetID + } + qTargetID := qrTargetID + if qTargetID != "" { + if err := r.SetQueryParam("target_id", qTargetID); err != nil { + return err + } + } + + } + + if o.TargetType != nil { + + // query param target_type + var qrTargetType string + if o.TargetType != nil { + qrTargetType = *o.TargetType + } + qTargetType := qrTargetType + if qTargetType != "" { + if err := r.SetQueryParam("target_type", qTargetType); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/client/network_service/list_h_v_n_routes_responses.go b/clients/cloud-network/preview/2020-09-07/client/network_service/list_h_v_n_routes_responses.go new file mode 100644 index 00000000..25211148 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/client/network_service/list_h_v_n_routes_responses.go @@ -0,0 +1,118 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-network/preview/2020-09-07/models" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// ListHVNRoutesReader is a Reader for the ListHVNRoutes structure. +type ListHVNRoutesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListHVNRoutesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListHVNRoutesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListHVNRoutesDefault(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 + } +} + +// NewListHVNRoutesOK creates a ListHVNRoutesOK with default headers values +func NewListHVNRoutesOK() *ListHVNRoutesOK { + return &ListHVNRoutesOK{} +} + +/*ListHVNRoutesOK handles this case with default header values. + +A successful response. +*/ +type ListHVNRoutesOK struct { + Payload *models.HashicorpCloudNetwork20200907ListHVNRoutesResponse +} + +func (o *ListHVNRoutesOK) Error() string { + return fmt.Sprintf("[GET /network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes][%d] listHVNRoutesOK %+v", 200, o.Payload) +} + +func (o *ListHVNRoutesOK) GetPayload() *models.HashicorpCloudNetwork20200907ListHVNRoutesResponse { + return o.Payload +} + +func (o *ListHVNRoutesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudNetwork20200907ListHVNRoutesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListHVNRoutesDefault creates a ListHVNRoutesDefault with default headers values +func NewListHVNRoutesDefault(code int) *ListHVNRoutesDefault { + return &ListHVNRoutesDefault{ + _statusCode: code, + } +} + +/*ListHVNRoutesDefault handles this case with default header values. + +An unexpected error response. +*/ +type ListHVNRoutesDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the list h v n routes default response +func (o *ListHVNRoutesDefault) Code() int { + return o._statusCode +} + +func (o *ListHVNRoutesDefault) Error() string { + return fmt.Sprintf("[GET /network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes][%d] ListHVNRoutes default %+v", o._statusCode, o.Payload) +} + +func (o *ListHVNRoutesDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ListHVNRoutesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/client/network_service/network_service_client.go b/clients/cloud-network/preview/2020-09-07/client/network_service/network_service_client.go index 30b51285..a9408394 100644 --- a/clients/cloud-network/preview/2020-09-07/client/network_service/network_service_client.go +++ b/clients/cloud-network/preview/2020-09-07/client/network_service/network_service_client.go @@ -29,12 +29,16 @@ type ClientService interface { Create(params *CreateParams, authInfo runtime.ClientAuthInfoWriter) (*CreateOK, error) + CreateHVNRoute(params *CreateHVNRouteParams, authInfo runtime.ClientAuthInfoWriter) (*CreateHVNRouteOK, error) + CreatePeering(params *CreatePeeringParams, authInfo runtime.ClientAuthInfoWriter) (*CreatePeeringOK, error) CreateTGWAttachment(params *CreateTGWAttachmentParams, authInfo runtime.ClientAuthInfoWriter) (*CreateTGWAttachmentOK, error) Delete(params *DeleteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteOK, error) + DeleteHVNRoute(params *DeleteHVNRouteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteHVNRouteOK, error) + DeletePeering(params *DeletePeeringParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePeeringOK, error) DeleteTGWAttachment(params *DeleteTGWAttachmentParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteTGWAttachmentOK, error) @@ -49,6 +53,8 @@ type ClientService interface { ListDependencies(params *ListDependenciesParams, authInfo runtime.ClientAuthInfoWriter) (*ListDependenciesOK, error) + ListHVNRoutes(params *ListHVNRoutesParams, authInfo runtime.ClientAuthInfoWriter) (*ListHVNRoutesOK, error) + ListPeerings(params *ListPeeringsParams, authInfo runtime.ClientAuthInfoWriter) (*ListPeeringsOK, error) ListTGWAttachments(params *ListTGWAttachmentsParams, authInfo runtime.ClientAuthInfoWriter) (*ListTGWAttachmentsOK, error) @@ -124,6 +130,42 @@ func (a *Client) Create(params *CreateParams, authInfo runtime.ClientAuthInfoWri return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* + CreateHVNRoute hs v n routes + + CreateHVNRoute creates a new HVN Route +*/ +func (a *Client) CreateHVNRoute(params *CreateHVNRouteParams, authInfo runtime.ClientAuthInfoWriter) (*CreateHVNRouteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateHVNRouteParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "CreateHVNRoute", + Method: "POST", + PathPattern: "/network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CreateHVNRouteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*CreateHVNRouteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateHVNRouteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* CreatePeering creates peering creates a new network peering between h v n v p c and target v p c */ @@ -226,6 +268,40 @@ func (a *Client) Delete(params *DeleteParams, authInfo runtime.ClientAuthInfoWri return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* + DeleteHVNRoute deletes h v n route triggers h v n route deletion workflow +*/ +func (a *Client) DeleteHVNRoute(params *DeleteHVNRouteParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteHVNRouteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteHVNRouteParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteHVNRoute", + Method: "DELETE", + PathPattern: "/network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteHVNRouteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteHVNRouteOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteHVNRouteDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* DeletePeering deletes peering deletes specified peering and triggers updating network configuration */ @@ -464,6 +540,40 @@ func (a *Client) ListDependencies(params *ListDependenciesParams, authInfo runti return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* + ListHVNRoutes lists h v n routes returns a list of routes for an h v n +*/ +func (a *Client) ListHVNRoutes(params *ListHVNRoutesParams, authInfo runtime.ClientAuthInfoWriter) (*ListHVNRoutesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListHVNRoutesParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "ListHVNRoutes", + Method: "GET", + PathPattern: "/network/2020-09-07/organizations/{hvn.location.organization_id}/projects/{hvn.location.project_id}/networks/{hvn.id}/routes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListHVNRoutesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*ListHVNRoutesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListHVNRoutesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ListPeerings lists peerings returns a list of peerings matching the request */ diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_create_h_v_n_route_request.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_create_h_v_n_route_request.go new file mode 100644 index 00000000..275f0315 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_create_h_v_n_route_request.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudNetwork20200907CreateHVNRouteRequest hashicorp cloud network 20200907 create h v n route request +// +// swagger:model hashicorp.cloud.network_20200907.CreateHVNRouteRequest +type HashicorpCloudNetwork20200907CreateHVNRouteRequest struct { + + // destination is a destination CIDR for this HVN Route + Destination string `json:"destination,omitempty"` + + // hvn is the HVN where a route being created + Hvn *cloud.HashicorpCloudLocationLink `json:"hvn,omitempty"` + + // id is a user generated id for the route + ID string `json:"id,omitempty"` + + // target is a target for this HVN Route + Target *HashicorpCloudNetwork20200907HVNRouteTarget `json:"target,omitempty"` +} + +// Validate validates this hashicorp cloud network 20200907 create h v n route request +func (m *HashicorpCloudNetwork20200907CreateHVNRouteRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHvn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudNetwork20200907CreateHVNRouteRequest) validateHvn(formats strfmt.Registry) error { + + if swag.IsZero(m.Hvn) { // not required + return nil + } + + if m.Hvn != nil { + if err := m.Hvn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hvn") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudNetwork20200907CreateHVNRouteRequest) validateTarget(formats strfmt.Registry) error { + + if swag.IsZero(m.Target) { // not required + return nil + } + + if m.Target != nil { + if err := m.Target.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907CreateHVNRouteRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907CreateHVNRouteRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudNetwork20200907CreateHVNRouteRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_create_h_v_n_route_response.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_create_h_v_n_route_response.go new file mode 100644 index 00000000..adefa209 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_create_h_v_n_route_response.go @@ -0,0 +1,97 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudNetwork20200907CreateHVNRouteResponse hashicorp cloud network 20200907 create h v n route response +// +// swagger:model hashicorp.cloud.network_20200907.CreateHVNRouteResponse +type HashicorpCloudNetwork20200907CreateHVNRouteResponse struct { + + // operation is the operation that represents the pending creation of the HVN Route. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` + + // route is the newly created route + Route *HashicorpCloudNetwork20200907HVNRoute `json:"route,omitempty"` +} + +// Validate validates this hashicorp cloud network 20200907 create h v n route response +func (m *HashicorpCloudNetwork20200907CreateHVNRouteResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRoute(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudNetwork20200907CreateHVNRouteResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudNetwork20200907CreateHVNRouteResponse) validateRoute(formats strfmt.Registry) error { + + if swag.IsZero(m.Route) { // not required + return nil + } + + if m.Route != nil { + if err := m.Route.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("route") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907CreateHVNRouteResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907CreateHVNRouteResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudNetwork20200907CreateHVNRouteResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_delete_h_v_n_route_response.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_delete_h_v_n_route_response.go new file mode 100644 index 00000000..8deeb572 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_delete_h_v_n_route_response.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudNetwork20200907DeleteHVNRouteResponse hashicorp cloud network 20200907 delete h v n route response +// +// swagger:model hashicorp.cloud.network_20200907.DeleteHVNRouteResponse +type HashicorpCloudNetwork20200907DeleteHVNRouteResponse struct { + + // operation is the operation that represents the pending deletion of an HVN route. + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud network 20200907 delete h v n route response +func (m *HashicorpCloudNetwork20200907DeleteHVNRouteResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudNetwork20200907DeleteHVNRouteResponse) validateOperation(formats strfmt.Registry) error { + + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907DeleteHVNRouteResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907DeleteHVNRouteResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudNetwork20200907DeleteHVNRouteResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route.go new file mode 100644 index 00000000..5e201507 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudNetwork20200907HVNRoute HVNRoute represents an HVN Route +// +// swagger:model hashicorp.cloud.network_20200907.HVNRoute +type HashicorpCloudNetwork20200907HVNRoute struct { + + // created_at is a timestamp when HVN Route was originally created + // Format: date-time + CreatedAt strfmt.DateTime `json:"created_at,omitempty"` + + // destination is a destination CIDR for this HVN Route + Destination string `json:"destination,omitempty"` + + // HVN is a link to the HVN the Route belongs to + Hvn *cloud.HashicorpCloudLocationLink `json:"hvn,omitempty"` + + // id is the user set, slug identifier for the HVN Route. It is unique + // within a given HVN but not globally unique. + ID string `json:"id,omitempty"` + + // state is the state of this HVN Route + State HashicorpCloudNetwork20200907HVNRouteState `json:"state,omitempty"` + + // target is a target for this HVN Route + Target *HashicorpCloudNetwork20200907HVNRouteTarget `json:"target,omitempty"` +} + +// Validate validates this hashicorp cloud network 20200907 h v n route +func (m *HashicorpCloudNetwork20200907HVNRoute) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHvn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudNetwork20200907HVNRoute) 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 *HashicorpCloudNetwork20200907HVNRoute) validateHvn(formats strfmt.Registry) error { + + if swag.IsZero(m.Hvn) { // not required + return nil + } + + if m.Hvn != nil { + if err := m.Hvn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hvn") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudNetwork20200907HVNRoute) validateState(formats strfmt.Registry) error { + + if swag.IsZero(m.State) { // not required + return nil + } + + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } + return err + } + + return nil +} + +func (m *HashicorpCloudNetwork20200907HVNRoute) validateTarget(formats strfmt.Registry) error { + + if swag.IsZero(m.Target) { // not required + return nil + } + + if m.Target != nil { + if err := m.Target.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907HVNRoute) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907HVNRoute) UnmarshalBinary(b []byte) error { + var res HashicorpCloudNetwork20200907HVNRoute + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route_state.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route_state.go new file mode 100644 index 00000000..b9e45293 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route_state.go @@ -0,0 +1,75 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudNetwork20200907HVNRouteState state is one of the states the TGW Attachment could be in. +// +// swagger:model hashicorp.cloud.network_20200907.HVNRoute.State +type HashicorpCloudNetwork20200907HVNRouteState string + +const ( + + // HashicorpCloudNetwork20200907HVNRouteStateUNSET captures enum value "UNSET" + HashicorpCloudNetwork20200907HVNRouteStateUNSET HashicorpCloudNetwork20200907HVNRouteState = "UNSET" + + // HashicorpCloudNetwork20200907HVNRouteStatePENDING captures enum value "PENDING" + HashicorpCloudNetwork20200907HVNRouteStatePENDING HashicorpCloudNetwork20200907HVNRouteState = "PENDING" + + // HashicorpCloudNetwork20200907HVNRouteStateCREATING captures enum value "CREATING" + HashicorpCloudNetwork20200907HVNRouteStateCREATING HashicorpCloudNetwork20200907HVNRouteState = "CREATING" + + // HashicorpCloudNetwork20200907HVNRouteStateACTIVE captures enum value "ACTIVE" + HashicorpCloudNetwork20200907HVNRouteStateACTIVE HashicorpCloudNetwork20200907HVNRouteState = "ACTIVE" + + // HashicorpCloudNetwork20200907HVNRouteStateFAILED captures enum value "FAILED" + HashicorpCloudNetwork20200907HVNRouteStateFAILED HashicorpCloudNetwork20200907HVNRouteState = "FAILED" + + // HashicorpCloudNetwork20200907HVNRouteStateDELETING captures enum value "DELETING" + HashicorpCloudNetwork20200907HVNRouteStateDELETING HashicorpCloudNetwork20200907HVNRouteState = "DELETING" +) + +// for schema +var hashicorpCloudNetwork20200907HVNRouteStateEnum []interface{} + +func init() { + var res []HashicorpCloudNetwork20200907HVNRouteState + if err := json.Unmarshal([]byte(`["UNSET","PENDING","CREATING","ACTIVE","FAILED","DELETING"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudNetwork20200907HVNRouteStateEnum = append(hashicorpCloudNetwork20200907HVNRouteStateEnum, v) + } +} + +func (m HashicorpCloudNetwork20200907HVNRouteState) validateHashicorpCloudNetwork20200907HVNRouteStateEnum(path, location string, value HashicorpCloudNetwork20200907HVNRouteState) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudNetwork20200907HVNRouteStateEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud network 20200907 h v n route state +func (m HashicorpCloudNetwork20200907HVNRouteState) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudNetwork20200907HVNRouteStateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route_target.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route_target.go new file mode 100644 index 00000000..acb4752b --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_h_v_n_route_target.go @@ -0,0 +1,73 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudNetwork20200907HVNRouteTarget HVNRouteTarget is a wrapper around HVN Route target that allows us to +// add more types of targets in the future. +// +// swagger:model hashicorp.cloud.network_20200907.HVNRouteTarget +type HashicorpCloudNetwork20200907HVNRouteTarget struct { + + // hvn_connection is a link-type target for HVN connections (peerings and TGW attachments) + HvnConnection *cloud.HashicorpCloudLocationLink `json:"hvn_connection,omitempty"` +} + +// Validate validates this hashicorp cloud network 20200907 h v n route target +func (m *HashicorpCloudNetwork20200907HVNRouteTarget) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHvnConnection(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudNetwork20200907HVNRouteTarget) validateHvnConnection(formats strfmt.Registry) error { + + if swag.IsZero(m.HvnConnection) { // not required + return nil + } + + if m.HvnConnection != nil { + if err := m.HvnConnection.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hvn_connection") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907HVNRouteTarget) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907HVNRouteTarget) UnmarshalBinary(b []byte) error { + var res HashicorpCloudNetwork20200907HVNRouteTarget + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_list_h_v_n_routes_response.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_list_h_v_n_routes_response.go new file mode 100644 index 00000000..ce8baa4c --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_list_h_v_n_routes_response.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudNetwork20200907ListHVNRoutesResponse hashicorp cloud network 20200907 list h v n routes response +// +// swagger:model hashicorp.cloud.network_20200907.ListHVNRoutesResponse +type HashicorpCloudNetwork20200907ListHVNRoutesResponse struct { + + // Pagination contains the pagination tokens for a subsequent request. + Pagination *cloud.HashicorpCloudCommonPaginationResponse `json:"pagination,omitempty"` + + // routes is a list of HVN Routes matching request + Routes []*HashicorpCloudNetwork20200907HVNRoute `json:"routes"` +} + +// Validate validates this hashicorp cloud network 20200907 list h v n routes response +func (m *HashicorpCloudNetwork20200907ListHVNRoutesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePagination(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRoutes(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudNetwork20200907ListHVNRoutesResponse) validatePagination(formats strfmt.Registry) error { + + if swag.IsZero(m.Pagination) { // not required + return nil + } + + if m.Pagination != nil { + if err := m.Pagination.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pagination") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudNetwork20200907ListHVNRoutesResponse) 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)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907ListHVNRoutesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907ListHVNRoutesResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudNetwork20200907ListHVNRoutesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_network_target.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_network_target.go new file mode 100644 index 00000000..0ceeb2c0 --- /dev/null +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_network_target.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudNetwork20200907NetworkTarget NetworkTarget is a Peering.Target based on another HVN. +// +// swagger:model hashicorp.cloud.network_20200907.NetworkTarget +type HashicorpCloudNetwork20200907NetworkTarget struct { + + // hvn is the managed HVN needing to be peered with. + Hvn *cloud.HashicorpCloudLocationLink `json:"hvn,omitempty"` +} + +// Validate validates this hashicorp cloud network 20200907 network target +func (m *HashicorpCloudNetwork20200907NetworkTarget) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHvn(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudNetwork20200907NetworkTarget) validateHvn(formats strfmt.Registry) error { + + if swag.IsZero(m.Hvn) { // not required + return nil + } + + if m.Hvn != nil { + if err := m.Hvn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hvn") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907NetworkTarget) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudNetwork20200907NetworkTarget) UnmarshalBinary(b []byte) error { + var res HashicorpCloudNetwork20200907NetworkTarget + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_peering_target.go b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_peering_target.go index 562b1d71..791c78e1 100644 --- a/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_peering_target.go +++ b/clients/cloud-network/preview/2020-09-07/models/hashicorp_cloud_network20200907_peering_target.go @@ -18,6 +18,9 @@ type HashicorpCloudNetwork20200907PeeringTarget struct { // aws target AwsTarget *HashicorpCloudNetwork20200907AWSPeeringTarget `json:"aws_target,omitempty"` + + // hvn target + HvnTarget *HashicorpCloudNetwork20200907NetworkTarget `json:"hvn_target,omitempty"` } // Validate validates this hashicorp cloud network 20200907 peering target @@ -28,6 +31,10 @@ func (m *HashicorpCloudNetwork20200907PeeringTarget) Validate(formats strfmt.Reg res = append(res, err) } + if err := m.validateHvnTarget(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -52,6 +59,24 @@ func (m *HashicorpCloudNetwork20200907PeeringTarget) validateAwsTarget(formats s return nil } +func (m *HashicorpCloudNetwork20200907PeeringTarget) validateHvnTarget(formats strfmt.Registry) error { + + if swag.IsZero(m.HvnTarget) { // not required + return nil + } + + if m.HvnTarget != nil { + if err := m.HvnTarget.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hvn_target") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HashicorpCloudNetwork20200907PeeringTarget) MarshalBinary() ([]byte, error) { if m == nil {