From 8bb4f9b0f4ef404f2998ccf377a01278dd977aa8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 21 Dec 2022 20:46:41 +0000 Subject: [PATCH] feat: update public API to include annotation support (#3790) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 496410329 Source-Link: https://togithub.com/googleapis/googleapis/commit/cc3837ae30818a91caf893b70244b5245d089f49 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/fc0d1d212432583a11cd56c3b5c3e06252caf4ec Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3JldG1hbmFnZXIvLk93bEJvdC55YW1sIiwiaCI6ImZjMGQxZDIxMjQzMjU4M2ExMWNkNTZjM2I1YzNlMDYyNTJjYWY0ZWMifQ== --- .../cloud/secretmanager/v1/resources.proto | 333 ++++++++++++------ .../protos/protos.d.ts | 6 + .../protos/protos.js | 57 +++ .../protos/protos.json | 8 + .../src/v1/secret_manager_service_client.ts | 3 + 5 files changed, 291 insertions(+), 116 deletions(-) diff --git a/packages/google-cloud-secretmanager/protos/google/cloud/secretmanager/v1/resources.proto b/packages/google-cloud-secretmanager/protos/google/cloud/secretmanager/v1/resources.proto index 4b50a671559..3c6591e3b9b 100644 --- a/packages/google-cloud-secretmanager/protos/google/cloud/secretmanager/v1/resources.proto +++ b/packages/google-cloud-secretmanager/protos/google/cloud/secretmanager/v1/resources.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,21 +31,25 @@ option objc_class_prefix = "GSM"; option php_namespace = "Google\\Cloud\\SecretManager\\V1"; option ruby_package = "Google::Cloud::SecretManager::V1"; -// A [Secret][google.cloud.secretmanager.v1.Secret] is a logical secret whose value and versions can -// be accessed. +// A [Secret][google.cloud.secretmanager.v1.Secret] is a logical secret whose +// value and versions can be accessed. // -// A [Secret][google.cloud.secretmanager.v1.Secret] is made up of zero or more [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] that -// represent the secret data. +// A [Secret][google.cloud.secretmanager.v1.Secret] is made up of zero or more +// [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] that represent +// the secret data. message Secret { option (google.api.resource) = { type: "secretmanager.googleapis.com/Secret" pattern: "projects/{project}/secrets/{secret}" }; - // Output only. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] in the format `projects/*/secrets/*`. + // Output only. The resource name of the + // [Secret][google.cloud.secretmanager.v1.Secret] in the format + // `projects/*/secrets/*`. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Required. Immutable. The replication policy of the secret data attached to the [Secret][google.cloud.secretmanager.v1.Secret]. + // Required. Immutable. The replication policy of the secret data attached to + // the [Secret][google.cloud.secretmanager.v1.Secret]. // // The replication policy cannot be changed after the Secret has been created. Replication replication = 2 [ @@ -53,8 +57,10 @@ message Secret { (google.api.field_behavior) = REQUIRED ]; - // Output only. The time at which the [Secret][google.cloud.secretmanager.v1.Secret] was created. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The time at which the + // [Secret][google.cloud.secretmanager.v1.Secret] was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // The labels assigned to this Secret. // @@ -69,32 +75,40 @@ message Secret { // No more than 64 labels can be assigned to a given resource. map labels = 4; - // Optional. A list of up to 10 Pub/Sub topics to which messages are published when - // control plane operations are called on the secret or its versions. + // Optional. A list of up to 10 Pub/Sub topics to which messages are published + // when control plane operations are called on the secret or its versions. repeated Topic topics = 5 [(google.api.field_behavior) = OPTIONAL]; - // Expiration policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. If specified the [Secret][google.cloud.secretmanager.v1.Secret] - // and all [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be automatically deleted at - // expiration. Expired secrets are irreversibly deleted. + // Expiration policy attached to the + // [Secret][google.cloud.secretmanager.v1.Secret]. If specified the + // [Secret][google.cloud.secretmanager.v1.Secret] and all + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be + // automatically deleted at expiration. Expired secrets are irreversibly + // deleted. // // Expiration is *not* the recommended way to set time-based permissions. [IAM // Conditions](https://cloud.google.com/secret-manager/docs/access-control#conditions) // is recommended for granting time-based permissions because the operation // can be reversed. oneof expiration { - // Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is - // always provided on output, regardless of what was sent on input. - google.protobuf.Timestamp expire_time = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret]. + // Optional. Timestamp in UTC when the + // [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. + // This is always provided on output, regardless of what was sent on input. + google.protobuf.Timestamp expire_time = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Input only. The TTL for the + // [Secret][google.cloud.secretmanager.v1.Secret]. google.protobuf.Duration ttl = 7 [(google.api.field_behavior) = INPUT_ONLY]; } - // Optional. Etag of the currently stored [Secret][google.cloud.secretmanager.v1.Secret]. + // Optional. Etag of the currently stored + // [Secret][google.cloud.secretmanager.v1.Secret]. string etag = 8 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Rotation policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. May be excluded if there is no - // rotation policy. + // Optional. Rotation policy attached to the + // [Secret][google.cloud.secretmanager.v1.Secret]. May be excluded if there is + // no rotation policy. Rotation rotation = 9 [(google.api.field_behavior) = OPTIONAL]; // Optional. Mapping from version alias to version name. @@ -108,7 +122,22 @@ message Secret { // Version-Alias pairs will be viewable via GetSecret and modifiable via // UpdateSecret. At launch access by alias will only be supported on // GetSecretVersion and AccessSecretVersion. - map version_aliases = 11 [(google.api.field_behavior) = OPTIONAL]; + map version_aliases = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Custom metadata about the secret. + // + // Annotations are distinct from various forms of labels. + // Annotations exist to allow client tools to store their own state + // information without requiring a database. + // + // Annotation keys must be between 1 and 63 characters long, have a UTF-8 + // encoding of maximum 128 bytes, begin and end with an alphanumeric character + // ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and + // alphanumerics in between these symbols. + // + // The total size of annotation keys and values must be less than 16KiB. + map annotations = 13 [(google.api.field_behavior) = OPTIONAL]; } // A secret version resource in the Secret Manager API. @@ -118,88 +147,119 @@ message SecretVersion { pattern: "projects/{project}/secrets/{secret}/versions/{secret_version}" }; - // The state of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion], indicating if it can be accessed. + // The state of a + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion], indicating if + // it can be accessed. enum State { // Not specified. This value is unused and invalid. STATE_UNSPECIFIED = 0; - // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may be accessed. + // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may be + // accessed. ENABLED = 1; - // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may not be accessed, but the secret data - // is still available and can be placed back into the [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED] + // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may not + // be accessed, but the secret data is still available and can be placed + // back into the + // [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED] // state. DISABLED = 2; - // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] is destroyed and the secret data is no longer - // stored. A version may not leave this state once entered. + // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] is + // destroyed and the secret data is no longer stored. A version may not + // leave this state once entered. DESTROYED = 3; } - // Output only. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the - // format `projects/*/secrets/*/versions/*`. + // Output only. The resource name of the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format + // `projects/*/secrets/*/versions/*`. // - // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] IDs in a [Secret][google.cloud.secretmanager.v1.Secret] start at 1 and - // are incremented for each subsequent version of the secret. + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] IDs in a + // [Secret][google.cloud.secretmanager.v1.Secret] start at 1 and are + // incremented for each subsequent version of the secret. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The time at which the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The time at which the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The time this [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was destroyed. - // Only present if [state][google.cloud.secretmanager.v1.SecretVersion.state] is + // Output only. The time this + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was destroyed. + // Only present if [state][google.cloud.secretmanager.v1.SecretVersion.state] + // is // [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED]. - google.protobuf.Timestamp destroy_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp destroy_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The current state of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // Output only. The current state of the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // The replication status of the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. ReplicationStatus replication_status = 5; - // Output only. Etag of the currently stored [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // Output only. Etag of the currently stored + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. string etag = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. True if payload checksum specified in [SecretPayload][google.cloud.secretmanager.v1.SecretPayload] object has been - // received by [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] on + // Output only. True if payload checksum specified in + // [SecretPayload][google.cloud.secretmanager.v1.SecretPayload] object has + // been received by + // [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] + // on // [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]. - bool client_specified_payload_checksum = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + bool client_specified_payload_checksum = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // A policy that defines the replication and encryption configuration of data. message Replication { - // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload without any + // A replication policy that replicates the + // [Secret][google.cloud.secretmanager.v1.Secret] payload without any // restrictions. message Automatic { - // Optional. The customer-managed encryption configuration of the [Secret][google.cloud.secretmanager.v1.Secret]. If no - // configuration is provided, Google-managed default encryption is used. + // Optional. The customer-managed encryption configuration of the + // [Secret][google.cloud.secretmanager.v1.Secret]. If no configuration is + // provided, Google-managed default encryption is used. // - // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to - // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply - // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. - CustomerManagedEncryption customer_managed_encryption = 1 [(google.api.field_behavior) = OPTIONAL]; + // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption + // configuration only apply to + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added + // afterwards. They do not apply retroactively to existing + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. + CustomerManagedEncryption customer_managed_encryption = 1 + [(google.api.field_behavior) = OPTIONAL]; } - // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload into the - // locations specified in [Secret.replication.user_managed.replicas][] + // A replication policy that replicates the + // [Secret][google.cloud.secretmanager.v1.Secret] payload into the locations + // specified in [Secret.replication.user_managed.replicas][] message UserManaged { - // Represents a Replica for this [Secret][google.cloud.secretmanager.v1.Secret]. + // Represents a Replica for this + // [Secret][google.cloud.secretmanager.v1.Secret]. message Replica { // The canonical IDs of the location to replicate data. // For example: `"us-east1"`. string location = 1; - // Optional. The customer-managed encryption configuration of the [User-Managed - // Replica][Replication.UserManaged.Replica]. If no configuration is - // provided, Google-managed default encryption is used. + // Optional. The customer-managed encryption configuration of the + // [User-Managed Replica][Replication.UserManaged.Replica]. If no + // configuration is provided, Google-managed default encryption is used. // - // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to - // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply - // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. - CustomerManagedEncryption customer_managed_encryption = 2 [(google.api.field_behavior) = OPTIONAL]; + // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] + // encryption configuration only apply to + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added + // afterwards. They do not apply retroactively to existing + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. + CustomerManagedEncryption customer_managed_encryption = 2 + [(google.api.field_behavior) = OPTIONAL]; } - // Required. The list of Replicas for this [Secret][google.cloud.secretmanager.v1.Secret]. + // Required. The list of Replicas for this + // [Secret][google.cloud.secretmanager.v1.Secret]. // // Cannot be empty. repeated Replica replicas = 1 [(google.api.field_behavior) = REQUIRED]; @@ -207,10 +267,12 @@ message Replication { // The replication policy for this secret. oneof replication { - // The [Secret][google.cloud.secretmanager.v1.Secret] will automatically be replicated without any restrictions. + // The [Secret][google.cloud.secretmanager.v1.Secret] will automatically be + // replicated without any restrictions. Automatic automatic = 1; - // The [Secret][google.cloud.secretmanager.v1.Secret] will only be replicated into the locations specified. + // The [Secret][google.cloud.secretmanager.v1.Secret] will only be + // replicated into the locations specified. UserManaged user_managed = 2; } } @@ -218,75 +280,93 @@ message Replication { // Configuration for encrypting secret payloads using customer-managed // encryption keys (CMEK). message CustomerManagedEncryption { - // Required. The resource name of the Cloud KMS CryptoKey used to encrypt secret - // payloads. + // Required. The resource name of the Cloud KMS CryptoKey used to encrypt + // secret payloads. // - // For secrets using the [UserManaged][google.cloud.secretmanager.v1.Replication.UserManaged] replication - // policy type, Cloud KMS CryptoKeys must reside in the same location as the - // [replica location][Secret.UserManaged.Replica.location]. + // For secrets using the + // [UserManaged][google.cloud.secretmanager.v1.Replication.UserManaged] + // replication policy type, Cloud KMS CryptoKeys must reside in the same + // location as the [replica location][Secret.UserManaged.Replica.location]. // - // For secrets using the [Automatic][google.cloud.secretmanager.v1.Replication.Automatic] replication policy - // type, Cloud KMS CryptoKeys must reside in `global`. + // For secrets using the + // [Automatic][google.cloud.secretmanager.v1.Replication.Automatic] + // replication policy type, Cloud KMS CryptoKeys must reside in `global`. // // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED]; } -// The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. +// The replication status of a +// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. message ReplicationStatus { - // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using automatic replication. + // The replication status of a + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using + // automatic replication. // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication - // policy. + // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] + // has an automatic replication policy. message AutomaticStatus { - // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only + // Output only. The customer-managed encryption status of the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only // populated if customer-managed encryption is used. - CustomerManagedEncryptionStatus customer_managed_encryption = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + CustomerManagedEncryptionStatus customer_managed_encryption = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; } - // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using user-managed - // replication. + // The replication status of a + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using + // user-managed replication. // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication - // policy. + // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] + // has a user-managed replication policy. message UserManagedStatus { - // Describes the status of a user-managed replica for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // Describes the status of a user-managed replica for the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. message ReplicaStatus { // Output only. The canonical ID of the replica location. // For example: `"us-east1"`. string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only + // Output only. The customer-managed encryption status of the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only // populated if customer-managed encryption is used. - CustomerManagedEncryptionStatus customer_managed_encryption = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + CustomerManagedEncryptionStatus customer_managed_encryption = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; } - // Output only. The list of replica statuses for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - repeated ReplicaStatus replicas = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The list of replica statuses for the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + repeated ReplicaStatus replicas = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; } - // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // The replication status of the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. oneof replication_status { - // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with + // Describes the replication status of a + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with // automatic replication. // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication - // policy. + // Only populated if the parent + // [Secret][google.cloud.secretmanager.v1.Secret] has an automatic + // replication policy. AutomaticStatus automatic = 1; - // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with + // Describes the replication status of a + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with // user-managed replication. // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication - // policy. + // Only populated if the parent + // [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed + // replication policy. UserManagedStatus user_managed = 2; } } // Describes the status of customer-managed encryption. message CustomerManagedEncryptionStatus { - // Required. The resource name of the Cloud KMS CryptoKeyVersion used to encrypt the - // secret payload, in the following format: + // Required. The resource name of the Cloud KMS CryptoKeyVersion used to + // encrypt the secret payload, in the following format: // `projects/*/locations/*/keyRings/*/cryptoKeys/*/versions/*`. string kms_key_version_name = 1 [(google.api.field_behavior) = REQUIRED]; } @@ -299,44 +379,65 @@ message Topic { pattern: "projects/{project}/topics/{topic}" }; - // Required. The resource name of the Pub/Sub topic that will be published to, in the - // following format: `projects/*/topics/*`. For publication to succeed, the - // Secret Manager P4SA must have `pubsub.publisher` permissions on the topic. + // Required. The resource name of the Pub/Sub topic that will be published to, + // in the following format: `projects/*/topics/*`. For publication to succeed, + // the Secret Manager P4SA must have `pubsub.publisher` permissions on the + // topic. string name = 1 [(google.api.field_behavior) = REQUIRED]; } -// The rotation time and period for a [Secret][google.cloud.secretmanager.v1.Secret]. At next_rotation_time, Secret +// The rotation time and period for a +// [Secret][google.cloud.secretmanager.v1.Secret]. At next_rotation_time, Secret // Manager will send a Pub/Sub notification to the topics configured on the -// Secret. [Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be set to configure rotation. +// Secret. [Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be +// set to configure rotation. message Rotation { - // Optional. Timestamp in UTC at which the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to rotate. Cannot be - // set to less than 300s (5 min) in the future and at most 3153600000s (100 - // years). + // Optional. Timestamp in UTC at which the + // [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to rotate. + // Cannot be set to less than 300s (5 min) in the future and at most + // 3153600000s (100 years). // - // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] MUST be set if [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set. - google.protobuf.Timestamp next_rotation_time = 1 [(google.api.field_behavior) = OPTIONAL]; + // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] + // MUST be set if + // [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] + // is set. + google.protobuf.Timestamp next_rotation_time = 1 + [(google.api.field_behavior) = OPTIONAL]; // Input only. The Duration between rotation notifications. Must be in seconds // and at least 3600s (1h) and at most 3153600000s (100 years). // - // If [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set, [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] must be set. - // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] will be advanced by this period when the service - // automatically sends rotation notifications. - google.protobuf.Duration rotation_period = 2 [(google.api.field_behavior) = INPUT_ONLY]; + // If + // [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] + // is set, + // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] + // must be set. + // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] + // will be advanced by this period when the service automatically sends + // rotation notifications. + google.protobuf.Duration rotation_period = 2 + [(google.api.field_behavior) = INPUT_ONLY]; } // A secret payload resource in the Secret Manager API. This contains the -// sensitive secret payload that is associated with a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. +// sensitive secret payload that is associated with a +// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. message SecretPayload { // The secret data. Must be no larger than 64KiB. bytes data = 1; - // Optional. If specified, [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will verify the integrity of the - // received [data][google.cloud.secretmanager.v1.SecretPayload.data] on [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] calls using - // the crc32c checksum and store it to include in future - // [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion] responses. If a checksum is - // not provided in the [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] request, the - // [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will generate and store one for you. + // Optional. If specified, + // [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] + // will verify the integrity of the received + // [data][google.cloud.secretmanager.v1.SecretPayload.data] on + // [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] + // calls using the crc32c checksum and store it to include in future + // [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion] + // responses. If a checksum is not provided in the + // [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] + // request, the + // [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] + // will generate and store one for you. // // The CRC32C value is encoded as a Int64 for compatibility, and can be // safely downconverted to uint32 in languages that support this type. diff --git a/packages/google-cloud-secretmanager/protos/protos.d.ts b/packages/google-cloud-secretmanager/protos/protos.d.ts index e3add63a2f7..1f177a49fdf 100644 --- a/packages/google-cloud-secretmanager/protos/protos.d.ts +++ b/packages/google-cloud-secretmanager/protos/protos.d.ts @@ -58,6 +58,9 @@ export namespace google { /** Secret versionAliases */ versionAliases?: ({ [k: string]: (number|Long|string) }|null); + + /** Secret annotations */ + annotations?: ({ [k: string]: string }|null); } /** Represents a Secret. */ @@ -99,6 +102,9 @@ export namespace google { /** Secret versionAliases. */ public versionAliases: { [k: string]: (number|Long|string) }; + /** Secret annotations. */ + public annotations: { [k: string]: string }; + /** Secret expiration. */ public expiration?: ("expireTime"|"ttl"); diff --git a/packages/google-cloud-secretmanager/protos/protos.js b/packages/google-cloud-secretmanager/protos/protos.js index 54ffe8f49e6..c2787bf9782 100644 --- a/packages/google-cloud-secretmanager/protos/protos.js +++ b/packages/google-cloud-secretmanager/protos/protos.js @@ -82,6 +82,7 @@ * @property {string|null} [etag] Secret etag * @property {google.cloud.secretmanager.v1.IRotation|null} [rotation] Secret rotation * @property {Object.|null} [versionAliases] Secret versionAliases + * @property {Object.|null} [annotations] Secret annotations */ /** @@ -96,6 +97,7 @@ this.labels = {}; this.topics = []; this.versionAliases = {}; + this.annotations = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -182,6 +184,14 @@ */ Secret.prototype.versionAliases = $util.emptyObject; + /** + * Secret annotations. + * @member {Object.} annotations + * @memberof google.cloud.secretmanager.v1.Secret + * @instance + */ + Secret.prototype.annotations = $util.emptyObject; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -243,6 +253,9 @@ if (message.versionAliases != null && Object.hasOwnProperty.call(message, "versionAliases")) for (var keys = Object.keys(message.versionAliases), i = 0; i < keys.length; ++i) writer.uint32(/* id 11, wireType 2 =*/90).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 0 =*/16).int64(message.versionAliases[keys[i]]).ldelim(); + if (message.annotations != null && Object.hasOwnProperty.call(message, "annotations")) + for (var keys = Object.keys(message.annotations), i = 0; i < keys.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.annotations[keys[i]]).ldelim(); return writer; }; @@ -357,6 +370,29 @@ message.versionAliases[key] = value; break; } + case 13: { + if (message.annotations === $util.emptyObject) + message.annotations = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.annotations[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -457,6 +493,14 @@ if (!$util.isInteger(message.versionAliases[key[i]]) && !(message.versionAliases[key[i]] && $util.isInteger(message.versionAliases[key[i]].low) && $util.isInteger(message.versionAliases[key[i]].high))) return "versionAliases: integer|Long{k:string} expected"; } + if (message.annotations != null && message.hasOwnProperty("annotations")) { + if (!$util.isObject(message.annotations)) + return "annotations: object expected"; + var key = Object.keys(message.annotations); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.annotations[key[i]])) + return "annotations: string{k:string} expected"; + } return null; }; @@ -532,6 +576,13 @@ else if (typeof object.versionAliases[keys[i]] === "object") message.versionAliases[keys[i]] = new $util.LongBits(object.versionAliases[keys[i]].low >>> 0, object.versionAliases[keys[i]].high >>> 0).toNumber(); } + if (object.annotations) { + if (typeof object.annotations !== "object") + throw TypeError(".google.cloud.secretmanager.v1.Secret.annotations: object expected"); + message.annotations = {}; + for (var keys = Object.keys(object.annotations), i = 0; i < keys.length; ++i) + message.annotations[keys[i]] = String(object.annotations[keys[i]]); + } return message; }; @@ -553,6 +604,7 @@ if (options.objects || options.defaults) { object.labels = {}; object.versionAliases = {}; + object.annotations = {}; } if (options.defaults) { object.name = ""; @@ -600,6 +652,11 @@ else object.versionAliases[keys2[j]] = options.longs === String ? $util.Long.prototype.toString.call(message.versionAliases[keys2[j]]) : options.longs === Number ? new $util.LongBits(message.versionAliases[keys2[j]].low >>> 0, message.versionAliases[keys2[j]].high >>> 0).toNumber() : message.versionAliases[keys2[j]]; } + if (message.annotations && (keys2 = Object.keys(message.annotations)).length) { + object.annotations = {}; + for (var j = 0; j < keys2.length; ++j) + object.annotations[keys2[j]] = message.annotations[keys2[j]]; + } return object; }; diff --git a/packages/google-cloud-secretmanager/protos/protos.json b/packages/google-cloud-secretmanager/protos/protos.json index 4bd730f663a..5f58bffe786 100644 --- a/packages/google-cloud-secretmanager/protos/protos.json +++ b/packages/google-cloud-secretmanager/protos/protos.json @@ -102,6 +102,14 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "annotations": { + "keyType": "string", + "type": "string", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, diff --git a/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts b/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts index 071d976ddbc..6ad2129d565 100644 --- a/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts +++ b/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts @@ -126,6 +126,9 @@ export class SecretManagerServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes;