Skip to content

Commit

Permalink
Mock AccessContextManager
Browse files Browse the repository at this point in the history
  • Loading branch information
gemmahou committed Mar 24, 2024
1 parent ee1db9f commit 260629b
Show file tree
Hide file tree
Showing 27 changed files with 11,622 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kind: AccessContextManagerAccessLevel
metadata:
annotations:
# Replace "${ORG_ID?}" with the numeric ID for your organization
cnrm.cloud.google.com/organization-id: "${ORG_ID}"
cnrm.cloud.google.com/organization-id: "${ORG_ID?}"
name: accesslevelsample
spec:
accessPolicyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kind: AccessContextManagerAccessPolicy
metadata:
annotations:
# Replace "${ORG_ID?}" with the numeric ID for your organization
cnrm.cloud.google.com/organization-id: "${ORG_ID}"
cnrm.cloud.google.com/organization-id: "${ORG_ID?}"
name: accesspolicysample
spec:
title: Config Connector Sample
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kind: AccessContextManagerAccessLevel
metadata:
annotations:
# Replace "${ORG_ID?}" with the numeric ID for your organization
cnrm.cloud.google.com/organization-id: "${ORG_ID}"
cnrm.cloud.google.com/organization-id: "${ORG_ID?}"
name: serviceperimeterdep1
spec:
accessPolicyRef:
Expand All @@ -34,7 +34,7 @@ kind: AccessContextManagerAccessLevel
metadata:
annotations:
# Replace "${ORG_ID?}" with the numeric ID for your organization
cnrm.cloud.google.com/organization-id: "${ORG_ID}"
cnrm.cloud.google.com/organization-id: "${ORG_ID?}"
name: serviceperimeterdep2
spec:
accessPolicyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ spec:
egressPolicies:
- egressFrom:
identities:
- name: serviceperimeterengressdep
- serviceAccountRef:
name: serviceperimeterengressdep
- egressTo:
resources:
- projectRef:
external: "projects/${PROJECT_NUMBER1}"
ingressPolicies:
- ingressFrom:
identities:
- name: serviceperimeteringressdep
- serviceAccountRef:
name: serviceperimeteringressdep
sources:
- accessLevelRef:
name: serviceperimeterdep2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ kind: IAMServiceAccount
metadata:
annotations:
# Replace "${ORG_ID?}" with the numeric ID for your organization
cnrm.cloud.google.com/organization-id: "${ORG_ID}"
cnrm.cloud.google.com/organization-id: "${ORG_ID?}"
name: serviceperimeterengressdep
---
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMServiceAccount
metadata:
annotations:
# Replace "${ORG_ID?}" with the numeric ID for your organization
cnrm.cloud.google.com/organization-id: "${ORG_ID}"
cnrm.cloud.google.com/organization-id: "${ORG_ID?}"
name: serviceperimeteringressdep
4 changes: 4 additions & 0 deletions config/tests/samples/create/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured
}

switch gvk.GroupKind() {
case schema.GroupKind{Group: "accesscontextmanager.cnrm.cloud.google.com", Kind: "AccessContextManagerAccessLevel"}:
case schema.GroupKind{Group: "accesscontextmanager.cnrm.cloud.google.com", Kind: "AccessContextManagerServicePerimeter"}:
case schema.GroupKind{Group: "accesscontextmanager.cnrm.cloud.google.com", Kind: "AccessContextManagerServicePerimeterResource"}:

case schema.GroupKind{Group: "apikeys.cnrm.cloud.google.com", Kind: "APIKeysKey"}:

case schema.GroupKind{Group: "cloudfunctions.cnrm.cloud.google.com", Kind: "CloudFunctionsFunction"}:
Expand Down
3 changes: 2 additions & 1 deletion mockgcp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ gen-proto:
./third_party/googleapis/mockgcp/cloud/security/privateca/v1/*.proto \
./third_party/googleapis/mockgcp/cloud/secretmanager/v1/*.proto \
./third_party/googleapis/mockgcp/api/serviceusage/v1/*.proto \
./third_party/googleapis/mockgcp/api/serviceusage/v1beta1/*.proto
./third_party/googleapis/mockgcp/api/serviceusage/v1beta1/*.proto \
./third_party/googleapis/mockgcp/identity/accesscontextmanager/v1/*.proto
4 changes: 4 additions & 0 deletions mockgcp/fixup-third-party.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ rm -rf mockgcp/ && mkdir -p mockgcp/api/
mv google/cloud/ mockgcp/
mv google/iam/ mockgcp/
mv google/storage/ mockgcp/
mv google/identity/ mockgcp/
mv google/api/apikeys/ mockgcp/api/
mv google/api/serviceusage/ mockgcp/api/

Expand All @@ -41,6 +42,9 @@ find . -type f -print0 | xargs -0 sed -i -e "s@google\[email protected]@g"
find . -type f -print0 | xargs -0 sed -i -e "s@google/storage/@mockgcp/storage/@g"
find . -type f -print0 | xargs -0 sed -i -e "s@google\[email protected]@g"

find . -type f -print0 | xargs -0 sed -i -e "s@google/identity/@mockgcp/identity/@g"
find . -type f -print0 | xargs -0 sed -i -e "s@google\[email protected]@g"

find . -type f -print0 | xargs -0 sed -i -e "s@google/api/apikeys/@mockgcp/api/apikeys/@g"
find . -type f -print0 | xargs -0 sed -i -e "s@google\.api\[email protected]@g"

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 260629b

Please sign in to comment.