Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove need to pass location parameter along #1093

Merged
184 changes: 184 additions & 0 deletions __snapshots__/cluster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
// Copyright 2022 Google LLC
//
// 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
//
// https://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.

exports[
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 1'
] = {
input: {
id: 'my-cluster',
options: {
nodes: 2,
location: 'us-central1-b',
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'partialUpdateCluster',
reqOpts: {
cluster: {
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster',
location: 'us-central1-b',
serveNodes: 2,
},
updateMask: {
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'],
},
},
gaxOpts: {},
},
},
};

exports[
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 2'
] = {
input: {
id: 'my-cluster',
options: {
nodes: 2,
storage: 'ssd',
location: 'us-central1-b',
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'partialUpdateCluster',
reqOpts: {
cluster: {
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster',
location: 'us-central1-b',
serveNodes: 2,
storage: 'ssd',
},
updateMask: {
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'],
},
},
gaxOpts: {},
},
},
};

exports[
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 3'
] = {
input: {
id: 'my-cluster',
options: {
nodes: 2,
key: 'kms-key-name',
location: 'us-central1-b',
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'partialUpdateCluster',
reqOpts: {
cluster: {
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster',
location: 'us-central1-b',
serveNodes: 2,
key: 'kms-key-name',
},
updateMask: {
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'],
},
},
gaxOpts: {},
},
},
};

exports[
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 4'
] = {
input: {
id: 'my-cluster',
options: {
nodes: 2,
encryption: {
kmsKeyName: 'kms-key-name',
},
location: 'us-central1-b',
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'partialUpdateCluster',
reqOpts: {
cluster: {
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster',
location: 'us-central1-b',
serveNodes: 2,
encryption: {
kmsKeyName: 'kms-key-name',
},
},
updateMask: {
paths: ['serve_nodes', 'cluster_config.cluster_autoscaling_config'],
},
},
gaxOpts: {},
},
},
};

exports[
'Bigtable/Cluster setMetadata should provide the proper request options asynchronously 5'
] = {
input: {
id: 'my-cluster',
options: {
minServeNodes: 2,
maxServeNodes: 3,
cpuUtilizationPercent: 50,
location: 'us-central1-b',
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'partialUpdateCluster',
reqOpts: {
cluster: {
name: 'projects/grape-spaceship-123/instances/i/clusters/my-cluster',
location: 'us-central1-b',
clusterConfig: {
clusterAutoscalingConfig: {
autoscalingTargets: {
cpuUtilizationPercent: 50,
},
autoscalingLimits: {
minServeNodes: 2,
maxServeNodes: 3,
},
},
},
},
updateMask: {
paths: [
'cluster_config.cluster_autoscaling_config.autoscaling_limits.min_serve_nodes',
'cluster_config.cluster_autoscaling_config.autoscaling_limits.max_serve_nodes',
'cluster_config.cluster_autoscaling_config.autoscaling_targets.cpu_utilization_percent',
],
},
},
gaxOpts: {},
},
},
};
211 changes: 211 additions & 0 deletions __snapshots__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
// Copyright 2022 Google LLC
//
// 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
//
// https://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.

exports[
'Bigtable createInstance should provide the proper request options asynchronously 1'
] = {
input: {
id: 'my-instance',
options: {
clusters: {
nodes: 2,
location: 'us-central1-b',
id: 'my-cluster',
},
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'createInstance',
reqOpts: {
parent: 'projects/test-project',
instanceId: 'my-instance',
instance: {
displayName: 'my-instance',
},
clusters: {
'my-cluster': {
location: 'projects/test-project/locations/us-central1-b',
serveNodes: 2,
defaultStorageType: 0,
},
},
},
},
},
};

exports[
'Bigtable createInstance should provide the proper request options asynchronously 2'
] = {
input: {
id: 'my-instance',
options: {
clusters: {
nodes: 2,
storage: 'ssd',
location: 'us-central1-b',
id: 'my-cluster',
},
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'createInstance',
reqOpts: {
parent: 'projects/test-project',
instanceId: 'my-instance',
instance: {
displayName: 'my-instance',
},
clusters: {
'my-cluster': {
location: 'projects/test-project/locations/us-central1-b',
serveNodes: 2,
defaultStorageType: 1,
},
},
},
},
},
};

exports[
'Bigtable createInstance should provide the proper request options asynchronously 3'
] = {
input: {
id: 'my-instance',
options: {
clusters: {
nodes: 2,
key: 'kms-key-name',
location: 'us-central1-b',
id: 'my-cluster',
},
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'createInstance',
reqOpts: {
parent: 'projects/test-project',
instanceId: 'my-instance',
instance: {
displayName: 'my-instance',
},
clusters: {
'my-cluster': {
location: 'projects/test-project/locations/us-central1-b',
serveNodes: 2,
defaultStorageType: 0,
encryptionConfig: {
kmsKeyName: 'kms-key-name',
},
},
},
},
},
},
};

exports[
'Bigtable createInstance should provide the proper request options asynchronously 4'
] = {
input: {
id: 'my-instance',
options: {
clusters: {
nodes: 2,
encryption: {
kmsKeyName: 'kms-key-name',
},
location: 'us-central1-b',
id: 'my-cluster',
},
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'createInstance',
reqOpts: {
parent: 'projects/test-project',
instanceId: 'my-instance',
instance: {
displayName: 'my-instance',
},
clusters: {
'my-cluster': {
location: 'projects/test-project/locations/us-central1-b',
serveNodes: 2,
defaultStorageType: 0,
encryptionConfig: {
kmsKeyName: 'kms-key-name',
},
},
},
},
},
},
};

exports[
'Bigtable createInstance should provide the proper request options asynchronously 5'
] = {
input: {
id: 'my-instance',
options: {
clusters: {
minServeNodes: 2,
maxServeNodes: 3,
cpuUtilizationPercent: 50,
location: 'us-central1-b',
id: 'my-cluster',
},
},
},
output: {
config: {
client: 'BigtableInstanceAdminClient',
method: 'createInstance',
reqOpts: {
parent: 'projects/test-project',
instanceId: 'my-instance',
instance: {
displayName: 'my-instance',
},
clusters: {
'my-cluster': {
location: 'projects/test-project/locations/us-central1-b',
clusterConfig: {
clusterAutoscalingConfig: {
autoscalingTargets: {
cpuUtilizationPercent: 50,
},
autoscalingLimits: {
minServeNodes: 2,
maxServeNodes: 3,
},
},
},
defaultStorageType: 0,
},
},
},
},
},
};
Loading