From 173bbc762600c23a3b138b745bf8860c5a2c4a6f Mon Sep 17 00:00:00 2001 From: justinsb Date: Mon, 16 Oct 2023 13:27:48 -0400 Subject: [PATCH 1/2] mockgcp: Support compute targetVpnGateway --- config/tests/samples/create/harness.go | 1 + mockgcp/mockcompute/service.go | 5 + mockgcp/mockcompute/targetvpngatewayv1.go | 158 ++++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 mockgcp/mockcompute/targetvpngatewayv1.go diff --git a/config/tests/samples/create/harness.go b/config/tests/samples/create/harness.go index 6cfaff6e9f..9908145b18 100644 --- a/config/tests/samples/create/harness.go +++ b/config/tests/samples/create/harness.go @@ -656,6 +656,7 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeNodeTemplate"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeManagedSSLCertificate"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeSubnetwork"}: + case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeTargetVPNGateway"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeVPNGateway"}: // ok diff --git a/mockgcp/mockcompute/service.go b/mockgcp/mockcompute/service.go index 4156b1e9d1..624e451ba3 100644 --- a/mockgcp/mockcompute/service.go +++ b/mockgcp/mockcompute/service.go @@ -53,6 +53,7 @@ func (s *MockService) Register(grpcServer *grpc.Server) { pb.RegisterNetworksServer(grpcServer, &NetworksV1{MockService: s}) pb.RegisterSubnetworksServer(grpcServer, &SubnetsV1{MockService: s}) pb.RegisterVpnGatewaysServer(grpcServer, &VPNGatewaysV1{MockService: s}) + pb.RegisterTargetVpnGatewaysServer(grpcServer, &TargetVpnGatewaysV1{MockService: s}) pb.RegisterRegionHealthChecksServer(grpcServer, &RegionalHealthCheckV1{MockService: s}) pb.RegisterHealthChecksServer(grpcServer, &GlobalHealthCheckV1{MockService: s}) @@ -95,6 +96,10 @@ func (s *MockService) NewHTTPMux(ctx context.Context, conn *grpc.ClientConn) (ht return nil, err } + if err := pb.RegisterTargetVpnGatewaysHandler(ctx, mux.ServeMux, conn); err != nil { + return nil, err + } + if err := pb.RegisterNodeGroupsHandler(ctx, mux.ServeMux, conn); err != nil { return nil, err } diff --git a/mockgcp/mockcompute/targetvpngatewayv1.go b/mockgcp/mockcompute/targetvpngatewayv1.go new file mode 100644 index 0000000000..bab2685450 --- /dev/null +++ b/mockgcp/mockcompute/targetvpngatewayv1.go @@ -0,0 +1,158 @@ +// 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. + +package mockcompute + +import ( + "context" + "strings" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + apierrors "k8s.io/apimachinery/pkg/api/errors" + + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" +) + +type TargetVpnGatewaysV1 struct { + *MockService + pb.UnimplementedTargetVpnGatewaysServer +} + +func (s *TargetVpnGatewaysV1) Get(ctx context.Context, req *pb.GetTargetVpnGatewayRequest) (*pb.TargetVpnGateway, error) { + reqName := "projects/" + req.GetProject() + "/regions/" + req.GetRegion() + "/targetVpnGateways/" + req.GetTargetVpnGateway() + name, err := s.parseRegionalTargetVpnGatewayName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.TargetVpnGateway{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "targetVpnGateway %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error reading targetVpnGateway: %v", err) + } + } + + return obj, nil +} + +func (s *TargetVpnGatewaysV1) Insert(ctx context.Context, req *pb.InsertTargetVpnGatewayRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/regions/" + req.GetRegion() + "/targetVpnGateways/" + req.GetTargetVpnGatewayResource().GetName() + name, err := s.parseRegionalTargetVpnGatewayName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + id := s.generateID() + + obj := proto.Clone(req.GetTargetVpnGatewayResource()).(*pb.TargetVpnGateway) + obj.SelfLink = PtrTo("https://compute.googleapis.com/compute/v1/" + name.String()) + obj.CreationTimestamp = PtrTo(s.nowString()) + obj.Id = &id + obj.Kind = PtrTo("compute#targetVpnGateway") + + if err := s.storage.Create(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error creating targetVpnGateway: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *TargetVpnGatewaysV1) Delete(ctx context.Context, req *pb.DeleteTargetVpnGatewayRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/regions/" + req.GetRegion() + "/targetVpnGateways/" + req.GetTargetVpnGateway() + name, err := s.parseRegionalTargetVpnGatewayName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + deleted := &pb.TargetVpnGateway{} + if err := s.storage.Delete(ctx, fqn, deleted); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "targetVpnGateway %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error deleting targetVpnGateway: %v", err) + } + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *TargetVpnGatewaysV1) SetLabels(ctx context.Context, req *pb.SetLabelsTargetVpnGatewayRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/regions/" + req.GetRegion() + "/targetVpnGateways/" + req.GetResource() + name, err := s.parseRegionalTargetVpnGatewayName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.TargetVpnGateway{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "targetVpnGateway %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error reading targetVpnGateway: %v", err) + } + } + + obj.Labels = req.GetRegionSetLabelsRequestResource().GetLabels() + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating targetVpnGateway: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +type regionalTargetVpnGatewayName struct { + Project *projects.ProjectData + Region string + Name string +} + +func (n *regionalTargetVpnGatewayName) String() string { + return "projects/" + n.Project.ID + "/regions/" + n.Region + "/targetVpnGateways/" + n.Name +} + +// parseRegionalTargetVpnGatewayName parses a string into a regionalTargetVpnGatewayName. +// The expected form is `projects/*/regions/*/targetVpnGateways/*`. +func (s *MockService) parseRegionalTargetVpnGatewayName(name string) (*regionalTargetVpnGatewayName, error) { + tokens := strings.Split(name, "/") + + if len(tokens) == 6 && tokens[0] == "projects" && tokens[2] == "regions" && tokens[4] == "targetVpnGateways" { + project, err := s.projects.GetProjectByID(tokens[1]) + if err != nil { + return nil, err + } + + name := ®ionalTargetVpnGatewayName{ + Project: project, + Region: tokens[3], + Name: tokens[5], + } + + return name, nil + } else { + return nil, status.Errorf(codes.InvalidArgument, "name %q is not valid", name) + } +} From d7e14d78bacac18634918443ed5b094f5b446053 Mon Sep 17 00:00:00 2001 From: Gemma Hou Date: Tue, 9 Jul 2024 18:53:57 +0000 Subject: [PATCH 2/2] mockGCP for ComputeTargetVpnGateway --- mockgcp/mockcompute/targetvpngatewayv1.go | 30 +- ...object_computetargetvpngateway.golden.yaml | 31 ++ .../v1beta1/computetargetvpngateway/_http.log | 270 ++++++++++++++++++ tests/e2e/normalize.go | 2 +- 4 files changed, 310 insertions(+), 23 deletions(-) create mode 100644 pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_generated_object_computetargetvpngateway.golden.yaml create mode 100644 pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_http.log diff --git a/mockgcp/mockcompute/targetvpngatewayv1.go b/mockgcp/mockcompute/targetvpngatewayv1.go index bab2685450..c6df0d156d 100644 --- a/mockgcp/mockcompute/targetvpngatewayv1.go +++ b/mockgcp/mockcompute/targetvpngatewayv1.go @@ -18,13 +18,11 @@ import ( "context" "strings" + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" - apierrors "k8s.io/apimachinery/pkg/api/errors" - - "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" - pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" ) type TargetVpnGatewaysV1 struct { @@ -43,11 +41,7 @@ func (s *TargetVpnGatewaysV1) Get(ctx context.Context, req *pb.GetTargetVpnGatew obj := &pb.TargetVpnGateway{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "targetVpnGateway %q not found", name) - } else { - return nil, status.Errorf(codes.Internal, "error reading targetVpnGateway: %v", err) - } + return nil, err } return obj, nil @@ -71,7 +65,7 @@ func (s *TargetVpnGatewaysV1) Insert(ctx context.Context, req *pb.InsertTargetVp obj.Kind = PtrTo("compute#targetVpnGateway") if err := s.storage.Create(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error creating targetVpnGateway: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -88,11 +82,7 @@ func (s *TargetVpnGatewaysV1) Delete(ctx context.Context, req *pb.DeleteTargetVp deleted := &pb.TargetVpnGateway{} if err := s.storage.Delete(ctx, fqn, deleted); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "targetVpnGateway %q not found", name) - } else { - return nil, status.Errorf(codes.Internal, "error deleting targetVpnGateway: %v", err) - } + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -109,16 +99,12 @@ func (s *TargetVpnGatewaysV1) SetLabels(ctx context.Context, req *pb.SetLabelsTa obj := &pb.TargetVpnGateway{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "targetVpnGateway %q not found", name) - } else { - return nil, status.Errorf(codes.Internal, "error reading targetVpnGateway: %v", err) - } + return nil, err } obj.Labels = req.GetRegionSetLabelsRequestResource().GetLabels() if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating targetVpnGateway: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -140,7 +126,7 @@ func (s *MockService) parseRegionalTargetVpnGatewayName(name string) (*regionalT tokens := strings.Split(name, "/") if len(tokens) == 6 && tokens[0] == "projects" && tokens[2] == "regions" && tokens[4] == "targetVpnGateways" { - project, err := s.projects.GetProjectByID(tokens[1]) + project, err := s.Projects.GetProjectByID(tokens[1]) if err != nil { return nil, err } diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_generated_object_computetargetvpngateway.golden.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_generated_object_computetargetvpngateway.golden.yaml new file mode 100644 index 0000000000..9d640fd543 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_generated_object_computetargetvpngateway.golden.yaml @@ -0,0 +1,31 @@ +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeTargetVPNGateway +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: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + name: computevpngateway-${uniqueId} + namespace: ${uniqueId} +spec: + networkRef: + name: default + region: us-central1 + resourceID: computevpngateway-${uniqueId} +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + creationTimestamp: "1970-01-01T00:00:00Z" + gatewayId: "1.719337333063698e+18" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/targetVpnGateways/computevpngateway-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_http.log b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_http.log new file mode 100644 index 0000000000..7a004cdc58 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computetargetvpngateway/_http.log @@ -0,0 +1,270 @@ +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?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-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?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 + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +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 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?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-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?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 + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +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 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?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-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/targetVpnGateways/computevpngateway-${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-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "targetVpnGateway \"projects/${projectId}/regions/us-central1/targetVpnGateways/computevpngateway-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "targetVpnGateway \"projects/${projectId}/regions/us-central1/targetVpnGateways/computevpngateway-${uniqueId}\" not found" + } +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/targetVpnGateways?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 + +{ + "name": "computevpngateway-${uniqueId}", + "network": "projects/${projectId}/global/networks/${networkID}", + "region": "projects/${projectId}/global/regions/us-central1" +} + +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 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/targetVpnGateways/computevpngateway-${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-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#targetVpnGateway", + "name": "computevpngateway-${uniqueId}", + "network": "projects/${projectId}/global/networks/${networkID}", + "region": "projects/${projectId}/global/regions/us-central1", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/targetVpnGateways/computevpngateway-${uniqueId}" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/targetVpnGateways/computevpngateway-${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-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} \ No newline at end of file diff --git a/tests/e2e/normalize.go b/tests/e2e/normalize.go index 0efe0d0429..0455671fb1 100644 --- a/tests/e2e/normalize.go +++ b/tests/e2e/normalize.go @@ -106,6 +106,7 @@ func normalizeKRMObject(u *unstructured.Unstructured, project testgcp.GCPProject // Specific to Compute visitor.replacePaths[".status.observedState.certificateID"] = "1.719337333063698e+18" visitor.replacePaths[".status.instanceId"] = "1111111111111111" + visitor.replacePaths[".status.gatewayId"] = "1.719337333063698e+18" // Specific to MonitoringDashboard visitor.stringTransforms = append(visitor.stringTransforms, func(path string, s string) string { @@ -414,7 +415,6 @@ func normalizeHTTPResponses(t *testing.T, events test.LogEntries) { // Compute operations visitor.replacePaths[".fingerprint"] = "abcdef0123A=" - visitor.replacePaths[".startTime"] = "2024-04-01T12:34:56.123456Z" events.PrettifyJSON(func(obj map[string]any) {