Skip to content

Instantly share code, notes, and snippets.

@beccasaurus
Created October 4, 2018 23:41
Show Gist options
  • Save beccasaurus/02bb1b9113f941e0c459b836a61b9654 to your computer and use it in GitHub Desktop.
Save beccasaurus/02bb1b9113f941e0c459b836a61b9654 to your computer and use it in GitHub Desktop.
Cloud KMS gapic.yaml including a sample for CreateKeyRing
type: com.google.api.codegen.ConfigProto
config_schema_version: 1.0.0
# The settings of generated code in a specific language.
language_settings:
java:
package_name: com.google.cloud.kms.v1
python:
package_name: google.cloud.kms_v1.gapic
go:
package_name: cloud.google.com/go/kms/apiv1
release_level: GA
csharp:
package_name: Google.Cloud.Kms.V1
ruby:
package_name: Google::Cloud::Kms::V1
php:
package_name: Google\Cloud\Kms\V1
nodejs:
package_name: kms.v1
domain_layer_location: google-cloud
# The configuration for the license header to put on generated files.
license_header:
# The file containing the copyright line(s).
copyright_file: copyright-google.txt
# The file containing the raw license header without any copyright line(s).
license_file: license-header-apache-2.0.txt
collection_oneofs:
- oneof_name: key_oneof
collection_names:
- key_ring
- crypto_key
interfaces:
# The fully qualified name of the API interface.
- name: google.cloud.kms.v1.KeyManagementService
# A list of resource collection configurations.
# Consists of a name_pattern and an entity_name.
# The name_pattern is a pattern to describe the names of the resources of this
# collection, using the platform's conventions for URI patterns. A generator
# may use this to generate methods to compose and decompose such names. The
# pattern should use named placeholders as in `shelves/{shelf}/books/{book}`;
# those will be taken as hints for the parameter names of the generated
# methods. If empty, no name methods are generated.
# The entity_name is the name to be used as a basis for generated methods and
# classes.
collections:
- name_pattern: projects/{project}/locations/{location}/keyRings/{key_ring}
entity_name: key_ring
- name_pattern: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key_path=**}
entity_name: crypto_key_path
- name_pattern: projects/{project}/locations/{location}
entity_name: location
- name_pattern: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
entity_name: crypto_key
- name_pattern: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}
entity_name: crypto_key_version
# Definition for retryable codes.
retry_codes_def:
- name: idempotent
retry_codes:
- UNAVAILABLE
- DEADLINE_EXCEEDED
- name: non_idempotent
retry_codes: []
# Definition for retry/backoff parameters.
retry_params_def:
- name: default
initial_retry_delay_millis: 100
retry_delay_multiplier: 1.3
max_retry_delay_millis: 60000
initial_rpc_timeout_millis: 20000
rpc_timeout_multiplier: 1
max_rpc_timeout_millis: 20000
total_timeout_millis: 600000
# A list of method configurations.
# Common properties:
#
# name - The simple name of the method.
#
# flattening - Specifies the configuration for parameter flattening.
# Describes the parameter groups for which a generator should produce method
# overloads which allow a client to directly pass request message fields as
# method parameters. This information may or may not be used, depending on
# the target language.
# Consists of groups, which each represent a list of parameters to be
# flattened. Each parameter listed must be a field of the request message.
#
# required_fields - Fields that are always required for a request to be
# valid.
#
# request_object_method - Turns on or off the generation of a method whose
# sole parameter is a request object. Not all languages will generate this
# method.
#
# resource_name_treatment - An enum that specifies how to treat the resource
# name formats defined in the field_name_patterns and
# response_field_name_patterns fields.
# UNSET: default value
# NONE: the collection configs will not be used by the generated code.
# VALIDATE: string fields will be validated by the client against the
# specified resource name formats.
# STATIC_TYPES: the client will use generated types for resource names.
#
# page_streaming - Specifies the configuration for paging.
# Describes information for generating a method which transforms a paging
# list RPC into a stream of resources.
# Consists of a request and a response.
# The request specifies request information of the list method. It defines
# which fields match the paging pattern in the request. The request consists
# of a page_size_field and a token_field. The page_size_field is the name of
# the optional field specifying the maximum number of elements to be
# returned in the response. The token_field is the name of the field in the
# request containing the page token.
# The response specifies response information of the list method. It defines
# which fields match the paging pattern in the response. The response
# consists of a token_field and a resources_field. The token_field is the
# name of the field in the response containing the next page token. The
# resources_field is the name of the field in the response containing the
# list of resources belonging to the page.
#
# retry_codes_name - Specifies the configuration for retryable codes. The
# name must be defined in interfaces.retry_codes_def.
#
# retry_params_name - Specifies the configuration for retry/backoff
# parameters. The name must be defined in interfaces.retry_params_def.
#
# field_name_patterns - Maps the field name of the request type to
# entity_name of interfaces.collections.
# Specifies the string pattern that the field must follow.
#
# timeout_millis - Specifies the default timeout for a non-retrying call. If
# the call is retrying, refer to retry_params_name instead.
methods:
- name: ListKeyRings
flattening:
groups:
- parameters:
- parent
required_fields:
- parent
header_request_params:
- parent
request_object_method: true
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: key_rings
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
parent: location
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: ListCryptoKeys
flattening:
groups:
- parameters:
- parent
required_fields:
- parent
header_request_params:
- parent
request_object_method: true
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: crypto_keys
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
parent: key_ring
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: ListCryptoKeyVersions
flattening:
groups:
- parameters:
- parent
required_fields:
- parent
header_request_params:
- parent
request_object_method: true
page_streaming:
request:
page_size_field: page_size
token_field: page_token
response:
token_field: next_page_token
resources_field: crypto_key_versions
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
parent: crypto_key
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: GetKeyRing
flattening:
groups:
- parameters:
- name
required_fields:
- name
header_request_params:
- name
request_object_method: false
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: key_ring
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: GetCryptoKey
flattening:
groups:
- parameters:
- name
required_fields:
- name
header_request_params:
- name
request_object_method: false
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: GetCryptoKeyVersion
flattening:
groups:
- parameters:
- name
required_fields:
- name
header_request_params:
- name
request_object_method: false
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key_version
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: CreateKeyRing
###
#
samples:
standalone:
- calling_forms: ".*"
value_sets: kms_create_key_ring
region_tag: kms_create_key_ring
sample_value_sets:
- id: kms_create_key_ring
title: title
description: "Create a KeyRing"
parameters:
#### defaults:
attributes:
- parameter: key_ring_id
sample_argument: true
on_success:
- print:
- "Name: %s"
- $resp.name
#
#
###
flattening:
groups:
- parameters:
- parent
- key_ring_id
- key_ring
required_fields:
- parent
- key_ring_id
- key_ring
header_request_params:
- parent
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: location
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: CreateCryptoKey
flattening:
groups:
- parameters:
- parent
- crypto_key_id
- crypto_key
required_fields:
- parent
- crypto_key_id
- crypto_key
header_request_params:
- parent
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: key_ring
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
sample_code_init_fields:
- crypto_key_id=my-app-key
- crypto_key.purpose=ENCRYPT_DECRYPT
- crypto_key.next_rotation_time.seconds=2147483647
- crypto_key.rotation_period.seconds=604800
- name: CreateCryptoKeyVersion
flattening:
groups:
- parameters:
- parent
- crypto_key_version
required_fields:
- parent
- crypto_key_version
header_request_params:
- parent
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
parent: crypto_key
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: UpdateCryptoKey
flattening:
groups:
- parameters:
- crypto_key
- update_mask
required_fields:
- crypto_key
- update_mask
header_request_params:
- crypto_key.name
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
crypto_key.name: crypto_key
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: UpdateCryptoKeyVersion
flattening:
groups:
- parameters:
- crypto_key_version
- update_mask
required_fields:
- crypto_key_version
- update_mask
header_request_params:
- crypto_key_version.name
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
crypto_key_version.name: crypto_key_version
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: Encrypt
flattening:
groups:
- parameters:
- name
- plaintext
required_fields:
- name
- plaintext
header_request_params:
- name
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key_path
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: Decrypt
flattening:
groups:
- parameters:
- name
- ciphertext
required_fields:
- name
- ciphertext
header_request_params:
- name
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: UpdateCryptoKeyPrimaryVersion
flattening:
groups:
- parameters:
- name
- crypto_key_version_id
required_fields:
- name
- crypto_key_version_id
header_request_params:
- name
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: DestroyCryptoKeyVersion
flattening:
groups:
- parameters:
- name
required_fields:
- name
header_request_params:
- name
request_object_method: false
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key_version
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: RestoreCryptoKeyVersion
flattening:
groups:
- parameters:
- name
required_fields:
- name
header_request_params:
- name
request_object_method: false
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key_version
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: GetPublicKey
flattening:
groups:
- parameters:
- name
required_fields:
- name
header_request_params:
- name
request_object_method: true
retry_codes_name: idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key_version
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: AsymmetricDecrypt
flattening:
groups:
- parameters:
- name
- ciphertext
required_fields:
- name
- ciphertext
header_request_params:
- name
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key_version
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: AsymmetricSign
flattening:
groups:
- parameters:
- name
- digest
required_fields:
- name
- digest
header_request_params:
- name
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
field_name_patterns:
name: crypto_key_version
resource_name_treatment: STATIC_TYPES
timeout_millis: 60000
- name: SetIamPolicy
flattening:
groups:
- parameters:
- resource
- policy
required_fields:
- resource
- policy
header_request_params:
- resource
field_name_patterns:
resource: key_oneof
resource_name_treatment: STATIC_TYPES
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
timeout_millis: 60000
reroute_to_grpc_interface: google.iam.v1.IAMPolicy
surface_treatments:
- include_languages:
- go
visibility: DISABLED
- name: GetIamPolicy
flattening:
groups:
- parameters:
- resource
required_fields:
- resource
header_request_params:
- resource
field_name_patterns:
resource: key_oneof
resource_name_treatment: STATIC_TYPES
request_object_method: false
retry_codes_name: idempotent
retry_params_name: default
timeout_millis: 60000
reroute_to_grpc_interface: google.iam.v1.IAMPolicy
surface_treatments:
- include_languages:
- go
visibility: DISABLED
- name: TestIamPermissions
flattening:
groups:
- parameters:
- resource
- permissions
required_fields:
- resource
- permissions
header_request_params:
- resource
field_name_patterns:
resource: key_oneof
resource_name_treatment: STATIC_TYPES
request_object_method: true
retry_codes_name: non_idempotent
retry_params_name: default
timeout_millis: 60000
reroute_to_grpc_interface: google.iam.v1.IAMPolicy
surface_treatments:
- include_languages:
- go
visibility: DISABLED
resource_name_generation:
- message_name: google.iam.v1.SetIamPolicyRequest
field_entity_map:
resource: "*"
- message_name: google.iam.v1.GetIamPolicyRequest
field_entity_map:
resource: "*"
- message_name: google.iam.v1.TestIamPermissionsRequest
field_entity_map:
resource: "*"
- message_name: KeyRing
field_entity_map:
name: key_ring
- message_name: CryptoKey #UpdateCryptoKeyRequest
field_entity_map:
name: crypto_key
- message_name: CryptoKeyVersion #UpdateCryptoKeyVersionRequest
field_entity_map:
name: crypto_key_version
- message_name: ListKeyRingsRequest
field_entity_map:
parent: location
- message_name: ListCryptoKeysRequest
field_entity_map:
parent: key_ring
- message_name: ListCryptoKeyVersionsRequest
field_entity_map:
parent: crypto_key
- message_name: GetKeyRingRequest
field_entity_map:
name: key_ring
- message_name: GetCryptoKeyRequest
field_entity_map:
name: crypto_key
- message_name: GetCryptoKeyVersionRequest
field_entity_map:
name: crypto_key_version
- message_name: CreateKeyRingRequest
field_entity_map:
parent: location
- message_name: CreateCryptoKeyRequest
field_entity_map:
parent: key_ring
- message_name: CreateCryptoKeyVersionRequest
field_entity_map:
parent: crypto_key
- message_name: EncryptRequest
field_entity_map:
name: crypto_key_path
- message_name: DecryptRequest
field_entity_map:
name: crypto_key
- message_name: UpdateCryptoKeyPrimaryVersionRequest
field_entity_map:
name: crypto_key
- message_name: DestroyCryptoKeyVersionRequest
field_entity_map:
name: crypto_key_version
- message_name: RestoreCryptoKeyVersionRequest
field_entity_map:
name: crypto_key_version
- message_name: GetPublicKeyRequest
field_entity_map:
name: crypto_key_version
- message_name: AsymmetricSignRequest
field_entity_map:
name: crypto_key_version
- message_name: AsymmetricDecryptRequest
field_entity_map:
name: crypto_key_version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment