From 6aca7b6e8d7d59128a334a41e0b23df820c777a7 Mon Sep 17 00:00:00 2001 From: ArthurVerrept Date: Thu, 29 Feb 2024 07:41:27 +0000 Subject: [PATCH] upgrade client --- internal/client/billing/billing_client.go | 544 ++ .../create_billing_account_parameters.go | 150 + .../create_billing_account_responses.go | 182 + .../delete_billing_account_parameters.go | 148 + .../delete_billing_account_responses.go | 180 + .../get_billing_account_details_parameters.go | 148 + .../get_billing_account_details_responses.go | 182 + .../billing/get_billing_account_parameters.go | 148 + ...ling_account_payment_methods_parameters.go | 148 + ...lling_account_payment_methods_responses.go | 182 + .../billing/get_billing_account_responses.go | 182 + ...billing_account_setup_intent_parameters.go | 148 + ..._billing_account_setup_intent_responses.go | 182 + ...illing_account_spend_details_parameters.go | 200 + ...billing_account_spend_details_responses.go | 182 + ...ling_account_stripe_invoices_parameters.go | 249 + ...lling_account_stripe_invoices_responses.go | 182 + .../list_billing_accounts_parameters.go | 194 + .../list_billing_accounts_responses.go | 182 + ..._outstanding_stripe_invoices_parameters.go | 128 + ...t_outstanding_stripe_invoices_responses.go | 182 + ...lling_account_payment_method_parameters.go | 167 + ...illing_account_payment_method_responses.go | 182 + ...count_default_payment_method_parameters.go | 167 + ...ccount_default_payment_method_responses.go | 182 + .../update_billing_account_parameters.go | 169 + .../update_billing_account_responses.go | 182 + .../client/cudo_compute_service_client.go | 15 + .../data_centers/count_hosts_parameters.go | 148 + .../data_centers/count_hosts_responses.go | 182 + .../create_data_center_parameters.go | 150 + .../create_data_center_responses.go | 182 + .../data_centers/data_centers_client.go | 488 ++ .../delete_data_center_parameters.go | 148 + .../delete_data_center_responses.go | 180 + ...data_center_live_utilization_parameters.go | 148 + ..._data_center_live_utilization_responses.go | 182 + .../get_data_center_parameters.go | 148 + .../data_centers/get_data_center_responses.go | 182 + ...a_center_revenue_by_resource_parameters.go | 200 + ...ta_center_revenue_by_resource_responses.go | 182 + ...a_center_revenue_time_series_parameters.go | 237 + ...ta_center_revenue_time_series_responses.go | 182 + .../data_centers/list_clusters_parameters.go | 148 + .../data_centers/list_clusters_responses.go | 182 + .../list_data_centers_parameters.go | 194 + .../list_data_centers_responses.go | 182 + .../data_centers/list_hosts_parameters.go | 148 + .../data_centers/list_hosts_responses.go | 182 + .../update_data_center_parameters.go | 165 + .../update_data_center_responses.go | 342 + .../disks/create_disk_snapshot_parameters.go | 14 +- .../disks/create_disk_snapshot_responses.go | 78 - .../disks/create_storage_disk_parameters.go | 14 +- .../disks/create_storage_disk_responses.go | 102 - ...achine_type_live_utilization_parameters.go | 167 + ...machine_type_live_utilization_responses.go | 182 + .../get_machine_type_parameters.go | 167 + .../get_machine_type_responses.go | 182 + .../list_machine_types_parameters.go | 148 + .../list_machine_types_responses.go | 182 + .../machine_types/machine_types_client.go | 154 + .../networks/create_network_parameters.go | 14 +- .../networks/create_network_responses.go | 168 - .../networks/delete_network_parameters.go | 24 - .../networks/start_network_parameters.go | 24 - .../networks/stop_network_parameters.go | 24 - .../object_storage/activate_parameters.go | 14 +- .../object_storage/activate_responses.go | 40 - .../create_object_storage_user_parameters.go | 14 +- .../create_object_storage_user_responses.go | 40 - .../delete_object_storage_key_parameters.go | 24 +- .../delete_object_storage_key_responses.go | 8 +- .../generate_object_storage_key_parameters.go | 19 - .../object_storage/object_storage_client.go | 6 +- ...ling_account_user_permission_parameters.go | 14 +- ...lling_account_user_permission_responses.go | 125 - ..._data_center_user_permission_parameters.go | 14 +- ...d_data_center_user_permission_responses.go | 125 - .../add_project_user_permission_parameters.go | 14 +- .../add_project_user_permission_responses.go | 125 - ...ling_account_user_permission_parameters.go | 14 +- ...lling_account_user_permission_responses.go | 125 - ..._data_center_user_permission_parameters.go | 14 +- ...e_data_center_user_permission_responses.go | 125 - ...move_project_user_permission_parameters.go | 14 +- ...emove_project_user_permission_responses.go | 125 - .../attach_security_group_parameters.go | 198 + .../attach_security_group_responses.go | 180 + .../virtual_machines/create_vm_parameters.go | 14 +- .../virtual_machines/create_vm_responses.go | 338 - .../detach_security_group_parameters.go | 198 + .../detach_security_group_responses.go | 180 + .../list_vm_machine_types2_parameters.go | 128 + .../list_vm_machine_types2_responses.go | 182 + .../list_vm_machine_types_parameters.go | 31 + .../update_vm_metadata_parameters.go | 188 + .../update_vm_metadata_responses.go | 182 + .../virtual_machines_client.go | 156 + internal/models/activate_body.go | 50 + ...dd_billing_account_user_permission_body.go | 135 + .../add_data_center_user_permission_body.go | 135 + .../add_project_user_permission_body.go | 135 + .../models/attach_security_group_response.go | 11 + internal/models/billing_account.go | 336 + .../models/billing_account_payment_method.go | 169 + .../models/billing_account_payment_methods.go | 121 + .../models/billing_account_setup_intent.go | 88 + internal/models/billing_account_spend_row.go | 261 + internal/models/cluster.go | 573 ++ internal/models/count_hosts_response.go | 71 + internal/models/cpu_topology.go | 56 + .../models/create_billing_account_request.go | 176 + internal/models/create_disk_snapshot_body.go | 88 + internal/models/create_network_body.go | 161 + .../models/create_object_storage_user_body.go | 50 + internal/models/create_storage_disk_body.go | 112 + internal/models/create_vm_body.go | 402 + internal/models/data_center_machine_type.go | 139 + .../models/data_center_revenue_resource.go | 208 + internal/models/data_center_time_revenue.go | 130 + .../models/detach_security_group_response.go | 11 + .../get_billing_account_details_response.go | 157 + ..._billing_account_spend_details_response.go | 124 + ...illing_account_stripe_invoices_response.go | 141 + ...t_data_center_live_utilization_response.go | 275 + ...ata_center_revenue_by_resource_response.go | 124 + ...ata_center_revenue_time_series_response.go | 124 + ..._machine_type_live_utilization_response.go | 275 + internal/models/get_machine_type_response.go | 557 ++ internal/models/get_response.go | 124 + internal/models/get_vm_response.go | 490 ++ internal/models/gpu_model_category.go | 51 + internal/models/host.go | 336 + internal/models/host_config_category.go | 17 + internal/models/image.go | 72 +- internal/models/interval.go | 84 + internal/models/invoice.go | 95 + .../models/list_billing_accounts_response.go | 158 + internal/models/list_clusters_response.go | 124 + internal/models/list_data_centers_response.go | 158 + internal/models/list_hosts_response.go | 124 + .../models/list_machine_types_response.go | 124 + ...st_outstanding_stripe_invoices_response.go | 124 + .../models/list_vm_machine_types2_response.go | 124 + .../models/list_vm_machine_types_request.go | 3 + internal/models/network.go | 234 +- internal/models/network_price_hr.go | 2 +- internal/models/network_state.go | 129 + internal/models/package.go | 105 + internal/models/payment_method_card.go | 65 + internal/models/payment_method_paypal.go | 53 + internal/models/point.go | 53 + internal/models/protobuf_any.go | 161 + internal/models/protocol.go | 93 - internal/models/region.go | 76 +- internal/models/region_data_center.go | 50 + ...billing_account_payment_method_response.go | 88 + ...ve_billing_account_user_permission_body.go | 135 + ...remove_data_center_user_permission_body.go | 135 + .../remove_project_user_permission_body.go | 135 + internal/models/rule.go | 4 +- internal/models/rule_protocol.go | 93 + internal/models/rule_rule_type.go | 81 + internal/models/rule_type.go | 81 - internal/models/security_group_rule.go | 4 +- .../models/security_group_rule_protocol.go | 93 + .../models/security_group_rule_rule_type.go | 81 + ...account_default_payment_method_response.go | 88 + internal/models/status.go | 2 +- internal/models/stripe_customer.go | 118 + internal/models/sync_response.go | 11 + internal/models/task.go | 56 + internal/models/tax_id.go | 77 + internal/models/unit.go | 81 + .../models/update_billing_account_body.go | 431 + internal/models/update_host_response.go | 11 + internal/models/update_image_response.go | 11 + internal/models/update_net_response.go | 11 + internal/models/update_vm_metadata_body.go | 53 + .../models/update_vm_metadata_response.go | 50 + internal/models/update_vm_response.go | 11 + internal/models/v1_data_center.go | 187 + internal/models/v1_v_router_size.go | 84 + internal/models/vm.go | 100 +- .../models/vm_data_center_v_router_size.go | 84 + internal/models/vm_machine_type.go | 610 ++ internal/models/vm_state.go | 129 + internal/provider/network_data_source.go | 12 +- internal/provider/network_resource.go | 40 +- internal/provider/security_group_resource.go | 38 +- internal/provider/vm_resource.go | 2 +- swagger/public.swagger.json | 7477 ++++++++++++----- 193 files changed, 29224 insertions(+), 4291 deletions(-) create mode 100644 internal/client/billing/billing_client.go create mode 100644 internal/client/billing/create_billing_account_parameters.go create mode 100644 internal/client/billing/create_billing_account_responses.go create mode 100644 internal/client/billing/delete_billing_account_parameters.go create mode 100644 internal/client/billing/delete_billing_account_responses.go create mode 100644 internal/client/billing/get_billing_account_details_parameters.go create mode 100644 internal/client/billing/get_billing_account_details_responses.go create mode 100644 internal/client/billing/get_billing_account_parameters.go create mode 100644 internal/client/billing/get_billing_account_payment_methods_parameters.go create mode 100644 internal/client/billing/get_billing_account_payment_methods_responses.go create mode 100644 internal/client/billing/get_billing_account_responses.go create mode 100644 internal/client/billing/get_billing_account_setup_intent_parameters.go create mode 100644 internal/client/billing/get_billing_account_setup_intent_responses.go create mode 100644 internal/client/billing/get_billing_account_spend_details_parameters.go create mode 100644 internal/client/billing/get_billing_account_spend_details_responses.go create mode 100644 internal/client/billing/get_billing_account_stripe_invoices_parameters.go create mode 100644 internal/client/billing/get_billing_account_stripe_invoices_responses.go create mode 100644 internal/client/billing/list_billing_accounts_parameters.go create mode 100644 internal/client/billing/list_billing_accounts_responses.go create mode 100644 internal/client/billing/list_outstanding_stripe_invoices_parameters.go create mode 100644 internal/client/billing/list_outstanding_stripe_invoices_responses.go create mode 100644 internal/client/billing/remove_billing_account_payment_method_parameters.go create mode 100644 internal/client/billing/remove_billing_account_payment_method_responses.go create mode 100644 internal/client/billing/set_billing_account_default_payment_method_parameters.go create mode 100644 internal/client/billing/set_billing_account_default_payment_method_responses.go create mode 100644 internal/client/billing/update_billing_account_parameters.go create mode 100644 internal/client/billing/update_billing_account_responses.go create mode 100644 internal/client/data_centers/count_hosts_parameters.go create mode 100644 internal/client/data_centers/count_hosts_responses.go create mode 100644 internal/client/data_centers/create_data_center_parameters.go create mode 100644 internal/client/data_centers/create_data_center_responses.go create mode 100644 internal/client/data_centers/data_centers_client.go create mode 100644 internal/client/data_centers/delete_data_center_parameters.go create mode 100644 internal/client/data_centers/delete_data_center_responses.go create mode 100644 internal/client/data_centers/get_data_center_live_utilization_parameters.go create mode 100644 internal/client/data_centers/get_data_center_live_utilization_responses.go create mode 100644 internal/client/data_centers/get_data_center_parameters.go create mode 100644 internal/client/data_centers/get_data_center_responses.go create mode 100644 internal/client/data_centers/get_data_center_revenue_by_resource_parameters.go create mode 100644 internal/client/data_centers/get_data_center_revenue_by_resource_responses.go create mode 100644 internal/client/data_centers/get_data_center_revenue_time_series_parameters.go create mode 100644 internal/client/data_centers/get_data_center_revenue_time_series_responses.go create mode 100644 internal/client/data_centers/list_clusters_parameters.go create mode 100644 internal/client/data_centers/list_clusters_responses.go create mode 100644 internal/client/data_centers/list_data_centers_parameters.go create mode 100644 internal/client/data_centers/list_data_centers_responses.go create mode 100644 internal/client/data_centers/list_hosts_parameters.go create mode 100644 internal/client/data_centers/list_hosts_responses.go create mode 100644 internal/client/data_centers/update_data_center_parameters.go create mode 100644 internal/client/data_centers/update_data_center_responses.go create mode 100644 internal/client/machine_types/get_machine_type_live_utilization_parameters.go create mode 100644 internal/client/machine_types/get_machine_type_live_utilization_responses.go create mode 100644 internal/client/machine_types/get_machine_type_parameters.go create mode 100644 internal/client/machine_types/get_machine_type_responses.go create mode 100644 internal/client/machine_types/list_machine_types_parameters.go create mode 100644 internal/client/machine_types/list_machine_types_responses.go create mode 100644 internal/client/machine_types/machine_types_client.go create mode 100644 internal/client/virtual_machines/attach_security_group_parameters.go create mode 100644 internal/client/virtual_machines/attach_security_group_responses.go create mode 100644 internal/client/virtual_machines/detach_security_group_parameters.go create mode 100644 internal/client/virtual_machines/detach_security_group_responses.go create mode 100644 internal/client/virtual_machines/list_vm_machine_types2_parameters.go create mode 100644 internal/client/virtual_machines/list_vm_machine_types2_responses.go create mode 100644 internal/client/virtual_machines/update_vm_metadata_parameters.go create mode 100644 internal/client/virtual_machines/update_vm_metadata_responses.go create mode 100644 internal/models/activate_body.go create mode 100644 internal/models/add_billing_account_user_permission_body.go create mode 100644 internal/models/add_data_center_user_permission_body.go create mode 100644 internal/models/add_project_user_permission_body.go create mode 100644 internal/models/attach_security_group_response.go create mode 100644 internal/models/billing_account.go create mode 100644 internal/models/billing_account_payment_method.go create mode 100644 internal/models/billing_account_payment_methods.go create mode 100644 internal/models/billing_account_setup_intent.go create mode 100644 internal/models/billing_account_spend_row.go create mode 100644 internal/models/cluster.go create mode 100644 internal/models/count_hosts_response.go create mode 100644 internal/models/cpu_topology.go create mode 100644 internal/models/create_billing_account_request.go create mode 100644 internal/models/create_disk_snapshot_body.go create mode 100644 internal/models/create_network_body.go create mode 100644 internal/models/create_object_storage_user_body.go create mode 100644 internal/models/create_storage_disk_body.go create mode 100644 internal/models/create_vm_body.go create mode 100644 internal/models/data_center_machine_type.go create mode 100644 internal/models/data_center_revenue_resource.go create mode 100644 internal/models/data_center_time_revenue.go create mode 100644 internal/models/detach_security_group_response.go create mode 100644 internal/models/get_billing_account_details_response.go create mode 100644 internal/models/get_billing_account_spend_details_response.go create mode 100644 internal/models/get_billing_account_stripe_invoices_response.go create mode 100644 internal/models/get_data_center_live_utilization_response.go create mode 100644 internal/models/get_data_center_revenue_by_resource_response.go create mode 100644 internal/models/get_data_center_revenue_time_series_response.go create mode 100644 internal/models/get_machine_type_live_utilization_response.go create mode 100644 internal/models/get_machine_type_response.go create mode 100644 internal/models/get_response.go create mode 100644 internal/models/host.go create mode 100644 internal/models/interval.go create mode 100644 internal/models/invoice.go create mode 100644 internal/models/list_billing_accounts_response.go create mode 100644 internal/models/list_clusters_response.go create mode 100644 internal/models/list_data_centers_response.go create mode 100644 internal/models/list_hosts_response.go create mode 100644 internal/models/list_machine_types_response.go create mode 100644 internal/models/list_outstanding_stripe_invoices_response.go create mode 100644 internal/models/list_vm_machine_types2_response.go create mode 100644 internal/models/network_state.go create mode 100644 internal/models/package.go create mode 100644 internal/models/payment_method_card.go create mode 100644 internal/models/payment_method_paypal.go create mode 100644 internal/models/point.go create mode 100644 internal/models/protobuf_any.go delete mode 100644 internal/models/protocol.go create mode 100644 internal/models/region_data_center.go create mode 100644 internal/models/remove_billing_account_payment_method_response.go create mode 100644 internal/models/remove_billing_account_user_permission_body.go create mode 100644 internal/models/remove_data_center_user_permission_body.go create mode 100644 internal/models/remove_project_user_permission_body.go create mode 100644 internal/models/rule_protocol.go create mode 100644 internal/models/rule_rule_type.go delete mode 100644 internal/models/rule_type.go create mode 100644 internal/models/security_group_rule_protocol.go create mode 100644 internal/models/security_group_rule_rule_type.go create mode 100644 internal/models/set_billing_account_default_payment_method_response.go create mode 100644 internal/models/stripe_customer.go create mode 100644 internal/models/sync_response.go create mode 100644 internal/models/task.go create mode 100644 internal/models/tax_id.go create mode 100644 internal/models/unit.go create mode 100644 internal/models/update_billing_account_body.go create mode 100644 internal/models/update_host_response.go create mode 100644 internal/models/update_image_response.go create mode 100644 internal/models/update_net_response.go create mode 100644 internal/models/update_vm_metadata_body.go create mode 100644 internal/models/update_vm_metadata_response.go create mode 100644 internal/models/update_vm_response.go create mode 100644 internal/models/v1_data_center.go create mode 100644 internal/models/v1_v_router_size.go create mode 100644 internal/models/vm_data_center_v_router_size.go create mode 100644 internal/models/vm_machine_type.go create mode 100644 internal/models/vm_state.go diff --git a/internal/client/billing/billing_client.go b/internal/client/billing/billing_client.go new file mode 100644 index 0000000..bc9c69a --- /dev/null +++ b/internal/client/billing/billing_client.go @@ -0,0 +1,544 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new billing API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for billing API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + CreateBillingAccount(params *CreateBillingAccountParams, opts ...ClientOption) (*CreateBillingAccountOK, error) + + DeleteBillingAccount(params *DeleteBillingAccountParams, opts ...ClientOption) (*DeleteBillingAccountOK, error) + + GetBillingAccount(params *GetBillingAccountParams, opts ...ClientOption) (*GetBillingAccountOK, error) + + GetBillingAccountDetails(params *GetBillingAccountDetailsParams, opts ...ClientOption) (*GetBillingAccountDetailsOK, error) + + GetBillingAccountPaymentMethods(params *GetBillingAccountPaymentMethodsParams, opts ...ClientOption) (*GetBillingAccountPaymentMethodsOK, error) + + GetBillingAccountSetupIntent(params *GetBillingAccountSetupIntentParams, opts ...ClientOption) (*GetBillingAccountSetupIntentOK, error) + + GetBillingAccountSpendDetails(params *GetBillingAccountSpendDetailsParams, opts ...ClientOption) (*GetBillingAccountSpendDetailsOK, error) + + GetBillingAccountStripeInvoices(params *GetBillingAccountStripeInvoicesParams, opts ...ClientOption) (*GetBillingAccountStripeInvoicesOK, error) + + ListBillingAccounts(params *ListBillingAccountsParams, opts ...ClientOption) (*ListBillingAccountsOK, error) + + ListOutstandingStripeInvoices(params *ListOutstandingStripeInvoicesParams, opts ...ClientOption) (*ListOutstandingStripeInvoicesOK, error) + + RemoveBillingAccountPaymentMethod(params *RemoveBillingAccountPaymentMethodParams, opts ...ClientOption) (*RemoveBillingAccountPaymentMethodOK, error) + + SetBillingAccountDefaultPaymentMethod(params *SetBillingAccountDefaultPaymentMethodParams, opts ...ClientOption) (*SetBillingAccountDefaultPaymentMethodOK, error) + + UpdateBillingAccount(params *UpdateBillingAccountParams, opts ...ClientOption) (*UpdateBillingAccountOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +CreateBillingAccount creates a billing account +*/ +func (a *Client) CreateBillingAccount(params *CreateBillingAccountParams, opts ...ClientOption) (*CreateBillingAccountOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateBillingAccountParams() + } + op := &runtime.ClientOperation{ + ID: "CreateBillingAccount", + Method: "POST", + PathPattern: "/v1/billing-accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &CreateBillingAccountReader{formats: a.formats}, + 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.(*CreateBillingAccountOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateBillingAccountDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeleteBillingAccount deletes billing account +*/ +func (a *Client) DeleteBillingAccount(params *DeleteBillingAccountParams, opts ...ClientOption) (*DeleteBillingAccountOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteBillingAccountParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteBillingAccount", + Method: "DELETE", + PathPattern: "/v1/billing-accounts/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &DeleteBillingAccountReader{formats: a.formats}, + 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.(*DeleteBillingAccountOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteBillingAccountDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetBillingAccount gets a billing account +*/ +func (a *Client) GetBillingAccount(params *GetBillingAccountParams, opts ...ClientOption) (*GetBillingAccountOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetBillingAccountParams() + } + op := &runtime.ClientOperation{ + ID: "GetBillingAccount", + Method: "GET", + PathPattern: "/v1/billing-accounts/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetBillingAccountReader{formats: a.formats}, + 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.(*GetBillingAccountOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetBillingAccountDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetBillingAccountDetails gets billing account details +*/ +func (a *Client) GetBillingAccountDetails(params *GetBillingAccountDetailsParams, opts ...ClientOption) (*GetBillingAccountDetailsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetBillingAccountDetailsParams() + } + op := &runtime.ClientOperation{ + ID: "GetBillingAccountDetails", + Method: "GET", + PathPattern: "/v1/billing-accounts/{id}/details", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetBillingAccountDetailsReader{formats: a.formats}, + 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.(*GetBillingAccountDetailsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetBillingAccountDetailsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetBillingAccountPaymentMethods gets payment methods +*/ +func (a *Client) GetBillingAccountPaymentMethods(params *GetBillingAccountPaymentMethodsParams, opts ...ClientOption) (*GetBillingAccountPaymentMethodsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetBillingAccountPaymentMethodsParams() + } + op := &runtime.ClientOperation{ + ID: "GetBillingAccountPaymentMethods", + Method: "GET", + PathPattern: "/v1/billing-accounts/{id}/payment-methods", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetBillingAccountPaymentMethodsReader{formats: a.formats}, + 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.(*GetBillingAccountPaymentMethodsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetBillingAccountPaymentMethodsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetBillingAccountSetupIntent gets setup intent +*/ +func (a *Client) GetBillingAccountSetupIntent(params *GetBillingAccountSetupIntentParams, opts ...ClientOption) (*GetBillingAccountSetupIntentOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetBillingAccountSetupIntentParams() + } + op := &runtime.ClientOperation{ + ID: "GetBillingAccountSetupIntent", + Method: "GET", + PathPattern: "/v1/billing-accounts/{id}/setup-intent", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetBillingAccountSetupIntentReader{formats: a.formats}, + 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.(*GetBillingAccountSetupIntentOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetBillingAccountSetupIntentDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetBillingAccountSpendDetails gets spend details +*/ +func (a *Client) GetBillingAccountSpendDetails(params *GetBillingAccountSpendDetailsParams, opts ...ClientOption) (*GetBillingAccountSpendDetailsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetBillingAccountSpendDetailsParams() + } + op := &runtime.ClientOperation{ + ID: "GetBillingAccountSpendDetails", + Method: "GET", + PathPattern: "/v1/billing-accounts/{billingAccountId}/spend/details", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetBillingAccountSpendDetailsReader{formats: a.formats}, + 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.(*GetBillingAccountSpendDetailsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetBillingAccountSpendDetailsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetBillingAccountStripeInvoices gets invoices +*/ +func (a *Client) GetBillingAccountStripeInvoices(params *GetBillingAccountStripeInvoicesParams, opts ...ClientOption) (*GetBillingAccountStripeInvoicesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetBillingAccountStripeInvoicesParams() + } + op := &runtime.ClientOperation{ + ID: "GetBillingAccountStripeInvoices", + Method: "GET", + PathPattern: "/v1/billing-accounts/invoices", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetBillingAccountStripeInvoicesReader{formats: a.formats}, + 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.(*GetBillingAccountStripeInvoicesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetBillingAccountStripeInvoicesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListBillingAccounts lists billing accounts +*/ +func (a *Client) ListBillingAccounts(params *ListBillingAccountsParams, opts ...ClientOption) (*ListBillingAccountsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListBillingAccountsParams() + } + op := &runtime.ClientOperation{ + ID: "ListBillingAccounts", + Method: "GET", + PathPattern: "/v1/billing-accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListBillingAccountsReader{formats: a.formats}, + 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.(*ListBillingAccountsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListBillingAccountsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListOutstandingStripeInvoices gets outstanding invoices +*/ +func (a *Client) ListOutstandingStripeInvoices(params *ListOutstandingStripeInvoicesParams, opts ...ClientOption) (*ListOutstandingStripeInvoicesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListOutstandingStripeInvoicesParams() + } + op := &runtime.ClientOperation{ + ID: "ListOutstandingStripeInvoices", + Method: "GET", + PathPattern: "/v1/billing-accounts/invoices/outstanding", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListOutstandingStripeInvoicesReader{formats: a.formats}, + 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.(*ListOutstandingStripeInvoicesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListOutstandingStripeInvoicesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +RemoveBillingAccountPaymentMethod removes payment method +*/ +func (a *Client) RemoveBillingAccountPaymentMethod(params *RemoveBillingAccountPaymentMethodParams, opts ...ClientOption) (*RemoveBillingAccountPaymentMethodOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRemoveBillingAccountPaymentMethodParams() + } + op := &runtime.ClientOperation{ + ID: "RemoveBillingAccountPaymentMethod", + Method: "DELETE", + PathPattern: "/v1/billing-accounts/{id}/payment-methods/{paymentMethodId}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &RemoveBillingAccountPaymentMethodReader{formats: a.formats}, + 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.(*RemoveBillingAccountPaymentMethodOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*RemoveBillingAccountPaymentMethodDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +SetBillingAccountDefaultPaymentMethod sets default payment method +*/ +func (a *Client) SetBillingAccountDefaultPaymentMethod(params *SetBillingAccountDefaultPaymentMethodParams, opts ...ClientOption) (*SetBillingAccountDefaultPaymentMethodOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewSetBillingAccountDefaultPaymentMethodParams() + } + op := &runtime.ClientOperation{ + ID: "SetBillingAccountDefaultPaymentMethod", + Method: "POST", + PathPattern: "/v1/billing-accounts/{id}/payment-methods/{paymentMethodId}/set-default", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &SetBillingAccountDefaultPaymentMethodReader{formats: a.formats}, + 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.(*SetBillingAccountDefaultPaymentMethodOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*SetBillingAccountDefaultPaymentMethodDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UpdateBillingAccount updates billing account +*/ +func (a *Client) UpdateBillingAccount(params *UpdateBillingAccountParams, opts ...ClientOption) (*UpdateBillingAccountOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateBillingAccountParams() + } + op := &runtime.ClientOperation{ + ID: "UpdateBillingAccount", + Method: "PATCH", + PathPattern: "/v1/billing-accounts/{billingAccount.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &UpdateBillingAccountReader{formats: a.formats}, + 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.(*UpdateBillingAccountOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateBillingAccountDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/client/billing/create_billing_account_parameters.go b/internal/client/billing/create_billing_account_parameters.go new file mode 100644 index 0000000..fe1ef89 --- /dev/null +++ b/internal/client/billing/create_billing_account_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// NewCreateBillingAccountParams creates a new CreateBillingAccountParams 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 NewCreateBillingAccountParams() *CreateBillingAccountParams { + return &CreateBillingAccountParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateBillingAccountParamsWithTimeout creates a new CreateBillingAccountParams object +// with the ability to set a timeout on a request. +func NewCreateBillingAccountParamsWithTimeout(timeout time.Duration) *CreateBillingAccountParams { + return &CreateBillingAccountParams{ + timeout: timeout, + } +} + +// NewCreateBillingAccountParamsWithContext creates a new CreateBillingAccountParams object +// with the ability to set a context for a request. +func NewCreateBillingAccountParamsWithContext(ctx context.Context) *CreateBillingAccountParams { + return &CreateBillingAccountParams{ + Context: ctx, + } +} + +// NewCreateBillingAccountParamsWithHTTPClient creates a new CreateBillingAccountParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateBillingAccountParamsWithHTTPClient(client *http.Client) *CreateBillingAccountParams { + return &CreateBillingAccountParams{ + HTTPClient: client, + } +} + +/* +CreateBillingAccountParams contains all the parameters to send to the API endpoint + + for the create billing account operation. + + Typically these are written to a http.Request. +*/ +type CreateBillingAccountParams struct { + + // Body. + Body *models.CreateBillingAccountRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateBillingAccountParams) WithDefaults() *CreateBillingAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateBillingAccountParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create billing account params +func (o *CreateBillingAccountParams) WithTimeout(timeout time.Duration) *CreateBillingAccountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create billing account params +func (o *CreateBillingAccountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create billing account params +func (o *CreateBillingAccountParams) WithContext(ctx context.Context) *CreateBillingAccountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create billing account params +func (o *CreateBillingAccountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create billing account params +func (o *CreateBillingAccountParams) WithHTTPClient(client *http.Client) *CreateBillingAccountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create billing account params +func (o *CreateBillingAccountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create billing account params +func (o *CreateBillingAccountParams) WithBody(body *models.CreateBillingAccountRequest) *CreateBillingAccountParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create billing account params +func (o *CreateBillingAccountParams) SetBody(body *models.CreateBillingAccountRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateBillingAccountParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/create_billing_account_responses.go b/internal/client/billing/create_billing_account_responses.go new file mode 100644 index 0000000..388037d --- /dev/null +++ b/internal/client/billing/create_billing_account_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// CreateBillingAccountReader is a Reader for the CreateBillingAccount structure. +type CreateBillingAccountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateBillingAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateBillingAccountOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateBillingAccountDefault(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 + } +} + +// NewCreateBillingAccountOK creates a CreateBillingAccountOK with default headers values +func NewCreateBillingAccountOK() *CreateBillingAccountOK { + return &CreateBillingAccountOK{} +} + +/* +CreateBillingAccountOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type CreateBillingAccountOK struct { + Payload *models.BillingAccount +} + +// IsSuccess returns true when this create billing account o k response has a 2xx status code +func (o *CreateBillingAccountOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create billing account o k response has a 3xx status code +func (o *CreateBillingAccountOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create billing account o k response has a 4xx status code +func (o *CreateBillingAccountOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this create billing account o k response has a 5xx status code +func (o *CreateBillingAccountOK) IsServerError() bool { + return false +} + +// IsCode returns true when this create billing account o k response a status code equal to that given +func (o *CreateBillingAccountOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the create billing account o k response +func (o *CreateBillingAccountOK) Code() int { + return 200 +} + +func (o *CreateBillingAccountOK) Error() string { + return fmt.Sprintf("[POST /v1/billing-accounts][%d] createBillingAccountOK %+v", 200, o.Payload) +} + +func (o *CreateBillingAccountOK) String() string { + return fmt.Sprintf("[POST /v1/billing-accounts][%d] createBillingAccountOK %+v", 200, o.Payload) +} + +func (o *CreateBillingAccountOK) GetPayload() *models.BillingAccount { + return o.Payload +} + +func (o *CreateBillingAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.BillingAccount) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateBillingAccountDefault creates a CreateBillingAccountDefault with default headers values +func NewCreateBillingAccountDefault(code int) *CreateBillingAccountDefault { + return &CreateBillingAccountDefault{ + _statusCode: code, + } +} + +/* +CreateBillingAccountDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type CreateBillingAccountDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this create billing account default response has a 2xx status code +func (o *CreateBillingAccountDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create billing account default response has a 3xx status code +func (o *CreateBillingAccountDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create billing account default response has a 4xx status code +func (o *CreateBillingAccountDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create billing account default response has a 5xx status code +func (o *CreateBillingAccountDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create billing account default response a status code equal to that given +func (o *CreateBillingAccountDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the create billing account default response +func (o *CreateBillingAccountDefault) Code() int { + return o._statusCode +} + +func (o *CreateBillingAccountDefault) Error() string { + return fmt.Sprintf("[POST /v1/billing-accounts][%d] CreateBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *CreateBillingAccountDefault) String() string { + return fmt.Sprintf("[POST /v1/billing-accounts][%d] CreateBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *CreateBillingAccountDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *CreateBillingAccountDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/delete_billing_account_parameters.go b/internal/client/billing/delete_billing_account_parameters.go new file mode 100644 index 0000000..17da798 --- /dev/null +++ b/internal/client/billing/delete_billing_account_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewDeleteBillingAccountParams creates a new DeleteBillingAccountParams 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 NewDeleteBillingAccountParams() *DeleteBillingAccountParams { + return &DeleteBillingAccountParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteBillingAccountParamsWithTimeout creates a new DeleteBillingAccountParams object +// with the ability to set a timeout on a request. +func NewDeleteBillingAccountParamsWithTimeout(timeout time.Duration) *DeleteBillingAccountParams { + return &DeleteBillingAccountParams{ + timeout: timeout, + } +} + +// NewDeleteBillingAccountParamsWithContext creates a new DeleteBillingAccountParams object +// with the ability to set a context for a request. +func NewDeleteBillingAccountParamsWithContext(ctx context.Context) *DeleteBillingAccountParams { + return &DeleteBillingAccountParams{ + Context: ctx, + } +} + +// NewDeleteBillingAccountParamsWithHTTPClient creates a new DeleteBillingAccountParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteBillingAccountParamsWithHTTPClient(client *http.Client) *DeleteBillingAccountParams { + return &DeleteBillingAccountParams{ + HTTPClient: client, + } +} + +/* +DeleteBillingAccountParams contains all the parameters to send to the API endpoint + + for the delete billing account operation. + + Typically these are written to a http.Request. +*/ +type DeleteBillingAccountParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteBillingAccountParams) WithDefaults() *DeleteBillingAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteBillingAccountParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete billing account params +func (o *DeleteBillingAccountParams) WithTimeout(timeout time.Duration) *DeleteBillingAccountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete billing account params +func (o *DeleteBillingAccountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete billing account params +func (o *DeleteBillingAccountParams) WithContext(ctx context.Context) *DeleteBillingAccountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete billing account params +func (o *DeleteBillingAccountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete billing account params +func (o *DeleteBillingAccountParams) WithHTTPClient(client *http.Client) *DeleteBillingAccountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete billing account params +func (o *DeleteBillingAccountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete billing account params +func (o *DeleteBillingAccountParams) WithID(id string) *DeleteBillingAccountParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete billing account params +func (o *DeleteBillingAccountParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteBillingAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/delete_billing_account_responses.go b/internal/client/billing/delete_billing_account_responses.go new file mode 100644 index 0000000..0c40195 --- /dev/null +++ b/internal/client/billing/delete_billing_account_responses.go @@ -0,0 +1,180 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// DeleteBillingAccountReader is a Reader for the DeleteBillingAccount structure. +type DeleteBillingAccountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteBillingAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteBillingAccountOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeleteBillingAccountDefault(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 + } +} + +// NewDeleteBillingAccountOK creates a DeleteBillingAccountOK with default headers values +func NewDeleteBillingAccountOK() *DeleteBillingAccountOK { + return &DeleteBillingAccountOK{} +} + +/* +DeleteBillingAccountOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeleteBillingAccountOK struct { + Payload interface{} +} + +// IsSuccess returns true when this delete billing account o k response has a 2xx status code +func (o *DeleteBillingAccountOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete billing account o k response has a 3xx status code +func (o *DeleteBillingAccountOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete billing account o k response has a 4xx status code +func (o *DeleteBillingAccountOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete billing account o k response has a 5xx status code +func (o *DeleteBillingAccountOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete billing account o k response a status code equal to that given +func (o *DeleteBillingAccountOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete billing account o k response +func (o *DeleteBillingAccountOK) Code() int { + return 200 +} + +func (o *DeleteBillingAccountOK) Error() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}][%d] deleteBillingAccountOK %+v", 200, o.Payload) +} + +func (o *DeleteBillingAccountOK) String() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}][%d] deleteBillingAccountOK %+v", 200, o.Payload) +} + +func (o *DeleteBillingAccountOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeleteBillingAccountOK) 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 +} + +// NewDeleteBillingAccountDefault creates a DeleteBillingAccountDefault with default headers values +func NewDeleteBillingAccountDefault(code int) *DeleteBillingAccountDefault { + return &DeleteBillingAccountDefault{ + _statusCode: code, + } +} + +/* +DeleteBillingAccountDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeleteBillingAccountDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this delete billing account default response has a 2xx status code +func (o *DeleteBillingAccountDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete billing account default response has a 3xx status code +func (o *DeleteBillingAccountDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete billing account default response has a 4xx status code +func (o *DeleteBillingAccountDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete billing account default response has a 5xx status code +func (o *DeleteBillingAccountDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete billing account default response a status code equal to that given +func (o *DeleteBillingAccountDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete billing account default response +func (o *DeleteBillingAccountDefault) Code() int { + return o._statusCode +} + +func (o *DeleteBillingAccountDefault) Error() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}][%d] DeleteBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteBillingAccountDefault) String() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}][%d] DeleteBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteBillingAccountDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *DeleteBillingAccountDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/get_billing_account_details_parameters.go b/internal/client/billing/get_billing_account_details_parameters.go new file mode 100644 index 0000000..241520b --- /dev/null +++ b/internal/client/billing/get_billing_account_details_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewGetBillingAccountDetailsParams creates a new GetBillingAccountDetailsParams 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 NewGetBillingAccountDetailsParams() *GetBillingAccountDetailsParams { + return &GetBillingAccountDetailsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetBillingAccountDetailsParamsWithTimeout creates a new GetBillingAccountDetailsParams object +// with the ability to set a timeout on a request. +func NewGetBillingAccountDetailsParamsWithTimeout(timeout time.Duration) *GetBillingAccountDetailsParams { + return &GetBillingAccountDetailsParams{ + timeout: timeout, + } +} + +// NewGetBillingAccountDetailsParamsWithContext creates a new GetBillingAccountDetailsParams object +// with the ability to set a context for a request. +func NewGetBillingAccountDetailsParamsWithContext(ctx context.Context) *GetBillingAccountDetailsParams { + return &GetBillingAccountDetailsParams{ + Context: ctx, + } +} + +// NewGetBillingAccountDetailsParamsWithHTTPClient creates a new GetBillingAccountDetailsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetBillingAccountDetailsParamsWithHTTPClient(client *http.Client) *GetBillingAccountDetailsParams { + return &GetBillingAccountDetailsParams{ + HTTPClient: client, + } +} + +/* +GetBillingAccountDetailsParams contains all the parameters to send to the API endpoint + + for the get billing account details operation. + + Typically these are written to a http.Request. +*/ +type GetBillingAccountDetailsParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get billing account details params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountDetailsParams) WithDefaults() *GetBillingAccountDetailsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get billing account details params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountDetailsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get billing account details params +func (o *GetBillingAccountDetailsParams) WithTimeout(timeout time.Duration) *GetBillingAccountDetailsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get billing account details params +func (o *GetBillingAccountDetailsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get billing account details params +func (o *GetBillingAccountDetailsParams) WithContext(ctx context.Context) *GetBillingAccountDetailsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get billing account details params +func (o *GetBillingAccountDetailsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get billing account details params +func (o *GetBillingAccountDetailsParams) WithHTTPClient(client *http.Client) *GetBillingAccountDetailsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get billing account details params +func (o *GetBillingAccountDetailsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get billing account details params +func (o *GetBillingAccountDetailsParams) WithID(id string) *GetBillingAccountDetailsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get billing account details params +func (o *GetBillingAccountDetailsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetBillingAccountDetailsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/get_billing_account_details_responses.go b/internal/client/billing/get_billing_account_details_responses.go new file mode 100644 index 0000000..bf85d22 --- /dev/null +++ b/internal/client/billing/get_billing_account_details_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetBillingAccountDetailsReader is a Reader for the GetBillingAccountDetails structure. +type GetBillingAccountDetailsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetBillingAccountDetailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetBillingAccountDetailsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetBillingAccountDetailsDefault(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 + } +} + +// NewGetBillingAccountDetailsOK creates a GetBillingAccountDetailsOK with default headers values +func NewGetBillingAccountDetailsOK() *GetBillingAccountDetailsOK { + return &GetBillingAccountDetailsOK{} +} + +/* +GetBillingAccountDetailsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetBillingAccountDetailsOK struct { + Payload *models.GetBillingAccountDetailsResponse +} + +// IsSuccess returns true when this get billing account details o k response has a 2xx status code +func (o *GetBillingAccountDetailsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get billing account details o k response has a 3xx status code +func (o *GetBillingAccountDetailsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get billing account details o k response has a 4xx status code +func (o *GetBillingAccountDetailsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get billing account details o k response has a 5xx status code +func (o *GetBillingAccountDetailsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get billing account details o k response a status code equal to that given +func (o *GetBillingAccountDetailsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get billing account details o k response +func (o *GetBillingAccountDetailsOK) Code() int { + return 200 +} + +func (o *GetBillingAccountDetailsOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/details][%d] getBillingAccountDetailsOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountDetailsOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/details][%d] getBillingAccountDetailsOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountDetailsOK) GetPayload() *models.GetBillingAccountDetailsResponse { + return o.Payload +} + +func (o *GetBillingAccountDetailsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetBillingAccountDetailsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetBillingAccountDetailsDefault creates a GetBillingAccountDetailsDefault with default headers values +func NewGetBillingAccountDetailsDefault(code int) *GetBillingAccountDetailsDefault { + return &GetBillingAccountDetailsDefault{ + _statusCode: code, + } +} + +/* +GetBillingAccountDetailsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetBillingAccountDetailsDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get billing account details default response has a 2xx status code +func (o *GetBillingAccountDetailsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get billing account details default response has a 3xx status code +func (o *GetBillingAccountDetailsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get billing account details default response has a 4xx status code +func (o *GetBillingAccountDetailsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get billing account details default response has a 5xx status code +func (o *GetBillingAccountDetailsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get billing account details default response a status code equal to that given +func (o *GetBillingAccountDetailsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get billing account details default response +func (o *GetBillingAccountDetailsDefault) Code() int { + return o._statusCode +} + +func (o *GetBillingAccountDetailsDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/details][%d] GetBillingAccountDetails default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountDetailsDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/details][%d] GetBillingAccountDetails default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountDetailsDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetBillingAccountDetailsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/get_billing_account_parameters.go b/internal/client/billing/get_billing_account_parameters.go new file mode 100644 index 0000000..2799f56 --- /dev/null +++ b/internal/client/billing/get_billing_account_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewGetBillingAccountParams creates a new GetBillingAccountParams 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 NewGetBillingAccountParams() *GetBillingAccountParams { + return &GetBillingAccountParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetBillingAccountParamsWithTimeout creates a new GetBillingAccountParams object +// with the ability to set a timeout on a request. +func NewGetBillingAccountParamsWithTimeout(timeout time.Duration) *GetBillingAccountParams { + return &GetBillingAccountParams{ + timeout: timeout, + } +} + +// NewGetBillingAccountParamsWithContext creates a new GetBillingAccountParams object +// with the ability to set a context for a request. +func NewGetBillingAccountParamsWithContext(ctx context.Context) *GetBillingAccountParams { + return &GetBillingAccountParams{ + Context: ctx, + } +} + +// NewGetBillingAccountParamsWithHTTPClient creates a new GetBillingAccountParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetBillingAccountParamsWithHTTPClient(client *http.Client) *GetBillingAccountParams { + return &GetBillingAccountParams{ + HTTPClient: client, + } +} + +/* +GetBillingAccountParams contains all the parameters to send to the API endpoint + + for the get billing account operation. + + Typically these are written to a http.Request. +*/ +type GetBillingAccountParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountParams) WithDefaults() *GetBillingAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get billing account params +func (o *GetBillingAccountParams) WithTimeout(timeout time.Duration) *GetBillingAccountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get billing account params +func (o *GetBillingAccountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get billing account params +func (o *GetBillingAccountParams) WithContext(ctx context.Context) *GetBillingAccountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get billing account params +func (o *GetBillingAccountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get billing account params +func (o *GetBillingAccountParams) WithHTTPClient(client *http.Client) *GetBillingAccountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get billing account params +func (o *GetBillingAccountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get billing account params +func (o *GetBillingAccountParams) WithID(id string) *GetBillingAccountParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get billing account params +func (o *GetBillingAccountParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetBillingAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/get_billing_account_payment_methods_parameters.go b/internal/client/billing/get_billing_account_payment_methods_parameters.go new file mode 100644 index 0000000..bd02418 --- /dev/null +++ b/internal/client/billing/get_billing_account_payment_methods_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewGetBillingAccountPaymentMethodsParams creates a new GetBillingAccountPaymentMethodsParams 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 NewGetBillingAccountPaymentMethodsParams() *GetBillingAccountPaymentMethodsParams { + return &GetBillingAccountPaymentMethodsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetBillingAccountPaymentMethodsParamsWithTimeout creates a new GetBillingAccountPaymentMethodsParams object +// with the ability to set a timeout on a request. +func NewGetBillingAccountPaymentMethodsParamsWithTimeout(timeout time.Duration) *GetBillingAccountPaymentMethodsParams { + return &GetBillingAccountPaymentMethodsParams{ + timeout: timeout, + } +} + +// NewGetBillingAccountPaymentMethodsParamsWithContext creates a new GetBillingAccountPaymentMethodsParams object +// with the ability to set a context for a request. +func NewGetBillingAccountPaymentMethodsParamsWithContext(ctx context.Context) *GetBillingAccountPaymentMethodsParams { + return &GetBillingAccountPaymentMethodsParams{ + Context: ctx, + } +} + +// NewGetBillingAccountPaymentMethodsParamsWithHTTPClient creates a new GetBillingAccountPaymentMethodsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetBillingAccountPaymentMethodsParamsWithHTTPClient(client *http.Client) *GetBillingAccountPaymentMethodsParams { + return &GetBillingAccountPaymentMethodsParams{ + HTTPClient: client, + } +} + +/* +GetBillingAccountPaymentMethodsParams contains all the parameters to send to the API endpoint + + for the get billing account payment methods operation. + + Typically these are written to a http.Request. +*/ +type GetBillingAccountPaymentMethodsParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get billing account payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountPaymentMethodsParams) WithDefaults() *GetBillingAccountPaymentMethodsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get billing account payment methods params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountPaymentMethodsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) WithTimeout(timeout time.Duration) *GetBillingAccountPaymentMethodsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) WithContext(ctx context.Context) *GetBillingAccountPaymentMethodsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) WithHTTPClient(client *http.Client) *GetBillingAccountPaymentMethodsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) WithID(id string) *GetBillingAccountPaymentMethodsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get billing account payment methods params +func (o *GetBillingAccountPaymentMethodsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetBillingAccountPaymentMethodsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/get_billing_account_payment_methods_responses.go b/internal/client/billing/get_billing_account_payment_methods_responses.go new file mode 100644 index 0000000..057483e --- /dev/null +++ b/internal/client/billing/get_billing_account_payment_methods_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetBillingAccountPaymentMethodsReader is a Reader for the GetBillingAccountPaymentMethods structure. +type GetBillingAccountPaymentMethodsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetBillingAccountPaymentMethodsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetBillingAccountPaymentMethodsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetBillingAccountPaymentMethodsDefault(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 + } +} + +// NewGetBillingAccountPaymentMethodsOK creates a GetBillingAccountPaymentMethodsOK with default headers values +func NewGetBillingAccountPaymentMethodsOK() *GetBillingAccountPaymentMethodsOK { + return &GetBillingAccountPaymentMethodsOK{} +} + +/* +GetBillingAccountPaymentMethodsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetBillingAccountPaymentMethodsOK struct { + Payload *models.BillingAccountPaymentMethods +} + +// IsSuccess returns true when this get billing account payment methods o k response has a 2xx status code +func (o *GetBillingAccountPaymentMethodsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get billing account payment methods o k response has a 3xx status code +func (o *GetBillingAccountPaymentMethodsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get billing account payment methods o k response has a 4xx status code +func (o *GetBillingAccountPaymentMethodsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get billing account payment methods o k response has a 5xx status code +func (o *GetBillingAccountPaymentMethodsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get billing account payment methods o k response a status code equal to that given +func (o *GetBillingAccountPaymentMethodsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get billing account payment methods o k response +func (o *GetBillingAccountPaymentMethodsOK) Code() int { + return 200 +} + +func (o *GetBillingAccountPaymentMethodsOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/payment-methods][%d] getBillingAccountPaymentMethodsOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountPaymentMethodsOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/payment-methods][%d] getBillingAccountPaymentMethodsOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountPaymentMethodsOK) GetPayload() *models.BillingAccountPaymentMethods { + return o.Payload +} + +func (o *GetBillingAccountPaymentMethodsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.BillingAccountPaymentMethods) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetBillingAccountPaymentMethodsDefault creates a GetBillingAccountPaymentMethodsDefault with default headers values +func NewGetBillingAccountPaymentMethodsDefault(code int) *GetBillingAccountPaymentMethodsDefault { + return &GetBillingAccountPaymentMethodsDefault{ + _statusCode: code, + } +} + +/* +GetBillingAccountPaymentMethodsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetBillingAccountPaymentMethodsDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get billing account payment methods default response has a 2xx status code +func (o *GetBillingAccountPaymentMethodsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get billing account payment methods default response has a 3xx status code +func (o *GetBillingAccountPaymentMethodsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get billing account payment methods default response has a 4xx status code +func (o *GetBillingAccountPaymentMethodsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get billing account payment methods default response has a 5xx status code +func (o *GetBillingAccountPaymentMethodsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get billing account payment methods default response a status code equal to that given +func (o *GetBillingAccountPaymentMethodsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get billing account payment methods default response +func (o *GetBillingAccountPaymentMethodsDefault) Code() int { + return o._statusCode +} + +func (o *GetBillingAccountPaymentMethodsDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/payment-methods][%d] GetBillingAccountPaymentMethods default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountPaymentMethodsDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/payment-methods][%d] GetBillingAccountPaymentMethods default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountPaymentMethodsDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetBillingAccountPaymentMethodsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/get_billing_account_responses.go b/internal/client/billing/get_billing_account_responses.go new file mode 100644 index 0000000..e71e9f2 --- /dev/null +++ b/internal/client/billing/get_billing_account_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetBillingAccountReader is a Reader for the GetBillingAccount structure. +type GetBillingAccountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetBillingAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetBillingAccountOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetBillingAccountDefault(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 + } +} + +// NewGetBillingAccountOK creates a GetBillingAccountOK with default headers values +func NewGetBillingAccountOK() *GetBillingAccountOK { + return &GetBillingAccountOK{} +} + +/* +GetBillingAccountOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetBillingAccountOK struct { + Payload *models.BillingAccount +} + +// IsSuccess returns true when this get billing account o k response has a 2xx status code +func (o *GetBillingAccountOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get billing account o k response has a 3xx status code +func (o *GetBillingAccountOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get billing account o k response has a 4xx status code +func (o *GetBillingAccountOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get billing account o k response has a 5xx status code +func (o *GetBillingAccountOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get billing account o k response a status code equal to that given +func (o *GetBillingAccountOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get billing account o k response +func (o *GetBillingAccountOK) Code() int { + return 200 +} + +func (o *GetBillingAccountOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}][%d] getBillingAccountOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}][%d] getBillingAccountOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountOK) GetPayload() *models.BillingAccount { + return o.Payload +} + +func (o *GetBillingAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.BillingAccount) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetBillingAccountDefault creates a GetBillingAccountDefault with default headers values +func NewGetBillingAccountDefault(code int) *GetBillingAccountDefault { + return &GetBillingAccountDefault{ + _statusCode: code, + } +} + +/* +GetBillingAccountDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetBillingAccountDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get billing account default response has a 2xx status code +func (o *GetBillingAccountDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get billing account default response has a 3xx status code +func (o *GetBillingAccountDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get billing account default response has a 4xx status code +func (o *GetBillingAccountDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get billing account default response has a 5xx status code +func (o *GetBillingAccountDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get billing account default response a status code equal to that given +func (o *GetBillingAccountDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get billing account default response +func (o *GetBillingAccountDefault) Code() int { + return o._statusCode +} + +func (o *GetBillingAccountDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}][%d] GetBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}][%d] GetBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetBillingAccountDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/get_billing_account_setup_intent_parameters.go b/internal/client/billing/get_billing_account_setup_intent_parameters.go new file mode 100644 index 0000000..d598e59 --- /dev/null +++ b/internal/client/billing/get_billing_account_setup_intent_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewGetBillingAccountSetupIntentParams creates a new GetBillingAccountSetupIntentParams 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 NewGetBillingAccountSetupIntentParams() *GetBillingAccountSetupIntentParams { + return &GetBillingAccountSetupIntentParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetBillingAccountSetupIntentParamsWithTimeout creates a new GetBillingAccountSetupIntentParams object +// with the ability to set a timeout on a request. +func NewGetBillingAccountSetupIntentParamsWithTimeout(timeout time.Duration) *GetBillingAccountSetupIntentParams { + return &GetBillingAccountSetupIntentParams{ + timeout: timeout, + } +} + +// NewGetBillingAccountSetupIntentParamsWithContext creates a new GetBillingAccountSetupIntentParams object +// with the ability to set a context for a request. +func NewGetBillingAccountSetupIntentParamsWithContext(ctx context.Context) *GetBillingAccountSetupIntentParams { + return &GetBillingAccountSetupIntentParams{ + Context: ctx, + } +} + +// NewGetBillingAccountSetupIntentParamsWithHTTPClient creates a new GetBillingAccountSetupIntentParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetBillingAccountSetupIntentParamsWithHTTPClient(client *http.Client) *GetBillingAccountSetupIntentParams { + return &GetBillingAccountSetupIntentParams{ + HTTPClient: client, + } +} + +/* +GetBillingAccountSetupIntentParams contains all the parameters to send to the API endpoint + + for the get billing account setup intent operation. + + Typically these are written to a http.Request. +*/ +type GetBillingAccountSetupIntentParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get billing account setup intent params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountSetupIntentParams) WithDefaults() *GetBillingAccountSetupIntentParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get billing account setup intent params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountSetupIntentParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) WithTimeout(timeout time.Duration) *GetBillingAccountSetupIntentParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) WithContext(ctx context.Context) *GetBillingAccountSetupIntentParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) WithHTTPClient(client *http.Client) *GetBillingAccountSetupIntentParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) WithID(id string) *GetBillingAccountSetupIntentParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get billing account setup intent params +func (o *GetBillingAccountSetupIntentParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetBillingAccountSetupIntentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/get_billing_account_setup_intent_responses.go b/internal/client/billing/get_billing_account_setup_intent_responses.go new file mode 100644 index 0000000..7aa7bd1 --- /dev/null +++ b/internal/client/billing/get_billing_account_setup_intent_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetBillingAccountSetupIntentReader is a Reader for the GetBillingAccountSetupIntent structure. +type GetBillingAccountSetupIntentReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetBillingAccountSetupIntentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetBillingAccountSetupIntentOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetBillingAccountSetupIntentDefault(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 + } +} + +// NewGetBillingAccountSetupIntentOK creates a GetBillingAccountSetupIntentOK with default headers values +func NewGetBillingAccountSetupIntentOK() *GetBillingAccountSetupIntentOK { + return &GetBillingAccountSetupIntentOK{} +} + +/* +GetBillingAccountSetupIntentOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetBillingAccountSetupIntentOK struct { + Payload *models.BillingAccountSetupIntent +} + +// IsSuccess returns true when this get billing account setup intent o k response has a 2xx status code +func (o *GetBillingAccountSetupIntentOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get billing account setup intent o k response has a 3xx status code +func (o *GetBillingAccountSetupIntentOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get billing account setup intent o k response has a 4xx status code +func (o *GetBillingAccountSetupIntentOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get billing account setup intent o k response has a 5xx status code +func (o *GetBillingAccountSetupIntentOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get billing account setup intent o k response a status code equal to that given +func (o *GetBillingAccountSetupIntentOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get billing account setup intent o k response +func (o *GetBillingAccountSetupIntentOK) Code() int { + return 200 +} + +func (o *GetBillingAccountSetupIntentOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/setup-intent][%d] getBillingAccountSetupIntentOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountSetupIntentOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/setup-intent][%d] getBillingAccountSetupIntentOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountSetupIntentOK) GetPayload() *models.BillingAccountSetupIntent { + return o.Payload +} + +func (o *GetBillingAccountSetupIntentOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.BillingAccountSetupIntent) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetBillingAccountSetupIntentDefault creates a GetBillingAccountSetupIntentDefault with default headers values +func NewGetBillingAccountSetupIntentDefault(code int) *GetBillingAccountSetupIntentDefault { + return &GetBillingAccountSetupIntentDefault{ + _statusCode: code, + } +} + +/* +GetBillingAccountSetupIntentDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetBillingAccountSetupIntentDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get billing account setup intent default response has a 2xx status code +func (o *GetBillingAccountSetupIntentDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get billing account setup intent default response has a 3xx status code +func (o *GetBillingAccountSetupIntentDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get billing account setup intent default response has a 4xx status code +func (o *GetBillingAccountSetupIntentDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get billing account setup intent default response has a 5xx status code +func (o *GetBillingAccountSetupIntentDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get billing account setup intent default response a status code equal to that given +func (o *GetBillingAccountSetupIntentDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get billing account setup intent default response +func (o *GetBillingAccountSetupIntentDefault) Code() int { + return o._statusCode +} + +func (o *GetBillingAccountSetupIntentDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/setup-intent][%d] GetBillingAccountSetupIntent default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountSetupIntentDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{id}/setup-intent][%d] GetBillingAccountSetupIntent default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountSetupIntentDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetBillingAccountSetupIntentDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/get_billing_account_spend_details_parameters.go b/internal/client/billing/get_billing_account_spend_details_parameters.go new file mode 100644 index 0000000..5ef4674 --- /dev/null +++ b/internal/client/billing/get_billing_account_spend_details_parameters.go @@ -0,0 +1,200 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewGetBillingAccountSpendDetailsParams creates a new GetBillingAccountSpendDetailsParams 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 NewGetBillingAccountSpendDetailsParams() *GetBillingAccountSpendDetailsParams { + return &GetBillingAccountSpendDetailsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetBillingAccountSpendDetailsParamsWithTimeout creates a new GetBillingAccountSpendDetailsParams object +// with the ability to set a timeout on a request. +func NewGetBillingAccountSpendDetailsParamsWithTimeout(timeout time.Duration) *GetBillingAccountSpendDetailsParams { + return &GetBillingAccountSpendDetailsParams{ + timeout: timeout, + } +} + +// NewGetBillingAccountSpendDetailsParamsWithContext creates a new GetBillingAccountSpendDetailsParams object +// with the ability to set a context for a request. +func NewGetBillingAccountSpendDetailsParamsWithContext(ctx context.Context) *GetBillingAccountSpendDetailsParams { + return &GetBillingAccountSpendDetailsParams{ + Context: ctx, + } +} + +// NewGetBillingAccountSpendDetailsParamsWithHTTPClient creates a new GetBillingAccountSpendDetailsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetBillingAccountSpendDetailsParamsWithHTTPClient(client *http.Client) *GetBillingAccountSpendDetailsParams { + return &GetBillingAccountSpendDetailsParams{ + HTTPClient: client, + } +} + +/* +GetBillingAccountSpendDetailsParams contains all the parameters to send to the API endpoint + + for the get billing account spend details operation. + + Typically these are written to a http.Request. +*/ +type GetBillingAccountSpendDetailsParams struct { + + // BillingAccountID. + BillingAccountID string + + // EndTime. + // + // Format: date-time + EndTime strfmt.DateTime + + // StartTime. + // + // Format: date-time + StartTime strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get billing account spend details params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountSpendDetailsParams) WithDefaults() *GetBillingAccountSpendDetailsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get billing account spend details params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountSpendDetailsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) WithTimeout(timeout time.Duration) *GetBillingAccountSpendDetailsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) WithContext(ctx context.Context) *GetBillingAccountSpendDetailsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) WithHTTPClient(client *http.Client) *GetBillingAccountSpendDetailsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBillingAccountID adds the billingAccountID to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) WithBillingAccountID(billingAccountID string) *GetBillingAccountSpendDetailsParams { + o.SetBillingAccountID(billingAccountID) + return o +} + +// SetBillingAccountID adds the billingAccountId to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) SetBillingAccountID(billingAccountID string) { + o.BillingAccountID = billingAccountID +} + +// WithEndTime adds the endTime to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) WithEndTime(endTime strfmt.DateTime) *GetBillingAccountSpendDetailsParams { + o.SetEndTime(endTime) + return o +} + +// SetEndTime adds the endTime to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) SetEndTime(endTime strfmt.DateTime) { + o.EndTime = endTime +} + +// WithStartTime adds the startTime to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) WithStartTime(startTime strfmt.DateTime) *GetBillingAccountSpendDetailsParams { + o.SetStartTime(startTime) + return o +} + +// SetStartTime adds the startTime to the get billing account spend details params +func (o *GetBillingAccountSpendDetailsParams) SetStartTime(startTime strfmt.DateTime) { + o.StartTime = startTime +} + +// WriteToRequest writes these params to a swagger request +func (o *GetBillingAccountSpendDetailsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param billingAccountId + if err := r.SetPathParam("billingAccountId", o.BillingAccountID); err != nil { + return err + } + + // query param endTime + qrEndTime := o.EndTime + qEndTime := qrEndTime.String() + if qEndTime != "" { + + if err := r.SetQueryParam("endTime", qEndTime); err != nil { + return err + } + } + + // query param startTime + qrStartTime := o.StartTime + qStartTime := qrStartTime.String() + if qStartTime != "" { + + if err := r.SetQueryParam("startTime", qStartTime); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/get_billing_account_spend_details_responses.go b/internal/client/billing/get_billing_account_spend_details_responses.go new file mode 100644 index 0000000..b7c8c4e --- /dev/null +++ b/internal/client/billing/get_billing_account_spend_details_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetBillingAccountSpendDetailsReader is a Reader for the GetBillingAccountSpendDetails structure. +type GetBillingAccountSpendDetailsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetBillingAccountSpendDetailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetBillingAccountSpendDetailsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetBillingAccountSpendDetailsDefault(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 + } +} + +// NewGetBillingAccountSpendDetailsOK creates a GetBillingAccountSpendDetailsOK with default headers values +func NewGetBillingAccountSpendDetailsOK() *GetBillingAccountSpendDetailsOK { + return &GetBillingAccountSpendDetailsOK{} +} + +/* +GetBillingAccountSpendDetailsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetBillingAccountSpendDetailsOK struct { + Payload *models.GetBillingAccountSpendDetailsResponse +} + +// IsSuccess returns true when this get billing account spend details o k response has a 2xx status code +func (o *GetBillingAccountSpendDetailsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get billing account spend details o k response has a 3xx status code +func (o *GetBillingAccountSpendDetailsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get billing account spend details o k response has a 4xx status code +func (o *GetBillingAccountSpendDetailsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get billing account spend details o k response has a 5xx status code +func (o *GetBillingAccountSpendDetailsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get billing account spend details o k response a status code equal to that given +func (o *GetBillingAccountSpendDetailsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get billing account spend details o k response +func (o *GetBillingAccountSpendDetailsOK) Code() int { + return 200 +} + +func (o *GetBillingAccountSpendDetailsOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{billingAccountId}/spend/details][%d] getBillingAccountSpendDetailsOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountSpendDetailsOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{billingAccountId}/spend/details][%d] getBillingAccountSpendDetailsOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountSpendDetailsOK) GetPayload() *models.GetBillingAccountSpendDetailsResponse { + return o.Payload +} + +func (o *GetBillingAccountSpendDetailsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetBillingAccountSpendDetailsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetBillingAccountSpendDetailsDefault creates a GetBillingAccountSpendDetailsDefault with default headers values +func NewGetBillingAccountSpendDetailsDefault(code int) *GetBillingAccountSpendDetailsDefault { + return &GetBillingAccountSpendDetailsDefault{ + _statusCode: code, + } +} + +/* +GetBillingAccountSpendDetailsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetBillingAccountSpendDetailsDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get billing account spend details default response has a 2xx status code +func (o *GetBillingAccountSpendDetailsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get billing account spend details default response has a 3xx status code +func (o *GetBillingAccountSpendDetailsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get billing account spend details default response has a 4xx status code +func (o *GetBillingAccountSpendDetailsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get billing account spend details default response has a 5xx status code +func (o *GetBillingAccountSpendDetailsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get billing account spend details default response a status code equal to that given +func (o *GetBillingAccountSpendDetailsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get billing account spend details default response +func (o *GetBillingAccountSpendDetailsDefault) Code() int { + return o._statusCode +} + +func (o *GetBillingAccountSpendDetailsDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{billingAccountId}/spend/details][%d] GetBillingAccountSpendDetails default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountSpendDetailsDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/{billingAccountId}/spend/details][%d] GetBillingAccountSpendDetails default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountSpendDetailsDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetBillingAccountSpendDetailsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/get_billing_account_stripe_invoices_parameters.go b/internal/client/billing/get_billing_account_stripe_invoices_parameters.go new file mode 100644 index 0000000..a6cab1d --- /dev/null +++ b/internal/client/billing/get_billing_account_stripe_invoices_parameters.go @@ -0,0 +1,249 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewGetBillingAccountStripeInvoicesParams creates a new GetBillingAccountStripeInvoicesParams 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 NewGetBillingAccountStripeInvoicesParams() *GetBillingAccountStripeInvoicesParams { + return &GetBillingAccountStripeInvoicesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetBillingAccountStripeInvoicesParamsWithTimeout creates a new GetBillingAccountStripeInvoicesParams object +// with the ability to set a timeout on a request. +func NewGetBillingAccountStripeInvoicesParamsWithTimeout(timeout time.Duration) *GetBillingAccountStripeInvoicesParams { + return &GetBillingAccountStripeInvoicesParams{ + timeout: timeout, + } +} + +// NewGetBillingAccountStripeInvoicesParamsWithContext creates a new GetBillingAccountStripeInvoicesParams object +// with the ability to set a context for a request. +func NewGetBillingAccountStripeInvoicesParamsWithContext(ctx context.Context) *GetBillingAccountStripeInvoicesParams { + return &GetBillingAccountStripeInvoicesParams{ + Context: ctx, + } +} + +// NewGetBillingAccountStripeInvoicesParamsWithHTTPClient creates a new GetBillingAccountStripeInvoicesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetBillingAccountStripeInvoicesParamsWithHTTPClient(client *http.Client) *GetBillingAccountStripeInvoicesParams { + return &GetBillingAccountStripeInvoicesParams{ + HTTPClient: client, + } +} + +/* +GetBillingAccountStripeInvoicesParams contains all the parameters to send to the API endpoint + + for the get billing account stripe invoices operation. + + Typically these are written to a http.Request. +*/ +type GetBillingAccountStripeInvoicesParams struct { + + // ID. + ID string + + // PageSize. + // + // Format: int32 + PageSize *int32 + + // StartingAfter. + StartingAfter *string + + // Status. + Status *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get billing account stripe invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountStripeInvoicesParams) WithDefaults() *GetBillingAccountStripeInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get billing account stripe invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetBillingAccountStripeInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) WithTimeout(timeout time.Duration) *GetBillingAccountStripeInvoicesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) WithContext(ctx context.Context) *GetBillingAccountStripeInvoicesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) WithHTTPClient(client *http.Client) *GetBillingAccountStripeInvoicesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) WithID(id string) *GetBillingAccountStripeInvoicesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) SetID(id string) { + o.ID = id +} + +// WithPageSize adds the pageSize to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) WithPageSize(pageSize *int32) *GetBillingAccountStripeInvoicesParams { + o.SetPageSize(pageSize) + return o +} + +// SetPageSize adds the pageSize to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) SetPageSize(pageSize *int32) { + o.PageSize = pageSize +} + +// WithStartingAfter adds the startingAfter to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) WithStartingAfter(startingAfter *string) *GetBillingAccountStripeInvoicesParams { + o.SetStartingAfter(startingAfter) + return o +} + +// SetStartingAfter adds the startingAfter to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) SetStartingAfter(startingAfter *string) { + o.StartingAfter = startingAfter +} + +// WithStatus adds the status to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) WithStatus(status *string) *GetBillingAccountStripeInvoicesParams { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the get billing account stripe invoices params +func (o *GetBillingAccountStripeInvoicesParams) SetStatus(status *string) { + o.Status = status +} + +// WriteToRequest writes these params to a swagger request +func (o *GetBillingAccountStripeInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param id + qrID := o.ID + qID := qrID + if qID != "" { + + if err := r.SetQueryParam("id", qID); err != nil { + return err + } + } + + if o.PageSize != nil { + + // query param pageSize + var qrPageSize int32 + + if o.PageSize != nil { + qrPageSize = *o.PageSize + } + qPageSize := swag.FormatInt32(qrPageSize) + if qPageSize != "" { + + if err := r.SetQueryParam("pageSize", qPageSize); err != nil { + return err + } + } + } + + if o.StartingAfter != nil { + + // query param startingAfter + var qrStartingAfter string + + if o.StartingAfter != nil { + qrStartingAfter = *o.StartingAfter + } + qStartingAfter := qrStartingAfter + if qStartingAfter != "" { + + if err := r.SetQueryParam("startingAfter", qStartingAfter); err != nil { + return err + } + } + } + + if o.Status != nil { + + // query param status + var qrStatus string + + if o.Status != nil { + qrStatus = *o.Status + } + qStatus := qrStatus + if qStatus != "" { + + if err := r.SetQueryParam("status", qStatus); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/get_billing_account_stripe_invoices_responses.go b/internal/client/billing/get_billing_account_stripe_invoices_responses.go new file mode 100644 index 0000000..c88957f --- /dev/null +++ b/internal/client/billing/get_billing_account_stripe_invoices_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetBillingAccountStripeInvoicesReader is a Reader for the GetBillingAccountStripeInvoices structure. +type GetBillingAccountStripeInvoicesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetBillingAccountStripeInvoicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetBillingAccountStripeInvoicesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetBillingAccountStripeInvoicesDefault(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 + } +} + +// NewGetBillingAccountStripeInvoicesOK creates a GetBillingAccountStripeInvoicesOK with default headers values +func NewGetBillingAccountStripeInvoicesOK() *GetBillingAccountStripeInvoicesOK { + return &GetBillingAccountStripeInvoicesOK{} +} + +/* +GetBillingAccountStripeInvoicesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetBillingAccountStripeInvoicesOK struct { + Payload *models.GetBillingAccountStripeInvoicesResponse +} + +// IsSuccess returns true when this get billing account stripe invoices o k response has a 2xx status code +func (o *GetBillingAccountStripeInvoicesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get billing account stripe invoices o k response has a 3xx status code +func (o *GetBillingAccountStripeInvoicesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get billing account stripe invoices o k response has a 4xx status code +func (o *GetBillingAccountStripeInvoicesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get billing account stripe invoices o k response has a 5xx status code +func (o *GetBillingAccountStripeInvoicesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get billing account stripe invoices o k response a status code equal to that given +func (o *GetBillingAccountStripeInvoicesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get billing account stripe invoices o k response +func (o *GetBillingAccountStripeInvoicesOK) Code() int { + return 200 +} + +func (o *GetBillingAccountStripeInvoicesOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices][%d] getBillingAccountStripeInvoicesOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountStripeInvoicesOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices][%d] getBillingAccountStripeInvoicesOK %+v", 200, o.Payload) +} + +func (o *GetBillingAccountStripeInvoicesOK) GetPayload() *models.GetBillingAccountStripeInvoicesResponse { + return o.Payload +} + +func (o *GetBillingAccountStripeInvoicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetBillingAccountStripeInvoicesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetBillingAccountStripeInvoicesDefault creates a GetBillingAccountStripeInvoicesDefault with default headers values +func NewGetBillingAccountStripeInvoicesDefault(code int) *GetBillingAccountStripeInvoicesDefault { + return &GetBillingAccountStripeInvoicesDefault{ + _statusCode: code, + } +} + +/* +GetBillingAccountStripeInvoicesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetBillingAccountStripeInvoicesDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get billing account stripe invoices default response has a 2xx status code +func (o *GetBillingAccountStripeInvoicesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get billing account stripe invoices default response has a 3xx status code +func (o *GetBillingAccountStripeInvoicesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get billing account stripe invoices default response has a 4xx status code +func (o *GetBillingAccountStripeInvoicesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get billing account stripe invoices default response has a 5xx status code +func (o *GetBillingAccountStripeInvoicesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get billing account stripe invoices default response a status code equal to that given +func (o *GetBillingAccountStripeInvoicesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get billing account stripe invoices default response +func (o *GetBillingAccountStripeInvoicesDefault) Code() int { + return o._statusCode +} + +func (o *GetBillingAccountStripeInvoicesDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices][%d] GetBillingAccountStripeInvoices default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountStripeInvoicesDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices][%d] GetBillingAccountStripeInvoices default %+v", o._statusCode, o.Payload) +} + +func (o *GetBillingAccountStripeInvoicesDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetBillingAccountStripeInvoicesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/list_billing_accounts_parameters.go b/internal/client/billing/list_billing_accounts_parameters.go new file mode 100644 index 0000000..06808f6 --- /dev/null +++ b/internal/client/billing/list_billing_accounts_parameters.go @@ -0,0 +1,194 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewListBillingAccountsParams creates a new ListBillingAccountsParams 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 NewListBillingAccountsParams() *ListBillingAccountsParams { + return &ListBillingAccountsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListBillingAccountsParamsWithTimeout creates a new ListBillingAccountsParams object +// with the ability to set a timeout on a request. +func NewListBillingAccountsParamsWithTimeout(timeout time.Duration) *ListBillingAccountsParams { + return &ListBillingAccountsParams{ + timeout: timeout, + } +} + +// NewListBillingAccountsParamsWithContext creates a new ListBillingAccountsParams object +// with the ability to set a context for a request. +func NewListBillingAccountsParamsWithContext(ctx context.Context) *ListBillingAccountsParams { + return &ListBillingAccountsParams{ + Context: ctx, + } +} + +// NewListBillingAccountsParamsWithHTTPClient creates a new ListBillingAccountsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListBillingAccountsParamsWithHTTPClient(client *http.Client) *ListBillingAccountsParams { + return &ListBillingAccountsParams{ + HTTPClient: client, + } +} + +/* +ListBillingAccountsParams contains all the parameters to send to the API endpoint + + for the list billing accounts operation. + + Typically these are written to a http.Request. +*/ +type ListBillingAccountsParams struct { + + // PageSize. + // + // Format: int32 + PageSize *int32 + + // PageToken. + PageToken *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list billing accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListBillingAccountsParams) WithDefaults() *ListBillingAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list billing accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListBillingAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list billing accounts params +func (o *ListBillingAccountsParams) WithTimeout(timeout time.Duration) *ListBillingAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list billing accounts params +func (o *ListBillingAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list billing accounts params +func (o *ListBillingAccountsParams) WithContext(ctx context.Context) *ListBillingAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list billing accounts params +func (o *ListBillingAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list billing accounts params +func (o *ListBillingAccountsParams) WithHTTPClient(client *http.Client) *ListBillingAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list billing accounts params +func (o *ListBillingAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPageSize adds the pageSize to the list billing accounts params +func (o *ListBillingAccountsParams) WithPageSize(pageSize *int32) *ListBillingAccountsParams { + o.SetPageSize(pageSize) + return o +} + +// SetPageSize adds the pageSize to the list billing accounts params +func (o *ListBillingAccountsParams) SetPageSize(pageSize *int32) { + o.PageSize = pageSize +} + +// WithPageToken adds the pageToken to the list billing accounts params +func (o *ListBillingAccountsParams) WithPageToken(pageToken *string) *ListBillingAccountsParams { + o.SetPageToken(pageToken) + return o +} + +// SetPageToken adds the pageToken to the list billing accounts params +func (o *ListBillingAccountsParams) SetPageToken(pageToken *string) { + o.PageToken = pageToken +} + +// WriteToRequest writes these params to a swagger request +func (o *ListBillingAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.PageSize != nil { + + // query param pageSize + var qrPageSize int32 + + if o.PageSize != nil { + qrPageSize = *o.PageSize + } + qPageSize := swag.FormatInt32(qrPageSize) + if qPageSize != "" { + + if err := r.SetQueryParam("pageSize", qPageSize); err != nil { + return err + } + } + } + + if o.PageToken != nil { + + // query param pageToken + var qrPageToken string + + if o.PageToken != nil { + qrPageToken = *o.PageToken + } + qPageToken := qrPageToken + if qPageToken != "" { + + if err := r.SetQueryParam("pageToken", qPageToken); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/list_billing_accounts_responses.go b/internal/client/billing/list_billing_accounts_responses.go new file mode 100644 index 0000000..965e626 --- /dev/null +++ b/internal/client/billing/list_billing_accounts_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// ListBillingAccountsReader is a Reader for the ListBillingAccounts structure. +type ListBillingAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListBillingAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListBillingAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListBillingAccountsDefault(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 + } +} + +// NewListBillingAccountsOK creates a ListBillingAccountsOK with default headers values +func NewListBillingAccountsOK() *ListBillingAccountsOK { + return &ListBillingAccountsOK{} +} + +/* +ListBillingAccountsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListBillingAccountsOK struct { + Payload *models.ListBillingAccountsResponse +} + +// IsSuccess returns true when this list billing accounts o k response has a 2xx status code +func (o *ListBillingAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list billing accounts o k response has a 3xx status code +func (o *ListBillingAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list billing accounts o k response has a 4xx status code +func (o *ListBillingAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list billing accounts o k response has a 5xx status code +func (o *ListBillingAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list billing accounts o k response a status code equal to that given +func (o *ListBillingAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list billing accounts o k response +func (o *ListBillingAccountsOK) Code() int { + return 200 +} + +func (o *ListBillingAccountsOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts][%d] listBillingAccountsOK %+v", 200, o.Payload) +} + +func (o *ListBillingAccountsOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts][%d] listBillingAccountsOK %+v", 200, o.Payload) +} + +func (o *ListBillingAccountsOK) GetPayload() *models.ListBillingAccountsResponse { + return o.Payload +} + +func (o *ListBillingAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ListBillingAccountsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListBillingAccountsDefault creates a ListBillingAccountsDefault with default headers values +func NewListBillingAccountsDefault(code int) *ListBillingAccountsDefault { + return &ListBillingAccountsDefault{ + _statusCode: code, + } +} + +/* +ListBillingAccountsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListBillingAccountsDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this list billing accounts default response has a 2xx status code +func (o *ListBillingAccountsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list billing accounts default response has a 3xx status code +func (o *ListBillingAccountsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list billing accounts default response has a 4xx status code +func (o *ListBillingAccountsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list billing accounts default response has a 5xx status code +func (o *ListBillingAccountsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list billing accounts default response a status code equal to that given +func (o *ListBillingAccountsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list billing accounts default response +func (o *ListBillingAccountsDefault) Code() int { + return o._statusCode +} + +func (o *ListBillingAccountsDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts][%d] ListBillingAccounts default %+v", o._statusCode, o.Payload) +} + +func (o *ListBillingAccountsDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts][%d] ListBillingAccounts default %+v", o._statusCode, o.Payload) +} + +func (o *ListBillingAccountsDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *ListBillingAccountsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/list_outstanding_stripe_invoices_parameters.go b/internal/client/billing/list_outstanding_stripe_invoices_parameters.go new file mode 100644 index 0000000..20fa843 --- /dev/null +++ b/internal/client/billing/list_outstanding_stripe_invoices_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewListOutstandingStripeInvoicesParams creates a new ListOutstandingStripeInvoicesParams 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 NewListOutstandingStripeInvoicesParams() *ListOutstandingStripeInvoicesParams { + return &ListOutstandingStripeInvoicesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListOutstandingStripeInvoicesParamsWithTimeout creates a new ListOutstandingStripeInvoicesParams object +// with the ability to set a timeout on a request. +func NewListOutstandingStripeInvoicesParamsWithTimeout(timeout time.Duration) *ListOutstandingStripeInvoicesParams { + return &ListOutstandingStripeInvoicesParams{ + timeout: timeout, + } +} + +// NewListOutstandingStripeInvoicesParamsWithContext creates a new ListOutstandingStripeInvoicesParams object +// with the ability to set a context for a request. +func NewListOutstandingStripeInvoicesParamsWithContext(ctx context.Context) *ListOutstandingStripeInvoicesParams { + return &ListOutstandingStripeInvoicesParams{ + Context: ctx, + } +} + +// NewListOutstandingStripeInvoicesParamsWithHTTPClient creates a new ListOutstandingStripeInvoicesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListOutstandingStripeInvoicesParamsWithHTTPClient(client *http.Client) *ListOutstandingStripeInvoicesParams { + return &ListOutstandingStripeInvoicesParams{ + HTTPClient: client, + } +} + +/* +ListOutstandingStripeInvoicesParams contains all the parameters to send to the API endpoint + + for the list outstanding stripe invoices operation. + + Typically these are written to a http.Request. +*/ +type ListOutstandingStripeInvoicesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list outstanding stripe invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListOutstandingStripeInvoicesParams) WithDefaults() *ListOutstandingStripeInvoicesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list outstanding stripe invoices params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListOutstandingStripeInvoicesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list outstanding stripe invoices params +func (o *ListOutstandingStripeInvoicesParams) WithTimeout(timeout time.Duration) *ListOutstandingStripeInvoicesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list outstanding stripe invoices params +func (o *ListOutstandingStripeInvoicesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list outstanding stripe invoices params +func (o *ListOutstandingStripeInvoicesParams) WithContext(ctx context.Context) *ListOutstandingStripeInvoicesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list outstanding stripe invoices params +func (o *ListOutstandingStripeInvoicesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list outstanding stripe invoices params +func (o *ListOutstandingStripeInvoicesParams) WithHTTPClient(client *http.Client) *ListOutstandingStripeInvoicesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list outstanding stripe invoices params +func (o *ListOutstandingStripeInvoicesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListOutstandingStripeInvoicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/list_outstanding_stripe_invoices_responses.go b/internal/client/billing/list_outstanding_stripe_invoices_responses.go new file mode 100644 index 0000000..ff588ce --- /dev/null +++ b/internal/client/billing/list_outstanding_stripe_invoices_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// ListOutstandingStripeInvoicesReader is a Reader for the ListOutstandingStripeInvoices structure. +type ListOutstandingStripeInvoicesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListOutstandingStripeInvoicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListOutstandingStripeInvoicesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListOutstandingStripeInvoicesDefault(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 + } +} + +// NewListOutstandingStripeInvoicesOK creates a ListOutstandingStripeInvoicesOK with default headers values +func NewListOutstandingStripeInvoicesOK() *ListOutstandingStripeInvoicesOK { + return &ListOutstandingStripeInvoicesOK{} +} + +/* +ListOutstandingStripeInvoicesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListOutstandingStripeInvoicesOK struct { + Payload *models.ListOutstandingStripeInvoicesResponse +} + +// IsSuccess returns true when this list outstanding stripe invoices o k response has a 2xx status code +func (o *ListOutstandingStripeInvoicesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list outstanding stripe invoices o k response has a 3xx status code +func (o *ListOutstandingStripeInvoicesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list outstanding stripe invoices o k response has a 4xx status code +func (o *ListOutstandingStripeInvoicesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list outstanding stripe invoices o k response has a 5xx status code +func (o *ListOutstandingStripeInvoicesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list outstanding stripe invoices o k response a status code equal to that given +func (o *ListOutstandingStripeInvoicesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list outstanding stripe invoices o k response +func (o *ListOutstandingStripeInvoicesOK) Code() int { + return 200 +} + +func (o *ListOutstandingStripeInvoicesOK) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices/outstanding][%d] listOutstandingStripeInvoicesOK %+v", 200, o.Payload) +} + +func (o *ListOutstandingStripeInvoicesOK) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices/outstanding][%d] listOutstandingStripeInvoicesOK %+v", 200, o.Payload) +} + +func (o *ListOutstandingStripeInvoicesOK) GetPayload() *models.ListOutstandingStripeInvoicesResponse { + return o.Payload +} + +func (o *ListOutstandingStripeInvoicesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ListOutstandingStripeInvoicesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListOutstandingStripeInvoicesDefault creates a ListOutstandingStripeInvoicesDefault with default headers values +func NewListOutstandingStripeInvoicesDefault(code int) *ListOutstandingStripeInvoicesDefault { + return &ListOutstandingStripeInvoicesDefault{ + _statusCode: code, + } +} + +/* +ListOutstandingStripeInvoicesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListOutstandingStripeInvoicesDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this list outstanding stripe invoices default response has a 2xx status code +func (o *ListOutstandingStripeInvoicesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list outstanding stripe invoices default response has a 3xx status code +func (o *ListOutstandingStripeInvoicesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list outstanding stripe invoices default response has a 4xx status code +func (o *ListOutstandingStripeInvoicesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list outstanding stripe invoices default response has a 5xx status code +func (o *ListOutstandingStripeInvoicesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list outstanding stripe invoices default response a status code equal to that given +func (o *ListOutstandingStripeInvoicesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list outstanding stripe invoices default response +func (o *ListOutstandingStripeInvoicesDefault) Code() int { + return o._statusCode +} + +func (o *ListOutstandingStripeInvoicesDefault) Error() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices/outstanding][%d] ListOutstandingStripeInvoices default %+v", o._statusCode, o.Payload) +} + +func (o *ListOutstandingStripeInvoicesDefault) String() string { + return fmt.Sprintf("[GET /v1/billing-accounts/invoices/outstanding][%d] ListOutstandingStripeInvoices default %+v", o._statusCode, o.Payload) +} + +func (o *ListOutstandingStripeInvoicesDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *ListOutstandingStripeInvoicesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/remove_billing_account_payment_method_parameters.go b/internal/client/billing/remove_billing_account_payment_method_parameters.go new file mode 100644 index 0000000..cfc9205 --- /dev/null +++ b/internal/client/billing/remove_billing_account_payment_method_parameters.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewRemoveBillingAccountPaymentMethodParams creates a new RemoveBillingAccountPaymentMethodParams 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 NewRemoveBillingAccountPaymentMethodParams() *RemoveBillingAccountPaymentMethodParams { + return &RemoveBillingAccountPaymentMethodParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRemoveBillingAccountPaymentMethodParamsWithTimeout creates a new RemoveBillingAccountPaymentMethodParams object +// with the ability to set a timeout on a request. +func NewRemoveBillingAccountPaymentMethodParamsWithTimeout(timeout time.Duration) *RemoveBillingAccountPaymentMethodParams { + return &RemoveBillingAccountPaymentMethodParams{ + timeout: timeout, + } +} + +// NewRemoveBillingAccountPaymentMethodParamsWithContext creates a new RemoveBillingAccountPaymentMethodParams object +// with the ability to set a context for a request. +func NewRemoveBillingAccountPaymentMethodParamsWithContext(ctx context.Context) *RemoveBillingAccountPaymentMethodParams { + return &RemoveBillingAccountPaymentMethodParams{ + Context: ctx, + } +} + +// NewRemoveBillingAccountPaymentMethodParamsWithHTTPClient creates a new RemoveBillingAccountPaymentMethodParams object +// with the ability to set a custom HTTPClient for a request. +func NewRemoveBillingAccountPaymentMethodParamsWithHTTPClient(client *http.Client) *RemoveBillingAccountPaymentMethodParams { + return &RemoveBillingAccountPaymentMethodParams{ + HTTPClient: client, + } +} + +/* +RemoveBillingAccountPaymentMethodParams contains all the parameters to send to the API endpoint + + for the remove billing account payment method operation. + + Typically these are written to a http.Request. +*/ +type RemoveBillingAccountPaymentMethodParams struct { + + // ID. + ID string + + // PaymentMethodID. + PaymentMethodID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the remove billing account payment method params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RemoveBillingAccountPaymentMethodParams) WithDefaults() *RemoveBillingAccountPaymentMethodParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the remove billing account payment method params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RemoveBillingAccountPaymentMethodParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) WithTimeout(timeout time.Duration) *RemoveBillingAccountPaymentMethodParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) WithContext(ctx context.Context) *RemoveBillingAccountPaymentMethodParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) WithHTTPClient(client *http.Client) *RemoveBillingAccountPaymentMethodParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) WithID(id string) *RemoveBillingAccountPaymentMethodParams { + o.SetID(id) + return o +} + +// SetID adds the id to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) SetID(id string) { + o.ID = id +} + +// WithPaymentMethodID adds the paymentMethodID to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) WithPaymentMethodID(paymentMethodID string) *RemoveBillingAccountPaymentMethodParams { + o.SetPaymentMethodID(paymentMethodID) + return o +} + +// SetPaymentMethodID adds the paymentMethodId to the remove billing account payment method params +func (o *RemoveBillingAccountPaymentMethodParams) SetPaymentMethodID(paymentMethodID string) { + o.PaymentMethodID = paymentMethodID +} + +// WriteToRequest writes these params to a swagger request +func (o *RemoveBillingAccountPaymentMethodParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param paymentMethodId + if err := r.SetPathParam("paymentMethodId", o.PaymentMethodID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/remove_billing_account_payment_method_responses.go b/internal/client/billing/remove_billing_account_payment_method_responses.go new file mode 100644 index 0000000..512d36b --- /dev/null +++ b/internal/client/billing/remove_billing_account_payment_method_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// RemoveBillingAccountPaymentMethodReader is a Reader for the RemoveBillingAccountPaymentMethod structure. +type RemoveBillingAccountPaymentMethodReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RemoveBillingAccountPaymentMethodReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRemoveBillingAccountPaymentMethodOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewRemoveBillingAccountPaymentMethodDefault(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 + } +} + +// NewRemoveBillingAccountPaymentMethodOK creates a RemoveBillingAccountPaymentMethodOK with default headers values +func NewRemoveBillingAccountPaymentMethodOK() *RemoveBillingAccountPaymentMethodOK { + return &RemoveBillingAccountPaymentMethodOK{} +} + +/* +RemoveBillingAccountPaymentMethodOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type RemoveBillingAccountPaymentMethodOK struct { + Payload *models.RemoveBillingAccountPaymentMethodResponse +} + +// IsSuccess returns true when this remove billing account payment method o k response has a 2xx status code +func (o *RemoveBillingAccountPaymentMethodOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this remove billing account payment method o k response has a 3xx status code +func (o *RemoveBillingAccountPaymentMethodOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove billing account payment method o k response has a 4xx status code +func (o *RemoveBillingAccountPaymentMethodOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this remove billing account payment method o k response has a 5xx status code +func (o *RemoveBillingAccountPaymentMethodOK) IsServerError() bool { + return false +} + +// IsCode returns true when this remove billing account payment method o k response a status code equal to that given +func (o *RemoveBillingAccountPaymentMethodOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the remove billing account payment method o k response +func (o *RemoveBillingAccountPaymentMethodOK) Code() int { + return 200 +} + +func (o *RemoveBillingAccountPaymentMethodOK) Error() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}][%d] removeBillingAccountPaymentMethodOK %+v", 200, o.Payload) +} + +func (o *RemoveBillingAccountPaymentMethodOK) String() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}][%d] removeBillingAccountPaymentMethodOK %+v", 200, o.Payload) +} + +func (o *RemoveBillingAccountPaymentMethodOK) GetPayload() *models.RemoveBillingAccountPaymentMethodResponse { + return o.Payload +} + +func (o *RemoveBillingAccountPaymentMethodOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.RemoveBillingAccountPaymentMethodResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRemoveBillingAccountPaymentMethodDefault creates a RemoveBillingAccountPaymentMethodDefault with default headers values +func NewRemoveBillingAccountPaymentMethodDefault(code int) *RemoveBillingAccountPaymentMethodDefault { + return &RemoveBillingAccountPaymentMethodDefault{ + _statusCode: code, + } +} + +/* +RemoveBillingAccountPaymentMethodDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type RemoveBillingAccountPaymentMethodDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this remove billing account payment method default response has a 2xx status code +func (o *RemoveBillingAccountPaymentMethodDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this remove billing account payment method default response has a 3xx status code +func (o *RemoveBillingAccountPaymentMethodDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this remove billing account payment method default response has a 4xx status code +func (o *RemoveBillingAccountPaymentMethodDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this remove billing account payment method default response has a 5xx status code +func (o *RemoveBillingAccountPaymentMethodDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this remove billing account payment method default response a status code equal to that given +func (o *RemoveBillingAccountPaymentMethodDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the remove billing account payment method default response +func (o *RemoveBillingAccountPaymentMethodDefault) Code() int { + return o._statusCode +} + +func (o *RemoveBillingAccountPaymentMethodDefault) Error() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}][%d] RemoveBillingAccountPaymentMethod default %+v", o._statusCode, o.Payload) +} + +func (o *RemoveBillingAccountPaymentMethodDefault) String() string { + return fmt.Sprintf("[DELETE /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}][%d] RemoveBillingAccountPaymentMethod default %+v", o._statusCode, o.Payload) +} + +func (o *RemoveBillingAccountPaymentMethodDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *RemoveBillingAccountPaymentMethodDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/set_billing_account_default_payment_method_parameters.go b/internal/client/billing/set_billing_account_default_payment_method_parameters.go new file mode 100644 index 0000000..43b8e48 --- /dev/null +++ b/internal/client/billing/set_billing_account_default_payment_method_parameters.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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" +) + +// NewSetBillingAccountDefaultPaymentMethodParams creates a new SetBillingAccountDefaultPaymentMethodParams 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 NewSetBillingAccountDefaultPaymentMethodParams() *SetBillingAccountDefaultPaymentMethodParams { + return &SetBillingAccountDefaultPaymentMethodParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewSetBillingAccountDefaultPaymentMethodParamsWithTimeout creates a new SetBillingAccountDefaultPaymentMethodParams object +// with the ability to set a timeout on a request. +func NewSetBillingAccountDefaultPaymentMethodParamsWithTimeout(timeout time.Duration) *SetBillingAccountDefaultPaymentMethodParams { + return &SetBillingAccountDefaultPaymentMethodParams{ + timeout: timeout, + } +} + +// NewSetBillingAccountDefaultPaymentMethodParamsWithContext creates a new SetBillingAccountDefaultPaymentMethodParams object +// with the ability to set a context for a request. +func NewSetBillingAccountDefaultPaymentMethodParamsWithContext(ctx context.Context) *SetBillingAccountDefaultPaymentMethodParams { + return &SetBillingAccountDefaultPaymentMethodParams{ + Context: ctx, + } +} + +// NewSetBillingAccountDefaultPaymentMethodParamsWithHTTPClient creates a new SetBillingAccountDefaultPaymentMethodParams object +// with the ability to set a custom HTTPClient for a request. +func NewSetBillingAccountDefaultPaymentMethodParamsWithHTTPClient(client *http.Client) *SetBillingAccountDefaultPaymentMethodParams { + return &SetBillingAccountDefaultPaymentMethodParams{ + HTTPClient: client, + } +} + +/* +SetBillingAccountDefaultPaymentMethodParams contains all the parameters to send to the API endpoint + + for the set billing account default payment method operation. + + Typically these are written to a http.Request. +*/ +type SetBillingAccountDefaultPaymentMethodParams struct { + + // ID. + ID string + + // PaymentMethodID. + PaymentMethodID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the set billing account default payment method params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SetBillingAccountDefaultPaymentMethodParams) WithDefaults() *SetBillingAccountDefaultPaymentMethodParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the set billing account default payment method params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SetBillingAccountDefaultPaymentMethodParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) WithTimeout(timeout time.Duration) *SetBillingAccountDefaultPaymentMethodParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) WithContext(ctx context.Context) *SetBillingAccountDefaultPaymentMethodParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) WithHTTPClient(client *http.Client) *SetBillingAccountDefaultPaymentMethodParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) WithID(id string) *SetBillingAccountDefaultPaymentMethodParams { + o.SetID(id) + return o +} + +// SetID adds the id to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) SetID(id string) { + o.ID = id +} + +// WithPaymentMethodID adds the paymentMethodID to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) WithPaymentMethodID(paymentMethodID string) *SetBillingAccountDefaultPaymentMethodParams { + o.SetPaymentMethodID(paymentMethodID) + return o +} + +// SetPaymentMethodID adds the paymentMethodId to the set billing account default payment method params +func (o *SetBillingAccountDefaultPaymentMethodParams) SetPaymentMethodID(paymentMethodID string) { + o.PaymentMethodID = paymentMethodID +} + +// WriteToRequest writes these params to a swagger request +func (o *SetBillingAccountDefaultPaymentMethodParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param paymentMethodId + if err := r.SetPathParam("paymentMethodId", o.PaymentMethodID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/set_billing_account_default_payment_method_responses.go b/internal/client/billing/set_billing_account_default_payment_method_responses.go new file mode 100644 index 0000000..eb79c17 --- /dev/null +++ b/internal/client/billing/set_billing_account_default_payment_method_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// SetBillingAccountDefaultPaymentMethodReader is a Reader for the SetBillingAccountDefaultPaymentMethod structure. +type SetBillingAccountDefaultPaymentMethodReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *SetBillingAccountDefaultPaymentMethodReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewSetBillingAccountDefaultPaymentMethodOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewSetBillingAccountDefaultPaymentMethodDefault(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 + } +} + +// NewSetBillingAccountDefaultPaymentMethodOK creates a SetBillingAccountDefaultPaymentMethodOK with default headers values +func NewSetBillingAccountDefaultPaymentMethodOK() *SetBillingAccountDefaultPaymentMethodOK { + return &SetBillingAccountDefaultPaymentMethodOK{} +} + +/* +SetBillingAccountDefaultPaymentMethodOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type SetBillingAccountDefaultPaymentMethodOK struct { + Payload *models.SetBillingAccountDefaultPaymentMethodResponse +} + +// IsSuccess returns true when this set billing account default payment method o k response has a 2xx status code +func (o *SetBillingAccountDefaultPaymentMethodOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this set billing account default payment method o k response has a 3xx status code +func (o *SetBillingAccountDefaultPaymentMethodOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this set billing account default payment method o k response has a 4xx status code +func (o *SetBillingAccountDefaultPaymentMethodOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this set billing account default payment method o k response has a 5xx status code +func (o *SetBillingAccountDefaultPaymentMethodOK) IsServerError() bool { + return false +} + +// IsCode returns true when this set billing account default payment method o k response a status code equal to that given +func (o *SetBillingAccountDefaultPaymentMethodOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the set billing account default payment method o k response +func (o *SetBillingAccountDefaultPaymentMethodOK) Code() int { + return 200 +} + +func (o *SetBillingAccountDefaultPaymentMethodOK) Error() string { + return fmt.Sprintf("[POST /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}/set-default][%d] setBillingAccountDefaultPaymentMethodOK %+v", 200, o.Payload) +} + +func (o *SetBillingAccountDefaultPaymentMethodOK) String() string { + return fmt.Sprintf("[POST /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}/set-default][%d] setBillingAccountDefaultPaymentMethodOK %+v", 200, o.Payload) +} + +func (o *SetBillingAccountDefaultPaymentMethodOK) GetPayload() *models.SetBillingAccountDefaultPaymentMethodResponse { + return o.Payload +} + +func (o *SetBillingAccountDefaultPaymentMethodOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SetBillingAccountDefaultPaymentMethodResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewSetBillingAccountDefaultPaymentMethodDefault creates a SetBillingAccountDefaultPaymentMethodDefault with default headers values +func NewSetBillingAccountDefaultPaymentMethodDefault(code int) *SetBillingAccountDefaultPaymentMethodDefault { + return &SetBillingAccountDefaultPaymentMethodDefault{ + _statusCode: code, + } +} + +/* +SetBillingAccountDefaultPaymentMethodDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type SetBillingAccountDefaultPaymentMethodDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this set billing account default payment method default response has a 2xx status code +func (o *SetBillingAccountDefaultPaymentMethodDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this set billing account default payment method default response has a 3xx status code +func (o *SetBillingAccountDefaultPaymentMethodDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this set billing account default payment method default response has a 4xx status code +func (o *SetBillingAccountDefaultPaymentMethodDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this set billing account default payment method default response has a 5xx status code +func (o *SetBillingAccountDefaultPaymentMethodDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this set billing account default payment method default response a status code equal to that given +func (o *SetBillingAccountDefaultPaymentMethodDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the set billing account default payment method default response +func (o *SetBillingAccountDefaultPaymentMethodDefault) Code() int { + return o._statusCode +} + +func (o *SetBillingAccountDefaultPaymentMethodDefault) Error() string { + return fmt.Sprintf("[POST /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}/set-default][%d] SetBillingAccountDefaultPaymentMethod default %+v", o._statusCode, o.Payload) +} + +func (o *SetBillingAccountDefaultPaymentMethodDefault) String() string { + return fmt.Sprintf("[POST /v1/billing-accounts/{id}/payment-methods/{paymentMethodId}/set-default][%d] SetBillingAccountDefaultPaymentMethod default %+v", o._statusCode, o.Payload) +} + +func (o *SetBillingAccountDefaultPaymentMethodDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *SetBillingAccountDefaultPaymentMethodDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/billing/update_billing_account_parameters.go b/internal/client/billing/update_billing_account_parameters.go new file mode 100644 index 0000000..14eede5 --- /dev/null +++ b/internal/client/billing/update_billing_account_parameters.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// NewUpdateBillingAccountParams creates a new UpdateBillingAccountParams 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 NewUpdateBillingAccountParams() *UpdateBillingAccountParams { + return &UpdateBillingAccountParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateBillingAccountParamsWithTimeout creates a new UpdateBillingAccountParams object +// with the ability to set a timeout on a request. +func NewUpdateBillingAccountParamsWithTimeout(timeout time.Duration) *UpdateBillingAccountParams { + return &UpdateBillingAccountParams{ + timeout: timeout, + } +} + +// NewUpdateBillingAccountParamsWithContext creates a new UpdateBillingAccountParams object +// with the ability to set a context for a request. +func NewUpdateBillingAccountParamsWithContext(ctx context.Context) *UpdateBillingAccountParams { + return &UpdateBillingAccountParams{ + Context: ctx, + } +} + +// NewUpdateBillingAccountParamsWithHTTPClient creates a new UpdateBillingAccountParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateBillingAccountParamsWithHTTPClient(client *http.Client) *UpdateBillingAccountParams { + return &UpdateBillingAccountParams{ + HTTPClient: client, + } +} + +/* +UpdateBillingAccountParams contains all the parameters to send to the API endpoint + + for the update billing account operation. + + Typically these are written to a http.Request. +*/ +type UpdateBillingAccountParams struct { + + // BillingAccountID. + BillingAccountID string + + // Body. + Body *models.UpdateBillingAccountBody + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateBillingAccountParams) WithDefaults() *UpdateBillingAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update billing account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateBillingAccountParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update billing account params +func (o *UpdateBillingAccountParams) WithTimeout(timeout time.Duration) *UpdateBillingAccountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update billing account params +func (o *UpdateBillingAccountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update billing account params +func (o *UpdateBillingAccountParams) WithContext(ctx context.Context) *UpdateBillingAccountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update billing account params +func (o *UpdateBillingAccountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update billing account params +func (o *UpdateBillingAccountParams) WithHTTPClient(client *http.Client) *UpdateBillingAccountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update billing account params +func (o *UpdateBillingAccountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBillingAccountID adds the billingAccountID to the update billing account params +func (o *UpdateBillingAccountParams) WithBillingAccountID(billingAccountID string) *UpdateBillingAccountParams { + o.SetBillingAccountID(billingAccountID) + return o +} + +// SetBillingAccountID adds the billingAccountId to the update billing account params +func (o *UpdateBillingAccountParams) SetBillingAccountID(billingAccountID string) { + o.BillingAccountID = billingAccountID +} + +// WithBody adds the body to the update billing account params +func (o *UpdateBillingAccountParams) WithBody(body *models.UpdateBillingAccountBody) *UpdateBillingAccountParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update billing account params +func (o *UpdateBillingAccountParams) SetBody(body *models.UpdateBillingAccountBody) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateBillingAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param billingAccount.id + if err := r.SetPathParam("billingAccount.id", o.BillingAccountID); err != nil { + return err + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/billing/update_billing_account_responses.go b/internal/client/billing/update_billing_account_responses.go new file mode 100644 index 0000000..2daaf5e --- /dev/null +++ b/internal/client/billing/update_billing_account_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package billing + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// UpdateBillingAccountReader is a Reader for the UpdateBillingAccount structure. +type UpdateBillingAccountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateBillingAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateBillingAccountOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateBillingAccountDefault(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 + } +} + +// NewUpdateBillingAccountOK creates a UpdateBillingAccountOK with default headers values +func NewUpdateBillingAccountOK() *UpdateBillingAccountOK { + return &UpdateBillingAccountOK{} +} + +/* +UpdateBillingAccountOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UpdateBillingAccountOK struct { + Payload *models.BillingAccount +} + +// IsSuccess returns true when this update billing account o k response has a 2xx status code +func (o *UpdateBillingAccountOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update billing account o k response has a 3xx status code +func (o *UpdateBillingAccountOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update billing account o k response has a 4xx status code +func (o *UpdateBillingAccountOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update billing account o k response has a 5xx status code +func (o *UpdateBillingAccountOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update billing account o k response a status code equal to that given +func (o *UpdateBillingAccountOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update billing account o k response +func (o *UpdateBillingAccountOK) Code() int { + return 200 +} + +func (o *UpdateBillingAccountOK) Error() string { + return fmt.Sprintf("[PATCH /v1/billing-accounts/{billingAccount.id}][%d] updateBillingAccountOK %+v", 200, o.Payload) +} + +func (o *UpdateBillingAccountOK) String() string { + return fmt.Sprintf("[PATCH /v1/billing-accounts/{billingAccount.id}][%d] updateBillingAccountOK %+v", 200, o.Payload) +} + +func (o *UpdateBillingAccountOK) GetPayload() *models.BillingAccount { + return o.Payload +} + +func (o *UpdateBillingAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.BillingAccount) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateBillingAccountDefault creates a UpdateBillingAccountDefault with default headers values +func NewUpdateBillingAccountDefault(code int) *UpdateBillingAccountDefault { + return &UpdateBillingAccountDefault{ + _statusCode: code, + } +} + +/* +UpdateBillingAccountDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UpdateBillingAccountDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this update billing account default response has a 2xx status code +func (o *UpdateBillingAccountDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update billing account default response has a 3xx status code +func (o *UpdateBillingAccountDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update billing account default response has a 4xx status code +func (o *UpdateBillingAccountDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update billing account default response has a 5xx status code +func (o *UpdateBillingAccountDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update billing account default response a status code equal to that given +func (o *UpdateBillingAccountDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update billing account default response +func (o *UpdateBillingAccountDefault) Code() int { + return o._statusCode +} + +func (o *UpdateBillingAccountDefault) Error() string { + return fmt.Sprintf("[PATCH /v1/billing-accounts/{billingAccount.id}][%d] UpdateBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateBillingAccountDefault) String() string { + return fmt.Sprintf("[PATCH /v1/billing-accounts/{billingAccount.id}][%d] UpdateBillingAccount default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateBillingAccountDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *UpdateBillingAccountDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/cudo_compute_service_client.go b/internal/client/cudo_compute_service_client.go index 5bfe6cf..6e2ae67 100644 --- a/internal/client/cudo_compute_service_client.go +++ b/internal/client/cudo_compute_service_client.go @@ -11,7 +11,10 @@ import ( "github.com/go-openapi/strfmt" "github.com/CudoVentures/terraform-provider-cudo/internal/client/api_keys" + "github.com/CudoVentures/terraform-provider-cudo/internal/client/billing" + "github.com/CudoVentures/terraform-provider-cudo/internal/client/data_centers" "github.com/CudoVentures/terraform-provider-cudo/internal/client/disks" + "github.com/CudoVentures/terraform-provider-cudo/internal/client/machine_types" "github.com/CudoVentures/terraform-provider-cudo/internal/client/networks" "github.com/CudoVentures/terraform-provider-cudo/internal/client/object_storage" "github.com/CudoVentures/terraform-provider-cudo/internal/client/permissions" @@ -65,7 +68,10 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *CudoComput cli := new(CudoComputeService) cli.Transport = transport cli.APIKeys = api_keys.New(transport, formats) + cli.Billing = billing.New(transport, formats) + cli.DataCenters = data_centers.New(transport, formats) cli.Disks = disks.New(transport, formats) + cli.MachineTypes = machine_types.New(transport, formats) cli.Networks = networks.New(transport, formats) cli.ObjectStorage = object_storage.New(transport, formats) cli.Permissions = permissions.New(transport, formats) @@ -120,8 +126,14 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { type CudoComputeService struct { APIKeys api_keys.ClientService + Billing billing.ClientService + + DataCenters data_centers.ClientService + Disks disks.ClientService + MachineTypes machine_types.ClientService + Networks networks.ClientService ObjectStorage object_storage.ClientService @@ -145,7 +157,10 @@ type CudoComputeService struct { func (c *CudoComputeService) SetTransport(transport runtime.ClientTransport) { c.Transport = transport c.APIKeys.SetTransport(transport) + c.Billing.SetTransport(transport) + c.DataCenters.SetTransport(transport) c.Disks.SetTransport(transport) + c.MachineTypes.SetTransport(transport) c.Networks.SetTransport(transport) c.ObjectStorage.SetTransport(transport) c.Permissions.SetTransport(transport) diff --git a/internal/client/data_centers/count_hosts_parameters.go b/internal/client/data_centers/count_hosts_parameters.go new file mode 100644 index 0000000..1174800 --- /dev/null +++ b/internal/client/data_centers/count_hosts_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewCountHostsParams creates a new CountHostsParams 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 NewCountHostsParams() *CountHostsParams { + return &CountHostsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCountHostsParamsWithTimeout creates a new CountHostsParams object +// with the ability to set a timeout on a request. +func NewCountHostsParamsWithTimeout(timeout time.Duration) *CountHostsParams { + return &CountHostsParams{ + timeout: timeout, + } +} + +// NewCountHostsParamsWithContext creates a new CountHostsParams object +// with the ability to set a context for a request. +func NewCountHostsParamsWithContext(ctx context.Context) *CountHostsParams { + return &CountHostsParams{ + Context: ctx, + } +} + +// NewCountHostsParamsWithHTTPClient creates a new CountHostsParams object +// with the ability to set a custom HTTPClient for a request. +func NewCountHostsParamsWithHTTPClient(client *http.Client) *CountHostsParams { + return &CountHostsParams{ + HTTPClient: client, + } +} + +/* +CountHostsParams contains all the parameters to send to the API endpoint + + for the count hosts operation. + + Typically these are written to a http.Request. +*/ +type CountHostsParams struct { + + // DataCenterID. + DataCenterID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the count hosts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CountHostsParams) WithDefaults() *CountHostsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the count hosts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CountHostsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the count hosts params +func (o *CountHostsParams) WithTimeout(timeout time.Duration) *CountHostsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the count hosts params +func (o *CountHostsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the count hosts params +func (o *CountHostsParams) WithContext(ctx context.Context) *CountHostsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the count hosts params +func (o *CountHostsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the count hosts params +func (o *CountHostsParams) WithHTTPClient(client *http.Client) *CountHostsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the count hosts params +func (o *CountHostsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenterID adds the dataCenterID to the count hosts params +func (o *CountHostsParams) WithDataCenterID(dataCenterID string) *CountHostsParams { + o.SetDataCenterID(dataCenterID) + return o +} + +// SetDataCenterID adds the dataCenterId to the count hosts params +func (o *CountHostsParams) SetDataCenterID(dataCenterID string) { + o.DataCenterID = dataCenterID +} + +// WriteToRequest writes these params to a swagger request +func (o *CountHostsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param dataCenterId + if err := r.SetPathParam("dataCenterId", o.DataCenterID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/count_hosts_responses.go b/internal/client/data_centers/count_hosts_responses.go new file mode 100644 index 0000000..ae31fcf --- /dev/null +++ b/internal/client/data_centers/count_hosts_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// CountHostsReader is a Reader for the CountHosts structure. +type CountHostsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CountHostsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCountHostsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCountHostsDefault(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 + } +} + +// NewCountHostsOK creates a CountHostsOK with default headers values +func NewCountHostsOK() *CountHostsOK { + return &CountHostsOK{} +} + +/* +CountHostsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type CountHostsOK struct { + Payload *models.CountHostsResponse +} + +// IsSuccess returns true when this count hosts o k response has a 2xx status code +func (o *CountHostsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this count hosts o k response has a 3xx status code +func (o *CountHostsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this count hosts o k response has a 4xx status code +func (o *CountHostsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this count hosts o k response has a 5xx status code +func (o *CountHostsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this count hosts o k response a status code equal to that given +func (o *CountHostsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the count hosts o k response +func (o *CountHostsOK) Code() int { + return 200 +} + +func (o *CountHostsOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/host-count][%d] countHostsOK %+v", 200, o.Payload) +} + +func (o *CountHostsOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/host-count][%d] countHostsOK %+v", 200, o.Payload) +} + +func (o *CountHostsOK) GetPayload() *models.CountHostsResponse { + return o.Payload +} + +func (o *CountHostsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CountHostsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCountHostsDefault creates a CountHostsDefault with default headers values +func NewCountHostsDefault(code int) *CountHostsDefault { + return &CountHostsDefault{ + _statusCode: code, + } +} + +/* +CountHostsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type CountHostsDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this count hosts default response has a 2xx status code +func (o *CountHostsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this count hosts default response has a 3xx status code +func (o *CountHostsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this count hosts default response has a 4xx status code +func (o *CountHostsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this count hosts default response has a 5xx status code +func (o *CountHostsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this count hosts default response a status code equal to that given +func (o *CountHostsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the count hosts default response +func (o *CountHostsDefault) Code() int { + return o._statusCode +} + +func (o *CountHostsDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/host-count][%d] CountHosts default %+v", o._statusCode, o.Payload) +} + +func (o *CountHostsDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/host-count][%d] CountHosts default %+v", o._statusCode, o.Payload) +} + +func (o *CountHostsDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *CountHostsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/create_data_center_parameters.go b/internal/client/data_centers/create_data_center_parameters.go new file mode 100644 index 0000000..0adb7f4 --- /dev/null +++ b/internal/client/data_centers/create_data_center_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// NewCreateDataCenterParams creates a new CreateDataCenterParams 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 NewCreateDataCenterParams() *CreateDataCenterParams { + return &CreateDataCenterParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateDataCenterParamsWithTimeout creates a new CreateDataCenterParams object +// with the ability to set a timeout on a request. +func NewCreateDataCenterParamsWithTimeout(timeout time.Duration) *CreateDataCenterParams { + return &CreateDataCenterParams{ + timeout: timeout, + } +} + +// NewCreateDataCenterParamsWithContext creates a new CreateDataCenterParams object +// with the ability to set a context for a request. +func NewCreateDataCenterParamsWithContext(ctx context.Context) *CreateDataCenterParams { + return &CreateDataCenterParams{ + Context: ctx, + } +} + +// NewCreateDataCenterParamsWithHTTPClient creates a new CreateDataCenterParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateDataCenterParamsWithHTTPClient(client *http.Client) *CreateDataCenterParams { + return &CreateDataCenterParams{ + HTTPClient: client, + } +} + +/* +CreateDataCenterParams contains all the parameters to send to the API endpoint + + for the create data center operation. + + Typically these are written to a http.Request. +*/ +type CreateDataCenterParams struct { + + // DataCenter. + DataCenter *models.V1DataCenter + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateDataCenterParams) WithDefaults() *CreateDataCenterParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateDataCenterParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create data center params +func (o *CreateDataCenterParams) WithTimeout(timeout time.Duration) *CreateDataCenterParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create data center params +func (o *CreateDataCenterParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create data center params +func (o *CreateDataCenterParams) WithContext(ctx context.Context) *CreateDataCenterParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create data center params +func (o *CreateDataCenterParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create data center params +func (o *CreateDataCenterParams) WithHTTPClient(client *http.Client) *CreateDataCenterParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create data center params +func (o *CreateDataCenterParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenter adds the dataCenter to the create data center params +func (o *CreateDataCenterParams) WithDataCenter(dataCenter *models.V1DataCenter) *CreateDataCenterParams { + o.SetDataCenter(dataCenter) + return o +} + +// SetDataCenter adds the dataCenter to the create data center params +func (o *CreateDataCenterParams) SetDataCenter(dataCenter *models.V1DataCenter) { + o.DataCenter = dataCenter +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateDataCenterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.DataCenter != nil { + if err := r.SetBodyParam(o.DataCenter); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/create_data_center_responses.go b/internal/client/data_centers/create_data_center_responses.go new file mode 100644 index 0000000..bdfac63 --- /dev/null +++ b/internal/client/data_centers/create_data_center_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// CreateDataCenterReader is a Reader for the CreateDataCenter structure. +type CreateDataCenterReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateDataCenterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCreateDataCenterOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewCreateDataCenterDefault(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 + } +} + +// NewCreateDataCenterOK creates a CreateDataCenterOK with default headers values +func NewCreateDataCenterOK() *CreateDataCenterOK { + return &CreateDataCenterOK{} +} + +/* +CreateDataCenterOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type CreateDataCenterOK struct { + Payload *models.V1DataCenter +} + +// IsSuccess returns true when this create data center o k response has a 2xx status code +func (o *CreateDataCenterOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create data center o k response has a 3xx status code +func (o *CreateDataCenterOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create data center o k response has a 4xx status code +func (o *CreateDataCenterOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this create data center o k response has a 5xx status code +func (o *CreateDataCenterOK) IsServerError() bool { + return false +} + +// IsCode returns true when this create data center o k response a status code equal to that given +func (o *CreateDataCenterOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the create data center o k response +func (o *CreateDataCenterOK) Code() int { + return 200 +} + +func (o *CreateDataCenterOK) Error() string { + return fmt.Sprintf("[POST /v1/data-centers][%d] createDataCenterOK %+v", 200, o.Payload) +} + +func (o *CreateDataCenterOK) String() string { + return fmt.Sprintf("[POST /v1/data-centers][%d] createDataCenterOK %+v", 200, o.Payload) +} + +func (o *CreateDataCenterOK) GetPayload() *models.V1DataCenter { + return o.Payload +} + +func (o *CreateDataCenterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1DataCenter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateDataCenterDefault creates a CreateDataCenterDefault with default headers values +func NewCreateDataCenterDefault(code int) *CreateDataCenterDefault { + return &CreateDataCenterDefault{ + _statusCode: code, + } +} + +/* +CreateDataCenterDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type CreateDataCenterDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this create data center default response has a 2xx status code +func (o *CreateDataCenterDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create data center default response has a 3xx status code +func (o *CreateDataCenterDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create data center default response has a 4xx status code +func (o *CreateDataCenterDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create data center default response has a 5xx status code +func (o *CreateDataCenterDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create data center default response a status code equal to that given +func (o *CreateDataCenterDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the create data center default response +func (o *CreateDataCenterDefault) Code() int { + return o._statusCode +} + +func (o *CreateDataCenterDefault) Error() string { + return fmt.Sprintf("[POST /v1/data-centers][%d] CreateDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *CreateDataCenterDefault) String() string { + return fmt.Sprintf("[POST /v1/data-centers][%d] CreateDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *CreateDataCenterDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *CreateDataCenterDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/data_centers_client.go b/internal/client/data_centers/data_centers_client.go new file mode 100644 index 0000000..d5eedfe --- /dev/null +++ b/internal/client/data_centers/data_centers_client.go @@ -0,0 +1,488 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new data centers API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for data centers API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + CountHosts(params *CountHostsParams, opts ...ClientOption) (*CountHostsOK, error) + + CreateDataCenter(params *CreateDataCenterParams, opts ...ClientOption) (*CreateDataCenterOK, error) + + DeleteDataCenter(params *DeleteDataCenterParams, opts ...ClientOption) (*DeleteDataCenterOK, error) + + GetDataCenter(params *GetDataCenterParams, opts ...ClientOption) (*GetDataCenterOK, error) + + GetDataCenterLiveUtilization(params *GetDataCenterLiveUtilizationParams, opts ...ClientOption) (*GetDataCenterLiveUtilizationOK, error) + + GetDataCenterRevenueByResource(params *GetDataCenterRevenueByResourceParams, opts ...ClientOption) (*GetDataCenterRevenueByResourceOK, error) + + GetDataCenterRevenueTimeSeries(params *GetDataCenterRevenueTimeSeriesParams, opts ...ClientOption) (*GetDataCenterRevenueTimeSeriesOK, error) + + ListClusters(params *ListClustersParams, opts ...ClientOption) (*ListClustersOK, error) + + ListDataCenters(params *ListDataCentersParams, opts ...ClientOption) (*ListDataCentersOK, error) + + ListHosts(params *ListHostsParams, opts ...ClientOption) (*ListHostsOK, error) + + UpdateDataCenter(params *UpdateDataCenterParams, opts ...ClientOption) (*UpdateDataCenterOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +CountHosts gets host count + +Returns the number of hosts in a data center +*/ +func (a *Client) CountHosts(params *CountHostsParams, opts ...ClientOption) (*CountHostsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCountHostsParams() + } + op := &runtime.ClientOperation{ + ID: "CountHosts", + Method: "GET", + PathPattern: "/v1/data-centers/{dataCenterId}/host-count", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &CountHostsReader{formats: a.formats}, + 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.(*CountHostsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CountHostsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +CreateDataCenter creates data center + +Creates a new data center +*/ +func (a *Client) CreateDataCenter(params *CreateDataCenterParams, opts ...ClientOption) (*CreateDataCenterOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateDataCenterParams() + } + op := &runtime.ClientOperation{ + ID: "CreateDataCenter", + Method: "POST", + PathPattern: "/v1/data-centers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &CreateDataCenterReader{formats: a.formats}, + 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.(*CreateDataCenterOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateDataCenterDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +DeleteDataCenter deletes data center + +Deletes a data center +*/ +func (a *Client) DeleteDataCenter(params *DeleteDataCenterParams, opts ...ClientOption) (*DeleteDataCenterOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteDataCenterParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteDataCenter", + Method: "DELETE", + PathPattern: "/v1/data-centers/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &DeleteDataCenterReader{formats: a.formats}, + 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.(*DeleteDataCenterOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteDataCenterDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetDataCenter gets data center + +Returns a data center +*/ +func (a *Client) GetDataCenter(params *GetDataCenterParams, opts ...ClientOption) (*GetDataCenterOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetDataCenterParams() + } + op := &runtime.ClientOperation{ + ID: "GetDataCenter", + Method: "GET", + PathPattern: "/v1/data-centers/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetDataCenterReader{formats: a.formats}, + 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.(*GetDataCenterOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetDataCenterDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetDataCenterLiveUtilization gets live utilization + +Returns the live utilization of a data center +*/ +func (a *Client) GetDataCenterLiveUtilization(params *GetDataCenterLiveUtilizationParams, opts ...ClientOption) (*GetDataCenterLiveUtilizationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetDataCenterLiveUtilizationParams() + } + op := &runtime.ClientOperation{ + ID: "GetDataCenterLiveUtilization", + Method: "GET", + PathPattern: "/v1/data-centers/{id}/live-utilization", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetDataCenterLiveUtilizationReader{formats: a.formats}, + 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.(*GetDataCenterLiveUtilizationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetDataCenterLiveUtilizationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetDataCenterRevenueByResource gets revenue by resource + +Returns the revenue of a data center by resource (CPU, Memory, Storage, etc.) +*/ +func (a *Client) GetDataCenterRevenueByResource(params *GetDataCenterRevenueByResourceParams, opts ...ClientOption) (*GetDataCenterRevenueByResourceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetDataCenterRevenueByResourceParams() + } + op := &runtime.ClientOperation{ + ID: "GetDataCenterRevenueByResource", + Method: "GET", + PathPattern: "/v1/data-centers/{id}/revenue-by-resource", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetDataCenterRevenueByResourceReader{formats: a.formats}, + 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.(*GetDataCenterRevenueByResourceOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetDataCenterRevenueByResourceDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetDataCenterRevenueTimeSeries gets revenue time series + +Returns the revenue of a data center over time +*/ +func (a *Client) GetDataCenterRevenueTimeSeries(params *GetDataCenterRevenueTimeSeriesParams, opts ...ClientOption) (*GetDataCenterRevenueTimeSeriesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetDataCenterRevenueTimeSeriesParams() + } + op := &runtime.ClientOperation{ + ID: "GetDataCenterRevenueTimeSeries", + Method: "GET", + PathPattern: "/v1/data-centers/{id}/revenue", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetDataCenterRevenueTimeSeriesReader{formats: a.formats}, + 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.(*GetDataCenterRevenueTimeSeriesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetDataCenterRevenueTimeSeriesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListClusters lists clusters + +Returns the clusters in a data center +*/ +func (a *Client) ListClusters(params *ListClustersParams, opts ...ClientOption) (*ListClustersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListClustersParams() + } + op := &runtime.ClientOperation{ + ID: "ListClusters", + Method: "GET", + PathPattern: "/v1/data-centers/{dataCenterId}/clusters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListClustersReader{formats: a.formats}, + 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.(*ListClustersOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListClustersDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListDataCenters lists data centers + +Returns the data centers in an organization +*/ +func (a *Client) ListDataCenters(params *ListDataCentersParams, opts ...ClientOption) (*ListDataCentersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListDataCentersParams() + } + op := &runtime.ClientOperation{ + ID: "ListDataCenters", + Method: "GET", + PathPattern: "/v1/data-centers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListDataCentersReader{formats: a.formats}, + 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.(*ListDataCentersOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListDataCentersDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListHosts lists hosts + +Returns the hosts in a data center +*/ +func (a *Client) ListHosts(params *ListHostsParams, opts ...ClientOption) (*ListHostsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListHostsParams() + } + op := &runtime.ClientOperation{ + ID: "ListHosts", + Method: "GET", + PathPattern: "/v1/data-centers/{dataCenterId}/hosts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListHostsReader{formats: a.formats}, + 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.(*ListHostsOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListHostsDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +UpdateDataCenter updates data center + +Updates a data center +*/ +func (a *Client) UpdateDataCenter(params *UpdateDataCenterParams, opts ...ClientOption) (*UpdateDataCenterOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateDataCenterParams() + } + op := &runtime.ClientOperation{ + ID: "UpdateDataCenter", + Method: "PATCH", + PathPattern: "/v1/data-centers/{dataCenter.id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &UpdateDataCenterReader{formats: a.formats}, + 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.(*UpdateDataCenterOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateDataCenterDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/client/data_centers/delete_data_center_parameters.go b/internal/client/data_centers/delete_data_center_parameters.go new file mode 100644 index 0000000..857562b --- /dev/null +++ b/internal/client/data_centers/delete_data_center_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewDeleteDataCenterParams creates a new DeleteDataCenterParams 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 NewDeleteDataCenterParams() *DeleteDataCenterParams { + return &DeleteDataCenterParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteDataCenterParamsWithTimeout creates a new DeleteDataCenterParams object +// with the ability to set a timeout on a request. +func NewDeleteDataCenterParamsWithTimeout(timeout time.Duration) *DeleteDataCenterParams { + return &DeleteDataCenterParams{ + timeout: timeout, + } +} + +// NewDeleteDataCenterParamsWithContext creates a new DeleteDataCenterParams object +// with the ability to set a context for a request. +func NewDeleteDataCenterParamsWithContext(ctx context.Context) *DeleteDataCenterParams { + return &DeleteDataCenterParams{ + Context: ctx, + } +} + +// NewDeleteDataCenterParamsWithHTTPClient creates a new DeleteDataCenterParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteDataCenterParamsWithHTTPClient(client *http.Client) *DeleteDataCenterParams { + return &DeleteDataCenterParams{ + HTTPClient: client, + } +} + +/* +DeleteDataCenterParams contains all the parameters to send to the API endpoint + + for the delete data center operation. + + Typically these are written to a http.Request. +*/ +type DeleteDataCenterParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteDataCenterParams) WithDefaults() *DeleteDataCenterParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteDataCenterParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete data center params +func (o *DeleteDataCenterParams) WithTimeout(timeout time.Duration) *DeleteDataCenterParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete data center params +func (o *DeleteDataCenterParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete data center params +func (o *DeleteDataCenterParams) WithContext(ctx context.Context) *DeleteDataCenterParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete data center params +func (o *DeleteDataCenterParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete data center params +func (o *DeleteDataCenterParams) WithHTTPClient(client *http.Client) *DeleteDataCenterParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete data center params +func (o *DeleteDataCenterParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the delete data center params +func (o *DeleteDataCenterParams) WithID(id string) *DeleteDataCenterParams { + o.SetID(id) + return o +} + +// SetID adds the id to the delete data center params +func (o *DeleteDataCenterParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteDataCenterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/delete_data_center_responses.go b/internal/client/data_centers/delete_data_center_responses.go new file mode 100644 index 0000000..e1afdec --- /dev/null +++ b/internal/client/data_centers/delete_data_center_responses.go @@ -0,0 +1,180 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// DeleteDataCenterReader is a Reader for the DeleteDataCenter structure. +type DeleteDataCenterReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteDataCenterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteDataCenterOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeleteDataCenterDefault(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 + } +} + +// NewDeleteDataCenterOK creates a DeleteDataCenterOK with default headers values +func NewDeleteDataCenterOK() *DeleteDataCenterOK { + return &DeleteDataCenterOK{} +} + +/* +DeleteDataCenterOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeleteDataCenterOK struct { + Payload interface{} +} + +// IsSuccess returns true when this delete data center o k response has a 2xx status code +func (o *DeleteDataCenterOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete data center o k response has a 3xx status code +func (o *DeleteDataCenterOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete data center o k response has a 4xx status code +func (o *DeleteDataCenterOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete data center o k response has a 5xx status code +func (o *DeleteDataCenterOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete data center o k response a status code equal to that given +func (o *DeleteDataCenterOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the delete data center o k response +func (o *DeleteDataCenterOK) Code() int { + return 200 +} + +func (o *DeleteDataCenterOK) Error() string { + return fmt.Sprintf("[DELETE /v1/data-centers/{id}][%d] deleteDataCenterOK %+v", 200, o.Payload) +} + +func (o *DeleteDataCenterOK) String() string { + return fmt.Sprintf("[DELETE /v1/data-centers/{id}][%d] deleteDataCenterOK %+v", 200, o.Payload) +} + +func (o *DeleteDataCenterOK) GetPayload() interface{} { + return o.Payload +} + +func (o *DeleteDataCenterOK) 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 +} + +// NewDeleteDataCenterDefault creates a DeleteDataCenterDefault with default headers values +func NewDeleteDataCenterDefault(code int) *DeleteDataCenterDefault { + return &DeleteDataCenterDefault{ + _statusCode: code, + } +} + +/* +DeleteDataCenterDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeleteDataCenterDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this delete data center default response has a 2xx status code +func (o *DeleteDataCenterDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete data center default response has a 3xx status code +func (o *DeleteDataCenterDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete data center default response has a 4xx status code +func (o *DeleteDataCenterDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete data center default response has a 5xx status code +func (o *DeleteDataCenterDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete data center default response a status code equal to that given +func (o *DeleteDataCenterDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the delete data center default response +func (o *DeleteDataCenterDefault) Code() int { + return o._statusCode +} + +func (o *DeleteDataCenterDefault) Error() string { + return fmt.Sprintf("[DELETE /v1/data-centers/{id}][%d] DeleteDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteDataCenterDefault) String() string { + return fmt.Sprintf("[DELETE /v1/data-centers/{id}][%d] DeleteDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteDataCenterDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *DeleteDataCenterDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/get_data_center_live_utilization_parameters.go b/internal/client/data_centers/get_data_center_live_utilization_parameters.go new file mode 100644 index 0000000..af98dc5 --- /dev/null +++ b/internal/client/data_centers/get_data_center_live_utilization_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewGetDataCenterLiveUtilizationParams creates a new GetDataCenterLiveUtilizationParams 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 NewGetDataCenterLiveUtilizationParams() *GetDataCenterLiveUtilizationParams { + return &GetDataCenterLiveUtilizationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetDataCenterLiveUtilizationParamsWithTimeout creates a new GetDataCenterLiveUtilizationParams object +// with the ability to set a timeout on a request. +func NewGetDataCenterLiveUtilizationParamsWithTimeout(timeout time.Duration) *GetDataCenterLiveUtilizationParams { + return &GetDataCenterLiveUtilizationParams{ + timeout: timeout, + } +} + +// NewGetDataCenterLiveUtilizationParamsWithContext creates a new GetDataCenterLiveUtilizationParams object +// with the ability to set a context for a request. +func NewGetDataCenterLiveUtilizationParamsWithContext(ctx context.Context) *GetDataCenterLiveUtilizationParams { + return &GetDataCenterLiveUtilizationParams{ + Context: ctx, + } +} + +// NewGetDataCenterLiveUtilizationParamsWithHTTPClient creates a new GetDataCenterLiveUtilizationParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetDataCenterLiveUtilizationParamsWithHTTPClient(client *http.Client) *GetDataCenterLiveUtilizationParams { + return &GetDataCenterLiveUtilizationParams{ + HTTPClient: client, + } +} + +/* +GetDataCenterLiveUtilizationParams contains all the parameters to send to the API endpoint + + for the get data center live utilization operation. + + Typically these are written to a http.Request. +*/ +type GetDataCenterLiveUtilizationParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get data center live utilization params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterLiveUtilizationParams) WithDefaults() *GetDataCenterLiveUtilizationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get data center live utilization params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterLiveUtilizationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) WithTimeout(timeout time.Duration) *GetDataCenterLiveUtilizationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) WithContext(ctx context.Context) *GetDataCenterLiveUtilizationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) WithHTTPClient(client *http.Client) *GetDataCenterLiveUtilizationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) WithID(id string) *GetDataCenterLiveUtilizationParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get data center live utilization params +func (o *GetDataCenterLiveUtilizationParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetDataCenterLiveUtilizationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/get_data_center_live_utilization_responses.go b/internal/client/data_centers/get_data_center_live_utilization_responses.go new file mode 100644 index 0000000..81da9ee --- /dev/null +++ b/internal/client/data_centers/get_data_center_live_utilization_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetDataCenterLiveUtilizationReader is a Reader for the GetDataCenterLiveUtilization structure. +type GetDataCenterLiveUtilizationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetDataCenterLiveUtilizationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetDataCenterLiveUtilizationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetDataCenterLiveUtilizationDefault(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 + } +} + +// NewGetDataCenterLiveUtilizationOK creates a GetDataCenterLiveUtilizationOK with default headers values +func NewGetDataCenterLiveUtilizationOK() *GetDataCenterLiveUtilizationOK { + return &GetDataCenterLiveUtilizationOK{} +} + +/* +GetDataCenterLiveUtilizationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetDataCenterLiveUtilizationOK struct { + Payload *models.GetDataCenterLiveUtilizationResponse +} + +// IsSuccess returns true when this get data center live utilization o k response has a 2xx status code +func (o *GetDataCenterLiveUtilizationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get data center live utilization o k response has a 3xx status code +func (o *GetDataCenterLiveUtilizationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get data center live utilization o k response has a 4xx status code +func (o *GetDataCenterLiveUtilizationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get data center live utilization o k response has a 5xx status code +func (o *GetDataCenterLiveUtilizationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get data center live utilization o k response a status code equal to that given +func (o *GetDataCenterLiveUtilizationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get data center live utilization o k response +func (o *GetDataCenterLiveUtilizationOK) Code() int { + return 200 +} + +func (o *GetDataCenterLiveUtilizationOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/live-utilization][%d] getDataCenterLiveUtilizationOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterLiveUtilizationOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/live-utilization][%d] getDataCenterLiveUtilizationOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterLiveUtilizationOK) GetPayload() *models.GetDataCenterLiveUtilizationResponse { + return o.Payload +} + +func (o *GetDataCenterLiveUtilizationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetDataCenterLiveUtilizationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetDataCenterLiveUtilizationDefault creates a GetDataCenterLiveUtilizationDefault with default headers values +func NewGetDataCenterLiveUtilizationDefault(code int) *GetDataCenterLiveUtilizationDefault { + return &GetDataCenterLiveUtilizationDefault{ + _statusCode: code, + } +} + +/* +GetDataCenterLiveUtilizationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetDataCenterLiveUtilizationDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get data center live utilization default response has a 2xx status code +func (o *GetDataCenterLiveUtilizationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get data center live utilization default response has a 3xx status code +func (o *GetDataCenterLiveUtilizationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get data center live utilization default response has a 4xx status code +func (o *GetDataCenterLiveUtilizationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get data center live utilization default response has a 5xx status code +func (o *GetDataCenterLiveUtilizationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get data center live utilization default response a status code equal to that given +func (o *GetDataCenterLiveUtilizationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get data center live utilization default response +func (o *GetDataCenterLiveUtilizationDefault) Code() int { + return o._statusCode +} + +func (o *GetDataCenterLiveUtilizationDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/live-utilization][%d] GetDataCenterLiveUtilization default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterLiveUtilizationDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/live-utilization][%d] GetDataCenterLiveUtilization default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterLiveUtilizationDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetDataCenterLiveUtilizationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/get_data_center_parameters.go b/internal/client/data_centers/get_data_center_parameters.go new file mode 100644 index 0000000..ddf9c8e --- /dev/null +++ b/internal/client/data_centers/get_data_center_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewGetDataCenterParams creates a new GetDataCenterParams 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 NewGetDataCenterParams() *GetDataCenterParams { + return &GetDataCenterParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetDataCenterParamsWithTimeout creates a new GetDataCenterParams object +// with the ability to set a timeout on a request. +func NewGetDataCenterParamsWithTimeout(timeout time.Duration) *GetDataCenterParams { + return &GetDataCenterParams{ + timeout: timeout, + } +} + +// NewGetDataCenterParamsWithContext creates a new GetDataCenterParams object +// with the ability to set a context for a request. +func NewGetDataCenterParamsWithContext(ctx context.Context) *GetDataCenterParams { + return &GetDataCenterParams{ + Context: ctx, + } +} + +// NewGetDataCenterParamsWithHTTPClient creates a new GetDataCenterParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetDataCenterParamsWithHTTPClient(client *http.Client) *GetDataCenterParams { + return &GetDataCenterParams{ + HTTPClient: client, + } +} + +/* +GetDataCenterParams contains all the parameters to send to the API endpoint + + for the get data center operation. + + Typically these are written to a http.Request. +*/ +type GetDataCenterParams struct { + + // ID. + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterParams) WithDefaults() *GetDataCenterParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get data center params +func (o *GetDataCenterParams) WithTimeout(timeout time.Duration) *GetDataCenterParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get data center params +func (o *GetDataCenterParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get data center params +func (o *GetDataCenterParams) WithContext(ctx context.Context) *GetDataCenterParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get data center params +func (o *GetDataCenterParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get data center params +func (o *GetDataCenterParams) WithHTTPClient(client *http.Client) *GetDataCenterParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get data center params +func (o *GetDataCenterParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the get data center params +func (o *GetDataCenterParams) WithID(id string) *GetDataCenterParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get data center params +func (o *GetDataCenterParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *GetDataCenterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/get_data_center_responses.go b/internal/client/data_centers/get_data_center_responses.go new file mode 100644 index 0000000..3536a2e --- /dev/null +++ b/internal/client/data_centers/get_data_center_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetDataCenterReader is a Reader for the GetDataCenter structure. +type GetDataCenterReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetDataCenterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetDataCenterOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetDataCenterDefault(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 + } +} + +// NewGetDataCenterOK creates a GetDataCenterOK with default headers values +func NewGetDataCenterOK() *GetDataCenterOK { + return &GetDataCenterOK{} +} + +/* +GetDataCenterOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetDataCenterOK struct { + Payload *models.V1DataCenter +} + +// IsSuccess returns true when this get data center o k response has a 2xx status code +func (o *GetDataCenterOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get data center o k response has a 3xx status code +func (o *GetDataCenterOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get data center o k response has a 4xx status code +func (o *GetDataCenterOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get data center o k response has a 5xx status code +func (o *GetDataCenterOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get data center o k response a status code equal to that given +func (o *GetDataCenterOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get data center o k response +func (o *GetDataCenterOK) Code() int { + return 200 +} + +func (o *GetDataCenterOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}][%d] getDataCenterOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}][%d] getDataCenterOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterOK) GetPayload() *models.V1DataCenter { + return o.Payload +} + +func (o *GetDataCenterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1DataCenter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetDataCenterDefault creates a GetDataCenterDefault with default headers values +func NewGetDataCenterDefault(code int) *GetDataCenterDefault { + return &GetDataCenterDefault{ + _statusCode: code, + } +} + +/* +GetDataCenterDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetDataCenterDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get data center default response has a 2xx status code +func (o *GetDataCenterDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get data center default response has a 3xx status code +func (o *GetDataCenterDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get data center default response has a 4xx status code +func (o *GetDataCenterDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get data center default response has a 5xx status code +func (o *GetDataCenterDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get data center default response a status code equal to that given +func (o *GetDataCenterDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get data center default response +func (o *GetDataCenterDefault) Code() int { + return o._statusCode +} + +func (o *GetDataCenterDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}][%d] GetDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}][%d] GetDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetDataCenterDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/get_data_center_revenue_by_resource_parameters.go b/internal/client/data_centers/get_data_center_revenue_by_resource_parameters.go new file mode 100644 index 0000000..fe85a3d --- /dev/null +++ b/internal/client/data_centers/get_data_center_revenue_by_resource_parameters.go @@ -0,0 +1,200 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewGetDataCenterRevenueByResourceParams creates a new GetDataCenterRevenueByResourceParams 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 NewGetDataCenterRevenueByResourceParams() *GetDataCenterRevenueByResourceParams { + return &GetDataCenterRevenueByResourceParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetDataCenterRevenueByResourceParamsWithTimeout creates a new GetDataCenterRevenueByResourceParams object +// with the ability to set a timeout on a request. +func NewGetDataCenterRevenueByResourceParamsWithTimeout(timeout time.Duration) *GetDataCenterRevenueByResourceParams { + return &GetDataCenterRevenueByResourceParams{ + timeout: timeout, + } +} + +// NewGetDataCenterRevenueByResourceParamsWithContext creates a new GetDataCenterRevenueByResourceParams object +// with the ability to set a context for a request. +func NewGetDataCenterRevenueByResourceParamsWithContext(ctx context.Context) *GetDataCenterRevenueByResourceParams { + return &GetDataCenterRevenueByResourceParams{ + Context: ctx, + } +} + +// NewGetDataCenterRevenueByResourceParamsWithHTTPClient creates a new GetDataCenterRevenueByResourceParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetDataCenterRevenueByResourceParamsWithHTTPClient(client *http.Client) *GetDataCenterRevenueByResourceParams { + return &GetDataCenterRevenueByResourceParams{ + HTTPClient: client, + } +} + +/* +GetDataCenterRevenueByResourceParams contains all the parameters to send to the API endpoint + + for the get data center revenue by resource operation. + + Typically these are written to a http.Request. +*/ +type GetDataCenterRevenueByResourceParams struct { + + // EndTime. + // + // Format: date-time + EndTime strfmt.DateTime + + // ID. + ID string + + // StartTime. + // + // Format: date-time + StartTime strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get data center revenue by resource params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterRevenueByResourceParams) WithDefaults() *GetDataCenterRevenueByResourceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get data center revenue by resource params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterRevenueByResourceParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) WithTimeout(timeout time.Duration) *GetDataCenterRevenueByResourceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) WithContext(ctx context.Context) *GetDataCenterRevenueByResourceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) WithHTTPClient(client *http.Client) *GetDataCenterRevenueByResourceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEndTime adds the endTime to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) WithEndTime(endTime strfmt.DateTime) *GetDataCenterRevenueByResourceParams { + o.SetEndTime(endTime) + return o +} + +// SetEndTime adds the endTime to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) SetEndTime(endTime strfmt.DateTime) { + o.EndTime = endTime +} + +// WithID adds the id to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) WithID(id string) *GetDataCenterRevenueByResourceParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) SetID(id string) { + o.ID = id +} + +// WithStartTime adds the startTime to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) WithStartTime(startTime strfmt.DateTime) *GetDataCenterRevenueByResourceParams { + o.SetStartTime(startTime) + return o +} + +// SetStartTime adds the startTime to the get data center revenue by resource params +func (o *GetDataCenterRevenueByResourceParams) SetStartTime(startTime strfmt.DateTime) { + o.StartTime = startTime +} + +// WriteToRequest writes these params to a swagger request +func (o *GetDataCenterRevenueByResourceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param endTime + qrEndTime := o.EndTime + qEndTime := qrEndTime.String() + if qEndTime != "" { + + if err := r.SetQueryParam("endTime", qEndTime); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // query param startTime + qrStartTime := o.StartTime + qStartTime := qrStartTime.String() + if qStartTime != "" { + + if err := r.SetQueryParam("startTime", qStartTime); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/get_data_center_revenue_by_resource_responses.go b/internal/client/data_centers/get_data_center_revenue_by_resource_responses.go new file mode 100644 index 0000000..4324bf3 --- /dev/null +++ b/internal/client/data_centers/get_data_center_revenue_by_resource_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetDataCenterRevenueByResourceReader is a Reader for the GetDataCenterRevenueByResource structure. +type GetDataCenterRevenueByResourceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetDataCenterRevenueByResourceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetDataCenterRevenueByResourceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetDataCenterRevenueByResourceDefault(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 + } +} + +// NewGetDataCenterRevenueByResourceOK creates a GetDataCenterRevenueByResourceOK with default headers values +func NewGetDataCenterRevenueByResourceOK() *GetDataCenterRevenueByResourceOK { + return &GetDataCenterRevenueByResourceOK{} +} + +/* +GetDataCenterRevenueByResourceOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetDataCenterRevenueByResourceOK struct { + Payload *models.GetDataCenterRevenueByResourceResponse +} + +// IsSuccess returns true when this get data center revenue by resource o k response has a 2xx status code +func (o *GetDataCenterRevenueByResourceOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get data center revenue by resource o k response has a 3xx status code +func (o *GetDataCenterRevenueByResourceOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get data center revenue by resource o k response has a 4xx status code +func (o *GetDataCenterRevenueByResourceOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get data center revenue by resource o k response has a 5xx status code +func (o *GetDataCenterRevenueByResourceOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get data center revenue by resource o k response a status code equal to that given +func (o *GetDataCenterRevenueByResourceOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get data center revenue by resource o k response +func (o *GetDataCenterRevenueByResourceOK) Code() int { + return 200 +} + +func (o *GetDataCenterRevenueByResourceOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue-by-resource][%d] getDataCenterRevenueByResourceOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterRevenueByResourceOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue-by-resource][%d] getDataCenterRevenueByResourceOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterRevenueByResourceOK) GetPayload() *models.GetDataCenterRevenueByResourceResponse { + return o.Payload +} + +func (o *GetDataCenterRevenueByResourceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetDataCenterRevenueByResourceResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetDataCenterRevenueByResourceDefault creates a GetDataCenterRevenueByResourceDefault with default headers values +func NewGetDataCenterRevenueByResourceDefault(code int) *GetDataCenterRevenueByResourceDefault { + return &GetDataCenterRevenueByResourceDefault{ + _statusCode: code, + } +} + +/* +GetDataCenterRevenueByResourceDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetDataCenterRevenueByResourceDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get data center revenue by resource default response has a 2xx status code +func (o *GetDataCenterRevenueByResourceDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get data center revenue by resource default response has a 3xx status code +func (o *GetDataCenterRevenueByResourceDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get data center revenue by resource default response has a 4xx status code +func (o *GetDataCenterRevenueByResourceDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get data center revenue by resource default response has a 5xx status code +func (o *GetDataCenterRevenueByResourceDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get data center revenue by resource default response a status code equal to that given +func (o *GetDataCenterRevenueByResourceDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get data center revenue by resource default response +func (o *GetDataCenterRevenueByResourceDefault) Code() int { + return o._statusCode +} + +func (o *GetDataCenterRevenueByResourceDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue-by-resource][%d] GetDataCenterRevenueByResource default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterRevenueByResourceDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue-by-resource][%d] GetDataCenterRevenueByResource default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterRevenueByResourceDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetDataCenterRevenueByResourceDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/get_data_center_revenue_time_series_parameters.go b/internal/client/data_centers/get_data_center_revenue_time_series_parameters.go new file mode 100644 index 0000000..2d5e591 --- /dev/null +++ b/internal/client/data_centers/get_data_center_revenue_time_series_parameters.go @@ -0,0 +1,237 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewGetDataCenterRevenueTimeSeriesParams creates a new GetDataCenterRevenueTimeSeriesParams 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 NewGetDataCenterRevenueTimeSeriesParams() *GetDataCenterRevenueTimeSeriesParams { + return &GetDataCenterRevenueTimeSeriesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetDataCenterRevenueTimeSeriesParamsWithTimeout creates a new GetDataCenterRevenueTimeSeriesParams object +// with the ability to set a timeout on a request. +func NewGetDataCenterRevenueTimeSeriesParamsWithTimeout(timeout time.Duration) *GetDataCenterRevenueTimeSeriesParams { + return &GetDataCenterRevenueTimeSeriesParams{ + timeout: timeout, + } +} + +// NewGetDataCenterRevenueTimeSeriesParamsWithContext creates a new GetDataCenterRevenueTimeSeriesParams object +// with the ability to set a context for a request. +func NewGetDataCenterRevenueTimeSeriesParamsWithContext(ctx context.Context) *GetDataCenterRevenueTimeSeriesParams { + return &GetDataCenterRevenueTimeSeriesParams{ + Context: ctx, + } +} + +// NewGetDataCenterRevenueTimeSeriesParamsWithHTTPClient creates a new GetDataCenterRevenueTimeSeriesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetDataCenterRevenueTimeSeriesParamsWithHTTPClient(client *http.Client) *GetDataCenterRevenueTimeSeriesParams { + return &GetDataCenterRevenueTimeSeriesParams{ + HTTPClient: client, + } +} + +/* +GetDataCenterRevenueTimeSeriesParams contains all the parameters to send to the API endpoint + + for the get data center revenue time series operation. + + Typically these are written to a http.Request. +*/ +type GetDataCenterRevenueTimeSeriesParams struct { + + // EndTime. + // + // Format: date-time + EndTime strfmt.DateTime + + // ID. + ID string + + // Interval. + // + // Default: "INTERVAL_UNKNOWN" + Interval string + + // StartTime. + // + // Format: date-time + StartTime strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get data center revenue time series params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterRevenueTimeSeriesParams) WithDefaults() *GetDataCenterRevenueTimeSeriesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get data center revenue time series params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetDataCenterRevenueTimeSeriesParams) SetDefaults() { + var ( + intervalDefault = string("INTERVAL_UNKNOWN") + ) + + val := GetDataCenterRevenueTimeSeriesParams{ + Interval: intervalDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) WithTimeout(timeout time.Duration) *GetDataCenterRevenueTimeSeriesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) WithContext(ctx context.Context) *GetDataCenterRevenueTimeSeriesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) WithHTTPClient(client *http.Client) *GetDataCenterRevenueTimeSeriesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEndTime adds the endTime to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) WithEndTime(endTime strfmt.DateTime) *GetDataCenterRevenueTimeSeriesParams { + o.SetEndTime(endTime) + return o +} + +// SetEndTime adds the endTime to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) SetEndTime(endTime strfmt.DateTime) { + o.EndTime = endTime +} + +// WithID adds the id to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) WithID(id string) *GetDataCenterRevenueTimeSeriesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) SetID(id string) { + o.ID = id +} + +// WithInterval adds the interval to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) WithInterval(interval string) *GetDataCenterRevenueTimeSeriesParams { + o.SetInterval(interval) + return o +} + +// SetInterval adds the interval to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) SetInterval(interval string) { + o.Interval = interval +} + +// WithStartTime adds the startTime to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) WithStartTime(startTime strfmt.DateTime) *GetDataCenterRevenueTimeSeriesParams { + o.SetStartTime(startTime) + return o +} + +// SetStartTime adds the startTime to the get data center revenue time series params +func (o *GetDataCenterRevenueTimeSeriesParams) SetStartTime(startTime strfmt.DateTime) { + o.StartTime = startTime +} + +// WriteToRequest writes these params to a swagger request +func (o *GetDataCenterRevenueTimeSeriesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param endTime + qrEndTime := o.EndTime + qEndTime := qrEndTime.String() + if qEndTime != "" { + + if err := r.SetQueryParam("endTime", qEndTime); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // query param interval + qrInterval := o.Interval + qInterval := qrInterval + if qInterval != "" { + + if err := r.SetQueryParam("interval", qInterval); err != nil { + return err + } + } + + // query param startTime + qrStartTime := o.StartTime + qStartTime := qrStartTime.String() + if qStartTime != "" { + + if err := r.SetQueryParam("startTime", qStartTime); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/get_data_center_revenue_time_series_responses.go b/internal/client/data_centers/get_data_center_revenue_time_series_responses.go new file mode 100644 index 0000000..434c4e4 --- /dev/null +++ b/internal/client/data_centers/get_data_center_revenue_time_series_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetDataCenterRevenueTimeSeriesReader is a Reader for the GetDataCenterRevenueTimeSeries structure. +type GetDataCenterRevenueTimeSeriesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetDataCenterRevenueTimeSeriesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetDataCenterRevenueTimeSeriesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetDataCenterRevenueTimeSeriesDefault(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 + } +} + +// NewGetDataCenterRevenueTimeSeriesOK creates a GetDataCenterRevenueTimeSeriesOK with default headers values +func NewGetDataCenterRevenueTimeSeriesOK() *GetDataCenterRevenueTimeSeriesOK { + return &GetDataCenterRevenueTimeSeriesOK{} +} + +/* +GetDataCenterRevenueTimeSeriesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetDataCenterRevenueTimeSeriesOK struct { + Payload *models.GetDataCenterRevenueTimeSeriesResponse +} + +// IsSuccess returns true when this get data center revenue time series o k response has a 2xx status code +func (o *GetDataCenterRevenueTimeSeriesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get data center revenue time series o k response has a 3xx status code +func (o *GetDataCenterRevenueTimeSeriesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get data center revenue time series o k response has a 4xx status code +func (o *GetDataCenterRevenueTimeSeriesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get data center revenue time series o k response has a 5xx status code +func (o *GetDataCenterRevenueTimeSeriesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get data center revenue time series o k response a status code equal to that given +func (o *GetDataCenterRevenueTimeSeriesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get data center revenue time series o k response +func (o *GetDataCenterRevenueTimeSeriesOK) Code() int { + return 200 +} + +func (o *GetDataCenterRevenueTimeSeriesOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue][%d] getDataCenterRevenueTimeSeriesOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterRevenueTimeSeriesOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue][%d] getDataCenterRevenueTimeSeriesOK %+v", 200, o.Payload) +} + +func (o *GetDataCenterRevenueTimeSeriesOK) GetPayload() *models.GetDataCenterRevenueTimeSeriesResponse { + return o.Payload +} + +func (o *GetDataCenterRevenueTimeSeriesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetDataCenterRevenueTimeSeriesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetDataCenterRevenueTimeSeriesDefault creates a GetDataCenterRevenueTimeSeriesDefault with default headers values +func NewGetDataCenterRevenueTimeSeriesDefault(code int) *GetDataCenterRevenueTimeSeriesDefault { + return &GetDataCenterRevenueTimeSeriesDefault{ + _statusCode: code, + } +} + +/* +GetDataCenterRevenueTimeSeriesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetDataCenterRevenueTimeSeriesDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get data center revenue time series default response has a 2xx status code +func (o *GetDataCenterRevenueTimeSeriesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get data center revenue time series default response has a 3xx status code +func (o *GetDataCenterRevenueTimeSeriesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get data center revenue time series default response has a 4xx status code +func (o *GetDataCenterRevenueTimeSeriesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get data center revenue time series default response has a 5xx status code +func (o *GetDataCenterRevenueTimeSeriesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get data center revenue time series default response a status code equal to that given +func (o *GetDataCenterRevenueTimeSeriesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get data center revenue time series default response +func (o *GetDataCenterRevenueTimeSeriesDefault) Code() int { + return o._statusCode +} + +func (o *GetDataCenterRevenueTimeSeriesDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue][%d] GetDataCenterRevenueTimeSeries default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterRevenueTimeSeriesDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{id}/revenue][%d] GetDataCenterRevenueTimeSeries default %+v", o._statusCode, o.Payload) +} + +func (o *GetDataCenterRevenueTimeSeriesDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetDataCenterRevenueTimeSeriesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/list_clusters_parameters.go b/internal/client/data_centers/list_clusters_parameters.go new file mode 100644 index 0000000..4297fd1 --- /dev/null +++ b/internal/client/data_centers/list_clusters_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewListClustersParams creates a new ListClustersParams 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 NewListClustersParams() *ListClustersParams { + return &ListClustersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListClustersParamsWithTimeout creates a new ListClustersParams object +// with the ability to set a timeout on a request. +func NewListClustersParamsWithTimeout(timeout time.Duration) *ListClustersParams { + return &ListClustersParams{ + timeout: timeout, + } +} + +// NewListClustersParamsWithContext creates a new ListClustersParams object +// with the ability to set a context for a request. +func NewListClustersParamsWithContext(ctx context.Context) *ListClustersParams { + return &ListClustersParams{ + Context: ctx, + } +} + +// NewListClustersParamsWithHTTPClient creates a new ListClustersParams object +// with the ability to set a custom HTTPClient for a request. +func NewListClustersParamsWithHTTPClient(client *http.Client) *ListClustersParams { + return &ListClustersParams{ + HTTPClient: client, + } +} + +/* +ListClustersParams contains all the parameters to send to the API endpoint + + for the list clusters operation. + + Typically these are written to a http.Request. +*/ +type ListClustersParams struct { + + // DataCenterID. + DataCenterID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListClustersParams) WithDefaults() *ListClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListClustersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list clusters params +func (o *ListClustersParams) WithTimeout(timeout time.Duration) *ListClustersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list clusters params +func (o *ListClustersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list clusters params +func (o *ListClustersParams) WithContext(ctx context.Context) *ListClustersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list clusters params +func (o *ListClustersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list clusters params +func (o *ListClustersParams) WithHTTPClient(client *http.Client) *ListClustersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list clusters params +func (o *ListClustersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenterID adds the dataCenterID to the list clusters params +func (o *ListClustersParams) WithDataCenterID(dataCenterID string) *ListClustersParams { + o.SetDataCenterID(dataCenterID) + return o +} + +// SetDataCenterID adds the dataCenterId to the list clusters params +func (o *ListClustersParams) SetDataCenterID(dataCenterID string) { + o.DataCenterID = dataCenterID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param dataCenterId + if err := r.SetPathParam("dataCenterId", o.DataCenterID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/list_clusters_responses.go b/internal/client/data_centers/list_clusters_responses.go new file mode 100644 index 0000000..e45ff96 --- /dev/null +++ b/internal/client/data_centers/list_clusters_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// ListClustersReader is a Reader for the ListClusters structure. +type ListClustersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListClustersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListClustersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListClustersDefault(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 + } +} + +// NewListClustersOK creates a ListClustersOK with default headers values +func NewListClustersOK() *ListClustersOK { + return &ListClustersOK{} +} + +/* +ListClustersOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListClustersOK struct { + Payload *models.ListClustersResponse +} + +// IsSuccess returns true when this list clusters o k response has a 2xx status code +func (o *ListClustersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list clusters o k response has a 3xx status code +func (o *ListClustersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list clusters o k response has a 4xx status code +func (o *ListClustersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list clusters o k response has a 5xx status code +func (o *ListClustersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list clusters o k response a status code equal to that given +func (o *ListClustersOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list clusters o k response +func (o *ListClustersOK) Code() int { + return 200 +} + +func (o *ListClustersOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/clusters][%d] listClustersOK %+v", 200, o.Payload) +} + +func (o *ListClustersOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/clusters][%d] listClustersOK %+v", 200, o.Payload) +} + +func (o *ListClustersOK) GetPayload() *models.ListClustersResponse { + return o.Payload +} + +func (o *ListClustersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ListClustersResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListClustersDefault creates a ListClustersDefault with default headers values +func NewListClustersDefault(code int) *ListClustersDefault { + return &ListClustersDefault{ + _statusCode: code, + } +} + +/* +ListClustersDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListClustersDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this list clusters default response has a 2xx status code +func (o *ListClustersDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list clusters default response has a 3xx status code +func (o *ListClustersDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list clusters default response has a 4xx status code +func (o *ListClustersDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list clusters default response has a 5xx status code +func (o *ListClustersDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list clusters default response a status code equal to that given +func (o *ListClustersDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list clusters default response +func (o *ListClustersDefault) Code() int { + return o._statusCode +} + +func (o *ListClustersDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/clusters][%d] ListClusters default %+v", o._statusCode, o.Payload) +} + +func (o *ListClustersDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/clusters][%d] ListClusters default %+v", o._statusCode, o.Payload) +} + +func (o *ListClustersDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *ListClustersDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/list_data_centers_parameters.go b/internal/client/data_centers/list_data_centers_parameters.go new file mode 100644 index 0000000..13dfe05 --- /dev/null +++ b/internal/client/data_centers/list_data_centers_parameters.go @@ -0,0 +1,194 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewListDataCentersParams creates a new ListDataCentersParams 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 NewListDataCentersParams() *ListDataCentersParams { + return &ListDataCentersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListDataCentersParamsWithTimeout creates a new ListDataCentersParams object +// with the ability to set a timeout on a request. +func NewListDataCentersParamsWithTimeout(timeout time.Duration) *ListDataCentersParams { + return &ListDataCentersParams{ + timeout: timeout, + } +} + +// NewListDataCentersParamsWithContext creates a new ListDataCentersParams object +// with the ability to set a context for a request. +func NewListDataCentersParamsWithContext(ctx context.Context) *ListDataCentersParams { + return &ListDataCentersParams{ + Context: ctx, + } +} + +// NewListDataCentersParamsWithHTTPClient creates a new ListDataCentersParams object +// with the ability to set a custom HTTPClient for a request. +func NewListDataCentersParamsWithHTTPClient(client *http.Client) *ListDataCentersParams { + return &ListDataCentersParams{ + HTTPClient: client, + } +} + +/* +ListDataCentersParams contains all the parameters to send to the API endpoint + + for the list data centers operation. + + Typically these are written to a http.Request. +*/ +type ListDataCentersParams struct { + + // PageSize. + // + // Format: int32 + PageSize *int32 + + // PageToken. + PageToken *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list data centers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListDataCentersParams) WithDefaults() *ListDataCentersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list data centers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListDataCentersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list data centers params +func (o *ListDataCentersParams) WithTimeout(timeout time.Duration) *ListDataCentersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list data centers params +func (o *ListDataCentersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list data centers params +func (o *ListDataCentersParams) WithContext(ctx context.Context) *ListDataCentersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list data centers params +func (o *ListDataCentersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list data centers params +func (o *ListDataCentersParams) WithHTTPClient(client *http.Client) *ListDataCentersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list data centers params +func (o *ListDataCentersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPageSize adds the pageSize to the list data centers params +func (o *ListDataCentersParams) WithPageSize(pageSize *int32) *ListDataCentersParams { + o.SetPageSize(pageSize) + return o +} + +// SetPageSize adds the pageSize to the list data centers params +func (o *ListDataCentersParams) SetPageSize(pageSize *int32) { + o.PageSize = pageSize +} + +// WithPageToken adds the pageToken to the list data centers params +func (o *ListDataCentersParams) WithPageToken(pageToken *string) *ListDataCentersParams { + o.SetPageToken(pageToken) + return o +} + +// SetPageToken adds the pageToken to the list data centers params +func (o *ListDataCentersParams) SetPageToken(pageToken *string) { + o.PageToken = pageToken +} + +// WriteToRequest writes these params to a swagger request +func (o *ListDataCentersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.PageSize != nil { + + // query param pageSize + var qrPageSize int32 + + if o.PageSize != nil { + qrPageSize = *o.PageSize + } + qPageSize := swag.FormatInt32(qrPageSize) + if qPageSize != "" { + + if err := r.SetQueryParam("pageSize", qPageSize); err != nil { + return err + } + } + } + + if o.PageToken != nil { + + // query param pageToken + var qrPageToken string + + if o.PageToken != nil { + qrPageToken = *o.PageToken + } + qPageToken := qrPageToken + if qPageToken != "" { + + if err := r.SetQueryParam("pageToken", qPageToken); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/list_data_centers_responses.go b/internal/client/data_centers/list_data_centers_responses.go new file mode 100644 index 0000000..48a975e --- /dev/null +++ b/internal/client/data_centers/list_data_centers_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// ListDataCentersReader is a Reader for the ListDataCenters structure. +type ListDataCentersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListDataCentersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListDataCentersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListDataCentersDefault(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 + } +} + +// NewListDataCentersOK creates a ListDataCentersOK with default headers values +func NewListDataCentersOK() *ListDataCentersOK { + return &ListDataCentersOK{} +} + +/* +ListDataCentersOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListDataCentersOK struct { + Payload *models.ListDataCentersResponse +} + +// IsSuccess returns true when this list data centers o k response has a 2xx status code +func (o *ListDataCentersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list data centers o k response has a 3xx status code +func (o *ListDataCentersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list data centers o k response has a 4xx status code +func (o *ListDataCentersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list data centers o k response has a 5xx status code +func (o *ListDataCentersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list data centers o k response a status code equal to that given +func (o *ListDataCentersOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list data centers o k response +func (o *ListDataCentersOK) Code() int { + return 200 +} + +func (o *ListDataCentersOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers][%d] listDataCentersOK %+v", 200, o.Payload) +} + +func (o *ListDataCentersOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers][%d] listDataCentersOK %+v", 200, o.Payload) +} + +func (o *ListDataCentersOK) GetPayload() *models.ListDataCentersResponse { + return o.Payload +} + +func (o *ListDataCentersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ListDataCentersResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListDataCentersDefault creates a ListDataCentersDefault with default headers values +func NewListDataCentersDefault(code int) *ListDataCentersDefault { + return &ListDataCentersDefault{ + _statusCode: code, + } +} + +/* +ListDataCentersDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListDataCentersDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this list data centers default response has a 2xx status code +func (o *ListDataCentersDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list data centers default response has a 3xx status code +func (o *ListDataCentersDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list data centers default response has a 4xx status code +func (o *ListDataCentersDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list data centers default response has a 5xx status code +func (o *ListDataCentersDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list data centers default response a status code equal to that given +func (o *ListDataCentersDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list data centers default response +func (o *ListDataCentersDefault) Code() int { + return o._statusCode +} + +func (o *ListDataCentersDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers][%d] ListDataCenters default %+v", o._statusCode, o.Payload) +} + +func (o *ListDataCentersDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers][%d] ListDataCenters default %+v", o._statusCode, o.Payload) +} + +func (o *ListDataCentersDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *ListDataCentersDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/list_hosts_parameters.go b/internal/client/data_centers/list_hosts_parameters.go new file mode 100644 index 0000000..48cb6f0 --- /dev/null +++ b/internal/client/data_centers/list_hosts_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewListHostsParams creates a new ListHostsParams 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 NewListHostsParams() *ListHostsParams { + return &ListHostsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListHostsParamsWithTimeout creates a new ListHostsParams object +// with the ability to set a timeout on a request. +func NewListHostsParamsWithTimeout(timeout time.Duration) *ListHostsParams { + return &ListHostsParams{ + timeout: timeout, + } +} + +// NewListHostsParamsWithContext creates a new ListHostsParams object +// with the ability to set a context for a request. +func NewListHostsParamsWithContext(ctx context.Context) *ListHostsParams { + return &ListHostsParams{ + Context: ctx, + } +} + +// NewListHostsParamsWithHTTPClient creates a new ListHostsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListHostsParamsWithHTTPClient(client *http.Client) *ListHostsParams { + return &ListHostsParams{ + HTTPClient: client, + } +} + +/* +ListHostsParams contains all the parameters to send to the API endpoint + + for the list hosts operation. + + Typically these are written to a http.Request. +*/ +type ListHostsParams struct { + + // DataCenterID. + DataCenterID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list hosts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListHostsParams) WithDefaults() *ListHostsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list hosts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListHostsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list hosts params +func (o *ListHostsParams) WithTimeout(timeout time.Duration) *ListHostsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list hosts params +func (o *ListHostsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list hosts params +func (o *ListHostsParams) WithContext(ctx context.Context) *ListHostsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list hosts params +func (o *ListHostsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list hosts params +func (o *ListHostsParams) WithHTTPClient(client *http.Client) *ListHostsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list hosts params +func (o *ListHostsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenterID adds the dataCenterID to the list hosts params +func (o *ListHostsParams) WithDataCenterID(dataCenterID string) *ListHostsParams { + o.SetDataCenterID(dataCenterID) + return o +} + +// SetDataCenterID adds the dataCenterId to the list hosts params +func (o *ListHostsParams) SetDataCenterID(dataCenterID string) { + o.DataCenterID = dataCenterID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListHostsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param dataCenterId + if err := r.SetPathParam("dataCenterId", o.DataCenterID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/list_hosts_responses.go b/internal/client/data_centers/list_hosts_responses.go new file mode 100644 index 0000000..7e6adf5 --- /dev/null +++ b/internal/client/data_centers/list_hosts_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// ListHostsReader is a Reader for the ListHosts structure. +type ListHostsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListHostsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListHostsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListHostsDefault(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 + } +} + +// NewListHostsOK creates a ListHostsOK with default headers values +func NewListHostsOK() *ListHostsOK { + return &ListHostsOK{} +} + +/* +ListHostsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListHostsOK struct { + Payload *models.ListHostsResponse +} + +// IsSuccess returns true when this list hosts o k response has a 2xx status code +func (o *ListHostsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list hosts o k response has a 3xx status code +func (o *ListHostsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list hosts o k response has a 4xx status code +func (o *ListHostsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list hosts o k response has a 5xx status code +func (o *ListHostsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list hosts o k response a status code equal to that given +func (o *ListHostsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list hosts o k response +func (o *ListHostsOK) Code() int { + return 200 +} + +func (o *ListHostsOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/hosts][%d] listHostsOK %+v", 200, o.Payload) +} + +func (o *ListHostsOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/hosts][%d] listHostsOK %+v", 200, o.Payload) +} + +func (o *ListHostsOK) GetPayload() *models.ListHostsResponse { + return o.Payload +} + +func (o *ListHostsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ListHostsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListHostsDefault creates a ListHostsDefault with default headers values +func NewListHostsDefault(code int) *ListHostsDefault { + return &ListHostsDefault{ + _statusCode: code, + } +} + +/* +ListHostsDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListHostsDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this list hosts default response has a 2xx status code +func (o *ListHostsDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list hosts default response has a 3xx status code +func (o *ListHostsDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list hosts default response has a 4xx status code +func (o *ListHostsDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list hosts default response has a 5xx status code +func (o *ListHostsDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list hosts default response a status code equal to that given +func (o *ListHostsDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list hosts default response +func (o *ListHostsDefault) Code() int { + return o._statusCode +} + +func (o *ListHostsDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/hosts][%d] ListHosts default %+v", o._statusCode, o.Payload) +} + +func (o *ListHostsDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/hosts][%d] ListHosts default %+v", o._statusCode, o.Payload) +} + +func (o *ListHostsDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *ListHostsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/data_centers/update_data_center_parameters.go b/internal/client/data_centers/update_data_center_parameters.go new file mode 100644 index 0000000..af0307d --- /dev/null +++ b/internal/client/data_centers/update_data_center_parameters.go @@ -0,0 +1,165 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" +) + +// NewUpdateDataCenterParams creates a new UpdateDataCenterParams 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 NewUpdateDataCenterParams() *UpdateDataCenterParams { + return &UpdateDataCenterParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateDataCenterParamsWithTimeout creates a new UpdateDataCenterParams object +// with the ability to set a timeout on a request. +func NewUpdateDataCenterParamsWithTimeout(timeout time.Duration) *UpdateDataCenterParams { + return &UpdateDataCenterParams{ + timeout: timeout, + } +} + +// NewUpdateDataCenterParamsWithContext creates a new UpdateDataCenterParams object +// with the ability to set a context for a request. +func NewUpdateDataCenterParamsWithContext(ctx context.Context) *UpdateDataCenterParams { + return &UpdateDataCenterParams{ + Context: ctx, + } +} + +// NewUpdateDataCenterParamsWithHTTPClient creates a new UpdateDataCenterParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateDataCenterParamsWithHTTPClient(client *http.Client) *UpdateDataCenterParams { + return &UpdateDataCenterParams{ + HTTPClient: client, + } +} + +/* +UpdateDataCenterParams contains all the parameters to send to the API endpoint + + for the update data center operation. + + Typically these are written to a http.Request. +*/ +type UpdateDataCenterParams struct { + + // DataCenter. + DataCenter UpdateDataCenterBody + + // DataCenterID. + DataCenterID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateDataCenterParams) WithDefaults() *UpdateDataCenterParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update data center params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateDataCenterParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update data center params +func (o *UpdateDataCenterParams) WithTimeout(timeout time.Duration) *UpdateDataCenterParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update data center params +func (o *UpdateDataCenterParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update data center params +func (o *UpdateDataCenterParams) WithContext(ctx context.Context) *UpdateDataCenterParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update data center params +func (o *UpdateDataCenterParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update data center params +func (o *UpdateDataCenterParams) WithHTTPClient(client *http.Client) *UpdateDataCenterParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update data center params +func (o *UpdateDataCenterParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenter adds the dataCenter to the update data center params +func (o *UpdateDataCenterParams) WithDataCenter(dataCenter UpdateDataCenterBody) *UpdateDataCenterParams { + o.SetDataCenter(dataCenter) + return o +} + +// SetDataCenter adds the dataCenter to the update data center params +func (o *UpdateDataCenterParams) SetDataCenter(dataCenter UpdateDataCenterBody) { + o.DataCenter = dataCenter +} + +// WithDataCenterID adds the dataCenterID to the update data center params +func (o *UpdateDataCenterParams) WithDataCenterID(dataCenterID string) *UpdateDataCenterParams { + o.SetDataCenterID(dataCenterID) + return o +} + +// SetDataCenterID adds the dataCenterId to the update data center params +func (o *UpdateDataCenterParams) SetDataCenterID(dataCenterID string) { + o.DataCenterID = dataCenterID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateDataCenterParams) 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.DataCenter); err != nil { + return err + } + + // path param dataCenter.id + if err := r.SetPathParam("dataCenter.id", o.DataCenterID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/data_centers/update_data_center_responses.go b/internal/client/data_centers/update_data_center_responses.go new file mode 100644 index 0000000..7866301 --- /dev/null +++ b/internal/client/data_centers/update_data_center_responses.go @@ -0,0 +1,342 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package data_centers + +// 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" + "github.com/go-openapi/validate" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" +) + +// UpdateDataCenterReader is a Reader for the UpdateDataCenter structure. +type UpdateDataCenterReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateDataCenterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateDataCenterOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateDataCenterDefault(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 + } +} + +// NewUpdateDataCenterOK creates a UpdateDataCenterOK with default headers values +func NewUpdateDataCenterOK() *UpdateDataCenterOK { + return &UpdateDataCenterOK{} +} + +/* +UpdateDataCenterOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UpdateDataCenterOK struct { + Payload *models.V1DataCenter +} + +// IsSuccess returns true when this update data center o k response has a 2xx status code +func (o *UpdateDataCenterOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update data center o k response has a 3xx status code +func (o *UpdateDataCenterOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update data center o k response has a 4xx status code +func (o *UpdateDataCenterOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update data center o k response has a 5xx status code +func (o *UpdateDataCenterOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update data center o k response a status code equal to that given +func (o *UpdateDataCenterOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update data center o k response +func (o *UpdateDataCenterOK) Code() int { + return 200 +} + +func (o *UpdateDataCenterOK) Error() string { + return fmt.Sprintf("[PATCH /v1/data-centers/{dataCenter.id}][%d] updateDataCenterOK %+v", 200, o.Payload) +} + +func (o *UpdateDataCenterOK) String() string { + return fmt.Sprintf("[PATCH /v1/data-centers/{dataCenter.id}][%d] updateDataCenterOK %+v", 200, o.Payload) +} + +func (o *UpdateDataCenterOK) GetPayload() *models.V1DataCenter { + return o.Payload +} + +func (o *UpdateDataCenterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V1DataCenter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateDataCenterDefault creates a UpdateDataCenterDefault with default headers values +func NewUpdateDataCenterDefault(code int) *UpdateDataCenterDefault { + return &UpdateDataCenterDefault{ + _statusCode: code, + } +} + +/* +UpdateDataCenterDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UpdateDataCenterDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this update data center default response has a 2xx status code +func (o *UpdateDataCenterDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update data center default response has a 3xx status code +func (o *UpdateDataCenterDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update data center default response has a 4xx status code +func (o *UpdateDataCenterDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update data center default response has a 5xx status code +func (o *UpdateDataCenterDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update data center default response a status code equal to that given +func (o *UpdateDataCenterDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update data center default response +func (o *UpdateDataCenterDefault) Code() int { + return o._statusCode +} + +func (o *UpdateDataCenterDefault) Error() string { + return fmt.Sprintf("[PATCH /v1/data-centers/{dataCenter.id}][%d] UpdateDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateDataCenterDefault) String() string { + return fmt.Sprintf("[PATCH /v1/data-centers/{dataCenter.id}][%d] UpdateDataCenter default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateDataCenterDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *UpdateDataCenterDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/* +UpdateDataCenterBody update data center body +swagger:model UpdateDataCenterBody +*/ +type UpdateDataCenterBody struct { + + // create by + // Read Only: true + CreateBy string `json:"createBy,omitempty"` + + // lng lat + LngLat *models.Point `json:"lngLat,omitempty"` + + // one frontend Id + // Required: true + OneFrontendID *string `json:"oneFrontendId"` + + // region Id + RegionID string `json:"regionId,omitempty"` + + // renewable energy + RenewableEnergy bool `json:"renewableEnergy,omitempty"` + + // s3 endpoint + // Required: true + S3Endpoint *string `json:"s3Endpoint"` + + // supplier name + SupplierName string `json:"supplierName,omitempty"` +} + +// Validate validates this update data center body +func (o *UpdateDataCenterBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateLngLat(formats); err != nil { + res = append(res, err) + } + + if err := o.validateOneFrontendID(formats); err != nil { + res = append(res, err) + } + + if err := o.validateS3Endpoint(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *UpdateDataCenterBody) validateLngLat(formats strfmt.Registry) error { + if swag.IsZero(o.LngLat) { // not required + return nil + } + + if o.LngLat != nil { + if err := o.LngLat.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dataCenter" + "." + "lngLat") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dataCenter" + "." + "lngLat") + } + return err + } + } + + return nil +} + +func (o *UpdateDataCenterBody) validateOneFrontendID(formats strfmt.Registry) error { + + if err := validate.Required("dataCenter"+"."+"oneFrontendId", "body", o.OneFrontendID); err != nil { + return err + } + + return nil +} + +func (o *UpdateDataCenterBody) validateS3Endpoint(formats strfmt.Registry) error { + + if err := validate.Required("dataCenter"+"."+"s3Endpoint", "body", o.S3Endpoint); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this update data center body based on the context it is used +func (o *UpdateDataCenterBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := o.contextValidateCreateBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := o.contextValidateLngLat(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *UpdateDataCenterBody) contextValidateCreateBy(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "dataCenter"+"."+"createBy", "body", string(o.CreateBy)); err != nil { + return err + } + + return nil +} + +func (o *UpdateDataCenterBody) contextValidateLngLat(ctx context.Context, formats strfmt.Registry) error { + + if o.LngLat != nil { + + if swag.IsZero(o.LngLat) { // not required + return nil + } + + if err := o.LngLat.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dataCenter" + "." + "lngLat") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dataCenter" + "." + "lngLat") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (o *UpdateDataCenterBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *UpdateDataCenterBody) UnmarshalBinary(b []byte) error { + var res UpdateDataCenterBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/internal/client/disks/create_disk_snapshot_parameters.go b/internal/client/disks/create_disk_snapshot_parameters.go index 988bd81..4e5a5d5 100644 --- a/internal/client/disks/create_disk_snapshot_parameters.go +++ b/internal/client/disks/create_disk_snapshot_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewCreateDiskSnapshotParams creates a new CreateDiskSnapshotParams object, @@ -62,7 +64,7 @@ CreateDiskSnapshotParams contains all the parameters to send to the API endpoint type CreateDiskSnapshotParams struct { // Body. - Body CreateDiskSnapshotBody + Body *models.CreateDiskSnapshotBody // ID. ID string @@ -124,13 +126,13 @@ func (o *CreateDiskSnapshotParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create disk snapshot params -func (o *CreateDiskSnapshotParams) WithBody(body CreateDiskSnapshotBody) *CreateDiskSnapshotParams { +func (o *CreateDiskSnapshotParams) WithBody(body *models.CreateDiskSnapshotBody) *CreateDiskSnapshotParams { o.SetBody(body) return o } // SetBody adds the body to the create disk snapshot params -func (o *CreateDiskSnapshotParams) SetBody(body CreateDiskSnapshotBody) { +func (o *CreateDiskSnapshotParams) SetBody(body *models.CreateDiskSnapshotBody) { o.Body = body } @@ -163,8 +165,10 @@ func (o *CreateDiskSnapshotParams) WriteToRequest(r runtime.ClientRequest, reg s return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param id diff --git a/internal/client/disks/create_disk_snapshot_responses.go b/internal/client/disks/create_disk_snapshot_responses.go index b065409..b571b63 100644 --- a/internal/client/disks/create_disk_snapshot_responses.go +++ b/internal/client/disks/create_disk_snapshot_responses.go @@ -6,15 +6,11 @@ package disks // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,77 +178,3 @@ func (o *CreateDiskSnapshotDefault) readResponse(response runtime.ClientResponse return nil } - -/* -CreateDiskSnapshotBody create disk snapshot body -swagger:model CreateDiskSnapshotBody -*/ -type CreateDiskSnapshotBody struct { - - // snapshot Id - // Required: true - SnapshotID *string `json:"snapshotId"` - - // vm Id - // Required: true - VMID *string `json:"vmId"` -} - -// Validate validates this create disk snapshot body -func (o *CreateDiskSnapshotBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateSnapshotID(formats); err != nil { - res = append(res, err) - } - - if err := o.validateVMID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateDiskSnapshotBody) validateSnapshotID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"snapshotId", "body", o.SnapshotID); err != nil { - return err - } - - return nil -} - -func (o *CreateDiskSnapshotBody) validateVMID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"vmId", "body", o.VMID); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this create disk snapshot body based on context it is used -func (o *CreateDiskSnapshotBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *CreateDiskSnapshotBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateDiskSnapshotBody) UnmarshalBinary(b []byte) error { - var res CreateDiskSnapshotBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/disks/create_storage_disk_parameters.go b/internal/client/disks/create_storage_disk_parameters.go index 6c667d6..3ee4894 100644 --- a/internal/client/disks/create_storage_disk_parameters.go +++ b/internal/client/disks/create_storage_disk_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewCreateStorageDiskParams creates a new CreateStorageDiskParams object, @@ -62,7 +64,7 @@ CreateStorageDiskParams contains all the parameters to send to the API endpoint type CreateStorageDiskParams struct { // Body. - Body CreateStorageDiskBody + Body *models.CreateStorageDiskBody // ProjectID. ProjectID string @@ -121,13 +123,13 @@ func (o *CreateStorageDiskParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create storage disk params -func (o *CreateStorageDiskParams) WithBody(body CreateStorageDiskBody) *CreateStorageDiskParams { +func (o *CreateStorageDiskParams) WithBody(body *models.CreateStorageDiskBody) *CreateStorageDiskParams { o.SetBody(body) return o } // SetBody adds the body to the create storage disk params -func (o *CreateStorageDiskParams) SetBody(body CreateStorageDiskBody) { +func (o *CreateStorageDiskParams) SetBody(body *models.CreateStorageDiskBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *CreateStorageDiskParams) WriteToRequest(r runtime.ClientRequest, reg st return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param projectId diff --git a/internal/client/disks/create_storage_disk_responses.go b/internal/client/disks/create_storage_disk_responses.go index 691899f..45e5589 100644 --- a/internal/client/disks/create_storage_disk_responses.go +++ b/internal/client/disks/create_storage_disk_responses.go @@ -6,14 +6,11 @@ package disks // 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" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -181,102 +178,3 @@ func (o *CreateStorageDiskDefault) readResponse(response runtime.ClientResponse, return nil } - -/* -CreateStorageDiskBody create storage disk body -swagger:model CreateStorageDiskBody -*/ -type CreateStorageDiskBody struct { - - // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` - - // disk - Disk *models.Disk `json:"disk,omitempty"` -} - -// Validate validates this create storage disk body -func (o *CreateStorageDiskBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDisk(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateStorageDiskBody) validateDisk(formats strfmt.Registry) error { - if swag.IsZero(o.Disk) { // not required - return nil - } - - if o.Disk != nil { - if err := o.Disk.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "disk") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "disk") - } - return err - } - } - - return nil -} - -// ContextValidate validate this create storage disk body based on the context it is used -func (o *CreateStorageDiskBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateDisk(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateStorageDiskBody) contextValidateDisk(ctx context.Context, formats strfmt.Registry) error { - - if o.Disk != nil { - - if swag.IsZero(o.Disk) { // not required - return nil - } - - if err := o.Disk.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "disk") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "disk") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *CreateStorageDiskBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateStorageDiskBody) UnmarshalBinary(b []byte) error { - var res CreateStorageDiskBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/machine_types/get_machine_type_live_utilization_parameters.go b/internal/client/machine_types/get_machine_type_live_utilization_parameters.go new file mode 100644 index 0000000..5a0aad4 --- /dev/null +++ b/internal/client/machine_types/get_machine_type_live_utilization_parameters.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine_types + +// 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" +) + +// NewGetMachineTypeLiveUtilizationParams creates a new GetMachineTypeLiveUtilizationParams 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 NewGetMachineTypeLiveUtilizationParams() *GetMachineTypeLiveUtilizationParams { + return &GetMachineTypeLiveUtilizationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetMachineTypeLiveUtilizationParamsWithTimeout creates a new GetMachineTypeLiveUtilizationParams object +// with the ability to set a timeout on a request. +func NewGetMachineTypeLiveUtilizationParamsWithTimeout(timeout time.Duration) *GetMachineTypeLiveUtilizationParams { + return &GetMachineTypeLiveUtilizationParams{ + timeout: timeout, + } +} + +// NewGetMachineTypeLiveUtilizationParamsWithContext creates a new GetMachineTypeLiveUtilizationParams object +// with the ability to set a context for a request. +func NewGetMachineTypeLiveUtilizationParamsWithContext(ctx context.Context) *GetMachineTypeLiveUtilizationParams { + return &GetMachineTypeLiveUtilizationParams{ + Context: ctx, + } +} + +// NewGetMachineTypeLiveUtilizationParamsWithHTTPClient creates a new GetMachineTypeLiveUtilizationParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetMachineTypeLiveUtilizationParamsWithHTTPClient(client *http.Client) *GetMachineTypeLiveUtilizationParams { + return &GetMachineTypeLiveUtilizationParams{ + HTTPClient: client, + } +} + +/* +GetMachineTypeLiveUtilizationParams contains all the parameters to send to the API endpoint + + for the get machine type live utilization operation. + + Typically these are written to a http.Request. +*/ +type GetMachineTypeLiveUtilizationParams struct { + + // DataCenterID. + DataCenterID string + + // MachineType. + MachineType string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get machine type live utilization params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMachineTypeLiveUtilizationParams) WithDefaults() *GetMachineTypeLiveUtilizationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get machine type live utilization params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMachineTypeLiveUtilizationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) WithTimeout(timeout time.Duration) *GetMachineTypeLiveUtilizationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) WithContext(ctx context.Context) *GetMachineTypeLiveUtilizationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) WithHTTPClient(client *http.Client) *GetMachineTypeLiveUtilizationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenterID adds the dataCenterID to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) WithDataCenterID(dataCenterID string) *GetMachineTypeLiveUtilizationParams { + o.SetDataCenterID(dataCenterID) + return o +} + +// SetDataCenterID adds the dataCenterId to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) SetDataCenterID(dataCenterID string) { + o.DataCenterID = dataCenterID +} + +// WithMachineType adds the machineType to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) WithMachineType(machineType string) *GetMachineTypeLiveUtilizationParams { + o.SetMachineType(machineType) + return o +} + +// SetMachineType adds the machineType to the get machine type live utilization params +func (o *GetMachineTypeLiveUtilizationParams) SetMachineType(machineType string) { + o.MachineType = machineType +} + +// WriteToRequest writes these params to a swagger request +func (o *GetMachineTypeLiveUtilizationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param dataCenterId + if err := r.SetPathParam("dataCenterId", o.DataCenterID); err != nil { + return err + } + + // path param machineType + if err := r.SetPathParam("machineType", o.MachineType); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/machine_types/get_machine_type_live_utilization_responses.go b/internal/client/machine_types/get_machine_type_live_utilization_responses.go new file mode 100644 index 0000000..f2fdd6e --- /dev/null +++ b/internal/client/machine_types/get_machine_type_live_utilization_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine_types + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetMachineTypeLiveUtilizationReader is a Reader for the GetMachineTypeLiveUtilization structure. +type GetMachineTypeLiveUtilizationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetMachineTypeLiveUtilizationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetMachineTypeLiveUtilizationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetMachineTypeLiveUtilizationDefault(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 + } +} + +// NewGetMachineTypeLiveUtilizationOK creates a GetMachineTypeLiveUtilizationOK with default headers values +func NewGetMachineTypeLiveUtilizationOK() *GetMachineTypeLiveUtilizationOK { + return &GetMachineTypeLiveUtilizationOK{} +} + +/* +GetMachineTypeLiveUtilizationOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetMachineTypeLiveUtilizationOK struct { + Payload *models.GetMachineTypeLiveUtilizationResponse +} + +// IsSuccess returns true when this get machine type live utilization o k response has a 2xx status code +func (o *GetMachineTypeLiveUtilizationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get machine type live utilization o k response has a 3xx status code +func (o *GetMachineTypeLiveUtilizationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get machine type live utilization o k response has a 4xx status code +func (o *GetMachineTypeLiveUtilizationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get machine type live utilization o k response has a 5xx status code +func (o *GetMachineTypeLiveUtilizationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get machine type live utilization o k response a status code equal to that given +func (o *GetMachineTypeLiveUtilizationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get machine type live utilization o k response +func (o *GetMachineTypeLiveUtilizationOK) Code() int { + return 200 +} + +func (o *GetMachineTypeLiveUtilizationOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}/live-utilization][%d] getMachineTypeLiveUtilizationOK %+v", 200, o.Payload) +} + +func (o *GetMachineTypeLiveUtilizationOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}/live-utilization][%d] getMachineTypeLiveUtilizationOK %+v", 200, o.Payload) +} + +func (o *GetMachineTypeLiveUtilizationOK) GetPayload() *models.GetMachineTypeLiveUtilizationResponse { + return o.Payload +} + +func (o *GetMachineTypeLiveUtilizationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetMachineTypeLiveUtilizationResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetMachineTypeLiveUtilizationDefault creates a GetMachineTypeLiveUtilizationDefault with default headers values +func NewGetMachineTypeLiveUtilizationDefault(code int) *GetMachineTypeLiveUtilizationDefault { + return &GetMachineTypeLiveUtilizationDefault{ + _statusCode: code, + } +} + +/* +GetMachineTypeLiveUtilizationDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetMachineTypeLiveUtilizationDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get machine type live utilization default response has a 2xx status code +func (o *GetMachineTypeLiveUtilizationDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get machine type live utilization default response has a 3xx status code +func (o *GetMachineTypeLiveUtilizationDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get machine type live utilization default response has a 4xx status code +func (o *GetMachineTypeLiveUtilizationDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get machine type live utilization default response has a 5xx status code +func (o *GetMachineTypeLiveUtilizationDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get machine type live utilization default response a status code equal to that given +func (o *GetMachineTypeLiveUtilizationDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get machine type live utilization default response +func (o *GetMachineTypeLiveUtilizationDefault) Code() int { + return o._statusCode +} + +func (o *GetMachineTypeLiveUtilizationDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}/live-utilization][%d] GetMachineTypeLiveUtilization default %+v", o._statusCode, o.Payload) +} + +func (o *GetMachineTypeLiveUtilizationDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}/live-utilization][%d] GetMachineTypeLiveUtilization default %+v", o._statusCode, o.Payload) +} + +func (o *GetMachineTypeLiveUtilizationDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetMachineTypeLiveUtilizationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/machine_types/get_machine_type_parameters.go b/internal/client/machine_types/get_machine_type_parameters.go new file mode 100644 index 0000000..a17d33f --- /dev/null +++ b/internal/client/machine_types/get_machine_type_parameters.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine_types + +// 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" +) + +// NewGetMachineTypeParams creates a new GetMachineTypeParams 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 NewGetMachineTypeParams() *GetMachineTypeParams { + return &GetMachineTypeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetMachineTypeParamsWithTimeout creates a new GetMachineTypeParams object +// with the ability to set a timeout on a request. +func NewGetMachineTypeParamsWithTimeout(timeout time.Duration) *GetMachineTypeParams { + return &GetMachineTypeParams{ + timeout: timeout, + } +} + +// NewGetMachineTypeParamsWithContext creates a new GetMachineTypeParams object +// with the ability to set a context for a request. +func NewGetMachineTypeParamsWithContext(ctx context.Context) *GetMachineTypeParams { + return &GetMachineTypeParams{ + Context: ctx, + } +} + +// NewGetMachineTypeParamsWithHTTPClient creates a new GetMachineTypeParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetMachineTypeParamsWithHTTPClient(client *http.Client) *GetMachineTypeParams { + return &GetMachineTypeParams{ + HTTPClient: client, + } +} + +/* +GetMachineTypeParams contains all the parameters to send to the API endpoint + + for the get machine type operation. + + Typically these are written to a http.Request. +*/ +type GetMachineTypeParams struct { + + // DataCenterID. + DataCenterID string + + // MachineType. + MachineType string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get machine type params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMachineTypeParams) WithDefaults() *GetMachineTypeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get machine type params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMachineTypeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get machine type params +func (o *GetMachineTypeParams) WithTimeout(timeout time.Duration) *GetMachineTypeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get machine type params +func (o *GetMachineTypeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get machine type params +func (o *GetMachineTypeParams) WithContext(ctx context.Context) *GetMachineTypeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get machine type params +func (o *GetMachineTypeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get machine type params +func (o *GetMachineTypeParams) WithHTTPClient(client *http.Client) *GetMachineTypeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get machine type params +func (o *GetMachineTypeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenterID adds the dataCenterID to the get machine type params +func (o *GetMachineTypeParams) WithDataCenterID(dataCenterID string) *GetMachineTypeParams { + o.SetDataCenterID(dataCenterID) + return o +} + +// SetDataCenterID adds the dataCenterId to the get machine type params +func (o *GetMachineTypeParams) SetDataCenterID(dataCenterID string) { + o.DataCenterID = dataCenterID +} + +// WithMachineType adds the machineType to the get machine type params +func (o *GetMachineTypeParams) WithMachineType(machineType string) *GetMachineTypeParams { + o.SetMachineType(machineType) + return o +} + +// SetMachineType adds the machineType to the get machine type params +func (o *GetMachineTypeParams) SetMachineType(machineType string) { + o.MachineType = machineType +} + +// WriteToRequest writes these params to a swagger request +func (o *GetMachineTypeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param dataCenterId + if err := r.SetPathParam("dataCenterId", o.DataCenterID); err != nil { + return err + } + + // path param machineType + if err := r.SetPathParam("machineType", o.MachineType); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/machine_types/get_machine_type_responses.go b/internal/client/machine_types/get_machine_type_responses.go new file mode 100644 index 0000000..8fca720 --- /dev/null +++ b/internal/client/machine_types/get_machine_type_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine_types + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// GetMachineTypeReader is a Reader for the GetMachineType structure. +type GetMachineTypeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetMachineTypeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetMachineTypeOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetMachineTypeDefault(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 + } +} + +// NewGetMachineTypeOK creates a GetMachineTypeOK with default headers values +func NewGetMachineTypeOK() *GetMachineTypeOK { + return &GetMachineTypeOK{} +} + +/* +GetMachineTypeOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetMachineTypeOK struct { + Payload *models.GetMachineTypeResponse +} + +// IsSuccess returns true when this get machine type o k response has a 2xx status code +func (o *GetMachineTypeOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get machine type o k response has a 3xx status code +func (o *GetMachineTypeOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get machine type o k response has a 4xx status code +func (o *GetMachineTypeOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get machine type o k response has a 5xx status code +func (o *GetMachineTypeOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get machine type o k response a status code equal to that given +func (o *GetMachineTypeOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get machine type o k response +func (o *GetMachineTypeOK) Code() int { + return 200 +} + +func (o *GetMachineTypeOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}][%d] getMachineTypeOK %+v", 200, o.Payload) +} + +func (o *GetMachineTypeOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}][%d] getMachineTypeOK %+v", 200, o.Payload) +} + +func (o *GetMachineTypeOK) GetPayload() *models.GetMachineTypeResponse { + return o.Payload +} + +func (o *GetMachineTypeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetMachineTypeResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetMachineTypeDefault creates a GetMachineTypeDefault with default headers values +func NewGetMachineTypeDefault(code int) *GetMachineTypeDefault { + return &GetMachineTypeDefault{ + _statusCode: code, + } +} + +/* +GetMachineTypeDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetMachineTypeDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this get machine type default response has a 2xx status code +func (o *GetMachineTypeDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get machine type default response has a 3xx status code +func (o *GetMachineTypeDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get machine type default response has a 4xx status code +func (o *GetMachineTypeDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get machine type default response has a 5xx status code +func (o *GetMachineTypeDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get machine type default response a status code equal to that given +func (o *GetMachineTypeDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the get machine type default response +func (o *GetMachineTypeDefault) Code() int { + return o._statusCode +} + +func (o *GetMachineTypeDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}][%d] GetMachineType default %+v", o._statusCode, o.Payload) +} + +func (o *GetMachineTypeDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types/{machineType}][%d] GetMachineType default %+v", o._statusCode, o.Payload) +} + +func (o *GetMachineTypeDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *GetMachineTypeDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/machine_types/list_machine_types_parameters.go b/internal/client/machine_types/list_machine_types_parameters.go new file mode 100644 index 0000000..858a4e1 --- /dev/null +++ b/internal/client/machine_types/list_machine_types_parameters.go @@ -0,0 +1,148 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine_types + +// 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" +) + +// NewListMachineTypesParams creates a new ListMachineTypesParams 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 NewListMachineTypesParams() *ListMachineTypesParams { + return &ListMachineTypesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListMachineTypesParamsWithTimeout creates a new ListMachineTypesParams object +// with the ability to set a timeout on a request. +func NewListMachineTypesParamsWithTimeout(timeout time.Duration) *ListMachineTypesParams { + return &ListMachineTypesParams{ + timeout: timeout, + } +} + +// NewListMachineTypesParamsWithContext creates a new ListMachineTypesParams object +// with the ability to set a context for a request. +func NewListMachineTypesParamsWithContext(ctx context.Context) *ListMachineTypesParams { + return &ListMachineTypesParams{ + Context: ctx, + } +} + +// NewListMachineTypesParamsWithHTTPClient creates a new ListMachineTypesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListMachineTypesParamsWithHTTPClient(client *http.Client) *ListMachineTypesParams { + return &ListMachineTypesParams{ + HTTPClient: client, + } +} + +/* +ListMachineTypesParams contains all the parameters to send to the API endpoint + + for the list machine types operation. + + Typically these are written to a http.Request. +*/ +type ListMachineTypesParams struct { + + // DataCenterID. + DataCenterID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list machine types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListMachineTypesParams) WithDefaults() *ListMachineTypesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list machine types params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListMachineTypesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list machine types params +func (o *ListMachineTypesParams) WithTimeout(timeout time.Duration) *ListMachineTypesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list machine types params +func (o *ListMachineTypesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list machine types params +func (o *ListMachineTypesParams) WithContext(ctx context.Context) *ListMachineTypesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list machine types params +func (o *ListMachineTypesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list machine types params +func (o *ListMachineTypesParams) WithHTTPClient(client *http.Client) *ListMachineTypesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list machine types params +func (o *ListMachineTypesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDataCenterID adds the dataCenterID to the list machine types params +func (o *ListMachineTypesParams) WithDataCenterID(dataCenterID string) *ListMachineTypesParams { + o.SetDataCenterID(dataCenterID) + return o +} + +// SetDataCenterID adds the dataCenterId to the list machine types params +func (o *ListMachineTypesParams) SetDataCenterID(dataCenterID string) { + o.DataCenterID = dataCenterID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListMachineTypesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param dataCenterId + if err := r.SetPathParam("dataCenterId", o.DataCenterID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/machine_types/list_machine_types_responses.go b/internal/client/machine_types/list_machine_types_responses.go new file mode 100644 index 0000000..5652c22 --- /dev/null +++ b/internal/client/machine_types/list_machine_types_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine_types + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// ListMachineTypesReader is a Reader for the ListMachineTypes structure. +type ListMachineTypesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListMachineTypesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListMachineTypesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListMachineTypesDefault(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 + } +} + +// NewListMachineTypesOK creates a ListMachineTypesOK with default headers values +func NewListMachineTypesOK() *ListMachineTypesOK { + return &ListMachineTypesOK{} +} + +/* +ListMachineTypesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListMachineTypesOK struct { + Payload *models.ListMachineTypesResponse +} + +// IsSuccess returns true when this list machine types o k response has a 2xx status code +func (o *ListMachineTypesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list machine types o k response has a 3xx status code +func (o *ListMachineTypesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list machine types o k response has a 4xx status code +func (o *ListMachineTypesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list machine types o k response has a 5xx status code +func (o *ListMachineTypesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list machine types o k response a status code equal to that given +func (o *ListMachineTypesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list machine types o k response +func (o *ListMachineTypesOK) Code() int { + return 200 +} + +func (o *ListMachineTypesOK) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types][%d] listMachineTypesOK %+v", 200, o.Payload) +} + +func (o *ListMachineTypesOK) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types][%d] listMachineTypesOK %+v", 200, o.Payload) +} + +func (o *ListMachineTypesOK) GetPayload() *models.ListMachineTypesResponse { + return o.Payload +} + +func (o *ListMachineTypesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ListMachineTypesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListMachineTypesDefault creates a ListMachineTypesDefault with default headers values +func NewListMachineTypesDefault(code int) *ListMachineTypesDefault { + return &ListMachineTypesDefault{ + _statusCode: code, + } +} + +/* +ListMachineTypesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListMachineTypesDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this list machine types default response has a 2xx status code +func (o *ListMachineTypesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list machine types default response has a 3xx status code +func (o *ListMachineTypesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list machine types default response has a 4xx status code +func (o *ListMachineTypesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list machine types default response has a 5xx status code +func (o *ListMachineTypesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list machine types default response a status code equal to that given +func (o *ListMachineTypesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list machine types default response +func (o *ListMachineTypesDefault) Code() int { + return o._statusCode +} + +func (o *ListMachineTypesDefault) Error() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types][%d] ListMachineTypes default %+v", o._statusCode, o.Payload) +} + +func (o *ListMachineTypesDefault) String() string { + return fmt.Sprintf("[GET /v1/data-centers/{dataCenterId}/machine-types][%d] ListMachineTypes default %+v", o._statusCode, o.Payload) +} + +func (o *ListMachineTypesDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *ListMachineTypesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/machine_types/machine_types_client.go b/internal/client/machine_types/machine_types_client.go new file mode 100644 index 0000000..77a8ef5 --- /dev/null +++ b/internal/client/machine_types/machine_types_client.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package machine_types + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// New creates a new machine types API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for machine types API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetMachineType(params *GetMachineTypeParams, opts ...ClientOption) (*GetMachineTypeOK, error) + + GetMachineTypeLiveUtilization(params *GetMachineTypeLiveUtilizationParams, opts ...ClientOption) (*GetMachineTypeLiveUtilizationOK, error) + + ListMachineTypes(params *ListMachineTypesParams, opts ...ClientOption) (*ListMachineTypesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetMachineType gets +*/ +func (a *Client) GetMachineType(params *GetMachineTypeParams, opts ...ClientOption) (*GetMachineTypeOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetMachineTypeParams() + } + op := &runtime.ClientOperation{ + ID: "GetMachineType", + Method: "GET", + PathPattern: "/v1/data-centers/{dataCenterId}/machine-types/{machineType}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetMachineTypeReader{formats: a.formats}, + 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.(*GetMachineTypeOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetMachineTypeDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +GetMachineTypeLiveUtilization gets +*/ +func (a *Client) GetMachineTypeLiveUtilization(params *GetMachineTypeLiveUtilizationParams, opts ...ClientOption) (*GetMachineTypeLiveUtilizationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetMachineTypeLiveUtilizationParams() + } + op := &runtime.ClientOperation{ + ID: "GetMachineTypeLiveUtilization", + Method: "GET", + PathPattern: "/v1/data-centers/{dataCenterId}/machine-types/{machineType}/live-utilization", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetMachineTypeLiveUtilizationReader{formats: a.formats}, + 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.(*GetMachineTypeLiveUtilizationOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetMachineTypeLiveUtilizationDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +/* +ListMachineTypes gets +*/ +func (a *Client) ListMachineTypes(params *ListMachineTypesParams, opts ...ClientOption) (*ListMachineTypesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListMachineTypesParams() + } + op := &runtime.ClientOperation{ + ID: "ListMachineTypes", + Method: "GET", + PathPattern: "/v1/data-centers/{dataCenterId}/machine-types", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListMachineTypesReader{formats: a.formats}, + 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.(*ListMachineTypesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListMachineTypesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/internal/client/networks/create_network_parameters.go b/internal/client/networks/create_network_parameters.go index 1c6a0fb..9c30039 100644 --- a/internal/client/networks/create_network_parameters.go +++ b/internal/client/networks/create_network_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewCreateNetworkParams creates a new CreateNetworkParams object, @@ -62,7 +64,7 @@ CreateNetworkParams contains all the parameters to send to the API endpoint type CreateNetworkParams struct { // Body. - Body CreateNetworkBody + Body *models.CreateNetworkBody // ProjectID. ProjectID string @@ -121,13 +123,13 @@ func (o *CreateNetworkParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create network params -func (o *CreateNetworkParams) WithBody(body CreateNetworkBody) *CreateNetworkParams { +func (o *CreateNetworkParams) WithBody(body *models.CreateNetworkBody) *CreateNetworkParams { o.SetBody(body) return o } // SetBody adds the body to the create network params -func (o *CreateNetworkParams) SetBody(body CreateNetworkBody) { +func (o *CreateNetworkParams) SetBody(body *models.CreateNetworkBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *CreateNetworkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param projectId diff --git a/internal/client/networks/create_network_responses.go b/internal/client/networks/create_network_responses.go index d87ca91..d743d27 100644 --- a/internal/client/networks/create_network_responses.go +++ b/internal/client/networks/create_network_responses.go @@ -6,15 +6,11 @@ package networks // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,167 +178,3 @@ func (o *CreateNetworkDefault) readResponse(response runtime.ClientResponse, con return nil } - -/* -CreateNetworkBody create network body -swagger:model CreateNetworkBody -*/ -type CreateNetworkBody struct { - - // cidr prefix - // Required: true - CidrPrefix *string `json:"cidrPrefix"` - - // data center Id - // Required: true - DataCenterID *string `json:"dataCenterId"` - - // id - // Required: true - ID *string `json:"id"` - - // network Id - // Required: true - NetworkID *string `json:"networkId"` - - // vrouter size - VrouterSize *models.VRouterSize `json:"vrouterSize,omitempty"` -} - -// Validate validates this create network body -func (o *CreateNetworkBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateCidrPrefix(formats); err != nil { - res = append(res, err) - } - - if err := o.validateDataCenterID(formats); err != nil { - res = append(res, err) - } - - if err := o.validateID(formats); err != nil { - res = append(res, err) - } - - if err := o.validateNetworkID(formats); err != nil { - res = append(res, err) - } - - if err := o.validateVrouterSize(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateNetworkBody) validateCidrPrefix(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"cidrPrefix", "body", o.CidrPrefix); err != nil { - return err - } - - return nil -} - -func (o *CreateNetworkBody) validateDataCenterID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"dataCenterId", "body", o.DataCenterID); err != nil { - return err - } - - return nil -} - -func (o *CreateNetworkBody) validateID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"id", "body", o.ID); err != nil { - return err - } - - return nil -} - -func (o *CreateNetworkBody) validateNetworkID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"networkId", "body", o.NetworkID); err != nil { - return err - } - - return nil -} - -func (o *CreateNetworkBody) validateVrouterSize(formats strfmt.Registry) error { - if swag.IsZero(o.VrouterSize) { // not required - return nil - } - - if o.VrouterSize != nil { - if err := o.VrouterSize.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "vrouterSize") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "vrouterSize") - } - return err - } - } - - return nil -} - -// ContextValidate validate this create network body based on the context it is used -func (o *CreateNetworkBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateVrouterSize(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateNetworkBody) contextValidateVrouterSize(ctx context.Context, formats strfmt.Registry) error { - - if o.VrouterSize != nil { - - if swag.IsZero(o.VrouterSize) { // not required - return nil - } - - if err := o.VrouterSize.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "vrouterSize") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "vrouterSize") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *CreateNetworkBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateNetworkBody) UnmarshalBinary(b []byte) error { - var res CreateNetworkBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/networks/delete_network_parameters.go b/internal/client/networks/delete_network_parameters.go index 2341b04..5fa1ecc 100644 --- a/internal/client/networks/delete_network_parameters.go +++ b/internal/client/networks/delete_network_parameters.go @@ -64,9 +64,6 @@ type DeleteNetworkParams struct { // ID. ID string - // NetworkID. - NetworkID string - // ProjectID. ProjectID string @@ -134,17 +131,6 @@ func (o *DeleteNetworkParams) SetID(id string) { o.ID = id } -// WithNetworkID adds the networkID to the delete network params -func (o *DeleteNetworkParams) WithNetworkID(networkID string) *DeleteNetworkParams { - o.SetNetworkID(networkID) - return o -} - -// SetNetworkID adds the networkId to the delete network params -func (o *DeleteNetworkParams) SetNetworkID(networkID string) { - o.NetworkID = networkID -} - // WithProjectID adds the projectID to the delete network params func (o *DeleteNetworkParams) WithProjectID(projectID string) *DeleteNetworkParams { o.SetProjectID(projectID) @@ -169,16 +155,6 @@ func (o *DeleteNetworkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt return err } - // query param networkId - qrNetworkID := o.NetworkID - qNetworkID := qrNetworkID - if qNetworkID != "" { - - if err := r.SetQueryParam("networkId", qNetworkID); err != nil { - return err - } - } - // path param projectId if err := r.SetPathParam("projectId", o.ProjectID); err != nil { return err diff --git a/internal/client/networks/start_network_parameters.go b/internal/client/networks/start_network_parameters.go index 2fb0bd0..b1184b6 100644 --- a/internal/client/networks/start_network_parameters.go +++ b/internal/client/networks/start_network_parameters.go @@ -64,9 +64,6 @@ type StartNetworkParams struct { // ID. ID string - // NetworkID. - NetworkID string - // ProjectID. ProjectID string @@ -134,17 +131,6 @@ func (o *StartNetworkParams) SetID(id string) { o.ID = id } -// WithNetworkID adds the networkID to the start network params -func (o *StartNetworkParams) WithNetworkID(networkID string) *StartNetworkParams { - o.SetNetworkID(networkID) - return o -} - -// SetNetworkID adds the networkId to the start network params -func (o *StartNetworkParams) SetNetworkID(networkID string) { - o.NetworkID = networkID -} - // WithProjectID adds the projectID to the start network params func (o *StartNetworkParams) WithProjectID(projectID string) *StartNetworkParams { o.SetProjectID(projectID) @@ -169,16 +155,6 @@ func (o *StartNetworkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. return err } - // query param networkId - qrNetworkID := o.NetworkID - qNetworkID := qrNetworkID - if qNetworkID != "" { - - if err := r.SetQueryParam("networkId", qNetworkID); err != nil { - return err - } - } - // path param projectId if err := r.SetPathParam("projectId", o.ProjectID); err != nil { return err diff --git a/internal/client/networks/stop_network_parameters.go b/internal/client/networks/stop_network_parameters.go index 88055e7..547e48b 100644 --- a/internal/client/networks/stop_network_parameters.go +++ b/internal/client/networks/stop_network_parameters.go @@ -64,9 +64,6 @@ type StopNetworkParams struct { // ID. ID string - // NetworkID. - NetworkID string - // ProjectID. ProjectID string @@ -134,17 +131,6 @@ func (o *StopNetworkParams) SetID(id string) { o.ID = id } -// WithNetworkID adds the networkID to the stop network params -func (o *StopNetworkParams) WithNetworkID(networkID string) *StopNetworkParams { - o.SetNetworkID(networkID) - return o -} - -// SetNetworkID adds the networkId to the stop network params -func (o *StopNetworkParams) SetNetworkID(networkID string) { - o.NetworkID = networkID -} - // WithProjectID adds the projectID to the stop network params func (o *StopNetworkParams) WithProjectID(projectID string) *StopNetworkParams { o.SetProjectID(projectID) @@ -169,16 +155,6 @@ func (o *StopNetworkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } - // query param networkId - qrNetworkID := o.NetworkID - qNetworkID := qrNetworkID - if qNetworkID != "" { - - if err := r.SetQueryParam("networkId", qNetworkID); err != nil { - return err - } - } - // path param projectId if err := r.SetPathParam("projectId", o.ProjectID); err != nil { return err diff --git a/internal/client/object_storage/activate_parameters.go b/internal/client/object_storage/activate_parameters.go index 6be357e..5e3075a 100644 --- a/internal/client/object_storage/activate_parameters.go +++ b/internal/client/object_storage/activate_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewActivateParams creates a new ActivateParams object, @@ -62,7 +64,7 @@ ActivateParams contains all the parameters to send to the API endpoint type ActivateParams struct { // Body. - Body ActivateBody + Body *models.ActivateBody // ProjectID. ProjectID string @@ -121,13 +123,13 @@ func (o *ActivateParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the activate params -func (o *ActivateParams) WithBody(body ActivateBody) *ActivateParams { +func (o *ActivateParams) WithBody(body *models.ActivateBody) *ActivateParams { o.SetBody(body) return o } // SetBody adds the body to the activate params -func (o *ActivateParams) SetBody(body ActivateBody) { +func (o *ActivateParams) SetBody(body *models.ActivateBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *ActivateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param projectId diff --git a/internal/client/object_storage/activate_responses.go b/internal/client/object_storage/activate_responses.go index d9a7476..0d86cf0 100644 --- a/internal/client/object_storage/activate_responses.go +++ b/internal/client/object_storage/activate_responses.go @@ -6,13 +6,11 @@ package object_storage // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -180,41 +178,3 @@ func (o *ActivateDefault) readResponse(response runtime.ClientResponse, consumer return nil } - -/* -ActivateBody activate body -swagger:model ActivateBody -*/ -type ActivateBody struct { - - // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` -} - -// Validate validates this activate body -func (o *ActivateBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this activate body based on context it is used -func (o *ActivateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *ActivateBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *ActivateBody) UnmarshalBinary(b []byte) error { - var res ActivateBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/object_storage/create_object_storage_user_parameters.go b/internal/client/object_storage/create_object_storage_user_parameters.go index 615f6c5..ac854ea 100644 --- a/internal/client/object_storage/create_object_storage_user_parameters.go +++ b/internal/client/object_storage/create_object_storage_user_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewCreateObjectStorageUserParams creates a new CreateObjectStorageUserParams object, @@ -62,7 +64,7 @@ CreateObjectStorageUserParams contains all the parameters to send to the API end type CreateObjectStorageUserParams struct { // Body. - Body CreateObjectStorageUserBody + Body *models.CreateObjectStorageUserBody // ProjectID. ProjectID string @@ -121,13 +123,13 @@ func (o *CreateObjectStorageUserParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create object storage user params -func (o *CreateObjectStorageUserParams) WithBody(body CreateObjectStorageUserBody) *CreateObjectStorageUserParams { +func (o *CreateObjectStorageUserParams) WithBody(body *models.CreateObjectStorageUserBody) *CreateObjectStorageUserParams { o.SetBody(body) return o } // SetBody adds the body to the create object storage user params -func (o *CreateObjectStorageUserParams) SetBody(body CreateObjectStorageUserBody) { +func (o *CreateObjectStorageUserParams) SetBody(body *models.CreateObjectStorageUserBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *CreateObjectStorageUserParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param projectId diff --git a/internal/client/object_storage/create_object_storage_user_responses.go b/internal/client/object_storage/create_object_storage_user_responses.go index 43b8ccd..e2c6353 100644 --- a/internal/client/object_storage/create_object_storage_user_responses.go +++ b/internal/client/object_storage/create_object_storage_user_responses.go @@ -6,13 +6,11 @@ package object_storage // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,41 +180,3 @@ func (o *CreateObjectStorageUserDefault) readResponse(response runtime.ClientRes return nil } - -/* -CreateObjectStorageUserBody create object storage user body -swagger:model CreateObjectStorageUserBody -*/ -type CreateObjectStorageUserBody struct { - - // id - ID string `json:"id,omitempty"` -} - -// Validate validates this create object storage user body -func (o *CreateObjectStorageUserBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this create object storage user body based on context it is used -func (o *CreateObjectStorageUserBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *CreateObjectStorageUserBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateObjectStorageUserBody) UnmarshalBinary(b []byte) error { - var res CreateObjectStorageUserBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/object_storage/delete_object_storage_key_parameters.go b/internal/client/object_storage/delete_object_storage_key_parameters.go index 6e78fca..b2fa08b 100644 --- a/internal/client/object_storage/delete_object_storage_key_parameters.go +++ b/internal/client/object_storage/delete_object_storage_key_parameters.go @@ -62,7 +62,7 @@ DeleteObjectStorageKeyParams contains all the parameters to send to the API endp type DeleteObjectStorageKeyParams struct { // AccessKey. - AccessKey *string + AccessKey string // ID. ID string @@ -124,13 +124,13 @@ func (o *DeleteObjectStorageKeyParams) SetHTTPClient(client *http.Client) { } // WithAccessKey adds the accessKey to the delete object storage key params -func (o *DeleteObjectStorageKeyParams) WithAccessKey(accessKey *string) *DeleteObjectStorageKeyParams { +func (o *DeleteObjectStorageKeyParams) WithAccessKey(accessKey string) *DeleteObjectStorageKeyParams { o.SetAccessKey(accessKey) return o } // SetAccessKey adds the accessKey to the delete object storage key params -func (o *DeleteObjectStorageKeyParams) SetAccessKey(accessKey *string) { +func (o *DeleteObjectStorageKeyParams) SetAccessKey(accessKey string) { o.AccessKey = accessKey } @@ -164,21 +164,9 @@ func (o *DeleteObjectStorageKeyParams) WriteToRequest(r runtime.ClientRequest, r } var res []error - if o.AccessKey != nil { - - // query param accessKey - var qrAccessKey string - - if o.AccessKey != nil { - qrAccessKey = *o.AccessKey - } - qAccessKey := qrAccessKey - if qAccessKey != "" { - - if err := r.SetQueryParam("accessKey", qAccessKey); err != nil { - return err - } - } + // path param accessKey + if err := r.SetPathParam("accessKey", o.AccessKey); err != nil { + return err } // path param id diff --git a/internal/client/object_storage/delete_object_storage_key_responses.go b/internal/client/object_storage/delete_object_storage_key_responses.go index 05339bc..228f796 100644 --- a/internal/client/object_storage/delete_object_storage_key_responses.go +++ b/internal/client/object_storage/delete_object_storage_key_responses.go @@ -86,11 +86,11 @@ func (o *DeleteObjectStorageKeyOK) Code() int { } func (o *DeleteObjectStorageKeyOK) Error() string { - return fmt.Sprintf("[POST /v1/projects/{projectId}/object-storage/users/{id}/keys][%d] deleteObjectStorageKeyOK %+v", 200, o.Payload) + return fmt.Sprintf("[DELETE /v1/projects/{projectId}/object-storage/users/{id}/keys/{accessKey}][%d] deleteObjectStorageKeyOK %+v", 200, o.Payload) } func (o *DeleteObjectStorageKeyOK) String() string { - return fmt.Sprintf("[POST /v1/projects/{projectId}/object-storage/users/{id}/keys][%d] deleteObjectStorageKeyOK %+v", 200, o.Payload) + return fmt.Sprintf("[DELETE /v1/projects/{projectId}/object-storage/users/{id}/keys/{accessKey}][%d] deleteObjectStorageKeyOK %+v", 200, o.Payload) } func (o *DeleteObjectStorageKeyOK) GetPayload() models.DeleteObjectStorageKeyResponse { @@ -156,11 +156,11 @@ func (o *DeleteObjectStorageKeyDefault) Code() int { } func (o *DeleteObjectStorageKeyDefault) Error() string { - return fmt.Sprintf("[POST /v1/projects/{projectId}/object-storage/users/{id}/keys][%d] DeleteObjectStorageKey default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[DELETE /v1/projects/{projectId}/object-storage/users/{id}/keys/{accessKey}][%d] DeleteObjectStorageKey default %+v", o._statusCode, o.Payload) } func (o *DeleteObjectStorageKeyDefault) String() string { - return fmt.Sprintf("[POST /v1/projects/{projectId}/object-storage/users/{id}/keys][%d] DeleteObjectStorageKey default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[DELETE /v1/projects/{projectId}/object-storage/users/{id}/keys/{accessKey}][%d] DeleteObjectStorageKey default %+v", o._statusCode, o.Payload) } func (o *DeleteObjectStorageKeyDefault) GetPayload() *models.Status { diff --git a/internal/client/object_storage/generate_object_storage_key_parameters.go b/internal/client/object_storage/generate_object_storage_key_parameters.go index e880fb3..d183d50 100644 --- a/internal/client/object_storage/generate_object_storage_key_parameters.go +++ b/internal/client/object_storage/generate_object_storage_key_parameters.go @@ -61,9 +61,6 @@ GenerateObjectStorageKeyParams contains all the parameters to send to the API en */ type GenerateObjectStorageKeyParams struct { - // Body. - Body interface{} - // ID. ID string @@ -123,17 +120,6 @@ func (o *GenerateObjectStorageKeyParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithBody adds the body to the generate object storage key params -func (o *GenerateObjectStorageKeyParams) WithBody(body interface{}) *GenerateObjectStorageKeyParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the generate object storage key params -func (o *GenerateObjectStorageKeyParams) SetBody(body interface{}) { - o.Body = body -} - // WithID adds the id to the generate object storage key params func (o *GenerateObjectStorageKeyParams) WithID(id string) *GenerateObjectStorageKeyParams { o.SetID(id) @@ -163,11 +149,6 @@ func (o *GenerateObjectStorageKeyParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - } // path param id if err := r.SetPathParam("id", o.ID); err != nil { diff --git a/internal/client/object_storage/object_storage_client.go b/internal/client/object_storage/object_storage_client.go index 4a6c371..6c78910 100644 --- a/internal/client/object_storage/object_storage_client.go +++ b/internal/client/object_storage/object_storage_client.go @@ -126,7 +126,7 @@ func (a *Client) CreateObjectStorageUser(params *CreateObjectStorageUserParams, } /* -DeleteObjectStorageKey deletes object storage user +DeleteObjectStorageKey deletes object storage user key */ func (a *Client) DeleteObjectStorageKey(params *DeleteObjectStorageKeyParams, opts ...ClientOption) (*DeleteObjectStorageKeyOK, error) { // TODO: Validate the params before sending @@ -135,8 +135,8 @@ func (a *Client) DeleteObjectStorageKey(params *DeleteObjectStorageKeyParams, op } op := &runtime.ClientOperation{ ID: "DeleteObjectStorageKey", - Method: "POST", - PathPattern: "/v1/projects/{projectId}/object-storage/users/{id}/keys", + Method: "DELETE", + PathPattern: "/v1/projects/{projectId}/object-storage/users/{id}/keys/{accessKey}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"https"}, diff --git a/internal/client/permissions/add_billing_account_user_permission_parameters.go b/internal/client/permissions/add_billing_account_user_permission_parameters.go index 26e72ce..6ba3689 100644 --- a/internal/client/permissions/add_billing_account_user_permission_parameters.go +++ b/internal/client/permissions/add_billing_account_user_permission_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewAddBillingAccountUserPermissionParams creates a new AddBillingAccountUserPermissionParams object, @@ -65,7 +67,7 @@ type AddBillingAccountUserPermissionParams struct { BillingAccountID string // Body. - Body AddBillingAccountUserPermissionBody + Body *models.AddBillingAccountUserPermissionBody timeout time.Duration Context context.Context @@ -132,13 +134,13 @@ func (o *AddBillingAccountUserPermissionParams) SetBillingAccountID(billingAccou } // WithBody adds the body to the add billing account user permission params -func (o *AddBillingAccountUserPermissionParams) WithBody(body AddBillingAccountUserPermissionBody) *AddBillingAccountUserPermissionParams { +func (o *AddBillingAccountUserPermissionParams) WithBody(body *models.AddBillingAccountUserPermissionBody) *AddBillingAccountUserPermissionParams { o.SetBody(body) return o } // SetBody adds the body to the add billing account user permission params -func (o *AddBillingAccountUserPermissionParams) SetBody(body AddBillingAccountUserPermissionBody) { +func (o *AddBillingAccountUserPermissionParams) SetBody(body *models.AddBillingAccountUserPermissionBody) { o.Body = body } @@ -154,8 +156,10 @@ func (o *AddBillingAccountUserPermissionParams) WriteToRequest(r runtime.ClientR if err := r.SetPathParam("billingAccountId", o.BillingAccountID); err != nil { return err } - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } if len(res) > 0 { diff --git a/internal/client/permissions/add_billing_account_user_permission_responses.go b/internal/client/permissions/add_billing_account_user_permission_responses.go index 05f119a..be2ff9e 100644 --- a/internal/client/permissions/add_billing_account_user_permission_responses.go +++ b/internal/client/permissions/add_billing_account_user_permission_responses.go @@ -6,15 +6,11 @@ package permissions // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,124 +178,3 @@ func (o *AddBillingAccountUserPermissionDefault) readResponse(response runtime.C return nil } - -/* -AddBillingAccountUserPermissionBody add billing account user permission body -swagger:model AddBillingAccountUserPermissionBody -*/ -type AddBillingAccountUserPermissionBody struct { - - // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` - - // project Id - ProjectID string `json:"projectId,omitempty"` - - // role - // Required: true - Role *models.Role `json:"role"` - - // user email - // Required: true - UserEmail *string `json:"userEmail"` -} - -// Validate validates this add billing account user permission body -func (o *AddBillingAccountUserPermissionBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateRole(formats); err != nil { - res = append(res, err) - } - - if err := o.validateUserEmail(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddBillingAccountUserPermissionBody) validateRole(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if o.Role != nil { - if err := o.Role.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -func (o *AddBillingAccountUserPermissionBody) validateUserEmail(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"userEmail", "body", o.UserEmail); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this add billing account user permission body based on the context it is used -func (o *AddBillingAccountUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRole(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddBillingAccountUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { - - if o.Role != nil { - - if err := o.Role.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *AddBillingAccountUserPermissionBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddBillingAccountUserPermissionBody) UnmarshalBinary(b []byte) error { - var res AddBillingAccountUserPermissionBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/permissions/add_data_center_user_permission_parameters.go b/internal/client/permissions/add_data_center_user_permission_parameters.go index 83f39b3..b0d4dce 100644 --- a/internal/client/permissions/add_data_center_user_permission_parameters.go +++ b/internal/client/permissions/add_data_center_user_permission_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewAddDataCenterUserPermissionParams creates a new AddDataCenterUserPermissionParams object, @@ -62,7 +64,7 @@ AddDataCenterUserPermissionParams contains all the parameters to send to the API type AddDataCenterUserPermissionParams struct { // Body. - Body AddDataCenterUserPermissionBody + Body *models.AddDataCenterUserPermissionBody // DataCenterID. DataCenterID string @@ -121,13 +123,13 @@ func (o *AddDataCenterUserPermissionParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the add data center user permission params -func (o *AddDataCenterUserPermissionParams) WithBody(body AddDataCenterUserPermissionBody) *AddDataCenterUserPermissionParams { +func (o *AddDataCenterUserPermissionParams) WithBody(body *models.AddDataCenterUserPermissionBody) *AddDataCenterUserPermissionParams { o.SetBody(body) return o } // SetBody adds the body to the add data center user permission params -func (o *AddDataCenterUserPermissionParams) SetBody(body AddDataCenterUserPermissionBody) { +func (o *AddDataCenterUserPermissionParams) SetBody(body *models.AddDataCenterUserPermissionBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *AddDataCenterUserPermissionParams) WriteToRequest(r runtime.ClientReque return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param dataCenterId diff --git a/internal/client/permissions/add_data_center_user_permission_responses.go b/internal/client/permissions/add_data_center_user_permission_responses.go index a0b78cd..3cc3146 100644 --- a/internal/client/permissions/add_data_center_user_permission_responses.go +++ b/internal/client/permissions/add_data_center_user_permission_responses.go @@ -6,15 +6,11 @@ package permissions // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,124 +178,3 @@ func (o *AddDataCenterUserPermissionDefault) readResponse(response runtime.Clien return nil } - -/* -AddDataCenterUserPermissionBody add data center user permission body -swagger:model AddDataCenterUserPermissionBody -*/ -type AddDataCenterUserPermissionBody struct { - - // billing account Id - BillingAccountID string `json:"billingAccountId,omitempty"` - - // project Id - ProjectID string `json:"projectId,omitempty"` - - // role - // Required: true - Role *models.Role `json:"role"` - - // user email - // Required: true - UserEmail *string `json:"userEmail"` -} - -// Validate validates this add data center user permission body -func (o *AddDataCenterUserPermissionBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateRole(formats); err != nil { - res = append(res, err) - } - - if err := o.validateUserEmail(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddDataCenterUserPermissionBody) validateRole(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if o.Role != nil { - if err := o.Role.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -func (o *AddDataCenterUserPermissionBody) validateUserEmail(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"userEmail", "body", o.UserEmail); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this add data center user permission body based on the context it is used -func (o *AddDataCenterUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRole(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddDataCenterUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { - - if o.Role != nil { - - if err := o.Role.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *AddDataCenterUserPermissionBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddDataCenterUserPermissionBody) UnmarshalBinary(b []byte) error { - var res AddDataCenterUserPermissionBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/permissions/add_project_user_permission_parameters.go b/internal/client/permissions/add_project_user_permission_parameters.go index 36e34be..bfcd699 100644 --- a/internal/client/permissions/add_project_user_permission_parameters.go +++ b/internal/client/permissions/add_project_user_permission_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewAddProjectUserPermissionParams creates a new AddProjectUserPermissionParams object, @@ -62,7 +64,7 @@ AddProjectUserPermissionParams contains all the parameters to send to the API en type AddProjectUserPermissionParams struct { // Body. - Body AddProjectUserPermissionBody + Body *models.AddProjectUserPermissionBody // ProjectID. ProjectID string @@ -121,13 +123,13 @@ func (o *AddProjectUserPermissionParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the add project user permission params -func (o *AddProjectUserPermissionParams) WithBody(body AddProjectUserPermissionBody) *AddProjectUserPermissionParams { +func (o *AddProjectUserPermissionParams) WithBody(body *models.AddProjectUserPermissionBody) *AddProjectUserPermissionParams { o.SetBody(body) return o } // SetBody adds the body to the add project user permission params -func (o *AddProjectUserPermissionParams) SetBody(body AddProjectUserPermissionBody) { +func (o *AddProjectUserPermissionParams) SetBody(body *models.AddProjectUserPermissionBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *AddProjectUserPermissionParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param projectId diff --git a/internal/client/permissions/add_project_user_permission_responses.go b/internal/client/permissions/add_project_user_permission_responses.go index 36f72f3..8daebce 100644 --- a/internal/client/permissions/add_project_user_permission_responses.go +++ b/internal/client/permissions/add_project_user_permission_responses.go @@ -6,15 +6,11 @@ package permissions // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,124 +178,3 @@ func (o *AddProjectUserPermissionDefault) readResponse(response runtime.ClientRe return nil } - -/* -AddProjectUserPermissionBody add project user permission body -swagger:model AddProjectUserPermissionBody -*/ -type AddProjectUserPermissionBody struct { - - // billing account Id - BillingAccountID string `json:"billingAccountId,omitempty"` - - // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` - - // role - // Required: true - Role *models.Role `json:"role"` - - // user email - // Required: true - UserEmail *string `json:"userEmail"` -} - -// Validate validates this add project user permission body -func (o *AddProjectUserPermissionBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateRole(formats); err != nil { - res = append(res, err) - } - - if err := o.validateUserEmail(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddProjectUserPermissionBody) validateRole(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if o.Role != nil { - if err := o.Role.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -func (o *AddProjectUserPermissionBody) validateUserEmail(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"userEmail", "body", o.UserEmail); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this add project user permission body based on the context it is used -func (o *AddProjectUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRole(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *AddProjectUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { - - if o.Role != nil { - - if err := o.Role.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *AddProjectUserPermissionBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *AddProjectUserPermissionBody) UnmarshalBinary(b []byte) error { - var res AddProjectUserPermissionBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/permissions/remove_billing_account_user_permission_parameters.go b/internal/client/permissions/remove_billing_account_user_permission_parameters.go index 2691b02..78155aa 100644 --- a/internal/client/permissions/remove_billing_account_user_permission_parameters.go +++ b/internal/client/permissions/remove_billing_account_user_permission_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewRemoveBillingAccountUserPermissionParams creates a new RemoveBillingAccountUserPermissionParams object, @@ -65,7 +67,7 @@ type RemoveBillingAccountUserPermissionParams struct { BillingAccountID string // Body. - Body RemoveBillingAccountUserPermissionBody + Body *models.RemoveBillingAccountUserPermissionBody timeout time.Duration Context context.Context @@ -132,13 +134,13 @@ func (o *RemoveBillingAccountUserPermissionParams) SetBillingAccountID(billingAc } // WithBody adds the body to the remove billing account user permission params -func (o *RemoveBillingAccountUserPermissionParams) WithBody(body RemoveBillingAccountUserPermissionBody) *RemoveBillingAccountUserPermissionParams { +func (o *RemoveBillingAccountUserPermissionParams) WithBody(body *models.RemoveBillingAccountUserPermissionBody) *RemoveBillingAccountUserPermissionParams { o.SetBody(body) return o } // SetBody adds the body to the remove billing account user permission params -func (o *RemoveBillingAccountUserPermissionParams) SetBody(body RemoveBillingAccountUserPermissionBody) { +func (o *RemoveBillingAccountUserPermissionParams) SetBody(body *models.RemoveBillingAccountUserPermissionBody) { o.Body = body } @@ -154,8 +156,10 @@ func (o *RemoveBillingAccountUserPermissionParams) WriteToRequest(r runtime.Clie if err := r.SetPathParam("billingAccountId", o.BillingAccountID); err != nil { return err } - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } if len(res) > 0 { diff --git a/internal/client/permissions/remove_billing_account_user_permission_responses.go b/internal/client/permissions/remove_billing_account_user_permission_responses.go index b1d2b94..4bcc886 100644 --- a/internal/client/permissions/remove_billing_account_user_permission_responses.go +++ b/internal/client/permissions/remove_billing_account_user_permission_responses.go @@ -6,15 +6,11 @@ package permissions // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,124 +178,3 @@ func (o *RemoveBillingAccountUserPermissionDefault) readResponse(response runtim return nil } - -/* -RemoveBillingAccountUserPermissionBody remove billing account user permission body -swagger:model RemoveBillingAccountUserPermissionBody -*/ -type RemoveBillingAccountUserPermissionBody struct { - - // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` - - // project Id - ProjectID string `json:"projectId,omitempty"` - - // role - // Required: true - Role *models.Role `json:"role"` - - // user Id - // Required: true - UserID *string `json:"userId"` -} - -// Validate validates this remove billing account user permission body -func (o *RemoveBillingAccountUserPermissionBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateRole(formats); err != nil { - res = append(res, err) - } - - if err := o.validateUserID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveBillingAccountUserPermissionBody) validateRole(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if o.Role != nil { - if err := o.Role.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -func (o *RemoveBillingAccountUserPermissionBody) validateUserID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"userId", "body", o.UserID); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this remove billing account user permission body based on the context it is used -func (o *RemoveBillingAccountUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRole(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveBillingAccountUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { - - if o.Role != nil { - - if err := o.Role.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *RemoveBillingAccountUserPermissionBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *RemoveBillingAccountUserPermissionBody) UnmarshalBinary(b []byte) error { - var res RemoveBillingAccountUserPermissionBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/permissions/remove_data_center_user_permission_parameters.go b/internal/client/permissions/remove_data_center_user_permission_parameters.go index 5bf3692..17aa8e0 100644 --- a/internal/client/permissions/remove_data_center_user_permission_parameters.go +++ b/internal/client/permissions/remove_data_center_user_permission_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewRemoveDataCenterUserPermissionParams creates a new RemoveDataCenterUserPermissionParams object, @@ -62,7 +64,7 @@ RemoveDataCenterUserPermissionParams contains all the parameters to send to the type RemoveDataCenterUserPermissionParams struct { // Body. - Body RemoveDataCenterUserPermissionBody + Body *models.RemoveDataCenterUserPermissionBody // DataCenterID. DataCenterID string @@ -121,13 +123,13 @@ func (o *RemoveDataCenterUserPermissionParams) SetHTTPClient(client *http.Client } // WithBody adds the body to the remove data center user permission params -func (o *RemoveDataCenterUserPermissionParams) WithBody(body RemoveDataCenterUserPermissionBody) *RemoveDataCenterUserPermissionParams { +func (o *RemoveDataCenterUserPermissionParams) WithBody(body *models.RemoveDataCenterUserPermissionBody) *RemoveDataCenterUserPermissionParams { o.SetBody(body) return o } // SetBody adds the body to the remove data center user permission params -func (o *RemoveDataCenterUserPermissionParams) SetBody(body RemoveDataCenterUserPermissionBody) { +func (o *RemoveDataCenterUserPermissionParams) SetBody(body *models.RemoveDataCenterUserPermissionBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *RemoveDataCenterUserPermissionParams) WriteToRequest(r runtime.ClientRe return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param dataCenterId diff --git a/internal/client/permissions/remove_data_center_user_permission_responses.go b/internal/client/permissions/remove_data_center_user_permission_responses.go index 6cd722b..04d74e1 100644 --- a/internal/client/permissions/remove_data_center_user_permission_responses.go +++ b/internal/client/permissions/remove_data_center_user_permission_responses.go @@ -6,15 +6,11 @@ package permissions // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,124 +178,3 @@ func (o *RemoveDataCenterUserPermissionDefault) readResponse(response runtime.Cl return nil } - -/* -RemoveDataCenterUserPermissionBody remove data center user permission body -swagger:model RemoveDataCenterUserPermissionBody -*/ -type RemoveDataCenterUserPermissionBody struct { - - // billing account Id - BillingAccountID string `json:"billingAccountId,omitempty"` - - // project Id - ProjectID string `json:"projectId,omitempty"` - - // role - // Required: true - Role *models.Role `json:"role"` - - // user Id - // Required: true - UserID *string `json:"userId"` -} - -// Validate validates this remove data center user permission body -func (o *RemoveDataCenterUserPermissionBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateRole(formats); err != nil { - res = append(res, err) - } - - if err := o.validateUserID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveDataCenterUserPermissionBody) validateRole(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if o.Role != nil { - if err := o.Role.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -func (o *RemoveDataCenterUserPermissionBody) validateUserID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"userId", "body", o.UserID); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this remove data center user permission body based on the context it is used -func (o *RemoveDataCenterUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRole(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveDataCenterUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { - - if o.Role != nil { - - if err := o.Role.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *RemoveDataCenterUserPermissionBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *RemoveDataCenterUserPermissionBody) UnmarshalBinary(b []byte) error { - var res RemoveDataCenterUserPermissionBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/permissions/remove_project_user_permission_parameters.go b/internal/client/permissions/remove_project_user_permission_parameters.go index 9cb8fb2..92e31f2 100644 --- a/internal/client/permissions/remove_project_user_permission_parameters.go +++ b/internal/client/permissions/remove_project_user_permission_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewRemoveProjectUserPermissionParams creates a new RemoveProjectUserPermissionParams object, @@ -62,7 +64,7 @@ RemoveProjectUserPermissionParams contains all the parameters to send to the API type RemoveProjectUserPermissionParams struct { // Body. - Body RemoveProjectUserPermissionBody + Body *models.RemoveProjectUserPermissionBody // ProjectID. ProjectID string @@ -121,13 +123,13 @@ func (o *RemoveProjectUserPermissionParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the remove project user permission params -func (o *RemoveProjectUserPermissionParams) WithBody(body RemoveProjectUserPermissionBody) *RemoveProjectUserPermissionParams { +func (o *RemoveProjectUserPermissionParams) WithBody(body *models.RemoveProjectUserPermissionBody) *RemoveProjectUserPermissionParams { o.SetBody(body) return o } // SetBody adds the body to the remove project user permission params -func (o *RemoveProjectUserPermissionParams) SetBody(body RemoveProjectUserPermissionBody) { +func (o *RemoveProjectUserPermissionParams) SetBody(body *models.RemoveProjectUserPermissionBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *RemoveProjectUserPermissionParams) WriteToRequest(r runtime.ClientReque return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param projectId diff --git a/internal/client/permissions/remove_project_user_permission_responses.go b/internal/client/permissions/remove_project_user_permission_responses.go index 00ff58c..66a7f98 100644 --- a/internal/client/permissions/remove_project_user_permission_responses.go +++ b/internal/client/permissions/remove_project_user_permission_responses.go @@ -6,15 +6,11 @@ package permissions // 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" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -182,124 +178,3 @@ func (o *RemoveProjectUserPermissionDefault) readResponse(response runtime.Clien return nil } - -/* -RemoveProjectUserPermissionBody remove project user permission body -swagger:model RemoveProjectUserPermissionBody -*/ -type RemoveProjectUserPermissionBody struct { - - // billing account Id - BillingAccountID string `json:"billingAccountId,omitempty"` - - // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` - - // role - // Required: true - Role *models.Role `json:"role"` - - // user Id - // Required: true - UserID *string `json:"userId"` -} - -// Validate validates this remove project user permission body -func (o *RemoveProjectUserPermissionBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateRole(formats); err != nil { - res = append(res, err) - } - - if err := o.validateUserID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveProjectUserPermissionBody) validateRole(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if err := validate.Required("body"+"."+"role", "body", o.Role); err != nil { - return err - } - - if o.Role != nil { - if err := o.Role.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -func (o *RemoveProjectUserPermissionBody) validateUserID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"userId", "body", o.UserID); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this remove project user permission body based on the context it is used -func (o *RemoveProjectUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateRole(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *RemoveProjectUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { - - if o.Role != nil { - - if err := o.Role.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "role") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "role") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *RemoveProjectUserPermissionBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *RemoveProjectUserPermissionBody) UnmarshalBinary(b []byte) error { - var res RemoveProjectUserPermissionBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/virtual_machines/attach_security_group_parameters.go b/internal/client/virtual_machines/attach_security_group_parameters.go new file mode 100644 index 0000000..2c7896d --- /dev/null +++ b/internal/client/virtual_machines/attach_security_group_parameters.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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" +) + +// NewAttachSecurityGroupParams creates a new AttachSecurityGroupParams 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 NewAttachSecurityGroupParams() *AttachSecurityGroupParams { + return &AttachSecurityGroupParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAttachSecurityGroupParamsWithTimeout creates a new AttachSecurityGroupParams object +// with the ability to set a timeout on a request. +func NewAttachSecurityGroupParamsWithTimeout(timeout time.Duration) *AttachSecurityGroupParams { + return &AttachSecurityGroupParams{ + timeout: timeout, + } +} + +// NewAttachSecurityGroupParamsWithContext creates a new AttachSecurityGroupParams object +// with the ability to set a context for a request. +func NewAttachSecurityGroupParamsWithContext(ctx context.Context) *AttachSecurityGroupParams { + return &AttachSecurityGroupParams{ + Context: ctx, + } +} + +// NewAttachSecurityGroupParamsWithHTTPClient creates a new AttachSecurityGroupParams object +// with the ability to set a custom HTTPClient for a request. +func NewAttachSecurityGroupParamsWithHTTPClient(client *http.Client) *AttachSecurityGroupParams { + return &AttachSecurityGroupParams{ + HTTPClient: client, + } +} + +/* +AttachSecurityGroupParams contains all the parameters to send to the API endpoint + + for the attach security group operation. + + Typically these are written to a http.Request. +*/ +type AttachSecurityGroupParams struct { + + // ID. + ID string + + // ProjectID. + ProjectID string + + // SecurityGroupID. + SecurityGroupID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the attach security group params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AttachSecurityGroupParams) WithDefaults() *AttachSecurityGroupParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the attach security group params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AttachSecurityGroupParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the attach security group params +func (o *AttachSecurityGroupParams) WithTimeout(timeout time.Duration) *AttachSecurityGroupParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the attach security group params +func (o *AttachSecurityGroupParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the attach security group params +func (o *AttachSecurityGroupParams) WithContext(ctx context.Context) *AttachSecurityGroupParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the attach security group params +func (o *AttachSecurityGroupParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the attach security group params +func (o *AttachSecurityGroupParams) WithHTTPClient(client *http.Client) *AttachSecurityGroupParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the attach security group params +func (o *AttachSecurityGroupParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the attach security group params +func (o *AttachSecurityGroupParams) WithID(id string) *AttachSecurityGroupParams { + o.SetID(id) + return o +} + +// SetID adds the id to the attach security group params +func (o *AttachSecurityGroupParams) SetID(id string) { + o.ID = id +} + +// WithProjectID adds the projectID to the attach security group params +func (o *AttachSecurityGroupParams) WithProjectID(projectID string) *AttachSecurityGroupParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the attach security group params +func (o *AttachSecurityGroupParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WithSecurityGroupID adds the securityGroupID to the attach security group params +func (o *AttachSecurityGroupParams) WithSecurityGroupID(securityGroupID *string) *AttachSecurityGroupParams { + o.SetSecurityGroupID(securityGroupID) + return o +} + +// SetSecurityGroupID adds the securityGroupId to the attach security group params +func (o *AttachSecurityGroupParams) SetSecurityGroupID(securityGroupID *string) { + o.SecurityGroupID = securityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *AttachSecurityGroupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param projectId + if err := r.SetPathParam("projectId", o.ProjectID); err != nil { + return err + } + + if o.SecurityGroupID != nil { + + // query param securityGroupId + var qrSecurityGroupID string + + if o.SecurityGroupID != nil { + qrSecurityGroupID = *o.SecurityGroupID + } + qSecurityGroupID := qrSecurityGroupID + if qSecurityGroupID != "" { + + if err := r.SetQueryParam("securityGroupId", qSecurityGroupID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/virtual_machines/attach_security_group_responses.go b/internal/client/virtual_machines/attach_security_group_responses.go new file mode 100644 index 0000000..a9bcd3e --- /dev/null +++ b/internal/client/virtual_machines/attach_security_group_responses.go @@ -0,0 +1,180 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// AttachSecurityGroupReader is a Reader for the AttachSecurityGroup structure. +type AttachSecurityGroupReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AttachSecurityGroupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAttachSecurityGroupOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewAttachSecurityGroupDefault(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 + } +} + +// NewAttachSecurityGroupOK creates a AttachSecurityGroupOK with default headers values +func NewAttachSecurityGroupOK() *AttachSecurityGroupOK { + return &AttachSecurityGroupOK{} +} + +/* +AttachSecurityGroupOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type AttachSecurityGroupOK struct { + Payload models.AttachSecurityGroupResponse +} + +// IsSuccess returns true when this attach security group o k response has a 2xx status code +func (o *AttachSecurityGroupOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this attach security group o k response has a 3xx status code +func (o *AttachSecurityGroupOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this attach security group o k response has a 4xx status code +func (o *AttachSecurityGroupOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this attach security group o k response has a 5xx status code +func (o *AttachSecurityGroupOK) IsServerError() bool { + return false +} + +// IsCode returns true when this attach security group o k response a status code equal to that given +func (o *AttachSecurityGroupOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the attach security group o k response +func (o *AttachSecurityGroupOK) Code() int { + return 200 +} + +func (o *AttachSecurityGroupOK) Error() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/attach][%d] attachSecurityGroupOK %+v", 200, o.Payload) +} + +func (o *AttachSecurityGroupOK) String() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/attach][%d] attachSecurityGroupOK %+v", 200, o.Payload) +} + +func (o *AttachSecurityGroupOK) GetPayload() models.AttachSecurityGroupResponse { + return o.Payload +} + +func (o *AttachSecurityGroupOK) 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 +} + +// NewAttachSecurityGroupDefault creates a AttachSecurityGroupDefault with default headers values +func NewAttachSecurityGroupDefault(code int) *AttachSecurityGroupDefault { + return &AttachSecurityGroupDefault{ + _statusCode: code, + } +} + +/* +AttachSecurityGroupDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type AttachSecurityGroupDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this attach security group default response has a 2xx status code +func (o *AttachSecurityGroupDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this attach security group default response has a 3xx status code +func (o *AttachSecurityGroupDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this attach security group default response has a 4xx status code +func (o *AttachSecurityGroupDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this attach security group default response has a 5xx status code +func (o *AttachSecurityGroupDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this attach security group default response a status code equal to that given +func (o *AttachSecurityGroupDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the attach security group default response +func (o *AttachSecurityGroupDefault) Code() int { + return o._statusCode +} + +func (o *AttachSecurityGroupDefault) Error() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/attach][%d] AttachSecurityGroup default %+v", o._statusCode, o.Payload) +} + +func (o *AttachSecurityGroupDefault) String() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/attach][%d] AttachSecurityGroup default %+v", o._statusCode, o.Payload) +} + +func (o *AttachSecurityGroupDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *AttachSecurityGroupDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/virtual_machines/create_vm_parameters.go b/internal/client/virtual_machines/create_vm_parameters.go index efa2923..b8e483c 100644 --- a/internal/client/virtual_machines/create_vm_parameters.go +++ b/internal/client/virtual_machines/create_vm_parameters.go @@ -14,6 +14,8 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + + "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) // NewCreateVMParams creates a new CreateVMParams object, @@ -62,7 +64,7 @@ CreateVMParams contains all the parameters to send to the API endpoint type CreateVMParams struct { // Body. - Body CreateVMBody + Body *models.CreateVMBody // ProjectID. ProjectID string @@ -121,13 +123,13 @@ func (o *CreateVMParams) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create VM params -func (o *CreateVMParams) WithBody(body CreateVMBody) *CreateVMParams { +func (o *CreateVMParams) WithBody(body *models.CreateVMBody) *CreateVMParams { o.SetBody(body) return o } // SetBody adds the body to the create VM params -func (o *CreateVMParams) SetBody(body CreateVMBody) { +func (o *CreateVMParams) SetBody(body *models.CreateVMBody) { o.Body = body } @@ -149,8 +151,10 @@ func (o *CreateVMParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi return err } var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } } // path param projectId diff --git a/internal/client/virtual_machines/create_vm_responses.go b/internal/client/virtual_machines/create_vm_responses.go index 3da99e2..b7ae689 100644 --- a/internal/client/virtual_machines/create_vm_responses.go +++ b/internal/client/virtual_machines/create_vm_responses.go @@ -6,16 +6,11 @@ package virtual_machines // Editing this file might prove futile when you re-run the swagger generate command import ( - "context" "fmt" "io" - "strconv" - "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" "github.com/CudoVentures/terraform-provider-cudo/internal/models" ) @@ -185,336 +180,3 @@ func (o *CreateVMDefault) readResponse(response runtime.ClientResponse, consumer return nil } - -/* -CreateVMBody create VM body -swagger:model CreateVMBody -*/ -type CreateVMBody struct { - - // boot disk - BootDisk *models.Disk `json:"bootDisk,omitempty"` - - // boot disk image Id - // Required: true - BootDiskImageID *string `json:"bootDiskImageId"` - - // cpu model - CPUModel string `json:"cpuModel,omitempty"` - - // custom Ssh keys - CustomSSHKeys []string `json:"customSshKeys"` - - // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` - - // gpu model - GpuModel string `json:"gpuModel,omitempty"` - - // gpus - Gpus int32 `json:"gpus,omitempty"` - - // machine type - MachineType string `json:"machineType,omitempty"` - - // max price hr - MaxPriceHr *models.Decimal `json:"maxPriceHr,omitempty"` - - // memory gib - MemoryGib int32 `json:"memoryGib,omitempty"` - - // metadata - Metadata map[string]string `json:"metadata,omitempty"` - - // nics - Nics []*models.CreateVMRequestNIC `json:"nics"` - - // password - Password string `json:"password,omitempty"` - - // ignored if any nics are provided - SecurityGroupIds []string `json:"securityGroupIds"` - - // ssh key source - SSHKeySource *models.SSHKeySource `json:"sshKeySource,omitempty"` - - // start script - StartScript string `json:"startScript,omitempty"` - - // storage disk ids - StorageDiskIds []string `json:"storageDiskIds"` - - // vcpus - Vcpus int32 `json:"vcpus,omitempty"` - - // vm Id - // Required: true - VMID *string `json:"vmId"` -} - -// Validate validates this create VM body -func (o *CreateVMBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateBootDisk(formats); err != nil { - res = append(res, err) - } - - if err := o.validateBootDiskImageID(formats); err != nil { - res = append(res, err) - } - - if err := o.validateMaxPriceHr(formats); err != nil { - res = append(res, err) - } - - if err := o.validateNics(formats); err != nil { - res = append(res, err) - } - - if err := o.validateSSHKeySource(formats); err != nil { - res = append(res, err) - } - - if err := o.validateVMID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateVMBody) validateBootDisk(formats strfmt.Registry) error { - if swag.IsZero(o.BootDisk) { // not required - return nil - } - - if o.BootDisk != nil { - if err := o.BootDisk.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "bootDisk") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "bootDisk") - } - return err - } - } - - return nil -} - -func (o *CreateVMBody) validateBootDiskImageID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"bootDiskImageId", "body", o.BootDiskImageID); err != nil { - return err - } - - return nil -} - -func (o *CreateVMBody) validateMaxPriceHr(formats strfmt.Registry) error { - if swag.IsZero(o.MaxPriceHr) { // not required - return nil - } - - if o.MaxPriceHr != nil { - if err := o.MaxPriceHr.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "maxPriceHr") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "maxPriceHr") - } - return err - } - } - - return nil -} - -func (o *CreateVMBody) validateNics(formats strfmt.Registry) error { - if swag.IsZero(o.Nics) { // not required - return nil - } - - for i := 0; i < len(o.Nics); i++ { - if swag.IsZero(o.Nics[i]) { // not required - continue - } - - if o.Nics[i] != nil { - if err := o.Nics[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "nics" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "nics" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *CreateVMBody) validateSSHKeySource(formats strfmt.Registry) error { - if swag.IsZero(o.SSHKeySource) { // not required - return nil - } - - if o.SSHKeySource != nil { - if err := o.SSHKeySource.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "sshKeySource") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "sshKeySource") - } - return err - } - } - - return nil -} - -func (o *CreateVMBody) validateVMID(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"vmId", "body", o.VMID); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this create VM body based on the context it is used -func (o *CreateVMBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := o.contextValidateBootDisk(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateMaxPriceHr(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateNics(ctx, formats); err != nil { - res = append(res, err) - } - - if err := o.contextValidateSSHKeySource(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateVMBody) contextValidateBootDisk(ctx context.Context, formats strfmt.Registry) error { - - if o.BootDisk != nil { - - if swag.IsZero(o.BootDisk) { // not required - return nil - } - - if err := o.BootDisk.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "bootDisk") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "bootDisk") - } - return err - } - } - - return nil -} - -func (o *CreateVMBody) contextValidateMaxPriceHr(ctx context.Context, formats strfmt.Registry) error { - - if o.MaxPriceHr != nil { - - if swag.IsZero(o.MaxPriceHr) { // not required - return nil - } - - if err := o.MaxPriceHr.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "maxPriceHr") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "maxPriceHr") - } - return err - } - } - - return nil -} - -func (o *CreateVMBody) contextValidateNics(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(o.Nics); i++ { - - if o.Nics[i] != nil { - - if swag.IsZero(o.Nics[i]) { // not required - return nil - } - - if err := o.Nics[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "nics" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "nics" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (o *CreateVMBody) contextValidateSSHKeySource(ctx context.Context, formats strfmt.Registry) error { - - if o.SSHKeySource != nil { - - if swag.IsZero(o.SSHKeySource) { // not required - return nil - } - - if err := o.SSHKeySource.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("body" + "." + "sshKeySource") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("body" + "." + "sshKeySource") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (o *CreateVMBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateVMBody) UnmarshalBinary(b []byte) error { - var res CreateVMBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/internal/client/virtual_machines/detach_security_group_parameters.go b/internal/client/virtual_machines/detach_security_group_parameters.go new file mode 100644 index 0000000..2d5dc3f --- /dev/null +++ b/internal/client/virtual_machines/detach_security_group_parameters.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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" +) + +// NewDetachSecurityGroupParams creates a new DetachSecurityGroupParams 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 NewDetachSecurityGroupParams() *DetachSecurityGroupParams { + return &DetachSecurityGroupParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDetachSecurityGroupParamsWithTimeout creates a new DetachSecurityGroupParams object +// with the ability to set a timeout on a request. +func NewDetachSecurityGroupParamsWithTimeout(timeout time.Duration) *DetachSecurityGroupParams { + return &DetachSecurityGroupParams{ + timeout: timeout, + } +} + +// NewDetachSecurityGroupParamsWithContext creates a new DetachSecurityGroupParams object +// with the ability to set a context for a request. +func NewDetachSecurityGroupParamsWithContext(ctx context.Context) *DetachSecurityGroupParams { + return &DetachSecurityGroupParams{ + Context: ctx, + } +} + +// NewDetachSecurityGroupParamsWithHTTPClient creates a new DetachSecurityGroupParams object +// with the ability to set a custom HTTPClient for a request. +func NewDetachSecurityGroupParamsWithHTTPClient(client *http.Client) *DetachSecurityGroupParams { + return &DetachSecurityGroupParams{ + HTTPClient: client, + } +} + +/* +DetachSecurityGroupParams contains all the parameters to send to the API endpoint + + for the detach security group operation. + + Typically these are written to a http.Request. +*/ +type DetachSecurityGroupParams struct { + + // ID. + ID string + + // ProjectID. + ProjectID string + + // SecurityGroupID. + SecurityGroupID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the detach security group params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DetachSecurityGroupParams) WithDefaults() *DetachSecurityGroupParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the detach security group params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DetachSecurityGroupParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the detach security group params +func (o *DetachSecurityGroupParams) WithTimeout(timeout time.Duration) *DetachSecurityGroupParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the detach security group params +func (o *DetachSecurityGroupParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the detach security group params +func (o *DetachSecurityGroupParams) WithContext(ctx context.Context) *DetachSecurityGroupParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the detach security group params +func (o *DetachSecurityGroupParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the detach security group params +func (o *DetachSecurityGroupParams) WithHTTPClient(client *http.Client) *DetachSecurityGroupParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the detach security group params +func (o *DetachSecurityGroupParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the detach security group params +func (o *DetachSecurityGroupParams) WithID(id string) *DetachSecurityGroupParams { + o.SetID(id) + return o +} + +// SetID adds the id to the detach security group params +func (o *DetachSecurityGroupParams) SetID(id string) { + o.ID = id +} + +// WithProjectID adds the projectID to the detach security group params +func (o *DetachSecurityGroupParams) WithProjectID(projectID string) *DetachSecurityGroupParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the detach security group params +func (o *DetachSecurityGroupParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WithSecurityGroupID adds the securityGroupID to the detach security group params +func (o *DetachSecurityGroupParams) WithSecurityGroupID(securityGroupID *string) *DetachSecurityGroupParams { + o.SetSecurityGroupID(securityGroupID) + return o +} + +// SetSecurityGroupID adds the securityGroupId to the detach security group params +func (o *DetachSecurityGroupParams) SetSecurityGroupID(securityGroupID *string) { + o.SecurityGroupID = securityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *DetachSecurityGroupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param projectId + if err := r.SetPathParam("projectId", o.ProjectID); err != nil { + return err + } + + if o.SecurityGroupID != nil { + + // query param securityGroupId + var qrSecurityGroupID string + + if o.SecurityGroupID != nil { + qrSecurityGroupID = *o.SecurityGroupID + } + qSecurityGroupID := qrSecurityGroupID + if qSecurityGroupID != "" { + + if err := r.SetQueryParam("securityGroupId", qSecurityGroupID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/virtual_machines/detach_security_group_responses.go b/internal/client/virtual_machines/detach_security_group_responses.go new file mode 100644 index 0000000..e83bd21 --- /dev/null +++ b/internal/client/virtual_machines/detach_security_group_responses.go @@ -0,0 +1,180 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// DetachSecurityGroupReader is a Reader for the DetachSecurityGroup structure. +type DetachSecurityGroupReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DetachSecurityGroupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDetachSecurityGroupOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDetachSecurityGroupDefault(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 + } +} + +// NewDetachSecurityGroupOK creates a DetachSecurityGroupOK with default headers values +func NewDetachSecurityGroupOK() *DetachSecurityGroupOK { + return &DetachSecurityGroupOK{} +} + +/* +DetachSecurityGroupOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DetachSecurityGroupOK struct { + Payload models.DetachSecurityGroupResponse +} + +// IsSuccess returns true when this detach security group o k response has a 2xx status code +func (o *DetachSecurityGroupOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this detach security group o k response has a 3xx status code +func (o *DetachSecurityGroupOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this detach security group o k response has a 4xx status code +func (o *DetachSecurityGroupOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this detach security group o k response has a 5xx status code +func (o *DetachSecurityGroupOK) IsServerError() bool { + return false +} + +// IsCode returns true when this detach security group o k response a status code equal to that given +func (o *DetachSecurityGroupOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the detach security group o k response +func (o *DetachSecurityGroupOK) Code() int { + return 200 +} + +func (o *DetachSecurityGroupOK) Error() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/detach][%d] detachSecurityGroupOK %+v", 200, o.Payload) +} + +func (o *DetachSecurityGroupOK) String() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/detach][%d] detachSecurityGroupOK %+v", 200, o.Payload) +} + +func (o *DetachSecurityGroupOK) GetPayload() models.DetachSecurityGroupResponse { + return o.Payload +} + +func (o *DetachSecurityGroupOK) 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 +} + +// NewDetachSecurityGroupDefault creates a DetachSecurityGroupDefault with default headers values +func NewDetachSecurityGroupDefault(code int) *DetachSecurityGroupDefault { + return &DetachSecurityGroupDefault{ + _statusCode: code, + } +} + +/* +DetachSecurityGroupDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DetachSecurityGroupDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this detach security group default response has a 2xx status code +func (o *DetachSecurityGroupDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this detach security group default response has a 3xx status code +func (o *DetachSecurityGroupDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this detach security group default response has a 4xx status code +func (o *DetachSecurityGroupDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this detach security group default response has a 5xx status code +func (o *DetachSecurityGroupDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this detach security group default response a status code equal to that given +func (o *DetachSecurityGroupDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the detach security group default response +func (o *DetachSecurityGroupDefault) Code() int { + return o._statusCode +} + +func (o *DetachSecurityGroupDefault) Error() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/detach][%d] DetachSecurityGroup default %+v", o._statusCode, o.Payload) +} + +func (o *DetachSecurityGroupDefault) String() string { + return fmt.Sprintf("[PATCH /v1/projects/{projectId}/vm/{id}/security-group/detach][%d] DetachSecurityGroup default %+v", o._statusCode, o.Payload) +} + +func (o *DetachSecurityGroupDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *DetachSecurityGroupDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/virtual_machines/list_vm_machine_types2_parameters.go b/internal/client/virtual_machines/list_vm_machine_types2_parameters.go new file mode 100644 index 0000000..10250db --- /dev/null +++ b/internal/client/virtual_machines/list_vm_machine_types2_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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" +) + +// NewListVMMachineTypes2Params creates a new ListVMMachineTypes2Params 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 NewListVMMachineTypes2Params() *ListVMMachineTypes2Params { + return &ListVMMachineTypes2Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewListVMMachineTypes2ParamsWithTimeout creates a new ListVMMachineTypes2Params object +// with the ability to set a timeout on a request. +func NewListVMMachineTypes2ParamsWithTimeout(timeout time.Duration) *ListVMMachineTypes2Params { + return &ListVMMachineTypes2Params{ + timeout: timeout, + } +} + +// NewListVMMachineTypes2ParamsWithContext creates a new ListVMMachineTypes2Params object +// with the ability to set a context for a request. +func NewListVMMachineTypes2ParamsWithContext(ctx context.Context) *ListVMMachineTypes2Params { + return &ListVMMachineTypes2Params{ + Context: ctx, + } +} + +// NewListVMMachineTypes2ParamsWithHTTPClient creates a new ListVMMachineTypes2Params object +// with the ability to set a custom HTTPClient for a request. +func NewListVMMachineTypes2ParamsWithHTTPClient(client *http.Client) *ListVMMachineTypes2Params { + return &ListVMMachineTypes2Params{ + HTTPClient: client, + } +} + +/* +ListVMMachineTypes2Params contains all the parameters to send to the API endpoint + + for the list VM machine types2 operation. + + Typically these are written to a http.Request. +*/ +type ListVMMachineTypes2Params struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list VM machine types2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListVMMachineTypes2Params) WithDefaults() *ListVMMachineTypes2Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list VM machine types2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListVMMachineTypes2Params) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list VM machine types2 params +func (o *ListVMMachineTypes2Params) WithTimeout(timeout time.Duration) *ListVMMachineTypes2Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list VM machine types2 params +func (o *ListVMMachineTypes2Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list VM machine types2 params +func (o *ListVMMachineTypes2Params) WithContext(ctx context.Context) *ListVMMachineTypes2Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list VM machine types2 params +func (o *ListVMMachineTypes2Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list VM machine types2 params +func (o *ListVMMachineTypes2Params) WithHTTPClient(client *http.Client) *ListVMMachineTypes2Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list VM machine types2 params +func (o *ListVMMachineTypes2Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListVMMachineTypes2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/virtual_machines/list_vm_machine_types2_responses.go b/internal/client/virtual_machines/list_vm_machine_types2_responses.go new file mode 100644 index 0000000..e0551ad --- /dev/null +++ b/internal/client/virtual_machines/list_vm_machine_types2_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// ListVMMachineTypes2Reader is a Reader for the ListVMMachineTypes2 structure. +type ListVMMachineTypes2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListVMMachineTypes2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListVMMachineTypes2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListVMMachineTypes2Default(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 + } +} + +// NewListVMMachineTypes2OK creates a ListVMMachineTypes2OK with default headers values +func NewListVMMachineTypes2OK() *ListVMMachineTypes2OK { + return &ListVMMachineTypes2OK{} +} + +/* +ListVMMachineTypes2OK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListVMMachineTypes2OK struct { + Payload *models.ListVMMachineTypes2Response +} + +// IsSuccess returns true when this list Vm machine types2 o k response has a 2xx status code +func (o *ListVMMachineTypes2OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list Vm machine types2 o k response has a 3xx status code +func (o *ListVMMachineTypes2OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list Vm machine types2 o k response has a 4xx status code +func (o *ListVMMachineTypes2OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list Vm machine types2 o k response has a 5xx status code +func (o *ListVMMachineTypes2OK) IsServerError() bool { + return false +} + +// IsCode returns true when this list Vm machine types2 o k response a status code equal to that given +func (o *ListVMMachineTypes2OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list Vm machine types2 o k response +func (o *ListVMMachineTypes2OK) Code() int { + return 200 +} + +func (o *ListVMMachineTypes2OK) Error() string { + return fmt.Sprintf("[GET /v1/vms/machine-types-2][%d] listVmMachineTypes2OK %+v", 200, o.Payload) +} + +func (o *ListVMMachineTypes2OK) String() string { + return fmt.Sprintf("[GET /v1/vms/machine-types-2][%d] listVmMachineTypes2OK %+v", 200, o.Payload) +} + +func (o *ListVMMachineTypes2OK) GetPayload() *models.ListVMMachineTypes2Response { + return o.Payload +} + +func (o *ListVMMachineTypes2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ListVMMachineTypes2Response) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListVMMachineTypes2Default creates a ListVMMachineTypes2Default with default headers values +func NewListVMMachineTypes2Default(code int) *ListVMMachineTypes2Default { + return &ListVMMachineTypes2Default{ + _statusCode: code, + } +} + +/* +ListVMMachineTypes2Default describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListVMMachineTypes2Default struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this list VM machine types2 default response has a 2xx status code +func (o *ListVMMachineTypes2Default) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list VM machine types2 default response has a 3xx status code +func (o *ListVMMachineTypes2Default) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list VM machine types2 default response has a 4xx status code +func (o *ListVMMachineTypes2Default) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list VM machine types2 default response has a 5xx status code +func (o *ListVMMachineTypes2Default) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list VM machine types2 default response a status code equal to that given +func (o *ListVMMachineTypes2Default) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the list VM machine types2 default response +func (o *ListVMMachineTypes2Default) Code() int { + return o._statusCode +} + +func (o *ListVMMachineTypes2Default) Error() string { + return fmt.Sprintf("[GET /v1/vms/machine-types-2][%d] ListVMMachineTypes2 default %+v", o._statusCode, o.Payload) +} + +func (o *ListVMMachineTypes2Default) String() string { + return fmt.Sprintf("[GET /v1/vms/machine-types-2][%d] ListVMMachineTypes2 default %+v", o._statusCode, o.Payload) +} + +func (o *ListVMMachineTypes2Default) GetPayload() *models.Status { + return o.Payload +} + +func (o *ListVMMachineTypes2Default) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/virtual_machines/list_vm_machine_types_parameters.go b/internal/client/virtual_machines/list_vm_machine_types_parameters.go index 975a2d5..fbe3170 100644 --- a/internal/client/virtual_machines/list_vm_machine_types_parameters.go +++ b/internal/client/virtual_machines/list_vm_machine_types_parameters.go @@ -76,6 +76,9 @@ type ListVMMachineTypesParams struct { // GpuModel. GpuModel *string + // GpuModelID. + GpuModelID *string + // MemoryGib. // // Format: int32 @@ -207,6 +210,17 @@ func (o *ListVMMachineTypesParams) SetGpuModel(gpuModel *string) { o.GpuModel = gpuModel } +// WithGpuModelID adds the gpuModelID to the list VM machine types params +func (o *ListVMMachineTypesParams) WithGpuModelID(gpuModelID *string) *ListVMMachineTypesParams { + o.SetGpuModelID(gpuModelID) + return o +} + +// SetGpuModelID adds the gpuModelId to the list VM machine types params +func (o *ListVMMachineTypesParams) SetGpuModelID(gpuModelID *string) { + o.GpuModelID = gpuModelID +} + // WithMemoryGib adds the memoryGib to the list VM machine types params func (o *ListVMMachineTypesParams) WithMemoryGib(memoryGib int32) *ListVMMachineTypesParams { o.SetMemoryGib(memoryGib) @@ -371,6 +385,23 @@ func (o *ListVMMachineTypesParams) WriteToRequest(r runtime.ClientRequest, reg s } } + if o.GpuModelID != nil { + + // query param gpuModelId + var qrGpuModelID string + + if o.GpuModelID != nil { + qrGpuModelID = *o.GpuModelID + } + qGpuModelID := qrGpuModelID + if qGpuModelID != "" { + + if err := r.SetQueryParam("gpuModelId", qGpuModelID); err != nil { + return err + } + } + } + // query param memoryGib qrMemoryGib := o.MemoryGib qMemoryGib := swag.FormatInt32(qrMemoryGib) diff --git a/internal/client/virtual_machines/update_vm_metadata_parameters.go b/internal/client/virtual_machines/update_vm_metadata_parameters.go new file mode 100644 index 0000000..0f6705c --- /dev/null +++ b/internal/client/virtual_machines/update_vm_metadata_parameters.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// NewUpdateVMMetadataParams creates a new UpdateVMMetadataParams 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 NewUpdateVMMetadataParams() *UpdateVMMetadataParams { + return &UpdateVMMetadataParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateVMMetadataParamsWithTimeout creates a new UpdateVMMetadataParams object +// with the ability to set a timeout on a request. +func NewUpdateVMMetadataParamsWithTimeout(timeout time.Duration) *UpdateVMMetadataParams { + return &UpdateVMMetadataParams{ + timeout: timeout, + } +} + +// NewUpdateVMMetadataParamsWithContext creates a new UpdateVMMetadataParams object +// with the ability to set a context for a request. +func NewUpdateVMMetadataParamsWithContext(ctx context.Context) *UpdateVMMetadataParams { + return &UpdateVMMetadataParams{ + Context: ctx, + } +} + +// NewUpdateVMMetadataParamsWithHTTPClient creates a new UpdateVMMetadataParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateVMMetadataParamsWithHTTPClient(client *http.Client) *UpdateVMMetadataParams { + return &UpdateVMMetadataParams{ + HTTPClient: client, + } +} + +/* +UpdateVMMetadataParams contains all the parameters to send to the API endpoint + + for the update VM metadata operation. + + Typically these are written to a http.Request. +*/ +type UpdateVMMetadataParams struct { + + // Body. + Body *models.UpdateVMMetadataBody + + // ID. + ID string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update VM metadata params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateVMMetadataParams) WithDefaults() *UpdateVMMetadataParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update VM metadata params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateVMMetadataParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update VM metadata params +func (o *UpdateVMMetadataParams) WithTimeout(timeout time.Duration) *UpdateVMMetadataParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update VM metadata params +func (o *UpdateVMMetadataParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update VM metadata params +func (o *UpdateVMMetadataParams) WithContext(ctx context.Context) *UpdateVMMetadataParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update VM metadata params +func (o *UpdateVMMetadataParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update VM metadata params +func (o *UpdateVMMetadataParams) WithHTTPClient(client *http.Client) *UpdateVMMetadataParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update VM metadata params +func (o *UpdateVMMetadataParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the update VM metadata params +func (o *UpdateVMMetadataParams) WithBody(body *models.UpdateVMMetadataBody) *UpdateVMMetadataParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the update VM metadata params +func (o *UpdateVMMetadataParams) SetBody(body *models.UpdateVMMetadataBody) { + o.Body = body +} + +// WithID adds the id to the update VM metadata params +func (o *UpdateVMMetadataParams) WithID(id string) *UpdateVMMetadataParams { + o.SetID(id) + return o +} + +// SetID adds the id to the update VM metadata params +func (o *UpdateVMMetadataParams) SetID(id string) { + o.ID = id +} + +// WithProjectID adds the projectID to the update VM metadata params +func (o *UpdateVMMetadataParams) WithProjectID(projectID string) *UpdateVMMetadataParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the update VM metadata params +func (o *UpdateVMMetadataParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateVMMetadataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // path param projectId + if err := r.SetPathParam("projectId", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/client/virtual_machines/update_vm_metadata_responses.go b/internal/client/virtual_machines/update_vm_metadata_responses.go new file mode 100644 index 0000000..5c3d07e --- /dev/null +++ b/internal/client/virtual_machines/update_vm_metadata_responses.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package virtual_machines + +// 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/CudoVentures/terraform-provider-cudo/internal/models" +) + +// UpdateVMMetadataReader is a Reader for the UpdateVMMetadata structure. +type UpdateVMMetadataReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateVMMetadataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateVMMetadataOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUpdateVMMetadataDefault(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 + } +} + +// NewUpdateVMMetadataOK creates a UpdateVMMetadataOK with default headers values +func NewUpdateVMMetadataOK() *UpdateVMMetadataOK { + return &UpdateVMMetadataOK{} +} + +/* +UpdateVMMetadataOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UpdateVMMetadataOK struct { + Payload *models.UpdateVMMetadataResponse +} + +// IsSuccess returns true when this update Vm metadata o k response has a 2xx status code +func (o *UpdateVMMetadataOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update Vm metadata o k response has a 3xx status code +func (o *UpdateVMMetadataOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update Vm metadata o k response has a 4xx status code +func (o *UpdateVMMetadataOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update Vm metadata o k response has a 5xx status code +func (o *UpdateVMMetadataOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update Vm metadata o k response a status code equal to that given +func (o *UpdateVMMetadataOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update Vm metadata o k response +func (o *UpdateVMMetadataOK) Code() int { + return 200 +} + +func (o *UpdateVMMetadataOK) Error() string { + return fmt.Sprintf("[POST /v1/projects/{projectId}/vm/{id}/metadata][%d] updateVmMetadataOK %+v", 200, o.Payload) +} + +func (o *UpdateVMMetadataOK) String() string { + return fmt.Sprintf("[POST /v1/projects/{projectId}/vm/{id}/metadata][%d] updateVmMetadataOK %+v", 200, o.Payload) +} + +func (o *UpdateVMMetadataOK) GetPayload() *models.UpdateVMMetadataResponse { + return o.Payload +} + +func (o *UpdateVMMetadataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UpdateVMMetadataResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUpdateVMMetadataDefault creates a UpdateVMMetadataDefault with default headers values +func NewUpdateVMMetadataDefault(code int) *UpdateVMMetadataDefault { + return &UpdateVMMetadataDefault{ + _statusCode: code, + } +} + +/* +UpdateVMMetadataDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UpdateVMMetadataDefault struct { + _statusCode int + + Payload *models.Status +} + +// IsSuccess returns true when this update VM metadata default response has a 2xx status code +func (o *UpdateVMMetadataDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this update VM metadata default response has a 3xx status code +func (o *UpdateVMMetadataDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this update VM metadata default response has a 4xx status code +func (o *UpdateVMMetadataDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this update VM metadata default response has a 5xx status code +func (o *UpdateVMMetadataDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this update VM metadata default response a status code equal to that given +func (o *UpdateVMMetadataDefault) IsCode(code int) bool { + return o._statusCode == code +} + +// Code gets the status code for the update VM metadata default response +func (o *UpdateVMMetadataDefault) Code() int { + return o._statusCode +} + +func (o *UpdateVMMetadataDefault) Error() string { + return fmt.Sprintf("[POST /v1/projects/{projectId}/vm/{id}/metadata][%d] UpdateVMMetadata default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateVMMetadataDefault) String() string { + return fmt.Sprintf("[POST /v1/projects/{projectId}/vm/{id}/metadata][%d] UpdateVMMetadata default %+v", o._statusCode, o.Payload) +} + +func (o *UpdateVMMetadataDefault) GetPayload() *models.Status { + return o.Payload +} + +func (o *UpdateVMMetadataDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/internal/client/virtual_machines/virtual_machines_client.go b/internal/client/virtual_machines/virtual_machines_client.go index f7d588f..6802c17 100644 --- a/internal/client/virtual_machines/virtual_machines_client.go +++ b/internal/client/virtual_machines/virtual_machines_client.go @@ -28,6 +28,8 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { + AttachSecurityGroup(params *AttachSecurityGroupParams, opts ...ClientOption) (*AttachSecurityGroupOK, error) + ConnectVM(params *ConnectVMParams, opts ...ClientOption) (*ConnectVMOK, error) CountVMs(params *CountVMsParams, opts ...ClientOption) (*CountVMsOK, error) @@ -38,6 +40,8 @@ type ClientService interface { DeletePrivateVMImage(params *DeletePrivateVMImageParams, opts ...ClientOption) (*DeletePrivateVMImageOK, error) + DetachSecurityGroup(params *DetachSecurityGroupParams, opts ...ClientOption) (*DetachSecurityGroupOK, error) + GetPrivateVMImage(params *GetPrivateVMImageParams, opts ...ClientOption) (*GetPrivateVMImageOK, error) GetVM(params *GetVMParams, opts ...ClientOption) (*GetVMOK, error) @@ -52,6 +56,8 @@ type ClientService interface { ListVMMachineTypes(params *ListVMMachineTypesParams, opts ...ClientOption) (*ListVMMachineTypesOK, error) + ListVMMachineTypes2(params *ListVMMachineTypes2Params, opts ...ClientOption) (*ListVMMachineTypes2OK, error) + ListVMs(params *ListVMsParams, opts ...ClientOption) (*ListVMsOK, error) MonitorVM(params *MonitorVMParams, opts ...ClientOption) (*MonitorVMOK, error) @@ -70,9 +76,48 @@ type ClientService interface { UpdatePrivateVMImage(params *UpdatePrivateVMImageParams, opts ...ClientOption) (*UpdatePrivateVMImageOK, error) + UpdateVMMetadata(params *UpdateVMMetadataParams, opts ...ClientOption) (*UpdateVMMetadataOK, error) + SetTransport(transport runtime.ClientTransport) } +/* +AttachSecurityGroup attaches security group to VM +*/ +func (a *Client) AttachSecurityGroup(params *AttachSecurityGroupParams, opts ...ClientOption) (*AttachSecurityGroupOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAttachSecurityGroupParams() + } + op := &runtime.ClientOperation{ + ID: "AttachSecurityGroup", + Method: "PATCH", + PathPattern: "/v1/projects/{projectId}/vm/{id}/security-group/attach", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &AttachSecurityGroupReader{formats: a.formats}, + 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.(*AttachSecurityGroupOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*AttachSecurityGroupDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ConnectVM connects via v n c */ @@ -258,6 +303,43 @@ func (a *Client) DeletePrivateVMImage(params *DeletePrivateVMImageParams, opts . return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +DetachSecurityGroup attaches security group to VM +*/ +func (a *Client) DetachSecurityGroup(params *DetachSecurityGroupParams, opts ...ClientOption) (*DetachSecurityGroupOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDetachSecurityGroupParams() + } + op := &runtime.ClientOperation{ + ID: "DetachSecurityGroup", + Method: "PATCH", + PathPattern: "/v1/projects/{projectId}/vm/{id}/security-group/detach", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &DetachSecurityGroupReader{formats: a.formats}, + 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.(*DetachSecurityGroupOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DetachSecurityGroupDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* GetPrivateVMImage gets private VM image */ @@ -517,6 +599,43 @@ func (a *Client) ListVMMachineTypes(params *ListVMMachineTypesParams, opts ...Cl return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +ListVMMachineTypes2 lists machine types v2 +*/ +func (a *Client) ListVMMachineTypes2(params *ListVMMachineTypes2Params, opts ...ClientOption) (*ListVMMachineTypes2OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListVMMachineTypes2Params() + } + op := &runtime.ClientOperation{ + ID: "ListVMMachineTypes2", + Method: "GET", + PathPattern: "/v1/vms/machine-types-2", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListVMMachineTypes2Reader{formats: a.formats}, + 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.(*ListVMMachineTypes2OK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListVMMachineTypes2Default) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ListVMs lists */ @@ -850,6 +969,43 @@ func (a *Client) UpdatePrivateVMImage(params *UpdatePrivateVMImageParams, opts . return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +UpdateVMMetadata updates VM metadata +*/ +func (a *Client) UpdateVMMetadata(params *UpdateVMMetadataParams, opts ...ClientOption) (*UpdateVMMetadataOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateVMMetadataParams() + } + op := &runtime.ClientOperation{ + ID: "UpdateVMMetadata", + Method: "POST", + PathPattern: "/v1/projects/{projectId}/vm/{id}/metadata", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &UpdateVMMetadataReader{formats: a.formats}, + 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.(*UpdateVMMetadataOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UpdateVMMetadataDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport diff --git a/internal/models/activate_body.go b/internal/models/activate_body.go new file mode 100644 index 0000000..18bf61c --- /dev/null +++ b/internal/models/activate_body.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" +) + +// ActivateBody activate body +// +// swagger:model ActivateBody +type ActivateBody struct { + + // data center Id + DataCenterID string `json:"dataCenterId,omitempty"` +} + +// Validate validates this activate body +func (m *ActivateBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this activate body based on context it is used +func (m *ActivateBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ActivateBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActivateBody) UnmarshalBinary(b []byte) error { + var res ActivateBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/add_billing_account_user_permission_body.go b/internal/models/add_billing_account_user_permission_body.go new file mode 100644 index 0000000..f0a31d2 --- /dev/null +++ b/internal/models/add_billing_account_user_permission_body.go @@ -0,0 +1,135 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// AddBillingAccountUserPermissionBody add billing account user permission body +// +// swagger:model AddBillingAccountUserPermissionBody +type AddBillingAccountUserPermissionBody struct { + + // data center Id + DataCenterID string `json:"dataCenterId,omitempty"` + + // project Id + ProjectID string `json:"projectId,omitempty"` + + // role + // Required: true + Role *Role `json:"role"` + + // user email + // Required: true + UserEmail *string `json:"userEmail"` +} + +// Validate validates this add billing account user permission body +func (m *AddBillingAccountUserPermissionBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserEmail(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddBillingAccountUserPermissionBody) validateRole(formats strfmt.Registry) error { + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *AddBillingAccountUserPermissionBody) validateUserEmail(formats strfmt.Registry) error { + + if err := validate.Required("userEmail", "body", m.UserEmail); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this add billing account user permission body based on the context it is used +func (m *AddBillingAccountUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddBillingAccountUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AddBillingAccountUserPermissionBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AddBillingAccountUserPermissionBody) UnmarshalBinary(b []byte) error { + var res AddBillingAccountUserPermissionBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/add_data_center_user_permission_body.go b/internal/models/add_data_center_user_permission_body.go new file mode 100644 index 0000000..504ccbd --- /dev/null +++ b/internal/models/add_data_center_user_permission_body.go @@ -0,0 +1,135 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// AddDataCenterUserPermissionBody add data center user permission body +// +// swagger:model AddDataCenterUserPermissionBody +type AddDataCenterUserPermissionBody struct { + + // billing account Id + BillingAccountID string `json:"billingAccountId,omitempty"` + + // project Id + ProjectID string `json:"projectId,omitempty"` + + // role + // Required: true + Role *Role `json:"role"` + + // user email + // Required: true + UserEmail *string `json:"userEmail"` +} + +// Validate validates this add data center user permission body +func (m *AddDataCenterUserPermissionBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserEmail(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddDataCenterUserPermissionBody) validateRole(formats strfmt.Registry) error { + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *AddDataCenterUserPermissionBody) validateUserEmail(formats strfmt.Registry) error { + + if err := validate.Required("userEmail", "body", m.UserEmail); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this add data center user permission body based on the context it is used +func (m *AddDataCenterUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddDataCenterUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AddDataCenterUserPermissionBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AddDataCenterUserPermissionBody) UnmarshalBinary(b []byte) error { + var res AddDataCenterUserPermissionBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/add_project_user_permission_body.go b/internal/models/add_project_user_permission_body.go new file mode 100644 index 0000000..2311f4d --- /dev/null +++ b/internal/models/add_project_user_permission_body.go @@ -0,0 +1,135 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// AddProjectUserPermissionBody add project user permission body +// +// swagger:model AddProjectUserPermissionBody +type AddProjectUserPermissionBody struct { + + // billing account Id + BillingAccountID string `json:"billingAccountId,omitempty"` + + // data center Id + DataCenterID string `json:"dataCenterId,omitempty"` + + // role + // Required: true + Role *Role `json:"role"` + + // user email + // Required: true + UserEmail *string `json:"userEmail"` +} + +// Validate validates this add project user permission body +func (m *AddProjectUserPermissionBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserEmail(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddProjectUserPermissionBody) validateRole(formats strfmt.Registry) error { + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *AddProjectUserPermissionBody) validateUserEmail(formats strfmt.Registry) error { + + if err := validate.Required("userEmail", "body", m.UserEmail); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this add project user permission body based on the context it is used +func (m *AddProjectUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AddProjectUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AddProjectUserPermissionBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AddProjectUserPermissionBody) UnmarshalBinary(b []byte) error { + var res AddProjectUserPermissionBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/attach_security_group_response.go b/internal/models/attach_security_group_response.go new file mode 100644 index 0000000..6e38a7c --- /dev/null +++ b/internal/models/attach_security_group_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 + +// AttachSecurityGroupResponse attach security group response +// +// swagger:model AttachSecurityGroupResponse +type AttachSecurityGroupResponse interface{} diff --git a/internal/models/billing_account.go b/internal/models/billing_account.go new file mode 100644 index 0000000..4b854b2 --- /dev/null +++ b/internal/models/billing_account.go @@ -0,0 +1,336 @@ +// 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" + "github.com/go-openapi/validate" +) + +// BillingAccount billing account +// +// swagger:model BillingAccount +type BillingAccount struct { + + // billing threshold + // Read Only: true + BillingThreshold *Decimal `json:"billingThreshold,omitempty"` + + // blocked + // Read Only: true + Blocked *bool `json:"blocked,omitempty"` + + // create by + // Read Only: true + CreateBy string `json:"createBy,omitempty"` + + // create time + // Read Only: true + // Format: date-time + CreateTime strfmt.DateTime `json:"createTime,omitempty"` + + // demand enabled + // Read Only: true + DemandEnabled *bool `json:"demandEnabled,omitempty"` + + // display name + DisplayName string `json:"displayName,omitempty"` + + // id + // Read Only: true + ID string `json:"id,omitempty"` + + // invoice time + // Read Only: true + // Format: date-time + InvoiceTime strfmt.DateTime `json:"invoiceTime,omitempty"` + + // monthly spend + MonthlySpend string `json:"monthlySpend,omitempty"` + + // stripe ref + StripeRef string `json:"stripeRef,omitempty"` + + // supply enabled + // Read Only: true + SupplyEnabled *bool `json:"supplyEnabled,omitempty"` + + // tax ids + TaxIds []*TaxID `json:"taxIds"` +} + +// Validate validates this billing account +func (m *BillingAccount) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillingThreshold(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInvoiceTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTaxIds(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccount) validateBillingThreshold(formats strfmt.Registry) error { + if swag.IsZero(m.BillingThreshold) { // not required + return nil + } + + if m.BillingThreshold != nil { + if err := m.BillingThreshold.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingThreshold") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingThreshold") + } + return err + } + } + + return nil +} + +func (m *BillingAccount) validateCreateTime(formats strfmt.Registry) error { + if swag.IsZero(m.CreateTime) { // not required + return nil + } + + if err := validate.FormatOf("createTime", "body", "date-time", m.CreateTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) validateInvoiceTime(formats strfmt.Registry) error { + if swag.IsZero(m.InvoiceTime) { // not required + return nil + } + + if err := validate.FormatOf("invoiceTime", "body", "date-time", m.InvoiceTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) validateTaxIds(formats strfmt.Registry) error { + if swag.IsZero(m.TaxIds) { // not required + return nil + } + + for i := 0; i < len(m.TaxIds); i++ { + if swag.IsZero(m.TaxIds[i]) { // not required + continue + } + + if m.TaxIds[i] != nil { + if err := m.TaxIds[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this billing account based on the context it is used +func (m *BillingAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingThreshold(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBlocked(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCreateBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCreateTime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDemandEnabled(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInvoiceTime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSupplyEnabled(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxIds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccount) contextValidateBillingThreshold(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingThreshold != nil { + + if swag.IsZero(m.BillingThreshold) { // not required + return nil + } + + if err := m.BillingThreshold.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingThreshold") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingThreshold") + } + return err + } + } + + return nil +} + +func (m *BillingAccount) contextValidateBlocked(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "blocked", "body", m.Blocked); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) contextValidateCreateBy(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "createBy", "body", string(m.CreateBy)); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) contextValidateCreateTime(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "createTime", "body", strfmt.DateTime(m.CreateTime)); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) contextValidateDemandEnabled(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "demandEnabled", "body", m.DemandEnabled); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) contextValidateInvoiceTime(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "invoiceTime", "body", strfmt.DateTime(m.InvoiceTime)); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) contextValidateSupplyEnabled(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "supplyEnabled", "body", m.SupplyEnabled); err != nil { + return err + } + + return nil +} + +func (m *BillingAccount) contextValidateTaxIds(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxIds); i++ { + + if m.TaxIds[i] != nil { + + if swag.IsZero(m.TaxIds[i]) { // not required + return nil + } + + if err := m.TaxIds[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *BillingAccount) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BillingAccount) UnmarshalBinary(b []byte) error { + var res BillingAccount + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/billing_account_payment_method.go b/internal/models/billing_account_payment_method.go new file mode 100644 index 0000000..3444803 --- /dev/null +++ b/internal/models/billing_account_payment_method.go @@ -0,0 +1,169 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// BillingAccountPaymentMethod billing account payment method +// +// swagger:model BillingAccountPaymentMethod +type BillingAccountPaymentMethod struct { + + // card + Card *PaymentMethodCard `json:"card,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // is default + IsDefault bool `json:"isDefault,omitempty"` + + // paypal + Paypal *PaymentMethodPaypal `json:"paypal,omitempty"` + + // type + Type string `json:"type,omitempty"` +} + +// Validate validates this billing account payment method +func (m *BillingAccountPaymentMethod) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCard(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePaypal(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccountPaymentMethod) validateCard(formats strfmt.Registry) error { + if swag.IsZero(m.Card) { // not required + return nil + } + + if m.Card != nil { + if err := m.Card.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *BillingAccountPaymentMethod) validatePaypal(formats strfmt.Registry) error { + if swag.IsZero(m.Paypal) { // not required + return nil + } + + if m.Paypal != nil { + if err := m.Paypal.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("paypal") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("paypal") + } + return err + } + } + + return nil +} + +// ContextValidate validate this billing account payment method based on the context it is used +func (m *BillingAccountPaymentMethod) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCard(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePaypal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccountPaymentMethod) contextValidateCard(ctx context.Context, formats strfmt.Registry) error { + + if m.Card != nil { + + if swag.IsZero(m.Card) { // not required + return nil + } + + if err := m.Card.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *BillingAccountPaymentMethod) contextValidatePaypal(ctx context.Context, formats strfmt.Registry) error { + + if m.Paypal != nil { + + if swag.IsZero(m.Paypal) { // not required + return nil + } + + if err := m.Paypal.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("paypal") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("paypal") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *BillingAccountPaymentMethod) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BillingAccountPaymentMethod) UnmarshalBinary(b []byte) error { + var res BillingAccountPaymentMethod + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/billing_account_payment_methods.go b/internal/models/billing_account_payment_methods.go new file mode 100644 index 0000000..f2a65fd --- /dev/null +++ b/internal/models/billing_account_payment_methods.go @@ -0,0 +1,121 @@ +// 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" +) + +// BillingAccountPaymentMethods billing account payment methods +// +// swagger:model BillingAccountPaymentMethods +type BillingAccountPaymentMethods struct { + + // payment methods + PaymentMethods []*BillingAccountPaymentMethod `json:"paymentMethods"` +} + +// Validate validates this billing account payment methods +func (m *BillingAccountPaymentMethods) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePaymentMethods(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccountPaymentMethods) validatePaymentMethods(formats strfmt.Registry) error { + if swag.IsZero(m.PaymentMethods) { // not required + return nil + } + + for i := 0; i < len(m.PaymentMethods); i++ { + if swag.IsZero(m.PaymentMethods[i]) { // not required + continue + } + + if m.PaymentMethods[i] != nil { + if err := m.PaymentMethods[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("paymentMethods" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("paymentMethods" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this billing account payment methods based on the context it is used +func (m *BillingAccountPaymentMethods) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePaymentMethods(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccountPaymentMethods) contextValidatePaymentMethods(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PaymentMethods); i++ { + + if m.PaymentMethods[i] != nil { + + if swag.IsZero(m.PaymentMethods[i]) { // not required + return nil + } + + if err := m.PaymentMethods[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("paymentMethods" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("paymentMethods" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *BillingAccountPaymentMethods) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BillingAccountPaymentMethods) UnmarshalBinary(b []byte) error { + var res BillingAccountPaymentMethods + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/billing_account_setup_intent.go b/internal/models/billing_account_setup_intent.go new file mode 100644 index 0000000..b396eee --- /dev/null +++ b/internal/models/billing_account_setup_intent.go @@ -0,0 +1,88 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// BillingAccountSetupIntent billing account setup intent +// +// swagger:model BillingAccountSetupIntent +type BillingAccountSetupIntent struct { + + // client secret + // Required: true + ClientSecret *string `json:"clientSecret"` + + // id + // Required: true + ID *string `json:"id"` +} + +// Validate validates this billing account setup intent +func (m *BillingAccountSetupIntent) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClientSecret(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccountSetupIntent) validateClientSecret(formats strfmt.Registry) error { + + if err := validate.Required("clientSecret", "body", m.ClientSecret); err != nil { + return err + } + + return nil +} + +func (m *BillingAccountSetupIntent) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this billing account setup intent based on context it is used +func (m *BillingAccountSetupIntent) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *BillingAccountSetupIntent) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BillingAccountSetupIntent) UnmarshalBinary(b []byte) error { + var res BillingAccountSetupIntent + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/billing_account_spend_row.go b/internal/models/billing_account_spend_row.go new file mode 100644 index 0000000..ef31c60 --- /dev/null +++ b/internal/models/billing_account_spend_row.go @@ -0,0 +1,261 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// BillingAccountSpendRow billing account spend row +// +// swagger:model BillingAccountSpendRow +type BillingAccountSpendRow struct { + + // amount + // Required: true + Amount *Decimal `json:"amount"` + + // description + // Required: true + Description *string `json:"description"` + + // project Id + // Required: true + ProjectID *string `json:"projectId"` + + // quantity + // Required: true + Quantity *float32 `json:"quantity"` + + // unit + // Required: true + Unit *Unit `json:"unit"` + + // unit amount + // Required: true + UnitAmount *Decimal `json:"unitAmount"` +} + +// Validate validates this billing account spend row +func (m *BillingAccountSpendRow) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAmount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateQuantity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUnit(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUnitAmount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccountSpendRow) validateAmount(formats strfmt.Registry) error { + + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *BillingAccountSpendRow) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *BillingAccountSpendRow) validateProjectID(formats strfmt.Registry) error { + + if err := validate.Required("projectId", "body", m.ProjectID); err != nil { + return err + } + + return nil +} + +func (m *BillingAccountSpendRow) validateQuantity(formats strfmt.Registry) error { + + if err := validate.Required("quantity", "body", m.Quantity); err != nil { + return err + } + + return nil +} + +func (m *BillingAccountSpendRow) validateUnit(formats strfmt.Registry) error { + + if err := validate.Required("unit", "body", m.Unit); err != nil { + return err + } + + if err := validate.Required("unit", "body", m.Unit); err != nil { + return err + } + + if m.Unit != nil { + if err := m.Unit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unit") + } + return err + } + } + + return nil +} + +func (m *BillingAccountSpendRow) validateUnitAmount(formats strfmt.Registry) error { + + if err := validate.Required("unitAmount", "body", m.UnitAmount); err != nil { + return err + } + + if m.UnitAmount != nil { + if err := m.UnitAmount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unitAmount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unitAmount") + } + return err + } + } + + return nil +} + +// ContextValidate validate this billing account spend row based on the context it is used +func (m *BillingAccountSpendRow) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnit(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnitAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BillingAccountSpendRow) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *BillingAccountSpendRow) contextValidateUnit(ctx context.Context, formats strfmt.Registry) error { + + if m.Unit != nil { + + if err := m.Unit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unit") + } + return err + } + } + + return nil +} + +func (m *BillingAccountSpendRow) contextValidateUnitAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.UnitAmount != nil { + + if err := m.UnitAmount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unitAmount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unitAmount") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *BillingAccountSpendRow) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *BillingAccountSpendRow) UnmarshalBinary(b []byte) error { + var res BillingAccountSpendRow + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/cluster.go b/internal/models/cluster.go new file mode 100644 index 0000000..b91ea6e --- /dev/null +++ b/internal/models/cluster.go @@ -0,0 +1,573 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Cluster cluster +// +// swagger:model Cluster +type Cluster struct { + + // cpu model + // Required: true + CPUModel *string `json:"cpuModel"` + + // create time + // Required: true + // Format: date-time + CreateTime *strfmt.DateTime `json:"createTime"` + + // gpu free + // Required: true + GpuFree *int32 `json:"gpuFree"` + + // gpu model + // Required: true + GpuModel *string `json:"gpuModel"` + + // gpu model Id + // Required: true + GpuModelID *string `json:"gpuModelId"` + + // gpu model pci types + // Required: true + GpuModelPciTypes []string `json:"gpuModelPciTypes"` + + // gpu price hr + // Required: true + GpuPriceHr *Decimal `json:"gpuPriceHr"` + + // gpu used + // Required: true + GpuUsed *int32 `json:"gpuUsed"` + + // host count + // Required: true + HostCount *int32 `json:"hostCount"` + + // host problem count + // Required: true + HostProblemCount *int32 `json:"hostProblemCount"` + + // machine type + // Required: true + MachineType *string `json:"machineType"` + + // max vcpu per gpu + // Required: true + MaxVcpuPerGpu *float64 `json:"maxVcpuPerGpu"` + + // max vcpu per memory gib + // Required: true + MaxVcpuPerMemoryGib *float64 `json:"maxVcpuPerMemoryGib"` + + // memory gib free + // Required: true + MemoryGibFree *int32 `json:"memoryGibFree"` + + // memory gib price hr + // Required: true + MemoryGibPriceHr *Decimal `json:"memoryGibPriceHr"` + + // memory gib used + // Required: true + MemoryGibUsed *int32 `json:"memoryGibUsed"` + + // min vcpu per gpu + // Required: true + MinVcpuPerGpu *float64 `json:"minVcpuPerGpu"` + + // min vcpu per memory gib + // Required: true + MinVcpuPerMemoryGib *float64 `json:"minVcpuPerMemoryGib"` + + // update time + // Required: true + // Format: date-time + UpdateTime *strfmt.DateTime `json:"updateTime"` + + // vcpu free + // Required: true + VcpuFree *int32 `json:"vcpuFree"` + + // vcpu per Cpu thread + // Required: true + VcpuPerCPUThread *int32 `json:"vcpuPerCpuThread"` + + // vcpu price hr + // Required: true + VcpuPriceHr *Decimal `json:"vcpuPriceHr"` + + // vcpu used + // Required: true + VcpuUsed *int32 `json:"vcpuUsed"` + + // vm count + // Required: true + VMCount *int32 `json:"vmCount"` +} + +// Validate validates this cluster +func (m *Cluster) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCPUModel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModelID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModelPciTypes(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostCount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostProblemCount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMachineType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuPerGpu(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuPerMemoryGib(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinVcpuPerGpu(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinVcpuPerMemoryGib(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuPerCPUThread(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVMCount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Cluster) validateCPUModel(formats strfmt.Registry) error { + + if err := validate.Required("cpuModel", "body", m.CPUModel); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateCreateTime(formats strfmt.Registry) error { + + if err := validate.Required("createTime", "body", m.CreateTime); err != nil { + return err + } + + if err := validate.FormatOf("createTime", "body", "date-time", m.CreateTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateGpuFree(formats strfmt.Registry) error { + + if err := validate.Required("gpuFree", "body", m.GpuFree); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateGpuModel(formats strfmt.Registry) error { + + if err := validate.Required("gpuModel", "body", m.GpuModel); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateGpuModelID(formats strfmt.Registry) error { + + if err := validate.Required("gpuModelId", "body", m.GpuModelID); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateGpuModelPciTypes(formats strfmt.Registry) error { + + if err := validate.Required("gpuModelPciTypes", "body", m.GpuModelPciTypes); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateGpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("gpuPriceHr", "body", m.GpuPriceHr); err != nil { + return err + } + + if m.GpuPriceHr != nil { + if err := m.GpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *Cluster) validateGpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("gpuUsed", "body", m.GpuUsed); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateHostCount(formats strfmt.Registry) error { + + if err := validate.Required("hostCount", "body", m.HostCount); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateHostProblemCount(formats strfmt.Registry) error { + + if err := validate.Required("hostProblemCount", "body", m.HostProblemCount); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateMachineType(formats strfmt.Registry) error { + + if err := validate.Required("machineType", "body", m.MachineType); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateMaxVcpuPerGpu(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuPerGpu", "body", m.MaxVcpuPerGpu); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateMaxVcpuPerMemoryGib(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuPerMemoryGib", "body", m.MaxVcpuPerMemoryGib); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateMemoryGibFree(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibFree", "body", m.MemoryGibFree); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateMemoryGibPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibPriceHr", "body", m.MemoryGibPriceHr); err != nil { + return err + } + + if m.MemoryGibPriceHr != nil { + if err := m.MemoryGibPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *Cluster) validateMemoryGibUsed(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibUsed", "body", m.MemoryGibUsed); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateMinVcpuPerGpu(formats strfmt.Registry) error { + + if err := validate.Required("minVcpuPerGpu", "body", m.MinVcpuPerGpu); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateMinVcpuPerMemoryGib(formats strfmt.Registry) error { + + if err := validate.Required("minVcpuPerMemoryGib", "body", m.MinVcpuPerMemoryGib); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("updateTime", "body", m.UpdateTime); err != nil { + return err + } + + if err := validate.FormatOf("updateTime", "body", "date-time", m.UpdateTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateVcpuFree(formats strfmt.Registry) error { + + if err := validate.Required("vcpuFree", "body", m.VcpuFree); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateVcpuPerCPUThread(formats strfmt.Registry) error { + + if err := validate.Required("vcpuPerCpuThread", "body", m.VcpuPerCPUThread); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateVcpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("vcpuPriceHr", "body", m.VcpuPriceHr); err != nil { + return err + } + + if m.VcpuPriceHr != nil { + if err := m.VcpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vcpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *Cluster) validateVcpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("vcpuUsed", "body", m.VcpuUsed); err != nil { + return err + } + + return nil +} + +func (m *Cluster) validateVMCount(formats strfmt.Registry) error { + + if err := validate.Required("vmCount", "body", m.VMCount); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this cluster based on the context it is used +func (m *Cluster) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemoryGibPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVcpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Cluster) contextValidateGpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.GpuPriceHr != nil { + + if err := m.GpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *Cluster) contextValidateMemoryGibPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MemoryGibPriceHr != nil { + + if err := m.MemoryGibPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *Cluster) contextValidateVcpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.VcpuPriceHr != nil { + + if err := m.VcpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vcpuPriceHr") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Cluster) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Cluster) UnmarshalBinary(b []byte) error { + var res Cluster + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/count_hosts_response.go b/internal/models/count_hosts_response.go new file mode 100644 index 0000000..b6bd415 --- /dev/null +++ b/internal/models/count_hosts_response.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CountHostsResponse count hosts response +// +// swagger:model CountHostsResponse +type CountHostsResponse struct { + + // count + // Required: true + Count *int32 `json:"count"` +} + +// Validate validates this count hosts response +func (m *CountHostsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CountHostsResponse) validateCount(formats strfmt.Registry) error { + + if err := validate.Required("count", "body", m.Count); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this count hosts response based on context it is used +func (m *CountHostsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CountHostsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CountHostsResponse) UnmarshalBinary(b []byte) error { + var res CountHostsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/cpu_topology.go b/internal/models/cpu_topology.go new file mode 100644 index 0000000..ce6f9d4 --- /dev/null +++ b/internal/models/cpu_topology.go @@ -0,0 +1,56 @@ +// 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" +) + +// CPUTopology Cpu topology +// +// swagger:model CpuTopology +type CPUTopology struct { + + // cores + Cores int32 `json:"cores,omitempty"` + + // sockets + Sockets int32 `json:"sockets,omitempty"` + + // threads + Threads int32 `json:"threads,omitempty"` +} + +// Validate validates this Cpu topology +func (m *CPUTopology) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this Cpu topology based on context it is used +func (m *CPUTopology) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CPUTopology) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CPUTopology) UnmarshalBinary(b []byte) error { + var res CPUTopology + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/create_billing_account_request.go b/internal/models/create_billing_account_request.go new file mode 100644 index 0000000..7f3d8da --- /dev/null +++ b/internal/models/create_billing_account_request.go @@ -0,0 +1,176 @@ +// 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" + "github.com/go-openapi/validate" +) + +// CreateBillingAccountRequest create billing account request +// +// swagger:model CreateBillingAccountRequest +type CreateBillingAccountRequest struct { + + // display name + // Required: true + DisplayName *string `json:"displayName"` + + // email + // Required: true + Email *string `json:"email"` + + // invoice name + // Required: true + InvoiceName *string `json:"invoiceName"` + + // referral + Referral string `json:"referral,omitempty"` + + // tax ids + TaxIds []*TaxID `json:"taxIds"` +} + +// Validate validates this create billing account request +func (m *CreateBillingAccountRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisplayName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInvoiceName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTaxIds(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateBillingAccountRequest) validateDisplayName(formats strfmt.Registry) error { + + if err := validate.Required("displayName", "body", m.DisplayName); err != nil { + return err + } + + return nil +} + +func (m *CreateBillingAccountRequest) validateEmail(formats strfmt.Registry) error { + + if err := validate.Required("email", "body", m.Email); err != nil { + return err + } + + return nil +} + +func (m *CreateBillingAccountRequest) validateInvoiceName(formats strfmt.Registry) error { + + if err := validate.Required("invoiceName", "body", m.InvoiceName); err != nil { + return err + } + + return nil +} + +func (m *CreateBillingAccountRequest) validateTaxIds(formats strfmt.Registry) error { + if swag.IsZero(m.TaxIds) { // not required + return nil + } + + for i := 0; i < len(m.TaxIds); i++ { + if swag.IsZero(m.TaxIds[i]) { // not required + continue + } + + if m.TaxIds[i] != nil { + if err := m.TaxIds[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this create billing account request based on the context it is used +func (m *CreateBillingAccountRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTaxIds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateBillingAccountRequest) contextValidateTaxIds(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxIds); i++ { + + if m.TaxIds[i] != nil { + + if swag.IsZero(m.TaxIds[i]) { // not required + return nil + } + + if err := m.TaxIds[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taxIds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateBillingAccountRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateBillingAccountRequest) UnmarshalBinary(b []byte) error { + var res CreateBillingAccountRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/create_disk_snapshot_body.go b/internal/models/create_disk_snapshot_body.go new file mode 100644 index 0000000..045342c --- /dev/null +++ b/internal/models/create_disk_snapshot_body.go @@ -0,0 +1,88 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CreateDiskSnapshotBody create disk snapshot body +// +// swagger:model CreateDiskSnapshotBody +type CreateDiskSnapshotBody struct { + + // snapshot Id + // Required: true + SnapshotID *string `json:"snapshotId"` + + // vm Id + // Required: true + VMID *string `json:"vmId"` +} + +// Validate validates this create disk snapshot body +func (m *CreateDiskSnapshotBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSnapshotID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVMID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateDiskSnapshotBody) validateSnapshotID(formats strfmt.Registry) error { + + if err := validate.Required("snapshotId", "body", m.SnapshotID); err != nil { + return err + } + + return nil +} + +func (m *CreateDiskSnapshotBody) validateVMID(formats strfmt.Registry) error { + + if err := validate.Required("vmId", "body", m.VMID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this create disk snapshot body based on context it is used +func (m *CreateDiskSnapshotBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CreateDiskSnapshotBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateDiskSnapshotBody) UnmarshalBinary(b []byte) error { + var res CreateDiskSnapshotBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/create_network_body.go b/internal/models/create_network_body.go new file mode 100644 index 0000000..27e9eb7 --- /dev/null +++ b/internal/models/create_network_body.go @@ -0,0 +1,161 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CreateNetworkBody create network body +// +// swagger:model CreateNetworkBody +type CreateNetworkBody struct { + + // cidr prefix + // Required: true + CidrPrefix *string `json:"cidrPrefix"` + + // data center Id + // Required: true + DataCenterID *string `json:"dataCenterId"` + + // id + // Required: true + ID *string `json:"id"` + + // vrouter size + VrouterSize *V1VRouterSize `json:"vrouterSize,omitempty"` +} + +// Validate validates this create network body +func (m *CreateNetworkBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidrPrefix(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDataCenterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVrouterSize(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateNetworkBody) validateCidrPrefix(formats strfmt.Registry) error { + + if err := validate.Required("cidrPrefix", "body", m.CidrPrefix); err != nil { + return err + } + + return nil +} + +func (m *CreateNetworkBody) validateDataCenterID(formats strfmt.Registry) error { + + if err := validate.Required("dataCenterId", "body", m.DataCenterID); err != nil { + return err + } + + return nil +} + +func (m *CreateNetworkBody) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *CreateNetworkBody) validateVrouterSize(formats strfmt.Registry) error { + if swag.IsZero(m.VrouterSize) { // not required + return nil + } + + if m.VrouterSize != nil { + if err := m.VrouterSize.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vrouterSize") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vrouterSize") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create network body based on the context it is used +func (m *CreateNetworkBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVrouterSize(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateNetworkBody) contextValidateVrouterSize(ctx context.Context, formats strfmt.Registry) error { + + if m.VrouterSize != nil { + + if swag.IsZero(m.VrouterSize) { // not required + return nil + } + + if err := m.VrouterSize.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vrouterSize") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vrouterSize") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateNetworkBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateNetworkBody) UnmarshalBinary(b []byte) error { + var res CreateNetworkBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/create_object_storage_user_body.go b/internal/models/create_object_storage_user_body.go new file mode 100644 index 0000000..f1f2e27 --- /dev/null +++ b/internal/models/create_object_storage_user_body.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" +) + +// CreateObjectStorageUserBody create object storage user body +// +// swagger:model CreateObjectStorageUserBody +type CreateObjectStorageUserBody struct { + + // id + ID string `json:"id,omitempty"` +} + +// Validate validates this create object storage user body +func (m *CreateObjectStorageUserBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this create object storage user body based on context it is used +func (m *CreateObjectStorageUserBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CreateObjectStorageUserBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateObjectStorageUserBody) UnmarshalBinary(b []byte) error { + var res CreateObjectStorageUserBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/create_storage_disk_body.go b/internal/models/create_storage_disk_body.go new file mode 100644 index 0000000..51d0ac6 --- /dev/null +++ b/internal/models/create_storage_disk_body.go @@ -0,0 +1,112 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CreateStorageDiskBody create storage disk body +// +// swagger:model CreateStorageDiskBody +type CreateStorageDiskBody struct { + + // data center Id + DataCenterID string `json:"dataCenterId,omitempty"` + + // disk + Disk *Disk `json:"disk,omitempty"` +} + +// Validate validates this create storage disk body +func (m *CreateStorageDiskBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisk(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateStorageDiskBody) validateDisk(formats strfmt.Registry) error { + if swag.IsZero(m.Disk) { // not required + return nil + } + + if m.Disk != nil { + if err := m.Disk.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disk") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disk") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create storage disk body based on the context it is used +func (m *CreateStorageDiskBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDisk(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateStorageDiskBody) contextValidateDisk(ctx context.Context, formats strfmt.Registry) error { + + if m.Disk != nil { + + if swag.IsZero(m.Disk) { // not required + return nil + } + + if err := m.Disk.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disk") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disk") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateStorageDiskBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateStorageDiskBody) UnmarshalBinary(b []byte) error { + var res CreateStorageDiskBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/create_vm_body.go b/internal/models/create_vm_body.go new file mode 100644 index 0000000..db8afcb --- /dev/null +++ b/internal/models/create_vm_body.go @@ -0,0 +1,402 @@ +// 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" + "github.com/go-openapi/validate" +) + +// CreateVMBody create VM body +// +// swagger:model CreateVMBody +type CreateVMBody struct { + + // boot disk + BootDisk *Disk `json:"bootDisk,omitempty"` + + // boot disk image Id + // Required: true + BootDiskImageID *string `json:"bootDiskImageId"` + + // cpu model + CPUModel string `json:"cpuModel,omitempty"` + + // custom Ssh keys + CustomSSHKeys []string `json:"customSshKeys"` + + // data center Id + DataCenterID string `json:"dataCenterId,omitempty"` + + // gpu model + GpuModel string `json:"gpuModel,omitempty"` + + // gpu model Id + GpuModelID string `json:"gpuModelId,omitempty"` + + // gpus + Gpus int32 `json:"gpus,omitempty"` + + // machine type + MachineType string `json:"machineType,omitempty"` + + // max price hr + MaxPriceHr *Decimal `json:"maxPriceHr,omitempty"` + + // memory gib + MemoryGib int32 `json:"memoryGib,omitempty"` + + // metadata + Metadata map[string]string `json:"metadata,omitempty"` + + // nics + Nics []*CreateVMRequestNIC `json:"nics"` + + // password + Password string `json:"password,omitempty"` + + // ignored if any nics are provided + SecurityGroupIds []string `json:"securityGroupIds"` + + // ssh key source + SSHKeySource *SSHKeySource `json:"sshKeySource,omitempty"` + + // start script + StartScript string `json:"startScript,omitempty"` + + // storage disk ids + StorageDiskIds []string `json:"storageDiskIds"` + + // topology + Topology *CPUTopology `json:"topology,omitempty"` + + // vcpus + Vcpus int32 `json:"vcpus,omitempty"` + + // vm Id + // Required: true + VMID *string `json:"vmId"` +} + +// Validate validates this create VM body +func (m *CreateVMBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBootDisk(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBootDiskImageID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNics(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSSHKeySource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTopology(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVMID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateVMBody) validateBootDisk(formats strfmt.Registry) error { + if swag.IsZero(m.BootDisk) { // not required + return nil + } + + if m.BootDisk != nil { + if err := m.BootDisk.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bootDisk") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("bootDisk") + } + return err + } + } + + return nil +} + +func (m *CreateVMBody) validateBootDiskImageID(formats strfmt.Registry) error { + + if err := validate.Required("bootDiskImageId", "body", m.BootDiskImageID); err != nil { + return err + } + + return nil +} + +func (m *CreateVMBody) validateMaxPriceHr(formats strfmt.Registry) error { + if swag.IsZero(m.MaxPriceHr) { // not required + return nil + } + + if m.MaxPriceHr != nil { + if err := m.MaxPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxPriceHr") + } + return err + } + } + + return nil +} + +func (m *CreateVMBody) validateNics(formats strfmt.Registry) error { + if swag.IsZero(m.Nics) { // not required + return nil + } + + for i := 0; i < len(m.Nics); i++ { + if swag.IsZero(m.Nics[i]) { // not required + continue + } + + if m.Nics[i] != nil { + if err := m.Nics[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("nics" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("nics" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CreateVMBody) validateSSHKeySource(formats strfmt.Registry) error { + if swag.IsZero(m.SSHKeySource) { // not required + return nil + } + + if m.SSHKeySource != nil { + if err := m.SSHKeySource.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeySource") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeySource") + } + return err + } + } + + return nil +} + +func (m *CreateVMBody) validateTopology(formats strfmt.Registry) error { + if swag.IsZero(m.Topology) { // not required + return nil + } + + if m.Topology != nil { + if err := m.Topology.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("topology") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("topology") + } + return err + } + } + + return nil +} + +func (m *CreateVMBody) validateVMID(formats strfmt.Registry) error { + + if err := validate.Required("vmId", "body", m.VMID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this create VM body based on the context it is used +func (m *CreateVMBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBootDisk(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNics(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSSHKeySource(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTopology(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateVMBody) contextValidateBootDisk(ctx context.Context, formats strfmt.Registry) error { + + if m.BootDisk != nil { + + if swag.IsZero(m.BootDisk) { // not required + return nil + } + + if err := m.BootDisk.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bootDisk") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("bootDisk") + } + return err + } + } + + return nil +} + +func (m *CreateVMBody) contextValidateMaxPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxPriceHr != nil { + + if swag.IsZero(m.MaxPriceHr) { // not required + return nil + } + + if err := m.MaxPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxPriceHr") + } + return err + } + } + + return nil +} + +func (m *CreateVMBody) contextValidateNics(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Nics); i++ { + + if m.Nics[i] != nil { + + if swag.IsZero(m.Nics[i]) { // not required + return nil + } + + if err := m.Nics[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("nics" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("nics" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CreateVMBody) contextValidateSSHKeySource(ctx context.Context, formats strfmt.Registry) error { + + if m.SSHKeySource != nil { + + if swag.IsZero(m.SSHKeySource) { // not required + return nil + } + + if err := m.SSHKeySource.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeySource") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeySource") + } + return err + } + } + + return nil +} + +func (m *CreateVMBody) contextValidateTopology(ctx context.Context, formats strfmt.Registry) error { + + if m.Topology != nil { + + if swag.IsZero(m.Topology) { // not required + return nil + } + + if err := m.Topology.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("topology") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("topology") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateVMBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateVMBody) UnmarshalBinary(b []byte) error { + var res CreateVMBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/data_center_machine_type.go b/internal/models/data_center_machine_type.go new file mode 100644 index 0000000..5a11949 --- /dev/null +++ b/internal/models/data_center_machine_type.go @@ -0,0 +1,139 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DataCenterMachineType data center machine type +// +// swagger:model DataCenterMachineType +type DataCenterMachineType struct { + + // count clusters + // Required: true + CountClusters *int32 `json:"countClusters"` + + // count hosts + // Required: true + CountHosts *int32 `json:"countHosts"` + + // count hosts active + // Required: true + CountHostsActive *int32 `json:"countHostsActive"` + + // count hosts inactive + // Required: true + CountHostsInactive *int32 `json:"countHostsInactive"` + + // machine type + // Required: true + MachineType *string `json:"machineType"` +} + +// Validate validates this data center machine type +func (m *DataCenterMachineType) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCountClusters(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountHosts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountHostsActive(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountHostsInactive(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMachineType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DataCenterMachineType) validateCountClusters(formats strfmt.Registry) error { + + if err := validate.Required("countClusters", "body", m.CountClusters); err != nil { + return err + } + + return nil +} + +func (m *DataCenterMachineType) validateCountHosts(formats strfmt.Registry) error { + + if err := validate.Required("countHosts", "body", m.CountHosts); err != nil { + return err + } + + return nil +} + +func (m *DataCenterMachineType) validateCountHostsActive(formats strfmt.Registry) error { + + if err := validate.Required("countHostsActive", "body", m.CountHostsActive); err != nil { + return err + } + + return nil +} + +func (m *DataCenterMachineType) validateCountHostsInactive(formats strfmt.Registry) error { + + if err := validate.Required("countHostsInactive", "body", m.CountHostsInactive); err != nil { + return err + } + + return nil +} + +func (m *DataCenterMachineType) validateMachineType(formats strfmt.Registry) error { + + if err := validate.Required("machineType", "body", m.MachineType); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this data center machine type based on context it is used +func (m *DataCenterMachineType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DataCenterMachineType) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DataCenterMachineType) UnmarshalBinary(b []byte) error { + var res DataCenterMachineType + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/data_center_revenue_resource.go b/internal/models/data_center_revenue_resource.go new file mode 100644 index 0000000..f761673 --- /dev/null +++ b/internal/models/data_center_revenue_resource.go @@ -0,0 +1,208 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DataCenterRevenueResource data center revenue resource +// +// swagger:model DataCenterRevenueResource +type DataCenterRevenueResource struct { + + // quantity + // Required: true + Quantity *Decimal `json:"quantity"` + + // resource Id + // Required: true + ResourceID *string `json:"resourceId"` + + // resource type + // Required: true + ResourceType *string `json:"resourceType"` + + // revenue usd + // Required: true + RevenueUsd *Decimal `json:"revenueUsd"` + + // unit + // Required: true + Unit *string `json:"unit"` +} + +// Validate validates this data center revenue resource +func (m *DataCenterRevenueResource) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateQuantity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResourceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResourceType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRevenueUsd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUnit(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DataCenterRevenueResource) validateQuantity(formats strfmt.Registry) error { + + if err := validate.Required("quantity", "body", m.Quantity); err != nil { + return err + } + + if m.Quantity != nil { + if err := m.Quantity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quantity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("quantity") + } + return err + } + } + + return nil +} + +func (m *DataCenterRevenueResource) validateResourceID(formats strfmt.Registry) error { + + if err := validate.Required("resourceId", "body", m.ResourceID); err != nil { + return err + } + + return nil +} + +func (m *DataCenterRevenueResource) validateResourceType(formats strfmt.Registry) error { + + if err := validate.Required("resourceType", "body", m.ResourceType); err != nil { + return err + } + + return nil +} + +func (m *DataCenterRevenueResource) validateRevenueUsd(formats strfmt.Registry) error { + + if err := validate.Required("revenueUsd", "body", m.RevenueUsd); err != nil { + return err + } + + if m.RevenueUsd != nil { + if err := m.RevenueUsd.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("revenueUsd") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("revenueUsd") + } + return err + } + } + + return nil +} + +func (m *DataCenterRevenueResource) validateUnit(formats strfmt.Registry) error { + + if err := validate.Required("unit", "body", m.Unit); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this data center revenue resource based on the context it is used +func (m *DataCenterRevenueResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateQuantity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRevenueUsd(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DataCenterRevenueResource) contextValidateQuantity(ctx context.Context, formats strfmt.Registry) error { + + if m.Quantity != nil { + + if err := m.Quantity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quantity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("quantity") + } + return err + } + } + + return nil +} + +func (m *DataCenterRevenueResource) contextValidateRevenueUsd(ctx context.Context, formats strfmt.Registry) error { + + if m.RevenueUsd != nil { + + if err := m.RevenueUsd.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("revenueUsd") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("revenueUsd") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DataCenterRevenueResource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DataCenterRevenueResource) UnmarshalBinary(b []byte) error { + var res DataCenterRevenueResource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/data_center_time_revenue.go b/internal/models/data_center_time_revenue.go new file mode 100644 index 0000000..33d79bd --- /dev/null +++ b/internal/models/data_center_time_revenue.go @@ -0,0 +1,130 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DataCenterTimeRevenue data center time revenue +// +// swagger:model DataCenterTimeRevenue +type DataCenterTimeRevenue struct { + + // revenue usd + // Required: true + RevenueUsd *Decimal `json:"revenueUsd"` + + // time + // Required: true + // Format: date-time + Time *strfmt.DateTime `json:"time"` +} + +// Validate validates this data center time revenue +func (m *DataCenterTimeRevenue) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRevenueUsd(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTime(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DataCenterTimeRevenue) validateRevenueUsd(formats strfmt.Registry) error { + + if err := validate.Required("revenueUsd", "body", m.RevenueUsd); err != nil { + return err + } + + if m.RevenueUsd != nil { + if err := m.RevenueUsd.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("revenueUsd") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("revenueUsd") + } + return err + } + } + + return nil +} + +func (m *DataCenterTimeRevenue) validateTime(formats strfmt.Registry) error { + + if err := validate.Required("time", "body", m.Time); err != nil { + return err + } + + if err := validate.FormatOf("time", "body", "date-time", m.Time.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this data center time revenue based on the context it is used +func (m *DataCenterTimeRevenue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRevenueUsd(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DataCenterTimeRevenue) contextValidateRevenueUsd(ctx context.Context, formats strfmt.Registry) error { + + if m.RevenueUsd != nil { + + if err := m.RevenueUsd.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("revenueUsd") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("revenueUsd") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DataCenterTimeRevenue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DataCenterTimeRevenue) UnmarshalBinary(b []byte) error { + var res DataCenterTimeRevenue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/detach_security_group_response.go b/internal/models/detach_security_group_response.go new file mode 100644 index 0000000..684fafe --- /dev/null +++ b/internal/models/detach_security_group_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 + +// DetachSecurityGroupResponse detach security group response +// +// swagger:model DetachSecurityGroupResponse +type DetachSecurityGroupResponse interface{} diff --git a/internal/models/get_billing_account_details_response.go b/internal/models/get_billing_account_details_response.go new file mode 100644 index 0000000..fbd5749 --- /dev/null +++ b/internal/models/get_billing_account_details_response.go @@ -0,0 +1,157 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetBillingAccountDetailsResponse get billing account details response +// +// swagger:model GetBillingAccountDetailsResponse +type GetBillingAccountDetailsResponse struct { + + // billing account + // Required: true + BillingAccount *BillingAccount `json:"billingAccount"` + + // stripe customer + // Required: true + StripeCustomer *StripeCustomer `json:"stripeCustomer"` +} + +// Validate validates this get billing account details response +func (m *GetBillingAccountDetailsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillingAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStripeCustomer(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBillingAccountDetailsResponse) validateBillingAccount(formats strfmt.Registry) error { + + if err := validate.Required("billingAccount", "body", m.BillingAccount); err != nil { + return err + } + + if m.BillingAccount != nil { + if err := m.BillingAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount") + } + return err + } + } + + return nil +} + +func (m *GetBillingAccountDetailsResponse) validateStripeCustomer(formats strfmt.Registry) error { + + if err := validate.Required("stripeCustomer", "body", m.StripeCustomer); err != nil { + return err + } + + if m.StripeCustomer != nil { + if err := m.StripeCustomer.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stripeCustomer") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("stripeCustomer") + } + return err + } + } + + return nil +} + +// ContextValidate validate this get billing account details response based on the context it is used +func (m *GetBillingAccountDetailsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStripeCustomer(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBillingAccountDetailsResponse) contextValidateBillingAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAccount != nil { + + if err := m.BillingAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount") + } + return err + } + } + + return nil +} + +func (m *GetBillingAccountDetailsResponse) contextValidateStripeCustomer(ctx context.Context, formats strfmt.Registry) error { + + if m.StripeCustomer != nil { + + if err := m.StripeCustomer.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("stripeCustomer") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("stripeCustomer") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetBillingAccountDetailsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetBillingAccountDetailsResponse) UnmarshalBinary(b []byte) error { + var res GetBillingAccountDetailsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_billing_account_spend_details_response.go b/internal/models/get_billing_account_spend_details_response.go new file mode 100644 index 0000000..8b0d318 --- /dev/null +++ b/internal/models/get_billing_account_spend_details_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// GetBillingAccountSpendDetailsResponse get billing account spend details response +// +// swagger:model GetBillingAccountSpendDetailsResponse +type GetBillingAccountSpendDetailsResponse struct { + + // spend + // Required: true + Spend []*BillingAccountSpendRow `json:"spend"` +} + +// Validate validates this get billing account spend details response +func (m *GetBillingAccountSpendDetailsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSpend(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBillingAccountSpendDetailsResponse) validateSpend(formats strfmt.Registry) error { + + if err := validate.Required("spend", "body", m.Spend); err != nil { + return err + } + + for i := 0; i < len(m.Spend); i++ { + if swag.IsZero(m.Spend[i]) { // not required + continue + } + + if m.Spend[i] != nil { + if err := m.Spend[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spend" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("spend" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this get billing account spend details response based on the context it is used +func (m *GetBillingAccountSpendDetailsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSpend(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBillingAccountSpendDetailsResponse) contextValidateSpend(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Spend); i++ { + + if m.Spend[i] != nil { + + if swag.IsZero(m.Spend[i]) { // not required + return nil + } + + if err := m.Spend[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("spend" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("spend" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetBillingAccountSpendDetailsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetBillingAccountSpendDetailsResponse) UnmarshalBinary(b []byte) error { + var res GetBillingAccountSpendDetailsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_billing_account_stripe_invoices_response.go b/internal/models/get_billing_account_stripe_invoices_response.go new file mode 100644 index 0000000..03e21e0 --- /dev/null +++ b/internal/models/get_billing_account_stripe_invoices_response.go @@ -0,0 +1,141 @@ +// 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" + "github.com/go-openapi/validate" +) + +// GetBillingAccountStripeInvoicesResponse get billing account stripe invoices response +// +// swagger:model GetBillingAccountStripeInvoicesResponse +type GetBillingAccountStripeInvoicesResponse struct { + + // has more + // Required: true + HasMore *bool `json:"hasMore"` + + // invoices + // Required: true + Invoices []*Invoice `json:"invoices"` +} + +// Validate validates this get billing account stripe invoices response +func (m *GetBillingAccountStripeInvoicesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHasMore(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInvoices(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBillingAccountStripeInvoicesResponse) validateHasMore(formats strfmt.Registry) error { + + if err := validate.Required("hasMore", "body", m.HasMore); err != nil { + return err + } + + return nil +} + +func (m *GetBillingAccountStripeInvoicesResponse) validateInvoices(formats strfmt.Registry) error { + + if err := validate.Required("invoices", "body", m.Invoices); err != nil { + return err + } + + for i := 0; i < len(m.Invoices); i++ { + if swag.IsZero(m.Invoices[i]) { // not required + continue + } + + if m.Invoices[i] != nil { + if err := m.Invoices[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("invoices" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("invoices" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this get billing account stripe invoices response based on the context it is used +func (m *GetBillingAccountStripeInvoicesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInvoices(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetBillingAccountStripeInvoicesResponse) contextValidateInvoices(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Invoices); i++ { + + if m.Invoices[i] != nil { + + if swag.IsZero(m.Invoices[i]) { // not required + return nil + } + + if err := m.Invoices[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("invoices" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("invoices" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetBillingAccountStripeInvoicesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetBillingAccountStripeInvoicesResponse) UnmarshalBinary(b []byte) error { + var res GetBillingAccountStripeInvoicesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_data_center_live_utilization_response.go b/internal/models/get_data_center_live_utilization_response.go new file mode 100644 index 0000000..11bd0bd --- /dev/null +++ b/internal/models/get_data_center_live_utilization_response.go @@ -0,0 +1,275 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetDataCenterLiveUtilizationResponse get data center live utilization response +// +// swagger:model GetDataCenterLiveUtilizationResponse +type GetDataCenterLiveUtilizationResponse struct { + + // cpu utilization + // Required: true + CPUUtilization *float32 `json:"cpuUtilization"` + + // gpu free + // Required: true + GpuFree *int32 `json:"gpuFree"` + + // gpu total + // Required: true + GpuTotal *int32 `json:"gpuTotal"` + + // gpu used + // Required: true + GpuUsed *int32 `json:"gpuUsed"` + + // gpu utilization + // Required: true + GpuUtilization *float32 `json:"gpuUtilization"` + + // memory gib free + // Required: true + MemoryGibFree *int32 `json:"memoryGibFree"` + + // memory gib total + // Required: true + MemoryGibTotal *int32 `json:"memoryGibTotal"` + + // memory gib used + // Required: true + MemoryGibUsed *int32 `json:"memoryGibUsed"` + + // memory utilization + // Required: true + MemoryUtilization *float32 `json:"memoryUtilization"` + + // utilization + // Required: true + Utilization *float32 `json:"utilization"` + + // vcpu free + // Required: true + VcpuFree *int32 `json:"vcpuFree"` + + // vcpu total + // Required: true + VcpuTotal *int32 `json:"vcpuTotal"` + + // vcpu used + // Required: true + VcpuUsed *int32 `json:"vcpuUsed"` +} + +// Validate validates this get data center live utilization response +func (m *GetDataCenterLiveUtilizationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCPUUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuUsed(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateCPUUtilization(formats strfmt.Registry) error { + + if err := validate.Required("cpuUtilization", "body", m.CPUUtilization); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateGpuFree(formats strfmt.Registry) error { + + if err := validate.Required("gpuFree", "body", m.GpuFree); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateGpuTotal(formats strfmt.Registry) error { + + if err := validate.Required("gpuTotal", "body", m.GpuTotal); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateGpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("gpuUsed", "body", m.GpuUsed); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateGpuUtilization(formats strfmt.Registry) error { + + if err := validate.Required("gpuUtilization", "body", m.GpuUtilization); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateMemoryGibFree(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibFree", "body", m.MemoryGibFree); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateMemoryGibTotal(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibTotal", "body", m.MemoryGibTotal); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateMemoryGibUsed(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibUsed", "body", m.MemoryGibUsed); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateMemoryUtilization(formats strfmt.Registry) error { + + if err := validate.Required("memoryUtilization", "body", m.MemoryUtilization); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateUtilization(formats strfmt.Registry) error { + + if err := validate.Required("utilization", "body", m.Utilization); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateVcpuFree(formats strfmt.Registry) error { + + if err := validate.Required("vcpuFree", "body", m.VcpuFree); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateVcpuTotal(formats strfmt.Registry) error { + + if err := validate.Required("vcpuTotal", "body", m.VcpuTotal); err != nil { + return err + } + + return nil +} + +func (m *GetDataCenterLiveUtilizationResponse) validateVcpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("vcpuUsed", "body", m.VcpuUsed); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this get data center live utilization response based on context it is used +func (m *GetDataCenterLiveUtilizationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *GetDataCenterLiveUtilizationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetDataCenterLiveUtilizationResponse) UnmarshalBinary(b []byte) error { + var res GetDataCenterLiveUtilizationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_data_center_revenue_by_resource_response.go b/internal/models/get_data_center_revenue_by_resource_response.go new file mode 100644 index 0000000..d15b525 --- /dev/null +++ b/internal/models/get_data_center_revenue_by_resource_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// GetDataCenterRevenueByResourceResponse get data center revenue by resource response +// +// swagger:model GetDataCenterRevenueByResourceResponse +type GetDataCenterRevenueByResourceResponse struct { + + // resources + // Required: true + Resources []*DataCenterRevenueResource `json:"resources"` +} + +// Validate validates this get data center revenue by resource response +func (m *GetDataCenterRevenueByResourceResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResources(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetDataCenterRevenueByResourceResponse) validateResources(formats strfmt.Registry) error { + + if err := validate.Required("resources", "body", m.Resources); err != nil { + return err + } + + for i := 0; i < len(m.Resources); i++ { + if swag.IsZero(m.Resources[i]) { // not required + continue + } + + if m.Resources[i] != nil { + if err := m.Resources[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resources" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("resources" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this get data center revenue by resource response based on the context it is used +func (m *GetDataCenterRevenueByResourceResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResources(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetDataCenterRevenueByResourceResponse) contextValidateResources(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Resources); i++ { + + if m.Resources[i] != nil { + + if swag.IsZero(m.Resources[i]) { // not required + return nil + } + + if err := m.Resources[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resources" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("resources" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetDataCenterRevenueByResourceResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetDataCenterRevenueByResourceResponse) UnmarshalBinary(b []byte) error { + var res GetDataCenterRevenueByResourceResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_data_center_revenue_time_series_response.go b/internal/models/get_data_center_revenue_time_series_response.go new file mode 100644 index 0000000..fa68587 --- /dev/null +++ b/internal/models/get_data_center_revenue_time_series_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// GetDataCenterRevenueTimeSeriesResponse get data center revenue time series response +// +// swagger:model GetDataCenterRevenueTimeSeriesResponse +type GetDataCenterRevenueTimeSeriesResponse struct { + + // time revenue + // Required: true + TimeRevenue []*DataCenterTimeRevenue `json:"timeRevenue"` +} + +// Validate validates this get data center revenue time series response +func (m *GetDataCenterRevenueTimeSeriesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTimeRevenue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetDataCenterRevenueTimeSeriesResponse) validateTimeRevenue(formats strfmt.Registry) error { + + if err := validate.Required("timeRevenue", "body", m.TimeRevenue); err != nil { + return err + } + + for i := 0; i < len(m.TimeRevenue); i++ { + if swag.IsZero(m.TimeRevenue[i]) { // not required + continue + } + + if m.TimeRevenue[i] != nil { + if err := m.TimeRevenue[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("timeRevenue" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("timeRevenue" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this get data center revenue time series response based on the context it is used +func (m *GetDataCenterRevenueTimeSeriesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTimeRevenue(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetDataCenterRevenueTimeSeriesResponse) contextValidateTimeRevenue(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TimeRevenue); i++ { + + if m.TimeRevenue[i] != nil { + + if swag.IsZero(m.TimeRevenue[i]) { // not required + return nil + } + + if err := m.TimeRevenue[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("timeRevenue" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("timeRevenue" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetDataCenterRevenueTimeSeriesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetDataCenterRevenueTimeSeriesResponse) UnmarshalBinary(b []byte) error { + var res GetDataCenterRevenueTimeSeriesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_machine_type_live_utilization_response.go b/internal/models/get_machine_type_live_utilization_response.go new file mode 100644 index 0000000..fc93d8e --- /dev/null +++ b/internal/models/get_machine_type_live_utilization_response.go @@ -0,0 +1,275 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetMachineTypeLiveUtilizationResponse get machine type live utilization response +// +// swagger:model GetMachineTypeLiveUtilizationResponse +type GetMachineTypeLiveUtilizationResponse struct { + + // cpu utilization + // Required: true + CPUUtilization *float32 `json:"cpuUtilization"` + + // gpu free + // Required: true + GpuFree *int32 `json:"gpuFree"` + + // gpu total + // Required: true + GpuTotal *int32 `json:"gpuTotal"` + + // gpu used + // Required: true + GpuUsed *int32 `json:"gpuUsed"` + + // gpu utilization + // Required: true + GpuUtilization *float32 `json:"gpuUtilization"` + + // memory gib free + // Required: true + MemoryGibFree *int32 `json:"memoryGibFree"` + + // memory gib total + // Required: true + MemoryGibTotal *int32 `json:"memoryGibTotal"` + + // memory gib used + // Required: true + MemoryGibUsed *int32 `json:"memoryGibUsed"` + + // memory utilization + // Required: true + MemoryUtilization *float32 `json:"memoryUtilization"` + + // utilization + // Required: true + Utilization *float32 `json:"utilization"` + + // vcpu free + // Required: true + VcpuFree *int32 `json:"vcpuFree"` + + // vcpu total + // Required: true + VcpuTotal *int32 `json:"vcpuTotal"` + + // vcpu used + // Required: true + VcpuUsed *int32 `json:"vcpuUsed"` +} + +// Validate validates this get machine type live utilization response +func (m *GetMachineTypeLiveUtilizationResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCPUUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUtilization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuUsed(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateCPUUtilization(formats strfmt.Registry) error { + + if err := validate.Required("cpuUtilization", "body", m.CPUUtilization); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateGpuFree(formats strfmt.Registry) error { + + if err := validate.Required("gpuFree", "body", m.GpuFree); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateGpuTotal(formats strfmt.Registry) error { + + if err := validate.Required("gpuTotal", "body", m.GpuTotal); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateGpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("gpuUsed", "body", m.GpuUsed); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateGpuUtilization(formats strfmt.Registry) error { + + if err := validate.Required("gpuUtilization", "body", m.GpuUtilization); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateMemoryGibFree(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibFree", "body", m.MemoryGibFree); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateMemoryGibTotal(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibTotal", "body", m.MemoryGibTotal); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateMemoryGibUsed(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibUsed", "body", m.MemoryGibUsed); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateMemoryUtilization(formats strfmt.Registry) error { + + if err := validate.Required("memoryUtilization", "body", m.MemoryUtilization); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateUtilization(formats strfmt.Registry) error { + + if err := validate.Required("utilization", "body", m.Utilization); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateVcpuFree(formats strfmt.Registry) error { + + if err := validate.Required("vcpuFree", "body", m.VcpuFree); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateVcpuTotal(formats strfmt.Registry) error { + + if err := validate.Required("vcpuTotal", "body", m.VcpuTotal); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeLiveUtilizationResponse) validateVcpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("vcpuUsed", "body", m.VcpuUsed); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this get machine type live utilization response based on context it is used +func (m *GetMachineTypeLiveUtilizationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *GetMachineTypeLiveUtilizationResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetMachineTypeLiveUtilizationResponse) UnmarshalBinary(b []byte) error { + var res GetMachineTypeLiveUtilizationResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_machine_type_response.go b/internal/models/get_machine_type_response.go new file mode 100644 index 0000000..edd0bbb --- /dev/null +++ b/internal/models/get_machine_type_response.go @@ -0,0 +1,557 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetMachineTypeResponse get machine type response +// +// swagger:model GetMachineTypeResponse +type GetMachineTypeResponse struct { + + // count clusters + // Required: true + CountClusters *int32 `json:"countClusters"` + + // count hosts + // Required: true + CountHosts *int32 `json:"countHosts"` + + // count hosts active + // Required: true + CountHostsActive *int32 `json:"countHostsActive"` + + // count hosts inactive + // Required: true + CountHostsInactive *int32 `json:"countHostsInactive"` + + // cpu models + // Required: true + CPUModels []string `json:"cpuModels"` + + // data center Id + // Required: true + DataCenterID *string `json:"dataCenterId"` + + // gpu models + // Required: true + GpuModels []string `json:"gpuModels"` + + // machine type + // Required: true + MachineType *string `json:"machineType"` + + // max gpu price hr + // Required: true + MaxGpuPriceHr *Decimal `json:"maxGpuPriceHr"` + + // max memory gib price hr + // Required: true + MaxMemoryGibPriceHr *Decimal `json:"maxMemoryGibPriceHr"` + + // max vcpu per gpu + // Required: true + MaxVcpuPerGpu *float64 `json:"maxVcpuPerGpu"` + + // max vcpu per memory gib + // Required: true + MaxVcpuPerMemoryGib *float64 `json:"maxVcpuPerMemoryGib"` + + // max vcpu price hr + // Required: true + MaxVcpuPriceHr *Decimal `json:"maxVcpuPriceHr"` + + // min gpu price hr + // Required: true + MinGpuPriceHr *Decimal `json:"minGpuPriceHr"` + + // min memory gib price hr + // Required: true + MinMemoryGibPriceHr *Decimal `json:"minMemoryGibPriceHr"` + + // min vcpu per gpu + // Required: true + MinVcpuPerGpu *float64 `json:"minVcpuPerGpu"` + + // min vcpu per memory gib + // Required: true + MinVcpuPerMemoryGib *float64 `json:"minVcpuPerMemoryGib"` + + // min vcpu price hr + // Required: true + MinVcpuPriceHr *Decimal `json:"minVcpuPriceHr"` +} + +// Validate validates this get machine type response +func (m *GetMachineTypeResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCountClusters(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountHosts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountHostsActive(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountHostsInactive(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCPUModels(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDataCenterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModels(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMachineType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxGpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxMemoryGibPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuPerGpu(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuPerMemoryGib(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinGpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinMemoryGibPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinVcpuPerGpu(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinVcpuPerMemoryGib(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinVcpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetMachineTypeResponse) validateCountClusters(formats strfmt.Registry) error { + + if err := validate.Required("countClusters", "body", m.CountClusters); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateCountHosts(formats strfmt.Registry) error { + + if err := validate.Required("countHosts", "body", m.CountHosts); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateCountHostsActive(formats strfmt.Registry) error { + + if err := validate.Required("countHostsActive", "body", m.CountHostsActive); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateCountHostsInactive(formats strfmt.Registry) error { + + if err := validate.Required("countHostsInactive", "body", m.CountHostsInactive); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateCPUModels(formats strfmt.Registry) error { + + if err := validate.Required("cpuModels", "body", m.CPUModels); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateDataCenterID(formats strfmt.Registry) error { + + if err := validate.Required("dataCenterId", "body", m.DataCenterID); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateGpuModels(formats strfmt.Registry) error { + + if err := validate.Required("gpuModels", "body", m.GpuModels); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMachineType(formats strfmt.Registry) error { + + if err := validate.Required("machineType", "body", m.MachineType); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMaxGpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("maxGpuPriceHr", "body", m.MaxGpuPriceHr); err != nil { + return err + } + + if m.MaxGpuPriceHr != nil { + if err := m.MaxGpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxGpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxGpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMaxMemoryGibPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("maxMemoryGibPriceHr", "body", m.MaxMemoryGibPriceHr); err != nil { + return err + } + + if m.MaxMemoryGibPriceHr != nil { + if err := m.MaxMemoryGibPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxMemoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxMemoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMaxVcpuPerGpu(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuPerGpu", "body", m.MaxVcpuPerGpu); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMaxVcpuPerMemoryGib(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuPerMemoryGib", "body", m.MaxVcpuPerMemoryGib); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMaxVcpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuPriceHr", "body", m.MaxVcpuPriceHr); err != nil { + return err + } + + if m.MaxVcpuPriceHr != nil { + if err := m.MaxVcpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxVcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxVcpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMinGpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("minGpuPriceHr", "body", m.MinGpuPriceHr); err != nil { + return err + } + + if m.MinGpuPriceHr != nil { + if err := m.MinGpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minGpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minGpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMinMemoryGibPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("minMemoryGibPriceHr", "body", m.MinMemoryGibPriceHr); err != nil { + return err + } + + if m.MinMemoryGibPriceHr != nil { + if err := m.MinMemoryGibPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minMemoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minMemoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMinVcpuPerGpu(formats strfmt.Registry) error { + + if err := validate.Required("minVcpuPerGpu", "body", m.MinVcpuPerGpu); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMinVcpuPerMemoryGib(formats strfmt.Registry) error { + + if err := validate.Required("minVcpuPerMemoryGib", "body", m.MinVcpuPerMemoryGib); err != nil { + return err + } + + return nil +} + +func (m *GetMachineTypeResponse) validateMinVcpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("minVcpuPriceHr", "body", m.MinVcpuPriceHr); err != nil { + return err + } + + if m.MinVcpuPriceHr != nil { + if err := m.MinVcpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minVcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minVcpuPriceHr") + } + return err + } + } + + return nil +} + +// ContextValidate validate this get machine type response based on the context it is used +func (m *GetMachineTypeResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaxGpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxMemoryGibPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxVcpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMinGpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMinMemoryGibPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMinVcpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetMachineTypeResponse) contextValidateMaxGpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxGpuPriceHr != nil { + + if err := m.MaxGpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxGpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxGpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) contextValidateMaxMemoryGibPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxMemoryGibPriceHr != nil { + + if err := m.MaxMemoryGibPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxMemoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxMemoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) contextValidateMaxVcpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxVcpuPriceHr != nil { + + if err := m.MaxVcpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxVcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxVcpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) contextValidateMinGpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MinGpuPriceHr != nil { + + if err := m.MinGpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minGpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minGpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) contextValidateMinMemoryGibPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MinMemoryGibPriceHr != nil { + + if err := m.MinMemoryGibPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minMemoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minMemoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetMachineTypeResponse) contextValidateMinVcpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MinVcpuPriceHr != nil { + + if err := m.MinVcpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minVcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minVcpuPriceHr") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetMachineTypeResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetMachineTypeResponse) UnmarshalBinary(b []byte) error { + var res GetMachineTypeResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_response.go b/internal/models/get_response.go new file mode 100644 index 0000000..fef23aa --- /dev/null +++ b/internal/models/get_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// GetResponse get response +// +// swagger:model GetResponse +type GetResponse struct { + + // task + // Required: true + Task []*Task `json:"task"` +} + +// Validate validates this get response +func (m *GetResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTask(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetResponse) validateTask(formats strfmt.Registry) error { + + if err := validate.Required("task", "body", m.Task); err != nil { + return err + } + + for i := 0; i < len(m.Task); i++ { + if swag.IsZero(m.Task[i]) { // not required + continue + } + + if m.Task[i] != nil { + if err := m.Task[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this get response based on the context it is used +func (m *GetResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTask(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetResponse) contextValidateTask(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Task); i++ { + + if m.Task[i] != nil { + + if swag.IsZero(m.Task[i]) { // not required + return nil + } + + if err := m.Task[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("task" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("task" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetResponse) UnmarshalBinary(b []byte) error { + var res GetResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/get_vm_response.go b/internal/models/get_vm_response.go index d3f46dc..1a06c69 100644 --- a/internal/models/get_vm_response.go +++ b/internal/models/get_vm_response.go @@ -22,6 +22,46 @@ type GetVMResponse struct { // VM // Required: true VM *VM `json:"VM"` + + // gpu price hr + // Required: true + GpuPriceHr *Decimal `json:"gpuPriceHr"` + + // ipv4 price hr + // Required: true + IPV4PriceHr *Decimal `json:"ipv4PriceHr"` + + // memory gib price hr + // Required: true + MemoryGibPriceHr *Decimal `json:"memoryGibPriceHr"` + + // storage gib price hr + // Required: true + StorageGibPriceHr *Decimal `json:"storageGibPriceHr"` + + // total gpu price hr + // Required: true + TotalGpuPriceHr *Decimal `json:"totalGpuPriceHr"` + + // total memory price hr + // Required: true + TotalMemoryPriceHr *Decimal `json:"totalMemoryPriceHr"` + + // total price hr + // Required: true + TotalPriceHr *Decimal `json:"totalPriceHr"` + + // total storage price hr + // Required: true + TotalStoragePriceHr *Decimal `json:"totalStoragePriceHr"` + + // total vcpu price hr + // Required: true + TotalVcpuPriceHr *Decimal `json:"totalVcpuPriceHr"` + + // vcpu price hr + // Required: true + VcpuPriceHr *Decimal `json:"vcpuPriceHr"` } // Validate validates this get VM response @@ -32,6 +72,46 @@ func (m *GetVMResponse) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateGpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPV4PriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageGibPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalGpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalMemoryPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalStoragePriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalVcpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuPriceHr(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -58,6 +138,206 @@ func (m *GetVMResponse) validateVM(formats strfmt.Registry) error { return nil } +func (m *GetVMResponse) validateGpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("gpuPriceHr", "body", m.GpuPriceHr); err != nil { + return err + } + + if m.GpuPriceHr != nil { + if err := m.GpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateIPV4PriceHr(formats strfmt.Registry) error { + + if err := validate.Required("ipv4PriceHr", "body", m.IPV4PriceHr); err != nil { + return err + } + + if m.IPV4PriceHr != nil { + if err := m.IPV4PriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipv4PriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipv4PriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateMemoryGibPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibPriceHr", "body", m.MemoryGibPriceHr); err != nil { + return err + } + + if m.MemoryGibPriceHr != nil { + if err := m.MemoryGibPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateStorageGibPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("storageGibPriceHr", "body", m.StorageGibPriceHr); err != nil { + return err + } + + if m.StorageGibPriceHr != nil { + if err := m.StorageGibPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateTotalGpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("totalGpuPriceHr", "body", m.TotalGpuPriceHr); err != nil { + return err + } + + if m.TotalGpuPriceHr != nil { + if err := m.TotalGpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalGpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalGpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateTotalMemoryPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("totalMemoryPriceHr", "body", m.TotalMemoryPriceHr); err != nil { + return err + } + + if m.TotalMemoryPriceHr != nil { + if err := m.TotalMemoryPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalMemoryPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalMemoryPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateTotalPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("totalPriceHr", "body", m.TotalPriceHr); err != nil { + return err + } + + if m.TotalPriceHr != nil { + if err := m.TotalPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateTotalStoragePriceHr(formats strfmt.Registry) error { + + if err := validate.Required("totalStoragePriceHr", "body", m.TotalStoragePriceHr); err != nil { + return err + } + + if m.TotalStoragePriceHr != nil { + if err := m.TotalStoragePriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalStoragePriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalStoragePriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateTotalVcpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("totalVcpuPriceHr", "body", m.TotalVcpuPriceHr); err != nil { + return err + } + + if m.TotalVcpuPriceHr != nil { + if err := m.TotalVcpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalVcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalVcpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) validateVcpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("vcpuPriceHr", "body", m.VcpuPriceHr); err != nil { + return err + } + + if m.VcpuPriceHr != nil { + if err := m.VcpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vcpuPriceHr") + } + return err + } + } + + return nil +} + // ContextValidate validate this get VM response based on the context it is used func (m *GetVMResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -66,6 +346,46 @@ func (m *GetVMResponse) ContextValidate(ctx context.Context, formats strfmt.Regi res = append(res, err) } + if err := m.contextValidateGpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPV4PriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemoryGibPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStorageGibPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotalGpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotalMemoryPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotalPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotalStoragePriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotalVcpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVcpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -89,6 +409,176 @@ func (m *GetVMResponse) contextValidateVM(ctx context.Context, formats strfmt.Re return nil } +func (m *GetVMResponse) contextValidateGpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.GpuPriceHr != nil { + + if err := m.GpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateIPV4PriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.IPV4PriceHr != nil { + + if err := m.IPV4PriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipv4PriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipv4PriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateMemoryGibPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MemoryGibPriceHr != nil { + + if err := m.MemoryGibPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateStorageGibPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageGibPriceHr != nil { + + if err := m.StorageGibPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateTotalGpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.TotalGpuPriceHr != nil { + + if err := m.TotalGpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalGpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalGpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateTotalMemoryPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.TotalMemoryPriceHr != nil { + + if err := m.TotalMemoryPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalMemoryPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalMemoryPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateTotalPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.TotalPriceHr != nil { + + if err := m.TotalPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateTotalStoragePriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.TotalStoragePriceHr != nil { + + if err := m.TotalStoragePriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalStoragePriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalStoragePriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateTotalVcpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.TotalVcpuPriceHr != nil { + + if err := m.TotalVcpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("totalVcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("totalVcpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *GetVMResponse) contextValidateVcpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.VcpuPriceHr != nil { + + if err := m.VcpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vcpuPriceHr") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GetVMResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/models/gpu_model_category.go b/internal/models/gpu_model_category.go index 73e452b..f649f2f 100644 --- a/internal/models/gpu_model_category.go +++ b/internal/models/gpu_model_category.go @@ -23,6 +23,14 @@ type GpuModelCategory struct { // Required: true CountVMAvailable *int32 `json:"countVmAvailable"` + // id + // Required: true + ID *string `json:"id"` + + // max free + // Required: true + MaxFree *int32 `json:"maxFree"` + // min price hr // Required: true MinPriceHr *Decimal `json:"minPriceHr"` @@ -30,6 +38,10 @@ type GpuModelCategory struct { // name // Required: true Name *string `json:"name"` + + // total free + // Required: true + TotalFree *int32 `json:"totalFree"` } // Validate validates this gpu model category @@ -40,6 +52,14 @@ func (m *GpuModelCategory) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxFree(formats); err != nil { + res = append(res, err) + } + if err := m.validateMinPriceHr(formats); err != nil { res = append(res, err) } @@ -48,6 +68,10 @@ func (m *GpuModelCategory) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateTotalFree(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -63,6 +87,24 @@ func (m *GpuModelCategory) validateCountVMAvailable(formats strfmt.Registry) err return nil } +func (m *GpuModelCategory) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *GpuModelCategory) validateMaxFree(formats strfmt.Registry) error { + + if err := validate.Required("maxFree", "body", m.MaxFree); err != nil { + return err + } + + return nil +} + func (m *GpuModelCategory) validateMinPriceHr(formats strfmt.Registry) error { if err := validate.Required("minPriceHr", "body", m.MinPriceHr); err != nil { @@ -92,6 +134,15 @@ func (m *GpuModelCategory) validateName(formats strfmt.Registry) error { return nil } +func (m *GpuModelCategory) validateTotalFree(formats strfmt.Registry) error { + + if err := validate.Required("totalFree", "body", m.TotalFree); err != nil { + return err + } + + return nil +} + // ContextValidate validate this gpu model category based on the context it is used func (m *GpuModelCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error diff --git a/internal/models/host.go b/internal/models/host.go new file mode 100644 index 0000000..113266c --- /dev/null +++ b/internal/models/host.go @@ -0,0 +1,336 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Host host +// +// swagger:model Host +type Host struct { + + // cpu model + // Required: true + CPUModel *string `json:"cpuModel"` + + // create time + // Required: true + // Format: date-time + CreateTime *strfmt.DateTime `json:"createTime"` + + // gpu free + // Required: true + GpuFree *int32 `json:"gpuFree"` + + // gpu model + // Required: true + GpuModel *string `json:"gpuModel"` + + // gpu model Id + // Required: true + GpuModelID *string `json:"gpuModelId"` + + // gpu used + // Required: true + GpuUsed *int32 `json:"gpuUsed"` + + // machine type + // Required: true + MachineType *string `json:"machineType"` + + // memory gib free + // Required: true + MemoryGibFree *int32 `json:"memoryGibFree"` + + // memory gib used + // Required: true + MemoryGibUsed *int32 `json:"memoryGibUsed"` + + // name + // Required: true + Name *string `json:"name"` + + // online + // Required: true + Online *bool `json:"online"` + + // update time + // Required: true + // Format: date-time + UpdateTime *strfmt.DateTime `json:"updateTime"` + + // vcpu free + // Required: true + VcpuFree *int32 `json:"vcpuFree"` + + // vcpu per Cpu thread + // Required: true + VcpuPerCPUThread *int32 `json:"vcpuPerCpuThread"` + + // vcpu used + // Required: true + VcpuUsed *int32 `json:"vcpuUsed"` + + // vm count + // Required: true + VMCount *int32 `json:"vmCount"` +} + +// Validate validates this host +func (m *Host) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCPUModel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModelID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMachineType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOnline(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuPerCPUThread(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVMCount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Host) validateCPUModel(formats strfmt.Registry) error { + + if err := validate.Required("cpuModel", "body", m.CPUModel); err != nil { + return err + } + + return nil +} + +func (m *Host) validateCreateTime(formats strfmt.Registry) error { + + if err := validate.Required("createTime", "body", m.CreateTime); err != nil { + return err + } + + if err := validate.FormatOf("createTime", "body", "date-time", m.CreateTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Host) validateGpuFree(formats strfmt.Registry) error { + + if err := validate.Required("gpuFree", "body", m.GpuFree); err != nil { + return err + } + + return nil +} + +func (m *Host) validateGpuModel(formats strfmt.Registry) error { + + if err := validate.Required("gpuModel", "body", m.GpuModel); err != nil { + return err + } + + return nil +} + +func (m *Host) validateGpuModelID(formats strfmt.Registry) error { + + if err := validate.Required("gpuModelId", "body", m.GpuModelID); err != nil { + return err + } + + return nil +} + +func (m *Host) validateGpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("gpuUsed", "body", m.GpuUsed); err != nil { + return err + } + + return nil +} + +func (m *Host) validateMachineType(formats strfmt.Registry) error { + + if err := validate.Required("machineType", "body", m.MachineType); err != nil { + return err + } + + return nil +} + +func (m *Host) validateMemoryGibFree(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibFree", "body", m.MemoryGibFree); err != nil { + return err + } + + return nil +} + +func (m *Host) validateMemoryGibUsed(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibUsed", "body", m.MemoryGibUsed); err != nil { + return err + } + + return nil +} + +func (m *Host) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Host) validateOnline(formats strfmt.Registry) error { + + if err := validate.Required("online", "body", m.Online); err != nil { + return err + } + + return nil +} + +func (m *Host) validateUpdateTime(formats strfmt.Registry) error { + + if err := validate.Required("updateTime", "body", m.UpdateTime); err != nil { + return err + } + + if err := validate.FormatOf("updateTime", "body", "date-time", m.UpdateTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Host) validateVcpuFree(formats strfmt.Registry) error { + + if err := validate.Required("vcpuFree", "body", m.VcpuFree); err != nil { + return err + } + + return nil +} + +func (m *Host) validateVcpuPerCPUThread(formats strfmt.Registry) error { + + if err := validate.Required("vcpuPerCpuThread", "body", m.VcpuPerCPUThread); err != nil { + return err + } + + return nil +} + +func (m *Host) validateVcpuUsed(formats strfmt.Registry) error { + + if err := validate.Required("vcpuUsed", "body", m.VcpuUsed); err != nil { + return err + } + + return nil +} + +func (m *Host) validateVMCount(formats strfmt.Registry) error { + + if err := validate.Required("vmCount", "body", m.VMCount); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this host based on context it is used +func (m *Host) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Host) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Host) UnmarshalBinary(b []byte) error { + var res Host + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/host_config_category.go b/internal/models/host_config_category.go index d0467ef..c3856fc 100644 --- a/internal/models/host_config_category.go +++ b/internal/models/host_config_category.go @@ -35,6 +35,10 @@ type HostConfigCategory struct { // Required: true GpuModel *string `json:"gpuModel"` + // gpu model Id + // Required: true + GpuModelID *string `json:"gpuModelId"` + // gpu price hr // Required: true GpuPriceHr *Decimal `json:"gpuPriceHr"` @@ -108,6 +112,10 @@ func (m *HostConfigCategory) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateGpuModelID(formats); err != nil { + res = append(res, err) + } + if err := m.validateGpuPriceHr(formats); err != nil { res = append(res, err) } @@ -202,6 +210,15 @@ func (m *HostConfigCategory) validateGpuModel(formats strfmt.Registry) error { return nil } +func (m *HostConfigCategory) validateGpuModelID(formats strfmt.Registry) error { + + if err := validate.Required("gpuModelId", "body", m.GpuModelID); err != nil { + return err + } + + return nil +} + func (m *HostConfigCategory) validateGpuPriceHr(formats strfmt.Registry) error { if err := validate.Required("gpuPriceHr", "body", m.GpuPriceHr); err != nil { diff --git a/internal/models/image.go b/internal/models/image.go index 5c7a8e0..8302fe5 100644 --- a/internal/models/image.go +++ b/internal/models/image.go @@ -7,6 +7,7 @@ package models import ( "context" + "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -31,6 +32,10 @@ type Image struct { // Required: true ID *string `json:"id"` + // installed packages + // Required: true + InstalledPackages []*Package `json:"installedPackages"` + // name // Required: true Name *string `json:"name"` @@ -60,6 +65,10 @@ func (m *Image) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateInstalledPackages(formats); err != nil { + res = append(res, err) + } + if err := m.validateName(formats); err != nil { res = append(res, err) } @@ -105,6 +114,33 @@ func (m *Image) validateID(formats strfmt.Registry) error { return nil } +func (m *Image) validateInstalledPackages(formats strfmt.Registry) error { + + if err := validate.Required("installedPackages", "body", m.InstalledPackages); err != nil { + return err + } + + for i := 0; i < len(m.InstalledPackages); i++ { + if swag.IsZero(m.InstalledPackages[i]) { // not required + continue + } + + if m.InstalledPackages[i] != nil { + if err := m.InstalledPackages[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("installedPackages" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("installedPackages" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *Image) validateName(formats strfmt.Registry) error { if err := validate.Required("name", "body", m.Name); err != nil { @@ -132,8 +168,42 @@ func (m *Image) validateSizeGib(formats strfmt.Registry) error { return nil } -// ContextValidate validates this image based on context it is used +// ContextValidate validate this image based on the context it is used func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInstalledPackages(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Image) contextValidateInstalledPackages(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.InstalledPackages); i++ { + + if m.InstalledPackages[i] != nil { + + if swag.IsZero(m.InstalledPackages[i]) { // not required + return nil + } + + if err := m.InstalledPackages[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("installedPackages" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("installedPackages" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + return nil } diff --git a/internal/models/interval.go b/internal/models/interval.go new file mode 100644 index 0000000..3d37265 --- /dev/null +++ b/internal/models/interval.go @@ -0,0 +1,84 @@ +// 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" +) + +// Interval interval +// +// swagger:model Interval +type Interval string + +func NewInterval(value Interval) *Interval { + return &value +} + +// Pointer returns a pointer to a freshly-allocated Interval. +func (m Interval) Pointer() *Interval { + return &m +} + +const ( + + // IntervalINTERVALUNKNOWN captures enum value "INTERVAL_UNKNOWN" + IntervalINTERVALUNKNOWN Interval = "INTERVAL_UNKNOWN" + + // IntervalINTERVALDAY captures enum value "INTERVAL_DAY" + IntervalINTERVALDAY Interval = "INTERVAL_DAY" + + // IntervalINTERVALWEEK captures enum value "INTERVAL_WEEK" + IntervalINTERVALWEEK Interval = "INTERVAL_WEEK" + + // IntervalINTERVALMONTH captures enum value "INTERVAL_MONTH" + IntervalINTERVALMONTH Interval = "INTERVAL_MONTH" +) + +// for schema +var intervalEnum []interface{} + +func init() { + var res []Interval + if err := json.Unmarshal([]byte(`["INTERVAL_UNKNOWN","INTERVAL_DAY","INTERVAL_WEEK","INTERVAL_MONTH"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + intervalEnum = append(intervalEnum, v) + } +} + +func (m Interval) validateIntervalEnum(path, location string, value Interval) error { + if err := validate.EnumCase(path, location, value, intervalEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this interval +func (m Interval) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateIntervalEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this interval based on context it is used +func (m Interval) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/invoice.go b/internal/models/invoice.go new file mode 100644 index 0000000..13127ec --- /dev/null +++ b/internal/models/invoice.go @@ -0,0 +1,95 @@ +// 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" +) + +// Invoice invoice +// +// swagger:model Invoice +type Invoice struct { + + // amount due + AmountDue string `json:"amountDue,omitempty"` + + // amount paid + AmountPaid string `json:"amountPaid,omitempty"` + + // amount remaining + AmountRemaining string `json:"amountRemaining,omitempty"` + + // auto advance + AutoAdvance bool `json:"autoAdvance,omitempty"` + + // billing reason + BillingReason string `json:"billingReason,omitempty"` + + // created + Created string `json:"created,omitempty"` + + // currency + Currency string `json:"currency,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // due date + DueDate string `json:"dueDate,omitempty"` + + // hosted invoice Url + HostedInvoiceURL string `json:"hostedInvoiceUrl,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // number + Number string `json:"number,omitempty"` + + // paid date + PaidDate string `json:"paidDate,omitempty"` + + // period end + PeriodEnd string `json:"periodEnd,omitempty"` + + // period start + PeriodStart string `json:"periodStart,omitempty"` + + // status + Status string `json:"status,omitempty"` +} + +// Validate validates this invoice +func (m *Invoice) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this invoice based on context it is used +func (m *Invoice) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Invoice) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Invoice) UnmarshalBinary(b []byte) error { + var res Invoice + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_billing_accounts_response.go b/internal/models/list_billing_accounts_response.go new file mode 100644 index 0000000..39c92d0 --- /dev/null +++ b/internal/models/list_billing_accounts_response.go @@ -0,0 +1,158 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ListBillingAccountsResponse list billing accounts response +// +// swagger:model ListBillingAccountsResponse +type ListBillingAccountsResponse struct { + + // billing accounts + // Required: true + BillingAccounts []*BillingAccount `json:"billingAccounts"` + + // page size + // Required: true + PageSize *int32 `json:"pageSize"` + + // page token + // Required: true + PageToken *string `json:"pageToken"` +} + +// Validate validates this list billing accounts response +func (m *ListBillingAccountsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillingAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePageSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePageToken(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListBillingAccountsResponse) validateBillingAccounts(formats strfmt.Registry) error { + + if err := validate.Required("billingAccounts", "body", m.BillingAccounts); err != nil { + return err + } + + for i := 0; i < len(m.BillingAccounts); i++ { + if swag.IsZero(m.BillingAccounts[i]) { // not required + continue + } + + if m.BillingAccounts[i] != nil { + if err := m.BillingAccounts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ListBillingAccountsResponse) validatePageSize(formats strfmt.Registry) error { + + if err := validate.Required("pageSize", "body", m.PageSize); err != nil { + return err + } + + return nil +} + +func (m *ListBillingAccountsResponse) validatePageToken(formats strfmt.Registry) error { + + if err := validate.Required("pageToken", "body", m.PageToken); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this list billing accounts response based on the context it is used +func (m *ListBillingAccountsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListBillingAccountsResponse) contextValidateBillingAccounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.BillingAccounts); i++ { + + if m.BillingAccounts[i] != nil { + + if swag.IsZero(m.BillingAccounts[i]) { // not required + return nil + } + + if err := m.BillingAccounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListBillingAccountsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListBillingAccountsResponse) UnmarshalBinary(b []byte) error { + var res ListBillingAccountsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_clusters_response.go b/internal/models/list_clusters_response.go new file mode 100644 index 0000000..c67609d --- /dev/null +++ b/internal/models/list_clusters_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ListClustersResponse list clusters response +// +// swagger:model ListClustersResponse +type ListClustersResponse struct { + + // clusters + // Required: true + Clusters []*Cluster `json:"clusters"` +} + +// Validate validates this list clusters response +func (m *ListClustersResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClusters(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListClustersResponse) validateClusters(formats strfmt.Registry) error { + + if err := validate.Required("clusters", "body", m.Clusters); err != nil { + return err + } + + for i := 0; i < len(m.Clusters); i++ { + if swag.IsZero(m.Clusters[i]) { // not required + continue + } + + if m.Clusters[i] != nil { + if err := m.Clusters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clusters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clusters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this list clusters response based on the context it is used +func (m *ListClustersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClusters(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListClustersResponse) contextValidateClusters(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Clusters); i++ { + + if m.Clusters[i] != nil { + + if swag.IsZero(m.Clusters[i]) { // not required + return nil + } + + if err := m.Clusters[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clusters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clusters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListClustersResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListClustersResponse) UnmarshalBinary(b []byte) error { + var res ListClustersResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_data_centers_response.go b/internal/models/list_data_centers_response.go new file mode 100644 index 0000000..4d79cee --- /dev/null +++ b/internal/models/list_data_centers_response.go @@ -0,0 +1,158 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ListDataCentersResponse list data centers response +// +// swagger:model ListDataCentersResponse +type ListDataCentersResponse struct { + + // data centers + // Required: true + DataCenters []*V1DataCenter `json:"dataCenters"` + + // page size + // Required: true + PageSize *int32 `json:"pageSize"` + + // page token + // Required: true + PageToken *string `json:"pageToken"` +} + +// Validate validates this list data centers response +func (m *ListDataCentersResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDataCenters(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePageSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePageToken(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListDataCentersResponse) validateDataCenters(formats strfmt.Registry) error { + + if err := validate.Required("dataCenters", "body", m.DataCenters); err != nil { + return err + } + + for i := 0; i < len(m.DataCenters); i++ { + if swag.IsZero(m.DataCenters[i]) { // not required + continue + } + + if m.DataCenters[i] != nil { + if err := m.DataCenters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ListDataCentersResponse) validatePageSize(formats strfmt.Registry) error { + + if err := validate.Required("pageSize", "body", m.PageSize); err != nil { + return err + } + + return nil +} + +func (m *ListDataCentersResponse) validatePageToken(formats strfmt.Registry) error { + + if err := validate.Required("pageToken", "body", m.PageToken); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this list data centers response based on the context it is used +func (m *ListDataCentersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDataCenters(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListDataCentersResponse) contextValidateDataCenters(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DataCenters); i++ { + + if m.DataCenters[i] != nil { + + if swag.IsZero(m.DataCenters[i]) { // not required + return nil + } + + if err := m.DataCenters[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListDataCentersResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListDataCentersResponse) UnmarshalBinary(b []byte) error { + var res ListDataCentersResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_hosts_response.go b/internal/models/list_hosts_response.go new file mode 100644 index 0000000..b5311e8 --- /dev/null +++ b/internal/models/list_hosts_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ListHostsResponse list hosts response +// +// swagger:model ListHostsResponse +type ListHostsResponse struct { + + // hosts + // Required: true + Hosts []*Host `json:"hosts"` +} + +// Validate validates this list hosts response +func (m *ListHostsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHosts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListHostsResponse) validateHosts(formats strfmt.Registry) error { + + if err := validate.Required("hosts", "body", m.Hosts); err != nil { + return err + } + + for i := 0; i < len(m.Hosts); i++ { + if swag.IsZero(m.Hosts[i]) { // not required + continue + } + + if m.Hosts[i] != nil { + if err := m.Hosts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this list hosts response based on the context it is used +func (m *ListHostsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHosts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListHostsResponse) contextValidateHosts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Hosts); i++ { + + if m.Hosts[i] != nil { + + if swag.IsZero(m.Hosts[i]) { // not required + return nil + } + + if err := m.Hosts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListHostsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListHostsResponse) UnmarshalBinary(b []byte) error { + var res ListHostsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_machine_types_response.go b/internal/models/list_machine_types_response.go new file mode 100644 index 0000000..051200f --- /dev/null +++ b/internal/models/list_machine_types_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ListMachineTypesResponse list machine types response +// +// swagger:model ListMachineTypesResponse +type ListMachineTypesResponse struct { + + // machine types + // Required: true + MachineTypes []*DataCenterMachineType `json:"machineTypes"` +} + +// Validate validates this list machine types response +func (m *ListMachineTypesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMachineTypes(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListMachineTypesResponse) validateMachineTypes(formats strfmt.Registry) error { + + if err := validate.Required("machineTypes", "body", m.MachineTypes); err != nil { + return err + } + + for i := 0; i < len(m.MachineTypes); i++ { + if swag.IsZero(m.MachineTypes[i]) { // not required + continue + } + + if m.MachineTypes[i] != nil { + if err := m.MachineTypes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this list machine types response based on the context it is used +func (m *ListMachineTypesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMachineTypes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListMachineTypesResponse) contextValidateMachineTypes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MachineTypes); i++ { + + if m.MachineTypes[i] != nil { + + if swag.IsZero(m.MachineTypes[i]) { // not required + return nil + } + + if err := m.MachineTypes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListMachineTypesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListMachineTypesResponse) UnmarshalBinary(b []byte) error { + var res ListMachineTypesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_outstanding_stripe_invoices_response.go b/internal/models/list_outstanding_stripe_invoices_response.go new file mode 100644 index 0000000..1731be3 --- /dev/null +++ b/internal/models/list_outstanding_stripe_invoices_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ListOutstandingStripeInvoicesResponse list outstanding stripe invoices response +// +// swagger:model ListOutstandingStripeInvoicesResponse +type ListOutstandingStripeInvoicesResponse struct { + + // invoices + // Required: true + Invoices []*Invoice `json:"invoices"` +} + +// Validate validates this list outstanding stripe invoices response +func (m *ListOutstandingStripeInvoicesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInvoices(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListOutstandingStripeInvoicesResponse) validateInvoices(formats strfmt.Registry) error { + + if err := validate.Required("invoices", "body", m.Invoices); err != nil { + return err + } + + for i := 0; i < len(m.Invoices); i++ { + if swag.IsZero(m.Invoices[i]) { // not required + continue + } + + if m.Invoices[i] != nil { + if err := m.Invoices[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("invoices" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("invoices" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this list outstanding stripe invoices response based on the context it is used +func (m *ListOutstandingStripeInvoicesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInvoices(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListOutstandingStripeInvoicesResponse) contextValidateInvoices(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Invoices); i++ { + + if m.Invoices[i] != nil { + + if swag.IsZero(m.Invoices[i]) { // not required + return nil + } + + if err := m.Invoices[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("invoices" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("invoices" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListOutstandingStripeInvoicesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListOutstandingStripeInvoicesResponse) UnmarshalBinary(b []byte) error { + var res ListOutstandingStripeInvoicesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_vm_machine_types2_response.go b/internal/models/list_vm_machine_types2_response.go new file mode 100644 index 0000000..e6e54c9 --- /dev/null +++ b/internal/models/list_vm_machine_types2_response.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/validate" +) + +// ListVMMachineTypes2Response list VM machine types2 response +// +// swagger:model ListVMMachineTypes2Response +type ListVMMachineTypes2Response struct { + + // machine types + // Required: true + MachineTypes []*VMMachineType `json:"machineTypes"` +} + +// Validate validates this list VM machine types2 response +func (m *ListVMMachineTypes2Response) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMachineTypes(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListVMMachineTypes2Response) validateMachineTypes(formats strfmt.Registry) error { + + if err := validate.Required("machineTypes", "body", m.MachineTypes); err != nil { + return err + } + + for i := 0; i < len(m.MachineTypes); i++ { + if swag.IsZero(m.MachineTypes[i]) { // not required + continue + } + + if m.MachineTypes[i] != nil { + if err := m.MachineTypes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this list VM machine types2 response based on the context it is used +func (m *ListVMMachineTypes2Response) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMachineTypes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListVMMachineTypes2Response) contextValidateMachineTypes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MachineTypes); i++ { + + if m.MachineTypes[i] != nil { + + if swag.IsZero(m.MachineTypes[i]) { // not required + return nil + } + + if err := m.MachineTypes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("machineTypes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListVMMachineTypes2Response) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListVMMachineTypes2Response) UnmarshalBinary(b []byte) error { + var res ListVMMachineTypes2Response + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/list_vm_machine_types_request.go b/internal/models/list_vm_machine_types_request.go index 3f8d560..80c30a6 100644 --- a/internal/models/list_vm_machine_types_request.go +++ b/internal/models/list_vm_machine_types_request.go @@ -31,6 +31,9 @@ type ListVMMachineTypesRequest struct { // gpu model GpuModel string `json:"gpuModel,omitempty"` + // gpu model Id + GpuModelID string `json:"gpuModelId,omitempty"` + // memory gib // Required: true MemoryGib *int32 `json:"memoryGib"` diff --git a/internal/models/network.go b/internal/models/network.go index 9e66ddb..b1b6d84 100644 --- a/internal/models/network.go +++ b/internal/models/network.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // Network network @@ -18,61 +19,178 @@ import ( // swagger:model Network type Network struct { - // active state - ActiveState string `json:"activeState,omitempty"` + // create time + // Required: true + // Read Only: true + // Format: date-time + CreateTime strfmt.DateTime `json:"createTime"` // data center Id - DataCenterID string `json:"dataCenterId,omitempty"` + // Required: true + DataCenterID *string `json:"dataCenterId"` // external Ip address - ExternalIPAddress string `json:"externalIpAddress,omitempty"` + // Required: true + ExternalIPAddress *string `json:"externalIpAddress"` // gateway - Gateway string `json:"gateway,omitempty"` + // Required: true + Gateway *string `json:"gateway"` // id - ID string `json:"id,omitempty"` - - // init state - InitState string `json:"initState,omitempty"` + // Required: true + ID *string `json:"id"` // internal Ip address - InternalIPAddress string `json:"internalIpAddress,omitempty"` + // Required: true + InternalIPAddress *string `json:"internalIpAddress"` // ip range - IPRange string `json:"ipRange,omitempty"` + // Required: true + IPRange *string `json:"ipRange"` // price hr - PriceHr *Decimal `json:"priceHr,omitempty"` + // Required: true + PriceHr *Decimal `json:"priceHr"` // short state - ShortState string `json:"shortState,omitempty"` + // Required: true + ShortState *string `json:"shortState"` // size - Size *VRouterSize `json:"size,omitempty"` + // Required: true + Size *V1VRouterSize `json:"size"` + + // state + // Required: true + State *NetworkState `json:"state"` } // Validate validates this network func (m *Network) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateCreateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDataCenterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExternalIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGateway(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInternalIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPRange(formats); err != nil { + res = append(res, err) + } + if err := m.validatePriceHr(formats); err != nil { res = append(res, err) } + if err := m.validateShortState(formats); err != nil { + res = append(res, err) + } + if err := m.validateSize(formats); err != nil { res = append(res, err) } + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } +func (m *Network) validateCreateTime(formats strfmt.Registry) error { + + if err := validate.Required("createTime", "body", strfmt.DateTime(m.CreateTime)); err != nil { + return err + } + + if err := validate.FormatOf("createTime", "body", "date-time", m.CreateTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Network) validateDataCenterID(formats strfmt.Registry) error { + + if err := validate.Required("dataCenterId", "body", m.DataCenterID); err != nil { + return err + } + + return nil +} + +func (m *Network) validateExternalIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("externalIpAddress", "body", m.ExternalIPAddress); err != nil { + return err + } + + return nil +} + +func (m *Network) validateGateway(formats strfmt.Registry) error { + + if err := validate.Required("gateway", "body", m.Gateway); err != nil { + return err + } + + return nil +} + +func (m *Network) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *Network) validateInternalIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("internalIpAddress", "body", m.InternalIPAddress); err != nil { + return err + } + + return nil +} + +func (m *Network) validateIPRange(formats strfmt.Registry) error { + + if err := validate.Required("ipRange", "body", m.IPRange); err != nil { + return err + } + + return nil +} + func (m *Network) validatePriceHr(formats strfmt.Registry) error { - if swag.IsZero(m.PriceHr) { // not required - return nil + + if err := validate.Required("priceHr", "body", m.PriceHr); err != nil { + return err } if m.PriceHr != nil { @@ -89,9 +207,23 @@ func (m *Network) validatePriceHr(formats strfmt.Registry) error { return nil } +func (m *Network) validateShortState(formats strfmt.Registry) error { + + if err := validate.Required("shortState", "body", m.ShortState); err != nil { + return err + } + + return nil +} + func (m *Network) validateSize(formats strfmt.Registry) error { - if swag.IsZero(m.Size) { // not required - return nil + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + if err := validate.Required("size", "body", m.Size); err != nil { + return err } if m.Size != nil { @@ -108,10 +240,38 @@ func (m *Network) validateSize(formats strfmt.Registry) error { return nil } +func (m *Network) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + if m.State != nil { + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + // ContextValidate validate this network based on the context it is used func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateCreateTime(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidatePriceHr(ctx, formats); err != nil { res = append(res, err) } @@ -120,20 +280,29 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } + if err := m.contextValidateState(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } +func (m *Network) contextValidateCreateTime(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "createTime", "body", strfmt.DateTime(m.CreateTime)); err != nil { + return err + } + + return nil +} + func (m *Network) contextValidatePriceHr(ctx context.Context, formats strfmt.Registry) error { if m.PriceHr != nil { - if swag.IsZero(m.PriceHr) { // not required - return nil - } - if err := m.PriceHr.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("priceHr") @@ -151,10 +320,6 @@ func (m *Network) contextValidateSize(ctx context.Context, formats strfmt.Regist if m.Size != nil { - if swag.IsZero(m.Size) { // not required - return nil - } - if err := m.Size.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("size") @@ -168,6 +333,23 @@ func (m *Network) contextValidateSize(ctx context.Context, formats strfmt.Regist return nil } +func (m *Network) contextValidateState(ctx context.Context, formats strfmt.Registry) error { + + if m.State != nil { + + if err := m.State.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Network) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/internal/models/network_price_hr.go b/internal/models/network_price_hr.go index f6304f9..4897b75 100644 --- a/internal/models/network_price_hr.go +++ b/internal/models/network_price_hr.go @@ -22,7 +22,7 @@ type NetworkPriceHr struct { PriceHr *Decimal `json:"priceHr,omitempty"` // size - Size *VRouterSize `json:"size,omitempty"` + Size *VMDataCenterVRouterSize `json:"size,omitempty"` } // Validate validates this network price hr diff --git a/internal/models/network_state.go b/internal/models/network_state.go new file mode 100644 index 0000000..15c56ed --- /dev/null +++ b/internal/models/network_state.go @@ -0,0 +1,129 @@ +// 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" +) + +// NetworkState network state +// +// swagger:model NetworkState +type NetworkState string + +func NewNetworkState(value NetworkState) *NetworkState { + return &value +} + +// Pointer returns a pointer to a freshly-allocated NetworkState. +func (m NetworkState) Pointer() *NetworkState { + return &m +} + +const ( + + // NetworkStateCLONING captures enum value "CLONING" + NetworkStateCLONING NetworkState = "CLONING" + + // NetworkStateCREATINGSNAPSHOT captures enum value "CREATING_SNAPSHOT" + NetworkStateCREATINGSNAPSHOT NetworkState = "CREATING_SNAPSHOT" + + // NetworkStateDELETED captures enum value "DELETED" + NetworkStateDELETED NetworkState = "DELETED" + + // NetworkStateDELETING captures enum value "DELETING" + NetworkStateDELETING NetworkState = "DELETING" + + // NetworkStateDELETINGSNAPSHOT captures enum value "DELETING_SNAPSHOT" + NetworkStateDELETINGSNAPSHOT NetworkState = "DELETING_SNAPSHOT" + + // NetworkStateFAILED captures enum value "FAILED" + NetworkStateFAILED NetworkState = "FAILED" + + // NetworkStateHOTPLUGGING captures enum value "HOTPLUGGING" + NetworkStateHOTPLUGGING NetworkState = "HOTPLUGGING" + + // NetworkStateMIGRATING captures enum value "MIGRATING" + NetworkStateMIGRATING NetworkState = "MIGRATING" + + // NetworkStateRECREATING captures enum value "RECREATING" + NetworkStateRECREATING NetworkState = "RECREATING" + + // NetworkStateREVERTINGSNAPSHOT captures enum value "REVERTING_SNAPSHOT" + NetworkStateREVERTINGSNAPSHOT NetworkState = "REVERTING_SNAPSHOT" + + // NetworkStateRESIZING captures enum value "RESIZING" + NetworkStateRESIZING NetworkState = "RESIZING" + + // NetworkStateRESIZINGDISK captures enum value "RESIZING_DISK" + NetworkStateRESIZINGDISK NetworkState = "RESIZING_DISK" + + // NetworkStateACTIVE captures enum value "ACTIVE" + NetworkStateACTIVE NetworkState = "ACTIVE" + + // NetworkStateSTARTING captures enum value "STARTING" + NetworkStateSTARTING NetworkState = "STARTING" + + // NetworkStateSTOPPED captures enum value "STOPPED" + NetworkStateSTOPPED NetworkState = "STOPPED" + + // NetworkStateSTOPPING captures enum value "STOPPING" + NetworkStateSTOPPING NetworkState = "STOPPING" + + // NetworkStateSUSPENDED captures enum value "SUSPENDED" + NetworkStateSUSPENDED NetworkState = "SUSPENDED" + + // NetworkStateSUSPENDING captures enum value "SUSPENDING" + NetworkStateSUSPENDING NetworkState = "SUSPENDING" + + // NetworkStateUNKNOWN captures enum value "UNKNOWN" + NetworkStateUNKNOWN NetworkState = "UNKNOWN" +) + +// for schema +var networkStateEnum []interface{} + +func init() { + var res []NetworkState + if err := json.Unmarshal([]byte(`["CLONING","CREATING_SNAPSHOT","DELETED","DELETING","DELETING_SNAPSHOT","FAILED","HOTPLUGGING","MIGRATING","RECREATING","REVERTING_SNAPSHOT","RESIZING","RESIZING_DISK","ACTIVE","STARTING","STOPPED","STOPPING","SUSPENDED","SUSPENDING","UNKNOWN"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkStateEnum = append(networkStateEnum, v) + } +} + +func (m NetworkState) validateNetworkStateEnum(path, location string, value NetworkState) error { + if err := validate.EnumCase(path, location, value, networkStateEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this network state +func (m NetworkState) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateNetworkStateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this network state based on context it is used +func (m NetworkState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/package.go b/internal/models/package.go new file mode 100644 index 0000000..31bc82f --- /dev/null +++ b/internal/models/package.go @@ -0,0 +1,105 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Package package +// +// swagger:model Package +type Package struct { + + // description + // Required: true + Description *string `json:"description"` + + // name + // Required: true + Name *string `json:"name"` + + // version + // Required: true + Version *string `json:"version"` +} + +// Validate validates this package +func (m *Package) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Package) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *Package) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Package) validateVersion(formats strfmt.Registry) error { + + if err := validate.Required("version", "body", m.Version); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this package based on context it is used +func (m *Package) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Package) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Package) UnmarshalBinary(b []byte) error { + var res Package + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/payment_method_card.go b/internal/models/payment_method_card.go new file mode 100644 index 0000000..7bbc490 --- /dev/null +++ b/internal/models/payment_method_card.go @@ -0,0 +1,65 @@ +// 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" +) + +// PaymentMethodCard payment method card +// +// swagger:model PaymentMethodCard +type PaymentMethodCard struct { + + // brand + Brand string `json:"brand,omitempty"` + + // country + Country string `json:"country,omitempty"` + + // exp month + ExpMonth string `json:"expMonth,omitempty"` + + // exp year + ExpYear string `json:"expYear,omitempty"` + + // fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + + // last4 + Last4 string `json:"last4,omitempty"` +} + +// Validate validates this payment method card +func (m *PaymentMethodCard) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this payment method card based on context it is used +func (m *PaymentMethodCard) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PaymentMethodCard) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PaymentMethodCard) UnmarshalBinary(b []byte) error { + var res PaymentMethodCard + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/payment_method_paypal.go b/internal/models/payment_method_paypal.go new file mode 100644 index 0000000..3902167 --- /dev/null +++ b/internal/models/payment_method_paypal.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PaymentMethodPaypal payment method paypal +// +// swagger:model PaymentMethodPaypal +type PaymentMethodPaypal struct { + + // payer email + PayerEmail string `json:"payerEmail,omitempty"` + + // payer Id + PayerID string `json:"payerId,omitempty"` +} + +// Validate validates this payment method paypal +func (m *PaymentMethodPaypal) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this payment method paypal based on context it is used +func (m *PaymentMethodPaypal) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PaymentMethodPaypal) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PaymentMethodPaypal) UnmarshalBinary(b []byte) error { + var res PaymentMethodPaypal + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/point.go b/internal/models/point.go new file mode 100644 index 0000000..aee200f --- /dev/null +++ b/internal/models/point.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Point point +// +// swagger:model Point +type Point struct { + + // lat + Lat float64 `json:"lat,omitempty"` + + // lng + Lng float64 `json:"lng,omitempty"` +} + +// Validate validates this point +func (m *Point) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this point based on context it is used +func (m *Point) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Point) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Point) UnmarshalBinary(b []byte) error { + var res Point + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/protobuf_any.go b/internal/models/protobuf_any.go new file mode 100644 index 0000000..42a5730 --- /dev/null +++ b/internal/models/protobuf_any.go @@ -0,0 +1,161 @@ +// 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" +) + +// ProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a +// URL that describes the type of the serialized message. +// +// Protobuf library provides support to pack/unpack Any values in the form +// of utility functions or additional generated methods of the Any type. +// +// Example 1: Pack and unpack a message in C++. +// +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } +// +// Example 2: Pack and unpack a message in Java. +// +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// // or ... +// if (any.isSameTypeAs(Foo.getDefaultInstance())) { +// foo = any.unpack(Foo.getDefaultInstance()); +// } +// +// Example 3: Pack and unpack a message in Python. +// +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... +// +// Example 4: Pack and unpack a message in Go +// +// foo := &pb.Foo{...} +// any, err := anypb.New(foo) +// if err != nil { +// ... +// } +// ... +// foo := &pb.Foo{} +// if err := any.UnmarshalTo(foo); err != nil { +// ... +// } +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +// swagger:model protobuf.Any +type ProtobufAny struct { + + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. This string must contain at least + // one "/" character. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). + // + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: + // + // * If no scheme is provided, `https` is assumed. + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. As of May 2023, there are no widely used type server + // implementations and no plans to implement one. + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + AtType string `json:"@type,omitempty"` +} + +// Validate validates this protobuf any +func (m *ProtobufAny) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this protobuf any based on context it is used +func (m *ProtobufAny) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ProtobufAny) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ProtobufAny) UnmarshalBinary(b []byte) error { + var res ProtobufAny + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/protocol.go b/internal/models/protocol.go deleted file mode 100644 index 42d2e0c..0000000 --- a/internal/models/protocol.go +++ /dev/null @@ -1,93 +0,0 @@ -// 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" -) - -// Protocol protocol -// -// swagger:model Protocol -type Protocol string - -func NewProtocol(value Protocol) *Protocol { - return &value -} - -// Pointer returns a pointer to a freshly-allocated Protocol. -func (m Protocol) Pointer() *Protocol { - return &m -} - -const ( - - // ProtocolPROTOCOLUNKNOWN captures enum value "PROTOCOL_UNKNOWN" - ProtocolPROTOCOLUNKNOWN Protocol = "PROTOCOL_UNKNOWN" - - // ProtocolPROTOCOLALL captures enum value "PROTOCOL_ALL" - ProtocolPROTOCOLALL Protocol = "PROTOCOL_ALL" - - // ProtocolPROTOCOLTCP captures enum value "PROTOCOL_TCP" - ProtocolPROTOCOLTCP Protocol = "PROTOCOL_TCP" - - // ProtocolPROTOCOLUDP captures enum value "PROTOCOL_UDP" - ProtocolPROTOCOLUDP Protocol = "PROTOCOL_UDP" - - // ProtocolPROTOCOLICMP captures enum value "PROTOCOL_ICMP" - ProtocolPROTOCOLICMP Protocol = "PROTOCOL_ICMP" - - // ProtocolPROTOCOLICMPv6 captures enum value "PROTOCOL_ICMPv6" - ProtocolPROTOCOLICMPv6 Protocol = "PROTOCOL_ICMPv6" - - // ProtocolPROTOCOLIPSEC captures enum value "PROTOCOL_IPSEC" - ProtocolPROTOCOLIPSEC Protocol = "PROTOCOL_IPSEC" -) - -// for schema -var protocolEnum []interface{} - -func init() { - var res []Protocol - if err := json.Unmarshal([]byte(`["PROTOCOL_UNKNOWN","PROTOCOL_ALL","PROTOCOL_TCP","PROTOCOL_UDP","PROTOCOL_ICMP","PROTOCOL_ICMPv6","PROTOCOL_IPSEC"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - protocolEnum = append(protocolEnum, v) - } -} - -func (m Protocol) validateProtocolEnum(path, location string, value Protocol) error { - if err := validate.EnumCase(path, location, value, protocolEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this protocol -func (m Protocol) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateProtocolEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this protocol based on context it is used -func (m Protocol) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/internal/models/region.go b/internal/models/region.go index b7877f1..e446522 100644 --- a/internal/models/region.go +++ b/internal/models/region.go @@ -7,7 +7,9 @@ package models import ( "context" + "strconv" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) @@ -17,6 +19,9 @@ import ( // swagger:model Region type Region struct { + // data centers + DataCenters []*RegionDataCenter `json:"dataCenters"` + // id ID string `json:"id,omitempty"` @@ -26,11 +31,80 @@ type Region struct { // Validate validates this region func (m *Region) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDataCenters(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Region) validateDataCenters(formats strfmt.Registry) error { + if swag.IsZero(m.DataCenters) { // not required + return nil + } + + for i := 0; i < len(m.DataCenters); i++ { + if swag.IsZero(m.DataCenters[i]) { // not required + continue + } + + if m.DataCenters[i] != nil { + if err := m.DataCenters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + return nil } -// ContextValidate validates this region based on context it is used +// ContextValidate validate this region based on the context it is used func (m *Region) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDataCenters(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Region) contextValidateDataCenters(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DataCenters); i++ { + + if m.DataCenters[i] != nil { + + if swag.IsZero(m.DataCenters[i]) { // not required + return nil + } + + if err := m.DataCenters[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dataCenters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + return nil } diff --git a/internal/models/region_data_center.go b/internal/models/region_data_center.go new file mode 100644 index 0000000..2a78fd4 --- /dev/null +++ b/internal/models/region_data_center.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" +) + +// RegionDataCenter region data center +// +// swagger:model Region.DataCenter +type RegionDataCenter struct { + + // id + ID string `json:"id,omitempty"` +} + +// Validate validates this region data center +func (m *RegionDataCenter) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this region data center based on context it is used +func (m *RegionDataCenter) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *RegionDataCenter) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RegionDataCenter) UnmarshalBinary(b []byte) error { + var res RegionDataCenter + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/remove_billing_account_payment_method_response.go b/internal/models/remove_billing_account_payment_method_response.go new file mode 100644 index 0000000..336b599 --- /dev/null +++ b/internal/models/remove_billing_account_payment_method_response.go @@ -0,0 +1,88 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RemoveBillingAccountPaymentMethodResponse remove billing account payment method response +// +// swagger:model RemoveBillingAccountPaymentMethodResponse +type RemoveBillingAccountPaymentMethodResponse struct { + + // id + // Required: true + ID *string `json:"id"` + + // payment method Id + // Required: true + PaymentMethodID *string `json:"paymentMethodId"` +} + +// Validate validates this remove billing account payment method response +func (m *RemoveBillingAccountPaymentMethodResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePaymentMethodID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveBillingAccountPaymentMethodResponse) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *RemoveBillingAccountPaymentMethodResponse) validatePaymentMethodID(formats strfmt.Registry) error { + + if err := validate.Required("paymentMethodId", "body", m.PaymentMethodID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this remove billing account payment method response based on context it is used +func (m *RemoveBillingAccountPaymentMethodResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *RemoveBillingAccountPaymentMethodResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RemoveBillingAccountPaymentMethodResponse) UnmarshalBinary(b []byte) error { + var res RemoveBillingAccountPaymentMethodResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/remove_billing_account_user_permission_body.go b/internal/models/remove_billing_account_user_permission_body.go new file mode 100644 index 0000000..dd958f5 --- /dev/null +++ b/internal/models/remove_billing_account_user_permission_body.go @@ -0,0 +1,135 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RemoveBillingAccountUserPermissionBody remove billing account user permission body +// +// swagger:model RemoveBillingAccountUserPermissionBody +type RemoveBillingAccountUserPermissionBody struct { + + // data center Id + DataCenterID string `json:"dataCenterId,omitempty"` + + // project Id + ProjectID string `json:"projectId,omitempty"` + + // role + // Required: true + Role *Role `json:"role"` + + // user Id + // Required: true + UserID *string `json:"userId"` +} + +// Validate validates this remove billing account user permission body +func (m *RemoveBillingAccountUserPermissionBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveBillingAccountUserPermissionBody) validateRole(formats strfmt.Registry) error { + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *RemoveBillingAccountUserPermissionBody) validateUserID(formats strfmt.Registry) error { + + if err := validate.Required("userId", "body", m.UserID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this remove billing account user permission body based on the context it is used +func (m *RemoveBillingAccountUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveBillingAccountUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RemoveBillingAccountUserPermissionBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RemoveBillingAccountUserPermissionBody) UnmarshalBinary(b []byte) error { + var res RemoveBillingAccountUserPermissionBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/remove_data_center_user_permission_body.go b/internal/models/remove_data_center_user_permission_body.go new file mode 100644 index 0000000..2369073 --- /dev/null +++ b/internal/models/remove_data_center_user_permission_body.go @@ -0,0 +1,135 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RemoveDataCenterUserPermissionBody remove data center user permission body +// +// swagger:model RemoveDataCenterUserPermissionBody +type RemoveDataCenterUserPermissionBody struct { + + // billing account Id + BillingAccountID string `json:"billingAccountId,omitempty"` + + // project Id + ProjectID string `json:"projectId,omitempty"` + + // role + // Required: true + Role *Role `json:"role"` + + // user Id + // Required: true + UserID *string `json:"userId"` +} + +// Validate validates this remove data center user permission body +func (m *RemoveDataCenterUserPermissionBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveDataCenterUserPermissionBody) validateRole(formats strfmt.Registry) error { + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *RemoveDataCenterUserPermissionBody) validateUserID(formats strfmt.Registry) error { + + if err := validate.Required("userId", "body", m.UserID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this remove data center user permission body based on the context it is used +func (m *RemoveDataCenterUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveDataCenterUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RemoveDataCenterUserPermissionBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RemoveDataCenterUserPermissionBody) UnmarshalBinary(b []byte) error { + var res RemoveDataCenterUserPermissionBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/remove_project_user_permission_body.go b/internal/models/remove_project_user_permission_body.go new file mode 100644 index 0000000..6602b90 --- /dev/null +++ b/internal/models/remove_project_user_permission_body.go @@ -0,0 +1,135 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RemoveProjectUserPermissionBody remove project user permission body +// +// swagger:model RemoveProjectUserPermissionBody +type RemoveProjectUserPermissionBody struct { + + // billing account Id + BillingAccountID string `json:"billingAccountId,omitempty"` + + // data center Id + DataCenterID string `json:"dataCenterId,omitempty"` + + // role + // Required: true + Role *Role `json:"role"` + + // user Id + // Required: true + UserID *string `json:"userId"` +} + +// Validate validates this remove project user permission body +func (m *RemoveProjectUserPermissionBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveProjectUserPermissionBody) validateRole(formats strfmt.Registry) error { + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if err := validate.Required("role", "body", m.Role); err != nil { + return err + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *RemoveProjectUserPermissionBody) validateUserID(formats strfmt.Registry) error { + + if err := validate.Required("userId", "body", m.UserID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this remove project user permission body based on the context it is used +func (m *RemoveProjectUserPermissionBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RemoveProjectUserPermissionBody) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RemoveProjectUserPermissionBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RemoveProjectUserPermissionBody) UnmarshalBinary(b []byte) error { + var res RemoveProjectUserPermissionBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/rule.go b/internal/models/rule.go index 98b4ec9..6b337f8 100644 --- a/internal/models/rule.go +++ b/internal/models/rule.go @@ -31,10 +31,10 @@ type Rule struct { Ports string `json:"ports,omitempty"` // protocol - Protocol *Protocol `json:"protocol,omitempty"` + Protocol *RuleProtocol `json:"protocol,omitempty"` // rule type - RuleType *RuleType `json:"ruleType,omitempty"` + RuleType *RuleRuleType `json:"ruleType,omitempty"` } // Validate validates this rule diff --git a/internal/models/rule_protocol.go b/internal/models/rule_protocol.go new file mode 100644 index 0000000..4231f06 --- /dev/null +++ b/internal/models/rule_protocol.go @@ -0,0 +1,93 @@ +// 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" +) + +// RuleProtocol rule protocol +// +// swagger:model Rule.Protocol +type RuleProtocol string + +func NewRuleProtocol(value RuleProtocol) *RuleProtocol { + return &value +} + +// Pointer returns a pointer to a freshly-allocated RuleProtocol. +func (m RuleProtocol) Pointer() *RuleProtocol { + return &m +} + +const ( + + // RuleProtocolPROTOCOLUNKNOWN captures enum value "PROTOCOL_UNKNOWN" + RuleProtocolPROTOCOLUNKNOWN RuleProtocol = "PROTOCOL_UNKNOWN" + + // RuleProtocolPROTOCOLALL captures enum value "PROTOCOL_ALL" + RuleProtocolPROTOCOLALL RuleProtocol = "PROTOCOL_ALL" + + // RuleProtocolPROTOCOLTCP captures enum value "PROTOCOL_TCP" + RuleProtocolPROTOCOLTCP RuleProtocol = "PROTOCOL_TCP" + + // RuleProtocolPROTOCOLUDP captures enum value "PROTOCOL_UDP" + RuleProtocolPROTOCOLUDP RuleProtocol = "PROTOCOL_UDP" + + // RuleProtocolPROTOCOLICMP captures enum value "PROTOCOL_ICMP" + RuleProtocolPROTOCOLICMP RuleProtocol = "PROTOCOL_ICMP" + + // RuleProtocolPROTOCOLICMPv6 captures enum value "PROTOCOL_ICMPv6" + RuleProtocolPROTOCOLICMPv6 RuleProtocol = "PROTOCOL_ICMPv6" + + // RuleProtocolPROTOCOLIPSEC captures enum value "PROTOCOL_IPSEC" + RuleProtocolPROTOCOLIPSEC RuleProtocol = "PROTOCOL_IPSEC" +) + +// for schema +var ruleProtocolEnum []interface{} + +func init() { + var res []RuleProtocol + if err := json.Unmarshal([]byte(`["PROTOCOL_UNKNOWN","PROTOCOL_ALL","PROTOCOL_TCP","PROTOCOL_UDP","PROTOCOL_ICMP","PROTOCOL_ICMPv6","PROTOCOL_IPSEC"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ruleProtocolEnum = append(ruleProtocolEnum, v) + } +} + +func (m RuleProtocol) validateRuleProtocolEnum(path, location string, value RuleProtocol) error { + if err := validate.EnumCase(path, location, value, ruleProtocolEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this rule protocol +func (m RuleProtocol) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateRuleProtocolEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this rule protocol based on context it is used +func (m RuleProtocol) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/rule_rule_type.go b/internal/models/rule_rule_type.go new file mode 100644 index 0000000..ac9364d --- /dev/null +++ b/internal/models/rule_rule_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" +) + +// RuleRuleType rule rule type +// +// swagger:model Rule.RuleType +type RuleRuleType string + +func NewRuleRuleType(value RuleRuleType) *RuleRuleType { + return &value +} + +// Pointer returns a pointer to a freshly-allocated RuleRuleType. +func (m RuleRuleType) Pointer() *RuleRuleType { + return &m +} + +const ( + + // RuleRuleTypeRULETYPEUNKNOWN captures enum value "RULE_TYPE_UNKNOWN" + RuleRuleTypeRULETYPEUNKNOWN RuleRuleType = "RULE_TYPE_UNKNOWN" + + // RuleRuleTypeRULETYPEINBOUND captures enum value "RULE_TYPE_INBOUND" + RuleRuleTypeRULETYPEINBOUND RuleRuleType = "RULE_TYPE_INBOUND" + + // RuleRuleTypeRULETYPEOUTBOUND captures enum value "RULE_TYPE_OUTBOUND" + RuleRuleTypeRULETYPEOUTBOUND RuleRuleType = "RULE_TYPE_OUTBOUND" +) + +// for schema +var ruleRuleTypeEnum []interface{} + +func init() { + var res []RuleRuleType + if err := json.Unmarshal([]byte(`["RULE_TYPE_UNKNOWN","RULE_TYPE_INBOUND","RULE_TYPE_OUTBOUND"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ruleRuleTypeEnum = append(ruleRuleTypeEnum, v) + } +} + +func (m RuleRuleType) validateRuleRuleTypeEnum(path, location string, value RuleRuleType) error { + if err := validate.EnumCase(path, location, value, ruleRuleTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this rule rule type +func (m RuleRuleType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateRuleRuleTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this rule rule type based on context it is used +func (m RuleRuleType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/rule_type.go b/internal/models/rule_type.go deleted file mode 100644 index 926c80f..0000000 --- a/internal/models/rule_type.go +++ /dev/null @@ -1,81 +0,0 @@ -// 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" -) - -// RuleType rule type -// -// swagger:model RuleType -type RuleType string - -func NewRuleType(value RuleType) *RuleType { - return &value -} - -// Pointer returns a pointer to a freshly-allocated RuleType. -func (m RuleType) Pointer() *RuleType { - return &m -} - -const ( - - // RuleTypeRULETYPEUNKNOWN captures enum value "RULE_TYPE_UNKNOWN" - RuleTypeRULETYPEUNKNOWN RuleType = "RULE_TYPE_UNKNOWN" - - // RuleTypeRULETYPEINBOUND captures enum value "RULE_TYPE_INBOUND" - RuleTypeRULETYPEINBOUND RuleType = "RULE_TYPE_INBOUND" - - // RuleTypeRULETYPEOUTBOUND captures enum value "RULE_TYPE_OUTBOUND" - RuleTypeRULETYPEOUTBOUND RuleType = "RULE_TYPE_OUTBOUND" -) - -// for schema -var ruleTypeEnum []interface{} - -func init() { - var res []RuleType - if err := json.Unmarshal([]byte(`["RULE_TYPE_UNKNOWN","RULE_TYPE_INBOUND","RULE_TYPE_OUTBOUND"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - ruleTypeEnum = append(ruleTypeEnum, v) - } -} - -func (m RuleType) validateRuleTypeEnum(path, location string, value RuleType) error { - if err := validate.EnumCase(path, location, value, ruleTypeEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this rule type -func (m RuleType) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateRuleTypeEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this rule type based on context it is used -func (m RuleType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/internal/models/security_group_rule.go b/internal/models/security_group_rule.go index df52000..1623b8d 100644 --- a/internal/models/security_group_rule.go +++ b/internal/models/security_group_rule.go @@ -31,10 +31,10 @@ type SecurityGroupRule struct { Ports string `json:"ports,omitempty"` // protocol - Protocol *Protocol `json:"protocol,omitempty"` + Protocol *SecurityGroupRuleProtocol `json:"protocol,omitempty"` // rule type - RuleType *RuleType `json:"ruleType,omitempty"` + RuleType *SecurityGroupRuleRuleType `json:"ruleType,omitempty"` } // Validate validates this security group rule diff --git a/internal/models/security_group_rule_protocol.go b/internal/models/security_group_rule_protocol.go new file mode 100644 index 0000000..25eedf1 --- /dev/null +++ b/internal/models/security_group_rule_protocol.go @@ -0,0 +1,93 @@ +// 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" +) + +// SecurityGroupRuleProtocol security group rule protocol +// +// swagger:model SecurityGroupRule.Protocol +type SecurityGroupRuleProtocol string + +func NewSecurityGroupRuleProtocol(value SecurityGroupRuleProtocol) *SecurityGroupRuleProtocol { + return &value +} + +// Pointer returns a pointer to a freshly-allocated SecurityGroupRuleProtocol. +func (m SecurityGroupRuleProtocol) Pointer() *SecurityGroupRuleProtocol { + return &m +} + +const ( + + // SecurityGroupRuleProtocolPROTOCOLUNKNOWN captures enum value "PROTOCOL_UNKNOWN" + SecurityGroupRuleProtocolPROTOCOLUNKNOWN SecurityGroupRuleProtocol = "PROTOCOL_UNKNOWN" + + // SecurityGroupRuleProtocolPROTOCOLALL captures enum value "PROTOCOL_ALL" + SecurityGroupRuleProtocolPROTOCOLALL SecurityGroupRuleProtocol = "PROTOCOL_ALL" + + // SecurityGroupRuleProtocolPROTOCOLTCP captures enum value "PROTOCOL_TCP" + SecurityGroupRuleProtocolPROTOCOLTCP SecurityGroupRuleProtocol = "PROTOCOL_TCP" + + // SecurityGroupRuleProtocolPROTOCOLUDP captures enum value "PROTOCOL_UDP" + SecurityGroupRuleProtocolPROTOCOLUDP SecurityGroupRuleProtocol = "PROTOCOL_UDP" + + // SecurityGroupRuleProtocolPROTOCOLICMP captures enum value "PROTOCOL_ICMP" + SecurityGroupRuleProtocolPROTOCOLICMP SecurityGroupRuleProtocol = "PROTOCOL_ICMP" + + // SecurityGroupRuleProtocolPROTOCOLICMPv6 captures enum value "PROTOCOL_ICMPv6" + SecurityGroupRuleProtocolPROTOCOLICMPv6 SecurityGroupRuleProtocol = "PROTOCOL_ICMPv6" + + // SecurityGroupRuleProtocolPROTOCOLIPSEC captures enum value "PROTOCOL_IPSEC" + SecurityGroupRuleProtocolPROTOCOLIPSEC SecurityGroupRuleProtocol = "PROTOCOL_IPSEC" +) + +// for schema +var securityGroupRuleProtocolEnum []interface{} + +func init() { + var res []SecurityGroupRuleProtocol + if err := json.Unmarshal([]byte(`["PROTOCOL_UNKNOWN","PROTOCOL_ALL","PROTOCOL_TCP","PROTOCOL_UDP","PROTOCOL_ICMP","PROTOCOL_ICMPv6","PROTOCOL_IPSEC"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + securityGroupRuleProtocolEnum = append(securityGroupRuleProtocolEnum, v) + } +} + +func (m SecurityGroupRuleProtocol) validateSecurityGroupRuleProtocolEnum(path, location string, value SecurityGroupRuleProtocol) error { + if err := validate.EnumCase(path, location, value, securityGroupRuleProtocolEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this security group rule protocol +func (m SecurityGroupRuleProtocol) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateSecurityGroupRuleProtocolEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this security group rule protocol based on context it is used +func (m SecurityGroupRuleProtocol) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/security_group_rule_rule_type.go b/internal/models/security_group_rule_rule_type.go new file mode 100644 index 0000000..810dece --- /dev/null +++ b/internal/models/security_group_rule_rule_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" +) + +// SecurityGroupRuleRuleType security group rule rule type +// +// swagger:model SecurityGroupRule.RuleType +type SecurityGroupRuleRuleType string + +func NewSecurityGroupRuleRuleType(value SecurityGroupRuleRuleType) *SecurityGroupRuleRuleType { + return &value +} + +// Pointer returns a pointer to a freshly-allocated SecurityGroupRuleRuleType. +func (m SecurityGroupRuleRuleType) Pointer() *SecurityGroupRuleRuleType { + return &m +} + +const ( + + // SecurityGroupRuleRuleTypeRULETYPEUNKNOWN captures enum value "RULE_TYPE_UNKNOWN" + SecurityGroupRuleRuleTypeRULETYPEUNKNOWN SecurityGroupRuleRuleType = "RULE_TYPE_UNKNOWN" + + // SecurityGroupRuleRuleTypeRULETYPEINBOUND captures enum value "RULE_TYPE_INBOUND" + SecurityGroupRuleRuleTypeRULETYPEINBOUND SecurityGroupRuleRuleType = "RULE_TYPE_INBOUND" + + // SecurityGroupRuleRuleTypeRULETYPEOUTBOUND captures enum value "RULE_TYPE_OUTBOUND" + SecurityGroupRuleRuleTypeRULETYPEOUTBOUND SecurityGroupRuleRuleType = "RULE_TYPE_OUTBOUND" +) + +// for schema +var securityGroupRuleRuleTypeEnum []interface{} + +func init() { + var res []SecurityGroupRuleRuleType + if err := json.Unmarshal([]byte(`["RULE_TYPE_UNKNOWN","RULE_TYPE_INBOUND","RULE_TYPE_OUTBOUND"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + securityGroupRuleRuleTypeEnum = append(securityGroupRuleRuleTypeEnum, v) + } +} + +func (m SecurityGroupRuleRuleType) validateSecurityGroupRuleRuleTypeEnum(path, location string, value SecurityGroupRuleRuleType) error { + if err := validate.EnumCase(path, location, value, securityGroupRuleRuleTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this security group rule rule type +func (m SecurityGroupRuleRuleType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateSecurityGroupRuleRuleTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this security group rule rule type based on context it is used +func (m SecurityGroupRuleRuleType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/set_billing_account_default_payment_method_response.go b/internal/models/set_billing_account_default_payment_method_response.go new file mode 100644 index 0000000..5797596 --- /dev/null +++ b/internal/models/set_billing_account_default_payment_method_response.go @@ -0,0 +1,88 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// SetBillingAccountDefaultPaymentMethodResponse set billing account default payment method response +// +// swagger:model SetBillingAccountDefaultPaymentMethodResponse +type SetBillingAccountDefaultPaymentMethodResponse struct { + + // id + // Required: true + ID *string `json:"id"` + + // payment method Id + // Required: true + PaymentMethodID *string `json:"paymentMethodId"` +} + +// Validate validates this set billing account default payment method response +func (m *SetBillingAccountDefaultPaymentMethodResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePaymentMethodID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SetBillingAccountDefaultPaymentMethodResponse) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *SetBillingAccountDefaultPaymentMethodResponse) validatePaymentMethodID(formats strfmt.Registry) error { + + if err := validate.Required("paymentMethodId", "body", m.PaymentMethodID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this set billing account default payment method response based on context it is used +func (m *SetBillingAccountDefaultPaymentMethodResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SetBillingAccountDefaultPaymentMethodResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SetBillingAccountDefaultPaymentMethodResponse) UnmarshalBinary(b []byte) error { + var res SetBillingAccountDefaultPaymentMethodResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/status.go b/internal/models/status.go index 51b3994..8af07b7 100644 --- a/internal/models/status.go +++ b/internal/models/status.go @@ -23,7 +23,7 @@ type Status struct { Code int32 `json:"code,omitempty"` // details - Details []*Any `json:"details"` + Details []*ProtobufAny `json:"details"` // message Message string `json:"message,omitempty"` diff --git a/internal/models/stripe_customer.go b/internal/models/stripe_customer.go new file mode 100644 index 0000000..172c6ee --- /dev/null +++ b/internal/models/stripe_customer.go @@ -0,0 +1,118 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// StripeCustomer stripe customer +// +// swagger:model StripeCustomer +type StripeCustomer struct { + + // balance + Balance *Decimal `json:"balance,omitempty"` + + // email + Email string `json:"email,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // name + Name string `json:"name,omitempty"` +} + +// Validate validates this stripe customer +func (m *StripeCustomer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBalance(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StripeCustomer) validateBalance(formats strfmt.Registry) error { + if swag.IsZero(m.Balance) { // not required + return nil + } + + if m.Balance != nil { + if err := m.Balance.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("balance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("balance") + } + return err + } + } + + return nil +} + +// ContextValidate validate this stripe customer based on the context it is used +func (m *StripeCustomer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBalance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StripeCustomer) contextValidateBalance(ctx context.Context, formats strfmt.Registry) error { + + if m.Balance != nil { + + if swag.IsZero(m.Balance) { // not required + return nil + } + + if err := m.Balance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("balance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("balance") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StripeCustomer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StripeCustomer) UnmarshalBinary(b []byte) error { + var res StripeCustomer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/sync_response.go b/internal/models/sync_response.go new file mode 100644 index 0000000..5dca116 --- /dev/null +++ b/internal/models/sync_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 + +// SyncResponse sync response +// +// swagger:model SyncResponse +type SyncResponse interface{} diff --git a/internal/models/task.go b/internal/models/task.go new file mode 100644 index 0000000..b0933a5 --- /dev/null +++ b/internal/models/task.go @@ -0,0 +1,56 @@ +// 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" +) + +// Task task +// +// swagger:model Task +type Task struct { + + // percent complete + PercentComplete int32 `json:"percentComplete,omitempty"` + + // project Id + ProjectID string `json:"projectId,omitempty"` + + // task name + TaskName string `json:"taskName,omitempty"` +} + +// Validate validates this task +func (m *Task) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this task based on context it is used +func (m *Task) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Task) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Task) UnmarshalBinary(b []byte) error { + var res Task + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/tax_id.go b/internal/models/tax_id.go new file mode 100644 index 0000000..2f99d17 --- /dev/null +++ b/internal/models/tax_id.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TaxID tax Id +// +// swagger:model TaxId +type TaxID struct { + + // id + // Read Only: true + ID string `json:"id,omitempty"` + + // type + Type string `json:"type,omitempty"` + + // value + Value string `json:"value,omitempty"` +} + +// Validate validates this tax Id +func (m *TaxID) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this tax Id based on the context it is used +func (m *TaxID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TaxID) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TaxID) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TaxID) UnmarshalBinary(b []byte) error { + var res TaxID + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/unit.go b/internal/models/unit.go new file mode 100644 index 0000000..046dfcd --- /dev/null +++ b/internal/models/unit.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" +) + +// Unit unit +// +// swagger:model Unit +type Unit string + +func NewUnit(value Unit) *Unit { + return &value +} + +// Pointer returns a pointer to a freshly-allocated Unit. +func (m Unit) Pointer() *Unit { + return &m +} + +const ( + + // UnitUNITUNKNOWN captures enum value "UNIT_UNKNOWN" + UnitUNITUNKNOWN Unit = "UNIT_UNKNOWN" + + // UnitUNITGIBHOUR captures enum value "UNIT_GIB_HOUR" + UnitUNITGIBHOUR Unit = "UNIT_GIB_HOUR" + + // UnitUNITHOUR captures enum value "UNIT_HOUR" + UnitUNITHOUR Unit = "UNIT_HOUR" +) + +// for schema +var unitEnum []interface{} + +func init() { + var res []Unit + if err := json.Unmarshal([]byte(`["UNIT_UNKNOWN","UNIT_GIB_HOUR","UNIT_HOUR"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + unitEnum = append(unitEnum, v) + } +} + +func (m Unit) validateUnitEnum(path, location string, value Unit) error { + if err := validate.EnumCase(path, location, value, unitEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this unit +func (m Unit) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateUnitEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this unit based on context it is used +func (m Unit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/update_billing_account_body.go b/internal/models/update_billing_account_body.go new file mode 100644 index 0000000..8c8bba4 --- /dev/null +++ b/internal/models/update_billing_account_body.go @@ -0,0 +1,431 @@ +// 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" + "github.com/go-openapi/validate" +) + +// UpdateBillingAccountBody update billing account body +// +// swagger:model UpdateBillingAccountBody +type UpdateBillingAccountBody struct { + + // billing account + BillingAccount *UpdateBillingAccountBodyBillingAccount `json:"billingAccount,omitempty"` + + // update mask + // Required: true + UpdateMask *string `json:"updateMask"` +} + +// Validate validates this update billing account body +func (m *UpdateBillingAccountBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillingAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdateMask(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateBillingAccountBody) validateBillingAccount(formats strfmt.Registry) error { + if swag.IsZero(m.BillingAccount) { // not required + return nil + } + + if m.BillingAccount != nil { + if err := m.BillingAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount") + } + return err + } + } + + return nil +} + +func (m *UpdateBillingAccountBody) validateUpdateMask(formats strfmt.Registry) error { + + if err := validate.Required("updateMask", "body", m.UpdateMask); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this update billing account body based on the context it is used +func (m *UpdateBillingAccountBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateBillingAccountBody) contextValidateBillingAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingAccount != nil { + + if swag.IsZero(m.BillingAccount) { // not required + return nil + } + + if err := m.BillingAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateBillingAccountBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateBillingAccountBody) UnmarshalBinary(b []byte) error { + var res UpdateBillingAccountBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// UpdateBillingAccountBodyBillingAccount update billing account body billing account +// +// swagger:model UpdateBillingAccountBodyBillingAccount +type UpdateBillingAccountBodyBillingAccount struct { + + // billing threshold + // Read Only: true + BillingThreshold *Decimal `json:"billingThreshold,omitempty"` + + // blocked + // Read Only: true + Blocked *bool `json:"blocked,omitempty"` + + // create by + // Read Only: true + CreateBy string `json:"createBy,omitempty"` + + // create time + // Read Only: true + // Format: date-time + CreateTime strfmt.DateTime `json:"createTime,omitempty"` + + // demand enabled + // Read Only: true + DemandEnabled *bool `json:"demandEnabled,omitempty"` + + // display name + DisplayName string `json:"displayName,omitempty"` + + // invoice time + // Read Only: true + // Format: date-time + InvoiceTime strfmt.DateTime `json:"invoiceTime,omitempty"` + + // monthly spend + MonthlySpend string `json:"monthlySpend,omitempty"` + + // stripe ref + StripeRef string `json:"stripeRef,omitempty"` + + // supply enabled + // Read Only: true + SupplyEnabled *bool `json:"supplyEnabled,omitempty"` + + // tax ids + TaxIds []*TaxID `json:"taxIds"` +} + +// Validate validates this update billing account body billing account +func (m *UpdateBillingAccountBodyBillingAccount) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBillingThreshold(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInvoiceTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTaxIds(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) validateBillingThreshold(formats strfmt.Registry) error { + if swag.IsZero(m.BillingThreshold) { // not required + return nil + } + + if m.BillingThreshold != nil { + if err := m.BillingThreshold.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount" + "." + "billingThreshold") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount" + "." + "billingThreshold") + } + return err + } + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) validateCreateTime(formats strfmt.Registry) error { + if swag.IsZero(m.CreateTime) { // not required + return nil + } + + if err := validate.FormatOf("billingAccount"+"."+"createTime", "body", "date-time", m.CreateTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) validateInvoiceTime(formats strfmt.Registry) error { + if swag.IsZero(m.InvoiceTime) { // not required + return nil + } + + if err := validate.FormatOf("billingAccount"+"."+"invoiceTime", "body", "date-time", m.InvoiceTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) validateTaxIds(formats strfmt.Registry) error { + if swag.IsZero(m.TaxIds) { // not required + return nil + } + + for i := 0; i < len(m.TaxIds); i++ { + if swag.IsZero(m.TaxIds[i]) { // not required + continue + } + + if m.TaxIds[i] != nil { + if err := m.TaxIds[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount" + "." + "taxIds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount" + "." + "taxIds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this update billing account body billing account based on the context it is used +func (m *UpdateBillingAccountBodyBillingAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBillingThreshold(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateBlocked(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCreateBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCreateTime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDemandEnabled(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInvoiceTime(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSupplyEnabled(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaxIds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateBillingThreshold(ctx context.Context, formats strfmt.Registry) error { + + if m.BillingThreshold != nil { + + if swag.IsZero(m.BillingThreshold) { // not required + return nil + } + + if err := m.BillingThreshold.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount" + "." + "billingThreshold") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount" + "." + "billingThreshold") + } + return err + } + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateBlocked(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "billingAccount"+"."+"blocked", "body", m.Blocked); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateCreateBy(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "billingAccount"+"."+"createBy", "body", string(m.CreateBy)); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateCreateTime(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "billingAccount"+"."+"createTime", "body", strfmt.DateTime(m.CreateTime)); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateDemandEnabled(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "billingAccount"+"."+"demandEnabled", "body", m.DemandEnabled); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateInvoiceTime(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "billingAccount"+"."+"invoiceTime", "body", strfmt.DateTime(m.InvoiceTime)); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateSupplyEnabled(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "billingAccount"+"."+"supplyEnabled", "body", m.SupplyEnabled); err != nil { + return err + } + + return nil +} + +func (m *UpdateBillingAccountBodyBillingAccount) contextValidateTaxIds(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TaxIds); i++ { + + if m.TaxIds[i] != nil { + + if swag.IsZero(m.TaxIds[i]) { // not required + return nil + } + + if err := m.TaxIds[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("billingAccount" + "." + "taxIds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("billingAccount" + "." + "taxIds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateBillingAccountBodyBillingAccount) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateBillingAccountBodyBillingAccount) UnmarshalBinary(b []byte) error { + var res UpdateBillingAccountBodyBillingAccount + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/update_host_response.go b/internal/models/update_host_response.go new file mode 100644 index 0000000..4430357 --- /dev/null +++ b/internal/models/update_host_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 + +// UpdateHostResponse update host response +// +// swagger:model UpdateHostResponse +type UpdateHostResponse interface{} diff --git a/internal/models/update_image_response.go b/internal/models/update_image_response.go new file mode 100644 index 0000000..b1346c4 --- /dev/null +++ b/internal/models/update_image_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 + +// UpdateImageResponse update image response +// +// swagger:model UpdateImageResponse +type UpdateImageResponse interface{} diff --git a/internal/models/update_net_response.go b/internal/models/update_net_response.go new file mode 100644 index 0000000..478eb13 --- /dev/null +++ b/internal/models/update_net_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 + +// UpdateNetResponse update net response +// +// swagger:model UpdateNetResponse +type UpdateNetResponse interface{} diff --git a/internal/models/update_vm_metadata_body.go b/internal/models/update_vm_metadata_body.go new file mode 100644 index 0000000..9f4b9b9 --- /dev/null +++ b/internal/models/update_vm_metadata_body.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UpdateVMMetadataBody update VM metadata body +// +// swagger:model UpdateVMMetadataBody +type UpdateVMMetadataBody struct { + + // merge + Merge bool `json:"merge,omitempty"` + + // metadata + Metadata map[string]string `json:"metadata,omitempty"` +} + +// Validate validates this update VM metadata body +func (m *UpdateVMMetadataBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this update VM metadata body based on context it is used +func (m *UpdateVMMetadataBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateVMMetadataBody) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateVMMetadataBody) UnmarshalBinary(b []byte) error { + var res UpdateVMMetadataBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/update_vm_metadata_response.go b/internal/models/update_vm_metadata_response.go new file mode 100644 index 0000000..75cb2b8 --- /dev/null +++ b/internal/models/update_vm_metadata_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" +) + +// UpdateVMMetadataResponse update VM metadata response +// +// swagger:model UpdateVMMetadataResponse +type UpdateVMMetadataResponse struct { + + // metadata + Metadata map[string]string `json:"metadata,omitempty"` +} + +// Validate validates this update VM metadata response +func (m *UpdateVMMetadataResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this update VM metadata response based on context it is used +func (m *UpdateVMMetadataResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateVMMetadataResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateVMMetadataResponse) UnmarshalBinary(b []byte) error { + var res UpdateVMMetadataResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/update_vm_response.go b/internal/models/update_vm_response.go new file mode 100644 index 0000000..56929f0 --- /dev/null +++ b/internal/models/update_vm_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 + +// UpdateVMResponse update VM response +// +// swagger:model UpdateVMResponse +type UpdateVMResponse interface{} diff --git a/internal/models/v1_data_center.go b/internal/models/v1_data_center.go new file mode 100644 index 0000000..4565c07 --- /dev/null +++ b/internal/models/v1_data_center.go @@ -0,0 +1,187 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V1DataCenter v1 data center +// +// swagger:model v1.DataCenter +type V1DataCenter struct { + + // create by + // Read Only: true + CreateBy string `json:"createBy,omitempty"` + + // id + // Required: true + ID *string `json:"id"` + + // lng lat + LngLat *Point `json:"lngLat,omitempty"` + + // one frontend Id + // Required: true + OneFrontendID *string `json:"oneFrontendId"` + + // region Id + RegionID string `json:"regionId,omitempty"` + + // renewable energy + RenewableEnergy bool `json:"renewableEnergy,omitempty"` + + // s3 endpoint + // Required: true + S3Endpoint *string `json:"s3Endpoint"` + + // supplier name + SupplierName string `json:"supplierName,omitempty"` +} + +// Validate validates this v1 data center +func (m *V1DataCenter) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLngLat(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOneFrontendID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateS3Endpoint(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1DataCenter) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *V1DataCenter) validateLngLat(formats strfmt.Registry) error { + if swag.IsZero(m.LngLat) { // not required + return nil + } + + if m.LngLat != nil { + if err := m.LngLat.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("lngLat") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("lngLat") + } + return err + } + } + + return nil +} + +func (m *V1DataCenter) validateOneFrontendID(formats strfmt.Registry) error { + + if err := validate.Required("oneFrontendId", "body", m.OneFrontendID); err != nil { + return err + } + + return nil +} + +func (m *V1DataCenter) validateS3Endpoint(formats strfmt.Registry) error { + + if err := validate.Required("s3Endpoint", "body", m.S3Endpoint); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this v1 data center based on the context it is used +func (m *V1DataCenter) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreateBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLngLat(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V1DataCenter) contextValidateCreateBy(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "createBy", "body", string(m.CreateBy)); err != nil { + return err + } + + return nil +} + +func (m *V1DataCenter) contextValidateLngLat(ctx context.Context, formats strfmt.Registry) error { + + if m.LngLat != nil { + + if swag.IsZero(m.LngLat) { // not required + return nil + } + + if err := m.LngLat.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("lngLat") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("lngLat") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V1DataCenter) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V1DataCenter) UnmarshalBinary(b []byte) error { + var res V1DataCenter + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/v1_v_router_size.go b/internal/models/v1_v_router_size.go new file mode 100644 index 0000000..70429f3 --- /dev/null +++ b/internal/models/v1_v_router_size.go @@ -0,0 +1,84 @@ +// 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" +) + +// V1VRouterSize v1 v router size +// +// swagger:model v1.VRouterSize +type V1VRouterSize string + +func NewV1VRouterSize(value V1VRouterSize) *V1VRouterSize { + return &value +} + +// Pointer returns a pointer to a freshly-allocated V1VRouterSize. +func (m V1VRouterSize) Pointer() *V1VRouterSize { + return &m +} + +const ( + + // V1VRouterSizeVROUTERINSTANCEUNKNOWN captures enum value "VROUTER_INSTANCE_UNKNOWN" + V1VRouterSizeVROUTERINSTANCEUNKNOWN V1VRouterSize = "VROUTER_INSTANCE_UNKNOWN" + + // V1VRouterSizeVROUTERINSTANCESMALL captures enum value "VROUTER_INSTANCE_SMALL" + V1VRouterSizeVROUTERINSTANCESMALL V1VRouterSize = "VROUTER_INSTANCE_SMALL" + + // V1VRouterSizeVROUTERINSTANCEMEDIUM captures enum value "VROUTER_INSTANCE_MEDIUM" + V1VRouterSizeVROUTERINSTANCEMEDIUM V1VRouterSize = "VROUTER_INSTANCE_MEDIUM" + + // V1VRouterSizeVROUTERINSTANCELARGE captures enum value "VROUTER_INSTANCE_LARGE" + V1VRouterSizeVROUTERINSTANCELARGE V1VRouterSize = "VROUTER_INSTANCE_LARGE" +) + +// for schema +var v1VRouterSizeEnum []interface{} + +func init() { + var res []V1VRouterSize + if err := json.Unmarshal([]byte(`["VROUTER_INSTANCE_UNKNOWN","VROUTER_INSTANCE_SMALL","VROUTER_INSTANCE_MEDIUM","VROUTER_INSTANCE_LARGE"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + v1VRouterSizeEnum = append(v1VRouterSizeEnum, v) + } +} + +func (m V1VRouterSize) validateV1VRouterSizeEnum(path, location string, value V1VRouterSize) error { + if err := validate.EnumCase(path, location, value, v1VRouterSizeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this v1 v router size +func (m V1VRouterSize) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateV1VRouterSizeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this v1 v router size based on context it is used +func (m V1VRouterSize) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/vm.go b/internal/models/vm.go index aab78d3..b449547 100644 --- a/internal/models/vm.go +++ b/internal/models/vm.go @@ -20,9 +20,6 @@ import ( // swagger:model VM type VM struct { - // active state - ActiveState string `json:"activeState,omitempty"` - // boot disk BootDisk *Disk `json:"bootDisk,omitempty"` @@ -36,6 +33,11 @@ type VM struct { // Read Only: true CreateBy string `json:"createBy,omitempty"` + // create time + // Read Only: true + // Format: date-time + CreateTime strfmt.DateTime `json:"createTime,omitempty"` + // datacenter Id // Read Only: true DatacenterID string `json:"datacenterId,omitempty"` @@ -46,6 +48,9 @@ type VM struct { // gpu model GpuModel string `json:"gpuModel,omitempty"` + // gpu model Id + GpuModelID string `json:"gpuModelId,omitempty"` + // gpu quantity GpuQuantity int64 `json:"gpuQuantity,omitempty"` @@ -58,15 +63,9 @@ type VM struct { // image name ImageName string `json:"imageName,omitempty"` - // init state - InitState string `json:"initState,omitempty"` - // internal Ip address InternalIPAddress string `json:"internalIpAddress,omitempty"` - // lcm state - LcmState string `json:"lcmState,omitempty"` - // machine type MachineType string `json:"machineType,omitempty"` @@ -79,9 +78,6 @@ type VM struct { // nics Nics []*VMNIC `json:"nics"` - // one state - OneState string `json:"oneState,omitempty"` - // price hr PriceHr float32 `json:"priceHr,omitempty"` @@ -117,6 +113,9 @@ type VM struct { // short state ShortState string `json:"shortState,omitempty"` + // state + State *VMState `json:"state,omitempty"` + // storage disks StorageDisks []*Disk `json:"storageDisks"` @@ -132,6 +131,10 @@ func (m *VM) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCreateTime(formats); err != nil { + res = append(res, err) + } + if err := m.validateNics(formats); err != nil { res = append(res, err) } @@ -140,6 +143,10 @@ func (m *VM) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + if err := m.validateStorageDisks(formats); err != nil { res = append(res, err) } @@ -169,6 +176,18 @@ func (m *VM) validateBootDisk(formats strfmt.Registry) error { return nil } +func (m *VM) validateCreateTime(formats strfmt.Registry) error { + if swag.IsZero(m.CreateTime) { // not required + return nil + } + + if err := validate.FormatOf("createTime", "body", "date-time", m.CreateTime.String(), formats); err != nil { + return err + } + + return nil +} + func (m *VM) validateNics(formats strfmt.Registry) error { if swag.IsZero(m.Nics) { // not required return nil @@ -221,6 +240,25 @@ func (m *VM) validateRules(formats strfmt.Registry) error { return nil } +func (m *VM) validateState(formats strfmt.Registry) error { + if swag.IsZero(m.State) { // not required + return nil + } + + if m.State != nil { + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + func (m *VM) validateStorageDisks(formats strfmt.Registry) error { if swag.IsZero(m.StorageDisks) { // not required return nil @@ -259,6 +297,10 @@ func (m *VM) ContextValidate(ctx context.Context, formats strfmt.Registry) error res = append(res, err) } + if err := m.contextValidateCreateTime(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateDatacenterID(ctx, formats); err != nil { res = append(res, err) } @@ -279,6 +321,10 @@ func (m *VM) ContextValidate(ctx context.Context, formats strfmt.Registry) error res = append(res, err) } + if err := m.contextValidateState(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateStorageDisks(ctx, formats); err != nil { res = append(res, err) } @@ -319,6 +365,15 @@ func (m *VM) contextValidateCreateBy(ctx context.Context, formats strfmt.Registr return nil } +func (m *VM) contextValidateCreateTime(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "createTime", "body", strfmt.DateTime(m.CreateTime)); err != nil { + return err + } + + return nil +} + func (m *VM) contextValidateDatacenterID(ctx context.Context, formats strfmt.Registry) error { if err := validate.ReadOnly(ctx, "datacenterId", "body", string(m.DatacenterID)); err != nil { @@ -396,6 +451,27 @@ func (m *VM) contextValidateRules(ctx context.Context, formats strfmt.Registry) return nil } +func (m *VM) contextValidateState(ctx context.Context, formats strfmt.Registry) error { + + if m.State != nil { + + if swag.IsZero(m.State) { // not required + return nil + } + + if err := m.State.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("state") + } + return err + } + } + + return nil +} + func (m *VM) contextValidateStorageDisks(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.StorageDisks); i++ { diff --git a/internal/models/vm_data_center_v_router_size.go b/internal/models/vm_data_center_v_router_size.go new file mode 100644 index 0000000..982550d --- /dev/null +++ b/internal/models/vm_data_center_v_router_size.go @@ -0,0 +1,84 @@ +// 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" +) + +// VMDataCenterVRouterSize VM data center v router size +// +// swagger:model VMDataCenter.VRouterSize +type VMDataCenterVRouterSize string + +func NewVMDataCenterVRouterSize(value VMDataCenterVRouterSize) *VMDataCenterVRouterSize { + return &value +} + +// Pointer returns a pointer to a freshly-allocated VMDataCenterVRouterSize. +func (m VMDataCenterVRouterSize) Pointer() *VMDataCenterVRouterSize { + return &m +} + +const ( + + // VMDataCenterVRouterSizeVROUTERINSTANCEUNKNOWN captures enum value "VROUTER_INSTANCE_UNKNOWN" + VMDataCenterVRouterSizeVROUTERINSTANCEUNKNOWN VMDataCenterVRouterSize = "VROUTER_INSTANCE_UNKNOWN" + + // VMDataCenterVRouterSizeVROUTERINSTANCESMALL captures enum value "VROUTER_INSTANCE_SMALL" + VMDataCenterVRouterSizeVROUTERINSTANCESMALL VMDataCenterVRouterSize = "VROUTER_INSTANCE_SMALL" + + // VMDataCenterVRouterSizeVROUTERINSTANCEMEDIUM captures enum value "VROUTER_INSTANCE_MEDIUM" + VMDataCenterVRouterSizeVROUTERINSTANCEMEDIUM VMDataCenterVRouterSize = "VROUTER_INSTANCE_MEDIUM" + + // VMDataCenterVRouterSizeVROUTERINSTANCELARGE captures enum value "VROUTER_INSTANCE_LARGE" + VMDataCenterVRouterSizeVROUTERINSTANCELARGE VMDataCenterVRouterSize = "VROUTER_INSTANCE_LARGE" +) + +// for schema +var vmDataCenterVRouterSizeEnum []interface{} + +func init() { + var res []VMDataCenterVRouterSize + if err := json.Unmarshal([]byte(`["VROUTER_INSTANCE_UNKNOWN","VROUTER_INSTANCE_SMALL","VROUTER_INSTANCE_MEDIUM","VROUTER_INSTANCE_LARGE"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + vmDataCenterVRouterSizeEnum = append(vmDataCenterVRouterSizeEnum, v) + } +} + +func (m VMDataCenterVRouterSize) validateVMDataCenterVRouterSizeEnum(path, location string, value VMDataCenterVRouterSize) error { + if err := validate.EnumCase(path, location, value, vmDataCenterVRouterSizeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this VM data center v router size +func (m VMDataCenterVRouterSize) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateVMDataCenterVRouterSizeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this VM data center v router size based on context it is used +func (m VMDataCenterVRouterSize) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/models/vm_machine_type.go b/internal/models/vm_machine_type.go new file mode 100644 index 0000000..7506d29 --- /dev/null +++ b/internal/models/vm_machine_type.go @@ -0,0 +1,610 @@ +// 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/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// VMMachineType VM machine type +// +// swagger:model VMMachineType +type VMMachineType struct { + + // cpu model + // Required: true + CPUModel *string `json:"cpuModel"` + + // data center Id + // Required: true + DataCenterID *string `json:"dataCenterId"` + + // gpu model + // Required: true + GpuModel *string `json:"gpuModel"` + + // gpu model Id + // Required: true + GpuModelID *string `json:"gpuModelId"` + + // gpu price hr + // Required: true + GpuPriceHr *Decimal `json:"gpuPriceHr"` + + // ipv4 price hr + // Required: true + IPV4PriceHr *Decimal `json:"ipv4PriceHr"` + + // machine type + // Required: true + MachineType *string `json:"machineType"` + + // max gpu free + // Required: true + MaxGpuFree *int32 `json:"maxGpuFree"` + + // max memory gib free + // Required: true + MaxMemoryGibFree *int32 `json:"maxMemoryGibFree"` + + // max storage gib free + // Required: true + MaxStorageGibFree *int32 `json:"maxStorageGibFree"` + + // max vcpu free + // Required: true + MaxVcpuFree *int32 `json:"maxVcpuFree"` + + // max vcpu per gpu + // Required: true + MaxVcpuPerGpu *float64 `json:"maxVcpuPerGpu"` + + // max vcpu per memory gib + // Required: true + MaxVcpuPerMemoryGib *float64 `json:"maxVcpuPerMemoryGib"` + + // memory gib price hr + // Required: true + MemoryGibPriceHr *Decimal `json:"memoryGibPriceHr"` + + // min storage gib price hr + // Required: true + MinStorageGibPriceHr *Decimal `json:"minStorageGibPriceHr"` + + // min vcpu per gpu + // Required: true + MinVcpuPerGpu *float64 `json:"minVcpuPerGpu"` + + // min vcpu per memory gib + // Required: true + MinVcpuPerMemoryGib *float64 `json:"minVcpuPerMemoryGib"` + + // renewable energy + // Required: true + RenewableEnergy *bool `json:"renewableEnergy"` + + // total gpu free + // Required: true + TotalGpuFree *int32 `json:"totalGpuFree"` + + // total memory gib free + // Required: true + TotalMemoryGibFree *int32 `json:"totalMemoryGibFree"` + + // total storage gib free + // Required: true + TotalStorageGibFree *int32 `json:"totalStorageGibFree"` + + // total vcpu free + // Required: true + TotalVcpuFree *int32 `json:"totalVcpuFree"` + + // vcpu price hr + // Required: true + VcpuPriceHr *Decimal `json:"vcpuPriceHr"` +} + +// Validate validates this VM machine type +func (m *VMMachineType) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCPUModel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDataCenterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuModelID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPV4PriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMachineType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxGpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxMemoryGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxStorageGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuPerGpu(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxVcpuPerMemoryGib(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemoryGibPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinStorageGibPriceHr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinVcpuPerGpu(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinVcpuPerMemoryGib(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRenewableEnergy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalGpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalMemoryGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalStorageGibFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotalVcpuFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVcpuPriceHr(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VMMachineType) validateCPUModel(formats strfmt.Registry) error { + + if err := validate.Required("cpuModel", "body", m.CPUModel); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateDataCenterID(formats strfmt.Registry) error { + + if err := validate.Required("dataCenterId", "body", m.DataCenterID); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateGpuModel(formats strfmt.Registry) error { + + if err := validate.Required("gpuModel", "body", m.GpuModel); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateGpuModelID(formats strfmt.Registry) error { + + if err := validate.Required("gpuModelId", "body", m.GpuModelID); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateGpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("gpuPriceHr", "body", m.GpuPriceHr); err != nil { + return err + } + + if m.GpuPriceHr != nil { + if err := m.GpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) validateIPV4PriceHr(formats strfmt.Registry) error { + + if err := validate.Required("ipv4PriceHr", "body", m.IPV4PriceHr); err != nil { + return err + } + + if m.IPV4PriceHr != nil { + if err := m.IPV4PriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipv4PriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipv4PriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) validateMachineType(formats strfmt.Registry) error { + + if err := validate.Required("machineType", "body", m.MachineType); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMaxGpuFree(formats strfmt.Registry) error { + + if err := validate.Required("maxGpuFree", "body", m.MaxGpuFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMaxMemoryGibFree(formats strfmt.Registry) error { + + if err := validate.Required("maxMemoryGibFree", "body", m.MaxMemoryGibFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMaxStorageGibFree(formats strfmt.Registry) error { + + if err := validate.Required("maxStorageGibFree", "body", m.MaxStorageGibFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMaxVcpuFree(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuFree", "body", m.MaxVcpuFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMaxVcpuPerGpu(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuPerGpu", "body", m.MaxVcpuPerGpu); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMaxVcpuPerMemoryGib(formats strfmt.Registry) error { + + if err := validate.Required("maxVcpuPerMemoryGib", "body", m.MaxVcpuPerMemoryGib); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMemoryGibPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("memoryGibPriceHr", "body", m.MemoryGibPriceHr); err != nil { + return err + } + + if m.MemoryGibPriceHr != nil { + if err := m.MemoryGibPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) validateMinStorageGibPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("minStorageGibPriceHr", "body", m.MinStorageGibPriceHr); err != nil { + return err + } + + if m.MinStorageGibPriceHr != nil { + if err := m.MinStorageGibPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minStorageGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minStorageGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) validateMinVcpuPerGpu(formats strfmt.Registry) error { + + if err := validate.Required("minVcpuPerGpu", "body", m.MinVcpuPerGpu); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateMinVcpuPerMemoryGib(formats strfmt.Registry) error { + + if err := validate.Required("minVcpuPerMemoryGib", "body", m.MinVcpuPerMemoryGib); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateRenewableEnergy(formats strfmt.Registry) error { + + if err := validate.Required("renewableEnergy", "body", m.RenewableEnergy); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateTotalGpuFree(formats strfmt.Registry) error { + + if err := validate.Required("totalGpuFree", "body", m.TotalGpuFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateTotalMemoryGibFree(formats strfmt.Registry) error { + + if err := validate.Required("totalMemoryGibFree", "body", m.TotalMemoryGibFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateTotalStorageGibFree(formats strfmt.Registry) error { + + if err := validate.Required("totalStorageGibFree", "body", m.TotalStorageGibFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateTotalVcpuFree(formats strfmt.Registry) error { + + if err := validate.Required("totalVcpuFree", "body", m.TotalVcpuFree); err != nil { + return err + } + + return nil +} + +func (m *VMMachineType) validateVcpuPriceHr(formats strfmt.Registry) error { + + if err := validate.Required("vcpuPriceHr", "body", m.VcpuPriceHr); err != nil { + return err + } + + if m.VcpuPriceHr != nil { + if err := m.VcpuPriceHr.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vcpuPriceHr") + } + return err + } + } + + return nil +} + +// ContextValidate validate this VM machine type based on the context it is used +func (m *VMMachineType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPV4PriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemoryGibPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMinStorageGibPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVcpuPriceHr(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VMMachineType) contextValidateGpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.GpuPriceHr != nil { + + if err := m.GpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gpuPriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) contextValidateIPV4PriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.IPV4PriceHr != nil { + + if err := m.IPV4PriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipv4PriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipv4PriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) contextValidateMemoryGibPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MemoryGibPriceHr != nil { + + if err := m.MemoryGibPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memoryGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memoryGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) contextValidateMinStorageGibPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.MinStorageGibPriceHr != nil { + + if err := m.MinStorageGibPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("minStorageGibPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("minStorageGibPriceHr") + } + return err + } + } + + return nil +} + +func (m *VMMachineType) contextValidateVcpuPriceHr(ctx context.Context, formats strfmt.Registry) error { + + if m.VcpuPriceHr != nil { + + if err := m.VcpuPriceHr.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vcpuPriceHr") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vcpuPriceHr") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VMMachineType) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VMMachineType) UnmarshalBinary(b []byte) error { + var res VMMachineType + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/internal/models/vm_state.go b/internal/models/vm_state.go new file mode 100644 index 0000000..37f1025 --- /dev/null +++ b/internal/models/vm_state.go @@ -0,0 +1,129 @@ +// 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" +) + +// VMState Vm state +// +// swagger:model VmState +type VMState string + +func NewVMState(value VMState) *VMState { + return &value +} + +// Pointer returns a pointer to a freshly-allocated VMState. +func (m VMState) Pointer() *VMState { + return &m +} + +const ( + + // VMStateCLONING captures enum value "CLONING" + VMStateCLONING VMState = "CLONING" + + // VMStateCREATINGSNAPSHOT captures enum value "CREATING_SNAPSHOT" + VMStateCREATINGSNAPSHOT VMState = "CREATING_SNAPSHOT" + + // VMStateDELETED captures enum value "DELETED" + VMStateDELETED VMState = "DELETED" + + // VMStateDELETING captures enum value "DELETING" + VMStateDELETING VMState = "DELETING" + + // VMStateDELETINGSNAPSHOT captures enum value "DELETING_SNAPSHOT" + VMStateDELETINGSNAPSHOT VMState = "DELETING_SNAPSHOT" + + // VMStateFAILED captures enum value "FAILED" + VMStateFAILED VMState = "FAILED" + + // VMStateHOTPLUGGING captures enum value "HOTPLUGGING" + VMStateHOTPLUGGING VMState = "HOTPLUGGING" + + // VMStateMIGRATING captures enum value "MIGRATING" + VMStateMIGRATING VMState = "MIGRATING" + + // VMStateRECREATING captures enum value "RECREATING" + VMStateRECREATING VMState = "RECREATING" + + // VMStateREVERTINGSNAPSHOT captures enum value "REVERTING_SNAPSHOT" + VMStateREVERTINGSNAPSHOT VMState = "REVERTING_SNAPSHOT" + + // VMStateRESIZING captures enum value "RESIZING" + VMStateRESIZING VMState = "RESIZING" + + // VMStateRESIZINGDISK captures enum value "RESIZING_DISK" + VMStateRESIZINGDISK VMState = "RESIZING_DISK" + + // VMStateACTIVE captures enum value "ACTIVE" + VMStateACTIVE VMState = "ACTIVE" + + // VMStateSTARTING captures enum value "STARTING" + VMStateSTARTING VMState = "STARTING" + + // VMStateSTOPPED captures enum value "STOPPED" + VMStateSTOPPED VMState = "STOPPED" + + // VMStateSTOPPING captures enum value "STOPPING" + VMStateSTOPPING VMState = "STOPPING" + + // VMStateSUSPENDED captures enum value "SUSPENDED" + VMStateSUSPENDED VMState = "SUSPENDED" + + // VMStateSUSPENDING captures enum value "SUSPENDING" + VMStateSUSPENDING VMState = "SUSPENDING" + + // VMStateUNKNOWN captures enum value "UNKNOWN" + VMStateUNKNOWN VMState = "UNKNOWN" +) + +// for schema +var vmStateEnum []interface{} + +func init() { + var res []VMState + if err := json.Unmarshal([]byte(`["CLONING","CREATING_SNAPSHOT","DELETED","DELETING","DELETING_SNAPSHOT","FAILED","HOTPLUGGING","MIGRATING","RECREATING","REVERTING_SNAPSHOT","RESIZING","RESIZING_DISK","ACTIVE","STARTING","STOPPED","STOPPING","SUSPENDED","SUSPENDING","UNKNOWN"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + vmStateEnum = append(vmStateEnum, v) + } +} + +func (m VMState) validateVMStateEnum(path, location string, value VMState) error { + if err := validate.EnumCase(path, location, value, vmStateEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this Vm state +func (m VMState) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateVMStateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this Vm state based on context it is used +func (m VMState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/internal/provider/network_data_source.go b/internal/provider/network_data_source.go index 6e0df76..4a513ae 100644 --- a/internal/provider/network_data_source.go +++ b/internal/provider/network_data_source.go @@ -106,12 +106,12 @@ func (d *NetworkDataSource) Read(ctx context.Context, req datasource.ReadRequest return } - state.Id = types.StringValue(res.Payload.Network.ID) - state.DataCenterId = types.StringValue(res.Payload.Network.DataCenterID) - state.IPRange = types.StringValue(res.Payload.Network.IPRange) - state.Gateway = types.StringValue(res.Payload.Network.Gateway) - state.ExternalIPAddress = types.StringValue(res.Payload.Network.ExternalIPAddress) - state.InternalIPAddress = types.StringValue(res.Payload.Network.InternalIPAddress) + state.Id = types.StringValue(*res.Payload.Network.ID) + state.DataCenterId = types.StringValue(*res.Payload.Network.DataCenterID) + state.IPRange = types.StringValue(*res.Payload.Network.IPRange) + state.Gateway = types.StringValue(*res.Payload.Network.Gateway) + state.ExternalIPAddress = types.StringValue(*res.Payload.Network.ExternalIPAddress) + state.InternalIPAddress = types.StringValue(*res.Payload.Network.InternalIPAddress) // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) diff --git a/internal/provider/network_resource.go b/internal/provider/network_resource.go index b620936..6772c1c 100644 --- a/internal/provider/network_resource.go +++ b/internal/provider/network_resource.go @@ -127,8 +127,8 @@ func waitForNetworkAvailable(ctx context.Context, projectID string, networkID st return nil, "", err } - tflog.Trace(ctx, fmt.Sprintf("pending network %s in project %s state: %s", networkID, projectID, res.Payload.Network.ShortState)) - return res, res.Payload.Network.ShortState, nil + tflog.Trace(ctx, fmt.Sprintf("pending network %s in project %s state: %s", networkID, projectID, *res.Payload.Network.ShortState)) + return res, *res.Payload.Network.ShortState, nil } tflog.Debug(ctx, fmt.Sprintf("waiting for network %s in project %s ", networkID, projectID)) @@ -145,7 +145,7 @@ func waitForNetworkAvailable(ctx context.Context, projectID string, networkID st if res, err := stateConf.WaitForState(ctx); err != nil { return nil, fmt.Errorf("error waiting for network %s in project %s to become available: %w", networkID, projectID, err) } else if vm, ok := res.(*networks.GetNetworkOK); ok { - tflog.Trace(ctx, fmt.Sprintf("completed waiting for network %s in project %s (%s)", networkID, projectID, vm.Payload.Network.ShortState)) + tflog.Trace(ctx, fmt.Sprintf("completed waiting for network %s in project %s (%s)", networkID, projectID, *vm.Payload.Network.ShortState)) return vm, nil } @@ -166,13 +166,13 @@ func waitForNetworkStop(ctx context.Context, projectID string, networkID string, tflog.Error(ctx, fmt.Sprintf("error getting network %s in project %s: %v", networkID, projectID, err)) return nil, "", err } - if res.Payload.Network.ShortState == "" { + if *res.Payload.Network.ShortState == "" { tflog.Debug(ctx, fmt.Sprintf("Network %s in project %s is stopped: ", networkID, projectID)) return res, "done", nil } - tflog.Trace(ctx, fmt.Sprintf("pending network %s in project %s state: %s", networkID, projectID, res.Payload.Network.ShortState)) - return res, res.Payload.Network.ShortState, nil + tflog.Trace(ctx, fmt.Sprintf("pending network %s in project %s state: %s", networkID, projectID, *res.Payload.Network.ShortState)) + return res, *res.Payload.Network.ShortState, nil } tflog.Debug(ctx, fmt.Sprintf("waiting for network %s in project %s ", networkID, projectID)) @@ -206,13 +206,13 @@ func waitForNetworkDelete(ctx context.Context, projectID string, networkID strin tflog.Error(ctx, fmt.Sprintf("error getting network %s in project %s: %v", networkID, projectID, err)) return nil, "", err } - if res.Payload.Network.ShortState == "" { + if *res.Payload.Network.ShortState == "" { tflog.Debug(ctx, fmt.Sprintf("Network %s in project %s is stopped: ", networkID, projectID)) return res, "stop", nil } - tflog.Trace(ctx, fmt.Sprintf("pending network %s in project %s state: %s", networkID, projectID, res.Payload.Network.ShortState)) - return res, res.Payload.Network.ShortState, nil + tflog.Trace(ctx, fmt.Sprintf("pending network %s in project %s state: %s", networkID, projectID, *res.Payload.Network.ShortState)) + return res, *res.Payload.Network.ShortState, nil } tflog.Debug(ctx, fmt.Sprintf("waiting for network %s in project %s ", networkID, projectID)) @@ -243,11 +243,11 @@ func (r *NetworkResource) Create(ctx context.Context, req resource.CreateRequest params := networks.NewCreateNetworkParamsWithContext(ctx) params.ProjectID = r.client.DefaultProjectID - params.Body = networks.CreateNetworkBody{ + params.Body = &models.CreateNetworkBody{ CidrPrefix: state.IPRange.ValueStringPointer(), DataCenterID: state.DataCenterId.ValueStringPointer(), ID: state.ID.ValueStringPointer(), - VrouterSize: models.VRouterSizeVROUTERINSTANCESMALL.Pointer(), + VrouterSize: models.V1VRouterSizeVROUTERINSTANCESMALL.Pointer(), } _, err := r.client.Client.Networks.CreateNetwork(params) @@ -268,9 +268,9 @@ func (r *NetworkResource) Create(ctx context.Context, req resource.CreateRequest return } - state.Gateway = types.StringValue(res.Payload.Network.Gateway) - state.ExternalIPAddress = types.StringValue(res.Payload.Network.ExternalIPAddress) - state.InternalIPAddress = types.StringValue(res.Payload.Network.InternalIPAddress) + state.Gateway = types.StringValue(*res.Payload.Network.Gateway) + state.ExternalIPAddress = types.StringValue(*res.Payload.Network.ExternalIPAddress) + state.InternalIPAddress = types.StringValue(*res.Payload.Network.InternalIPAddress) resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) } @@ -301,12 +301,12 @@ func (r *NetworkResource) Read(ctx context.Context, req resource.ReadRequest, re return } - state.ID = types.StringValue(resget.Payload.Network.ID) - state.DataCenterId = types.StringValue(resget.Payload.Network.DataCenterID) - state.ExternalIPAddress = types.StringValue(resget.Payload.Network.ExternalIPAddress) - state.InternalIPAddress = types.StringValue(resget.Payload.Network.InternalIPAddress) - state.IPRange = types.StringValue(resget.Payload.Network.IPRange) - state.Gateway = types.StringValue(resget.Payload.Network.Gateway) + state.ID = types.StringValue(*resget.Payload.Network.ID) + state.DataCenterId = types.StringValue(*resget.Payload.Network.DataCenterID) + state.ExternalIPAddress = types.StringValue(*resget.Payload.Network.ExternalIPAddress) + state.InternalIPAddress = types.StringValue(*resget.Payload.Network.InternalIPAddress) + state.IPRange = types.StringValue(*resget.Payload.Network.IPRange) + state.Gateway = types.StringValue(*resget.Payload.Network.Gateway) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) diff --git a/internal/provider/security_group_resource.go b/internal/provider/security_group_resource.go index a118e3c..c8ec3f6 100644 --- a/internal/provider/security_group_resource.go +++ b/internal/provider/security_group_resource.go @@ -164,27 +164,27 @@ func getRuleModels(rules []*models.Rule) []RuleModel { var ruleModels []RuleModel for _, rule := range rules { protocol := "" - switch *rule.Protocol { - case models.ProtocolPROTOCOLALL: + switch rule.Protocol { + case models.RuleProtocolPROTOCOLALL.Pointer(): protocol = "all" - case models.ProtocolPROTOCOLICMP: + case models.RuleProtocolPROTOCOLICMP.Pointer(): protocol = "icmp" - case models.ProtocolPROTOCOLICMPv6: + case models.RuleProtocolPROTOCOLICMPv6.Pointer(): protocol = "icmpv6" - case models.ProtocolPROTOCOLIPSEC: + case models.RuleProtocolPROTOCOLIPSEC.Pointer(): protocol = "ipsec" - case models.ProtocolPROTOCOLTCP: + case models.RuleProtocolPROTOCOLTCP.Pointer(): protocol = "tcp" - case models.ProtocolPROTOCOLUDP: + case models.RuleProtocolPROTOCOLUDP.Pointer(): protocol = "udp" } ruleType := "" switch *rule.RuleType { - case models.RuleTypeRULETYPEINBOUND: + case models.RuleRuleTypeRULETYPEINBOUND: ruleType = "inbound" - case models.RuleTypeRULETYPEOUTBOUND: + case models.RuleRuleTypeRULETYPEOUTBOUND: ruleType = "outbound" } @@ -208,28 +208,28 @@ func getRuleParams(stateRules []RuleModel) []*models.Rule { for _, r := range stateRules { - var protocol *models.Protocol + var protocol *models.RuleProtocol switch r.Protocol.ValueString() { case "tcp": - protocol = models.NewProtocol(models.ProtocolPROTOCOLTCP) + protocol = models.NewRuleProtocol(models.RuleProtocolPROTOCOLTCP) case "udp": - protocol = models.NewProtocol(models.ProtocolPROTOCOLUDP) + protocol = models.NewRuleProtocol(models.RuleProtocolPROTOCOLUDP) case "icmp": - protocol = models.NewProtocol(models.ProtocolPROTOCOLICMP) + protocol = models.NewRuleProtocol(models.RuleProtocolPROTOCOLICMP) case "icmpv6": - protocol = models.NewProtocol(models.ProtocolPROTOCOLICMPv6) + protocol = models.NewRuleProtocol(models.RuleProtocolPROTOCOLICMPv6) case "ipsec": - protocol = models.NewProtocol(models.ProtocolPROTOCOLIPSEC) + protocol = models.NewRuleProtocol(models.RuleProtocolPROTOCOLIPSEC) default: - protocol = models.NewProtocol(models.ProtocolPROTOCOLALL) + protocol = models.NewRuleProtocol(models.RuleProtocolPROTOCOLALL) } - var ruleType *models.RuleType + var ruleType *models.RuleRuleType switch r.RuleType.ValueString() { case "inbound": - ruleType = models.NewRuleType(models.RuleTypeRULETYPEINBOUND) + ruleType = models.NewRuleRuleType(models.RuleRuleTypeRULETYPEINBOUND) case "outbound": - ruleType = models.NewRuleType(models.RuleTypeRULETYPEOUTBOUND) + ruleType = models.NewRuleRuleType(models.RuleRuleTypeRULETYPEOUTBOUND) } rule := models.Rule{ diff --git a/internal/provider/vm_resource.go b/internal/provider/vm_resource.go index 71544b0..c77b41c 100644 --- a/internal/provider/vm_resource.go +++ b/internal/provider/vm_resource.go @@ -455,7 +455,7 @@ func (r *VMResource) Create(ctx context.Context, req resource.CreateRequest, res if !state.MaxPriceHr.IsNull() { maxPriceHr = &models.Decimal{Value: state.MaxPriceHr.ValueString()} } - params.Body = virtual_machines.CreateVMBody{ + params.Body = &models.CreateVMBody{ BootDisk: &bootDisk, DataCenterID: state.DataCenterID.ValueString(), Gpus: int32(state.GPUs.ValueInt64()), diff --git a/swagger/public.swagger.json b/swagger/public.swagger.json index f10ae4e..76d4bd6 100644 --- a/swagger/public.swagger.json +++ b/swagger/public.swagger.json @@ -1,42 +1,25 @@ { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "schemes": [ - "https" - ], "swagger": "2.0", "info": { "title": "Cudo Compute service", "version": "1.0.0" }, "host": "rest.compute.cudo.org", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], "paths": { "/v1/api-keys": { "get": { - "description": "List the details of all API keys created by the requesting user. This does not include the API key itself which is only visible once when the API key is created.", - "tags": [ - "API keys" - ], "summary": "List", + "description": "List the details of all API keys created by the requesting user. This does not include the API key itself which is only visible once when the API key is created.", "operationId": "ListApiKeys", - "parameters": [ - { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "pageSize", - "in": "query" - } - ], "responses": { "200": { "description": "A successful response.", @@ -50,25 +33,31 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "description": "Creates a new API key for the requesting user. The API key is returned in the response, and this is the only time it can be viewed.", - "tags": [ - "API keys" - ], - "summary": "Generate", - "operationId": "GenerateApiKey", + }, "parameters": [ { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/GenerateApiKeyRequest" - } + "name": "pageNumber", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" } ], + "tags": [ + "API keys" + ] + }, + "post": { + "summary": "Generate", + "description": "Creates a new API key for the requesting user. The API key is returned in the response, and this is the only time it can be viewed.", + "operationId": "GenerateApiKey", "responses": { "200": { "description": "A successful response.", @@ -82,30 +71,33 @@ "$ref": "#/definitions/Status" } } - } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/GenerateApiKeyRequest" + } + } + ], + "tags": [ + "API keys" + ] } }, "/v1/api-keys/{name}": { "delete": { - "description": "Deletes an API key, revoking all access for requests that use the key.", - "tags": [ - "API keys" - ], "summary": "Delete", + "description": "Deletes an API key, revoking all access for requests that use the key.", "operationId": "DeleteApiKey", - "parameters": [ - { - "type": "string", - "name": "name", - "in": "path", - "required": true - } - ], "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "type": "object", + "properties": {} } }, "default": { @@ -114,16 +106,24 @@ "$ref": "#/definitions/Status" } } - } + }, + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "API keys" + ] } }, "/v1/auth": { "get": { - "description": "Responds with details of the user when suitable authentication material is sent with the request.", - "tags": [ - "User" - ], "summary": "Get", + "description": "Responds with details of the user when suitable authentication material is sent with the request.", "operationId": "Get", "responses": { "200": { @@ -138,20 +138,21 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "description": "Deletes your user, deleting all records of your user, and revoking access to every resource.", + }, "tags": [ "User" - ], + ] + }, + "delete": { "summary": "Delete", + "description": "Deletes your user, deleting all records of your user, and revoking access to every resource.", "operationId": "DeleteUser", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "type": "object", + "properties": {} } }, "default": { @@ -160,14 +161,14 @@ "$ref": "#/definitions/Status" } } - } + }, + "tags": [ + "User" + ] } }, "/v1/auth/create-identity-verification-session": { "get": { - "tags": [ - "User" - ], "summary": "Get identity verification session", "operationId": "CreateIdentityVerificationSession", "responses": { @@ -183,38 +184,64 @@ "$ref": "#/definitions/Status" } } - } + }, + "tags": [ + "User" + ] } }, "/v1/auth/permissions": { "get": { - "tags": [ - "Permissions" - ], "summary": "List", "operationId": "ListUserPermissions", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListUserPermissionsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, "parameters": [ { - "type": "string", "name": "projectId", - "in": "query" + "in": "query", + "required": false, + "type": "string" }, { - "type": "string", "name": "dataCenterId", - "in": "query" + "in": "query", + "required": false, + "type": "string" }, { - "type": "string", "name": "billingAccountId", - "in": "query" + "in": "query", + "required": false, + "type": "string" } ], + "tags": [ + "Permissions" + ] + } + }, + "/v1/billing-accounts": { + "get": { + "summary": "List billing accounts", + "operationId": "ListBillingAccounts", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListUserPermissionsResponse" + "$ref": "#/definitions/ListBillingAccountsResponse" } }, "default": { @@ -223,55 +250,34 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/billing-accounts/{billingAccountId}/add-user-permission": { - "post": { - "tags": [ - "Permissions" - ], - "summary": "Add billing account user", - "operationId": "AddBillingAccountUserPermission", + }, "parameters": [ { - "type": "string", - "name": "billingAccountId", - "in": "path", - "required": true + "name": "pageToken", + "in": "query", + "required": false, + "type": "string" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "required": [ - "userEmail", - "role" - ], - "properties": { - "dataCenterId": { - "type": "string" - }, - "projectId": { - "type": "string" - }, - "role": { - "$ref": "#/definitions/Role" - }, - "userEmail": { - "type": "string" - } - } - } + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" } ], + "tags": [ + "Billing" + ] + }, + "post": { + "summary": "Create a billing account", + "operationId": "CreateBillingAccount", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/BillingAccount" } }, "default": { @@ -280,55 +286,31 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/billing-accounts/{billingAccountId}/remove-user-permission": { - "post": { - "tags": [ - "Permissions" - ], - "summary": "Remove billing account user", - "operationId": "RemoveBillingAccountUserPermission", + }, "parameters": [ - { - "type": "string", - "name": "billingAccountId", - "in": "path", - "required": true - }, { "name": "body", "in": "body", "required": true, "schema": { - "type": "object", - "required": [ - "userId", - "role" - ], - "properties": { - "dataCenterId": { - "type": "string" - }, - "projectId": { - "type": "string" - }, - "role": { - "$ref": "#/definitions/Role" - }, - "userId": { - "type": "string" - } - } + "$ref": "#/definitions/CreateBillingAccountRequest" } } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/invoices": { + "get": { + "summary": "Get invoices", + "operationId": "GetBillingAccountStripeInvoices", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/GetBillingAccountStripeInvoicesResponse" } }, "default": { @@ -337,55 +319,48 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/data-centers/{dataCenterId}/add-user-permission": { - "post": { - "tags": [ - "Permissions" - ], - "summary": "Add data center user", - "operationId": "AddDataCenterUserPermission", + }, "parameters": [ { - "type": "string", - "name": "dataCenterId", - "in": "path", - "required": true + "name": "id", + "in": "query", + "required": true, + "type": "string" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "required": [ - "userEmail", - "role" - ], - "properties": { - "billingAccountId": { - "type": "string" - }, - "projectId": { - "type": "string" - }, - "role": { - "$ref": "#/definitions/Role" - }, - "userEmail": { - "type": "string" - } - } - } + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "startingAfter", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "status", + "in": "query", + "required": false, + "type": "string" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/invoices/outstanding": { + "get": { + "summary": "Get outstanding invoices", + "operationId": "ListOutstandingStripeInvoices", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/ListOutstandingStripeInvoicesResponse" } }, "default": { @@ -394,55 +369,61 @@ "$ref": "#/definitions/Status" } } - } + }, + "tags": [ + "Billing" + ] } }, - "/v1/data-centers/{dataCenterId}/remove-user-permission": { - "post": { - "tags": [ - "Permissions" - ], - "summary": "Remove data center user", - "operationId": "RemoveDataCenterUserPermission", + "/v1/billing-accounts/{billingAccount.id}": { + "patch": { + "summary": "Update billing account", + "operationId": "UpdateBillingAccount", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/BillingAccount" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, "parameters": [ { - "type": "string", - "name": "dataCenterId", + "name": "billingAccount.id", "in": "path", - "required": true + "required": true, + "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { - "type": "object", - "required": [ - "userId", - "role" - ], - "properties": { - "billingAccountId": { - "type": "string" - }, - "projectId": { - "type": "string" - }, - "role": { - "$ref": "#/definitions/Role" - }, - "userId": { - "type": "string" - } - } + "$ref": "#/definitions/UpdateBillingAccountBody" } } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/{billingAccountId}/add-user-permission": { + "post": { + "summary": "Add billing account user", + "operationId": "AddBillingAccountUserPermission", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "type": "object", + "properties": {} } }, "default": { @@ -451,29 +432,38 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/project/{projectId}/ssh-keys": { - "get": { - "tags": [ - "Projects" - ], - "summary": "List SSH keys", - "operationId": "ListProjectSshKeys", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "billingAccountId", "in": "path", - "required": true + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddBillingAccountUserPermissionBody" + } } ], + "tags": [ + "Permissions" + ] + } + }, + "/v1/billing-accounts/{billingAccountId}/remove-user-permission": { + "post": { + "summary": "Remove billing account user", + "operationId": "RemoveBillingAccountUserPermission", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListProjectSshKeysResponse" + "type": "object", + "properties": {} } }, "default": { @@ -482,34 +472,37 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects": { - "get": { - "tags": [ - "Projects" - ], - "summary": "List", - "operationId": "ListProjects", + }, "parameters": [ { - "type": "string", - "name": "pageToken", - "in": "query" + "name": "billingAccountId", + "in": "path", + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", - "name": "pageSize", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveBillingAccountUserPermissionBody" + } } ], + "tags": [ + "Permissions" + ] + } + }, + "/v1/billing-accounts/{billingAccountId}/spend/details": { + "get": { + "summary": "Get spend details", + "operationId": "GetBillingAccountSpendDetails", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListProjectsResponse" + "$ref": "#/definitions/GetBillingAccountSpendDetailsResponse" } }, "default": { @@ -518,29 +511,43 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Projects" - ], - "summary": "Create", - "operationId": "CreateProject", + }, "parameters": [ { - "name": "project", - "in": "body", + "name": "billingAccountId", + "in": "path", "required": true, - "schema": { - "$ref": "#/definitions/Project" - } + "type": "string" + }, + { + "name": "startTime", + "in": "query", + "required": true, + "type": "string", + "format": "date-time" + }, + { + "name": "endTime", + "in": "query", + "required": true, + "type": "string", + "format": "date-time" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/{id}": { + "get": { + "summary": "Get a billing account", + "operationId": "GetBillingAccount", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/Project" + "$ref": "#/definitions/BillingAccount" } }, "default": { @@ -549,29 +556,28 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{id}": { - "get": { - "tags": [ - "Projects" - ], - "summary": "Get", - "operationId": "GetProject", + }, "parameters": [ { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Billing" + ] + }, + "delete": { + "summary": "Delete billing account", + "operationId": "DeleteBillingAccount", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/Project" + "type": "object", + "properties": {} } }, "default": { @@ -580,27 +586,29 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "Projects" - ], - "summary": "Delete", - "operationId": "DeleteProject", + }, "parameters": [ { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/{id}/details": { + "get": { + "summary": "Get billing account details", + "operationId": "GetBillingAccountDetails", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/GetBillingAccountDetailsResponse" } }, "default": { @@ -609,54 +617,29 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{project.id}": { - "patch": { - "tags": [ - "Projects" - ], - "summary": "Update", - "operationId": "UpdateProject", + }, "parameters": [ { - "type": "string", - "name": "project.id", + "name": "id", "in": "path", - "required": true - }, - { - "name": "project", - "in": "body", "required": true, - "schema": { - "type": "object", - "required": [ - "billingAccountId" - ], - "properties": { - "billingAccountId": { - "type": "string" - }, - "createBy": { - "type": "string", - "readOnly": true - }, - "resourceCount": { - "type": "integer", - "format": "int32", - "readOnly": true - } - } - } + "type": "string" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/{id}/payment-methods": { + "get": { + "summary": "Get payment methods", + "operationId": "GetBillingAccountPaymentMethods", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/Project" + "$ref": "#/definitions/BillingAccountPaymentMethods" } }, "default": { @@ -665,55 +648,29 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/add-user-permission": { - "post": { - "tags": [ - "Permissions" - ], - "summary": "Add project user", - "operationId": "AddProjectUserPermission", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "id", "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", "required": true, - "schema": { - "type": "object", - "required": [ - "userEmail", - "role" - ], - "properties": { - "billingAccountId": { - "type": "string" - }, - "dataCenterId": { - "type": "string" - }, - "role": { - "$ref": "#/definitions/Role" - }, - "userEmail": { - "type": "string" - } - } - } + "type": "string" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/{id}/payment-methods/{paymentMethodId}": { + "delete": { + "summary": "Remove payment method", + "operationId": "RemoveBillingAccountPaymentMethod", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/RemoveBillingAccountPaymentMethodResponse" } }, "default": { @@ -722,29 +679,35 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/count-vms": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "Count", - "operationId": "CountVMs", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "paymentMethodId", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/{id}/payment-methods/{paymentMethodId}/set-default": { + "post": { + "summary": "Set default payment method", + "operationId": "SetBillingAccountDefaultPaymentMethod", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/CountVMsResponse" + "$ref": "#/definitions/SetBillingAccountDefaultPaymentMethodResponse" } }, "default": { @@ -753,40 +716,35 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/disk/{id}/attach": { - "patch": { - "tags": [ - "Disks" - ], - "summary": "Attach storage disk to VM", - "operationId": "AttachStorageDisk", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "vmId", - "in": "query" + "name": "paymentMethodId", + "in": "path", + "required": true, + "type": "string" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/billing-accounts/{id}/setup-intent": { + "get": { + "summary": "Get setup intent", + "operationId": "GetBillingAccountSetupIntent", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/AttachStorageDiskResponse" + "$ref": "#/definitions/BillingAccountSetupIntent" } }, "default": { @@ -795,35 +753,30 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/disk/{id}/detach": { - "put": { - "tags": [ - "Disks" - ], - "summary": "Detach storage disk from VM", - "operationId": "DetachStorageDisk", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Billing" + ] + } + }, + "/v1/data-centers": { + "get": { + "summary": "List data centers", + "description": "Returns the data centers in an organization", + "operationId": "ListDataCenters", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DetachStorageDiskResponse" + "$ref": "#/definitions/ListDataCentersResponse" } }, "default": { @@ -832,46 +785,69 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/disks": { - "get": { - "tags": [ - "Disks" - ], - "summary": "List disks", - "operationId": "ListDisks", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" + "name": "pageToken", + "in": "query", + "required": false, + "type": "string" }, { - "type": "integer", - "format": "int32", "name": "pageSize", - "in": "query" + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "Data Centers" + ] + }, + "post": { + "summary": "Create data center", + "description": "Creates a new data center", + "operationId": "CreateDataCenter", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1.DataCenter" + } }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ { - "type": "string", - "name": "dataCenterId", - "in": "query" + "name": "dataCenter", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.DataCenter" + } } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{dataCenter.id}": { + "patch": { + "summary": "Update data center", + "description": "Updates a data center", + "operationId": "UpdateDataCenter", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListDisksResponse" + "$ref": "#/definitions/v1.DataCenter" } }, "default": { @@ -880,43 +856,66 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Disks" - ], - "summary": "Create storage disk", - "operationId": "CreateStorageDisk", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "dataCenter.id", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "name": "body", + "name": "dataCenter", "in": "body", "required": true, "schema": { "type": "object", "properties": { - "dataCenterId": { + "regionId": { + "type": "string" + }, + "supplierName": { + "type": "string" + }, + "renewableEnergy": { + "type": "boolean" + }, + "lngLat": { + "$ref": "#/definitions/Point" + }, + "createBy": { + "type": "string", + "readOnly": true + }, + "oneFrontendId": { "type": "string" }, - "disk": { - "$ref": "#/definitions/Disk" + "s3Endpoint": { + "type": "string" } - } + }, + "required": [ + "oneFrontendId", + "s3Endpoint" + ] } } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{dataCenterId}/add-user-permission": { + "post": { + "summary": "Add data center user", + "operationId": "AddDataCenterUserPermission", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/CreateStorageDiskResponse" + "type": "object", + "properties": {} } }, "default": { @@ -925,35 +924,38 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/disks/{id}": { - "get": { - "tags": [ - "Disks" - ], - "summary": "List disks", - "operationId": "GetDisk", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "dataCenterId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/AddDataCenterUserPermissionBody" + } } ], + "tags": [ + "Permissions" + ] + } + }, + "/v1/data-centers/{dataCenterId}/clusters": { + "get": { + "summary": "List clusters", + "description": "Returns the clusters in a data center", + "operationId": "ListClusters", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/GetDiskResponse" + "$ref": "#/definitions/ListClustersResponse" } }, "default": { @@ -962,33 +964,30 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "Disks" - ], - "summary": "Delete storage disk", - "operationId": "DeleteStorageDisk", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "dataCenterId", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{dataCenterId}/host-count": { + "get": { + "summary": "Get host count", + "description": "Returns the number of hosts in a data center", + "operationId": "CountHosts", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DeleteStorageDiskResponse" + "$ref": "#/definitions/CountHostsResponse" } }, "default": { @@ -997,47 +996,30 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/disks/{id}/revert": { - "post": { - "tags": [ - "Disks" - ], - "summary": "Revert Disk to Snapshot", - "operationId": "RevertDisk", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "dataCenterId", "in": "path", - "required": true - }, - { - "type": "string", - "name": "snapshotId", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "vmId", - "in": "query", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{dataCenterId}/hosts": { + "get": { + "summary": "List hosts", + "description": "Returns the hosts in a data center", + "operationId": "ListHosts", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/RevertDiskResponse" + "$ref": "#/definitions/ListHostsResponse" } }, "default": { @@ -1046,35 +1028,29 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/disks/{id}/snapshots": { - "get": { - "tags": [ - "Disks" - ], - "summary": "List Disk Snapshots", - "operationId": "ListDiskSnapshots", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "dataCenterId", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{dataCenterId}/machine-types": { + "get": { + "summary": "Get", + "operationId": "ListMachineTypes", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListDiskSnapshotsResponse" + "$ref": "#/definitions/ListMachineTypesResponse" } }, "default": { @@ -1083,53 +1059,29 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Disks" - ], - "summary": "Create Disk Snapshot", - "operationId": "CreateDiskSnapshot", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "dataCenterId", "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", "required": true, - "schema": { - "type": "object", - "required": [ - "snapshotId", - "vmId" - ], - "properties": { - "snapshotId": { - "type": "string" - }, - "vmId": { - "type": "string" - } - } - } + "type": "string" } ], + "tags": [ + "MachineTypes" + ] + } + }, + "/v1/data-centers/{dataCenterId}/machine-types/{machineType}": { + "get": { + "summary": "Get", + "operationId": "GetMachineType", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/CreateDiskSnapshotResponse" + "$ref": "#/definitions/GetMachineTypeResponse" } }, "default": { @@ -1138,45 +1090,35 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "Disks" - ], - "summary": "Delete Disk Snapshots", - "operationId": "DeleteDiskSnapshot", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "dataCenterId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "id", + "name": "machineType", "in": "path", - "required": true - }, - { - "type": "string", - "name": "snapshotId", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "vmId", - "in": "query", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "MachineTypes" + ] + } + }, + "/v1/data-centers/{dataCenterId}/machine-types/{machineType}/live-utilization": { + "get": { + "summary": "Get", + "operationId": "GetMachineTypeLiveUtilization", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DeleteDiskSnapshotResponse" + "$ref": "#/definitions/GetMachineTypeLiveUtilizationResponse" } }, "default": { @@ -1185,41 +1127,36 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/images": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "List private VM images", - "operationId": "ListPrivateVMImages", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "dataCenterId", "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", - "name": "pageSize", - "in": "query" + "name": "machineType", + "in": "path", + "required": true, + "type": "string" } ], + "tags": [ + "MachineTypes" + ] + } + }, + "/v1/data-centers/{dataCenterId}/remove-user-permission": { + "post": { + "summary": "Remove data center user", + "operationId": "RemoveDataCenterUserPermission", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListPrivateVMImagesResponse" + "type": "object", + "properties": {} } }, "default": { @@ -1228,44 +1165,38 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Create private VM image", - "operationId": "CreatePrivateVMImage", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "dataCenterId", "in": "path", - "required": true - }, - { - "type": "string", - "name": "vmId", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "query", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "description", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveDataCenterUserPermissionBody" + } } ], + "tags": [ + "Permissions" + ] + } + }, + "/v1/data-centers/{id}": { + "get": { + "summary": "Get data center", + "description": "Returns a data center", + "operationId": "GetDataCenter", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/CreatePrivateVMImageResponse" + "$ref": "#/definitions/v1.DataCenter" } }, "default": { @@ -1274,35 +1205,29 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/images/{id}": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "Get private VM image", - "operationId": "GetPrivateVMImage", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Data Centers" + ] + }, + "delete": { + "summary": "Delete data center", + "description": "Deletes a data center", + "operationId": "DeleteDataCenter", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/GetPrivateVMImageResponse" + "type": "object", + "properties": {} } }, "default": { @@ -1311,38 +1236,30 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Update private VM image", - "operationId": "UpdatePrivateVMImage", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", "name": "id", "in": "path", - "required": true - }, - { - "type": "string", - "name": "description", - "in": "query" + "required": true, + "type": "string" } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{id}/live-utilization": { + "get": { + "summary": "Get live utilization", + "description": "Returns the live utilization of a data center", + "operationId": "GetDataCenterLiveUtilization", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/UpdatePrivateVMImageResponse" + "$ref": "#/definitions/GetDataCenterLiveUtilizationResponse" } }, "default": { @@ -1351,33 +1268,30 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "Virtual Machines" - ], - "summary": "Delete private VM image", - "operationId": "DeletePrivateVMImage", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{id}/revenue": { + "get": { + "summary": "Get revenue time series", + "description": "Returns the revenue of a data center over time", + "operationId": "GetDataCenterRevenueTimeSeries", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DeletePrivateVMImageResponse" + "$ref": "#/definitions/GetDataCenterRevenueTimeSeriesResponse" } }, "default": { @@ -1386,41 +1300,57 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/networks": { - "get": { - "tags": [ - "Networks" - ], - "summary": "List networks", - "operationId": "ListNetworks", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" + "name": "startTime", + "in": "query", + "required": true, + "type": "string", + "format": "date-time" }, { - "type": "integer", - "format": "int32", - "name": "pageSize", - "in": "query" + "name": "endTime", + "in": "query", + "required": true, + "type": "string", + "format": "date-time" + }, + { + "name": "interval", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "INTERVAL_UNKNOWN", + "INTERVAL_DAY", + "INTERVAL_WEEK", + "INTERVAL_MONTH" + ], + "default": "INTERVAL_UNKNOWN" } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/data-centers/{id}/revenue-by-resource": { + "get": { + "summary": "Get revenue by resource", + "description": "Returns the revenue of a data center by resource (CPU, Memory, Storage, etc.)", + "operationId": "GetDataCenterRevenueByResource", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListNetworksResponse" + "$ref": "#/definitions/GetDataCenterRevenueByResourceResponse" } }, "default": { @@ -1429,58 +1359,43 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Networks" - ], - "summary": "Create network", - "operationId": "CreateNetwork", + }, "parameters": [ { - "type": "string", - "name": "projectId", + "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "name": "body", - "in": "body", + "name": "startTime", + "in": "query", "required": true, - "schema": { - "type": "object", - "required": [ - "dataCenterId", - "id", - "cidrPrefix", - "networkId" - ], - "properties": { - "cidrPrefix": { - "type": "string" - }, - "dataCenterId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "networkId": { - "type": "string" - }, - "vrouterSize": { - "$ref": "#/definitions/VRouterSize" - } - } - } + "type": "string", + "format": "date-time" + }, + { + "name": "endTime", + "in": "query", + "required": true, + "type": "string", + "format": "date-time" } ], + "tags": [ + "Data Centers" + ] + } + }, + "/v1/project/{projectId}/ssh-keys": { + "get": { + "summary": "List SSH keys", + "operationId": "ListProjectSshKeys", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/CreateNetworkResponse" + "$ref": "#/definitions/ListProjectSshKeysResponse" } }, "default": { @@ -1489,46 +1404,29 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/networks/security-groups": { - "get": { - "tags": [ - "Networks" - ], - "summary": "List security groups", - "operationId": "ListSecurityGroups", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true - }, - { - "type": "string", - "name": "dataCenterId", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "pageSize", - "in": "query" + "required": true, + "type": "string" } ], + "tags": [ + "Projects" + ] + } + }, + "/v1/projects": { + "get": { + "summary": "List", + "operationId": "ListProjects", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListSecurityGroupsResponse" + "$ref": "#/definitions/ListProjectsResponse" } }, "default": { @@ -1537,35 +1435,34 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/networks/security-groups/{id}": { - "get": { - "tags": [ - "Networks" - ], - "summary": "Get a security group", - "operationId": "GetSecurityGroup", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true + "name": "pageToken", + "in": "query", + "required": false, + "type": "string" }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" } ], + "tags": [ + "Projects" + ] + }, + "post": { + "summary": "Create", + "operationId": "CreateProject", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/GetSecurityGroupResponse" + "$ref": "#/definitions/Project" } }, "default": { @@ -1574,33 +1471,31 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "Networks" - ], - "summary": "Delete security group", - "operationId": "DeleteSecurityGroup", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "project", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Project" + } } ], + "tags": [ + "Projects" + ] + } + }, + "/v1/projects/{id}": { + "get": { + "summary": "Get", + "operationId": "GetProject", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DeleteSecurityGroupResponse" + "$ref": "#/definitions/Project" } }, "default": { @@ -1609,35 +1504,28 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/networks/{id}": { - "get": { - "tags": [ - "Networks" - ], - "summary": "Get network", - "operationId": "GetNetwork", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Projects" + ] + }, + "delete": { + "summary": "Delete", + "operationId": "DeleteProject", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/GetNetworkResponse" + "type": "object", + "properties": {} } }, "default": { @@ -1646,39 +1534,29 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "Networks" - ], - "summary": "Delete network", - "operationId": "DeleteNetwork", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", "name": "id", "in": "path", - "required": true - }, - { - "type": "string", - "name": "networkId", - "in": "query", - "required": true + "required": true, + "type": "string" } ], - "responses": { + "tags": [ + "Projects" + ] + } + }, + "/v1/projects/{project.id}": { + "patch": { + "summary": "Update", + "operationId": "UpdateProject", + "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DeleteNetworkResponse" + "$ref": "#/definitions/Project" } }, "default": { @@ -1687,84 +1565,55 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/networks/{id}/start": { - "post": { - "tags": [ - "Networks" - ], - "summary": "Start network", - "operationId": "StartNetwork", + }, "parameters": [ { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", + "name": "project.id", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "networkId", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/StartNetworkResponse" - } - }, - "default": { - "description": "An unexpected error response.", + "name": "project", + "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/Status" + "type": "object", + "properties": { + "billingAccountId": { + "type": "string" + }, + "resourceCount": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "createBy": { + "type": "string", + "readOnly": true + } + }, + "required": [ + "billingAccountId" + ] } } - } + ], + "tags": [ + "Projects" + ] } }, - "/v1/projects/{projectId}/networks/{id}/stop": { + "/v1/projects/{projectId}/add-user-permission": { "post": { - "tags": [ - "Networks" - ], - "summary": "Stop network", - "operationId": "StopNetwork", - "parameters": [ - { - "type": "string", - "name": "projectId", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "name": "networkId", - "in": "query", - "required": true - } - ], + "summary": "Add project user", + "operationId": "AddProjectUserPermission", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/StopNetworkResponse" + "type": "object", + "properties": {} } }, "default": { @@ -1773,42 +1622,37 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/object-storage/activate": { - "post": { - "tags": [ - "Object Storage" - ], - "summary": "Allow the use of S3 compatible storage in a project", - "operationId": "Activate", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "dataCenterId": { - "type": "string" - } - } + "$ref": "#/definitions/AddProjectUserPermissionBody" } } ], + "tags": [ + "Permissions" + ] + } + }, + "/v1/projects/{projectId}/count-vms": { + "get": { + "summary": "Count", + "operationId": "CountVMs", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/CountVMsResponse" } }, "default": { @@ -1817,41 +1661,29 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/object-storage/buckets": { - "get": { - "tags": [ - "Object Storage" - ], - "summary": "List buckets", - "operationId": "ListObjectStorageBuckets", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "pageSize", - "in": "query" + "required": true, + "type": "string" } ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/disk/{id}/attach": { + "patch": { + "summary": "Attach storage disk to VM", + "operationId": "AttachStorageDisk", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListObjectStorageBucketsResponse" + "$ref": "#/definitions/AttachStorageDiskResponse" } }, "default": { @@ -1860,35 +1692,41 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/object-storage/buckets/{id}": { - "get": { - "tags": [ - "Object Storage" - ], - "summary": "Get details for a bucket", - "operationId": "GetObjectStorageBucket", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" + }, + { + "name": "vmId", + "in": "query", + "required": false, + "type": "string" } ], + "tags": [ + "Disks" + ] + } + }, + "/v1/projects/{projectId}/disk/{id}/detach": { + "put": { + "summary": "Detach storage disk from VM", + "operationId": "DetachStorageDisk", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ObjectStorageBucket" + "$ref": "#/definitions/DetachStorageDiskResponse" } }, "default": { @@ -1897,34 +1735,35 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/object-storage/session-key": { - "get": { - "tags": [ - "Object Storage" - ], - "summary": "Generate temporary key for storage bucket access", - "operationId": "GetObjectStorageSessionKey", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "dataCenterId", - "in": "query" + "name": "id", + "in": "path", + "required": true, + "type": "string" } ], + "tags": [ + "Disks" + ] + } + }, + "/v1/projects/{projectId}/disks": { + "get": { + "summary": "List disks", + "operationId": "ListDisks", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/GetObjectStorageSessionKeyResponse" + "$ref": "#/definitions/ListDisksResponse" } }, "default": { @@ -1933,41 +1772,47 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/object-storage/users": { - "get": { - "tags": [ - "Object Storage" - ], - "summary": "List storage users", - "operationId": "ListObjectStorageUsers", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", "name": "pageNumber", - "in": "query" + "in": "query", + "required": false, + "type": "integer", + "format": "int32" }, { - "type": "integer", - "format": "int32", "name": "pageSize", - "in": "query" + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "dataCenterId", + "in": "query", + "required": false, + "type": "string" } ], + "tags": [ + "Disks" + ] + }, + "post": { + "summary": "Create storage disk", + "operationId": "CreateStorageDisk", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListObjectStorageUsersResponse" + "$ref": "#/definitions/CreateStorageDiskResponse" } }, "default": { @@ -1976,40 +1821,37 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Object Storage" - ], - "summary": "Create user that stores keys for storage buckets", - "operationId": "CreateObjectStorageUser", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "id": { - "type": "string" - } - } + "$ref": "#/definitions/CreateStorageDiskBody" } } ], + "tags": [ + "Disks" + ] + } + }, + "/v1/projects/{projectId}/disks/{id}": { + "get": { + "summary": "List disks", + "operationId": "GetDisk", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ObjectStorageUser" + "$ref": "#/definitions/GetDiskResponse" } }, "default": { @@ -2018,43 +1860,33 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/object-storage/users/{id}": { - "post": { - "tags": [ - "Object Storage" - ], - "summary": "Generate access key for storage buckets", - "operationId": "GenerateObjectStorageKey", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true - }, - { - "name": "body", - "in": "body", "required": true, - "schema": { - "type": "object" - } + "type": "string" } ], + "tags": [ + "Disks" + ] + }, + "delete": { + "summary": "Delete storage disk", + "operationId": "DeleteStorageDisk", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ObjectStorageKey" + "$ref": "#/definitions/DeleteStorageDiskResponse" } }, "default": { @@ -2063,33 +1895,35 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "Object Storage" - ], - "summary": "Delete object storage user", - "operationId": "DeleteObjectStorageUser", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Disks" + ] + } + }, + "/v1/projects/{projectId}/disks/{id}/revert": { + "post": { + "summary": "Revert Disk to Snapshot", + "operationId": "RevertDisk", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DeleteObjectStorageUserResponse" + "$ref": "#/definitions/RevertDiskResponse" } }, "default": { @@ -2098,47 +1932,47 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/object-storage/users/{id}/keys": { - "get": { - "tags": [ - "Object Storage" - ], - "summary": "List storage user keys", - "operationId": "ListObjectStorageKeys", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" + "name": "snapshotId", + "in": "query", + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", - "name": "pageSize", - "in": "query" + "name": "vmId", + "in": "query", + "required": true, + "type": "string" } ], + "tags": [ + "Disks" + ] + } + }, + "/v1/projects/{projectId}/disks/{id}/snapshots": { + "get": { + "summary": "List Disk Snapshots", + "operationId": "ListDiskSnapshots", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListObjectStorageKeysResponse" + "$ref": "#/definitions/ListDiskSnapshotsResponse" } }, "default": { @@ -2147,38 +1981,80 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "Object Storage" + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } ], - "summary": "Delete object storage user", - "operationId": "DeleteObjectStorageKey", + "tags": [ + "Disks" + ] + }, + "delete": { + "summary": "Delete Disk Snapshots", + "operationId": "DeleteDiskSnapshot", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/DeleteDiskSnapshotResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "accessKey", - "in": "query" + "name": "snapshotId", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "vmId", + "in": "query", + "required": true, + "type": "string" } ], + "tags": [ + "Disks" + ] + }, + "post": { + "summary": "Create Disk Snapshot", + "operationId": "CreateDiskSnapshot", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/DeleteObjectStorageKeyResponse" + "$ref": "#/definitions/CreateDiskSnapshotResponse" } }, "default": { @@ -2187,55 +2063,43 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/remove-user-permission": { - "post": { - "tags": [ - "Permissions" - ], - "summary": "Remove project user", - "operationId": "RemoveProjectUserPermission", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { - "type": "object", - "required": [ - "userId", - "role" - ], - "properties": { - "billingAccountId": { - "type": "string" - }, - "dataCenterId": { - "type": "string" - }, - "role": { - "$ref": "#/definitions/Role" - }, - "userId": { - "type": "string" - } - } + "$ref": "#/definitions/CreateDiskSnapshotBody" } } ], + "tags": [ + "Disks" + ] + } + }, + "/v1/projects/{projectId}/images": { + "get": { + "summary": "List private VM images", + "operationId": "ListPrivateVMImages", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/ListPrivateVMImagesResponse" } }, "default": { @@ -2244,120 +2108,41 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vm": { - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Create virtual machine", - "operationId": "CreateVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "required": [ - "vmId", - "bootDiskImageId" - ], - "properties": { - "bootDisk": { - "$ref": "#/definitions/Disk" - }, - "bootDiskImageId": { - "type": "string" - }, - "cpuModel": { - "type": "string" - }, - "customSshKeys": { - "type": "array", - "items": { - "type": "string" - } - }, - "dataCenterId": { - "type": "string" - }, - "gpuModel": { - "type": "string" - }, - "gpus": { - "type": "integer", - "format": "int32" - }, - "machineType": { - "type": "string" - }, - "maxPriceHr": { - "$ref": "#/definitions/Decimal" - }, - "memoryGib": { - "type": "integer", - "format": "int32" - }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "nics": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/CreateVMRequest.NIC" - } - }, - "password": { - "type": "string" - }, - "securityGroupIds": { - "type": "array", - "title": "ignored if any nics are provided", - "items": { - "type": "string" - } - }, - "sshKeySource": { - "$ref": "#/definitions/SshKeySource" - }, - "startScript": { - "type": "string" - }, - "storageDiskIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "vcpus": { - "type": "integer", - "format": "int32" - }, - "vmId": { - "type": "string" - } - } - } + "name": "pageNumber", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" } ], + "tags": [ + "Virtual Machines" + ] + }, + "post": { + "summary": "Create private VM image", + "operationId": "CreatePrivateVMImage", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/CreateVMResponse" + "$ref": "#/definitions/CreatePrivateVMImageResponse" } }, "default": { @@ -2366,34 +2151,47 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "List", - "operationId": "ListVMs", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "networkId", - "in": "query" + "name": "vmId", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "description", + "in": "query", + "required": false, + "type": "string" } ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/images/{id}": { + "get": { + "summary": "Get private VM image", + "operationId": "GetPrivateVMImage", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListVMsResponse" + "$ref": "#/definitions/GetPrivateVMImageResponse" } }, "default": { @@ -2402,35 +2200,33 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "Get", - "operationId": "GetVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Virtual Machines" + ] + }, + "delete": { + "summary": "Delete private VM image", + "operationId": "DeletePrivateVMImage", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/GetVMResponse" + "$ref": "#/definitions/DeletePrivateVMImageResponse" } }, "default": { @@ -2439,40 +2235,33 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/connect": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "Connect via VNC", - "operationId": "ConnectVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true - }, - { - "type": "string", - "name": "connectionId", - "in": "query" + "required": true, + "type": "string" } ], + "tags": [ + "Virtual Machines" + ] + }, + "post": { + "summary": "Update private VM image", + "operationId": "UpdatePrivateVMImage", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ConnectVMResponse" + "$ref": "#/definitions/UpdatePrivateVMImageResponse" } }, "default": { @@ -2481,35 +2270,41 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/disks": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "List disks attached to VM", - "operationId": "ListVMDisks", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" + }, + { + "name": "description", + "in": "query", + "required": false, + "type": "string" } ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/networks": { + "get": { + "summary": "List networks", + "operationId": "ListNetworks", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListVMDisksResponse" + "$ref": "#/definitions/ListNetworksResponse" } }, "default": { @@ -2518,44 +2313,41 @@ "$ref": "#/definitions/Status" } } - } - }, - "patch": { - "tags": [ - "Virtual Machines" - ], - "summary": "Resize a VM's disk", - "operationId": "ResizeVMDisk", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true - }, - { - "type": "string", - "name": "id", - "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "diskId", - "in": "query" + "name": "pageNumber", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" }, { + "name": "pageSize", + "in": "query", + "required": false, "type": "integer", - "format": "int32", - "name": "sizeGib", - "in": "query" + "format": "int32" } ], + "tags": [ + "Networks" + ] + }, + "post": { + "summary": "Create network", + "operationId": "CreateNetwork", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ResizeVMDiskResponse" + "$ref": "#/definitions/CreateNetworkResponse" } }, "default": { @@ -2564,35 +2356,37 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/monitor": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "Monitor", - "operationId": "MonitorVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateNetworkBody" + } } ], + "tags": [ + "Networks" + ] + } + }, + "/v1/projects/{projectId}/networks/security-groups": { + "get": { + "summary": "List security groups", + "operationId": "ListSecurityGroups", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/MonitorVMResponse" + "$ref": "#/definitions/ListSecurityGroupsResponse" } }, "default": { @@ -2601,35 +2395,49 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/reboot": { - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Reboot", - "operationId": "RebootVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "id", - "in": "path", - "required": true + "name": "dataCenterId", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pageNumber", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" } ], + "tags": [ + "Networks" + ] + } + }, + "/v1/projects/{projectId}/networks/security-groups/{id}": { + "get": { + "summary": "Get a security group", + "operationId": "GetSecurityGroup", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/RebootVMResponse" + "$ref": "#/definitions/GetSecurityGroupResponse" } }, "default": { @@ -2638,47 +2446,33 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/resize": { - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Resize vCPU and memory of VM", - "operationId": "ResizeVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true - }, - { - "type": "integer", - "format": "int64", - "name": "vcpus", - "in": "query" - }, - { - "type": "integer", - "format": "int64", - "name": "memoryGib", - "in": "query" + "required": true, + "type": "string" } ], + "tags": [ + "Networks" + ] + }, + "delete": { + "summary": "Delete security group", + "operationId": "DeleteSecurityGroup", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ResizeVMResponse" + "$ref": "#/definitions/DeleteSecurityGroupResponse" } }, "default": { @@ -2687,35 +2481,35 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/start": { - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Start", - "operationId": "StartVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Networks" + ] + } + }, + "/v1/projects/{projectId}/networks/{id}": { + "get": { + "summary": "Get network", + "operationId": "GetNetwork", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/StartVMResponse" + "$ref": "#/definitions/GetNetworkResponse" } }, "default": { @@ -2724,35 +2518,33 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/stop": { - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Stop", - "operationId": "StopVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Networks" + ] + }, + "delete": { + "summary": "Delete network", + "operationId": "DeleteNetwork", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/StopVMResponse" + "$ref": "#/definitions/DeleteNetworkResponse" } }, "default": { @@ -2761,35 +2553,35 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{projectId}/vms/{id}/terminate": { - "post": { - "tags": [ - "Virtual Machines" - ], - "summary": "Terminate", - "operationId": "TerminateVM", + }, "parameters": [ { - "type": "string", "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", "name": "id", "in": "path", - "required": true + "required": true, + "type": "string" } ], + "tags": [ + "Networks" + ] + } + }, + "/v1/projects/{projectId}/networks/{id}/start": { + "post": { + "summary": "Start network", + "operationId": "StartNetwork", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/TerminateVMResponse" + "$ref": "#/definitions/StartNetworkResponse" } }, "default": { @@ -2798,59 +2590,35 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{securityGroup.projectId}/networks/security-groups": { - "post": { - "tags": [ - "Networks" - ], - "summary": "Create security group", - "operationId": "CreateSecurityGroup", + }, "parameters": [ { - "type": "string", - "name": "securityGroup.projectId", + "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "name": "securityGroup", - "in": "body", + "name": "id", + "in": "path", "required": true, - "schema": { - "type": "object", - "required": [ - "dataCenterId", - "id" - ], - "properties": { - "dataCenterId": { - "type": "string" - }, - "description": { - "type": "string" - }, - "id": { - "type": "string" - }, - "rules": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/Rule" - } - } - } - } + "type": "string" } ], + "tags": [ + "Networks" + ] + } + }, + "/v1/projects/{projectId}/networks/{id}/stop": { + "post": { + "summary": "Stop network", + "operationId": "StopNetwork", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/CreateSecurityGroupResponse" + "$ref": "#/definitions/StopNetworkResponse" } }, "default": { @@ -2859,61 +2627,36 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/projects/{securityGroup.projectId}/networks/security-groups/{securityGroup.id}": { - "patch": { - "tags": [ - "Networks" - ], - "summary": "Update security group", - "operationId": "UpdateSecurityGroup", + }, "parameters": [ { - "type": "string", - "name": "securityGroup.projectId", + "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" }, { - "type": "string", - "name": "securityGroup.id", + "name": "id", "in": "path", - "required": true - }, - { - "name": "securityGroup", - "in": "body", "required": true, - "schema": { - "type": "object", - "required": [ - "dataCenterId" - ], - "properties": { - "dataCenterId": { - "type": "string" - }, - "description": { - "type": "string" - }, - "rules": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/Rule" - } - } - } - } + "type": "string" } ], + "tags": [ + "Networks" + ] + } + }, + "/v1/projects/{projectId}/object-storage/activate": { + "post": { + "summary": "Allow the use of S3 compatible storage in a project", + "operationId": "Activate", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/UpdateSecurityGroupResponse" + "type": "object", + "properties": {} } }, "default": { @@ -2922,21 +2665,37 @@ "$ref": "#/definitions/Status" } } - } - } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ActivateBody" + } + } + ], + "tags": [ + "Object Storage" + ] + } }, - "/v1/regions": { + "/v1/projects/{projectId}/object-storage/buckets": { "get": { - "tags": [ - "Search" - ], - "summary": "Regions", - "operationId": "ListRegions", + "summary": "List buckets", + "operationId": "ListObjectStorageBuckets", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListRegionsResponse" + "$ref": "#/definitions/ListObjectStorageBucketsResponse" } }, "default": { @@ -2945,35 +2704,43 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/ssh-keys": { - "get": { - "tags": [ - "SSH keys" - ], - "summary": "List", - "operationId": "ListSshKeys", + }, "parameters": [ { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" + "name": "projectId", + "in": "path", + "required": true, + "type": "string" }, { + "name": "pageNumber", + "in": "query", + "required": false, "type": "integer", - "format": "int32", + "format": "int32" + }, + { "name": "pageSize", - "in": "query" + "in": "query", + "required": false, + "type": "integer", + "format": "int32" } ], + "tags": [ + "Object Storage" + ] + } + }, + "/v1/projects/{projectId}/object-storage/buckets/{id}": { + "get": { + "summary": "Get details for a bucket", + "operationId": "GetObjectStorageBucket", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListSshKeysResponse" + "$ref": "#/definitions/ObjectStorageBucket" } }, "default": { @@ -2982,29 +2749,35 @@ "$ref": "#/definitions/Status" } } - } - }, - "post": { - "tags": [ - "SSH keys" - ], - "summary": "Create", - "operationId": "CreateSshKey", + }, "parameters": [ { - "name": "sshKey", - "in": "body", + "name": "projectId", + "in": "path", "required": true, - "schema": { - "$ref": "#/definitions/SshKey" - } + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" } ], + "tags": [ + "Object Storage" + ] + } + }, + "/v1/projects/{projectId}/object-storage/session-key": { + "get": { + "summary": "Generate temporary key for storage bucket access", + "operationId": "GetObjectStorageSessionKey", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/SshKey" + "$ref": "#/definitions/GetObjectStorageSessionKeyResponse" } }, "default": { @@ -3013,29 +2786,35 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/ssh-keys/{id}": { - "get": { - "tags": [ - "SSH keys" - ], - "summary": "Get", - "operationId": "GetSshKey", + }, "parameters": [ { - "type": "string", - "name": "id", + "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" + }, + { + "name": "dataCenterId", + "in": "query", + "required": false, + "type": "string" } ], + "tags": [ + "Object Storage" + ] + } + }, + "/v1/projects/{projectId}/object-storage/users": { + "get": { + "summary": "List storage users", + "operationId": "ListObjectStorageUsers", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/SshKey" + "$ref": "#/definitions/ListObjectStorageUsersResponse" } }, "default": { @@ -3044,27 +2823,41 @@ "$ref": "#/definitions/Status" } } - } - }, - "delete": { - "tags": [ - "SSH keys" - ], - "summary": "Delete", - "operationId": "DeleteSshKey", + }, "parameters": [ { - "type": "string", - "name": "id", + "name": "projectId", "in": "path", - "required": true + "required": true, + "type": "string" + }, + { + "name": "pageNumber", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" } ], + "tags": [ + "Object Storage" + ] + }, + "post": { + "summary": "Create user that stores keys for storage buckets", + "operationId": "CreateObjectStorageUser", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object" + "$ref": "#/definitions/ObjectStorageUser" } }, "default": { @@ -3073,37 +2866,37 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/vms/data-centers": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "List data centers", - "operationId": "ListVMDataCenters", + }, "parameters": [ { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "multi", - "name": "regionId", - "in": "query" + "name": "projectId", + "in": "path", + "required": true, + "type": "string" }, { - "type": "boolean", - "name": "renewableEnergy", - "in": "query" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateObjectStorageUserBody" + } } ], + "tags": [ + "Object Storage" + ] + } + }, + "/v1/projects/{projectId}/object-storage/users/{id}": { + "delete": { + "summary": "Delete object storage user", + "operationId": "DeleteObjectStorageUser", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListVMDataCentersResponse" + "$ref": "#/definitions/DeleteObjectStorageUserResponse" } }, "default": { @@ -3112,91 +2905,1240 @@ "$ref": "#/definitions/Status" } } - } - } - }, - "/v1/vms/machine-types": { - "get": { - "tags": [ - "Virtual Machines" - ], - "summary": "List machine types", - "operationId": "ListVMMachineTypes", + }, "parameters": [ { - "type": "string", - "name": "cpuModel", - "in": "query" - }, - { - "type": "integer", - "format": "int32", - "name": "gpu", - "in": "query" - }, - { - "type": "string", - "name": "gpuModel", - "in": "query" + "name": "projectId", + "in": "path", + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", - "name": "memoryGib", - "in": "query", - "required": true + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Object Storage" + ] + }, + "post": { + "summary": "Generate access key for storage buckets", + "operationId": "GenerateObjectStorageKey", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ObjectStorageKey" + } }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ { - "type": "string", - "name": "orderBy", - "in": "query" + "name": "projectId", + "in": "path", + "required": true, + "type": "string" }, { - "type": "integer", - "format": "int32", - "name": "pageNumber", - "in": "query" + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Object Storage" + ] + } + }, + "/v1/projects/{projectId}/object-storage/users/{id}/keys": { + "get": { + "summary": "List storage user keys", + "operationId": "ListObjectStorageKeys", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListObjectStorageKeysResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageNumber", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "Object Storage" + ] + } + }, + "/v1/projects/{projectId}/object-storage/users/{id}/keys/{accessKey}": { + "delete": { + "summary": "Delete object storage user key", + "operationId": "DeleteObjectStorageKey", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/DeleteObjectStorageKeyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "accessKey", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Object Storage" + ] + } + }, + "/v1/projects/{projectId}/remove-user-permission": { + "post": { + "summary": "Remove project user", + "operationId": "RemoveProjectUserPermission", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": {} + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RemoveProjectUserPermissionBody" + } + } + ], + "tags": [ + "Permissions" + ] + } + }, + "/v1/projects/{projectId}/vm": { + "post": { + "summary": "Create virtual machine", + "operationId": "CreateVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/CreateVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVMBody" + } + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vm/{id}/metadata": { + "post": { + "summary": "Update VM metadata", + "operationId": "UpdateVMMetadata", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/UpdateVMMetadataResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateVMMetadataBody" + } + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vm/{id}/security-group/attach": { + "patch": { + "summary": "Attach security group to VM", + "operationId": "AttachSecurityGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/AttachSecurityGroupResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "securityGroupId", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vm/{id}/security-group/detach": { + "patch": { + "summary": "Attach security group to VM", + "operationId": "DetachSecurityGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/DetachSecurityGroupResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "securityGroupId", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms": { + "get": { + "summary": "List", + "operationId": "ListVMs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListVMsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "networkId", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}": { + "get": { + "summary": "Get", + "operationId": "GetVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/GetVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/connect": { + "get": { + "summary": "Connect via VNC", + "operationId": "ConnectVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ConnectVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "connectionId", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/disks": { + "get": { + "summary": "List disks attached to VM", + "operationId": "ListVMDisks", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListVMDisksResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + }, + "patch": { + "summary": "Resize a VM's disk", + "operationId": "ResizeVMDisk", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ResizeVMDiskResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "diskId", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sizeGib", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/monitor": { + "get": { + "summary": "Monitor", + "operationId": "MonitorVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/MonitorVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/reboot": { + "post": { + "summary": "Reboot", + "operationId": "RebootVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/RebootVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/resize": { + "post": { + "summary": "Resize vCPU and memory of VM", + "operationId": "ResizeVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ResizeVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "vcpus", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "memoryGib", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/start": { + "post": { + "summary": "Start", + "operationId": "StartVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/StartVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/stop": { + "post": { + "summary": "Stop", + "operationId": "StopVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/StopVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{projectId}/vms/{id}/terminate": { + "post": { + "summary": "Terminate", + "operationId": "TerminateVM", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/TerminateVMResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/projects/{securityGroup.projectId}/networks/security-groups": { + "post": { + "summary": "Create security group", + "operationId": "CreateSecurityGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/CreateSecurityGroupResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "securityGroup.projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "securityGroup", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Rule" + } + } + }, + "required": [ + "dataCenterId", + "id" + ] + } + } + ], + "tags": [ + "Networks" + ] + } + }, + "/v1/projects/{securityGroup.projectId}/networks/security-groups/{securityGroup.id}": { + "patch": { + "summary": "Update security group", + "operationId": "UpdateSecurityGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/UpdateSecurityGroupResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "securityGroup.projectId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "securityGroup.id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "securityGroup", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Rule" + } + } + }, + "required": [ + "dataCenterId" + ] + } + } + ], + "tags": [ + "Networks" + ] + } + }, + "/v1/regions": { + "get": { + "summary": "Regions", + "operationId": "ListRegions", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListRegionsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "tags": [ + "Search" + ] + } + }, + "/v1/ssh-keys": { + "get": { + "summary": "List", + "operationId": "ListSshKeys", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListSshKeysResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "pageNumber", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "SSH keys" + ] + }, + "post": { + "summary": "Create", + "operationId": "CreateSshKey", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/SshKey" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "sshKey", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SshKey" + } + } + ], + "tags": [ + "SSH keys" + ] + } + }, + "/v1/ssh-keys/{id}": { + "get": { + "summary": "Get", + "operationId": "GetSshKey", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/SshKey" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "SSH keys" + ] + }, + "delete": { + "summary": "Delete", + "operationId": "DeleteSshKey", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": {} + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "SSH keys" + ] + } + }, + "/v1/vms/data-centers": { + "get": { + "summary": "List data centers", + "operationId": "ListVMDataCenters", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListVMDataCentersResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "regionId", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "renewableEnergy", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/vms/machine-types": { + "get": { + "summary": "List machine types", + "operationId": "ListVMMachineTypes", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ListVMMachineTypesResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Status" + } + } + }, + "parameters": [ + { + "name": "cpuModel", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "gpu", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "gpuModel", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "gpuModelId", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "memoryGib", + "in": "query", + "required": true, + "type": "integer", + "format": "int32" + }, + { + "name": "orderBy", + "in": "query", + "required": false, + "type": "string" }, { + "name": "pageNumber", + "in": "query", + "required": false, "type": "integer", - "format": "int32", + "format": "int32" + }, + { "name": "pageSize", - "in": "query" + "in": "query", + "required": false, + "type": "integer", + "format": "int32" }, { - "type": "string", "name": "regionId", - "in": "query" + "in": "query", + "required": false, + "type": "string" }, { - "type": "integer", - "format": "int32", "name": "storageGib", - "in": "query" + "in": "query", + "required": false, + "type": "integer", + "format": "int32" }, { - "type": "integer", - "format": "int32", "name": "vcpu", "in": "query", - "required": true + "required": true, + "type": "integer", + "format": "int32" }, { - "type": "string", "name": "dataCenterId", - "in": "query" + "in": "query", + "required": false, + "type": "string" }, { - "type": "boolean", "name": "publicIpv4", - "in": "query" + "in": "query", + "required": false, + "type": "boolean" } ], + "tags": [ + "Virtual Machines" + ] + } + }, + "/v1/vms/machine-types-2": { + "get": { + "summary": "List machine types v2", + "operationId": "ListVMMachineTypes2", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/ListVMMachineTypesResponse" + "$ref": "#/definitions/ListVMMachineTypes2Response" } }, "default": { @@ -3205,14 +4147,14 @@ "$ref": "#/definitions/Status" } } - } + }, + "tags": [ + "Virtual Machines" + ] } }, "/v1/vms/public-images": { "get": { - "tags": [ - "Virtual Machines" - ], "summary": "List public VM images", "operationId": "ListPublicVMImages", "responses": { @@ -3228,47 +4170,367 @@ "$ref": "#/definitions/Status" } } - } + }, + "tags": [ + "Virtual Machines" + ] } } }, "definitions": { - "Any": { + "ActivateBody": { "type": "object", "properties": { - "@type": { + "dataCenterId": { + "type": "string" + } + } + }, + "AddBillingAccountUserPermissionBody": { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "dataCenterId": { + "type": "string" + }, + "userEmail": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/Role" + } + }, + "required": [ + "userEmail", + "role" + ] + }, + "AddDataCenterUserPermissionBody": { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "billingAccountId": { + "type": "string" + }, + "userEmail": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/Role" + } + }, + "required": [ + "userEmail", + "role" + ] + }, + "AddProjectUserPermissionBody": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "billingAccountId": { + "type": "string" + }, + "userEmail": { "type": "string" + }, + "role": { + "$ref": "#/definitions/Role" } }, - "additionalProperties": false + "required": [ + "userEmail", + "role" + ] }, "ApiKey": { "type": "object", "properties": { + "id": { + "type": "string", + "readOnly": true + }, + "createTime": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "key": { + "type": "string", + "readOnly": true + } + } + }, + "AttachSecurityGroupResponse": { + "type": "object" + }, + "AttachStorageDiskResponse": { + "type": "object" + }, + "BillingAccount": { + "type": "object", + "properties": { + "id": { + "type": "string", + "readOnly": true + }, + "createTime": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "supplyEnabled": { + "type": "boolean", + "readOnly": true + }, + "demandEnabled": { + "type": "boolean", + "readOnly": true + }, + "displayName": { + "type": "string" + }, + "stripeRef": { + "type": "string" + }, + "createBy": { + "type": "string", + "readOnly": true + }, + "monthlySpend": { + "type": "string" + }, + "taxIds": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/TaxId" + } + }, + "invoiceTime": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "billingThreshold": { + "$ref": "#/definitions/Decimal", + "readOnly": true + }, + "blocked": { + "type": "boolean", + "readOnly": true + } + } + }, + "BillingAccountPaymentMethod": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "card": { + "$ref": "#/definitions/PaymentMethodCard" + }, + "paypal": { + "$ref": "#/definitions/PaymentMethodPaypal" + }, + "isDefault": { + "type": "boolean" + } + } + }, + "BillingAccountPaymentMethods": { + "type": "object", + "properties": { + "paymentMethods": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/BillingAccountPaymentMethod" + } + } + } + }, + "BillingAccountSetupIntent": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "clientSecret": { + "type": "string" + } + }, + "required": [ + "id", + "clientSecret" + ] + }, + "BillingAccountSpendRow": { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "quantity": { + "type": "number", + "format": "float" + }, + "unit": { + "$ref": "#/definitions/Unit" + }, + "unitAmount": { + "$ref": "#/definitions/Decimal" + }, + "amount": { + "$ref": "#/definitions/Decimal" + } + }, + "required": [ + "projectId", + "description", + "quantity", + "unit", + "unitAmount", + "amount" + ] + }, + "Cluster": { + "type": "object", + "properties": { + "machineType": { + "type": "string" + }, + "cpuModel": { + "type": "string" + }, + "vcpuPerCpuThread": { + "type": "integer", + "format": "int32" + }, + "vcpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "memoryGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "gpuModel": { + "type": "string" + }, + "gpuModelId": { + "type": "string" + }, + "gpuModelPciTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "gpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "minVcpuPerMemoryGib": { + "type": "number", + "format": "double" + }, + "maxVcpuPerMemoryGib": { + "type": "number", + "format": "double" + }, + "minVcpuPerGpu": { + "type": "number", + "format": "double" + }, + "maxVcpuPerGpu": { + "type": "number", + "format": "double" + }, "createTime": { "type": "string", - "format": "date-time", - "readOnly": true + "format": "date-time" }, - "id": { + "updateTime": { "type": "string", - "readOnly": true + "format": "date-time" }, - "key": { - "type": "string", - "readOnly": true + "hostCount": { + "type": "integer", + "format": "int32" + }, + "hostProblemCount": { + "type": "integer", + "format": "int32" + }, + "vmCount": { + "type": "integer", + "format": "int32" + }, + "vcpuFree": { + "type": "integer", + "format": "int32" + }, + "vcpuUsed": { + "type": "integer", + "format": "int32" + }, + "memoryGibFree": { + "type": "integer", + "format": "int32" + }, + "memoryGibUsed": { + "type": "integer", + "format": "int32" + }, + "gpuFree": { + "type": "integer", + "format": "int32" + }, + "gpuUsed": { + "type": "integer", + "format": "int32" } - } - }, - "AttachStorageDiskResponse": { - "type": "object" + }, + "required": [ + "machineType", + "cpuModel", + "vcpuPerCpuThread", + "vcpuPriceHr", + "memoryGibPriceHr", + "gpuModel", + "gpuModelId", + "gpuModelPciTypes", + "gpuPriceHr", + "minVcpuPerMemoryGib", + "maxVcpuPerMemoryGib", + "minVcpuPerGpu", + "maxVcpuPerGpu", + "createTime", + "updateTime", + "hostCount", + "hostProblemCount", + "vmCount", + "vcpuFree", + "vcpuUsed", + "memoryGibFree", + "memoryGibUsed", + "gpuFree", + "gpuUsed" + ] }, "ConnectVMResponse": { "type": "object", - "required": [ - "connectUrl", - "token" - ], "properties": { "connectUrl": { "type": "string" @@ -3276,77 +4538,287 @@ "token": { "type": "string" } - } + }, + "required": [ + "connectUrl", + "token" + ] }, - "CountVMsResponse": { + "CountHostsResponse": { "type": "object", + "properties": { + "count": { + "type": "integer", + "format": "int32" + } + }, "required": [ "count" - ], + ] + }, + "CountVMsResponse": { + "type": "object", "properties": { "count": { "type": "integer", "format": "int32" } - } + }, + "required": [ + "count" + ] }, "CpuModelCategory": { "type": "object", + "properties": { + "name": { + "type": "string" + }, + "minPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "countVmAvailable": { + "type": "integer", + "format": "int32" + } + }, "required": [ "name", "minPriceHr", "countVmAvailable" - ], + ] + }, + "CpuTopology": { + "type": "object", "properties": { - "countVmAvailable": { + "sockets": { "type": "integer", "format": "int32" }, - "minPriceHr": { - "$ref": "#/definitions/Decimal" + "cores": { + "type": "integer", + "format": "int32" }, - "name": { - "type": "string" + "threads": { + "type": "integer", + "format": "int32" } } }, + "CreateBillingAccountRequest": { + "type": "object", + "properties": { + "displayName": { + "type": "string" + }, + "invoiceName": { + "type": "string" + }, + "email": { + "type": "string" + }, + "taxIds": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/TaxId" + } + }, + "referral": { + "type": "string" + } + }, + "required": [ + "displayName", + "invoiceName", + "email" + ] + }, + "CreateDiskSnapshotBody": { + "type": "object", + "properties": { + "snapshotId": { + "type": "string" + }, + "vmId": { + "type": "string" + } + }, + "required": [ + "snapshotId", + "vmId" + ] + }, "CreateDiskSnapshotResponse": { "type": "object" }, + "CreateNetworkBody": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "cidrPrefix": { + "type": "string" + }, + "vrouterSize": { + "$ref": "#/definitions/v1.VRouterSize" + } + }, + "required": [ + "dataCenterId", + "id", + "cidrPrefix" + ] + }, "CreateNetworkResponse": { "type": "object" }, + "CreateObjectStorageUserBody": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, "CreatePrivateVMImageResponse": { "type": "object", "properties": { "image": { "$ref": "#/definitions/v1.PrivateImage" } - } - }, - "CreateSecurityGroupResponse": { - "type": "object", + } + }, + "CreateSecurityGroupResponse": { + "type": "object", + "properties": { + "securityGroup": { + "$ref": "#/definitions/SecurityGroup" + } + }, + "required": [ + "securityGroup" + ] + }, + "CreateStorageDiskBody": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "disk": { + "$ref": "#/definitions/Disk" + } + } + }, + "CreateStorageDiskResponse": { + "type": "object" + }, + "CreateVMBody": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "machineType": { + "type": "string" + }, + "vmId": { + "type": "string" + }, + "startScript": { + "type": "string" + }, + "sshKeySource": { + "$ref": "#/definitions/SshKeySource" + }, + "customSshKeys": { + "type": "array", + "items": { + "type": "string" + } + }, + "password": { + "type": "string" + }, + "bootDisk": { + "$ref": "#/definitions/Disk" + }, + "bootDiskImageId": { + "type": "string" + }, + "vcpus": { + "type": "integer", + "format": "int32" + }, + "memoryGib": { + "type": "integer", + "format": "int32" + }, + "gpus": { + "type": "integer", + "format": "int32" + }, + "cpuModel": { + "type": "string" + }, + "gpuModel": { + "type": "string" + }, + "gpuModelId": { + "type": "string" + }, + "maxPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "nics": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/CreateVMRequest.NIC" + } + }, + "securityGroupIds": { + "type": "array", + "items": { + "type": "string" + }, + "title": "ignored if any nics are provided" + }, + "storageDiskIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "topology": { + "$ref": "#/definitions/CpuTopology" + } + }, "required": [ - "securityGroup" - ], - "properties": { - "securityGroup": { - "$ref": "#/definitions/SecurityGroup" - } - } - }, - "CreateStorageDiskResponse": { - "type": "object" + "vmId", + "bootDiskImageId" + ] }, "CreateVMRequest.NIC": { "type": "object", "properties": { - "assignPublicIp": { - "type": "boolean" - }, "networkId": { "type": "string" }, + "assignPublicIp": { + "type": "boolean" + }, "securityGroupIds": { "type": "array", "items": { @@ -3357,9 +4829,6 @@ }, "CreateVMResponse": { "type": "object", - "required": [ - "id" - ], "properties": { "id": { "type": "string" @@ -3367,41 +4836,118 @@ "vm": { "$ref": "#/definitions/VM" } - } + }, + "required": [ + "id" + ] }, "DataCenterCategory": { "type": "object", + "properties": { + "id": { + "type": "string" + }, + "minPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "countVmAvailable": { + "type": "integer", + "format": "int32" + }, + "renewableEnergy": { + "type": "boolean" + } + }, "required": [ "id", "minPriceHr", "countVmAvailable", "renewableEnergy" - ], + ] + }, + "DataCenterMachineType": { + "type": "object", "properties": { - "countVmAvailable": { + "machineType": { + "type": "string" + }, + "countClusters": { "type": "integer", "format": "int32" }, - "id": { + "countHosts": { + "type": "integer", + "format": "int32" + }, + "countHostsActive": { + "type": "integer", + "format": "int32" + }, + "countHostsInactive": { + "type": "integer", + "format": "int32" + } + }, + "required": [ + "machineType", + "countClusters", + "countHosts", + "countHostsActive", + "countHostsInactive" + ] + }, + "DataCenterRevenueResource": { + "type": "object", + "properties": { + "resourceType": { "type": "string" }, - "minPriceHr": { + "resourceId": { + "type": "string" + }, + "quantity": { "$ref": "#/definitions/Decimal" }, - "renewableEnergy": { - "type": "boolean" + "unit": { + "type": "string" + }, + "revenueUsd": { + "$ref": "#/definitions/Decimal" } - } + }, + "required": [ + "resourceType", + "resourceId", + "quantity", + "unit", + "revenueUsd" + ] + }, + "DataCenterTimeRevenue": { + "type": "object", + "properties": { + "time": { + "type": "string", + "format": "date-time" + }, + "revenueUsd": { + "$ref": "#/definitions/Decimal" + } + }, + "required": [ + "time", + "revenueUsd" + ] }, "Decimal": { - "description": "A representation of a decimal value, such as 2.5. Clients may convert values\ninto language-native decimal formats, such as Java's [BigDecimal][] or\nPython's [decimal.Decimal][].\n\n[BigDecimal]:\nhttps://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html\n[decimal.Decimal]: https://docs.python.org/3/library/decimal.html", "type": "object", "properties": { "value": { - "description": "The decimal value, as a string.\n\nThe string representation consists of an optional sign, `+` (`U+002B`)\nor `-` (`U+002D`), followed by a sequence of zero or more decimal digits\n(\"the integer\"), optionally followed by a fraction, optionally followed\nby an exponent.\n\nThe fraction consists of a decimal point followed by zero or more decimal\ndigits. The string must contain at least one digit in either the integer\nor the fraction. The number formed by the sign, the integer and the\nfraction is referred to as the significand.\n\nThe exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)\nfollowed by one or more decimal digits.\n\nServices **should** normalize decimal values before storing them by:\n\n - Removing an explicitly-provided `+` sign (`+2.5` -\u003e `2.5`).\n - Replacing a zero-length integer value with `0` (`.5` -\u003e `0.5`).\n - Coercing the exponent character to lower-case (`2.5E8` -\u003e `2.5e8`).\n - Removing an explicitly-provided zero exponent (`2.5e0` -\u003e `2.5`).\n\nServices **may** perform additional normalization based on its own needs\nand the internal decimal implementation selected, such as shifting the\ndecimal point and exponent value together (example: `2.5e-1` \u003c-\u003e `0.25`).\nAdditionally, services **may** preserve trailing zeroes in the fraction\nto indicate increased precision, but are not required to do so.\n\nNote that only the `.` character is supported to divide the integer\nand the fraction; `,` **should not** be supported regardless of locale.\nAdditionally, thousand separators **should not** be supported. If a\nservice does support them, values **must** be normalized.\n\nThe ENBF grammar is:\n\n DecimalString =\n [Sign] Significand [Exponent];\n\n Sign = '+' | '-';\n\n Significand =\n Digits ['.'] [Digits] | [Digits] '.' Digits;\n\n Exponent = ('e' | 'E') [Sign] Digits;\n\n Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };\n\nServices **should** clearly document the range of supported values, the\nmaximum supported precision (total number of digits), and, if applicable,\nthe scale (number of digits after the decimal point), as well as how it\nbehaves when receiving out-of-bounds values.\n\nServices **may** choose to accept values passed as input even when the\nvalue has a higher precision or scale than the service supports, and\n**should** round the value to fit the supported scale. Alternatively, the\nservice **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)\nif precision would be lost.\n\nServices **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in\ngRPC) if the service receives a value outside of the supported range.", - "type": "string" + "type": "string", + "description": "The decimal value, as a string.\n\nThe string representation consists of an optional sign, `+` (`U+002B`)\nor `-` (`U+002D`), followed by a sequence of zero or more decimal digits\n(\"the integer\"), optionally followed by a fraction, optionally followed\nby an exponent.\n\nThe fraction consists of a decimal point followed by zero or more decimal\ndigits. The string must contain at least one digit in either the integer\nor the fraction. The number formed by the sign, the integer and the\nfraction is referred to as the significand.\n\nThe exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)\nfollowed by one or more decimal digits.\n\nServices **should** normalize decimal values before storing them by:\n\n - Removing an explicitly-provided `+` sign (`+2.5` -\u003e `2.5`).\n - Replacing a zero-length integer value with `0` (`.5` -\u003e `0.5`).\n - Coercing the exponent character to lower-case (`2.5E8` -\u003e `2.5e8`).\n - Removing an explicitly-provided zero exponent (`2.5e0` -\u003e `2.5`).\n\nServices **may** perform additional normalization based on its own needs\nand the internal decimal implementation selected, such as shifting the\ndecimal point and exponent value together (example: `2.5e-1` \u003c-\u003e `0.25`).\nAdditionally, services **may** preserve trailing zeroes in the fraction\nto indicate increased precision, but are not required to do so.\n\nNote that only the `.` character is supported to divide the integer\nand the fraction; `,` **should not** be supported regardless of locale.\nAdditionally, thousand separators **should not** be supported. If a\nservice does support them, values **must** be normalized.\n\nThe ENBF grammar is:\n\n DecimalString =\n [Sign] Significand [Exponent];\n\n Sign = '+' | '-';\n\n Significand =\n Digits ['.'] [Digits] | [Digits] '.' Digits;\n\n Exponent = ('e' | 'E') [Sign] Digits;\n\n Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };\n\nServices **should** clearly document the range of supported values, the\nmaximum supported precision (total number of digits), and, if applicable,\nthe scale (number of digits after the decimal point), as well as how it\nbehaves when receiving out-of-bounds values.\n\nServices **may** choose to accept values passed as input even when the\nvalue has a higher precision or scale than the service supports, and\n**should** round the value to fit the supported scale. Alternatively, the\nservice **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)\nif precision would be lost.\n\nServices **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in\ngRPC) if the service receives a value outside of the supported range." } - } + }, + "description": "A representation of a decimal value, such as 2.5. Clients may convert values\ninto language-native decimal formats, such as Java's [BigDecimal][] or\nPython's [decimal.Decimal][].\n\n[BigDecimal]:\nhttps://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html\n[decimal.Decimal]: https://docs.python.org/3/library/decimal.html" }, "DeleteDiskSnapshotResponse": { "type": "object" @@ -3424,73 +4970,75 @@ "DeleteStorageDiskResponse": { "type": "object" }, + "DetachSecurityGroupResponse": { + "type": "object" + }, "DetachStorageDiskResponse": { "type": "object" }, "Disk": { "type": "object", - "required": [ - "id", - "sizeGib" - ], "properties": { - "createTime": { + "id": { + "type": "string" + }, + "projectId": { "type": "string", - "format": "date-time", "readOnly": true }, "dataCenterId": { "type": "string", "readOnly": true }, - "diskState": { - "$ref": "#/definitions/DiskState", + "vmId": { + "type": "string", "readOnly": true }, + "sizeGib": { + "type": "integer", + "format": "int32" + }, + "storageClass": { + "$ref": "#/definitions/Disk.StorageClass" + }, "diskType": { "$ref": "#/definitions/DiskType", "readOnly": true }, - "id": { - "type": "string" - }, - "privateImageId": { + "publicImageId": { "type": "string", "readOnly": true }, - "projectId": { + "privateImageId": { "type": "string", "readOnly": true }, - "publicImageId": { + "createTime": { "type": "string", + "format": "date-time", "readOnly": true }, - "sizeGib": { - "type": "integer", - "format": "int32" - }, - "storageClass": { - "$ref": "#/definitions/Disk.StorageClass" - }, - "vmId": { - "type": "string", + "diskState": { + "$ref": "#/definitions/DiskState", "readOnly": true } - } + }, + "required": [ + "id", + "sizeGib" + ] }, "Disk.StorageClass": { "type": "string", - "default": "STORAGE_CLASS_UNKNOWN", "enum": [ "STORAGE_CLASS_UNKNOWN", "STORAGE_CLASS_LOCAL", "STORAGE_CLASS_NETWORK" - ] + ], + "default": "STORAGE_CLASS_UNKNOWN" }, "DiskState": { "type": "string", - "default": "DISK_STATE_INIT", "enum": [ "DISK_STATE_INIT", "DISK_STATE_READY", @@ -3500,42 +5048,194 @@ "DISK_STATE_ERROR", "DISK_STATE_CLONE", "DISK_STATE_DELETE" + ], + "default": "DISK_STATE_INIT" + }, + "DiskStoragePriceHr": { + "type": "object", + "properties": { + "storageClass": { + "$ref": "#/definitions/VMDataCenter.StorageClass" + }, + "diskGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "snapshotGibPriceHr": { + "$ref": "#/definitions/Decimal" + } + } + }, + "DiskType": { + "type": "string", + "enum": [ + "DISK_TYPE_UNKNOWN", + "DISK_TYPE_BOOT", + "DISK_TYPE_STORAGE" + ], + "default": "DISK_TYPE_UNKNOWN" + }, + "GenerateApiKeyRequest": { + "type": "object", + "properties": { + "apikeyId": { + "type": "string", + "description": "The identifier to use for the api key, which will become the final component of\nthe api key's resource name.\nThis value should be 4-63 characters, and valid characters\nare /[a-z][0-9]-/." + } + }, + "required": [ + "apikeyId" + ] + }, + "GetBillingAccountDetailsResponse": { + "type": "object", + "properties": { + "billingAccount": { + "$ref": "#/definitions/BillingAccount" + }, + "stripeCustomer": { + "$ref": "#/definitions/StripeCustomer" + } + }, + "required": [ + "billingAccount", + "stripeCustomer" + ] + }, + "GetBillingAccountSpendDetailsResponse": { + "type": "object", + "properties": { + "spend": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/BillingAccountSpendRow" + } + } + }, + "required": [ + "spend" + ] + }, + "GetBillingAccountStripeInvoicesResponse": { + "type": "object", + "properties": { + "invoices": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Invoice" + } + }, + "hasMore": { + "type": "boolean" + } + }, + "required": [ + "invoices", + "hasMore" + ] + }, + "GetDataCenterLiveUtilizationResponse": { + "type": "object", + "properties": { + "utilization": { + "type": "number", + "format": "float" + }, + "vcpuUsed": { + "type": "integer", + "format": "int32" + }, + "vcpuFree": { + "type": "integer", + "format": "int32" + }, + "vcpuTotal": { + "type": "integer", + "format": "int32" + }, + "cpuUtilization": { + "type": "number", + "format": "float" + }, + "memoryGibUsed": { + "type": "integer", + "format": "int32" + }, + "memoryGibFree": { + "type": "integer", + "format": "int32" + }, + "memoryGibTotal": { + "type": "integer", + "format": "int32" + }, + "memoryUtilization": { + "type": "number", + "format": "float" + }, + "gpuUsed": { + "type": "integer", + "format": "int32" + }, + "gpuFree": { + "type": "integer", + "format": "int32" + }, + "gpuTotal": { + "type": "integer", + "format": "int32" + }, + "gpuUtilization": { + "type": "number", + "format": "float" + } + }, + "required": [ + "utilization", + "vcpuUsed", + "vcpuFree", + "vcpuTotal", + "cpuUtilization", + "memoryGibUsed", + "memoryGibFree", + "memoryGibTotal", + "memoryUtilization", + "gpuUsed", + "gpuFree", + "gpuTotal", + "gpuUtilization" ] }, - "DiskStoragePriceHr": { + "GetDataCenterRevenueByResourceResponse": { "type": "object", "properties": { - "diskGibPriceHr": { - "$ref": "#/definitions/Decimal" - }, - "snapshotGibPriceHr": { - "$ref": "#/definitions/Decimal" - }, - "storageClass": { - "$ref": "#/definitions/VMDataCenter.StorageClass" + "resources": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/DataCenterRevenueResource" + } } - } - }, - "DiskType": { - "type": "string", - "default": "DISK_TYPE_UNKNOWN", - "enum": [ - "DISK_TYPE_UNKNOWN", - "DISK_TYPE_BOOT", - "DISK_TYPE_STORAGE" + }, + "required": [ + "resources" ] }, - "GenerateApiKeyRequest": { + "GetDataCenterRevenueTimeSeriesResponse": { "type": "object", - "required": [ - "apikeyId" - ], "properties": { - "apikeyId": { - "description": "The identifier to use for the api key, which will become the final component of\nthe api key's resource name.\nThis value should be 4-63 characters, and valid characters\nare /[a-z][0-9]-/.", - "type": "string" + "timeRevenue": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/DataCenterTimeRevenue" + } } - } + }, + "required": [ + "timeRevenue" + ] }, "GetDiskResponse": { "type": "object", @@ -3552,33 +5252,198 @@ } } }, - "GetNetworkResponse": { + "GetMachineTypeLiveUtilizationResponse": { "type": "object", + "properties": { + "utilization": { + "type": "number", + "format": "float" + }, + "vcpuUsed": { + "type": "integer", + "format": "int32" + }, + "vcpuFree": { + "type": "integer", + "format": "int32" + }, + "vcpuTotal": { + "type": "integer", + "format": "int32" + }, + "cpuUtilization": { + "type": "number", + "format": "float" + }, + "memoryGibUsed": { + "type": "integer", + "format": "int32" + }, + "memoryGibFree": { + "type": "integer", + "format": "int32" + }, + "memoryGibTotal": { + "type": "integer", + "format": "int32" + }, + "memoryUtilization": { + "type": "number", + "format": "float" + }, + "gpuUsed": { + "type": "integer", + "format": "int32" + }, + "gpuFree": { + "type": "integer", + "format": "int32" + }, + "gpuTotal": { + "type": "integer", + "format": "int32" + }, + "gpuUtilization": { + "type": "number", + "format": "float" + } + }, "required": [ - "network" - ], + "utilization", + "vcpuUsed", + "vcpuFree", + "vcpuTotal", + "cpuUtilization", + "memoryGibUsed", + "memoryGibFree", + "memoryGibTotal", + "memoryUtilization", + "gpuUsed", + "gpuFree", + "gpuTotal", + "gpuUtilization" + ] + }, + "GetMachineTypeResponse": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "machineType": { + "type": "string" + }, + "cpuModels": { + "type": "array", + "items": { + "type": "string" + } + }, + "gpuModels": { + "type": "array", + "items": { + "type": "string" + } + }, + "minVcpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "maxVcpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "minMemoryGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "maxMemoryGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "minGpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "maxGpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "minVcpuPerMemoryGib": { + "type": "number", + "format": "double" + }, + "maxVcpuPerMemoryGib": { + "type": "number", + "format": "double" + }, + "minVcpuPerGpu": { + "type": "number", + "format": "double" + }, + "maxVcpuPerGpu": { + "type": "number", + "format": "double" + }, + "countClusters": { + "type": "integer", + "format": "int32" + }, + "countHosts": { + "type": "integer", + "format": "int32" + }, + "countHostsActive": { + "type": "integer", + "format": "int32" + }, + "countHostsInactive": { + "type": "integer", + "format": "int32" + } + }, + "required": [ + "dataCenterId", + "machineType", + "cpuModels", + "gpuModels", + "minVcpuPriceHr", + "maxVcpuPriceHr", + "minMemoryGibPriceHr", + "maxMemoryGibPriceHr", + "minGpuPriceHr", + "maxGpuPriceHr", + "minVcpuPerMemoryGib", + "maxVcpuPerMemoryGib", + "minVcpuPerGpu", + "maxVcpuPerGpu", + "countClusters", + "countHosts", + "countHostsActive", + "countHostsInactive" + ] + }, + "GetNetworkResponse": { + "type": "object", "properties": { "network": { "$ref": "#/definitions/Network" } - } + }, + "required": [ + "network" + ] }, "GetObjectStorageSessionKeyResponse": { "type": "object", "properties": { - "accessKey": { + "sessionName": { "type": "string" }, - "endpoint": { + "accessKey": { "type": "string" }, "secretKey": { "type": "string" }, - "sessionName": { + "sessionToken": { "type": "string" }, - "sessionToken": { + "endpoint": { "type": "string" } } @@ -3591,202 +5456,495 @@ } } }, - "GetSecurityGroupResponse": { + "GetResponse": { "type": "object", + "properties": { + "task": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Task" + } + } + }, "required": [ - "securityGroup" - ], + "task" + ] + }, + "GetSecurityGroupResponse": { + "type": "object", "properties": { "securityGroup": { "$ref": "#/definitions/SecurityGroup" } - } + }, + "required": [ + "securityGroup" + ] }, "GetVMResponse": { "type": "object", - "required": [ - "VM" - ], "properties": { "VM": { "$ref": "#/definitions/VM" + }, + "vcpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "totalVcpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "memoryGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "totalMemoryPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "gpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "totalGpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "storageGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "totalStoragePriceHr": { + "$ref": "#/definitions/Decimal" + }, + "ipv4PriceHr": { + "$ref": "#/definitions/Decimal" + }, + "totalPriceHr": { + "$ref": "#/definitions/Decimal" } - } + }, + "required": [ + "VM", + "vcpuPriceHr", + "totalVcpuPriceHr", + "memoryGibPriceHr", + "totalMemoryPriceHr", + "gpuPriceHr", + "totalGpuPriceHr", + "storageGibPriceHr", + "totalStoragePriceHr", + "ipv4PriceHr", + "totalPriceHr" + ] }, "GpuModelCategory": { "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "minPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "countVmAvailable": { + "type": "integer", + "format": "int32" + }, + "maxFree": { + "type": "integer", + "format": "int32" + }, + "totalFree": { + "type": "integer", + "format": "int32" + } + }, "required": [ + "id", "name", "minPriceHr", - "countVmAvailable" - ], + "countVmAvailable", + "maxFree", + "totalFree" + ] + }, + "Host": { + "type": "object", "properties": { - "countVmAvailable": { + "machineType": { + "type": "string" + }, + "cpuModel": { + "type": "string" + }, + "vcpuPerCpuThread": { "type": "integer", "format": "int32" }, - "minPriceHr": { - "$ref": "#/definitions/Decimal" + "gpuModel": { + "type": "string" + }, + "gpuModelId": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" + }, + "updateTime": { + "type": "string", + "format": "date-time" + }, + "vmCount": { + "type": "integer", + "format": "int32" + }, + "vcpuFree": { + "type": "integer", + "format": "int32" + }, + "vcpuUsed": { + "type": "integer", + "format": "int32" + }, + "memoryGibFree": { + "type": "integer", + "format": "int32" + }, + "memoryGibUsed": { + "type": "integer", + "format": "int32" + }, + "gpuFree": { + "type": "integer", + "format": "int32" + }, + "gpuUsed": { + "type": "integer", + "format": "int32" + }, + "online": { + "type": "boolean" }, "name": { "type": "string" } - } - }, - "HostConfigCategory": { - "type": "object", + }, "required": [ - "id", + "machineType", "cpuModel", + "vcpuPerCpuThread", "gpuModel", - "dataCenterId", - "vcpuPriceHr", - "totalVcpuPriceHr", - "memoryGibPriceHr", - "totalMemoryPriceHr", - "gpuPriceHr", - "totalGpuPriceHr", - "storageGibPriceHr", - "totalStoragePriceHr", - "totalPriceHr", - "countVmAvailable", - "machineType", - "renewableEnergy", - "ipv4PriceHr" - ], + "gpuModelId", + "createTime", + "updateTime", + "vmCount", + "vcpuFree", + "vcpuUsed", + "memoryGibFree", + "memoryGibUsed", + "gpuFree", + "gpuUsed", + "online", + "name" + ] + }, + "HostConfigCategory": { + "type": "object", "properties": { - "countVmAvailable": { - "type": "integer", - "format": "int32" - }, - "cpuModel": { + "id": { "type": "string" }, - "dataCenterId": { + "cpuModel": { "type": "string" }, "gpuModel": { "type": "string" }, - "gpuPriceHr": { - "$ref": "#/definitions/Decimal" + "gpuModelId": { + "type": "string" }, - "id": { + "dataCenterId": { "type": "string" }, - "ipv4PriceHr": { + "vcpuPriceHr": { "$ref": "#/definitions/Decimal" }, - "machineType": { - "type": "string" + "totalVcpuPriceHr": { + "$ref": "#/definitions/Decimal" }, "memoryGibPriceHr": { "$ref": "#/definitions/Decimal" }, - "renewableEnergy": { - "type": "boolean" - }, - "storageGibPriceHr": { + "totalMemoryPriceHr": { "$ref": "#/definitions/Decimal" }, - "totalGpuPriceHr": { + "gpuPriceHr": { "$ref": "#/definitions/Decimal" }, - "totalMemoryPriceHr": { + "totalGpuPriceHr": { "$ref": "#/definitions/Decimal" }, - "totalPriceHr": { + "storageGibPriceHr": { "$ref": "#/definitions/Decimal" }, "totalStoragePriceHr": { "$ref": "#/definitions/Decimal" }, - "totalVcpuPriceHr": { + "totalPriceHr": { "$ref": "#/definitions/Decimal" }, - "vcpuPriceHr": { + "countVmAvailable": { + "type": "integer", + "format": "int32" + }, + "machineType": { + "type": "string" + }, + "renewableEnergy": { + "type": "boolean" + }, + "ipv4PriceHr": { "$ref": "#/definitions/Decimal" } - } + }, + "required": [ + "id", + "cpuModel", + "gpuModel", + "gpuModelId", + "dataCenterId", + "vcpuPriceHr", + "totalVcpuPriceHr", + "memoryGibPriceHr", + "totalMemoryPriceHr", + "gpuPriceHr", + "totalGpuPriceHr", + "storageGibPriceHr", + "totalStoragePriceHr", + "totalPriceHr", + "countVmAvailable", + "machineType", + "renewableEnergy", + "ipv4PriceHr" + ] }, "IdentityVerificationSession": { "type": "object", "properties": { - "clientSecret": { + "id": { "type": "string" }, - "id": { + "clientSecret": { "type": "string" } } }, "Image": { "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "platform": { + "type": "string" + }, + "sizeGib": { + "type": "integer", + "format": "int32" + }, + "installedPackages": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Package" + } + } + }, "required": [ "id", "name", "description", "displayName", "platform", - "sizeGib" + "sizeGib", + "installedPackages" + ] + }, + "Interval": { + "type": "string", + "enum": [ + "INTERVAL_UNKNOWN", + "INTERVAL_DAY", + "INTERVAL_WEEK", + "INTERVAL_MONTH" ], + "default": "INTERVAL_UNKNOWN" + }, + "Invoice": { + "type": "object", "properties": { + "id": { + "type": "string" + }, + "amountDue": { + "type": "string", + "format": "int64" + }, + "amountPaid": { + "type": "string", + "format": "int64" + }, + "amountRemaining": { + "type": "string", + "format": "int64" + }, + "created": { + "type": "string", + "format": "int64" + }, "description": { "type": "string" }, - "displayName": { + "currency": { "type": "string" }, - "id": { + "hostedInvoiceUrl": { "type": "string" }, - "name": { + "status": { "type": "string" }, - "platform": { + "dueDate": { + "type": "string", + "format": "int64" + }, + "paidDate": { + "type": "string", + "format": "int64" + }, + "billingReason": { "type": "string" }, - "sizeGib": { + "autoAdvance": { + "type": "boolean" + }, + "periodStart": { + "type": "string", + "format": "int64" + }, + "periodEnd": { + "type": "string", + "format": "int64" + }, + "number": { + "type": "string" + } + } + }, + "ListApiKeysResponse": { + "type": "object", + "properties": { + "apiKeys": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/ApiKey" + } + }, + "totalCount": { + "type": "integer", + "format": "int32" + }, + "pageNumber": { + "type": "integer", + "format": "int32" + }, + "pageSize": { "type": "integer", "format": "int32" } - } + }, + "required": [ + "apiKeys", + "totalCount", + "pageNumber", + "pageSize" + ] + }, + "ListBillingAccountsResponse": { + "type": "object", + "properties": { + "billingAccounts": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/BillingAccount" + } + }, + "pageToken": { + "type": "string" + }, + "pageSize": { + "type": "integer", + "format": "int32" + } + }, + "required": [ + "billingAccounts", + "pageToken", + "pageSize" + ] }, - "ListApiKeysResponse": { + "ListClustersResponse": { "type": "object", + "properties": { + "clusters": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Cluster" + } + } + }, "required": [ - "apiKeys", - "totalCount", - "pageNumber", - "pageSize" - ], + "clusters" + ] + }, + "ListDataCentersResponse": { + "type": "object", "properties": { - "apiKeys": { + "dataCenters": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/ApiKey" + "$ref": "#/definitions/v1.DataCenter" } }, - "pageNumber": { - "type": "integer", - "format": "int32" + "pageToken": { + "type": "string" }, "pageSize": { "type": "integer", "format": "int32" - }, - "totalCount": { - "type": "integer", - "format": "int32" } - } + }, + "required": [ + "dataCenters", + "pageToken", + "pageSize" + ] }, "ListDiskSnapshotsResponse": { "type": "object", - "required": [ - "snapshots" - ], "properties": { "snapshots": { "type": "array", @@ -3795,15 +5953,13 @@ "$ref": "#/definitions/Snapshot" } } - } + }, + "required": [ + "snapshots" + ] }, "ListDisksResponse": { "type": "object", - "required": [ - "totalCount", - "pageNumber", - "pageSize" - ], "properties": { "disks": { "type": "array", @@ -3812,28 +5968,57 @@ "$ref": "#/definitions/Disk" } }, - "pageNumber": { + "totalCount": { "type": "integer", "format": "int32" }, - "pageSize": { + "pageNumber": { "type": "integer", "format": "int32" }, - "totalCount": { + "pageSize": { "type": "integer", "format": "int32" } - } - }, - "ListNetworksResponse": { - "type": "object", + }, "required": [ - "networks", "totalCount", "pageNumber", "pageSize" - ], + ] + }, + "ListHostsResponse": { + "type": "object", + "properties": { + "hosts": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Host" + } + } + }, + "required": [ + "hosts" + ] + }, + "ListMachineTypesResponse": { + "type": "object", + "properties": { + "machineTypes": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/DataCenterMachineType" + } + } + }, + "required": [ + "machineTypes" + ] + }, + "ListNetworksResponse": { + "type": "object", "properties": { "networks": { "type": "array", @@ -3842,28 +6027,28 @@ "$ref": "#/definitions/Network" } }, - "pageNumber": { + "totalCount": { "type": "integer", "format": "int32" }, - "pageSize": { + "pageNumber": { "type": "integer", "format": "int32" }, - "totalCount": { + "pageSize": { "type": "integer", "format": "int32" } - } - }, - "ListObjectStorageBucketsResponse": { - "type": "object", + }, "required": [ - "buckets", + "networks", "totalCount", "pageNumber", "pageSize" - ], + ] + }, + "ListObjectStorageBucketsResponse": { + "type": "object", "properties": { "buckets": { "type": "array", @@ -3872,28 +6057,28 @@ "$ref": "#/definitions/ObjectStorageBucket" } }, - "pageNumber": { + "totalCount": { "type": "integer", "format": "int32" }, - "pageSize": { + "pageNumber": { "type": "integer", "format": "int32" }, - "totalCount": { + "pageSize": { "type": "integer", "format": "int32" } - } - }, - "ListObjectStorageKeysResponse": { - "type": "object", + }, "required": [ - "keys", + "buckets", "totalCount", "pageNumber", "pageSize" - ], + ] + }, + "ListObjectStorageKeysResponse": { + "type": "object", "properties": { "keys": { "type": "array", @@ -3902,57 +6087,73 @@ "$ref": "#/definitions/ObjectStorageKey" } }, - "pageNumber": { + "totalCount": { "type": "integer", "format": "int32" }, - "pageSize": { + "pageNumber": { "type": "integer", "format": "int32" }, - "totalCount": { + "pageSize": { "type": "integer", "format": "int32" } - } - }, - "ListObjectStorageUsersResponse": { - "type": "object", + }, "required": [ - "users", + "keys", "totalCount", "pageNumber", "pageSize" - ], + ] + }, + "ListObjectStorageUsersResponse": { + "type": "object", "properties": { - "pageNumber": { + "users": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/ObjectStorageUser" + } + }, + "totalCount": { "type": "integer", "format": "int32" }, - "pageSize": { + "pageNumber": { "type": "integer", "format": "int32" }, - "totalCount": { + "pageSize": { "type": "integer", "format": "int32" - }, - "users": { + } + }, + "required": [ + "users", + "totalCount", + "pageNumber", + "pageSize" + ] + }, + "ListOutstandingStripeInvoicesResponse": { + "type": "object", + "properties": { + "invoices": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/ObjectStorageUser" + "$ref": "#/definitions/Invoice" } } - } + }, + "required": [ + "invoices" + ] }, "ListPrivateVMImagesResponse": { "type": "object", - "required": [ - "totalCount", - "pageNumber", - "pageSize" - ], "properties": { "images": { "type": "array", @@ -3961,33 +6162,38 @@ "$ref": "#/definitions/ListPrivateVMImagesResponse.PrivateImage" } }, - "pageNumber": { + "totalCount": { "type": "integer", "format": "int32" }, - "pageSize": { + "pageNumber": { "type": "integer", "format": "int32" }, - "totalCount": { + "pageSize": { "type": "integer", "format": "int32" } - } + }, + "required": [ + "totalCount", + "pageNumber", + "pageSize" + ] }, "ListPrivateVMImagesResponse.PrivateImage": { "type": "object", "properties": { - "dataCenterId": { + "projectId": { "type": "string" }, - "description": { + "id": { "type": "string" }, - "id": { + "dataCenterId": { "type": "string" }, - "projectId": { + "description": { "type": "string" }, "sizeGib": { @@ -3998,9 +6204,6 @@ }, "ListProjectSshKeysResponse": { "type": "object", - "required": [ - "sshKeys" - ], "properties": { "sshKeys": { "type": "array", @@ -4009,37 +6212,37 @@ "$ref": "#/definitions/SshKey" } } - } + }, + "required": [ + "sshKeys" + ] }, "ListProjectsResponse": { "type": "object", - "required": [ - "projects", - "pageToken", - "pageSize" - ], "properties": { - "pageSize": { - "type": "integer", - "format": "int32" - }, - "pageToken": { - "type": "string" - }, "projects": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/Project" } + }, + "pageToken": { + "type": "string" + }, + "pageSize": { + "type": "integer", + "format": "int32" } - } + }, + "required": [ + "projects", + "pageToken", + "pageSize" + ] }, "ListPublicVMImagesResponse": { "type": "object", - "required": [ - "images" - ], "properties": { "images": { "type": "array", @@ -4048,13 +6251,13 @@ "$ref": "#/definitions/Image" } } - } + }, + "required": [ + "images" + ] }, "ListRegionsResponse": { "type": "object", - "required": [ - "regions" - ], "properties": { "regions": { "type": "array", @@ -4063,25 +6266,14 @@ "$ref": "#/definitions/Region" } } - } - }, - "ListSecurityGroupsResponse": { - "type": "object", + }, "required": [ - "securityGroups", - "totalCount", - "pageNumber", - "pageSize" - ], + "regions" + ] + }, + "ListSecurityGroupsResponse": { + "type": "object", "properties": { - "pageNumber": { - "type": "integer", - "format": "int32" - }, - "pageSize": { - "type": "integer", - "format": "int32" - }, "securityGroups": { "type": "array", "items": { @@ -4092,18 +6284,7 @@ "totalCount": { "type": "integer", "format": "int32" - } - } - }, - "ListSshKeysResponse": { - "type": "object", - "required": [ - "sshKeys", - "totalCount", - "pageNumber", - "pageSize" - ], - "properties": { + }, "pageNumber": { "type": "integer", "format": "int32" @@ -4111,7 +6292,18 @@ "pageSize": { "type": "integer", "format": "int32" - }, + } + }, + "required": [ + "securityGroups", + "totalCount", + "pageNumber", + "pageSize" + ] + }, + "ListSshKeysResponse": { + "type": "object", + "properties": { "sshKeys": { "type": "array", "items": { @@ -4122,18 +6314,27 @@ "totalCount": { "type": "integer", "format": "int32" + }, + "pageNumber": { + "type": "integer", + "format": "int32" + }, + "pageSize": { + "type": "integer", + "format": "int32" } - } + }, + "required": [ + "sshKeys", + "totalCount", + "pageNumber", + "pageSize" + ] }, "ListUserPermissionsResponse": { "type": "object", - "required": [ - "projectPermissions", - "dataCenterPermissions", - "billingAccountPermissions" - ], "properties": { - "billingAccountPermissions": { + "projectPermissions": { "type": "array", "items": { "type": "object", @@ -4147,20 +6348,22 @@ "$ref": "#/definitions/UserPermission" } }, - "projectPermissions": { + "billingAccountPermissions": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/UserPermission" } } - } + }, + "required": [ + "projectPermissions", + "dataCenterPermissions", + "billingAccountPermissions" + ] }, "ListVMDataCentersResponse": { "type": "object", - "required": [ - "dataCenters" - ], "properties": { "dataCenters": { "type": "array", @@ -4169,7 +6372,10 @@ "$ref": "#/definitions/VMDataCenter" } } - } + }, + "required": [ + "dataCenters" + ] }, "ListVMDisksResponse": { "type": "object", @@ -4183,19 +6389,27 @@ } } }, - "ListVMMachineTypesRequest": { + "ListVMMachineTypes2Response": { "type": "object", + "properties": { + "machineTypes": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/VMMachineType" + } + } + }, "required": [ - "memoryGib", - "vcpu" - ], + "machineTypes" + ] + }, + "ListVMMachineTypesRequest": { + "type": "object", "properties": { "cpuModel": { "type": "string" }, - "dataCenterId": { - "type": "string" - }, "gpu": { "type": "integer", "format": "int32" @@ -4203,6 +6417,9 @@ "gpuModel": { "type": "string" }, + "gpuModelId": { + "type": "string" + }, "memoryGib": { "type": "integer", "format": "int32" @@ -4218,9 +6435,6 @@ "type": "integer", "format": "int32" }, - "publicIpv4": { - "type": "boolean" - }, "regionId": { "type": "string" }, @@ -4231,23 +6445,37 @@ "vcpu": { "type": "integer", "format": "int32" + }, + "dataCenterId": { + "type": "string" + }, + "publicIpv4": { + "type": "boolean" } - } + }, + "required": [ + "memoryGib", + "vcpu" + ] }, "ListVMMachineTypesResponse": { "type": "object", - "required": [ - "request", - "maxVcpu", - "maxMemoryGib", - "maxGpu", - "countVmAvailable", - "cpuModels", - "gpuModels", - "dataCenters", - "hostConfigs" - ], "properties": { + "request": { + "$ref": "#/definitions/ListVMMachineTypesRequest" + }, + "maxVcpu": { + "type": "integer", + "format": "int32" + }, + "maxMemoryGib": { + "type": "integer", + "format": "int32" + }, + "maxGpu": { + "type": "integer", + "format": "int32" + }, "countVmAvailable": { "type": "integer", "format": "int32" @@ -4259,18 +6487,18 @@ "$ref": "#/definitions/CpuModelCategory" } }, - "dataCenters": { + "gpuModels": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/DataCenterCategory" + "$ref": "#/definitions/GpuModelCategory" } }, - "gpuModels": { + "dataCenters": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/GpuModelCategory" + "$ref": "#/definitions/DataCenterCategory" } }, "hostConfigs": { @@ -4279,23 +6507,19 @@ "type": "object", "$ref": "#/definitions/HostConfigCategory" } - }, - "maxGpu": { - "type": "integer", - "format": "int32" - }, - "maxMemoryGib": { - "type": "integer", - "format": "int32" - }, - "maxVcpu": { - "type": "integer", - "format": "int32" - }, - "request": { - "$ref": "#/definitions/ListVMMachineTypesRequest" } - } + }, + "required": [ + "request", + "maxVcpu", + "maxMemoryGib", + "maxGpu", + "countVmAvailable", + "cpuModels", + "gpuModels", + "dataCenters", + "hostConfigs" + ] }, "ListVMsResponse": { "type": "object", @@ -4311,9 +6535,6 @@ }, "MonitorVMResponse": { "type": "object", - "required": [ - "items" - ], "properties": { "items": { "type": "array", @@ -4322,123 +6543,234 @@ "$ref": "#/definitions/VMMonitoringItem" } } - } + }, + "required": [ + "items" + ] }, "Network": { "type": "object", "properties": { - "activeState": { + "id": { "type": "string" }, "dataCenterId": { "type": "string" }, - "externalIpAddress": { + "ipRange": { "type": "string" }, "gateway": { "type": "string" }, + "size": { + "$ref": "#/definitions/v1.VRouterSize" + }, + "priceHr": { + "$ref": "#/definitions/Decimal" + }, + "externalIpAddress": { + "type": "string" + }, + "internalIpAddress": { + "type": "string" + }, + "shortState": { + "type": "string" + }, + "state": { + "$ref": "#/definitions/NetworkState" + }, + "createTime": { + "type": "string", + "format": "date-time", + "readOnly": true + } + }, + "required": [ + "id", + "dataCenterId", + "ipRange", + "gateway", + "size", + "priceHr", + "externalIpAddress", + "internalIpAddress", + "shortState", + "state", + "createTime" + ] + }, + "NetworkPriceHr": { + "type": "object", + "properties": { + "size": { + "$ref": "#/definitions/VMDataCenter.VRouterSize" + }, + "priceHr": { + "$ref": "#/definitions/Decimal" + } + } + }, + "NetworkState": { + "type": "string", + "enum": [ + "CLONING", + "CREATING_SNAPSHOT", + "DELETED", + "DELETING", + "DELETING_SNAPSHOT", + "FAILED", + "HOTPLUGGING", + "MIGRATING", + "RECREATING", + "REVERTING_SNAPSHOT", + "RESIZING", + "RESIZING_DISK", + "ACTIVE", + "STARTING", + "STOPPED", + "STOPPING", + "SUSPENDED", + "SUSPENDING", + "UNKNOWN" + ], + "default": "CLONING" + }, + "ObjectStorageBucket": { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "id": { + "type": "string" + }, + "dataCenterId": { + "type": "string" + }, + "endpoint": { + "type": "string" + }, + "objectCount": { + "type": "string", + "format": "int64" + }, + "sizeBytes": { + "type": "string", + "format": "int64" + }, + "billableBytes": { + "type": "string", + "format": "int64" + } + } + }, + "ObjectStorageKey": { + "type": "object", + "properties": { "id": { "type": "string" }, - "initState": { - "type": "string" - }, - "internalIpAddress": { + "accessKey": { "type": "string" }, - "ipRange": { + "secretKey": { "type": "string" }, - "priceHr": { - "$ref": "#/definitions/Decimal" - }, - "shortState": { + "createBy": { "type": "string" }, - "size": { - "$ref": "#/definitions/VRouterSize" + "createTime": { + "type": "string", + "format": "date-time" } } }, - "NetworkPriceHr": { + "ObjectStorageUser": { "type": "object", "properties": { - "priceHr": { - "$ref": "#/definitions/Decimal" + "id": { + "type": "string" }, - "size": { - "$ref": "#/definitions/VRouterSize" + "keyCount": { + "type": "integer", + "format": "int32" + }, + "createBy": { + "type": "string" + }, + "createTime": { + "type": "string", + "format": "date-time" } } }, - "ObjectStorageBucket": { + "Package": { "type": "object", "properties": { - "billableBytes": { - "type": "string", - "format": "int64" - }, - "dataCenterId": { - "type": "string" - }, - "endpoint": { + "name": { "type": "string" }, - "id": { + "description": { "type": "string" }, - "objectCount": { - "type": "string", - "format": "int64" - }, - "projectId": { + "version": { "type": "string" - }, - "sizeBytes": { - "type": "string", - "format": "int64" } - } + }, + "required": [ + "name", + "description", + "version" + ] }, - "ObjectStorageKey": { + "PaymentMethodCard": { "type": "object", "properties": { - "accessKey": { + "brand": { "type": "string" }, - "createBy": { + "country": { "type": "string" }, - "createTime": { + "expMonth": { "type": "string", - "format": "date-time" + "format": "int64" }, - "id": { + "expYear": { + "type": "string", + "format": "int64" + }, + "fingerprint": { "type": "string" }, - "secretKey": { + "last4": { "type": "string" } } }, - "ObjectStorageUser": { + "PaymentMethodPaypal": { "type": "object", "properties": { - "createBy": { + "payerEmail": { "type": "string" }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "id": { + "payerId": { "type": "string" + } + } + }, + "Point": { + "type": "object", + "properties": { + "lat": { + "type": "number", + "format": "double" }, - "keyCount": { - "type": "integer", - "format": "int32" + "lng": { + "type": "number", + "format": "double" } } }, @@ -4461,39 +6793,26 @@ }, "Project": { "type": "object", - "required": [ - "id", - "billingAccountId" - ], "properties": { - "billingAccountId": { + "id": { "type": "string" }, - "createBy": { - "type": "string", - "readOnly": true - }, - "id": { + "billingAccountId": { "type": "string" }, "resourceCount": { "type": "integer", "format": "int32", "readOnly": true + }, + "createBy": { + "type": "string", + "readOnly": true } - } - }, - "Protocol": { - "type": "string", - "default": "PROTOCOL_UNKNOWN", - "enum": [ - "PROTOCOL_UNKNOWN", - "PROTOCOL_ALL", - "PROTOCOL_TCP", - "PROTOCOL_UDP", - "PROTOCOL_ICMP", - "PROTOCOL_ICMPv6", - "PROTOCOL_IPSEC" + }, + "required": [ + "id", + "billingAccountId" ] }, "RebootVMResponse": { @@ -4507,86 +6826,188 @@ }, "name": { "type": "string" + }, + "dataCenters": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Region.DataCenter" + } + } + } + }, + "Region.DataCenter": { + "type": "object", + "properties": { + "id": { + "type": "string" } } }, + "RemoveBillingAccountPaymentMethodResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "paymentMethodId": { + "type": "string" + } + }, + "required": [ + "id", + "paymentMethodId" + ] + }, + "RemoveBillingAccountUserPermissionBody": { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "dataCenterId": { + "type": "string" + }, + "userId": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/Role" + } + }, + "required": [ + "userId", + "role" + ] + }, + "RemoveDataCenterUserPermissionBody": { + "type": "object", + "properties": { + "projectId": { + "type": "string" + }, + "billingAccountId": { + "type": "string" + }, + "userId": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/Role" + } + }, + "required": [ + "userId", + "role" + ] + }, + "RemoveProjectUserPermissionBody": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "billingAccountId": { + "type": "string" + }, + "userId": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/Role" + } + }, + "required": [ + "userId", + "role" + ] + }, "ResizeVMDiskResponse": { "type": "object" }, "ResizeVMResponse": { "type": "object", - "required": [ - "vm" - ], "properties": { "vm": { "$ref": "#/definitions/VM" } - } + }, + "required": [ + "vm" + ] }, "RevertDiskResponse": { "type": "object" }, "Role": { "type": "string", - "default": "UNKNOWN", "enum": [ "UNKNOWN", "OWNER", "VIEWER", "EDITOR" - ] + ], + "default": "UNKNOWN" }, "Rule": { "type": "object", "properties": { - "icmpType": { + "id": { "type": "string" }, - "id": { + "protocol": { + "$ref": "#/definitions/Rule.Protocol" + }, + "ports": { "type": "string" }, + "ruleType": { + "$ref": "#/definitions/Rule.RuleType" + }, "ipRangeCidr": { "type": "string", "title": "single IP or CIDR format range to apply rule to" }, - "ports": { + "icmpType": { "type": "string" - }, - "protocol": { - "$ref": "#/definitions/Protocol" - }, - "ruleType": { - "$ref": "#/definitions/RuleType" } } }, - "RuleType": { + "Rule.Protocol": { + "type": "string", + "enum": [ + "PROTOCOL_UNKNOWN", + "PROTOCOL_ALL", + "PROTOCOL_TCP", + "PROTOCOL_UDP", + "PROTOCOL_ICMP", + "PROTOCOL_ICMPv6", + "PROTOCOL_IPSEC" + ], + "default": "PROTOCOL_UNKNOWN" + }, + "Rule.RuleType": { "type": "string", - "default": "RULE_TYPE_UNKNOWN", "enum": [ "RULE_TYPE_UNKNOWN", "RULE_TYPE_INBOUND", "RULE_TYPE_OUTBOUND" - ] + ], + "default": "RULE_TYPE_UNKNOWN" }, "SecurityGroup": { "type": "object", - "required": [ - "dataCenterId", - "id" - ], "properties": { - "dataCenterId": { + "projectId": { "type": "string" }, - "description": { + "dataCenterId": { "type": "string" }, "id": { "type": "string" }, - "projectId": { + "description": { "type": "string" }, "rules": { @@ -4596,58 +7017,96 @@ "$ref": "#/definitions/Rule" } } - } + }, + "required": [ + "dataCenterId", + "id" + ] }, "SecurityGroupRule": { "type": "object", "properties": { - "icmpType": { + "id": { "type": "string" }, - "id": { + "protocol": { + "$ref": "#/definitions/SecurityGroupRule.Protocol" + }, + "ports": { "type": "string" }, + "ruleType": { + "$ref": "#/definitions/SecurityGroupRule.RuleType" + }, "ipRangeCidr": { "type": "string", "title": "single IP or CIDR format range to apply rule to" }, - "ports": { + "icmpType": { "type": "string" - }, - "protocol": { - "$ref": "#/definitions/Protocol" - }, - "ruleType": { - "$ref": "#/definitions/RuleType" } } }, - "Snapshot": { + "SecurityGroupRule.Protocol": { + "type": "string", + "enum": [ + "PROTOCOL_UNKNOWN", + "PROTOCOL_ALL", + "PROTOCOL_TCP", + "PROTOCOL_UDP", + "PROTOCOL_ICMP", + "PROTOCOL_ICMPv6", + "PROTOCOL_IPSEC" + ], + "default": "PROTOCOL_UNKNOWN" + }, + "SecurityGroupRule.RuleType": { + "type": "string", + "enum": [ + "RULE_TYPE_UNKNOWN", + "RULE_TYPE_INBOUND", + "RULE_TYPE_OUTBOUND" + ], + "default": "RULE_TYPE_UNKNOWN" + }, + "SetBillingAccountDefaultPaymentMethodResponse": { "type": "object", "properties": { - "active": { - "type": "boolean" - }, - "createTime": { - "type": "string", - "format": "date-time" + "id": { + "type": "string" }, + "paymentMethodId": { + "type": "string" + } + }, + "required": [ + "id", + "paymentMethodId" + ] + }, + "Snapshot": { + "type": "object", + "properties": { "id": { "type": "string" }, + "active": { + "type": "boolean" + }, "sizeGib": { "type": "integer", "format": "int32" + }, + "createTime": { + "type": "string", + "format": "date-time" } } }, "SshKey": { "type": "object", - "required": [ - "publicKey" - ], "properties": { - "comment": { + "id": { "type": "string", "readOnly": true }, @@ -4656,32 +7115,35 @@ "format": "date-time", "readOnly": true }, + "publicKey": { + "type": "string" + }, "fingerprint": { "type": "string", "readOnly": true }, - "id": { + "type": { "type": "string", "readOnly": true }, - "publicKey": { - "type": "string" - }, - "type": { + "comment": { "type": "string", "readOnly": true } - } + }, + "required": [ + "publicKey" + ] }, "SshKeySource": { "type": "string", - "default": "SSH_KEY_SOURCE_UNKNOWN", "enum": [ "SSH_KEY_SOURCE_UNKNOWN", "SSH_KEY_SOURCE_PROJECT", "SSH_KEY_SOURCE_USER", "SSH_KEY_SOURCE_NONE" - ] + ], + "default": "SSH_KEY_SOURCE_UNKNOWN" }, "StartNetworkResponse": { "type": "object" @@ -4696,15 +7158,15 @@ "type": "integer", "format": "int32" }, + "message": { + "type": "string" + }, "details": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/Any" + "$ref": "#/definitions/protobuf.Any" } - }, - "message": { - "type": "string" } } }, @@ -4714,130 +7176,271 @@ "StopVMResponse": { "type": "object" }, + "StripeCustomer": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "balance": { + "$ref": "#/definitions/Decimal" + } + } + }, + "SyncResponse": { + "type": "object" + }, + "Task": { + "type": "object", + "properties": { + "taskName": { + "type": "string" + }, + "percentComplete": { + "type": "integer", + "format": "int32" + }, + "projectId": { + "type": "string" + } + } + }, + "TaxId": { + "type": "object", + "properties": { + "id": { + "type": "string", + "readOnly": true + }, + "type": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, "TerminateVMResponse": { "type": "object" }, + "Unit": { + "type": "string", + "enum": [ + "UNIT_UNKNOWN", + "UNIT_GIB_HOUR", + "UNIT_HOUR" + ], + "default": "UNIT_UNKNOWN" + }, + "UpdateBillingAccountBody": { + "type": "object", + "properties": { + "billingAccount": { + "type": "object", + "properties": { + "createTime": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "supplyEnabled": { + "type": "boolean", + "readOnly": true + }, + "demandEnabled": { + "type": "boolean", + "readOnly": true + }, + "displayName": { + "type": "string" + }, + "stripeRef": { + "type": "string" + }, + "createBy": { + "type": "string", + "readOnly": true + }, + "monthlySpend": { + "type": "string" + }, + "taxIds": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/TaxId" + } + }, + "invoiceTime": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "billingThreshold": { + "$ref": "#/definitions/Decimal", + "readOnly": true + }, + "blocked": { + "type": "boolean", + "readOnly": true + } + } + }, + "updateMask": { + "type": "string" + } + }, + "required": [ + "updateMask" + ] + }, + "UpdateHostResponse": { + "type": "object" + }, + "UpdateImageResponse": { + "type": "object" + }, + "UpdateNetResponse": { + "type": "object" + }, "UpdatePrivateVMImageResponse": { "type": "object" }, "UpdateSecurityGroupResponse": { "type": "object", - "required": [ - "securityGroup" - ], "properties": { "securityGroup": { "$ref": "#/definitions/SecurityGroup" } + }, + "required": [ + "securityGroup" + ] + }, + "UpdateVMMetadataBody": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "merge": { + "type": "boolean" + } + } + }, + "UpdateVMMetadataResponse": { + "type": "object", + "properties": { + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } } }, + "UpdateVMResponse": { + "type": "object" + }, "UserPermission": { "type": "object", - "required": [ - "userId", - "userEmail", - "userPicture", - "role", - "permissionRole" - ], "properties": { - "permissionRole": { - "$ref": "#/definitions/Role" - }, - "role": { + "userId": { "type": "string" }, "userEmail": { "type": "string" }, - "userId": { + "userPicture": { "type": "string" }, - "userPicture": { + "role": { "type": "string" + }, + "permissionRole": { + "$ref": "#/definitions/Role" } - } + }, + "required": [ + "userId", + "userEmail", + "userPicture", + "role", + "permissionRole" + ] }, "VM": { "type": "object", "properties": { - "activeState": { - "type": "string" - }, - "bootDisk": { - "$ref": "#/definitions/Disk" - }, - "bootDiskSizeGib": { - "type": "integer", - "format": "int64" + "datacenterId": { + "type": "string", + "readOnly": true }, - "cpuModel": { + "machineType": { "type": "string" }, - "createBy": { + "regionId": { "type": "string", "readOnly": true }, - "datacenterId": { + "regionName": { "type": "string", "readOnly": true }, - "externalIpAddress": { - "type": "string" - }, - "gpuModel": { - "type": "string" - }, - "gpuQuantity": { - "type": "integer", - "format": "int64" - }, "id": { "type": "string" }, - "imageId": { - "type": "string" - }, - "imageName": { - "type": "string" - }, - "initState": { + "externalIpAddress": { "type": "string" }, "internalIpAddress": { "type": "string" }, - "lcmState": { - "type": "string" - }, - "machineType": { + "publicIpAddress": { "type": "string" }, "memory": { "type": "integer", "format": "int64" }, - "metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } + "cpuModel": { + "type": "string" }, - "nics": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/VM.NIC" - } + "vcpus": { + "type": "integer", + "format": "int64" + }, + "gpuModel": { + "type": "string" }, - "oneState": { + "gpuModelId": { "type": "string" }, + "gpuQuantity": { + "type": "integer", + "format": "int64" + }, + "bootDiskSizeGib": { + "type": "integer", + "format": "int64" + }, "priceHr": { "type": "number", "format": "float" }, - "privateImageId": { + "renewableEnergy": { + "type": "boolean" + }, + "imageId": { "type": "string" }, "publicImageId": { @@ -4846,19 +7449,22 @@ "publicImageName": { "type": "string" }, - "publicIpAddress": { + "privateImageId": { "type": "string" }, - "regionId": { - "type": "string", - "readOnly": true + "imageName": { + "type": "string" }, - "regionName": { + "createBy": { "type": "string", "readOnly": true }, - "renewableEnergy": { - "type": "boolean" + "nics": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/VM.NIC" + } }, "rules": { "type": "array", @@ -4876,6 +7482,9 @@ "shortState": { "type": "string" }, + "bootDisk": { + "$ref": "#/definitions/Disk" + }, "storageDisks": { "type": "array", "items": { @@ -4883,15 +7492,28 @@ "$ref": "#/definitions/Disk" } }, - "vcpus": { - "type": "integer", - "format": "int64" + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "state": { + "$ref": "#/definitions/VmState" + }, + "createTime": { + "type": "string", + "format": "date-time", + "readOnly": true } } }, "VM.NIC": { "type": "object", "properties": { + "networkId": { + "type": "string" + }, "externalIpAddress": { "type": "string" }, @@ -4901,9 +7523,6 @@ "networkAddress": { "type": "string" }, - "networkId": { - "type": "string" - }, "securityGroupIds": { "type": "array", "items": { @@ -4914,13 +7533,19 @@ }, "VMDataCenter": { "type": "object", - "required": [ - "id", - "regionId", - "supplierName", - "renewableEnergy" - ], "properties": { + "id": { + "type": "string" + }, + "regionId": { + "type": "string" + }, + "supplierName": { + "type": "string" + }, + "renewableEnergy": { + "type": "boolean" + }, "diskPoolPricing": { "type": "array", "items": { @@ -4928,12 +7553,6 @@ "$ref": "#/definitions/DiskStoragePriceHr" } }, - "id": { - "type": "string" - }, - "ipv4PriceHr": { - "$ref": "#/definitions/Decimal" - }, "networkPricing": { "type": "array", "items": { @@ -4941,24 +7560,145 @@ "$ref": "#/definitions/NetworkPriceHr" } }, - "regionId": { - "type": "string" - }, - "renewableEnergy": { - "type": "boolean" - }, - "supplierName": { - "type": "string" + "ipv4PriceHr": { + "$ref": "#/definitions/Decimal" } - } + }, + "required": [ + "id", + "regionId", + "supplierName", + "renewableEnergy" + ] }, "VMDataCenter.StorageClass": { "type": "string", - "default": "STORAGE_CLASS_UNKNOWN", "enum": [ "STORAGE_CLASS_UNKNOWN", "STORAGE_CLASS_LOCAL", "STORAGE_CLASS_NETWORK" + ], + "default": "STORAGE_CLASS_UNKNOWN" + }, + "VMDataCenter.VRouterSize": { + "type": "string", + "enum": [ + "VROUTER_INSTANCE_UNKNOWN", + "VROUTER_INSTANCE_SMALL", + "VROUTER_INSTANCE_MEDIUM", + "VROUTER_INSTANCE_LARGE" + ], + "default": "VROUTER_INSTANCE_UNKNOWN" + }, + "VMMachineType": { + "type": "object", + "properties": { + "dataCenterId": { + "type": "string" + }, + "machineType": { + "type": "string" + }, + "cpuModel": { + "type": "string" + }, + "gpuModel": { + "type": "string" + }, + "gpuModelId": { + "type": "string" + }, + "minVcpuPerMemoryGib": { + "type": "number", + "format": "double" + }, + "maxVcpuPerMemoryGib": { + "type": "number", + "format": "double" + }, + "minVcpuPerGpu": { + "type": "number", + "format": "double" + }, + "maxVcpuPerGpu": { + "type": "number", + "format": "double" + }, + "vcpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "memoryGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "gpuPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "minStorageGibPriceHr": { + "$ref": "#/definitions/Decimal" + }, + "ipv4PriceHr": { + "$ref": "#/definitions/Decimal" + }, + "renewableEnergy": { + "type": "boolean" + }, + "maxVcpuFree": { + "type": "integer", + "format": "int32" + }, + "totalVcpuFree": { + "type": "integer", + "format": "int32" + }, + "maxMemoryGibFree": { + "type": "integer", + "format": "int32" + }, + "totalMemoryGibFree": { + "type": "integer", + "format": "int32" + }, + "maxGpuFree": { + "type": "integer", + "format": "int32" + }, + "totalGpuFree": { + "type": "integer", + "format": "int32" + }, + "maxStorageGibFree": { + "type": "integer", + "format": "int32" + }, + "totalStorageGibFree": { + "type": "integer", + "format": "int32" + } + }, + "required": [ + "dataCenterId", + "machineType", + "cpuModel", + "gpuModel", + "gpuModelId", + "minVcpuPerMemoryGib", + "maxVcpuPerMemoryGib", + "minVcpuPerGpu", + "maxVcpuPerGpu", + "vcpuPriceHr", + "memoryGibPriceHr", + "gpuPriceHr", + "minStorageGibPriceHr", + "ipv4PriceHr", + "renewableEnergy", + "maxVcpuFree", + "totalVcpuFree", + "maxMemoryGibFree", + "totalMemoryGibFree", + "maxGpuFree", + "totalGpuFree", + "maxStorageGibFree", + "totalStorageGibFree" ] }, "VMMonitoringItem": { @@ -5001,29 +7741,90 @@ } } }, - "VRouterSize": { + "VmState": { "type": "string", - "default": "VROUTER_INSTANCE_UNKNOWN", "enum": [ - "VROUTER_INSTANCE_UNKNOWN", - "VROUTER_INSTANCE_SMALL", - "VROUTER_INSTANCE_MEDIUM", - "VROUTER_INSTANCE_LARGE" + "CLONING", + "CREATING_SNAPSHOT", + "DELETED", + "DELETING", + "DELETING_SNAPSHOT", + "FAILED", + "HOTPLUGGING", + "MIGRATING", + "RECREATING", + "REVERTING_SNAPSHOT", + "RESIZING", + "RESIZING_DISK", + "ACTIVE", + "STARTING", + "STOPPED", + "STOPPING", + "SUSPENDED", + "SUSPENDING", + "UNKNOWN" + ], + "default": "CLONING" + }, + "protobuf.Any": { + "type": "object", + "properties": { + "@type": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + } + }, + "additionalProperties": {}, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "v1.DataCenter": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "regionId": { + "type": "string" + }, + "supplierName": { + "type": "string" + }, + "renewableEnergy": { + "type": "boolean" + }, + "lngLat": { + "$ref": "#/definitions/Point" + }, + "createBy": { + "type": "string", + "readOnly": true + }, + "oneFrontendId": { + "type": "string" + }, + "s3Endpoint": { + "type": "string" + } + }, + "required": [ + "id", + "oneFrontendId", + "s3Endpoint" ] }, "v1.PrivateImage": { "type": "object", "properties": { - "dataCenterId": { + "projectId": { "type": "string" }, - "description": { + "id": { "type": "string" }, - "id": { + "dataCenterId": { "type": "string" }, - "projectId": { + "description": { "type": "string" }, "sizeGib": { @@ -5031,6 +7832,16 @@ "format": "int32" } } + }, + "v1.VRouterSize": { + "type": "string", + "enum": [ + "VROUTER_INSTANCE_UNKNOWN", + "VROUTER_INSTANCE_SMALL", + "VROUTER_INSTANCE_MEDIUM", + "VROUTER_INSTANCE_LARGE" + ], + "default": "VROUTER_INSTANCE_UNKNOWN" } } -} \ No newline at end of file +}