diff --git a/README.NewResourceFromTerraform.md b/README.NewResourceFromTerraform.md index c82c256bef..3a8805a897 100644 --- a/README.NewResourceFromTerraform.md +++ b/README.NewResourceFromTerraform.md @@ -1,12 +1,8 @@ -## Before You Start - -This README entails instructions to implement a new resource CRD through -[Terraform Provider Google](https://github.com/hashicorp/terraform-provider-google). - # Add a New Resource -The instructions will help you add a new resource to Config Connector. A -resource is a K8s representation of a GCP resource. +The instructions will help you add a new resource to Config Connector through +[Terraform Provider Google](https://github.com/hashicorp/terraform-provider-google). +A Config Connector resource is the kubernetes representation of a GCP resource. # Overview @@ -257,7 +253,7 @@ ServiceMappings file. Add the `ResourceConfig` for your resource: key: projectRef // one of 'projectRef', 'folderRef', 'organizationRef' and 'billingAccountRef' resourceReferences: - tfField: project - key: projectRef. // must match the key defined in hierarchicalReferences list + key: projectRef // must match the key defined in hierarchicalReferences list description: |- The project that this resource belongs to. gvk: diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_apikeyskeys.apikeys.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_apikeyskeys.apikeys.cnrm.cloud.google.com.yaml new file mode 100644 index 0000000000..5f1112fb80 --- /dev/null +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_apikeyskeys.apikeys.cnrm.cloud.google.com.yaml @@ -0,0 +1,249 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cnrm.cloud.google.com/version: 0.0.0-dev + creationTimestamp: null + labels: + cnrm.cloud.google.com/managed-by-kcc: "true" + cnrm.cloud.google.com/stability-level: stable + cnrm.cloud.google.com/system: "true" + cnrm.cloud.google.com/tf2crd: "true" + name: apikeyskeys.apikeys.cnrm.cloud.google.com +spec: + group: apikeys.cnrm.cloud.google.com + names: + categories: + - gcp + kind: APIKeysKey + plural: apikeyskeys + shortNames: + - gcpapikeyskey + - gcpapikeyskeys + singular: apikeyskey + preserveUnknownFields: false + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: When 'True', the most recent reconcile of the resource succeeded + jsonPath: .status.conditions[?(@.type=='Ready')].status + name: Ready + type: string + - description: The reason for the value in 'Ready' + jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Status + type: string + - description: The last transition time for the value in 'Status' + jsonPath: .status.conditions[?(@.type=='Ready')].lastTransitionTime + name: Status Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'apiVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + displayName: + description: Human-readable display name of this API key. Modifiable + by user. + type: string + projectRef: + description: The project that this resource belongs to. + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: 'Allowed value: The `name` field of a `Project` resource.' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + type: object + resourceID: + description: Immutable. Optional. The name of the resource. Used for + creation and acquisition. When unset, the value of `metadata.name` + is used as the default. + type: string + restrictions: + description: Key restrictions. + properties: + androidKeyRestrictions: + description: The Android apps that are allowed to use the key. + properties: + allowedApplications: + description: A list of Android applications that are allowed + to make API calls with this key. + items: + properties: + packageName: + description: The package name of the application. + type: string + sha1Fingerprint: + description: 'The SHA1 fingerprint of the application. + For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 + or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output + format is the latter.' + type: string + required: + - packageName + - sha1Fingerprint + type: object + type: array + required: + - allowedApplications + type: object + apiTargets: + description: A restriction for a specific service and optionally + one or more specific methods. Requests are allowed if they match + any of these restrictions. If no restrictions are specified, + all targets are allowed. + items: + properties: + methods: + description: 'Optional. List of one or more methods that + can be called. If empty, all methods for the service are + allowed. A wildcard (*) can be used as the last symbol. + Valid examples: `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` + `TranslateText` `Get*` `translate.googleapis.com.Get*`.' + items: + type: string + type: array + service: + description: 'The service for this restriction. It should + be the canonical service name, for example: `translate.googleapis.com`. + You can use `gcloud services list` to get a list of services + that are enabled in the project.' + type: string + required: + - service + type: object + type: array + browserKeyRestrictions: + description: The HTTP referrers (websites) that are allowed to + use the key. + properties: + allowedReferrers: + description: A list of regular expressions for the referrer + URLs that are allowed to make API calls with this key. + items: + type: string + type: array + required: + - allowedReferrers + type: object + iosKeyRestrictions: + description: The iOS apps that are allowed to use the key. + properties: + allowedBundleIds: + description: A list of bundle IDs that are allowed when making + API calls with this key. + items: + type: string + type: array + required: + - allowedBundleIds + type: object + serverKeyRestrictions: + description: The IP addresses of callers that are allowed to use + the key. + properties: + allowedIps: + description: A list of the caller IP addresses that are allowed + to make API calls with this key. + items: + type: string + type: array + required: + - allowedIps + type: object + type: object + required: + - projectRef + type: object + status: + properties: + conditions: + description: Conditions represent the latest available observation + of the resource's current state. + items: + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + type: string + message: + description: Human-readable message indicating details about + last transition. + type: string + reason: + description: Unique, one-word, CamelCase reason for the condition's + last transition. + type: string + status: + description: Status is the status of the condition. Can be True, + False, Unknown. + type: string + type: + description: Type is the type of the condition. + type: string + type: object + type: array + keyString: + description: Output only. An encrypted and signed value held by this + key. This field can be accessed only through the `GetKeyString` + method. + type: string + observedGeneration: + description: ObservedGeneration is the generation of the resource + that was most recently observed by the Config Connector controller. + If this is equal to metadata.generation, then that means that the + current reported status reflects the most recent desired state of + the resource. + type: integer + uid: + description: Output only. Unique id in UUID4 format. + type: string + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/config/installbundle/components/clusterroles/cnrm_admin.yaml b/config/installbundle/components/clusterroles/cnrm_admin.yaml index 3cf8fbcff8..4918bbcefb 100644 --- a/config/installbundle/components/clusterroles/cnrm_admin.yaml +++ b/config/installbundle/components/clusterroles/cnrm_admin.yaml @@ -55,6 +55,18 @@ rules: - update - patch - delete +- apiGroups: + - apikeys.cnrm.cloud.google.com + resources: + - '*' + verbs: + - get + - list + - watch + - create + - update + - patch + - delete - apiGroups: - appengine.cnrm.cloud.google.com resources: diff --git a/config/installbundle/components/clusterroles/cnrm_viewer.yaml b/config/installbundle/components/clusterroles/cnrm_viewer.yaml index 3010c73482..0a32263e99 100644 --- a/config/installbundle/components/clusterroles/cnrm_viewer.yaml +++ b/config/installbundle/components/clusterroles/cnrm_viewer.yaml @@ -38,6 +38,14 @@ rules: - get - list - watch +- apiGroups: + - apikeys.cnrm.cloud.google.com + resources: + - '*' + verbs: + - get + - list + - watch - apiGroups: - appengine.cnrm.cloud.google.com resources: diff --git a/config/samples/resources/apikeyskey/apikeys_v1alpha1_apikeyskey.yaml b/config/samples/resources/apikeyskey/apikeys_v1alpha1_apikeyskey.yaml new file mode 100644 index 0000000000..07b640cf5a --- /dev/null +++ b/config/samples/resources/apikeyskey/apikeys_v1alpha1_apikeyskey.yaml @@ -0,0 +1,28 @@ +# 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. + +apiVersion: apikeys.cnrm.cloud.google.com/v1alpha1 +kind: APIKeysKey +metadata: + name: apikeyskey-sample +spec: + displayName: "Human readable name" + projectRef: + # Replace ${PROJECT_ID?} with your project ID + external: "projects/${PROJECT_ID?}" + resourceID: sample + restrictions: + apiTargets: + - service: "translate.googleapis.com" + methods: [ "GET" ] \ No newline at end of file diff --git a/config/servicemappings/apikeys.yaml b/config/servicemappings/apikeys.yaml new file mode 100644 index 0000000000..c3bb6f53e4 --- /dev/null +++ b/config/servicemappings/apikeys.yaml @@ -0,0 +1,45 @@ +# 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. + +apiVersion: core.cnrm.cloud.google.com/v1alpha1 +kind: ServiceMapping +metadata: + name: apikeys.cnrm.cloud.google.com + namespace: cnrm-system +spec: + name: APIKeys + version: v1alpha1 + serviceHostName: "apikeys.googleapis.com" + resources: + - name: google_apikeys_key + kind: APIKeysKey + metadataMapping: + name: name + resourceID: + targetField: name + resourceAvailableInAssetInventory: true + idTemplate: "projects/{{project}}/locations/global/keys/{{name}}" + idTemplateCanBeUsedToMatchResourceName: true + hierarchicalReferences: + - type: project + key: projectRef + resourceReferences: + - tfField: project + key: projectRef + description: |- + The project that this resource belongs to. + gvk: + kind: Project + version: v1beta1 + group: resourcemanager.cnrm.cloud.google.com \ No newline at end of file diff --git a/config/tests/samples/create/harness.go b/config/tests/samples/create/harness.go index fe7b86dd63..e4bbaca210 100644 --- a/config/tests/samples/create/harness.go +++ b/config/tests/samples/create/harness.go @@ -397,6 +397,8 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured } switch gvk.GroupKind() { + case schema.GroupKind{Group: "apikeys.cnrm.cloud.google.com", Kind: "APIKeysKey"}: + case schema.GroupKind{Group: "cloudfunctions.cnrm.cloud.google.com", Kind: "CloudFunctionsFunction"}: case schema.GroupKind{Group: "containerattached.cnrm.cloud.google.com", Kind: "ContainerAttachedCluster"}: diff --git a/go.mod b/go.mod index 1960683bb7..1a40003681 100644 --- a/go.mod +++ b/go.mod @@ -61,11 +61,11 @@ require ( require ( bitbucket.org/creachadair/stringset v0.0.8 // indirect - cloud.google.com/go v0.110.7 // indirect + cloud.google.com/go v0.110.8 // indirect cloud.google.com/go/bigtable v1.19.0 // indirect cloud.google.com/go/compute v1.23.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.1 // indirect + cloud.google.com/go/iam v1.1.2 // indirect cloud.google.com/go/longrunning v0.5.1 // indirect dario.cat/mergo v1.0.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect diff --git a/go.sum b/go.sum index dfaeadeaa1..09a9cd9ae1 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,8 @@ cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSU cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.92.2/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= +cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -42,8 +42,8 @@ cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2Aawl cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= +cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/longrunning v0.5.1 h1:Fr7TXftcqTudoyRJa113hyaqlGdiBQkp0Gq7tErFDWI= cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= cloud.google.com/go/profiler v0.1.0 h1:MG/rxKC1MztRfEWMGYKFISxyZak5hNh29f0A/z2tvWk= diff --git a/mockgcp/Makefile b/mockgcp/Makefile index 92e9564654..f5c17d066f 100644 --- a/mockgcp/Makefile +++ b/mockgcp/Makefile @@ -26,6 +26,7 @@ gen-proto: --grpc-gateway_opt paths=source_relative \ --experimental_allow_proto3_optional \ ./apis/mockgcp/cloud/resourcemanager/v1/*.proto \ + ./third_party/googleapis/mockgcp/api/apikeys/v2/*.proto \ ./third_party/googleapis/mockgcp/iam/admin/v1/*.proto \ ./third_party/googleapis/mockgcp/cloud/billing/v1/*.proto \ ./third_party/googleapis/mockgcp/cloud/certificatemanager/v1/*.proto \ diff --git a/mockgcp/README.md b/mockgcp/README.md index d2fab1ee20..fe2d1889c9 100644 --- a/mockgcp/README.md +++ b/mockgcp/README.md @@ -32,7 +32,8 @@ Broadly the steps are: refer to your resource's API documentation to identify the service name, for example [privateca](https://cloud.google.com/certificate-authority-service/docs/reference/rest#service:-privateca.googleapis.com). Once you identify the service, find the proper path to the proto files, for example: `cloud/security/privateca/v1/*.proto`. Then replace the prefix `googleapis/google/` to `./third_party/googleapis/mockgcp/`, - and add into the Makefile. + and add into the Makefile. If you're adding an API outside of googleapis/google/cloud, + you may need to add commands to rename the API o mockgcp in [fixup-third-party.sh](fixup-third-party.sh] 1. Add a subdirectory called `mock`. Copying one of the existing ones. `mockprivateca` is a reasonable basic one. Keep the files names.go and service.go, diff --git a/mockgcp/fixup-third-party.sh b/mockgcp/fixup-third-party.sh index 6bdc2b1cdb..5eb62edb84 100755 --- a/mockgcp/fixup-third-party.sh +++ b/mockgcp/fixup-third-party.sh @@ -25,6 +25,7 @@ rm -rf mockgcp/ && mkdir -p mockgcp/api/ mv google/cloud/ mockgcp/ mv google/iam/ mockgcp/ +mv google/api/apikeys/ mockgcp/api/ mv google/api/serviceusage/ mockgcp/api/ cd mockgcp @@ -32,6 +33,9 @@ cd mockgcp find . -type f -print0 | xargs -0 sed -i -e "s@google/iam/@mockgcp/iam/@g" find . -type f -print0 | xargs -0 sed -i -e "s@google\.iam@mockgcp.iam@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\.apikeys@mockgcp.api.apikeys@g" + find . -type f -print0 | xargs -0 sed -i -e "s@google/api/serviceusage/@mockgcp/api/serviceusage/@g" find . -type f -print0 | xargs -0 sed -i -e "s@google\.api\.serviceusage@mockgcp.api.serviceusage@g" diff --git a/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys.pb.go b/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys.pb.go new file mode 100644 index 0000000000..0a973b223b --- /dev/null +++ b/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys.pb.go @@ -0,0 +1,1096 @@ +// Copyright 2023 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: mockgcp/api/apikeys/v2/apikeys.proto + +package apikeyspb + +import ( + longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" + _ "github.com/golang/protobuf/ptypes/empty" + _ "google.golang.org/genproto/googleapis/api/annotations" + field_mask "google.golang.org/genproto/protobuf/field_mask" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Request message for `CreateKey` method. +type CreateKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. The project in which the API key is created. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The API key fields to set at creation time. + // You can configure only the `display_name`, `restrictions`, and + // `annotations` fields. + Key *Key `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // User specified key id (optional). If specified, it will become the final + // component of the key resource name. + // + // The id must be unique within the project, must conform with RFC-1034, + // is restricted to lower-cased letters, and has a maximum length of 63 + // characters. In another word, the id must match the regular + // expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + // + // The id must NOT be a UUID-like string. + KeyId string `protobuf:"bytes,3,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` +} + +func (x *CreateKeyRequest) Reset() { + *x = CreateKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateKeyRequest) ProtoMessage() {} + +func (x *CreateKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateKeyRequest.ProtoReflect.Descriptor instead. +func (*CreateKeyRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateKeyRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreateKeyRequest) GetKey() *Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *CreateKeyRequest) GetKeyId() string { + if x != nil { + return x.KeyId + } + return "" +} + +// Request message for `ListKeys` method. +type ListKeysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. Lists all API keys associated with this project. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. Specifies the maximum number of results to be returned at a time. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. Requests a specific page of results. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // Optional. Indicate that keys deleted in the past 30 days should also be + // returned. + ShowDeleted bool `protobuf:"varint,6,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"` +} + +func (x *ListKeysRequest) Reset() { + *x = ListKeysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListKeysRequest) ProtoMessage() {} + +func (x *ListKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListKeysRequest.ProtoReflect.Descriptor instead. +func (*ListKeysRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{1} +} + +func (x *ListKeysRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListKeysRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListKeysRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListKeysRequest) GetShowDeleted() bool { + if x != nil { + return x.ShowDeleted + } + return false +} + +// Response message for `ListKeys` method. +type ListKeysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A list of API keys. + Keys []*Key `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` + // The pagination token for the next page of results. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListKeysResponse) Reset() { + *x = ListKeysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListKeysResponse) ProtoMessage() {} + +func (x *ListKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListKeysResponse.ProtoReflect.Descriptor instead. +func (*ListKeysResponse) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{2} +} + +func (x *ListKeysResponse) GetKeys() []*Key { + if x != nil { + return x.Keys + } + return nil +} + +func (x *ListKeysResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Request message for `GetKey` method. +type GetKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. The resource name of the API key to get. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetKeyRequest) Reset() { + *x = GetKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetKeyRequest) ProtoMessage() {} + +func (x *GetKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetKeyRequest.ProtoReflect.Descriptor instead. +func (*GetKeyRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{3} +} + +func (x *GetKeyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for `GetKeyString` method. +type GetKeyStringRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. The resource name of the API key to be retrieved. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetKeyStringRequest) Reset() { + *x = GetKeyStringRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetKeyStringRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetKeyStringRequest) ProtoMessage() {} + +func (x *GetKeyStringRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetKeyStringRequest.ProtoReflect.Descriptor instead. +func (*GetKeyStringRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{4} +} + +func (x *GetKeyStringRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Response message for `GetKeyString` method. +type GetKeyStringResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // An encrypted and signed value of the key. + KeyString string `protobuf:"bytes,1,opt,name=key_string,json=keyString,proto3" json:"key_string,omitempty"` +} + +func (x *GetKeyStringResponse) Reset() { + *x = GetKeyStringResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetKeyStringResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetKeyStringResponse) ProtoMessage() {} + +func (x *GetKeyStringResponse) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetKeyStringResponse.ProtoReflect.Descriptor instead. +func (*GetKeyStringResponse) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{5} +} + +func (x *GetKeyStringResponse) GetKeyString() string { + if x != nil { + return x.KeyString + } + return "" +} + +// Request message for `UpdateKey` method. +type UpdateKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. Set the `name` field to the resource name of the API key to be + // updated. You can update only the `display_name`, `restrictions`, and + // `annotations` fields. + Key *Key `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The field mask specifies which fields to be updated as part of this + // request. All other fields are ignored. + // Mutable fields are: `display_name`, `restrictions`, and `annotations`. + // If an update mask is not provided, the service treats it as an implied mask + // equivalent to all allowed fields that are set on the wire. If the field + // mask has a special value "*", the service treats it equivalent to replace + // all allowed mutable fields. + UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` +} + +func (x *UpdateKeyRequest) Reset() { + *x = UpdateKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateKeyRequest) ProtoMessage() {} + +func (x *UpdateKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateKeyRequest.ProtoReflect.Descriptor instead. +func (*UpdateKeyRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateKeyRequest) GetKey() *Key { + if x != nil { + return x.Key + } + return nil +} + +func (x *UpdateKeyRequest) GetUpdateMask() *field_mask.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +// Request message for `DeleteKey` method. +type DeleteKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. The resource name of the API key to be deleted. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Optional. The etag known to the client for the expected state of the key. + // This is to be used for optimistic concurrency. + Etag string `protobuf:"bytes,2,opt,name=etag,proto3" json:"etag,omitempty"` +} + +func (x *DeleteKeyRequest) Reset() { + *x = DeleteKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteKeyRequest) ProtoMessage() {} + +func (x *DeleteKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteKeyRequest.ProtoReflect.Descriptor instead. +func (*DeleteKeyRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteKeyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DeleteKeyRequest) GetEtag() string { + if x != nil { + return x.Etag + } + return "" +} + +// Request message for `UndeleteKey` method. +type UndeleteKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. The resource name of the API key to be undeleted. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *UndeleteKeyRequest) Reset() { + *x = UndeleteKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UndeleteKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UndeleteKeyRequest) ProtoMessage() {} + +func (x *UndeleteKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UndeleteKeyRequest.ProtoReflect.Descriptor instead. +func (*UndeleteKeyRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{8} +} + +func (x *UndeleteKeyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Request message for `LookupKey` method. +type LookupKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required. Finds the project that owns the key string value. + KeyString string `protobuf:"bytes,1,opt,name=key_string,json=keyString,proto3" json:"key_string,omitempty"` +} + +func (x *LookupKeyRequest) Reset() { + *x = LookupKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LookupKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LookupKeyRequest) ProtoMessage() {} + +func (x *LookupKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LookupKeyRequest.ProtoReflect.Descriptor instead. +func (*LookupKeyRequest) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{9} +} + +func (x *LookupKeyRequest) GetKeyString() string { + if x != nil { + return x.KeyString + } + return "" +} + +// Response message for `LookupKey` method. +type LookupKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The project that owns the key with the value specified in the request. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // The resource name of the API key. If the API key has been purged, + // resource name is empty. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *LookupKeyResponse) Reset() { + *x = LookupKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LookupKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LookupKeyResponse) ProtoMessage() {} + +func (x *LookupKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LookupKeyResponse.ProtoReflect.Descriptor instead. +func (*LookupKeyResponse) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP(), []int{10} +} + +func (x *LookupKeyResponse) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *LookupKeyResponse) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_mockgcp_api_apikeys_v2_apikeys_proto protoreflect.FileDescriptor + +var file_mockgcp_api_apikeys_v2_apikeys_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, + 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x1a, 0x1c, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x6d, 0x6f, + 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, + 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x6c, 0x6f, 0x6e, 0x67, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x6f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x01, + 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x22, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x1c, 0x12, 0x1a, 0x61, 0x70, 0x69, 0x6b, + 0x65, 0x79, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x4b, 0x65, 0x79, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x32, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x6f, + 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4b, 0x65, 0x79, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x22, 0xbb, 0x01, 0x0a, 0x0f, 0x4c, 0x69, + 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, + 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xe0, + 0x41, 0x02, 0xfa, 0x41, 0x1c, 0x12, 0x1a, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4b, 0x65, + 0x79, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x03, 0xe0, 0x41, + 0x01, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x03, 0xe0, 0x41, 0x01, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x26, 0x0a, 0x0c, 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x08, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x0b, 0x73, 0x68, 0x6f, 0x77, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x22, 0x6b, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4b, + 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, + 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, + 0x76, 0x32, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x47, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x22, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x1c, 0x0a, 0x1a, 0x61, 0x70, 0x69, + 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4d, 0x0a, + 0x13, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x22, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x1c, 0x0a, 0x1a, 0x61, 0x70, 0x69, 0x6b, + 0x65, 0x79, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x14, + 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x22, 0x83, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4b, 0x65, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4b, + 0x65, 0x79, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3b, 0x0a, 0x0b, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x63, 0x0a, 0x10, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xe0, 0x41, 0x02, + 0xfa, 0x41, 0x1c, 0x0a, 0x1a, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4b, 0x65, 0x79, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x65, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x04, 0x65, 0x74, 0x61, 0x67, 0x22, 0x4c, + 0x0a, 0x12, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x22, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x1c, 0x0a, 0x1a, 0x61, 0x70, 0x69, 0x6b, + 0x65, 0x79, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x36, 0x0a, 0x10, + 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x22, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3f, 0x0a, 0x11, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0xca, 0x0b, 0x0a, 0x07, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, + 0x73, 0x12, 0xbe, 0x01, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, + 0x28, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, + 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x68, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, + 0x22, 0x28, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x3a, 0x03, 0x6b, 0x65, 0x79, 0xda, + 0x41, 0x11, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x6b, 0x65, 0x79, 0x2c, 0x6b, 0x65, 0x79, + 0x5f, 0x69, 0x64, 0xca, 0x41, 0x1c, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x15, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x98, 0x01, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x12, + 0x27, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, + 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, + 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x39, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x76, 0x32, 0x2f, + 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, + 0x2f, 0x2a, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, + 0x6b, 0x65, 0x79, 0x73, 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x85, 0x01, + 0x0a, 0x06, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, + 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, + 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4b, 0x65, 0x79, 0x22, 0x37, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x2a, 0x7d, 0xda, 0x41, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0xac, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2b, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, + 0x4b, 0x65, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x41, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x12, 0x32, 0x2f, 0x76, 0x32, 0x2f, 0x7b, + 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x6b, 0x65, 0x79, 0x73, + 0x2f, 0x2a, 0x7d, 0x2f, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0xda, 0x41, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0xc0, 0x01, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4b, + 0x65, 0x79, 0x12, 0x28, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, + 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6a, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x33, 0x32, 0x2c, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6b, 0x65, 0x79, 0x2e, 0x6e, 0x61, + 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x2a, + 0x7d, 0x3a, 0x03, 0x6b, 0x65, 0x79, 0xda, 0x41, 0x0f, 0x6b, 0x65, 0x79, 0x2c, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0xca, 0x41, 0x1c, 0x0a, 0x03, 0x4b, 0x65, 0x79, + 0x12, 0x15, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0xac, 0x01, 0x0a, 0x09, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x28, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x72, 0x75, 0x6e, + 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x56, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x2a, 0x28, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x2a, 0x7d, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0xca, 0x41, 0x1c, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, + 0x15, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0xb5, 0x01, 0x0a, 0x0b, 0x55, 0x6e, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, + 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x5b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x22, 0x31, 0x2f, 0x76, 0x32, 0x2f, 0x7b, + 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x6b, 0x65, 0x79, 0x73, + 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0xca, + 0x41, 0x1c, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x15, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x7c, + 0x0a, 0x09, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x12, 0x28, 0x2e, 0x6d, 0x6f, + 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x4c, + 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x32, 0x2f, 0x6b, 0x65, + 0x79, 0x73, 0x3a, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x1a, 0x83, 0x01, 0xca, + 0x41, 0x16, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0xd2, 0x41, 0x67, 0x68, 0x74, 0x74, 0x70, 0x73, + 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, + 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, + 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x2d, 0x6f, 0x6e, + 0x6c, 0x79, 0x42, 0xb4, 0x01, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, + 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, + 0x32, 0x42, 0x0c, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x35, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x61, + 0x70, 0x69, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x62, 0x3b, 0x61, + 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x62, 0xaa, 0x02, 0x17, 0x47, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x2e, + 0x56, 0x32, 0xca, 0x02, 0x17, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5c, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x5c, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x5c, 0x56, 0x32, 0xea, 0x02, 0x1a, 0x47, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x3a, 0x3a, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x3a, 0x3a, 0x41, 0x70, + 0x69, 0x4b, 0x65, 0x79, 0x73, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescOnce sync.Once + file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescData = file_mockgcp_api_apikeys_v2_apikeys_proto_rawDesc +) + +func file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescGZIP() []byte { + file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescOnce.Do(func() { + file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescData = protoimpl.X.CompressGZIP(file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescData) + }) + return file_mockgcp_api_apikeys_v2_apikeys_proto_rawDescData +} + +var file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_mockgcp_api_apikeys_v2_apikeys_proto_goTypes = []interface{}{ + (*CreateKeyRequest)(nil), // 0: mockgcp.api.apikeys.v2.CreateKeyRequest + (*ListKeysRequest)(nil), // 1: mockgcp.api.apikeys.v2.ListKeysRequest + (*ListKeysResponse)(nil), // 2: mockgcp.api.apikeys.v2.ListKeysResponse + (*GetKeyRequest)(nil), // 3: mockgcp.api.apikeys.v2.GetKeyRequest + (*GetKeyStringRequest)(nil), // 4: mockgcp.api.apikeys.v2.GetKeyStringRequest + (*GetKeyStringResponse)(nil), // 5: mockgcp.api.apikeys.v2.GetKeyStringResponse + (*UpdateKeyRequest)(nil), // 6: mockgcp.api.apikeys.v2.UpdateKeyRequest + (*DeleteKeyRequest)(nil), // 7: mockgcp.api.apikeys.v2.DeleteKeyRequest + (*UndeleteKeyRequest)(nil), // 8: mockgcp.api.apikeys.v2.UndeleteKeyRequest + (*LookupKeyRequest)(nil), // 9: mockgcp.api.apikeys.v2.LookupKeyRequest + (*LookupKeyResponse)(nil), // 10: mockgcp.api.apikeys.v2.LookupKeyResponse + (*Key)(nil), // 11: mockgcp.api.apikeys.v2.Key + (*field_mask.FieldMask)(nil), // 12: google.protobuf.FieldMask + (*longrunningpb.Operation)(nil), // 13: google.longrunning.Operation +} +var file_mockgcp_api_apikeys_v2_apikeys_proto_depIdxs = []int32{ + 11, // 0: mockgcp.api.apikeys.v2.CreateKeyRequest.key:type_name -> mockgcp.api.apikeys.v2.Key + 11, // 1: mockgcp.api.apikeys.v2.ListKeysResponse.keys:type_name -> mockgcp.api.apikeys.v2.Key + 11, // 2: mockgcp.api.apikeys.v2.UpdateKeyRequest.key:type_name -> mockgcp.api.apikeys.v2.Key + 12, // 3: mockgcp.api.apikeys.v2.UpdateKeyRequest.update_mask:type_name -> google.protobuf.FieldMask + 0, // 4: mockgcp.api.apikeys.v2.ApiKeys.CreateKey:input_type -> mockgcp.api.apikeys.v2.CreateKeyRequest + 1, // 5: mockgcp.api.apikeys.v2.ApiKeys.ListKeys:input_type -> mockgcp.api.apikeys.v2.ListKeysRequest + 3, // 6: mockgcp.api.apikeys.v2.ApiKeys.GetKey:input_type -> mockgcp.api.apikeys.v2.GetKeyRequest + 4, // 7: mockgcp.api.apikeys.v2.ApiKeys.GetKeyString:input_type -> mockgcp.api.apikeys.v2.GetKeyStringRequest + 6, // 8: mockgcp.api.apikeys.v2.ApiKeys.UpdateKey:input_type -> mockgcp.api.apikeys.v2.UpdateKeyRequest + 7, // 9: mockgcp.api.apikeys.v2.ApiKeys.DeleteKey:input_type -> mockgcp.api.apikeys.v2.DeleteKeyRequest + 8, // 10: mockgcp.api.apikeys.v2.ApiKeys.UndeleteKey:input_type -> mockgcp.api.apikeys.v2.UndeleteKeyRequest + 9, // 11: mockgcp.api.apikeys.v2.ApiKeys.LookupKey:input_type -> mockgcp.api.apikeys.v2.LookupKeyRequest + 13, // 12: mockgcp.api.apikeys.v2.ApiKeys.CreateKey:output_type -> google.longrunning.Operation + 2, // 13: mockgcp.api.apikeys.v2.ApiKeys.ListKeys:output_type -> mockgcp.api.apikeys.v2.ListKeysResponse + 11, // 14: mockgcp.api.apikeys.v2.ApiKeys.GetKey:output_type -> mockgcp.api.apikeys.v2.Key + 5, // 15: mockgcp.api.apikeys.v2.ApiKeys.GetKeyString:output_type -> mockgcp.api.apikeys.v2.GetKeyStringResponse + 13, // 16: mockgcp.api.apikeys.v2.ApiKeys.UpdateKey:output_type -> google.longrunning.Operation + 13, // 17: mockgcp.api.apikeys.v2.ApiKeys.DeleteKey:output_type -> google.longrunning.Operation + 13, // 18: mockgcp.api.apikeys.v2.ApiKeys.UndeleteKey:output_type -> google.longrunning.Operation + 10, // 19: mockgcp.api.apikeys.v2.ApiKeys.LookupKey:output_type -> mockgcp.api.apikeys.v2.LookupKeyResponse + 12, // [12:20] is the sub-list for method output_type + 4, // [4:12] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_mockgcp_api_apikeys_v2_apikeys_proto_init() } +func file_mockgcp_api_apikeys_v2_apikeys_proto_init() { + if File_mockgcp_api_apikeys_v2_apikeys_proto != nil { + return + } + file_mockgcp_api_apikeys_v2_resources_proto_init() + if !protoimpl.UnsafeEnabled { + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListKeysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListKeysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetKeyStringRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetKeyStringResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UndeleteKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LookupKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LookupKeyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_mockgcp_api_apikeys_v2_apikeys_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_mockgcp_api_apikeys_v2_apikeys_proto_goTypes, + DependencyIndexes: file_mockgcp_api_apikeys_v2_apikeys_proto_depIdxs, + MessageInfos: file_mockgcp_api_apikeys_v2_apikeys_proto_msgTypes, + }.Build() + File_mockgcp_api_apikeys_v2_apikeys_proto = out.File + file_mockgcp_api_apikeys_v2_apikeys_proto_rawDesc = nil + file_mockgcp_api_apikeys_v2_apikeys_proto_goTypes = nil + file_mockgcp_api_apikeys_v2_apikeys_proto_depIdxs = nil +} diff --git a/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys.pb.gw.go b/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys.pb.gw.go new file mode 100644 index 0000000000..df96ec3523 --- /dev/null +++ b/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys.pb.gw.go @@ -0,0 +1,1028 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: mockgcp/api/apikeys/v2/apikeys.proto + +/* +Package apikeyspb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package apikeyspb + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +var ( + filter_ApiKeys_CreateKey_0 = &utilities.DoubleArray{Encoding: map[string]int{"key": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_ApiKeys_CreateKey_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateKeyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Key); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_CreateKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_CreateKey_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateKeyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Key); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_CreateKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateKey(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ApiKeys_ListKeys_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_ApiKeys_ListKeys_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListKeysRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_ListKeys_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListKeys(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_ListKeys_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListKeysRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_ListKeys_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListKeys(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ApiKeys_GetKey_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_GetKey_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetKey(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ApiKeys_GetKeyString_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetKeyStringRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetKeyString(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_GetKeyString_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetKeyStringRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetKeyString(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ApiKeys_UpdateKey_0 = &utilities.DoubleArray{Encoding: map[string]int{"key": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} +) + +func request_ApiKeys_UpdateKey_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateKeyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Key); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Key); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["key.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "key.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "key.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_UpdateKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_UpdateKey_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateKeyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Key); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Key); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["key.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "key.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "key.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "key.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_UpdateKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateKey(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ApiKeys_DeleteKey_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_ApiKeys_DeleteKey_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_DeleteKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DeleteKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_DeleteKey_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteKeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_DeleteKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DeleteKey(ctx, &protoReq) + return msg, metadata, err + +} + +func request_ApiKeys_UndeleteKey_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UndeleteKeyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.UndeleteKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_UndeleteKey_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UndeleteKeyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.UndeleteKey(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_ApiKeys_LookupKey_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_ApiKeys_LookupKey_0(ctx context.Context, marshaler runtime.Marshaler, client ApiKeysClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LookupKeyRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_LookupKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LookupKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ApiKeys_LookupKey_0(ctx context.Context, marshaler runtime.Marshaler, server ApiKeysServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LookupKeyRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ApiKeys_LookupKey_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LookupKey(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterApiKeysHandlerServer registers the http handlers for service ApiKeys to "mux". +// UnaryRPC :call ApiKeysServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterApiKeysHandlerFromEndpoint instead. +func RegisterApiKeysHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiKeysServer) error { + + mux.Handle("POST", pattern_ApiKeys_CreateKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/CreateKey", runtime.WithHTTPPathPattern("/v2/{parent=projects/*/locations/*}/keys")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_CreateKey_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_CreateKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_ListKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/ListKeys", runtime.WithHTTPPathPattern("/v2/{parent=projects/*/locations/*}/keys")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_ListKeys_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_ListKeys_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_GetKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/GetKey", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_GetKey_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_GetKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_GetKeyString_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/GetKeyString", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}/keyString")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_GetKeyString_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_GetKeyString_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ApiKeys_UpdateKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/UpdateKey", runtime.WithHTTPPathPattern("/v2/{key.name=projects/*/locations/*/keys/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_UpdateKey_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_UpdateKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_ApiKeys_DeleteKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/DeleteKey", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_DeleteKey_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_DeleteKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ApiKeys_UndeleteKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/UndeleteKey", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}:undelete")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_UndeleteKey_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_UndeleteKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_LookupKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/LookupKey", runtime.WithHTTPPathPattern("/v2/keys:lookupKey")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ApiKeys_LookupKey_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_LookupKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterApiKeysHandlerFromEndpoint is same as RegisterApiKeysHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterApiKeysHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterApiKeysHandler(ctx, mux, conn) +} + +// RegisterApiKeysHandler registers the http handlers for service ApiKeys to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterApiKeysHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterApiKeysHandlerClient(ctx, mux, NewApiKeysClient(conn)) +} + +// RegisterApiKeysHandlerClient registers the http handlers for service ApiKeys +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ApiKeysClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ApiKeysClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "ApiKeysClient" to call the correct interceptors. +func RegisterApiKeysHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiKeysClient) error { + + mux.Handle("POST", pattern_ApiKeys_CreateKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/CreateKey", runtime.WithHTTPPathPattern("/v2/{parent=projects/*/locations/*}/keys")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_CreateKey_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_CreateKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_ListKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/ListKeys", runtime.WithHTTPPathPattern("/v2/{parent=projects/*/locations/*}/keys")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_ListKeys_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_ListKeys_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_GetKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/GetKey", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_GetKey_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_GetKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_GetKeyString_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/GetKeyString", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}/keyString")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_GetKeyString_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_GetKeyString_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_ApiKeys_UpdateKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/UpdateKey", runtime.WithHTTPPathPattern("/v2/{key.name=projects/*/locations/*/keys/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_UpdateKey_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_UpdateKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_ApiKeys_DeleteKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/DeleteKey", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_DeleteKey_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_DeleteKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ApiKeys_UndeleteKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/UndeleteKey", runtime.WithHTTPPathPattern("/v2/{name=projects/*/locations/*/keys/*}:undelete")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_UndeleteKey_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_UndeleteKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ApiKeys_LookupKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/mockgcp.api.apikeys.v2.ApiKeys/LookupKey", runtime.WithHTTPPathPattern("/v2/keys:lookupKey")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ApiKeys_LookupKey_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ApiKeys_LookupKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_ApiKeys_CreateKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v2", "projects", "locations", "parent", "keys"}, "")) + + pattern_ApiKeys_ListKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v2", "projects", "locations", "parent", "keys"}, "")) + + pattern_ApiKeys_GetKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 4, 6, 5, 4}, []string{"v2", "projects", "locations", "keys", "name"}, "")) + + pattern_ApiKeys_GetKeyString_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 4, 6, 5, 4, 2, 5}, []string{"v2", "projects", "locations", "keys", "name", "keyString"}, "")) + + pattern_ApiKeys_UpdateKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 4, 6, 5, 4}, []string{"v2", "projects", "locations", "keys", "key.name"}, "")) + + pattern_ApiKeys_DeleteKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 4, 6, 5, 4}, []string{"v2", "projects", "locations", "keys", "name"}, "")) + + pattern_ApiKeys_UndeleteKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 4, 6, 5, 4}, []string{"v2", "projects", "locations", "keys", "name"}, "undelete")) + + pattern_ApiKeys_LookupKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "keys"}, "lookupKey")) +) + +var ( + forward_ApiKeys_CreateKey_0 = runtime.ForwardResponseMessage + + forward_ApiKeys_ListKeys_0 = runtime.ForwardResponseMessage + + forward_ApiKeys_GetKey_0 = runtime.ForwardResponseMessage + + forward_ApiKeys_GetKeyString_0 = runtime.ForwardResponseMessage + + forward_ApiKeys_UpdateKey_0 = runtime.ForwardResponseMessage + + forward_ApiKeys_DeleteKey_0 = runtime.ForwardResponseMessage + + forward_ApiKeys_UndeleteKey_0 = runtime.ForwardResponseMessage + + forward_ApiKeys_LookupKey_0 = runtime.ForwardResponseMessage +) diff --git a/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys_grpc.pb.go b/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys_grpc.pb.go new file mode 100644 index 0000000000..df97c6f086 --- /dev/null +++ b/mockgcp/generated/mockgcp/api/apikeys/v2/apikeys_grpc.pb.go @@ -0,0 +1,432 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.12.4 +// source: mockgcp/api/apikeys/v2/apikeys.proto + +package apikeyspb + +import ( + longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ApiKeysClient is the client API for ApiKeys service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ApiKeysClient interface { + // Creates a new API key. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + CreateKey(ctx context.Context, in *CreateKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) + // Lists the API keys owned by a project. The key string of the API key + // isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + ListKeys(ctx context.Context, in *ListKeysRequest, opts ...grpc.CallOption) (*ListKeysResponse, error) + // Gets the metadata for an API key. The key string of the API key + // isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + GetKey(ctx context.Context, in *GetKeyRequest, opts ...grpc.CallOption) (*Key, error) + // Get the key string for an API key. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + GetKeyString(ctx context.Context, in *GetKeyStringRequest, opts ...grpc.CallOption) (*GetKeyStringResponse, error) + // Patches the modifiable fields of an API key. + // The key string of the API key isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + UpdateKey(ctx context.Context, in *UpdateKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) + // Deletes an API key. Deleted key can be retrieved within 30 days of + // deletion. Afterward, key will be purged from the project. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + DeleteKey(ctx context.Context, in *DeleteKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) + // Undeletes an API key which was deleted within 30 days. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + UndeleteKey(ctx context.Context, in *UndeleteKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) + // Find the parent project and resource name of the API + // key that matches the key string in the request. If the API key has been + // purged, resource name will not be set. + // The service account must have the `apikeys.keys.lookup` permission + // on the parent project. + LookupKey(ctx context.Context, in *LookupKeyRequest, opts ...grpc.CallOption) (*LookupKeyResponse, error) +} + +type apiKeysClient struct { + cc grpc.ClientConnInterface +} + +func NewApiKeysClient(cc grpc.ClientConnInterface) ApiKeysClient { + return &apiKeysClient{cc} +} + +func (c *apiKeysClient) CreateKey(ctx context.Context, in *CreateKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) { + out := new(longrunningpb.Operation) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/CreateKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiKeysClient) ListKeys(ctx context.Context, in *ListKeysRequest, opts ...grpc.CallOption) (*ListKeysResponse, error) { + out := new(ListKeysResponse) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/ListKeys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiKeysClient) GetKey(ctx context.Context, in *GetKeyRequest, opts ...grpc.CallOption) (*Key, error) { + out := new(Key) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/GetKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiKeysClient) GetKeyString(ctx context.Context, in *GetKeyStringRequest, opts ...grpc.CallOption) (*GetKeyStringResponse, error) { + out := new(GetKeyStringResponse) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/GetKeyString", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiKeysClient) UpdateKey(ctx context.Context, in *UpdateKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) { + out := new(longrunningpb.Operation) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/UpdateKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiKeysClient) DeleteKey(ctx context.Context, in *DeleteKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) { + out := new(longrunningpb.Operation) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/DeleteKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiKeysClient) UndeleteKey(ctx context.Context, in *UndeleteKeyRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) { + out := new(longrunningpb.Operation) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/UndeleteKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiKeysClient) LookupKey(ctx context.Context, in *LookupKeyRequest, opts ...grpc.CallOption) (*LookupKeyResponse, error) { + out := new(LookupKeyResponse) + err := c.cc.Invoke(ctx, "/mockgcp.api.apikeys.v2.ApiKeys/LookupKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ApiKeysServer is the server API for ApiKeys service. +// All implementations must embed UnimplementedApiKeysServer +// for forward compatibility +type ApiKeysServer interface { + // Creates a new API key. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + CreateKey(context.Context, *CreateKeyRequest) (*longrunningpb.Operation, error) + // Lists the API keys owned by a project. The key string of the API key + // isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + ListKeys(context.Context, *ListKeysRequest) (*ListKeysResponse, error) + // Gets the metadata for an API key. The key string of the API key + // isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + GetKey(context.Context, *GetKeyRequest) (*Key, error) + // Get the key string for an API key. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + GetKeyString(context.Context, *GetKeyStringRequest) (*GetKeyStringResponse, error) + // Patches the modifiable fields of an API key. + // The key string of the API key isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + UpdateKey(context.Context, *UpdateKeyRequest) (*longrunningpb.Operation, error) + // Deletes an API key. Deleted key can be retrieved within 30 days of + // deletion. Afterward, key will be purged from the project. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + DeleteKey(context.Context, *DeleteKeyRequest) (*longrunningpb.Operation, error) + // Undeletes an API key which was deleted within 30 days. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + UndeleteKey(context.Context, *UndeleteKeyRequest) (*longrunningpb.Operation, error) + // Find the parent project and resource name of the API + // key that matches the key string in the request. If the API key has been + // purged, resource name will not be set. + // The service account must have the `apikeys.keys.lookup` permission + // on the parent project. + LookupKey(context.Context, *LookupKeyRequest) (*LookupKeyResponse, error) + mustEmbedUnimplementedApiKeysServer() +} + +// UnimplementedApiKeysServer must be embedded to have forward compatible implementations. +type UnimplementedApiKeysServer struct { +} + +func (UnimplementedApiKeysServer) CreateKey(context.Context, *CreateKeyRequest) (*longrunningpb.Operation, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateKey not implemented") +} +func (UnimplementedApiKeysServer) ListKeys(context.Context, *ListKeysRequest) (*ListKeysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListKeys not implemented") +} +func (UnimplementedApiKeysServer) GetKey(context.Context, *GetKeyRequest) (*Key, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetKey not implemented") +} +func (UnimplementedApiKeysServer) GetKeyString(context.Context, *GetKeyStringRequest) (*GetKeyStringResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetKeyString not implemented") +} +func (UnimplementedApiKeysServer) UpdateKey(context.Context, *UpdateKeyRequest) (*longrunningpb.Operation, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateKey not implemented") +} +func (UnimplementedApiKeysServer) DeleteKey(context.Context, *DeleteKeyRequest) (*longrunningpb.Operation, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteKey not implemented") +} +func (UnimplementedApiKeysServer) UndeleteKey(context.Context, *UndeleteKeyRequest) (*longrunningpb.Operation, error) { + return nil, status.Errorf(codes.Unimplemented, "method UndeleteKey not implemented") +} +func (UnimplementedApiKeysServer) LookupKey(context.Context, *LookupKeyRequest) (*LookupKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LookupKey not implemented") +} +func (UnimplementedApiKeysServer) mustEmbedUnimplementedApiKeysServer() {} + +// UnsafeApiKeysServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ApiKeysServer will +// result in compilation errors. +type UnsafeApiKeysServer interface { + mustEmbedUnimplementedApiKeysServer() +} + +func RegisterApiKeysServer(s grpc.ServiceRegistrar, srv ApiKeysServer) { + s.RegisterService(&ApiKeys_ServiceDesc, srv) +} + +func _ApiKeys_CreateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).CreateKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/CreateKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).CreateKey(ctx, req.(*CreateKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiKeys_ListKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).ListKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/ListKeys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).ListKeys(ctx, req.(*ListKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiKeys_GetKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).GetKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/GetKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).GetKey(ctx, req.(*GetKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiKeys_GetKeyString_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetKeyStringRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).GetKeyString(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/GetKeyString", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).GetKeyString(ctx, req.(*GetKeyStringRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiKeys_UpdateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).UpdateKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/UpdateKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).UpdateKey(ctx, req.(*UpdateKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiKeys_DeleteKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).DeleteKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/DeleteKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).DeleteKey(ctx, req.(*DeleteKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiKeys_UndeleteKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UndeleteKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).UndeleteKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/UndeleteKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).UndeleteKey(ctx, req.(*UndeleteKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiKeys_LookupKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LookupKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiKeysServer).LookupKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mockgcp.api.apikeys.v2.ApiKeys/LookupKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiKeysServer).LookupKey(ctx, req.(*LookupKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ApiKeys_ServiceDesc is the grpc.ServiceDesc for ApiKeys service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ApiKeys_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "mockgcp.api.apikeys.v2.ApiKeys", + HandlerType: (*ApiKeysServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateKey", + Handler: _ApiKeys_CreateKey_Handler, + }, + { + MethodName: "ListKeys", + Handler: _ApiKeys_ListKeys_Handler, + }, + { + MethodName: "GetKey", + Handler: _ApiKeys_GetKey_Handler, + }, + { + MethodName: "GetKeyString", + Handler: _ApiKeys_GetKeyString_Handler, + }, + { + MethodName: "UpdateKey", + Handler: _ApiKeys_UpdateKey_Handler, + }, + { + MethodName: "DeleteKey", + Handler: _ApiKeys_DeleteKey_Handler, + }, + { + MethodName: "UndeleteKey", + Handler: _ApiKeys_UndeleteKey_Handler, + }, + { + MethodName: "LookupKey", + Handler: _ApiKeys_LookupKey_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "mockgcp/api/apikeys/v2/apikeys.proto", +} diff --git a/mockgcp/generated/mockgcp/api/apikeys/v2/resources.pb.go b/mockgcp/generated/mockgcp/api/apikeys/v2/resources.pb.go new file mode 100644 index 0000000000..7eb706e2fe --- /dev/null +++ b/mockgcp/generated/mockgcp/api/apikeys/v2/resources.pb.go @@ -0,0 +1,949 @@ +// Copyright 2023 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: mockgcp/api/apikeys/v2/resources.proto + +package apikeyspb + +import ( + timestamp "github.com/golang/protobuf/ptypes/timestamp" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The representation of a key managed by the API Keys API. +type Key struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Output only. The resource name of the key. + // The `name` has the form: + // `projects//locations/global/keys/`. + // For example: + // `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Output only. Unique id in UUID4 format. + Uid string `protobuf:"bytes,5,opt,name=uid,proto3" json:"uid,omitempty"` + // Human-readable display name of this key that you can modify. + // The maximum length is 63 characters. + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // Output only. An encrypted and signed value held by this key. + // This field can be accessed only through the `GetKeyString` method. + KeyString string `protobuf:"bytes,3,opt,name=key_string,json=keyString,proto3" json:"key_string,omitempty"` + // Output only. A timestamp identifying the time this key was originally + // created. + CreateTime *timestamp.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // Output only. A timestamp identifying the time this key was last + // updated. + UpdateTime *timestamp.Timestamp `protobuf:"bytes,6,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // Output only. A timestamp when this key was deleted. If the resource is not + // deleted, this must be empty. + DeleteTime *timestamp.Timestamp `protobuf:"bytes,7,opt,name=delete_time,json=deleteTime,proto3" json:"delete_time,omitempty"` + // Annotations is an unstructured key-value map stored with a policy that + // may be set by external tools to store and retrieve arbitrary metadata. + // They are not queryable and should be preserved when modifying objects. + Annotations map[string]string `protobuf:"bytes,8,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Key restrictions. + Restrictions *Restrictions `protobuf:"bytes,9,opt,name=restrictions,proto3" json:"restrictions,omitempty"` + // Output only. A checksum computed by the server based on the current value + // of the Key resource. This may be sent on update and delete requests to + // ensure the client has an up-to-date value before proceeding. See + // https://google.aip.dev/154. + Etag string `protobuf:"bytes,11,opt,name=etag,proto3" json:"etag,omitempty"` +} + +func (x *Key) Reset() { + *x = Key{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Key) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Key) ProtoMessage() {} + +func (x *Key) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Key.ProtoReflect.Descriptor instead. +func (*Key) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{0} +} + +func (x *Key) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Key) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *Key) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *Key) GetKeyString() string { + if x != nil { + return x.KeyString + } + return "" +} + +func (x *Key) GetCreateTime() *timestamp.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *Key) GetUpdateTime() *timestamp.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + +func (x *Key) GetDeleteTime() *timestamp.Timestamp { + if x != nil { + return x.DeleteTime + } + return nil +} + +func (x *Key) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *Key) GetRestrictions() *Restrictions { + if x != nil { + return x.Restrictions + } + return nil +} + +func (x *Key) GetEtag() string { + if x != nil { + return x.Etag + } + return "" +} + +// Describes the restrictions on the key. +type Restrictions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The websites, IP addresses, Android apps, or iOS apps (the clients) that + // are allowed to use the key. You can specify only one type of client + // restrictions per key. + // + // Types that are assignable to ClientRestrictions: + // + // *Restrictions_BrowserKeyRestrictions + // *Restrictions_ServerKeyRestrictions + // *Restrictions_AndroidKeyRestrictions + // *Restrictions_IosKeyRestrictions + ClientRestrictions isRestrictions_ClientRestrictions `protobuf_oneof:"client_restrictions"` + // A restriction for a specific service and optionally one or + // more specific methods. Requests are allowed if they + // match any of these restrictions. If no restrictions are + // specified, all targets are allowed. + ApiTargets []*ApiTarget `protobuf:"bytes,5,rep,name=api_targets,json=apiTargets,proto3" json:"api_targets,omitempty"` +} + +func (x *Restrictions) Reset() { + *x = Restrictions{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Restrictions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Restrictions) ProtoMessage() {} + +func (x *Restrictions) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Restrictions.ProtoReflect.Descriptor instead. +func (*Restrictions) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{1} +} + +func (m *Restrictions) GetClientRestrictions() isRestrictions_ClientRestrictions { + if m != nil { + return m.ClientRestrictions + } + return nil +} + +func (x *Restrictions) GetBrowserKeyRestrictions() *BrowserKeyRestrictions { + if x, ok := x.GetClientRestrictions().(*Restrictions_BrowserKeyRestrictions); ok { + return x.BrowserKeyRestrictions + } + return nil +} + +func (x *Restrictions) GetServerKeyRestrictions() *ServerKeyRestrictions { + if x, ok := x.GetClientRestrictions().(*Restrictions_ServerKeyRestrictions); ok { + return x.ServerKeyRestrictions + } + return nil +} + +func (x *Restrictions) GetAndroidKeyRestrictions() *AndroidKeyRestrictions { + if x, ok := x.GetClientRestrictions().(*Restrictions_AndroidKeyRestrictions); ok { + return x.AndroidKeyRestrictions + } + return nil +} + +func (x *Restrictions) GetIosKeyRestrictions() *IosKeyRestrictions { + if x, ok := x.GetClientRestrictions().(*Restrictions_IosKeyRestrictions); ok { + return x.IosKeyRestrictions + } + return nil +} + +func (x *Restrictions) GetApiTargets() []*ApiTarget { + if x != nil { + return x.ApiTargets + } + return nil +} + +type isRestrictions_ClientRestrictions interface { + isRestrictions_ClientRestrictions() +} + +type Restrictions_BrowserKeyRestrictions struct { + // The HTTP referrers (websites) that are allowed to use the key. + BrowserKeyRestrictions *BrowserKeyRestrictions `protobuf:"bytes,1,opt,name=browser_key_restrictions,json=browserKeyRestrictions,proto3,oneof"` +} + +type Restrictions_ServerKeyRestrictions struct { + // The IP addresses of callers that are allowed to use the key. + ServerKeyRestrictions *ServerKeyRestrictions `protobuf:"bytes,2,opt,name=server_key_restrictions,json=serverKeyRestrictions,proto3,oneof"` +} + +type Restrictions_AndroidKeyRestrictions struct { + // The Android apps that are allowed to use the key. + AndroidKeyRestrictions *AndroidKeyRestrictions `protobuf:"bytes,3,opt,name=android_key_restrictions,json=androidKeyRestrictions,proto3,oneof"` +} + +type Restrictions_IosKeyRestrictions struct { + // The iOS apps that are allowed to use the key. + IosKeyRestrictions *IosKeyRestrictions `protobuf:"bytes,4,opt,name=ios_key_restrictions,json=iosKeyRestrictions,proto3,oneof"` +} + +func (*Restrictions_BrowserKeyRestrictions) isRestrictions_ClientRestrictions() {} + +func (*Restrictions_ServerKeyRestrictions) isRestrictions_ClientRestrictions() {} + +func (*Restrictions_AndroidKeyRestrictions) isRestrictions_ClientRestrictions() {} + +func (*Restrictions_IosKeyRestrictions) isRestrictions_ClientRestrictions() {} + +// The HTTP referrers (websites) that are allowed to use the key. +type BrowserKeyRestrictions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A list of regular expressions for the referrer URLs that are allowed + // to make API calls with this key. + AllowedReferrers []string `protobuf:"bytes,1,rep,name=allowed_referrers,json=allowedReferrers,proto3" json:"allowed_referrers,omitempty"` +} + +func (x *BrowserKeyRestrictions) Reset() { + *x = BrowserKeyRestrictions{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BrowserKeyRestrictions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BrowserKeyRestrictions) ProtoMessage() {} + +func (x *BrowserKeyRestrictions) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BrowserKeyRestrictions.ProtoReflect.Descriptor instead. +func (*BrowserKeyRestrictions) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{2} +} + +func (x *BrowserKeyRestrictions) GetAllowedReferrers() []string { + if x != nil { + return x.AllowedReferrers + } + return nil +} + +// The IP addresses of callers that are allowed to use the key. +type ServerKeyRestrictions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A list of the caller IP addresses that are allowed to make API calls + // with this key. + AllowedIps []string `protobuf:"bytes,1,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"` +} + +func (x *ServerKeyRestrictions) Reset() { + *x = ServerKeyRestrictions{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerKeyRestrictions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerKeyRestrictions) ProtoMessage() {} + +func (x *ServerKeyRestrictions) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerKeyRestrictions.ProtoReflect.Descriptor instead. +func (*ServerKeyRestrictions) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{3} +} + +func (x *ServerKeyRestrictions) GetAllowedIps() []string { + if x != nil { + return x.AllowedIps + } + return nil +} + +// The Android apps that are allowed to use the key. +type AndroidKeyRestrictions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A list of Android applications that are allowed to make API calls with + // this key. + AllowedApplications []*AndroidApplication `protobuf:"bytes,1,rep,name=allowed_applications,json=allowedApplications,proto3" json:"allowed_applications,omitempty"` +} + +func (x *AndroidKeyRestrictions) Reset() { + *x = AndroidKeyRestrictions{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AndroidKeyRestrictions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AndroidKeyRestrictions) ProtoMessage() {} + +func (x *AndroidKeyRestrictions) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AndroidKeyRestrictions.ProtoReflect.Descriptor instead. +func (*AndroidKeyRestrictions) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{4} +} + +func (x *AndroidKeyRestrictions) GetAllowedApplications() []*AndroidApplication { + if x != nil { + return x.AllowedApplications + } + return nil +} + +// Identifier of an Android application for key use. +type AndroidApplication struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The SHA1 fingerprint of the application. For example, both sha1 formats are + // acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or + // DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. + // Output format is the latter. + Sha1Fingerprint string `protobuf:"bytes,1,opt,name=sha1_fingerprint,json=sha1Fingerprint,proto3" json:"sha1_fingerprint,omitempty"` + // The package name of the application. + PackageName string `protobuf:"bytes,2,opt,name=package_name,json=packageName,proto3" json:"package_name,omitempty"` +} + +func (x *AndroidApplication) Reset() { + *x = AndroidApplication{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AndroidApplication) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AndroidApplication) ProtoMessage() {} + +func (x *AndroidApplication) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AndroidApplication.ProtoReflect.Descriptor instead. +func (*AndroidApplication) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{5} +} + +func (x *AndroidApplication) GetSha1Fingerprint() string { + if x != nil { + return x.Sha1Fingerprint + } + return "" +} + +func (x *AndroidApplication) GetPackageName() string { + if x != nil { + return x.PackageName + } + return "" +} + +// The iOS apps that are allowed to use the key. +type IosKeyRestrictions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A list of bundle IDs that are allowed when making API calls with this key. + AllowedBundleIds []string `protobuf:"bytes,1,rep,name=allowed_bundle_ids,json=allowedBundleIds,proto3" json:"allowed_bundle_ids,omitempty"` +} + +func (x *IosKeyRestrictions) Reset() { + *x = IosKeyRestrictions{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IosKeyRestrictions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IosKeyRestrictions) ProtoMessage() {} + +func (x *IosKeyRestrictions) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IosKeyRestrictions.ProtoReflect.Descriptor instead. +func (*IosKeyRestrictions) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{6} +} + +func (x *IosKeyRestrictions) GetAllowedBundleIds() []string { + if x != nil { + return x.AllowedBundleIds + } + return nil +} + +// A restriction for a specific service and optionally one or multiple +// specific methods. Both fields are case insensitive. +type ApiTarget struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The service for this restriction. It should be the canonical + // service name, for example: `translate.googleapis.com`. + // You can use [`gcloud services list`](/sdk/gcloud/reference/services/list) + // to get a list of services that are enabled in the project. + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` + // Optional. List of one or more methods that can be called. + // If empty, all methods for the service are allowed. A wildcard + // (*) can be used as the last symbol. + // Valid examples: + // + // `mockgcp.cloud.translate.v2.TranslateService.GetSupportedLanguage` + // `TranslateText` + // `Get*` + // `translate.googleapis.com.Get*` + Methods []string `protobuf:"bytes,2,rep,name=methods,proto3" json:"methods,omitempty"` +} + +func (x *ApiTarget) Reset() { + *x = ApiTarget{} + if protoimpl.UnsafeEnabled { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApiTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiTarget) ProtoMessage() {} + +func (x *ApiTarget) ProtoReflect() protoreflect.Message { + mi := &file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ApiTarget.ProtoReflect.Descriptor instead. +func (*ApiTarget) Descriptor() ([]byte, []int) { + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP(), []int{7} +} + +func (x *ApiTarget) GetService() string { + if x != nil { + return x.Service + } + return "" +} + +func (x *ApiTarget) GetMethods() []string { + if x != nil { + return x.Methods + } + return nil +} + +var File_mockgcp_api_apikeys_v2_resources_proto protoreflect.FileDescriptor + +var file_mockgcp_api_apikeys_v2_resources_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, + 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, + 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, + 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x05, + 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x15, + 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, + 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, + 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x6b, 0x65, 0x79, 0x5f, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, + 0x03, 0x52, 0x09, 0x6b, 0x65, 0x79, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x40, 0x0a, 0x0b, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x03, 0xe0, + 0x41, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x40, + 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, + 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x40, 0x0a, 0x0b, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x4e, 0x0a, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, + 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, + 0x2e, 0x4b, 0x65, 0x79, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x48, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, + 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0c, + 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x17, 0x0a, 0x04, + 0x65, 0x74, 0x61, 0x67, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, + 0x04, 0x65, 0x74, 0x61, 0x67, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x61, 0xea, 0x41, 0x5e, 0x0a, 0x1a, 0x61, 0x70, 0x69, 0x6b, + 0x65, 0x79, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x4b, 0x65, 0x79, 0x12, 0x32, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, + 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x7d, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x2f, + 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x7b, 0x6b, 0x65, 0x79, 0x7d, 0x2a, 0x04, 0x6b, 0x65, 0x79, 0x73, + 0x32, 0x03, 0x6b, 0x65, 0x79, 0x52, 0x01, 0x01, 0x22, 0x8a, 0x04, 0x0a, 0x0c, 0x52, 0x65, 0x73, + 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x6a, 0x0a, 0x18, 0x62, 0x72, 0x6f, + 0x77, 0x73, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6d, 0x6f, + 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, + 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x52, + 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x16, 0x62, + 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x67, 0x0a, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, + 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x15, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x6a, + 0x0a, 0x18, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x65, + 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2e, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, + 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, + 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x48, 0x00, 0x52, 0x16, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5e, 0x0a, 0x14, 0x69, 0x6f, + 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, + 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, + 0x32, 0x2e, 0x49, 0x6f, 0x73, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x12, 0x69, 0x6f, 0x73, 0x4b, 0x65, 0x79, 0x52, 0x65, + 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x42, 0x0a, 0x0b, 0x61, 0x70, + 0x69, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, + 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x70, 0x69, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x42, 0x15, + 0x0a, 0x13, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x45, 0x0a, 0x16, 0x42, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, + 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, + 0x72, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x65, 0x64, 0x52, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x73, 0x22, 0x38, 0x0a, 0x15, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, + 0x5f, 0x69, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x65, 0x64, 0x49, 0x70, 0x73, 0x22, 0x77, 0x0a, 0x16, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, + 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x5d, 0x0a, 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x61, 0x70, 0x69, + 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x65, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, + 0x62, 0x0a, 0x12, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x68, 0x61, 0x31, 0x5f, 0x66, 0x69, + 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x73, 0x68, 0x61, 0x31, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, + 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x22, 0x42, 0x0a, 0x12, 0x49, 0x6f, 0x73, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, + 0x74, 0x72, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x42, 0x75, + 0x6e, 0x64, 0x6c, 0x65, 0x49, 0x64, 0x73, 0x22, 0x44, 0x0a, 0x09, 0x41, 0x70, 0x69, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1d, + 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, + 0x03, 0xe0, 0x41, 0x01, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x42, 0xb6, 0x01, + 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x6f, 0x63, 0x6b, 0x67, 0x63, 0x70, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x76, 0x32, 0x42, 0x0e, 0x52, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x76, + 0x32, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x70, 0x62, 0x3b, 0x61, 0x70, 0x69, 0x6b, + 0x65, 0x79, 0x73, 0x70, 0x62, 0xaa, 0x02, 0x17, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x43, + 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x2e, 0x56, 0x32, 0xca, + 0x02, 0x17, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x5c, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x5c, 0x41, + 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x5c, 0x56, 0x32, 0xea, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x3a, 0x3a, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x4b, 0x65, + 0x79, 0x73, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_mockgcp_api_apikeys_v2_resources_proto_rawDescOnce sync.Once + file_mockgcp_api_apikeys_v2_resources_proto_rawDescData = file_mockgcp_api_apikeys_v2_resources_proto_rawDesc +) + +func file_mockgcp_api_apikeys_v2_resources_proto_rawDescGZIP() []byte { + file_mockgcp_api_apikeys_v2_resources_proto_rawDescOnce.Do(func() { + file_mockgcp_api_apikeys_v2_resources_proto_rawDescData = protoimpl.X.CompressGZIP(file_mockgcp_api_apikeys_v2_resources_proto_rawDescData) + }) + return file_mockgcp_api_apikeys_v2_resources_proto_rawDescData +} + +var file_mockgcp_api_apikeys_v2_resources_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_mockgcp_api_apikeys_v2_resources_proto_goTypes = []interface{}{ + (*Key)(nil), // 0: mockgcp.api.apikeys.v2.Key + (*Restrictions)(nil), // 1: mockgcp.api.apikeys.v2.Restrictions + (*BrowserKeyRestrictions)(nil), // 2: mockgcp.api.apikeys.v2.BrowserKeyRestrictions + (*ServerKeyRestrictions)(nil), // 3: mockgcp.api.apikeys.v2.ServerKeyRestrictions + (*AndroidKeyRestrictions)(nil), // 4: mockgcp.api.apikeys.v2.AndroidKeyRestrictions + (*AndroidApplication)(nil), // 5: mockgcp.api.apikeys.v2.AndroidApplication + (*IosKeyRestrictions)(nil), // 6: mockgcp.api.apikeys.v2.IosKeyRestrictions + (*ApiTarget)(nil), // 7: mockgcp.api.apikeys.v2.ApiTarget + nil, // 8: mockgcp.api.apikeys.v2.Key.AnnotationsEntry + (*timestamp.Timestamp)(nil), // 9: google.protobuf.Timestamp +} +var file_mockgcp_api_apikeys_v2_resources_proto_depIdxs = []int32{ + 9, // 0: mockgcp.api.apikeys.v2.Key.create_time:type_name -> google.protobuf.Timestamp + 9, // 1: mockgcp.api.apikeys.v2.Key.update_time:type_name -> google.protobuf.Timestamp + 9, // 2: mockgcp.api.apikeys.v2.Key.delete_time:type_name -> google.protobuf.Timestamp + 8, // 3: mockgcp.api.apikeys.v2.Key.annotations:type_name -> mockgcp.api.apikeys.v2.Key.AnnotationsEntry + 1, // 4: mockgcp.api.apikeys.v2.Key.restrictions:type_name -> mockgcp.api.apikeys.v2.Restrictions + 2, // 5: mockgcp.api.apikeys.v2.Restrictions.browser_key_restrictions:type_name -> mockgcp.api.apikeys.v2.BrowserKeyRestrictions + 3, // 6: mockgcp.api.apikeys.v2.Restrictions.server_key_restrictions:type_name -> mockgcp.api.apikeys.v2.ServerKeyRestrictions + 4, // 7: mockgcp.api.apikeys.v2.Restrictions.android_key_restrictions:type_name -> mockgcp.api.apikeys.v2.AndroidKeyRestrictions + 6, // 8: mockgcp.api.apikeys.v2.Restrictions.ios_key_restrictions:type_name -> mockgcp.api.apikeys.v2.IosKeyRestrictions + 7, // 9: mockgcp.api.apikeys.v2.Restrictions.api_targets:type_name -> mockgcp.api.apikeys.v2.ApiTarget + 5, // 10: mockgcp.api.apikeys.v2.AndroidKeyRestrictions.allowed_applications:type_name -> mockgcp.api.apikeys.v2.AndroidApplication + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_mockgcp_api_apikeys_v2_resources_proto_init() } +func file_mockgcp_api_apikeys_v2_resources_proto_init() { + if File_mockgcp_api_apikeys_v2_resources_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Key); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Restrictions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BrowserKeyRestrictions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerKeyRestrictions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AndroidKeyRestrictions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AndroidApplication); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IosKeyRestrictions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ApiTarget); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_mockgcp_api_apikeys_v2_resources_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*Restrictions_BrowserKeyRestrictions)(nil), + (*Restrictions_ServerKeyRestrictions)(nil), + (*Restrictions_AndroidKeyRestrictions)(nil), + (*Restrictions_IosKeyRestrictions)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_mockgcp_api_apikeys_v2_resources_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_mockgcp_api_apikeys_v2_resources_proto_goTypes, + DependencyIndexes: file_mockgcp_api_apikeys_v2_resources_proto_depIdxs, + MessageInfos: file_mockgcp_api_apikeys_v2_resources_proto_msgTypes, + }.Build() + File_mockgcp_api_apikeys_v2_resources_proto = out.File + file_mockgcp_api_apikeys_v2_resources_proto_rawDesc = nil + file_mockgcp_api_apikeys_v2_resources_proto_goTypes = nil + file_mockgcp_api_apikeys_v2_resources_proto_depIdxs = nil +} diff --git a/mockgcp/go.mod b/mockgcp/go.mod index 3194b059e8..0c0ed3d679 100644 --- a/mockgcp/go.mod +++ b/mockgcp/go.mod @@ -3,7 +3,7 @@ module github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp go 1.21.5 require ( - cloud.google.com/go/iam v1.1.1 + cloud.google.com/go/iam v1.1.2 cloud.google.com/go/longrunning v0.5.1 github.com/golang/protobuf v1.5.3 github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 diff --git a/mockgcp/go.sum b/mockgcp/go.sum index ff739b5173..ccda567537 100644 --- a/mockgcp/go.sum +++ b/mockgcp/go.sum @@ -30,8 +30,8 @@ cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGB cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= +cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= cloud.google.com/go/longrunning v0.5.1 h1:Fr7TXftcqTudoyRJa113hyaqlGdiBQkp0Gq7tErFDWI= cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= diff --git a/mockgcp/mock_http_roundtrip.go b/mockgcp/mock_http_roundtrip.go index c096e74525..c69e099ada 100644 --- a/mockgcp/mock_http_roundtrip.go +++ b/mockgcp/mock_http_roundtrip.go @@ -32,6 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common" + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockapikeys" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockbilling" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockcertificatemanager" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/mockcloudfunctions" @@ -86,6 +87,7 @@ func NewMockRoundTripper(t *testing.T, k8sClient client.Client, storage storage. var services []MockService services = append(services, resourcemanagerService) + services = append(services, mockapikeys.New(env, storage)) services = append(services, mockbilling.New(env, storage)) services = append(services, mockcertificatemanager.New(env, storage)) services = append(services, mockcompute.New(env, storage)) diff --git a/mockgcp/mockapikeys/key.go b/mockgcp/mockapikeys/key.go new file mode 100644 index 0000000000..1b93534be4 --- /dev/null +++ b/mockgcp/mockapikeys/key.go @@ -0,0 +1,190 @@ +// Copyright 2023 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 mockapikeys + +import ( + "context" + "fmt" + "time" + + longrunning "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/fieldmaskpb" + apierrors "k8s.io/apimachinery/pkg/api/errors" + + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/api/apikeys/v2" +) + +type APIKeysV2 struct { + *MockService + pb.UnimplementedApiKeysServer +} + +func (s *APIKeysV2) GetKey(ctx context.Context, req *pb.GetKeyRequest) (*pb.Key, error) { + name, err := s.parseAPIKeyName(req.Name) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.Key{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "key %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error reading key: %v", err) + } + } + + return obj, nil +} + +func (s *APIKeysV2) GetKeyString(ctx context.Context, req *pb.GetKeyStringRequest) (*pb.GetKeyStringResponse, error) { + name, err := s.parseAPIKeyName(req.Name) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.Key{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "key %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error reading key: %v", err) + } + } + + keyString := "dummy-encrypted-value" + return &pb.GetKeyStringResponse{ + KeyString: keyString, + }, nil +} + +func (s *APIKeysV2) CreateKey(ctx context.Context, req *pb.CreateKeyRequest) (*longrunning.Operation, error) { + keyID := req.KeyId + if keyID == "" { + keyID = fmt.Sprintf("key-%d", time.Now().UnixNano()) + } + reqName := req.Parent + "/keys/" + keyID + name, err := s.parseAPIKeyName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := proto.Clone(req.Key).(*pb.Key) + obj.Name = fqn + + if err := s.storage.Create(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error creating key: %v", err) + } + + return s.operations.NewLRO(ctx) +} + +func (s *APIKeysV2) UpdateKey(ctx context.Context, req *pb.UpdateKeyRequest) (*longrunning.Operation, error) { + keyName := req.GetKey().GetName() + + name, err := s.parseAPIKeyName(keyName) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.Key{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "key %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error reading key: %v", err) + } + } + + // From the proto: + // You can update only the `display_name`, `restrictions`, and `annotations` fields. + + // See docs for UpdateMask + updateMask := req.GetUpdateMask() + + // If an update mask is not provided, the service treats it as an implied mask + // equivalent to all allowed fields that are set on the wire + if updateMask == nil { + updateMask = &fieldmaskpb.FieldMask{} + if req.GetKey().GetDisplayName() != "" { + updateMask.Paths = append(updateMask.Paths, "display_name") + } + if req.GetKey().GetRestrictions() != nil { + updateMask.Paths = append(updateMask.Paths, "restrictions") + } + if req.GetKey().GetAnnotations() != nil { + updateMask.Paths = append(updateMask.Paths, "annotations") + } + } + + isSpecified := func(s string) bool { + for _, p := range updateMask.Paths { + if p == s { + return true + } + if p == "*" { + return true + } + } + return false + } + + if isSpecified("display_name") || isSpecified("displayName") { + obj.DisplayName = req.GetKey().GetDisplayName() + } + if isSpecified("restrictions") { + obj.Restrictions = req.GetKey().GetRestrictions() + } + if isSpecified("annotations") { + obj.Annotations = req.GetKey().GetAnnotations() + } + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating key: %v", err) + } + + return s.operations.NewLRO(ctx) +} + +func (s *APIKeysV2) DeleteKey(ctx context.Context, req *pb.DeleteKeyRequest) (*longrunning.Operation, error) { + name, err := s.parseAPIKeyName(req.Name) + if err != nil { + return nil, err + } + + fqn := name.String() + + deleted := &pb.Key{} + if err := s.storage.Delete(ctx, fqn, deleted); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "key %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error deleting key: %v", err) + } + } + + return s.operations.NewLRO(ctx) +} diff --git a/mockgcp/mockapikeys/names.go b/mockgcp/mockapikeys/names.go new file mode 100644 index 0000000000..e6852064c0 --- /dev/null +++ b/mockgcp/mockapikeys/names.go @@ -0,0 +1,56 @@ +// Copyright 2023 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 mockapikeys + +import ( + "strings" + + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type apiKeyName struct { + Project *projects.ProjectData + Location string + KeyName string +} + +func (n *apiKeyName) String() string { + return "projects/" + n.Project.ID + "/locations/" + n.Location + "/keys/" + n.KeyName +} + +// parseAPIKeyName parses a string into a apiKeyName. +// The expected form is projects//locations/global/keys/ +func (s *MockService) parseAPIKeyName(name string) (*apiKeyName, error) { + tokens := strings.Split(name, "/") + + if len(tokens) == 6 && tokens[0] == "projects" && tokens[2] == "locations" && tokens[4] == "keys" { + project, err := s.projects.GetProjectByID(tokens[1]) + if err != nil { + return nil, err + } + + name := &apiKeyName{ + Project: project, + Location: tokens[3], + KeyName: tokens[5], + } + + return name, nil + } else { + return nil, status.Errorf(codes.InvalidArgument, "name %q is not valid", name) + } +} diff --git a/mockgcp/mockapikeys/service.go b/mockgcp/mockapikeys/service.go new file mode 100644 index 0000000000..a50a5d0ecf --- /dev/null +++ b/mockgcp/mockapikeys/service.go @@ -0,0 +1,70 @@ +// Copyright 2023 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 mockapikeys + +import ( + "context" + + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common" + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/operations" + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/pkg/storage" + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "google.golang.org/grpc" + "sigs.k8s.io/controller-runtime/pkg/client" + + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/api/apikeys/v2" +) + +// MockService represents a mocked apikeys service. +type MockService struct { + kube client.Client + storage storage.Storage + + projects projects.ProjectStore + operations *operations.Operations + + v2 *APIKeysV2 +} + +// New creates a MockService. +func New(env *common.MockEnvironment, storage storage.Storage) *MockService { + s := &MockService{ + kube: env.GetKubeClient(), + storage: storage, + projects: env.GetProjects(), + operations: operations.NewOperationsService(storage), + } + s.v2 = &APIKeysV2{MockService: s} + return s +} + +func (s *MockService) ExpectedHost() string { + return "apikeys.googleapis.com" +} + +func (s *MockService) Register(grpcServer *grpc.Server) { + pb.RegisterApiKeysServer(grpcServer, s.v2) +} + +func (s *MockService) NewHTTPMux(ctx context.Context, conn *grpc.ClientConn) (*runtime.ServeMux, error) { + mux := runtime.NewServeMux() + + if err := pb.RegisterApiKeysHandler(ctx, mux, conn); err != nil { + return nil, err + } + + return mux, nil +} diff --git a/pkg/clients/generated/apis/apikeys/group.go b/pkg/clients/generated/apis/apikeys/group.go new file mode 100644 index 0000000000..b7bb317eca --- /dev/null +++ b/pkg/clients/generated/apis/apikeys/group.go @@ -0,0 +1,32 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Package apikeys contains apikeys API versions. +package apikeys diff --git a/pkg/clients/generated/apis/apikeys/v1alpha1/apikeyskey_types.go b/pkg/clients/generated/apis/apikeys/v1alpha1/apikeyskey_types.go new file mode 100644 index 0000000000..49469c3c0d --- /dev/null +++ b/pkg/clients/generated/apis/apikeys/v1alpha1/apikeyskey_types.go @@ -0,0 +1,155 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +package v1alpha1 + +import ( + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/k8s/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type KeyAllowedApplications struct { + /* The package name of the application. */ + PackageName string `json:"packageName"` + + /* The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter. */ + Sha1Fingerprint string `json:"sha1Fingerprint"` +} + +type KeyAndroidKeyRestrictions struct { + /* A list of Android applications that are allowed to make API calls with this key. */ + AllowedApplications []KeyAllowedApplications `json:"allowedApplications"` +} + +type KeyApiTargets struct { + /* Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples: `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` `TranslateText` `Get*` `translate.googleapis.com.Get*`. */ + // +optional + Methods []string `json:"methods,omitempty"` + + /* The service for this restriction. It should be the canonical service name, for example: `translate.googleapis.com`. You can use `gcloud services list` to get a list of services that are enabled in the project. */ + Service string `json:"service"` +} + +type KeyBrowserKeyRestrictions struct { + /* A list of regular expressions for the referrer URLs that are allowed to make API calls with this key. */ + AllowedReferrers []string `json:"allowedReferrers"` +} + +type KeyIosKeyRestrictions struct { + /* A list of bundle IDs that are allowed when making API calls with this key. */ + AllowedBundleIds []string `json:"allowedBundleIds"` +} + +type KeyRestrictions struct { + /* The Android apps that are allowed to use the key. */ + // +optional + AndroidKeyRestrictions *KeyAndroidKeyRestrictions `json:"androidKeyRestrictions,omitempty"` + + /* A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed. */ + // +optional + ApiTargets []KeyApiTargets `json:"apiTargets,omitempty"` + + /* The HTTP referrers (websites) that are allowed to use the key. */ + // +optional + BrowserKeyRestrictions *KeyBrowserKeyRestrictions `json:"browserKeyRestrictions,omitempty"` + + /* The iOS apps that are allowed to use the key. */ + // +optional + IosKeyRestrictions *KeyIosKeyRestrictions `json:"iosKeyRestrictions,omitempty"` + + /* The IP addresses of callers that are allowed to use the key. */ + // +optional + ServerKeyRestrictions *KeyServerKeyRestrictions `json:"serverKeyRestrictions,omitempty"` +} + +type KeyServerKeyRestrictions struct { + /* A list of the caller IP addresses that are allowed to make API calls with this key. */ + AllowedIps []string `json:"allowedIps"` +} + +type APIKeysKeySpec struct { + /* Human-readable display name of this API key. Modifiable by user. */ + // +optional + DisplayName *string `json:"displayName,omitempty"` + + /* The project that this resource belongs to. */ + ProjectRef v1alpha1.ResourceRef `json:"projectRef"` + + /* Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default. */ + // +optional + ResourceID *string `json:"resourceID,omitempty"` + + /* Key restrictions. */ + // +optional + Restrictions *KeyRestrictions `json:"restrictions,omitempty"` +} + +type APIKeysKeyStatus struct { + /* Conditions represent the latest available observations of the + APIKeysKey's current state. */ + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` + /* Output only. An encrypted and signed value held by this key. This field can be accessed only through the `GetKeyString` method. */ + // +optional + KeyString *string `json:"keyString,omitempty"` + + /* ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. */ + // +optional + ObservedGeneration *int `json:"observedGeneration,omitempty"` + + /* Output only. Unique id in UUID4 format. */ + // +optional + Uid *string `json:"uid,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// APIKeysKey is the Schema for the apikeys API +// +k8s:openapi-gen=true +type APIKeysKey struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec APIKeysKeySpec `json:"spec,omitempty"` + Status APIKeysKeyStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// APIKeysKeyList contains a list of APIKeysKey +type APIKeysKeyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []APIKeysKey `json:"items"` +} + +func init() { + SchemeBuilder.Register(&APIKeysKey{}, &APIKeysKeyList{}) +} diff --git a/pkg/clients/generated/apis/apikeys/v1alpha1/doc.go b/pkg/clients/generated/apis/apikeys/v1alpha1/doc.go new file mode 100644 index 0000000000..ff50cae1dc --- /dev/null +++ b/pkg/clients/generated/apis/apikeys/v1alpha1/doc.go @@ -0,0 +1,41 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Package v1alpha1 contains API Schema definitions for the apikeys v1alpha1 API group. +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/pkg/apis/apikeys +// +k8s:defaulter-gen=TypeMeta +// +groupName=apikeys.cnrm.cloud.google.com + +// Generate deepcopy object for apikeys/v1alpha1 API group +// +//go:generate go run ../../../../../../scripts/deepcopy-gen/main.go -O zz_generated.deepcopy -i . -h ../../../../../../hack/boilerplate_client_alpha.go.txt +package v1alpha1 diff --git a/pkg/clients/generated/apis/apikeys/v1alpha1/register.go b/pkg/clients/generated/apis/apikeys/v1alpha1/register.go new file mode 100644 index 0000000000..b627ca65be --- /dev/null +++ b/pkg/clients/generated/apis/apikeys/v1alpha1/register.go @@ -0,0 +1,63 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Package v1alpha1 contains API Schema definitions for the apikeys v1alpha1 API group. +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/pkg/apis/apikeys +// +k8s:defaulter-gen=TypeMeta +// +groupName=apikeys.cnrm.cloud.google.com +package v1alpha1 + +import ( + "reflect" + + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // SchemeGroupVersion is the group version used to register these objects. + SchemeGroupVersion = schema.GroupVersion{Group: "apikeys.cnrm.cloud.google.com", Version: "v1beta1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = SchemeBuilder.AddToScheme + + APIKeysKeyGVK = schema.GroupVersionKind{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: reflect.TypeOf(APIKeysKey{}).Name(), + } + + apikeysAPIVersion = SchemeGroupVersion.String() +) diff --git a/pkg/clients/generated/apis/apikeys/v1alpha1/zz_generated.deepcopy.go b/pkg/clients/generated/apis/apikeys/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..67fab322a5 --- /dev/null +++ b/pkg/clients/generated/apis/apikeys/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,323 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +package v1alpha1 + +import ( + k8sv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/k8s/v1alpha1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIKeysKey) DeepCopyInto(out *APIKeysKey) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIKeysKey. +func (in *APIKeysKey) DeepCopy() *APIKeysKey { + if in == nil { + return nil + } + out := new(APIKeysKey) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIKeysKey) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIKeysKeyList) DeepCopyInto(out *APIKeysKeyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]APIKeysKey, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIKeysKeyList. +func (in *APIKeysKeyList) DeepCopy() *APIKeysKeyList { + if in == nil { + return nil + } + out := new(APIKeysKeyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIKeysKeyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIKeysKeySpec) DeepCopyInto(out *APIKeysKeySpec) { + *out = *in + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + out.ProjectRef = in.ProjectRef + if in.ResourceID != nil { + in, out := &in.ResourceID, &out.ResourceID + *out = new(string) + **out = **in + } + if in.Restrictions != nil { + in, out := &in.Restrictions, &out.Restrictions + *out = new(KeyRestrictions) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIKeysKeySpec. +func (in *APIKeysKeySpec) DeepCopy() *APIKeysKeySpec { + if in == nil { + return nil + } + out := new(APIKeysKeySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIKeysKeyStatus) DeepCopyInto(out *APIKeysKeyStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]k8sv1alpha1.Condition, len(*in)) + copy(*out, *in) + } + if in.KeyString != nil { + in, out := &in.KeyString, &out.KeyString + *out = new(string) + **out = **in + } + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int) + **out = **in + } + if in.Uid != nil { + in, out := &in.Uid, &out.Uid + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIKeysKeyStatus. +func (in *APIKeysKeyStatus) DeepCopy() *APIKeysKeyStatus { + if in == nil { + return nil + } + out := new(APIKeysKeyStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyAllowedApplications) DeepCopyInto(out *KeyAllowedApplications) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyAllowedApplications. +func (in *KeyAllowedApplications) DeepCopy() *KeyAllowedApplications { + if in == nil { + return nil + } + out := new(KeyAllowedApplications) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyAndroidKeyRestrictions) DeepCopyInto(out *KeyAndroidKeyRestrictions) { + *out = *in + if in.AllowedApplications != nil { + in, out := &in.AllowedApplications, &out.AllowedApplications + *out = make([]KeyAllowedApplications, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyAndroidKeyRestrictions. +func (in *KeyAndroidKeyRestrictions) DeepCopy() *KeyAndroidKeyRestrictions { + if in == nil { + return nil + } + out := new(KeyAndroidKeyRestrictions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyApiTargets) DeepCopyInto(out *KeyApiTargets) { + *out = *in + if in.Methods != nil { + in, out := &in.Methods, &out.Methods + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyApiTargets. +func (in *KeyApiTargets) DeepCopy() *KeyApiTargets { + if in == nil { + return nil + } + out := new(KeyApiTargets) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyBrowserKeyRestrictions) DeepCopyInto(out *KeyBrowserKeyRestrictions) { + *out = *in + if in.AllowedReferrers != nil { + in, out := &in.AllowedReferrers, &out.AllowedReferrers + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyBrowserKeyRestrictions. +func (in *KeyBrowserKeyRestrictions) DeepCopy() *KeyBrowserKeyRestrictions { + if in == nil { + return nil + } + out := new(KeyBrowserKeyRestrictions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyIosKeyRestrictions) DeepCopyInto(out *KeyIosKeyRestrictions) { + *out = *in + if in.AllowedBundleIds != nil { + in, out := &in.AllowedBundleIds, &out.AllowedBundleIds + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyIosKeyRestrictions. +func (in *KeyIosKeyRestrictions) DeepCopy() *KeyIosKeyRestrictions { + if in == nil { + return nil + } + out := new(KeyIosKeyRestrictions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyRestrictions) DeepCopyInto(out *KeyRestrictions) { + *out = *in + if in.AndroidKeyRestrictions != nil { + in, out := &in.AndroidKeyRestrictions, &out.AndroidKeyRestrictions + *out = new(KeyAndroidKeyRestrictions) + (*in).DeepCopyInto(*out) + } + if in.ApiTargets != nil { + in, out := &in.ApiTargets, &out.ApiTargets + *out = make([]KeyApiTargets, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.BrowserKeyRestrictions != nil { + in, out := &in.BrowserKeyRestrictions, &out.BrowserKeyRestrictions + *out = new(KeyBrowserKeyRestrictions) + (*in).DeepCopyInto(*out) + } + if in.IosKeyRestrictions != nil { + in, out := &in.IosKeyRestrictions, &out.IosKeyRestrictions + *out = new(KeyIosKeyRestrictions) + (*in).DeepCopyInto(*out) + } + if in.ServerKeyRestrictions != nil { + in, out := &in.ServerKeyRestrictions, &out.ServerKeyRestrictions + *out = new(KeyServerKeyRestrictions) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyRestrictions. +func (in *KeyRestrictions) DeepCopy() *KeyRestrictions { + if in == nil { + return nil + } + out := new(KeyRestrictions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KeyServerKeyRestrictions) DeepCopyInto(out *KeyServerKeyRestrictions) { + *out = *in + if in.AllowedIps != nil { + in, out := &in.AllowedIps, &out.AllowedIps + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KeyServerKeyRestrictions. +func (in *KeyServerKeyRestrictions) DeepCopy() *KeyServerKeyRestrictions { + if in == nil { + return nil + } + out := new(KeyServerKeyRestrictions) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/clients/generated/client/clientset/versioned/clientset.go b/pkg/clients/generated/client/clientset/versioned/clientset.go index 55152c5489..16a190cc85 100644 --- a/pkg/clients/generated/client/clientset/versioned/clientset.go +++ b/pkg/clients/generated/client/clientset/versioned/clientset.go @@ -31,6 +31,7 @@ import ( apigatewayv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apigateway/v1alpha1" apigeev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apigee/v1alpha1" apigeev1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apigee/v1beta1" + apikeysv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1" appenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/appengine/v1alpha1" artifactregistryv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/artifactregistry/v1beta1" beyondcorpv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/beyondcorp/v1alpha1" @@ -152,6 +153,7 @@ type Interface interface { ApigatewayV1alpha1() apigatewayv1alpha1.ApigatewayV1alpha1Interface ApigeeV1alpha1() apigeev1alpha1.ApigeeV1alpha1Interface ApigeeV1beta1() apigeev1beta1.ApigeeV1beta1Interface + ApikeysV1alpha1() apikeysv1alpha1.ApikeysV1alpha1Interface AppengineV1alpha1() appenginev1alpha1.AppengineV1alpha1Interface ArtifactregistryV1beta1() artifactregistryv1beta1.ArtifactregistryV1beta1Interface BeyondcorpV1alpha1() beyondcorpv1alpha1.BeyondcorpV1alpha1Interface @@ -271,6 +273,7 @@ type Clientset struct { apigatewayV1alpha1 *apigatewayv1alpha1.ApigatewayV1alpha1Client apigeeV1alpha1 *apigeev1alpha1.ApigeeV1alpha1Client apigeeV1beta1 *apigeev1beta1.ApigeeV1beta1Client + apikeysV1alpha1 *apikeysv1alpha1.ApikeysV1alpha1Client appengineV1alpha1 *appenginev1alpha1.AppengineV1alpha1Client artifactregistryV1beta1 *artifactregistryv1beta1.ArtifactregistryV1beta1Client beyondcorpV1alpha1 *beyondcorpv1alpha1.BeyondcorpV1alpha1Client @@ -411,6 +414,11 @@ func (c *Clientset) ApigeeV1beta1() apigeev1beta1.ApigeeV1beta1Interface { return c.apigeeV1beta1 } +// ApikeysV1alpha1 retrieves the ApikeysV1alpha1Client +func (c *Clientset) ApikeysV1alpha1() apikeysv1alpha1.ApikeysV1alpha1Interface { + return c.apikeysV1alpha1 +} + // AppengineV1alpha1 retrieves the AppengineV1alpha1Client func (c *Clientset) AppengineV1alpha1() appenginev1alpha1.AppengineV1alpha1Interface { return c.appengineV1alpha1 @@ -1019,6 +1027,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.apikeysV1alpha1, err = apikeysv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.appengineV1alpha1, err = appenginev1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -1478,6 +1490,7 @@ func New(c rest.Interface) *Clientset { cs.apigatewayV1alpha1 = apigatewayv1alpha1.New(c) cs.apigeeV1alpha1 = apigeev1alpha1.New(c) cs.apigeeV1beta1 = apigeev1beta1.New(c) + cs.apikeysV1alpha1 = apikeysv1alpha1.New(c) cs.appengineV1alpha1 = appenginev1alpha1.New(c) cs.artifactregistryV1beta1 = artifactregistryv1beta1.New(c) cs.beyondcorpV1alpha1 = beyondcorpv1alpha1.New(c) diff --git a/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go b/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go index a44da83490..d43505b798 100644 --- a/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go @@ -35,6 +35,8 @@ import ( fakeapigeev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apigee/v1alpha1/fake" apigeev1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apigee/v1beta1" fakeapigeev1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apigee/v1beta1/fake" + apikeysv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1" + fakeapikeysv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake" appenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/appengine/v1alpha1" fakeappenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/appengine/v1alpha1/fake" artifactregistryv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/artifactregistry/v1beta1" @@ -338,6 +340,11 @@ func (c *Clientset) ApigeeV1beta1() apigeev1beta1.ApigeeV1beta1Interface { return &fakeapigeev1beta1.FakeApigeeV1beta1{Fake: &c.Fake} } +// ApikeysV1alpha1 retrieves the ApikeysV1alpha1Client +func (c *Clientset) ApikeysV1alpha1() apikeysv1alpha1.ApikeysV1alpha1Interface { + return &fakeapikeysv1alpha1.FakeApikeysV1alpha1{Fake: &c.Fake} +} + // AppengineV1alpha1 retrieves the AppengineV1alpha1Client func (c *Clientset) AppengineV1alpha1() appenginev1alpha1.AppengineV1alpha1Interface { return &fakeappenginev1alpha1.FakeAppengineV1alpha1{Fake: &c.Fake} diff --git a/pkg/clients/generated/client/clientset/versioned/fake/register.go b/pkg/clients/generated/client/clientset/versioned/fake/register.go index 79768713ac..642cd4f2d5 100644 --- a/pkg/clients/generated/client/clientset/versioned/fake/register.go +++ b/pkg/clients/generated/client/clientset/versioned/fake/register.go @@ -28,6 +28,7 @@ import ( apigatewayv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apigateway/v1alpha1" apigeev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apigee/v1alpha1" apigeev1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apigee/v1beta1" + apikeysv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apikeys/v1alpha1" appenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/appengine/v1alpha1" artifactregistryv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/artifactregistry/v1beta1" beyondcorpv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/beyondcorp/v1alpha1" @@ -153,6 +154,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ apigatewayv1alpha1.AddToScheme, apigeev1alpha1.AddToScheme, apigeev1beta1.AddToScheme, + apikeysv1alpha1.AddToScheme, appenginev1alpha1.AddToScheme, artifactregistryv1beta1.AddToScheme, beyondcorpv1alpha1.AddToScheme, diff --git a/pkg/clients/generated/client/clientset/versioned/scheme/register.go b/pkg/clients/generated/client/clientset/versioned/scheme/register.go index 17cd7430f8..5269f566ab 100644 --- a/pkg/clients/generated/client/clientset/versioned/scheme/register.go +++ b/pkg/clients/generated/client/clientset/versioned/scheme/register.go @@ -28,6 +28,7 @@ import ( apigatewayv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apigateway/v1alpha1" apigeev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apigee/v1alpha1" apigeev1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apigee/v1beta1" + apikeysv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apikeys/v1alpha1" appenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/appengine/v1alpha1" artifactregistryv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/artifactregistry/v1beta1" beyondcorpv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/beyondcorp/v1alpha1" @@ -153,6 +154,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ apigatewayv1alpha1.AddToScheme, apigeev1alpha1.AddToScheme, apigeev1beta1.AddToScheme, + apikeysv1alpha1.AddToScheme, appenginev1alpha1.AddToScheme, artifactregistryv1beta1.AddToScheme, beyondcorpv1alpha1.AddToScheme, diff --git a/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/apikeys_client.go b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/apikeys_client.go new file mode 100644 index 0000000000..a74667b79e --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/apikeys_client.go @@ -0,0 +1,110 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +package v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apikeys/v1alpha1" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type ApikeysV1alpha1Interface interface { + RESTClient() rest.Interface + APIKeysKeysGetter +} + +// ApikeysV1alpha1Client is used to interact with features provided by the apikeys.cnrm.cloud.google.com group. +type ApikeysV1alpha1Client struct { + restClient rest.Interface +} + +func (c *ApikeysV1alpha1Client) APIKeysKeys(namespace string) APIKeysKeyInterface { + return newAPIKeysKeys(c, namespace) +} + +// NewForConfig creates a new ApikeysV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*ApikeysV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new ApikeysV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ApikeysV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &ApikeysV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ApikeysV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ApikeysV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ApikeysV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ApikeysV1alpha1Client { + return &ApikeysV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ApikeysV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/apikeyskey.go b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/apikeyskey.go new file mode 100644 index 0000000000..ce5c85795e --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/apikeyskey.go @@ -0,0 +1,198 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apikeys/v1alpha1" + scheme "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// APIKeysKeysGetter has a method to return a APIKeysKeyInterface. +// A group's client should implement this interface. +type APIKeysKeysGetter interface { + APIKeysKeys(namespace string) APIKeysKeyInterface +} + +// APIKeysKeyInterface has methods to work with APIKeysKey resources. +type APIKeysKeyInterface interface { + Create(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.CreateOptions) (*v1alpha1.APIKeysKey, error) + Update(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.UpdateOptions) (*v1alpha1.APIKeysKey, error) + UpdateStatus(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.UpdateOptions) (*v1alpha1.APIKeysKey, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.APIKeysKey, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.APIKeysKeyList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.APIKeysKey, err error) + APIKeysKeyExpansion +} + +// aPIKeysKeys implements APIKeysKeyInterface +type aPIKeysKeys struct { + client rest.Interface + ns string +} + +// newAPIKeysKeys returns a APIKeysKeys +func newAPIKeysKeys(c *ApikeysV1alpha1Client, namespace string) *aPIKeysKeys { + return &aPIKeysKeys{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the aPIKeysKey, and returns the corresponding aPIKeysKey object, and an error if there is any. +func (c *aPIKeysKeys) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.APIKeysKey, err error) { + result = &v1alpha1.APIKeysKey{} + err = c.client.Get(). + Namespace(c.ns). + Resource("apikeyskeys"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of APIKeysKeys that match those selectors. +func (c *aPIKeysKeys) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.APIKeysKeyList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.APIKeysKeyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("apikeyskeys"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested aPIKeysKeys. +func (c *aPIKeysKeys) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("apikeyskeys"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a aPIKeysKey and creates it. Returns the server's representation of the aPIKeysKey, and an error, if there is any. +func (c *aPIKeysKeys) Create(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.CreateOptions) (result *v1alpha1.APIKeysKey, err error) { + result = &v1alpha1.APIKeysKey{} + err = c.client.Post(). + Namespace(c.ns). + Resource("apikeyskeys"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(aPIKeysKey). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a aPIKeysKey and updates it. Returns the server's representation of the aPIKeysKey, and an error, if there is any. +func (c *aPIKeysKeys) Update(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.UpdateOptions) (result *v1alpha1.APIKeysKey, err error) { + result = &v1alpha1.APIKeysKey{} + err = c.client.Put(). + Namespace(c.ns). + Resource("apikeyskeys"). + Name(aPIKeysKey.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(aPIKeysKey). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *aPIKeysKeys) UpdateStatus(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.UpdateOptions) (result *v1alpha1.APIKeysKey, err error) { + result = &v1alpha1.APIKeysKey{} + err = c.client.Put(). + Namespace(c.ns). + Resource("apikeyskeys"). + Name(aPIKeysKey.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(aPIKeysKey). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the aPIKeysKey and deletes it. Returns an error if one occurs. +func (c *aPIKeysKeys) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("apikeyskeys"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *aPIKeysKeys) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("apikeyskeys"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched aPIKeysKey. +func (c *aPIKeysKeys) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.APIKeysKey, err error) { + result = &v1alpha1.APIKeysKey{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("apikeyskeys"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/doc.go b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/doc.go new file mode 100644 index 0000000000..61f2499ab1 --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/doc.go @@ -0,0 +1,23 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/doc.go b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/doc.go new file mode 100644 index 0000000000..7a39491606 --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/doc.go @@ -0,0 +1,23 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/fake_apikeys_client.go b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/fake_apikeys_client.go new file mode 100644 index 0000000000..e17ce6ee2f --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/fake_apikeys_client.go @@ -0,0 +1,43 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeApikeysV1alpha1 struct { + *testing.Fake +} + +func (c *FakeApikeysV1alpha1) APIKeysKeys(namespace string) v1alpha1.APIKeysKeyInterface { + return &FakeAPIKeysKeys{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeApikeysV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/fake_apikeyskey.go b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/fake_apikeyskey.go new file mode 100644 index 0000000000..7fa3066dec --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/fake/fake_apikeyskey.go @@ -0,0 +1,144 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/apikeys/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeAPIKeysKeys implements APIKeysKeyInterface +type FakeAPIKeysKeys struct { + Fake *FakeApikeysV1alpha1 + ns string +} + +var apikeyskeysResource = v1alpha1.SchemeGroupVersion.WithResource("apikeyskeys") + +var apikeyskeysKind = v1alpha1.SchemeGroupVersion.WithKind("APIKeysKey") + +// Get takes name of the aPIKeysKey, and returns the corresponding aPIKeysKey object, and an error if there is any. +func (c *FakeAPIKeysKeys) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.APIKeysKey, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(apikeyskeysResource, c.ns, name), &v1alpha1.APIKeysKey{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.APIKeysKey), err +} + +// List takes label and field selectors, and returns the list of APIKeysKeys that match those selectors. +func (c *FakeAPIKeysKeys) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.APIKeysKeyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(apikeyskeysResource, apikeyskeysKind, c.ns, opts), &v1alpha1.APIKeysKeyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.APIKeysKeyList{ListMeta: obj.(*v1alpha1.APIKeysKeyList).ListMeta} + for _, item := range obj.(*v1alpha1.APIKeysKeyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested aPIKeysKeys. +func (c *FakeAPIKeysKeys) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(apikeyskeysResource, c.ns, opts)) + +} + +// Create takes the representation of a aPIKeysKey and creates it. Returns the server's representation of the aPIKeysKey, and an error, if there is any. +func (c *FakeAPIKeysKeys) Create(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.CreateOptions) (result *v1alpha1.APIKeysKey, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(apikeyskeysResource, c.ns, aPIKeysKey), &v1alpha1.APIKeysKey{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.APIKeysKey), err +} + +// Update takes the representation of a aPIKeysKey and updates it. Returns the server's representation of the aPIKeysKey, and an error, if there is any. +func (c *FakeAPIKeysKeys) Update(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.UpdateOptions) (result *v1alpha1.APIKeysKey, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(apikeyskeysResource, c.ns, aPIKeysKey), &v1alpha1.APIKeysKey{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.APIKeysKey), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeAPIKeysKeys) UpdateStatus(ctx context.Context, aPIKeysKey *v1alpha1.APIKeysKey, opts v1.UpdateOptions) (*v1alpha1.APIKeysKey, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(apikeyskeysResource, "status", c.ns, aPIKeysKey), &v1alpha1.APIKeysKey{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.APIKeysKey), err +} + +// Delete takes name of the aPIKeysKey and deletes it. Returns an error if one occurs. +func (c *FakeAPIKeysKeys) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(apikeyskeysResource, c.ns, name, opts), &v1alpha1.APIKeysKey{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeAPIKeysKeys) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(apikeyskeysResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.APIKeysKeyList{}) + return err +} + +// Patch applies the patch and returns the patched aPIKeysKey. +func (c *FakeAPIKeysKeys) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.APIKeysKey, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(apikeyskeysResource, c.ns, name, pt, data, subresources...), &v1alpha1.APIKeysKey{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.APIKeysKey), err +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/generated_expansion.go b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/generated_expansion.go new file mode 100644 index 0000000000..544b2ebe44 --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/apikeys/v1alpha1/generated_expansion.go @@ -0,0 +1,24 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by main. DO NOT EDIT. + +package v1alpha1 + +type APIKeysKeyExpansion interface{} diff --git a/pkg/resourceskeleton/testdata/asset-skeleton.yaml b/pkg/resourceskeleton/testdata/asset-skeleton.yaml index e363bdb157..d35ef0cba8 100644 --- a/pkg/resourceskeleton/testdata/asset-skeleton.yaml +++ b/pkg/resourceskeleton/testdata/asset-skeleton.yaml @@ -26,8 +26,28 @@ - resourceConfigId: AlloyDBInstance # not supported by asset inventory - resourceConfigId: AlloyDBUser -# not supported by asset inventory -- resourceConfigId: ArtifactRegistryRepository + +# Service: apikeys.googleapis.com +- resourceConfigId: APIKeysKey + asset: + ancestors: + - projects/1234567890 + - organizations/1234567890 + name: //apikeys.googleapis.com/projects/1234567890/locations/global/keys/examplekey + asset_type: apikeys.googleapis.com/Key + expectedSkeleton: + apiVersion: apikeys.cnrm.cloud.google.com/v1alpha1 + kind: APIKeysKey + metadata: + name: examplekey + spec: + projectRef: + external: "1234567890" + +# Service: artifactregistry.googleapis.com +- resourceConfigId: ArtifactRegistryRepository # not supported by asset inventory + +# Service: bigquery.googleapis.com - asset: ancestors: - projects/1234567890 diff --git a/pkg/resourceskeleton/testdata/uri-skeleton.yaml b/pkg/resourceskeleton/testdata/uri-skeleton.yaml index a7063f72d6..4946e542f1 100644 --- a/pkg/resourceskeleton/testdata/uri-skeleton.yaml +++ b/pkg/resourceskeleton/testdata/uri-skeleton.yaml @@ -105,6 +105,16 @@ - ExpectedSkeleton: null ResourceConfigId: AlloyDBUser URI: "" +- ExpectedSkeleton: + apiVersion: apikeys.cnrm.cloud.google.com/v1alpha1 + kind: APIKeysKey + metadata: + name: keyname + spec: + projectRef: + external: kcc-test-project + ResourceConfigId: APIKeysKey + URI: "https://apikeys.googleapis.com/v2/projects/kcc-test-project/locations/global/keys/keyname" - ExpectedSkeleton: apiVersion: artifactregistry.cnrm.cloud.google.com/v1beta1 kind: ArtifactRegistryRepository diff --git a/pkg/test/constants/presubmitconstants.go b/pkg/test/constants/presubmitconstants.go index 78587b9f20..98f9084676 100644 --- a/pkg/test/constants/presubmitconstants.go +++ b/pkg/test/constants/presubmitconstants.go @@ -32,6 +32,7 @@ var ( "accesscontextmanager": {"accesscontextmanagerserviceperimeter"}, "alloydb": {"fullalloydbcluster"}, "apigee": {"apigeeenvironment"}, + "apikeys": {"apikeyskeybasic"}, "artifactregistry": {"artifactregistryrepository"}, "bigquery": {"bigqueryjob"}, "bigtable": {"bigtablegcpolicy"}, diff --git a/pkg/test/resourcefixture/resourcefixture_test.go b/pkg/test/resourcefixture/resourcefixture_test.go index d86e6a9346..4d3edfa1c1 100644 --- a/pkg/test/resourcefixture/resourcefixture_test.go +++ b/pkg/test/resourcefixture/resourcefixture_test.go @@ -77,7 +77,7 @@ func getResourceConfigIdSet(t *testing.T, smLoader *servicemappingloader.Service for _, rc := range sm.Spec.Resources { // No need to cover auto-generated v1alpha1 CRDs when calculating // set cover. - if sm.GetVersionFor(&rc) == k8s.KCCAPIVersionV1Alpha1 && rc.AutoGenerated { + if sm.GetVersionFor(&rc) == k8s.KCCAPIVersionV1Alpha1 { continue } id := resourcefixture.GetUniqueResourceConfigId(rc) diff --git a/pkg/test/resourcefixture/testdata/basic/apikeys/v1alpha1/apikeyskey/apikeyskeybasic/create.yaml b/pkg/test/resourcefixture/testdata/basic/apikeys/v1alpha1/apikeyskey/apikeyskeybasic/create.yaml new file mode 100644 index 0000000000..d7b6f2c57c --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/apikeys/v1alpha1/apikeyskey/apikeyskeybasic/create.yaml @@ -0,0 +1,27 @@ +# Copyright 2023 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: apikeys.cnrm.cloud.google.com/v1alpha1 +kind: APIKeysKey +metadata: + name: apikeyskey-${uniqueId} +spec: + projectRef: + external: ${projectId} + resourceID: apikeyskey${uniqueId} + displayName: "Example Display Name" + restrictions: + apiTargets: + - service: "translate.googleapis.com" + methods: [ "GET" ] \ No newline at end of file diff --git a/pkg/test/resourcefixture/testdata/basic/apikeys/v1alpha1/apikeyskey/apikeyskeybasic/update.yaml b/pkg/test/resourcefixture/testdata/basic/apikeys/v1alpha1/apikeyskey/apikeyskeybasic/update.yaml new file mode 100644 index 0000000000..9f3ec44720 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/apikeys/v1alpha1/apikeyskey/apikeyskeybasic/update.yaml @@ -0,0 +1,27 @@ +# Copyright 2023 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: apikeys.cnrm.cloud.google.com/v1alpha1 +kind: APIKeysKey +metadata: + name: apikeyskey-${uniqueId} +spec: + projectRef: + external: ${projectId} + resourceID: apikeyskey${uniqueId} + displayName: "Example Display Name - Updated" + restrictions: + apiTargets: + - service: "translate.googleapis.com" + methods: [ "GET", "DELETE" ] \ No newline at end of file diff --git a/scripts/generate-google3-docs/resource-reference/main.go b/scripts/generate-google3-docs/resource-reference/main.go index e8c163b87d..844ac76f64 100644 --- a/scripts/generate-google3-docs/resource-reference/main.go +++ b/scripts/generate-google3-docs/resource-reference/main.go @@ -49,6 +49,7 @@ import ( apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/klog/v2" ) // convenience struct for converting to the desired human readable output on the docs page from the fielddesc.FieldDescription struct @@ -156,6 +157,10 @@ func main() { } serviceMetadataLoader = dclmetadata.New() for _, gvk := range supportedgvks.ManualResources(smLoader, serviceMetadataLoader) { + if strings.HasPrefix(gvk.Version, "v1alpha") { + klog.Infof("skipping alpha resource %v", gvk) + continue + } if err := generateDocForGVK(gvk, smLoader); err != nil { log.Fatalf("error generating doc for GVK %v: %v", gvk, err) }