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

Add Spanner instance unset compute field test #3364

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: spanner.cnrm.cloud.google.com/v1beta1
kind: SpannerInstance
metadata:
annotations:
cnrm.cloud.google.com/management-conflict-prevention-policy: none
cnrm.cloud.google.com/project-id: ${projectId}
cnrm.cloud.google.com/state-into-spec: absent
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 3
labels:
cnrm-test: "true"
label-one: value-one
name: spannerinstance-sample-${uniqueId}
namespace: ${uniqueId}
spec:
config: regional-us-west1
displayName: New spanner Instance Sample
numNodes: 2
resourceID: spannerinstance-sample-${uniqueId}
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
observedGeneration: 3
state: READY
Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

404 Not Found
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"error": {
"code": 404,
"message": "Instance not found: projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"status": "NOT_FOUND"
}
}

---

POST https://spanner.googleapis.com/v1/projects/${projectId}/instances?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

{
"instance": {
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"nodeCount": 2
},
"instanceId": "spannerinstance-sample-${uniqueId}"
}

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"metadata": {
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceMetadata",
"instance": {
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"replicaComputeCapacity": [
{
"nodeCount": 2,
"replicaSelection": {
"location": "us-west1"
}
}
],
"state": "READY"
},
"startTime": "2024-04-01T12:34:56.123456Z"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}"
}

---

GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"done": true,
"metadata": {
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceMetadata",
"endTime": "2024-04-01T12:34:56.123456Z",
"expectedFulfillmentPeriod": "FULFILLMENT_PERIOD_NORMAL",
"instance": {
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"state": "READY",
"updateTime": "2024-04-01T12:34:56.123456Z"
},
"startTime": "2024-04-01T12:34:56.123456Z"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}",
"response": {
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.Instance",
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"state": "READY",
"updateTime": "2024-04-01T12:34:56.123456Z"
}
}

---

GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"state": "READY",
"updateTime": "2024-04-01T12:34:56.123456Z"
}

---

PATCH https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

{
"fieldMask": "displayName",
"instance": {
"displayName": "New spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/%!s(\u003cnil\u003e)",
"nodeCount": 2,
"processingUnits": 2000
anhdle-sso marked this conversation as resolved.
Show resolved Hide resolved
}
}

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"metadata": {
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceMetadata",
"instance": {
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"replicaComputeCapacity": [
{
"nodeCount": 2,
"replicaSelection": {
"location": "us-west1"
}
}
],
"state": "READY",
"updateTime": "2024-04-01T12:34:56.123456Z"
},
"startTime": "2024-04-01T12:34:56.123456Z"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}"
}

---

GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"done": true,
"metadata": {
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceMetadata",
"endTime": "2024-04-01T12:34:56.123456Z",
"expectedFulfillmentPeriod": "FULFILLMENT_PERIOD_NORMAL",
"instance": {
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"state": "READY",
"updateTime": "2024-04-01T12:34:56.123456Z"
},
"startTime": "2024-04-01T12:34:56.123456Z"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}/operations/${operationID}",
"response": {
"@type": "type.googleapis.com/google.spanner.admin.instance.v1.Instance",
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"state": "READY",
"updateTime": "2024-04-01T12:34:56.123456Z"
}
}

---

GET https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"config": "projects/${projectId}/instanceConfigs/regional-us-west1",
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "Spanner Instance Sample",
"labels": {
"cnrm-test": "true",
"label-one": "value-one",
"managed-by-cnrm": "true"
},
"name": "projects/${projectId}/instances/spannerinstance-sample-${uniqueId}",
"nodeCount": 2,
"processingUnits": 2000,
"state": "READY",
"updateTime": "2024-04-01T12:34:56.123456Z"
}

---

DELETE https://spanner.googleapis.com/v1/projects/${projectId}/instances/spannerinstance-sample-${uniqueId}?alt=json
Content-Type: application/json
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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
#
# 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.

apiVersion: spanner.cnrm.cloud.google.com/v1beta1
kind: SpannerInstance
metadata:
labels:
label-one: "value-one"
name: spannerinstance-sample-${uniqueId}
spec:
config: regional-us-west1
displayName: Spanner Instance Sample
numNodes: 2
anhdle-sso marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading