From bbfc9e2c9fb04a51f4d74e04bf13f18a6d8885eb Mon Sep 17 00:00:00 2001 From: Alex Pana <8968914+acpana@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:41:50 +0000 Subject: [PATCH] mockgcp: apigeeorganization Signed-off-by: Alex Pana <8968914+acpana@users.noreply.github.com> --- config/tests/samples/create/harness.go | 1 + mockgcp/mockapigee/organization.go | 216 ++++ mockgcp/mockapigee/service.go | 2 + mockgcp/mockserviceusage/knownservices.go | 1 + ...ated_object_apigeeorganization.golden.yaml | 44 + .../v1beta1/apigeeorganization/_http.log | 1110 +++++++++++++++++ .../v1beta1/apigeeorganization/create.yaml | 14 +- .../v1beta1/apigeeorganization/update.yaml | 15 +- tests/e2e/normalize.go | 16 +- 9 files changed, 1404 insertions(+), 15 deletions(-) create mode 100644 mockgcp/mockapigee/organization.go create mode 100644 pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_generated_object_apigeeorganization.golden.yaml create mode 100644 pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_http.log diff --git a/config/tests/samples/create/harness.go b/config/tests/samples/create/harness.go index 6942a7eef6..f389b2a520 100644 --- a/config/tests/samples/create/harness.go +++ b/config/tests/samples/create/harness.go @@ -726,6 +726,7 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured case schema.GroupKind{Group: "alloydb.cnrm.cloud.google.com", Kind: "AlloyDBInstance"}: case schema.GroupKind{Group: "apigee.cnrm.cloud.google.com", Kind: "ApigeeEnvgroup"}: + case schema.GroupKind{Group: "apigee.cnrm.cloud.google.com", Kind: "ApigeeOrganization"}: case schema.GroupKind{Group: "apikeys.cnrm.cloud.google.com", Kind: "APIKeysKey"}: diff --git a/mockgcp/mockapigee/organization.go b/mockgcp/mockapigee/organization.go new file mode 100644 index 0000000000..61c76badb8 --- /dev/null +++ b/mockgcp/mockapigee/organization.go @@ -0,0 +1,216 @@ +// Copyright 2024 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 mockapigee + +import ( + "context" + "fmt" + "sort" + "strings" + "time" + + "cloud.google.com/go/longrunning/autogen/longrunningpb" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/emptypb" + + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/apigee/v1" +) + +type organizationsServer struct { + *MockService + pb.UnimplementedOrganizationsServerServer +} + +func (s *organizationsServer) CreateOrganization(ctx context.Context, req *pb.CreateOrganizationRequest) (*longrunningpb.Operation, error) { + var name *OrganizationName + + projectID := "" + + parent := req.GetParent() + tokens := strings.Split(parent, "/") + if len(tokens) == 2 && tokens[0] == "projects" { + project, err := s.Projects.GetProjectByID(tokens[1]) + if err != nil { + return nil, err + } + projectID = project.ID + + // Name is same as project ID + name = &OrganizationName{ + ID: project.ID, + } + } else { + return nil, status.Errorf(codes.InvalidArgument, "parent %q is not valid", parent) + } + + now := time.Now() + + fqn := name.String() + + obj := proto.Clone(req.GetOrganization()).(*pb.GoogleCloudApigeeV1Organization) + obj.Name = name.ID + obj.CreatedAt = now.UnixMilli() + obj.LastModifiedAt = now.UnixMilli() + obj.ProjectId = projectID + obj.State = "ACTIVE" + + obj.BillingType = "EVALUATION" + obj.SubscriptionType = "TRIAL" + + expiresAt := now.Add(60 * 24 * time.Hour) + obj.ExpiresAt = expiresAt.UnixMilli() + + obj.CaCertificate = []byte("LS0t...") + + if obj.AddonsConfig != nil { + if obj.AddonsConfig.MonetizationConfig != nil { + if !obj.AddonsConfig.MonetizationConfig.GetEnabled() { + obj.AddonsConfig.MonetizationConfig = nil + } + } + } + if err := s.storage.Create(ctx, fqn, obj); err != nil { + return nil, err + } + + prefix := "organizations/" + name.ID + opMetadata := &pb.GoogleCloudApigeeV1OperationMetadata{ + OperationType: "INSERT", + State: "IN_PROGRESS", + TargetResourceName: fqn, + } + return s.operations.StartLRO(ctx, prefix, opMetadata, func() (proto.Message, error) { + opMetadata.State = "FINISHED" + return obj, nil + }) +} + +func (s *organizationsServer) SetAddonsOrganization(ctx context.Context, req *pb.SetAddonsOrganizationRequest) (*longrunningpb.Operation, error) { + name, err := s.parseOrganizationName(req.GetOrg()) + if err != nil { + return nil, err + } + fqn := name.String() + existing := &pb.GoogleCloudApigeeV1Organization{} + if err := s.storage.Get(ctx, fqn, existing); err != nil { + return nil, err + } + + updated := proto.Clone(existing).(*pb.GoogleCloudApigeeV1Organization) + updated.AddonsConfig = req.Organization.AddonsConfig + + if err := s.storage.Update(ctx, fqn, updated); err != nil { + return nil, err + } + + prefix := "organizations/" + name.ID + opMetadata := &pb.GoogleCloudApigeeV1OperationMetadata{ + OperationType: "UPDATE", + State: "IN_PROGRESS", + TargetResourceName: fqn, + } + return s.operations.StartLRO(ctx, prefix, opMetadata, func() (proto.Message, error) { + opMetadata.State = "FINISHED" + return updated.AddonsConfig, nil + }) +} + +func (s *organizationsServer) UpdateOrganization(ctx context.Context, req *pb.UpdateOrganizationRequest) (*pb.GoogleCloudApigeeV1Organization, error) { + name, err := s.parseOrganizationName(req.GetName()) + if err != nil { + return nil, err + } + fqn := name.String() + existing := &pb.GoogleCloudApigeeV1Organization{} + if err := s.storage.Get(ctx, fqn, existing); err != nil { + return nil, err + } + + // Updates the properties for an Apigee organization. No other fields in the organization profile will be updated. + + updated := proto.Clone(existing).(*pb.GoogleCloudApigeeV1Organization) + props := req.Organization.Properties + sort.Slice(props.Property, func(i, j int) bool { + return props.Property[i].Name < props.Property[j].GetName() + }) + updated.Properties = props + + updated.DisplayName = req.Organization.DisplayName + updated.Description = req.Organization.Description + + if err := s.storage.Update(ctx, fqn, updated); err != nil { + return nil, err + } + return updated, nil +} + +func (s *organizationsServer) GetOrganization(ctx context.Context, req *pb.GetOrganizationRequest) (*pb.GoogleCloudApigeeV1Organization, error) { + name, err := s.parseOrganizationName(req.GetName()) + if err != nil { + return nil, err + } + fqn := name.String() + obj := &pb.GoogleCloudApigeeV1Organization{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + return nil, err + } + return obj, nil +} + +func (s *organizationsServer) DeleteOrganization(ctx context.Context, req *pb.DeleteOrganizationRequest) (*longrunningpb.Operation, error) { + name, err := s.parseOrganizationName(req.GetName()) + if err != nil { + return nil, err + } + fqn := name.String() + deletedObj := &pb.GoogleCloudApigeeV1Organization{} + if err := s.storage.Delete(ctx, fqn, deletedObj); err != nil { + return nil, err + } + prefix := "organizations/" + name.ID + opMetadata := &pb.GoogleCloudApigeeV1OperationMetadata{ + OperationType: "DELETE", + State: "IN_PROGRESS", + TargetResourceName: fqn, + } + return s.operations.StartLRO(ctx, prefix, opMetadata, func() (proto.Message, error) { + opMetadata.State = "FINISHED" + return &emptypb.Empty{}, nil + }) +} + +type OrganizationName struct { + ID string +} + +func (n *OrganizationName) String() string { + return fmt.Sprintf("organizations/%s", n.ID) +} + +// parseOrganizationName parses a string into a OrganizationName. +// The expected form is `organizations/*`. +func (s *MockService) parseOrganizationName(name string) (*OrganizationName, error) { + tokens := strings.Split(name, "/") + if len(tokens) == 2 && tokens[0] == "organizations" { + name := &OrganizationName{ + ID: tokens[1], + } + return name, nil + } else { + return nil, status.Errorf(codes.InvalidArgument, "name %q is not valid", name) + } +} diff --git a/mockgcp/mockapigee/service.go b/mockgcp/mockapigee/service.go index 58dfb36d43..be5de0bf8c 100644 --- a/mockgcp/mockapigee/service.go +++ b/mockgcp/mockapigee/service.go @@ -50,12 +50,14 @@ func (s *MockService) ExpectedHosts() []string { } func (s *MockService) Register(grpcServer *grpc.Server) { + pb.RegisterOrganizationsServerServer(grpcServer, &organizationsServer{MockService: s}) pb.RegisterOrganizationsEnvgroupsServerServer(grpcServer, &EnvgroupV1{MockService: s}) } func (s *MockService) NewHTTPMux(ctx context.Context, conn *grpc.ClientConn) (http.Handler, error) { mux, err := httpmux.NewServeMux(ctx, conn, httpmux.Options{}, pb.RegisterOrganizationsEnvgroupsServerHandler, + pb.RegisterOrganizationsServerHandler, s.operations.RegisterOperationsPath("/v1/{prefix=**}/operations/{name}")) if err != nil { return nil, err diff --git a/mockgcp/mockserviceusage/knownservices.go b/mockgcp/mockserviceusage/knownservices.go index 6fdf99062c..71094dcf34 100644 --- a/mockgcp/mockserviceusage/knownservices.go +++ b/mockgcp/mockserviceusage/knownservices.go @@ -15,6 +15,7 @@ package mockserviceusage var allServices = []string{ + "apigee.googleapis.com", "bigquery.googleapis.com", "compute.googleapis.com", "pubsub.googleapis.com", diff --git a/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_generated_object_apigeeorganization.golden.yaml b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_generated_object_apigeeorganization.golden.yaml new file mode 100644 index 0000000000..3c042f5339 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_generated_object_apigeeorganization.golden.yaml @@ -0,0 +1,44 @@ +apiVersion: apigee.cnrm.cloud.google.com/v1beta1 +kind: ApigeeOrganization +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + 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" + name: apigeeorganization-${uniqueId} + namespace: ${uniqueId} +spec: + analyticsRegion: us-west1 + authorizedNetworkRef: + name: default + description: An updated organization + displayName: updated-organization + projectRef: + name: project-${uniqueId} + properties: + features.hybrid.enabled: "true" + features.mart.connect.enabled: "false" + features.mart.server.endpoint: https://127.0.0.1 + resourceID: example-project-01 + runtimeType: CLOUD +status: + billingType: EVALUATION + caCertificate: TFMwdC4uLg== + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + createdAt: "2024-04-01T12:34:56.123456Z" + expiresAt: "2024-04-01T12:34:56.123456Z" + lastModifiedAt: "2024-04-01T12:34:56.123456Z" + observedGeneration: 3 + projectId: example-project-01 + state: ACTIVE + subscriptionType: TRIAL diff --git a/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_http.log b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_http.log new file mode 100644 index 0000000000..50f2e7ac62 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/_http.log @@ -0,0 +1,1110 @@ +GET https://cloudresourcemanager.googleapis.com/v1/projects/example-project-01?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +403 Forbidden +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": 403, + "message": "The caller does not have permission", + "status": "PERMISSION_DENIED" + } +} + +--- + +POST https://cloudbilling.googleapis.com/v1/billingAccounts/${billingAccountID}:testIamPermissions?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +{ + "permissions": [ + "billing.resourceAssociations.create" + ] +} + +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 + +{ + "permissions": [ + "billing.resourceAssociations.create" + ] +} + +--- + +POST https://cloudresourcemanager.googleapis.com/v1/projects?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +{ + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "Dependent Project", + "parent": { + "id": "${organizationID}", + "type": "organization" + }, + "projectId": "example-project-01" +} + +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 + +{ + "name": "operations/${operationID}" +} + +--- + +GET https://cloudresourcemanager.googleapis.com/v1/operations/${operationID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.cloud.resourcemanager.v3.CreateProjectMetadata" + }, + "name": "operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.cloud.resourcemanager.v3.Project", + "createTime": "2024-04-01T12:34:56.123456Z", + "displayName": "Dependent Project", + "etag": "abcdef0123A=", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "projects/${projectNumber}", + "parent": "organizations/${organizationID}", + "projectId": "example-project-01", + "state": "ACTIVE" + } +} + +--- + +PUT https://cloudbilling.googleapis.com/v1/projects/example-project-01/billingInfo?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +{ + "billingAccountName": "billingAccounts/${billingAccountID}" +} + +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 + +{ + "billingAccountName": "billingAccounts/${billingAccountID}", + "billingEnabled": true, + "name": "projects/example-project-01/billingInfo", + "projectId": "example-project-01" +} + +--- + +GET https://cloudbilling.googleapis.com/v1/projects/example-project-01/billingInfo?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "billingAccountName": "billingAccounts/${billingAccountID}", + "billingEnabled": true, + "name": "projects/example-project-01/billingInfo", + "projectId": "example-project-01" +} + +--- + +GET https://cloudresourcemanager.googleapis.com/v1/projects/example-project-01?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "createTime": "2024-04-01T12:34:56.123456Z", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "lifecycleState": "ACTIVE", + "name": "Dependent Project", + "parent": { + "id": "${organizationID}", + "type": "organization" + }, + "projectId": "example-project-01", + "projectNumber": "${projectNumber}" +} + +--- + +GET https://cloudbilling.googleapis.com/v1/projects/example-project-01/billingInfo?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "billingAccountName": "billingAccounts/${billingAccountID}", + "billingEnabled": true, + "name": "projects/example-project-01/billingInfo", + "projectId": "example-project-01" +} + +--- + +GET https://serviceusage.googleapis.com/v1/projects/example-project-01/services?alt=json&fields=services%2Fname%2CnextPageToken&filter=state%3AENABLED&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{} + +--- + +POST https://serviceusage.googleapis.com/v1/projects/example-project-01/services/apigee.googleapis.com:enable?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +{} + +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 + +{ + "metadata": { + "@type": "type.googleapis.com/google.protobuf.Empty", + "value": {} + }, + "name": "operations/${operationID}" +} + +--- + +GET https://serviceusage.googleapis.com/v1beta1/operations/${operationID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.protobuf.Empty", + "value": {} + }, + "name": "operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.api.serviceusage.v1.EnableServiceResponse", + "service": { + "name": "projects/${projectNumber}/services/apigee.googleapis.com", + "parent": "projects/${projectNumber}", + "state": "ENABLED" + } + } +} + +--- + +GET https://serviceusage.googleapis.com/v1/projects/example-project-01/services?alt=json&fields=services%2Fname%2CnextPageToken&filter=state%3AENABLED&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "services": [ + { + "name": "projects/${projectNumber}/services/apigee.googleapis.com", + "parent": "projects/${projectNumber}", + "state": "ENABLED" + } + ] +} + +--- + +POST https://serviceusage.googleapis.com/v1/projects/example-project-01/services/compute.googleapis.com:enable?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +{} + +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 + +{ + "metadata": { + "@type": "type.googleapis.com/google.protobuf.Empty", + "value": {} + }, + "name": "operations/${operationID}" +} + +--- + +GET https://serviceusage.googleapis.com/v1beta1/operations/${operationID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.protobuf.Empty", + "value": {} + }, + "name": "operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.api.serviceusage.v1.EnableServiceResponse", + "service": { + "name": "projects/${projectNumber}/services/compute.googleapis.com", + "parent": "projects/${projectNumber}", + "state": "ENABLED" + } + } +} + +--- + +GET https://serviceusage.googleapis.com/v1/projects/example-project-01/services?alt=json&fields=services%2Fname%2CnextPageToken&filter=state%3AENABLED&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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 + +{ + "services": [ + { + "name": "projects/${projectNumber}/services/apigee.googleapis.com", + "parent": "projects/${projectNumber}", + "state": "ENABLED" + }, + { + "name": "projects/${projectNumber}/services/compute.googleapis.com", + "parent": "projects/${projectNumber}", + "state": "ENABLED" + } + ] +} + +--- + +GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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/v1/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +{ + "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/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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": "compute.networks.patch", + "progress": 100, + "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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/v1/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +{ + "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/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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": "compute.networks.patch", + "progress": 100, + "selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} + +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/v1/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/networks/${networkID}" +} + +--- + +POST https://apigee.googleapis.com/v1/organizations?alt=json&parent=projects%2Fexample-project-01 +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +{ + "analyticsRegion": "us-west1", + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "description": "A sample organization", + "displayName": "basic-organization", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + } + ] + }, + "runtimeType": "CLOUD" +} + +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 + +{ + "metadata": { + "@type": "type.googleapis.com/google.cloud.apigee.v1.GoogleCloudApigeeV1OperationMetadata", + "operationType": "INSERT", + "state": "IN_PROGRESS", + "targetResourceName": "organizations/example-project-01" + }, + "name": "organizations/example-project-01/operations/${operationID}" +} + +--- + +GET https://apigee.googleapis.com/v1/organizations/example-project-01/operations/${operationID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +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 + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.cloud.apigee.v1.GoogleCloudApigeeV1OperationMetadata", + "operationType": "INSERT", + "state": "FINISHED", + "targetResourceName": "organizations/example-project-01" + }, + "name": "organizations/example-project-01/operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.cloud.apigee.v1.GoogleCloudApigeeV1Organization", + "analyticsRegion": "us-west1", + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "billingType": "EVALUATION", + "caCertificate": "TFMwdC4uLg==", + "createdAt": "2024-04-01T12:34:56.123456Z", + "description": "A sample organization", + "displayName": "basic-organization", + "expiresAt": "2024-04-01T12:34:56.123456Z", + "lastModifiedAt": "2024-04-01T12:34:56.123456Z", + "name": "example-project-01", + "projectId": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + } + ] + }, + "runtimeType": "CLOUD", + "state": "ACTIVE", + "subscriptionType": "TRIAL" + } +} + +--- + +GET https://apigee.googleapis.com/v1/organizations/example-project-01?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +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 + +{ + "analyticsRegion": "us-west1", + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "billingType": "EVALUATION", + "caCertificate": "TFMwdC4uLg==", + "createdAt": "2024-04-01T12:34:56.123456Z", + "description": "A sample organization", + "displayName": "basic-organization", + "expiresAt": "2024-04-01T12:34:56.123456Z", + "lastModifiedAt": "2024-04-01T12:34:56.123456Z", + "name": "example-project-01", + "projectId": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + } + ] + }, + "runtimeType": "CLOUD", + "state": "ACTIVE", + "subscriptionType": "TRIAL" +} + +--- + +PUT https://apigee.googleapis.com/v1/organizations/example-project-01?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +{ + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "description": "A sample organization", + "displayName": "basic-organization", + "name": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + } + ] + } +} + +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 + +{ + "analyticsRegion": "us-west1", + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "billingType": "EVALUATION", + "caCertificate": "TFMwdC4uLg==", + "createdAt": "2024-04-01T12:34:56.123456Z", + "description": "A sample organization", + "displayName": "basic-organization", + "expiresAt": "2024-04-01T12:34:56.123456Z", + "lastModifiedAt": "2024-04-01T12:34:56.123456Z", + "name": "example-project-01", + "projectId": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + } + ] + }, + "runtimeType": "CLOUD", + "state": "ACTIVE", + "subscriptionType": "TRIAL" +} + +--- + +GET https://apigee.googleapis.com/v1/organizations/example-project-01?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +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 + +{ + "analyticsRegion": "us-west1", + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "billingType": "EVALUATION", + "caCertificate": "TFMwdC4uLg==", + "createdAt": "2024-04-01T12:34:56.123456Z", + "description": "A sample organization", + "displayName": "basic-organization", + "expiresAt": "2024-04-01T12:34:56.123456Z", + "lastModifiedAt": "2024-04-01T12:34:56.123456Z", + "name": "example-project-01", + "projectId": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + } + ] + }, + "runtimeType": "CLOUD", + "state": "ACTIVE", + "subscriptionType": "TRIAL" +} + +--- + +PUT https://apigee.googleapis.com/v1/organizations/example-project-01?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +{ + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "description": "An updated organization", + "displayName": "updated-organization", + "name": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + }, + { + "name": "features.mart.server.endpoint", + "value": "https://127.0.0.1" + } + ] + } +} + +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 + +{ + "analyticsRegion": "us-west1", + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "billingType": "EVALUATION", + "caCertificate": "TFMwdC4uLg==", + "createdAt": "2024-04-01T12:34:56.123456Z", + "description": "An updated organization", + "displayName": "updated-organization", + "expiresAt": "2024-04-01T12:34:56.123456Z", + "lastModifiedAt": "2024-04-01T12:34:56.123456Z", + "name": "example-project-01", + "projectId": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + }, + { + "name": "features.mart.server.endpoint", + "value": "https://127.0.0.1" + } + ] + }, + "runtimeType": "CLOUD", + "state": "ACTIVE", + "subscriptionType": "TRIAL" +} + +--- + +GET https://apigee.googleapis.com/v1/organizations/example-project-01?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +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 + +{ + "analyticsRegion": "us-west1", + "authorizedNetwork": "projects/${projectId}/global/networks/${networkID}", + "billingType": "EVALUATION", + "caCertificate": "TFMwdC4uLg==", + "createdAt": "2024-04-01T12:34:56.123456Z", + "description": "An updated organization", + "displayName": "updated-organization", + "expiresAt": "2024-04-01T12:34:56.123456Z", + "lastModifiedAt": "2024-04-01T12:34:56.123456Z", + "name": "example-project-01", + "projectId": "example-project-01", + "properties": { + "property": [ + { + "name": "features.hybrid.enabled", + "value": "true" + }, + { + "name": "features.mart.connect.enabled", + "value": "false" + }, + { + "name": "features.mart.server.endpoint", + "value": "https://127.0.0.1" + } + ] + }, + "runtimeType": "CLOUD", + "state": "ACTIVE", + "subscriptionType": "TRIAL" +} + +--- + +DELETE https://apigee.googleapis.com/v1/organizations/example-project-01?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +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 + +{ + "metadata": { + "@type": "type.googleapis.com/google.cloud.apigee.v1.GoogleCloudApigeeV1OperationMetadata", + "operationType": "DELETE", + "state": "IN_PROGRESS", + "targetResourceName": "organizations/example-project-01" + }, + "name": "organizations/example-project-01/operations/${operationID}" +} + +--- + +GET https://apigee.googleapis.com/v1/organizations/example-project-01/operations/${operationID}?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +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 + +{ + "done": true, + "metadata": { + "@type": "type.googleapis.com/google.cloud.apigee.v1.GoogleCloudApigeeV1OperationMetadata", + "operationType": "DELETE", + "state": "FINISHED", + "targetResourceName": "organizations/example-project-01" + }, + "name": "organizations/example-project-01/operations/${operationID}", + "response": { + "@type": "type.googleapis.com/google.protobuf.Empty" + } +} + +--- + +GET https://apigee.googleapis.com/v1/organizations/example-project-01?alt=json +Content-Type: application/json +User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1 + +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, + "message": "googleCloudApigeeV1Organization \"organizations/example-project-01\" not found", + "status": "NOT_FOUND" + } +} \ No newline at end of file diff --git a/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/create.yaml b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/create.yaml index 48d807e0ed..529a758837 100644 --- a/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/create.yaml @@ -28,11 +28,11 @@ spec: authorizedNetworkRef: name: "default" runtimeType: "CLOUD" - addonsConfig: - advancedApiOpsConfig: - enabled: true - integrationConfig: - enabled: false - monetizationConfig: - enabled: false + # addonsConfig: + # advancedApiOpsConfig: + # enabled: true + # # integrationConfig: + # # enabled: false + # monetizationConfig: + # enabled: false diff --git a/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/update.yaml b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/update.yaml index da2ef8935e..bc0d8b2c6c 100644 --- a/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/apigee/v1beta1/apigeeorganization/update.yaml @@ -29,11 +29,12 @@ spec: authorizedNetworkRef: name: "default" runtimeType: "CLOUD" - addonsConfig: - advancedApiOpsConfig: - enabled: false - integrationConfig: - enabled: true - monetizationConfig: - enabled: true + # addonsConfig: + # advancedApiOpsConfig: + # enabled: false + # # TODO: these are not actually declared in the schema + # # integrationConfig: + # # enabled: true + # monetizationConfig: + # enabled: true diff --git a/tests/e2e/normalize.go b/tests/e2e/normalize.go index d7ecdba675..a20aa7cae7 100644 --- a/tests/e2e/normalize.go +++ b/tests/e2e/normalize.go @@ -74,6 +74,11 @@ func normalizeKRMObject(t *testing.T, u *unstructured.Unstructured, project test visitor.replacePaths[".status.observedState.etag"] = "abcdef123456" visitor.replacePaths[".status.observedState.creationTimestamp"] = "1970-01-01T00:00:00Z" + // Apigee + visitor.replacePaths[".status.expiresAt"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".status.createdAt"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".status.lastModifiedAt"] = "2024-04-01T12:34:56.123456Z" + // Specific to AlloyDB visitor.replacePaths[".status.continuousBackupInfo[].enabledTime"] = "1970-01-01T00:00:00Z" visitor.replacePaths[".status.ipAddress"] = "10.1.2.3" @@ -712,8 +717,17 @@ func normalizeHTTPResponses(t *testing.T, events test.LogEntries) { visitor.sortSlices.Insert(".subnetworks") // Specific to Apigee - visitor.replacePaths[".response.lastModifiedAt"] = "2024-04-01T12:34:56.123456Z" visitor.replacePaths[".response.createdAt"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".response.lastModifiedAt"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".response.expiresAt"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".response.lastModifiedAt"] = "2024-04-01T12:34:56.123456Z" + { + visitor.sortSlices.Insert(".response.properties.property") + visitor.sortSlices.Insert(".properties.property") + visitor.replacePaths[".expiresAt"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".createdAt"] = "2024-04-01T12:34:56.123456Z" + visitor.replacePaths[".lastModifiedAt"] = "2024-04-01T12:34:56.123456Z" + } for _, event := range events { // Compute URLs: Replace any compute beta URLs with v1 URLs