From a2628c5e82623d136f7948feef4f632d988260a8 Mon Sep 17 00:00:00 2001 From: Evan Rademacher <44209290+erademacher@users.noreply.github.com> Date: Thu, 10 Aug 2023 11:30:33 -0700 Subject: [PATCH] Update CC SDK to v1.4.0 (#156) --- CHANGELOG.md | 11 + docs/data-sources/connection_string.md | 13 +- docs/resources/user_role_grants.md | 3 + go.mod | 2 +- go.sum | 4 +- .../provider/connection_string_data_source.go | 42 +- .../connection_string_data_source_test.go | 17 +- internal/provider/models.go | 22 +- internal/provider/provider.go | 11 +- mock/service.go | 79 ++ .../pkg/client/configuration.go | 2 +- .../pkg/client/model_any.go | 2 +- .../pkg/client/model_audit_log_action.go | 30 +- .../pkg/client/model_audit_log_source.go | 18 - ...del_aws_endpoint_connection_status_type.go | 18 - .../pkg/client/model_client_ca_cert_status.go | 18 - .../pkg/client/model_cloud_provider_type.go | 18 - .../pkg/client/model_cluster.go | 20 +- ...uster_major_version_support_status_type.go | 18 - .../pkg/client/model_cluster_state_type.go | 18 - .../pkg/client/model_cluster_status_type.go | 18 - .../model_cluster_upgrade_status_type.go | 18 - ...el_cluster_version_deferral_policy_type.go | 18 - .../pkg/client/model_cmek_customer_action.go | 18 - .../pkg/client/model_cmek_key_type.go | 18 - .../pkg/client/model_cmek_status.go | 18 - .../model_connection_string_parameters.go | 106 +++ .../model_create_cluster_specification.go | 18 +- .../pkg/client/model_create_folder_request.go | 73 ++ .../pkg/client/model_currency_type.go | 18 - .../pkg/client/model_datadog_site_type.go | 18 - .../model_egress_traffic_policy_type.go | 18 - .../client/model_enable_log_export_request.go | 16 + .../pkg/client/model_folder_resource.go | 147 ++++ .../pkg/client/model_folder_resource_list.go | 62 ++ .../client/model_folder_resource_type_type.go | 64 ++ .../model_get_connection_string_response.go | 45 +- .../model_log_export_cluster_specification.go | 16 + .../pkg/client/model_log_export_status.go | 18 - .../pkg/client/model_log_export_type.go | 18 - .../pkg/client/model_log_level_type.go | 18 - .../client/model_metric_export_status_type.go | 18 - .../client/model_network_visibility_type.go | 18 - .../pkg/client/model_node_status_type.go | 18 - .../pkg/client/model_operating_system_type.go | 18 - .../model_organization_user_role_type.go | 24 +- .../pkg/client/model_path_segment.go | 64 ++ .../pkg/client/model_plan_type.go | 18 - ...el_private_endpoint_service_status_type.go | 18 - .../pkg/client/model_quantity_unit_type.go | 18 - .../pkg/client/model_resource_type_type.go | 22 +- ...serverless_cluster_create_specification.go | 16 + ...set_aws_endpoint_connection_status_type.go | 18 - .../pkg/client/model_sort_order.go | 18 - .../model_update_cluster_specification.go | 18 +- .../model_update_folder_specification.go | 62 ++ .../pkg/client/service.go | 694 ++++++++++++++++++ vendor/modules.txt | 2 +- 58 files changed, 1592 insertions(+), 601 deletions(-) create mode 100644 vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_connection_string_parameters.go create mode 100644 vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_folder_request.go create mode 100644 vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource.go create mode 100644 vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_list.go create mode 100644 vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_type_type.go create mode 100644 vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_path_segment.go create mode 100644 vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_folder_specification.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f7d79219..e70bb8fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.0] - 2023-08-10 + +### Notes + +- The CockroachDB Cloud Terraform Provider is now generally available with semantic versioning compatibility promises. + +### Changed + +- connection_params field on the connection_string data source is now an object instead of a string map. + ### Fixed - Fixed an issue where changing `num_virtual_cpus` on a `cockroach_cluster` resource would fail to scale the cluster and would result in an inconsistent state error. - Added validation to prevent multiple serverless regions from being marked as "primary", which could result in an inconsistent state error. +- Fixed "not a valid value" errors that occurred when reading recently added enum values, such as cluster status. ## [0.7.0] - 2023-07-13 diff --git a/docs/data-sources/connection_string.md b/docs/data-sources/connection_string.md index 87bec9ad..cd5036c6 100644 --- a/docs/data-sources/connection_string.md +++ b/docs/data-sources/connection_string.md @@ -31,7 +31,18 @@ Generic connection string for a cluster. ### Read-Only -- `connection_params` (Map of String) List of individual connection string parameters. Can be used to build nonstandard connection strings. +- `connection_params` (Attributes) List of individual connection string parameters. Can be used to build nonstandard connection strings. (see [below for nested schema](#nestedatt--connection_params)) - `connection_string` (String) Fully formatted connection string. Assumes the cluster certificate is stored in the default location. + +### Nested Schema for `connection_params` + +Read-Only: + +- `database` (String) Database value to use in a connection URL. +- `host` (String) Host value to use in a connection URL. +- `password` (String, Sensitive) Password value to use in a connection URL. +- `port` (String) Port value to use in a connection URL. +- `username` (String) Username value to use in a connection URL. + diff --git a/docs/resources/user_role_grants.md b/docs/resources/user_role_grants.md index b5a617ec..38f05327 100644 --- a/docs/resources/user_role_grants.md +++ b/docs/resources/user_role_grants.md @@ -32,6 +32,7 @@ Required: - `resource_type` (String) Type of resource. Allowed values are: * ORGANIZATION * CLUSTER + * FOLDER - `role_name` (String) Name of the role to grant. Allowed values are: * DEVELOPER * ADMIN @@ -42,6 +43,8 @@ Required: * CLUSTER_OPERATOR_WRITER * CLUSTER_DEVELOPER * CLUSTER_CREATOR + * FOLDER_ADMIN + * FOLDER_MOVER Optional: diff --git a/go.mod b/go.mod index c5b90e64..e05ca025 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/cockroachdb/terraform-provider-cockroach go 1.18 require ( - github.com/cockroachdb/cockroach-cloud-sdk-go v1.3.0 + github.com/cockroachdb/cockroach-cloud-sdk-go v1.4.0 github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-retryablehttp v0.7.4 diff --git a/go.sum b/go.sum index f56e1063..2a85e1fa 100644 --- a/go.sum +++ b/go.sum @@ -27,8 +27,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/cockroachdb/cockroach-cloud-sdk-go v1.3.0 h1:6vjzv7fvQP5bcVgTx6gYLiGSgz+iQDQ2f4pmUH9Trcw= -github.com/cockroachdb/cockroach-cloud-sdk-go v1.3.0/go.mod h1:oG9ylbcVGOF7IbVAW2nx5F6ry9a2dZD1H9rd+qd4P60= +github.com/cockroachdb/cockroach-cloud-sdk-go v1.4.0 h1:VLXNL7oYG5ySlPWaUlucHdiFTCCSViVobrC1b9Tg5Mg= +github.com/cockroachdb/cockroach-cloud-sdk-go v1.4.0/go.mod h1:oG9ylbcVGOF7IbVAW2nx5F6ry9a2dZD1H9rd+qd4P60= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/internal/provider/connection_string_data_source.go b/internal/provider/connection_string_data_source.go index d3d3297c..c3557bf5 100644 --- a/internal/provider/connection_string_data_source.go +++ b/internal/provider/connection_string_data_source.go @@ -68,9 +68,31 @@ func (d *connectionStringDataSource) Schema( Computed: true, Description: "Fully formatted connection string. Assumes the cluster certificate is stored in the default location.", }, - "connection_params": schema.MapAttribute{ - Computed: true, - ElementType: types.StringType, + "connection_params": schema.SingleNestedAttribute{ + Computed: true, + Attributes: map[string]schema.Attribute{ + "host": schema.StringAttribute{ + Computed: true, + Description: "Host value to use in a connection URL.", + }, + "port": schema.StringAttribute{ + Computed: true, + Description: "Port value to use in a connection URL.", + }, + "database": schema.StringAttribute{ + Computed: true, + Description: "Database value to use in a connection URL.", + }, + "username": schema.StringAttribute{ + Computed: true, + Description: "Username value to use in a connection URL.", + }, + "password": schema.StringAttribute{ + Computed: true, + Sensitive: true, + Description: "Password value to use in a connection URL.", + }, + }, Description: "List of individual connection string parameters. Can be used to build nonstandard connection strings.", }, }, @@ -152,10 +174,15 @@ func (d *connectionStringDataSource) Read( } connectionString := apiResp.GetConnectionString() - connectionParams := apiResp.GetParams() + config.ConnectionParams = &ConnectionParams{ + Host: types.StringValue(apiResp.Params.Host), + Port: types.StringValue(apiResp.Params.Port), + Database: types.StringValue(apiResp.Params.Database), + Username: types.StringPointerValue(apiResp.Params.Username), + } if IsKnown(config.Password) { - connectionParams["Password"] = config.Password.ValueString() + config.ConnectionParams.Password = config.Password if connectionURL, err := url.Parse(connectionString); err != nil { resp.Diagnostics.AddWarning("Couldn't parse connection URL to inject password", err.Error()) } else { @@ -165,11 +192,6 @@ func (d *connectionStringDataSource) Read( } config.ConnectionString = types.StringValue(connectionString) - config.ConnectionParams, diags = types.MapValueFrom(ctx, types.StringType, connectionParams) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } diags = resp.State.Set(ctx, config) resp.Diagnostics.Append(diags...) diff --git a/internal/provider/connection_string_data_source_test.go b/internal/provider/connection_string_data_source_test.go index eeea4712..c1f2119d 100644 --- a/internal/provider/connection_string_data_source_test.go +++ b/internal/provider/connection_string_data_source_test.go @@ -74,10 +74,15 @@ func TestIntegrationConnectionStringDataSource(t *testing.T) { SqlUser: &sqlUser, Os: &os, } - fakeString := "postgresql://test@fake.cockroachlabs.cloud:26257/testdb" + username := "test" connectionStringResponse := &client.GetConnectionStringResponse{ - ConnectionString: &fakeString, - Params: &map[string]string{}, + ConnectionString: "postgresql://test@fake.cockroachlabs.cloud:26257/testdb", + Params: client.ConnectionStringParameters{ + Database: "testdb", + Host: "fake.cockroachlabs.cloud", + Port: "26257", + Username: &username, + }, } httpOkResponse := &http.Response{Status: http.StatusText(http.StatusOK)} @@ -106,7 +111,11 @@ func testConnectionStringDataSource(t *testing.T, clusterName string, useMock bo Config: getTestConnectionStringResourceConfig(clusterName, sqlPassword), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(connectStrDataSourceName, "connection_string"), - resource.TestCheckResourceAttrSet(connectStrDataSourceName, "connection_params.%"), + resource.TestCheckResourceAttrSet(connectStrDataSourceName, "connection_params.host"), + resource.TestCheckResourceAttrSet(connectStrDataSourceName, "connection_params.port"), + resource.TestCheckResourceAttr(connectStrDataSourceName, "connection_params.database", "testdb"), + resource.TestCheckResourceAttr(connectStrDataSourceName, "connection_params.username", "test"), + resource.TestCheckResourceAttr(connectStrDataSourceName, "connection_params.password", sqlPassword), resource.TestCheckResourceAttrWith(connectStrDataSourceName, "connection_string", func(value string) error { connectURL, err := url.Parse(value) if err != nil { diff --git a/internal/provider/models.go b/internal/provider/models.go index bf5250a9..c74f8f1c 100644 --- a/internal/provider/models.go +++ b/internal/provider/models.go @@ -155,14 +155,22 @@ type ClusterCert struct { Cert types.String `tfsdk:"cert"` } +type ConnectionParams struct { + Host types.String `tfsdk:"host"` + Port types.String `tfsdk:"port"` + Database types.String `tfsdk:"database"` + Username types.String `tfsdk:"username"` + Password types.String `tfsdk:"password"` +} + type ConnectionString struct { - ID types.String `tfsdk:"id"` - OS types.String `tfsdk:"os"` - Database types.String `tfsdk:"database"` - SqlUser types.String `tfsdk:"sql_user"` - Password types.String `tfsdk:"password"` - ConnectionString types.String `tfsdk:"connection_string"` - ConnectionParams types.Map `tfsdk:"connection_params"` + ID types.String `tfsdk:"id"` + OS types.String `tfsdk:"os"` + Database types.String `tfsdk:"database"` + SqlUser types.String `tfsdk:"sql_user"` + Password types.String `tfsdk:"password"` + ConnectionString types.String `tfsdk:"connection_string"` + ConnectionParams *ConnectionParams `tfsdk:"connection_params"` } type Database struct { diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 3303e64d..b06223e3 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -68,16 +68,7 @@ func (p *provider) Configure( } var apiKey string - if config.ApiKey.IsUnknown() { - // cannot connect to client with an unknown value - resp.Diagnostics.AddWarning( - "Unable to create client", - "Cannot use unknown value as apikey", - ) - return - } - - if config.ApiKey.IsNull() { + if !IsKnown(config.ApiKey) { apiKey = os.Getenv(CockroachAPIKey) } else { apiKey = config.ApiKey.ValueString() diff --git a/mock/service.go b/mock/service.go index cc4b843c..47df5d84 100644 --- a/mock/service.go +++ b/mock/service.go @@ -132,6 +132,22 @@ func (mr *MockServiceMockRecorder) CreateDatabase(arg0, arg1, arg2 interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDatabase", reflect.TypeOf((*MockService)(nil).CreateDatabase), arg0, arg1, arg2) } +// CreateFolder mocks base method. +func (m *MockService) CreateFolder(arg0 context.Context, arg1 *client.CreateFolderRequest) (*client.FolderResource, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateFolder", arg0, arg1) + ret0, _ := ret[0].(*client.FolderResource) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateFolder indicates an expected call of CreateFolder. +func (mr *MockServiceMockRecorder) CreateFolder(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateFolder", reflect.TypeOf((*MockService)(nil).CreateFolder), arg0, arg1) +} + // CreateGroup mocks base method. func (m *MockService) CreateGroup(arg0 context.Context, arg1 *client.CreateGroupRequest) (*client.ScimGroup, *http.Response, error) { m.ctrl.T.Helper() @@ -308,6 +324,21 @@ func (mr *MockServiceMockRecorder) DeleteEgressRule(arg0, arg1, arg2, arg3 inter return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteEgressRule", reflect.TypeOf((*MockService)(nil).DeleteEgressRule), arg0, arg1, arg2, arg3) } +// DeleteFolder mocks base method. +func (m *MockService) DeleteFolder(arg0 context.Context, arg1 string) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteFolder", arg0, arg1) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteFolder indicates an expected call of DeleteFolder. +func (mr *MockServiceMockRecorder) DeleteFolder(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteFolder", reflect.TypeOf((*MockService)(nil).DeleteFolder), arg0, arg1) +} + // DeleteGroup mocks base method. func (m *MockService) DeleteGroup(arg0 context.Context, arg1 string) (*http.Response, error) { m.ctrl.T.Helper() @@ -642,6 +673,22 @@ func (mr *MockServiceMockRecorder) GetEgressRule(arg0, arg1, arg2 interface{}) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEgressRule", reflect.TypeOf((*MockService)(nil).GetEgressRule), arg0, arg1, arg2) } +// GetFolder mocks base method. +func (m *MockService) GetFolder(arg0 context.Context, arg1 string) (*client.FolderResource, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetFolder", arg0, arg1) + ret0, _ := ret[0].(*client.FolderResource) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetFolder indicates an expected call of GetFolder. +func (mr *MockServiceMockRecorder) GetFolder(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFolder", reflect.TypeOf((*MockService)(nil).GetFolder), arg0, arg1) +} + // GetGroup mocks base method. func (m *MockService) GetGroup(arg0 context.Context, arg1 string, arg2 *client.GetGroupOptions) (*client.ScimGroup, *http.Response, error) { m.ctrl.T.Helper() @@ -1058,6 +1105,22 @@ func (mr *MockServiceMockRecorder) ListEgressRules(arg0, arg1, arg2 interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEgressRules", reflect.TypeOf((*MockService)(nil).ListEgressRules), arg0, arg1, arg2) } +// ListFolderContents mocks base method. +func (m *MockService) ListFolderContents(arg0 context.Context, arg1 string, arg2 *client.ListFolderContentsOptions) (*client.FolderResourceList, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListFolderContents", arg0, arg1, arg2) + ret0, _ := ret[0].(*client.FolderResourceList) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ListFolderContents indicates an expected call of ListFolderContents. +func (mr *MockServiceMockRecorder) ListFolderContents(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListFolderContents", reflect.TypeOf((*MockService)(nil).ListFolderContents), arg0, arg1, arg2) +} + // ListInvoices mocks base method. func (m *MockService) ListInvoices(arg0 context.Context) (*client.ListInvoicesResponse, *http.Response, error) { m.ctrl.T.Helper() @@ -1329,6 +1392,22 @@ func (mr *MockServiceMockRecorder) UpdateCluster(arg0, arg1, arg2 interface{}) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCluster", reflect.TypeOf((*MockService)(nil).UpdateCluster), arg0, arg1, arg2) } +// UpdateFolder mocks base method. +func (m *MockService) UpdateFolder(arg0 context.Context, arg1 string, arg2 *client.UpdateFolderSpecification) (*client.FolderResource, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateFolder", arg0, arg1, arg2) + ret0, _ := ret[0].(*client.FolderResource) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// UpdateFolder indicates an expected call of UpdateFolder. +func (mr *MockServiceMockRecorder) UpdateFolder(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateFolder", reflect.TypeOf((*MockService)(nil).UpdateFolder), arg0, arg1, arg2) +} + // UpdateGroup mocks base method. func (m *MockService) UpdateGroup(arg0 context.Context, arg1 string, arg2 *client.UpdateGroupRequest) (*client.ScimGroup, *http.Response, error) { m.ctrl.T.Helper() diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/configuration.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/configuration.go index 5e8cc5f9..35470ef9 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/configuration.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/configuration.go @@ -42,7 +42,7 @@ type Configuration struct { func NewConfiguration(apiKey string) *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "ccloud-sdk-go/1.2.0", + UserAgent: "ccloud-sdk-go/1.4.0", Debug: false, ServerURL: DefaultServerURL, apiKey: apiKey, diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_any.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_any.go index 03daeaa0..ad1e6066 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_any.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_any.go @@ -18,7 +18,7 @@ package client -// Any `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); } 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\" }. +// Any `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\" }. type Any 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. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. Type *string `json:"@type,omitempty"` diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_action.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_action.go index 64bbc47f..4f4a729a 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_action.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_action.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -66,6 +65,12 @@ const ( AUDITLOGACTION_SET_CLIENT_CA_CERT AuditLogAction = "AUDIT_LOG_ACTION_SET_CLIENT_CA_CERT" AUDITLOGACTION_UPDATE_CLIENT_CA_CERT AuditLogAction = "AUDIT_LOG_ACTION_UPDATE_CLIENT_CA_CERT" AUDITLOGACTION_DELETE_CLIENT_CA_CERT AuditLogAction = "AUDIT_LOG_ACTION_DELETE_CLIENT_CA_CERT" + AUDITLOGACTION_CREATE_API_OIDC_CONFIG AuditLogAction = "AUDIT_LOG_ACTION_CREATE_API_OIDC_CONFIG" + AUDITLOGACTION_DELETE_API_OIDC_CONFIG AuditLogAction = "AUDIT_LOG_ACTION_DELETE_API_OIDC_CONFIG" + AUDITLOGACTION_UPDATE_API_OIDC_CONFIG AuditLogAction = "AUDIT_LOG_ACTION_UPDATE_API_OIDC_CONFIG" + AUDITLOGACTION_CREATE_FOLDER AuditLogAction = "AUDIT_LOG_ACTION_CREATE_FOLDER" + AUDITLOGACTION_DELETE_FOLDER AuditLogAction = "AUDIT_LOG_ACTION_DELETE_FOLDER" + AUDITLOGACTION_UPDATE_FOLDER AuditLogAction = "AUDIT_LOG_ACTION_UPDATE_FOLDER" ) // All allowed values of AuditLogAction enum. @@ -108,23 +113,12 @@ var AllowedAuditLogActionEnumValues = []AuditLogAction{ "AUDIT_LOG_ACTION_SET_CLIENT_CA_CERT", "AUDIT_LOG_ACTION_UPDATE_CLIENT_CA_CERT", "AUDIT_LOG_ACTION_DELETE_CLIENT_CA_CERT", -} - -func (v *AuditLogAction) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := AuditLogAction(value) - for _, existing := range AllowedAuditLogActionEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid AuditLogAction", value) + "AUDIT_LOG_ACTION_CREATE_API_OIDC_CONFIG", + "AUDIT_LOG_ACTION_DELETE_API_OIDC_CONFIG", + "AUDIT_LOG_ACTION_UPDATE_API_OIDC_CONFIG", + "AUDIT_LOG_ACTION_CREATE_FOLDER", + "AUDIT_LOG_ACTION_DELETE_FOLDER", + "AUDIT_LOG_ACTION_UPDATE_FOLDER", } // NewAuditLogActionFromValue returns a pointer to a valid AuditLogAction diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_source.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_source.go index 3e58e9da..ed884453 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_source.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_audit_log_source.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -42,23 +41,6 @@ var AllowedAuditLogSourceEnumValues = []AuditLogSource{ "AUDIT_LOG_SOURCE_INTERNAL", } -func (v *AuditLogSource) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := AuditLogSource(value) - for _, existing := range AllowedAuditLogSourceEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid AuditLogSource", value) -} - // NewAuditLogSourceFromValue returns a pointer to a valid AuditLogSource // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewAuditLogSourceFromValue(v string) (*AuditLogSource, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_aws_endpoint_connection_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_aws_endpoint_connection_status_type.go index 86e63800..e94085e6 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_aws_endpoint_connection_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_aws_endpoint_connection_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -50,23 +49,6 @@ var AllowedAWSEndpointConnectionStatusTypeEnumValues = []AWSEndpointConnectionSt "EXPIRED", } -func (v *AWSEndpointConnectionStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := AWSEndpointConnectionStatusType(value) - for _, existing := range AllowedAWSEndpointConnectionStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid AWSEndpointConnectionStatusType", value) -} - // NewAWSEndpointConnectionStatusTypeFromValue returns a pointer to a valid AWSEndpointConnectionStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewAWSEndpointConnectionStatusTypeFromValue(v string) (*AWSEndpointConnectionStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_client_ca_cert_status.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_client_ca_cert_status.go index 4059ad0b..a4045dc7 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_client_ca_cert_status.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_client_ca_cert_status.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -42,23 +41,6 @@ var AllowedClientCACertStatusEnumValues = []ClientCACertStatus{ "FAILED", } -func (v *ClientCACertStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ClientCACertStatus(value) - for _, existing := range AllowedClientCACertStatusEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ClientCACertStatus", value) -} - // NewClientCACertStatusFromValue returns a pointer to a valid ClientCACertStatus // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewClientCACertStatusFromValue(v string) (*ClientCACertStatus, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cloud_provider_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cloud_provider_type.go index 5de4f6a7..37a5da4b 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cloud_provider_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cloud_provider_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -40,23 +39,6 @@ var AllowedCloudProviderTypeEnumValues = []CloudProviderType{ "AZURE", } -func (v *CloudProviderType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := CloudProviderType(value) - for _, existing := range AllowedCloudProviderTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid CloudProviderType", value) -} - // NewCloudProviderTypeFromValue returns a pointer to a valid CloudProviderType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewCloudProviderTypeFromValue(v string) (*CloudProviderType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster.go index 9723c47d..bf7596cd 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster.go @@ -36,8 +36,10 @@ type Cluster struct { Name string `json:"name"` NetworkVisibility *NetworkVisibilityType `json:"network_visibility,omitempty"` OperationStatus ClusterStatusType `json:"operation_status"` - Plan PlanType `json:"plan"` - Regions []Region `json:"regions"` + // Limited Access: The parent ID is a folder ID. A \"root\" valued parent ID refers to a cluster at the root level. + ParentId *string `json:"parent_id,omitempty"` + Plan PlanType `json:"plan"` + Regions []Region `json:"regions"` // sql_dns is the DNS name of SQL interface of the cluster. SqlDns *string `json:"sql_dns,omitempty"` State ClusterStateType `json:"state"` @@ -248,6 +250,20 @@ func (o *Cluster) SetOperationStatus(v ClusterStatusType) { o.OperationStatus = v } +// GetParentId returns the ParentId field value if set, zero value otherwise. +func (o *Cluster) GetParentId() string { + if o == nil || o.ParentId == nil { + var ret string + return ret + } + return *o.ParentId +} + +// SetParentId gets a reference to the given string and assigns it to the ParentId field. +func (o *Cluster) SetParentId(v string) { + o.ParentId = &v +} + // GetPlan returns the Plan field value. func (o *Cluster) GetPlan() PlanType { if o == nil { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_major_version_support_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_major_version_support_status_type.go index e87781cc..2b725066 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_major_version_support_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_major_version_support_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -40,23 +39,6 @@ var AllowedClusterMajorVersionSupportStatusTypeEnumValues = []ClusterMajorVersio "PREVIEW", } -func (v *ClusterMajorVersionSupportStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ClusterMajorVersionSupportStatusType(value) - for _, existing := range AllowedClusterMajorVersionSupportStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ClusterMajorVersionSupportStatusType", value) -} - // NewClusterMajorVersionSupportStatusTypeFromValue returns a pointer to a valid ClusterMajorVersionSupportStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewClusterMajorVersionSupportStatusTypeFromValue(v string) (*ClusterMajorVersionSupportStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_state_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_state_type.go index 6386abe0..5fff9621 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_state_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_state_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -44,23 +43,6 @@ var AllowedClusterStateTypeEnumValues = []ClusterStateType{ "LOCKED", } -func (v *ClusterStateType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ClusterStateType(value) - for _, existing := range AllowedClusterStateTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ClusterStateType", value) -} - // NewClusterStateTypeFromValue returns a pointer to a valid ClusterStateType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewClusterStateTypeFromValue(v string) (*ClusterStateType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_status_type.go index efccdd73..e299b1e8 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -90,23 +89,6 @@ var AllowedClusterStatusTypeEnumValues = []ClusterStatusType{ "DEDICATED_FULL_CLUSTER_RESTORE_FAILED", } -func (v *ClusterStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ClusterStatusType(value) - for _, existing := range AllowedClusterStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ClusterStatusType", value) -} - // NewClusterStatusTypeFromValue returns a pointer to a valid ClusterStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewClusterStatusTypeFromValue(v string) (*ClusterStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_upgrade_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_upgrade_status_type.go index f858bd8b..28f4300a 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_upgrade_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_upgrade_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -44,23 +43,6 @@ var AllowedClusterUpgradeStatusTypeEnumValues = []ClusterUpgradeStatusType{ "ROLLBACK_RUNNING", } -func (v *ClusterUpgradeStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ClusterUpgradeStatusType(value) - for _, existing := range AllowedClusterUpgradeStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ClusterUpgradeStatusType", value) -} - // NewClusterUpgradeStatusTypeFromValue returns a pointer to a valid ClusterUpgradeStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewClusterUpgradeStatusTypeFromValue(v string) (*ClusterUpgradeStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_version_deferral_policy_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_version_deferral_policy_type.go index 42776c1c..6625f264 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_version_deferral_policy_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cluster_version_deferral_policy_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedClusterVersionDeferralPolicyTypeEnumValues = []ClusterVersionDeferral "FIXED_DEFERRAL", } -func (v *ClusterVersionDeferralPolicyType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ClusterVersionDeferralPolicyType(value) - for _, existing := range AllowedClusterVersionDeferralPolicyTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ClusterVersionDeferralPolicyType", value) -} - // NewClusterVersionDeferralPolicyTypeFromValue returns a pointer to a valid ClusterVersionDeferralPolicyType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewClusterVersionDeferralPolicyTypeFromValue(v string) (*ClusterVersionDeferralPolicyType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_customer_action.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_customer_action.go index 1797d9f2..6e702747 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_customer_action.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_customer_action.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -36,23 +35,6 @@ var AllowedCMEKCustomerActionEnumValues = []CMEKCustomerAction{ "REVOKE", } -func (v *CMEKCustomerAction) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := CMEKCustomerAction(value) - for _, existing := range AllowedCMEKCustomerActionEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid CMEKCustomerAction", value) -} - // NewCMEKCustomerActionFromValue returns a pointer to a valid CMEKCustomerAction // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewCMEKCustomerActionFromValue(v string) (*CMEKCustomerAction, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_key_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_key_type.go index b2883a9f..3a1aef01 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_key_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_key_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -40,23 +39,6 @@ var AllowedCMEKKeyTypeEnumValues = []CMEKKeyType{ "NULL_KMS", } -func (v *CMEKKeyType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := CMEKKeyType(value) - for _, existing := range AllowedCMEKKeyTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid CMEKKeyType", value) -} - // NewCMEKKeyTypeFromValue returns a pointer to a valid CMEKKeyType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewCMEKKeyTypeFromValue(v string) (*CMEKKeyType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_status.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_status.go index 79e74c61..6446e9b7 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_status.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_cmek_status.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -56,23 +55,6 @@ var AllowedCMEKStatusEnumValues = []CMEKStatus{ "REVOKE_FAILED", } -func (v *CMEKStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := CMEKStatus(value) - for _, existing := range AllowedCMEKStatusEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid CMEKStatus", value) -} - // NewCMEKStatusFromValue returns a pointer to a valid CMEKStatus // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewCMEKStatusFromValue(v string) (*CMEKStatus, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_connection_string_parameters.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_connection_string_parameters.go new file mode 100644 index 00000000..65e7df4e --- /dev/null +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_connection_string_parameters.go @@ -0,0 +1,106 @@ +// Copyright 2023 The Cockroach Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// CockroachDB Cloud API +// API version: 2023-04-10 + +package client + +// ConnectionStringParameters Individual parameters used to create a connection string.. +type ConnectionStringParameters struct { + Database string `json:"Database"` + Host string `json:"Host"` + Port string `json:"Port"` + Username *string `json:"Username,omitempty"` +} + +// NewConnectionStringParameters instantiates a new ConnectionStringParameters object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConnectionStringParameters(database string, host string, port string) *ConnectionStringParameters { + p := ConnectionStringParameters{} + p.Database = database + p.Host = host + p.Port = port + return &p +} + +// NewConnectionStringParametersWithDefaults instantiates a new ConnectionStringParameters object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConnectionStringParametersWithDefaults() *ConnectionStringParameters { + p := ConnectionStringParameters{} + return &p +} + +// GetDatabase returns the Database field value. +func (o *ConnectionStringParameters) GetDatabase() string { + if o == nil { + var ret string + return ret + } + + return o.Database +} + +// SetDatabase sets field value. +func (o *ConnectionStringParameters) SetDatabase(v string) { + o.Database = v +} + +// GetHost returns the Host field value. +func (o *ConnectionStringParameters) GetHost() string { + if o == nil { + var ret string + return ret + } + + return o.Host +} + +// SetHost sets field value. +func (o *ConnectionStringParameters) SetHost(v string) { + o.Host = v +} + +// GetPort returns the Port field value. +func (o *ConnectionStringParameters) GetPort() string { + if o == nil { + var ret string + return ret + } + + return o.Port +} + +// SetPort sets field value. +func (o *ConnectionStringParameters) SetPort(v string) { + o.Port = v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *ConnectionStringParameters) GetUsername() string { + if o == nil || o.Username == nil { + var ret string + return ret + } + return *o.Username +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *ConnectionStringParameters) SetUsername(v string) { + o.Username = &v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_cluster_specification.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_cluster_specification.go index cc0c6bdf..a773737b 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_cluster_specification.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_cluster_specification.go @@ -20,7 +20,9 @@ package client // CreateClusterSpecification struct for CreateClusterSpecification. type CreateClusterSpecification struct { - Dedicated *DedicatedClusterCreateSpecification `json:"dedicated,omitempty"` + Dedicated *DedicatedClusterCreateSpecification `json:"dedicated,omitempty"` + // Limited Access: The parent ID is a folder ID. An empty string or \"root\" will create a cluster at the root level. + ParentId *string `json:"parent_id,omitempty"` Serverless *ServerlessClusterCreateSpecification `json:"serverless,omitempty"` } @@ -47,6 +49,20 @@ func (o *CreateClusterSpecification) SetDedicated(v DedicatedClusterCreateSpecif o.Dedicated = &v } +// GetParentId returns the ParentId field value if set, zero value otherwise. +func (o *CreateClusterSpecification) GetParentId() string { + if o == nil || o.ParentId == nil { + var ret string + return ret + } + return *o.ParentId +} + +// SetParentId gets a reference to the given string and assigns it to the ParentId field. +func (o *CreateClusterSpecification) SetParentId(v string) { + o.ParentId = &v +} + // GetServerless returns the Serverless field value if set, zero value otherwise. func (o *CreateClusterSpecification) GetServerless() ServerlessClusterCreateSpecification { if o == nil || o.Serverless == nil { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_folder_request.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_folder_request.go new file mode 100644 index 00000000..0240cfdf --- /dev/null +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_create_folder_request.go @@ -0,0 +1,73 @@ +// Copyright 2023 The Cockroach Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// CockroachDB Cloud API +// API version: 2023-04-10 + +package client + +// CreateFolderRequest struct for CreateFolderRequest. +type CreateFolderRequest struct { + Name string `json:"name"` + // The parent ID is a folder ID. An empty string or \"root\" will create a folder at the root level. + ParentId *string `json:"parent_id,omitempty"` +} + +// NewCreateFolderRequest instantiates a new CreateFolderRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateFolderRequest(name string) *CreateFolderRequest { + p := CreateFolderRequest{} + p.Name = name + return &p +} + +// NewCreateFolderRequestWithDefaults instantiates a new CreateFolderRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateFolderRequestWithDefaults() *CreateFolderRequest { + p := CreateFolderRequest{} + return &p +} + +// GetName returns the Name field value. +func (o *CreateFolderRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// SetName sets field value. +func (o *CreateFolderRequest) SetName(v string) { + o.Name = v +} + +// GetParentId returns the ParentId field value if set, zero value otherwise. +func (o *CreateFolderRequest) GetParentId() string { + if o == nil || o.ParentId == nil { + var ret string + return ret + } + return *o.ParentId +} + +// SetParentId gets a reference to the given string and assigns it to the ParentId field. +func (o *CreateFolderRequest) SetParentId(v string) { + o.ParentId = &v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_currency_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_currency_type.go index 4ac9a890..c12bcb99 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_currency_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_currency_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedCurrencyTypeEnumValues = []CurrencyType{ "CRDB_CLOUD_CREDITS", } -func (v *CurrencyType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := CurrencyType(value) - for _, existing := range AllowedCurrencyTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid CurrencyType", value) -} - // NewCurrencyTypeFromValue returns a pointer to a valid CurrencyType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewCurrencyTypeFromValue(v string) (*CurrencyType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_datadog_site_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_datadog_site_type.go index c53c3822..ea87191a 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_datadog_site_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_datadog_site_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -44,23 +43,6 @@ var AllowedDatadogSiteTypeEnumValues = []DatadogSiteType{ "EU1", } -func (v *DatadogSiteType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := DatadogSiteType(value) - for _, existing := range AllowedDatadogSiteTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid DatadogSiteType", value) -} - // NewDatadogSiteTypeFromValue returns a pointer to a valid DatadogSiteType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewDatadogSiteTypeFromValue(v string) (*DatadogSiteType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_egress_traffic_policy_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_egress_traffic_policy_type.go index 2746fe5b..7f1f1a9e 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_egress_traffic_policy_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_egress_traffic_policy_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -44,23 +43,6 @@ var AllowedEgressTrafficPolicyTypeEnumValues = []EgressTrafficPolicyType{ "UPDATING", } -func (v *EgressTrafficPolicyType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := EgressTrafficPolicyType(value) - for _, existing := range AllowedEgressTrafficPolicyTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid EgressTrafficPolicyType", value) -} - // NewEgressTrafficPolicyTypeFromValue returns a pointer to a valid EgressTrafficPolicyType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewEgressTrafficPolicyTypeFromValue(v string) (*EgressTrafficPolicyType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_enable_log_export_request.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_enable_log_export_request.go index 261df4fe..09cf61e9 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_enable_log_export_request.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_enable_log_export_request.go @@ -26,6 +26,8 @@ type EnableLogExportRequest struct { Groups *[]LogExportGroup `json:"groups,omitempty"` // log_name is an identifier for the logs in the customer's log sink. LogName string `json:"log_name"` + // omitted_channels is a list of channels that the user does not want to export logs for. + OmittedChannels *[]string `json:"omitted_channels,omitempty"` // redact allows the customer to set a default redaction policy for logs before they are exported to the target sink. If a group config omits a redact flag and this one is set to `true`, then that group will receive redacted logs. Redact *bool `json:"redact,omitempty"` // region allows the customer to override the destination region for all logs for a cluster. @@ -97,6 +99,20 @@ func (o *EnableLogExportRequest) SetLogName(v string) { o.LogName = v } +// GetOmittedChannels returns the OmittedChannels field value if set, zero value otherwise. +func (o *EnableLogExportRequest) GetOmittedChannels() []string { + if o == nil || o.OmittedChannels == nil { + var ret []string + return ret + } + return *o.OmittedChannels +} + +// SetOmittedChannels gets a reference to the given []string and assigns it to the OmittedChannels field. +func (o *EnableLogExportRequest) SetOmittedChannels(v []string) { + o.OmittedChannels = &v +} + // GetRedact returns the Redact field value if set, zero value otherwise. func (o *EnableLogExportRequest) GetRedact() bool { if o == nil || o.Redact == nil { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource.go new file mode 100644 index 00000000..beedcb71 --- /dev/null +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource.go @@ -0,0 +1,147 @@ +// Copyright 2023 The Cockroach Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// CockroachDB Cloud API +// API version: 2023-04-10 + +package client + +// FolderResource FolderResource describes a resource, and includes info about its lineage (parent/ancestors).. +type FolderResource struct { + // name is the resource's name. + Name string `json:"name"` + // organization_id is the id of the organization this resource belongs to. + OrganizationId string `json:"organization_id"` + // parent_id is the id of the resource's parent folder. \"root\" represents a root level resource. + ParentId string `json:"parent_id"` + // path contains the ids and names of ancestors that make up the resource's lineage. + Path []PathSegment `json:"path"` + // resource_id is the resource's id. + ResourceId string `json:"resource_id"` + ResourceType FolderResourceTypeType `json:"resource_type"` +} + +// NewFolderResource instantiates a new FolderResource object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFolderResource(name string, organizationId string, parentId string, path []PathSegment, resourceId string, resourceType FolderResourceTypeType) *FolderResource { + p := FolderResource{} + p.Name = name + p.OrganizationId = organizationId + p.ParentId = parentId + p.Path = path + p.ResourceId = resourceId + p.ResourceType = resourceType + return &p +} + +// NewFolderResourceWithDefaults instantiates a new FolderResource object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFolderResourceWithDefaults() *FolderResource { + p := FolderResource{} + return &p +} + +// GetName returns the Name field value. +func (o *FolderResource) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// SetName sets field value. +func (o *FolderResource) SetName(v string) { + o.Name = v +} + +// GetOrganizationId returns the OrganizationId field value. +func (o *FolderResource) GetOrganizationId() string { + if o == nil { + var ret string + return ret + } + + return o.OrganizationId +} + +// SetOrganizationId sets field value. +func (o *FolderResource) SetOrganizationId(v string) { + o.OrganizationId = v +} + +// GetParentId returns the ParentId field value. +func (o *FolderResource) GetParentId() string { + if o == nil { + var ret string + return ret + } + + return o.ParentId +} + +// SetParentId sets field value. +func (o *FolderResource) SetParentId(v string) { + o.ParentId = v +} + +// GetPath returns the Path field value. +func (o *FolderResource) GetPath() []PathSegment { + if o == nil { + var ret []PathSegment + return ret + } + + return o.Path +} + +// SetPath sets field value. +func (o *FolderResource) SetPath(v []PathSegment) { + o.Path = v +} + +// GetResourceId returns the ResourceId field value. +func (o *FolderResource) GetResourceId() string { + if o == nil { + var ret string + return ret + } + + return o.ResourceId +} + +// SetResourceId sets field value. +func (o *FolderResource) SetResourceId(v string) { + o.ResourceId = v +} + +// GetResourceType returns the ResourceType field value. +func (o *FolderResource) GetResourceType() FolderResourceTypeType { + if o == nil { + var ret FolderResourceTypeType + return ret + } + + return o.ResourceType +} + +// SetResourceType sets field value. +func (o *FolderResource) SetResourceType(v FolderResourceTypeType) { + o.ResourceType = v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_list.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_list.go new file mode 100644 index 00000000..b88be39b --- /dev/null +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_list.go @@ -0,0 +1,62 @@ +// Copyright 2023 The Cockroach Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// CockroachDB Cloud API +// API version: 2023-04-10 + +package client + +// FolderResourceList FolderResourceList contains a list of resources.. +type FolderResourceList struct { + Pagination *KeysetPaginationResponse `json:"pagination,omitempty"` + Resources *[]FolderResource `json:"resources,omitempty"` +} + +// NewFolderResourceList instantiates a new FolderResourceList object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFolderResourceList() *FolderResourceList { + p := FolderResourceList{} + return &p +} + +// GetPagination returns the Pagination field value if set, zero value otherwise. +func (o *FolderResourceList) GetPagination() KeysetPaginationResponse { + if o == nil || o.Pagination == nil { + var ret KeysetPaginationResponse + return ret + } + return *o.Pagination +} + +// SetPagination gets a reference to the given KeysetPaginationResponse and assigns it to the Pagination field. +func (o *FolderResourceList) SetPagination(v KeysetPaginationResponse) { + o.Pagination = &v +} + +// GetResources returns the Resources field value if set, zero value otherwise. +func (o *FolderResourceList) GetResources() []FolderResource { + if o == nil || o.Resources == nil { + var ret []FolderResource + return ret + } + return *o.Resources +} + +// SetResources gets a reference to the given []FolderResource and assigns it to the Resources field. +func (o *FolderResourceList) SetResources(v []FolderResource) { + o.Resources = &v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_type_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_type_type.go new file mode 100644 index 00000000..08e5ca46 --- /dev/null +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_folder_resource_type_type.go @@ -0,0 +1,64 @@ +// Copyright 2023 The Cockroach Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// CockroachDB Cloud API +// API version: 2023-04-10 + +package client + +import ( + "fmt" +) + +// FolderResourceTypeType the model 'FolderResourceTypeType'. +type FolderResourceTypeType string + +// List of FolderResourceType.Type. +const ( + FOLDERRESOURCETYPETYPE_FOLDER FolderResourceTypeType = "FOLDER" + FOLDERRESOURCETYPETYPE_CLUSTER FolderResourceTypeType = "CLUSTER" +) + +// All allowed values of FolderResourceTypeType enum. +var AllowedFolderResourceTypeTypeEnumValues = []FolderResourceTypeType{ + "FOLDER", + "CLUSTER", +} + +// NewFolderResourceTypeTypeFromValue returns a pointer to a valid FolderResourceTypeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFolderResourceTypeTypeFromValue(v string) (*FolderResourceTypeType, error) { + ev := FolderResourceTypeType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FolderResourceTypeType: valid values are %v", v, AllowedFolderResourceTypeTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FolderResourceTypeType) IsValid() bool { + for _, existing := range AllowedFolderResourceTypeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FolderResourceType.Type value. +func (v FolderResourceTypeType) Ptr() *FolderResourceTypeType { + return &v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_get_connection_string_response.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_get_connection_string_response.go index fe8b1e01..5f10a1e2 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_get_connection_string_response.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_get_connection_string_response.go @@ -21,44 +21,55 @@ package client // GetConnectionStringResponse struct for GetConnectionStringResponse. type GetConnectionStringResponse struct { // connection_string contains the full connection string with parameters formatted inline. - ConnectionString *string `json:"connection_string,omitempty"` - // params contains a list of individual key parameters for generating nonstandard connection strings. - Params *map[string]string `json:"params,omitempty"` + ConnectionString string `json:"connection_string"` + Params ConnectionStringParameters `json:"params"` } // NewGetConnectionStringResponse instantiates a new GetConnectionStringResponse object. // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGetConnectionStringResponse() *GetConnectionStringResponse { +func NewGetConnectionStringResponse(connectionString string, params ConnectionStringParameters) *GetConnectionStringResponse { p := GetConnectionStringResponse{} + p.ConnectionString = connectionString + p.Params = params return &p } -// GetConnectionString returns the ConnectionString field value if set, zero value otherwise. +// NewGetConnectionStringResponseWithDefaults instantiates a new GetConnectionStringResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetConnectionStringResponseWithDefaults() *GetConnectionStringResponse { + p := GetConnectionStringResponse{} + return &p +} + +// GetConnectionString returns the ConnectionString field value. func (o *GetConnectionStringResponse) GetConnectionString() string { - if o == nil || o.ConnectionString == nil { + if o == nil { var ret string return ret } - return *o.ConnectionString + + return o.ConnectionString } -// SetConnectionString gets a reference to the given string and assigns it to the ConnectionString field. +// SetConnectionString sets field value. func (o *GetConnectionStringResponse) SetConnectionString(v string) { - o.ConnectionString = &v + o.ConnectionString = v } -// GetParams returns the Params field value if set, zero value otherwise. -func (o *GetConnectionStringResponse) GetParams() map[string]string { - if o == nil || o.Params == nil { - var ret map[string]string +// GetParams returns the Params field value. +func (o *GetConnectionStringResponse) GetParams() ConnectionStringParameters { + if o == nil { + var ret ConnectionStringParameters return ret } - return *o.Params + + return o.Params } -// SetParams gets a reference to the given map[string]string and assigns it to the Params field. -func (o *GetConnectionStringResponse) SetParams(v map[string]string) { - o.Params = &v +// SetParams sets field value. +func (o *GetConnectionStringResponse) SetParams(v ConnectionStringParameters) { + o.Params = v } diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_cluster_specification.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_cluster_specification.go index dcae987d..1b68640c 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_cluster_specification.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_cluster_specification.go @@ -26,6 +26,8 @@ type LogExportClusterSpecification struct { Groups *[]LogExportGroup `json:"groups,omitempty"` // log_name is an identifier for the logs in the customer's log sink. LogName *string `json:"log_name,omitempty"` + // omitted_channels is a list of channels that the user does not want to export logs for. + OmittedChannels *[]string `json:"omitted_channels,omitempty"` // redact controls whether logs are redacted before forwarding to customer sinks. By default they are not redacted. Redact *bool `json:"redact,omitempty"` // region controls whether all logs are sent to a specific region in the customer sink. By default, logs will remain their region of origin depending on the cluster node's region. @@ -84,6 +86,20 @@ func (o *LogExportClusterSpecification) SetLogName(v string) { o.LogName = &v } +// GetOmittedChannels returns the OmittedChannels field value if set, zero value otherwise. +func (o *LogExportClusterSpecification) GetOmittedChannels() []string { + if o == nil || o.OmittedChannels == nil { + var ret []string + return ret + } + return *o.OmittedChannels +} + +// SetOmittedChannels gets a reference to the given []string and assigns it to the OmittedChannels field. +func (o *LogExportClusterSpecification) SetOmittedChannels(v []string) { + o.OmittedChannels = &v +} + // GetRedact returns the Redact field value if set, zero value otherwise. func (o *LogExportClusterSpecification) GetRedact() bool { if o == nil || o.Redact == nil { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_status.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_status.go index 3152d192..30e65731 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_status.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_status.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -46,23 +45,6 @@ var AllowedLogExportStatusEnumValues = []LogExportStatus{ "ENABLE_FAILED", } -func (v *LogExportStatus) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := LogExportStatus(value) - for _, existing := range AllowedLogExportStatusEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid LogExportStatus", value) -} - // NewLogExportStatusFromValue returns a pointer to a valid LogExportStatus // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewLogExportStatusFromValue(v string) (*LogExportStatus, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_type.go index a45f02f4..0ae9c045 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_export_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedLogExportTypeEnumValues = []LogExportType{ "GCP_CLOUD_LOGGING", } -func (v *LogExportType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := LogExportType(value) - for _, existing := range AllowedLogExportTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid LogExportType", value) -} - // NewLogExportTypeFromValue returns a pointer to a valid LogExportType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewLogExportTypeFromValue(v string) (*LogExportType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_level_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_level_type.go index ac21ca5b..8d4a3886 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_level_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_log_level_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -42,23 +41,6 @@ var AllowedLogLevelTypeEnumValues = []LogLevelType{ "FATAL", } -func (v *LogLevelType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := LogLevelType(value) - for _, existing := range AllowedLogLevelTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid LogLevelType", value) -} - // NewLogLevelTypeFromValue returns a pointer to a valid LogLevelType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewLogLevelTypeFromValue(v string) (*LogLevelType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_metric_export_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_metric_export_status_type.go index 06786ed6..8bb2812e 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_metric_export_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_metric_export_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -44,23 +43,6 @@ var AllowedMetricExportStatusTypeEnumValues = []MetricExportStatusType{ "ERROR", } -func (v *MetricExportStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := MetricExportStatusType(value) - for _, existing := range AllowedMetricExportStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid MetricExportStatusType", value) -} - // NewMetricExportStatusTypeFromValue returns a pointer to a valid MetricExportStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewMetricExportStatusTypeFromValue(v string) (*MetricExportStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_network_visibility_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_network_visibility_type.go index ffa3ade2..6e845a9d 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_network_visibility_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_network_visibility_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedNetworkVisibilityTypeEnumValues = []NetworkVisibilityType{ "PRIVATE", } -func (v *NetworkVisibilityType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := NetworkVisibilityType(value) - for _, existing := range AllowedNetworkVisibilityTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid NetworkVisibilityType", value) -} - // NewNetworkVisibilityTypeFromValue returns a pointer to a valid NetworkVisibilityType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewNetworkVisibilityTypeFromValue(v string) (*NetworkVisibilityType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_node_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_node_status_type.go index d94c9023..85c3476d 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_node_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_node_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedNodeStatusTypeEnumValues = []NodeStatusType{ "NOT_READY", } -func (v *NodeStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := NodeStatusType(value) - for _, existing := range AllowedNodeStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid NodeStatusType", value) -} - // NewNodeStatusTypeFromValue returns a pointer to a valid NodeStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewNodeStatusTypeFromValue(v string) (*NodeStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_operating_system_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_operating_system_type.go index bd2c04e1..539740a3 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_operating_system_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_operating_system_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -40,23 +39,6 @@ var AllowedOperatingSystemTypeEnumValues = []OperatingSystemType{ "WINDOWS", } -func (v *OperatingSystemType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := OperatingSystemType(value) - for _, existing := range AllowedOperatingSystemTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid OperatingSystemType", value) -} - // NewOperatingSystemTypeFromValue returns a pointer to a valid OperatingSystemType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewOperatingSystemTypeFromValue(v string) (*OperatingSystemType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_organization_user_role_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_organization_user_role_type.go index ea2a55a1..310f6058 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_organization_user_role_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_organization_user_role_type.go @@ -19,11 +19,10 @@ package client import ( - "encoding/json" "fmt" ) -// OrganizationUserRoleType the model 'OrganizationUserRoleType'. +// OrganizationUserRoleType - DEVELOPER: To be deprecated - ADMIN: To be deprecated - FOLDER_ADMIN: Limited Access: A folder admin role. - FOLDER_MOVER: Limited Access: A folder mover role. type OrganizationUserRoleType string // List of OrganizationUserRole.Type. @@ -37,6 +36,8 @@ const ( ORGANIZATIONUSERROLETYPE_CLUSTER_OPERATOR_WRITER OrganizationUserRoleType = "CLUSTER_OPERATOR_WRITER" ORGANIZATIONUSERROLETYPE_CLUSTER_DEVELOPER OrganizationUserRoleType = "CLUSTER_DEVELOPER" ORGANIZATIONUSERROLETYPE_CLUSTER_CREATOR OrganizationUserRoleType = "CLUSTER_CREATOR" + ORGANIZATIONUSERROLETYPE_FOLDER_ADMIN OrganizationUserRoleType = "FOLDER_ADMIN" + ORGANIZATIONUSERROLETYPE_FOLDER_MOVER OrganizationUserRoleType = "FOLDER_MOVER" ) // All allowed values of OrganizationUserRoleType enum. @@ -50,23 +51,8 @@ var AllowedOrganizationUserRoleTypeEnumValues = []OrganizationUserRoleType{ "CLUSTER_OPERATOR_WRITER", "CLUSTER_DEVELOPER", "CLUSTER_CREATOR", -} - -func (v *OrganizationUserRoleType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := OrganizationUserRoleType(value) - for _, existing := range AllowedOrganizationUserRoleTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid OrganizationUserRoleType", value) + "FOLDER_ADMIN", + "FOLDER_MOVER", } // NewOrganizationUserRoleTypeFromValue returns a pointer to a valid OrganizationUserRoleType diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_path_segment.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_path_segment.go new file mode 100644 index 00000000..3bdb1878 --- /dev/null +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_path_segment.go @@ -0,0 +1,64 @@ +// Copyright 2023 The Cockroach Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// CockroachDB Cloud API +// API version: 2023-04-10 + +package client + +// PathSegment struct for PathSegment. +type PathSegment struct { + // id is a folder id. + Id *string `json:"id,omitempty"` + // name is a folder name. + Name *string `json:"name,omitempty"` +} + +// NewPathSegment instantiates a new PathSegment object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPathSegment() *PathSegment { + p := PathSegment{} + return &p +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PathSegment) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PathSegment) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PathSegment) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PathSegment) SetName(v string) { + o.Name = &v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_plan_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_plan_type.go index c4355689..e51045c3 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_plan_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_plan_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -40,23 +39,6 @@ var AllowedPlanTypeEnumValues = []PlanType{ "SERVERLESS", } -func (v *PlanType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := PlanType(value) - for _, existing := range AllowedPlanTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid PlanType", value) -} - // NewPlanTypeFromValue returns a pointer to a valid PlanType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewPlanTypeFromValue(v string) (*PlanType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_private_endpoint_service_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_private_endpoint_service_status_type.go index d1ab269a..33db6346 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_private_endpoint_service_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_private_endpoint_service_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -44,23 +43,6 @@ var AllowedPrivateEndpointServiceStatusTypeEnumValues = []PrivateEndpointService "DELETE_FAILED", } -func (v *PrivateEndpointServiceStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := PrivateEndpointServiceStatusType(value) - for _, existing := range AllowedPrivateEndpointServiceStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid PrivateEndpointServiceStatusType", value) -} - // NewPrivateEndpointServiceStatusTypeFromValue returns a pointer to a valid PrivateEndpointServiceStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewPrivateEndpointServiceStatusTypeFromValue(v string) (*PrivateEndpointServiceStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_quantity_unit_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_quantity_unit_type.go index a875684b..3cc0763b 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_quantity_unit_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_quantity_unit_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedQuantityUnitTypeEnumValues = []QuantityUnitType{ "REQUEST_UNITS", } -func (v *QuantityUnitType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := QuantityUnitType(value) - for _, existing := range AllowedQuantityUnitTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid QuantityUnitType", value) -} - // NewQuantityUnitTypeFromValue returns a pointer to a valid QuantityUnitType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewQuantityUnitTypeFromValue(v string) (*QuantityUnitType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_resource_type_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_resource_type_type.go index 7d7f971b..ba022d4e 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_resource_type_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_resource_type_type.go @@ -19,40 +19,24 @@ package client import ( - "encoding/json" "fmt" ) -// ResourceTypeType the model 'ResourceTypeType'. +// ResourceTypeType - ORGANIZATION: An organization. - CLUSTER: A cluster resource. - FOLDER: Limited Access: A folder resource. type ResourceTypeType string // List of ResourceType.Type. const ( RESOURCETYPETYPE_ORGANIZATION ResourceTypeType = "ORGANIZATION" RESOURCETYPETYPE_CLUSTER ResourceTypeType = "CLUSTER" + RESOURCETYPETYPE_FOLDER ResourceTypeType = "FOLDER" ) // All allowed values of ResourceTypeType enum. var AllowedResourceTypeTypeEnumValues = []ResourceTypeType{ "ORGANIZATION", "CLUSTER", -} - -func (v *ResourceTypeType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := ResourceTypeType(value) - for _, existing := range AllowedResourceTypeTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ResourceTypeType", value) + "FOLDER", } // NewResourceTypeTypeFromValue returns a pointer to a valid ResourceTypeType diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_serverless_cluster_create_specification.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_serverless_cluster_create_specification.go index b15897a3..38d603fa 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_serverless_cluster_create_specification.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_serverless_cluster_create_specification.go @@ -27,6 +27,8 @@ type ServerlessClusterCreateSpecification struct { // spend_limit is the maximum monthly charge for a cluster, in US cents. We recommend using usage_limits instead, since spend_limit will be deprecated in the future. SpendLimit *int32 `json:"spend_limit,omitempty"` UsageLimits *UsageLimits `json:"usage_limits,omitempty"` + // WithEmptyIPAllowlist creates a cluster with no entries in the IP Allowlist. By default, Serverless clusters have one IP allowlist entry that opens the cluster to any IP. Set this property to true to ensure the cluster is closed to public traffic by default. + WithEmptyIpAllowlist *bool `json:"with_empty_ip_allowlist,omitempty"` } // NewServerlessClusterCreateSpecification instantiates a new ServerlessClusterCreateSpecification object. @@ -103,3 +105,17 @@ func (o *ServerlessClusterCreateSpecification) GetUsageLimits() UsageLimits { func (o *ServerlessClusterCreateSpecification) SetUsageLimits(v UsageLimits) { o.UsageLimits = &v } + +// GetWithEmptyIpAllowlist returns the WithEmptyIpAllowlist field value if set, zero value otherwise. +func (o *ServerlessClusterCreateSpecification) GetWithEmptyIpAllowlist() bool { + if o == nil || o.WithEmptyIpAllowlist == nil { + var ret bool + return ret + } + return *o.WithEmptyIpAllowlist +} + +// SetWithEmptyIpAllowlist gets a reference to the given bool and assigns it to the WithEmptyIpAllowlist field. +func (o *ServerlessClusterCreateSpecification) SetWithEmptyIpAllowlist(v bool) { + o.WithEmptyIpAllowlist = &v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_set_aws_endpoint_connection_status_type.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_set_aws_endpoint_connection_status_type.go index 4feb33bd..0774a91b 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_set_aws_endpoint_connection_status_type.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_set_aws_endpoint_connection_status_type.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedSetAWSEndpointConnectionStatusTypeEnumValues = []SetAWSEndpointConnec "REJECTED", } -func (v *SetAWSEndpointConnectionStatusType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := SetAWSEndpointConnectionStatusType(value) - for _, existing := range AllowedSetAWSEndpointConnectionStatusTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid SetAWSEndpointConnectionStatusType", value) -} - // NewSetAWSEndpointConnectionStatusTypeFromValue returns a pointer to a valid SetAWSEndpointConnectionStatusType // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewSetAWSEndpointConnectionStatusTypeFromValue(v string) (*SetAWSEndpointConnectionStatusType, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_sort_order.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_sort_order.go index 573f13f9..f94920f5 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_sort_order.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_sort_order.go @@ -19,7 +19,6 @@ package client import ( - "encoding/json" "fmt" ) @@ -38,23 +37,6 @@ var AllowedSortOrderEnumValues = []SortOrder{ "DESC", } -func (v *SortOrder) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := SortOrder(value) - for _, existing := range AllowedSortOrderEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid SortOrder", value) -} - // NewSortOrderFromValue returns a pointer to a valid SortOrder // for the value passed as argument, or an error if the value passed is not allowed by the enum. func NewSortOrderFromValue(v string) (*SortOrder, error) { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_cluster_specification.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_cluster_specification.go index 5c9b16af..02ea7b2e 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_cluster_specification.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_cluster_specification.go @@ -20,7 +20,9 @@ package client // UpdateClusterSpecification Set `upgrade_status` to 'UPGRADE_RUNNING' to start an upgrade. Multi-node clusters will undergo a rolling upgrade and will remain available, but single-node clusters will be briefly unavailable while the upgrade takes place. Upgrades will be finalized automatically after 72 hours, or can be manually finalized by setting the value to 'FINALIZED'. Before the cluster is finalized, it can be rolled back by setting the value to 'ROLLBACK_RUNNING'. Version upgrade operations cannot be performed simultaneously with other update operations.. type UpdateClusterSpecification struct { - Dedicated *DedicatedClusterUpdateSpecification `json:"dedicated,omitempty"` + Dedicated *DedicatedClusterUpdateSpecification `json:"dedicated,omitempty"` + // Limited Access: The parent ID is a folder ID. An empty string or \"root\" represents the root level. + ParentId *string `json:"parent_id,omitempty"` Serverless *ServerlessClusterUpdateSpecification `json:"serverless,omitempty"` UpgradeStatus *ClusterUpgradeStatusType `json:"upgrade_status,omitempty"` } @@ -48,6 +50,20 @@ func (o *UpdateClusterSpecification) SetDedicated(v DedicatedClusterUpdateSpecif o.Dedicated = &v } +// GetParentId returns the ParentId field value if set, zero value otherwise. +func (o *UpdateClusterSpecification) GetParentId() string { + if o == nil || o.ParentId == nil { + var ret string + return ret + } + return *o.ParentId +} + +// SetParentId gets a reference to the given string and assigns it to the ParentId field. +func (o *UpdateClusterSpecification) SetParentId(v string) { + o.ParentId = &v +} + // GetServerless returns the Serverless field value if set, zero value otherwise. func (o *UpdateClusterSpecification) GetServerless() ServerlessClusterUpdateSpecification { if o == nil || o.Serverless == nil { diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_folder_specification.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_folder_specification.go new file mode 100644 index 00000000..2844447a --- /dev/null +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/model_update_folder_specification.go @@ -0,0 +1,62 @@ +// Copyright 2023 The Cockroach Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// CockroachDB Cloud API +// API version: 2023-04-10 + +package client + +// UpdateFolderSpecification Set `parent_id` to empty string ” or 'root' to move a folder to the root level.. +type UpdateFolderSpecification struct { + Name *string `json:"name,omitempty"` + ParentId *string `json:"parent_id,omitempty"` +} + +// NewUpdateFolderSpecification instantiates a new UpdateFolderSpecification object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateFolderSpecification() *UpdateFolderSpecification { + p := UpdateFolderSpecification{} + return &p +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateFolderSpecification) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateFolderSpecification) SetName(v string) { + o.Name = &v +} + +// GetParentId returns the ParentId field value if set, zero value otherwise. +func (o *UpdateFolderSpecification) GetParentId() string { + if o == nil || o.ParentId == nil { + var ret string + return ret + } + return *o.ParentId +} + +// SetParentId gets a reference to the given string and assigns it to the ParentId field. +func (o *UpdateFolderSpecification) SetParentId(v string) { + o.ParentId = &v +} diff --git a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/service.go b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/service.go index 75e057b8..4b21008c 100644 --- a/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/service.go +++ b/vendor/github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client/service.go @@ -70,6 +70,12 @@ type Service interface { GetEgressRule(ctx _context.Context, clusterId string, ruleId string) (*GetEgressRuleResponse, *_nethttp.Response, error) ListEgressRules(ctx _context.Context, clusterId string, options *ListEgressRulesOptions) (*ListEgressRulesResponse, *_nethttp.Response, error) SetEgressTrafficPolicy(ctx _context.Context, clusterId string, setEgressTrafficPolicyRequest *SetEgressTrafficPolicyRequest) (*_nethttp.Response, error) + // Folders + CreateFolder(ctx _context.Context, createFolderRequest *CreateFolderRequest) (*FolderResource, *_nethttp.Response, error) + DeleteFolder(ctx _context.Context, folderId string) (*_nethttp.Response, error) + GetFolder(ctx _context.Context, folderId string) (*FolderResource, *_nethttp.Response, error) + ListFolderContents(ctx _context.Context, folderId string, options *ListFolderContentsOptions) (*FolderResourceList, *_nethttp.Response, error) + UpdateFolder(ctx _context.Context, folderId string, updateFolderSpecification *UpdateFolderSpecification) (*FolderResource, *_nethttp.Response, error) // IPAllowlists AddAllowlistEntry(ctx _context.Context, clusterId string, allowlistEntry *AllowlistEntry) (*AllowlistEntry, *_nethttp.Response, error) AddAllowlistEntry2(ctx _context.Context, clusterId string, entryCidrIp string, entryCidrMask int32, allowlistEntry1 *AllowlistEntry1) (*AllowlistEntry, *_nethttp.Response, error) @@ -4807,6 +4813,694 @@ func (a *ServiceImpl) SetEgressTrafficPolicy( return localVarHTTPResponse, nil } +// CreateFolder executes the request. +func (a *ServiceImpl) CreateFolder( + ctx _context.Context, createFolderRequest *CreateFolderRequest, +) (*FolderResource, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath := a.client.cfg.ServerURL + + localVarPath := localBasePath + "/api/v1/folders" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if createFolderRequest == nil { + return nil, nil, reportError("createFolderRequest is required and must be specified") + } + + // Determine the Content-Type header. + localVarHTTPContentTypes := []string{"application/json"} + + // Set Content-Type header. + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // Determine the Accept header. + localVarHTTPHeaderAccepts := []string{"application/json"} + + // Set Accept header. + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // Body params. + localVarPostBody = createFolderRequest + req, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return nil, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return nil, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := Error{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + var v Status + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + + var localVarReturnValue FolderResource + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := Error{ + body: localVarBody, + error: err.Error(), + } + return &localVarReturnValue, localVarHTTPResponse, newErr + } + + return &localVarReturnValue, localVarHTTPResponse, nil +} + +// DeleteFolder executes the request. +func (a *ServiceImpl) DeleteFolder( + ctx _context.Context, folderId string, +) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath := a.client.cfg.ServerURL + + localVarPath := localBasePath + "/api/v1/folders/{folder_id}" + localVarPath = strings.Replace(localVarPath, "{"+"folder_id"+"}", _neturl.PathEscape(parameterToString(folderId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // Determine the Content-Type header. + localVarHTTPContentTypes := []string{} + + // Set Content-Type header. + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // Determine the Accept header. + localVarHTTPHeaderAccepts := []string{"application/json"} + + // Set Accept header. + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := Error{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + var v Status + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetFolder executes the request. +func (a *ServiceImpl) GetFolder( + ctx _context.Context, folderId string, +) (*FolderResource, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath := a.client.cfg.ServerURL + + localVarPath := localBasePath + "/api/v1/folders/{folder_id}" + localVarPath = strings.Replace(localVarPath, "{"+"folder_id"+"}", _neturl.PathEscape(parameterToString(folderId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // Determine the Content-Type header. + localVarHTTPContentTypes := []string{} + + // Set Content-Type header. + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // Determine the Accept header. + localVarHTTPHeaderAccepts := []string{"application/json"} + + // Set Accept header. + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return nil, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return nil, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := Error{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + var v Status + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + + var localVarReturnValue FolderResource + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := Error{ + body: localVarBody, + error: err.Error(), + } + return &localVarReturnValue, localVarHTTPResponse, newErr + } + + return &localVarReturnValue, localVarHTTPResponse, nil +} + +// ListFolderContentsOptions contains optional parameters for ListFolderContents. +type ListFolderContentsOptions struct { + PaginationPage *string + + PaginationLimit *int32 + + PaginationAsOfTime *time.Time + + // - ASC: Sort in ascending order. This is the default unless otherwise specified. - DESC: Sort in descending order. + PaginationSortOrder *string +} + +// ListFolderContents executes the request. +func (a *ServiceImpl) ListFolderContents( + ctx _context.Context, folderId string, options *ListFolderContentsOptions, +) (*FolderResourceList, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath := a.client.cfg.ServerURL + + localVarPath := localBasePath + "/api/v1/folders/{folder_id}/contents" + localVarPath = strings.Replace(localVarPath, "{"+"folder_id"+"}", _neturl.PathEscape(parameterToString(folderId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if options.PaginationPage != nil { + localVarQueryParams.Add("pagination.page", parameterToString(*options.PaginationPage, "")) + } + if options.PaginationLimit != nil { + localVarQueryParams.Add("pagination.limit", parameterToString(*options.PaginationLimit, "")) + } + if options.PaginationAsOfTime != nil { + localVarQueryParams.Add("pagination.as_of_time", parameterToString(*options.PaginationAsOfTime, "")) + } + if options.PaginationSortOrder != nil { + localVarQueryParams.Add("pagination.sort_order", parameterToString(*options.PaginationSortOrder, "")) + } + // Determine the Content-Type header. + localVarHTTPContentTypes := []string{} + + // Set Content-Type header. + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // Determine the Accept header. + localVarHTTPHeaderAccepts := []string{"application/json"} + + // Set Accept header. + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return nil, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return nil, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := Error{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + var v Status + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + + var localVarReturnValue FolderResourceList + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := Error{ + body: localVarBody, + error: err.Error(), + } + return &localVarReturnValue, localVarHTTPResponse, newErr + } + + return &localVarReturnValue, localVarHTTPResponse, nil +} + +// UpdateFolder executes the request. +func (a *ServiceImpl) UpdateFolder( + ctx _context.Context, folderId string, updateFolderSpecification *UpdateFolderSpecification, +) (*FolderResource, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath := a.client.cfg.ServerURL + + localVarPath := localBasePath + "/api/v1/folders/{folder_id}" + localVarPath = strings.Replace(localVarPath, "{"+"folder_id"+"}", _neturl.PathEscape(parameterToString(folderId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if updateFolderSpecification == nil { + return nil, nil, reportError("updateFolderSpecification is required and must be specified") + } + + // Determine the Content-Type header. + localVarHTTPContentTypes := []string{"application/json"} + + // Set Content-Type header. + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // Determine the Accept header. + localVarHTTPHeaderAccepts := []string{"application/json"} + + // Set Accept header. + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // Body params. + localVarPostBody = updateFolderSpecification + req, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return nil, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return nil, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := Error{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v interface{} + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + var v Status + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return nil, localVarHTTPResponse, newErr + } + newErr.model = v + return nil, localVarHTTPResponse, newErr + } + + var localVarReturnValue FolderResource + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := Error{ + body: localVarBody, + error: err.Error(), + } + return &localVarReturnValue, localVarHTTPResponse, newErr + } + + return &localVarReturnValue, localVarHTTPResponse, nil +} + // AddAllowlistEntry executes the request. func (a *ServiceImpl) AddAllowlistEntry( ctx _context.Context, clusterId string, allowlistEntry *AllowlistEntry, diff --git a/vendor/modules.txt b/vendor/modules.txt index 1b05f28f..27afdd04 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -19,7 +19,7 @@ github.com/armon/go-radix # github.com/bgentry/speakeasy v0.1.0 ## explicit github.com/bgentry/speakeasy -# github.com/cockroachdb/cockroach-cloud-sdk-go v1.3.0 +# github.com/cockroachdb/cockroach-cloud-sdk-go v1.4.0 ## explicit; go 1.17 github.com/cockroachdb/cockroach-cloud-sdk-go/pkg/client # github.com/davecgh/go-spew v1.1.1