Skip to content

Commit

Permalink
Record mockGCP logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gemmahou committed Nov 16, 2024
1 parent bc1c618 commit 6125b16
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 713 deletions.
3 changes: 3 additions & 0 deletions mockgcp/mockcompute/globaltargettcpproxyv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func (s *GlobalTargetTcpProxyV1) Insert(ctx context.Context, req *pb.InsertTarge
obj.CreationTimestamp = PtrTo(s.nowString())
obj.Id = &id
obj.Kind = PtrTo("compute#targetTcpProxy")
if obj.ProxyHeader == nil {
obj.ProxyHeader = PtrTo("NONE")
}

if err := s.storage.Create(ctx, fqn, obj); err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"reason": "notFound"
}
],
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
}
}

Expand Down Expand Up @@ -118,17 +118,18 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"address": "34.8.178.35",
"addressType": "EXTERNAL",
"address": "8.8.8.8",
"creationTimestamp": "2024-04-01T12:34:56.123456Z",
"description": "a test global address",
"id": "000000000000000000000",
"kind": "compute#address",
"labelFingerprint": "abcdef0123A=",
"labels": {
"cnrm-test": "true",
"managed-by-cnrm": "true"
},
"name": "computeaddress-${uniqueId}",
"networkTier": "PREMIUM",
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"status": "RESERVED"
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}"
}

---
Expand Down Expand Up @@ -157,19 +158,14 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"endTime": "2024-04-01T12:34:56.123456Z",
"id": "000000000000000000000",
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "setLabels",
"progress": 100,
"progress": 0,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE",
"targetId": "${addressID}",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"user": "[email protected]"
"status": "DONE"
}

---
Expand All @@ -190,8 +186,7 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"address": "34.8.178.35",
"addressType": "EXTERNAL",
"address": "8.8.8.8",
"creationTimestamp": "2024-04-01T12:34:56.123456Z",
"description": "a test global address",
"id": "000000000000000000000",
Expand All @@ -202,9 +197,7 @@ X-Xss-Protection: 0
"managed-by-cnrm": "true"
},
"name": "computeaddress-${uniqueId}",
"networkTier": "PREMIUM",
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"status": "RESERVED"
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}"
}

---
Expand All @@ -230,11 +223,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "The resource 'projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}' was not found",
"message": "healthCheck \"projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}\" not found",
"reason": "notFound"
}
],
"message": "The resource 'projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}' was not found"
"message": "healthCheck \"projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}\" not found"
}
}

Expand Down Expand Up @@ -274,46 +267,10 @@ X-Xss-Protection: 0
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "insert",
"progress": 0,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "RUNNING",
"targetId": "2860175380157437550",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}",
"user": "[email protected]"
}

---

GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false
User-Agent: google-api-go-client/0.5 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-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"endTime": "2024-04-01T12:34:56.123456Z",
"id": "000000000000000000000",
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "insert",
"progress": 100,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE",
"targetId": "2860175380157437550",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}",
"user": "[email protected]"
"status": "DONE"
}

---
Expand Down Expand Up @@ -421,46 +378,10 @@ X-Xss-Protection: 0
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "insert",
"progress": 0,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "RUNNING",
"targetId": "3103970991032374882",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}",
"user": "[email protected]"
}

---

GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false
User-Agent: google-api-go-client/0.5 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-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"endTime": "2024-04-01T12:34:56.123456Z",
"id": "000000000000000000000",
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "insert",
"progress": 100,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE",
"targetId": "3103970991032374882",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}",
"user": "[email protected]"
"status": "DONE"
}

---
Expand All @@ -481,32 +402,24 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"affinityCookieTtlSec": 0,
"connectionDraining": {
"drainingTimeoutSec": 300
},
"creationTimestamp": "2024-04-01T12:34:56.123456Z",
"description": "",
"enableCDN": false,
"fingerprint": "abcdef0123A=",
"healthChecks": [
"https://www.googleapis.com/compute/beta/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}"
"https://www.googleapis.com/compute/v1/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}"
],
"iap": {
"enabled": false,
"oauth2ClientId": "",
"oauth2ClientSecretSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
"oauth2ClientSecret": ""
},
"id": "000000000000000000000",
"kind": "compute#backendService",
"loadBalancingScheme": "EXTERNAL",
"name": "computebackendservice-${uniqueId}",
"port": 80,
"portName": "http",
"protocol": "TCP",
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}",
"sessionAffinity": "NONE",
"timeoutSec": 30
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}"
}

---
Expand Down Expand Up @@ -1442,32 +1355,24 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"affinityCookieTtlSec": 0,
"connectionDraining": {
"drainingTimeoutSec": 300
},
"creationTimestamp": "2024-04-01T12:34:56.123456Z",
"description": "",
"enableCDN": false,
"fingerprint": "abcdef0123A=",
"healthChecks": [
"https://www.googleapis.com/compute/beta/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}"
"https://www.googleapis.com/compute/v1/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}"
],
"iap": {
"enabled": false,
"oauth2ClientId": "",
"oauth2ClientSecretSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
"oauth2ClientSecret": ""
},
"id": "000000000000000000000",
"kind": "compute#backendService",
"loadBalancingScheme": "EXTERNAL",
"name": "computebackendservice-${uniqueId}",
"port": 80,
"portName": "http",
"protocol": "TCP",
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}",
"sessionAffinity": "NONE",
"timeoutSec": 30
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}"
}

---
Expand All @@ -1492,46 +1397,10 @@ X-Xss-Protection: 0
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "delete",
"progress": 0,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "RUNNING",
"targetId": "3103970991032374882",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}",
"user": "[email protected]"
}

---

GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false
User-Agent: google-api-go-client/0.5 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-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"endTime": "2024-04-01T12:34:56.123456Z",
"id": "000000000000000000000",
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "delete",
"progress": 100,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE",
"targetId": "3103970991032374882",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/backendServices/computebackendservice-${uniqueId}",
"user": "[email protected]"
"status": "DONE"
}

---
Expand Down Expand Up @@ -1591,46 +1460,10 @@ X-Xss-Protection: 0
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "delete",
"progress": 0,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "RUNNING",
"targetId": "2860175380157437550",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}",
"user": "[email protected]"
}

---

GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false
User-Agent: google-api-go-client/0.5 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-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"endTime": "2024-04-01T12:34:56.123456Z",
"id": "000000000000000000000",
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "delete",
"progress": 100,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE",
"targetId": "2860175380157437550",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/healthChecks/computehealthcheck-${uniqueId}",
"user": "[email protected]"
"status": "DONE"
}

---
Expand All @@ -1651,8 +1484,7 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"address": "34.8.178.35",
"addressType": "EXTERNAL",
"address": "8.8.8.8",
"creationTimestamp": "2024-04-01T12:34:56.123456Z",
"description": "a test global address",
"id": "000000000000000000000",
Expand All @@ -1663,9 +1495,7 @@ X-Xss-Protection: 0
"managed-by-cnrm": "true"
},
"name": "computeaddress-${uniqueId}",
"networkTier": "PREMIUM",
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"status": "RESERVED"
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}"
}

---
Expand Down
Loading

0 comments on commit 6125b16

Please sign in to comment.