From 804e1045e0ae45ee08132cec691d1105d8555d8c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:56:50 -0800 Subject: [PATCH] docs: added resource annotations (#106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: added resource annotations feat: added flag for implicit dismissal for `DismissDecision` PiperOrigin-RevId: 427766265 Source-Link: https://github.com/googleapis/googleapis/commit/5556c910e15a4e35fb541a0cf0bbfb5838deb307 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d03fa03b217462784d6ba32ccdde4dfe0c06f017 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDAzZmEwM2IyMTc0NjI3ODRkNmJhMzJjY2RkZTRkZmUwYzA2ZjAxNyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../accessapproval/v1/accessapproval.proto | 257 ++++-- .../protos/protos.d.ts | 265 +++++- .../protos/protos.js | 788 +++++++++++++++++- .../protos/protos.json | 138 ++- ...s_approval.get_access_approval_settings.js | 3 +- .../access_approval.get_approval_request.js | 4 +- .../access_approval.list_approval_requests.js | 18 +- .../src/v1/access_approval_client.ts | 345 +++++++- .../test/gapic_access_approval_v1.ts | 362 ++++++++ 9 files changed, 2017 insertions(+), 163 deletions(-) diff --git a/packages/google-cloud-accessapproval/protos/google/cloud/accessapproval/v1/accessapproval.proto b/packages/google-cloud-accessapproval/protos/google/cloud/accessapproval/v1/accessapproval.proto index cd1ec8eb262..afe431909e2 100644 --- a/packages/google-cloud-accessapproval/protos/google/cloud/accessapproval/v1/accessapproval.proto +++ b/packages/google-cloud-accessapproval/protos/google/cloud/accessapproval/v1/accessapproval.proto @@ -1,4 +1,4 @@ -// Copyright 2020 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. @@ -19,6 +19,7 @@ package google.cloud.accessapproval.v1; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -36,17 +37,17 @@ option ruby_package = "Google::Cloud::AccessApproval::V1"; // // - The API has a collection of // [ApprovalRequest][google.cloud.accessapproval.v1.ApprovalRequest] -// resources, named `approvalRequests/{approval_request_id}` +// resources, named `approvalRequests/{approval_request}` // - The API has top-level settings per Project/Folder/Organization, named // `accessApprovalSettings` // // The service also periodically emails a list of recipients, defined at the // Project/Folder/Organization level in the accessApprovalSettings, when there // is a pending ApprovalRequest for them to act on. The ApprovalRequests can -// also optionally be published to a Cloud Pub/Sub topic owned by the customer -// (for Beta, the Pub/Sub setup is managed manually). +// also optionally be published to a Pub/Sub topic owned by the customer +// (contact support if you would like to enable Pub/Sub notifications). // -// ApprovalRequests can be approved or dismissed. Google personel can only +// ApprovalRequests can be approved or dismissed. Google personnel can only // access the indicated resource or resources if the request is approved // (subject to some exclusions: // https://cloud.google.com/access-approval/docs/overview#exclusions). @@ -66,17 +67,17 @@ option ruby_package = "Google::Cloud::AccessApproval::V1"; // If a request is not approved or dismissed, we call it pending. service AccessApproval { option (google.api.default_host) = "accessapproval.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; // Lists approval requests associated with a project, folder, or organization. // Approval requests can be filtered by state (pending, active, dismissed). // The order is reverse chronological. - rpc ListApprovalRequests(ListApprovalRequestsMessage) returns (ListApprovalRequestsResponse) { + rpc ListApprovalRequests(ListApprovalRequestsMessage) + returns (ListApprovalRequestsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*}/approvalRequests" - additional_bindings { - get: "/v1/{parent=folders/*}/approvalRequests" - } + additional_bindings { get: "/v1/{parent=folders/*}/approvalRequests" } additional_bindings { get: "/v1/{parent=organizations/*}/approvalRequests" } @@ -88,9 +89,7 @@ service AccessApproval { rpc GetApprovalRequest(GetApprovalRequestMessage) returns (ApprovalRequest) { option (google.api.http) = { get: "/v1/{name=projects/*/approvalRequests/*}" - additional_bindings { - get: "/v1/{name=folders/*/approvalRequests/*}" - } + additional_bindings { get: "/v1/{name=folders/*/approvalRequests/*}" } additional_bindings { get: "/v1/{name=organizations/*/approvalRequests/*}" } @@ -102,7 +101,8 @@ service AccessApproval { // // Returns NOT_FOUND if the request does not exist. Returns // FAILED_PRECONDITION if the request exists but is not in a pending state. - rpc ApproveApprovalRequest(ApproveApprovalRequestMessage) returns (ApprovalRequest) { + rpc ApproveApprovalRequest(ApproveApprovalRequestMessage) + returns (ApprovalRequest) { option (google.api.http) = { post: "/v1/{name=projects/*/approvalRequests/*}:approve" body: "*" @@ -127,7 +127,8 @@ service AccessApproval { // // Returns FAILED_PRECONDITION if the request exists but is not in a pending // state. - rpc DismissApprovalRequest(DismissApprovalRequestMessage) returns (ApprovalRequest) { + rpc DismissApprovalRequest(DismissApprovalRequestMessage) + returns (ApprovalRequest) { option (google.api.http) = { post: "/v1/{name=projects/*/approvalRequests/*}:dismiss" body: "*" @@ -143,12 +144,11 @@ service AccessApproval { } // Gets the settings associated with a project, folder, or organization. - rpc GetAccessApprovalSettings(GetAccessApprovalSettingsMessage) returns (AccessApprovalSettings) { + rpc GetAccessApprovalSettings(GetAccessApprovalSettingsMessage) + returns (AccessApprovalSettings) { option (google.api.http) = { get: "/v1/{name=projects/*/accessApprovalSettings}" - additional_bindings { - get: "/v1/{name=folders/*/accessApprovalSettings}" - } + additional_bindings { get: "/v1/{name=folders/*/accessApprovalSettings}" } additional_bindings { get: "/v1/{name=organizations/*/accessApprovalSettings}" } @@ -158,7 +158,8 @@ service AccessApproval { // Updates the settings associated with a project, folder, or organization. // Settings to update are determined by the value of field_mask. - rpc UpdateAccessApprovalSettings(UpdateAccessApprovalSettingsMessage) returns (AccessApprovalSettings) { + rpc UpdateAccessApprovalSettings(UpdateAccessApprovalSettingsMessage) + returns (AccessApprovalSettings) { option (google.api.http) = { patch: "/v1/{settings.name=projects/*/accessApprovalSettings}" body: "settings" @@ -180,7 +181,8 @@ service AccessApproval { // Approval disabled. If Access Approval is enabled at a higher level of the // hierarchy, then Access Approval will still be enabled at this level as // the settings are inherited. - rpc DeleteAccessApprovalSettings(DeleteAccessApprovalSettingsMessage) returns (google.protobuf.Empty) { + rpc DeleteAccessApprovalSettings(DeleteAccessApprovalSettingsMessage) + returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=projects/*/accessApprovalSettings}" additional_bindings { @@ -202,15 +204,14 @@ message AccessLocations { // of a country code. // Possible Region Codes: // - // - ASI: Asia - // - EUR: Europe - // - OCE: Oceania - // - AFR: Africa - // - NAM: North America - // - SAM: South America - // - ANT: Antarctica - // - ANY: Any location - // + // * ASI: Asia + // * EUR: Europe + // * OCE: Oceania + // * AFR: Africa + // * NAM: North America + // * SAM: South America + // * ANT: Antarctica + // * ANY: Any location string principal_office_country = 1; // Physical location of the principal at the time of the access. A @@ -219,15 +220,14 @@ message AccessLocations { // a region code instead of a country code. // Possible Region Codes: // - // - ASI: Asia - // - EUR: Europe - // - OCE: Oceania - // - AFR: Africa - // - NAM: North America - // - SAM: South America - // - ANT: Antarctica - // - ANY: Any location - // + // * ASI: Asia + // * EUR: Europe + // * OCE: Oceania + // * AFR: Africa + // * NAM: North America + // * SAM: South America + // * ANT: Antarctica + // * ANY: Any location string principal_physical_location_country = 2; } @@ -240,13 +240,12 @@ message AccessReason { // Customer made a request or raised an issue that required the principal to // access customer data. `detail` is of the form ("#####" is the issue ID): // - // - "Feedback Report: #####" - // - "Case Number: #####" - // - "Case ID: #####" - // - "E-PIN Reference: #####" - // - "Google-#####" - // - "T-#####" - // + // * "Feedback Report: #####" + // * "Case Number: #####" + // * "Case ID: #####" + // * "E-PIN Reference: #####" + // * "Google-#####" + // * "T-#####" CUSTOMER_INITIATED_SUPPORT = 1; // The principal accessed customer data in order to diagnose or resolve a @@ -280,6 +279,11 @@ message ApproveDecision { message DismissDecision { // The time at which the approval request was dismissed. google.protobuf.Timestamp dismiss_time = 1; + + // This field will be true if the ApprovalRequest was implcitly dismissed + // due to inaction by the access approval approvers (the request is not acted + // on by the approvers before the exiration time). + bool implicit = 2; } // The properties associated with the resource of the request. @@ -291,8 +295,15 @@ message ResourceProperties { // A request for the customer to approve access to a resource. message ApprovalRequest { + option (google.api.resource) = { + type: "accessapproval.googleapis.com/ApprovalRequest" + pattern: "projects/{project}/approvalRequests/{approval_request}" + pattern: "folders/{folder}/approvalRequests/{approval_request}" + pattern: "organizations/{organization}/approvalRequests/{approval_request}" + }; + // The resource name of the request. Format is - // "{projects|folders|organizations}/{id}/approvalRequests/{approval_request_id}". + // "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}". string name = 1; // The resource for which approval is being requested. The format of the @@ -330,46 +341,98 @@ message ApprovalRequest { } } +// Represents the type of enrollment for a given service to Access Approval. +enum EnrollmentLevel { + // Default value for proto, shouldn't be used. + ENROLLMENT_LEVEL_UNSPECIFIED = 0; + + // Service is enrolled in Access Approval for all requests + BLOCK_ALL = 1; +} + // Represents the enrollment of a cloud resource into a specific service. message EnrolledService { // The product for which Access Approval will be enrolled. Allowed values are // listed below (case-sensitive): // - // - all - // - appengine.googleapis.com - // - bigquery.googleapis.com - // - bigtable.googleapis.com - // - cloudkms.googleapis.com - // - compute.googleapis.com - // - dataflow.googleapis.com - // - iam.googleapis.com - // - pubsub.googleapis.com - // - storage.googleapis.com + // * all + // * GA + // * App Engine + // * BigQuery + // * Cloud Bigtable + // * Cloud Key Management Service + // * Compute Engine + // * Cloud Dataflow + // * Cloud DLP + // * Cloud EKM + // * Cloud HSM + // * Cloud Identity and Access Management + // * Cloud Logging + // * Cloud Pub/Sub + // * Cloud Spanner + // * Cloud SQL + // * Cloud Storage + // * Google Kubernetes Engine + // * Organization Policy Serivice + // * Persistent Disk + // * Resource Manager + // * Speaker ID + // + // Note: These values are supported as input for legacy purposes, but will not + // be returned from the API. // + // * all + // * ga-only + // * appengine.googleapis.com + // * bigquery.googleapis.com + // * bigtable.googleapis.com + // * container.googleapis.com + // * cloudkms.googleapis.com + // * cloudresourcemanager.googleapis.com + // * cloudsql.googleapis.com + // * compute.googleapis.com + // * dataflow.googleapis.com + // * dlp.googleapis.com + // * iam.googleapis.com + // * logging.googleapis.com + // * orgpolicy.googleapis.com + // * pubsub.googleapis.com + // * spanner.googleapis.com + // * speakerid.googleapis.com + // * storage.googleapis.com + // + // Calls to UpdateAccessApprovalSettings using 'all' or any of the + // XXX.googleapis.com will be translated to the associated product name + // ('all', 'App Engine', etc.). + // + // Note: 'all' will enroll the resource in all products supported at both 'GA' + // and 'Preview' levels. + // + // More information about levels of support is available at + // https://cloud.google.com/access-approval/docs/supported-services string cloud_product = 1; // The enrollment level of the service. EnrollmentLevel enrollment_level = 2; } -// Represents the type of enrollment for a given service to Access Approval. -enum EnrollmentLevel { - // Default value for proto, shouldn't be used. - ENROLLMENT_LEVEL_UNSPECIFIED = 0; - - // Service is enrolled in Access Approval for all requests - BLOCK_ALL = 1; -} - // Settings on a Project/Folder/Organization related to Access Approval. message AccessApprovalSettings { + option (google.api.resource) = { + type: "accessapproval.googleapis.com/AccessApprovalSettings" + pattern: "projects/{project}/accessApprovalSettings" + pattern: "folders/{folder}/accessApprovalSettings" + pattern: "organizations/{organization}/accessApprovalSettings" + }; + // The resource name of the settings. Format is one of: // - // - "projects/{project_id}/accessApprovalSettings" - // - "folders/{folder_id}/accessApprovalSettings" - // - "organizations/{organization_id}/accessApprovalSettings" - // - string name = 1; + // * "projects/{project}/accessApprovalSettings" + // * "folders/{folder}/accessApprovalSettings" + // * "organizations/{organization}/accessApprovalSettings" + string name = 1 [(google.api.resource_reference) = { + type: "accessapproval.googleapis.com/AccessApprovalSettings" + }]; // A list of email addresses to which notifications relating to approval // requests should be sent. Notifications relating to a resource will be sent @@ -391,7 +454,7 @@ message AccessApprovalSettings { repeated EnrolledService enrolled_services = 3; // Output only. This field is read only (not settable via - // UpdateAccessAccessApprovalSettings method). If the field is true, that + // UpdateAccessApprovalSettings method). If the field is true, that // indicates that at least one service is enrolled for Access Approval in one // or more ancestors of the Project or Folder (this field will always be // unset for the organization since organizations do not have ancestors). @@ -400,19 +463,24 @@ message AccessApprovalSettings { // Request to list approval requests. message ListApprovalRequestsMessage { - // The parent resource. This may be "projects/{project_id}", - // "folders/{folder_id}", or "organizations/{organization_id}". - string parent = 1; + // The parent resource. This may be "projects/{project}", + // "folders/{folder}", or "organizations/{organization}". + string parent = 1 [(google.api.resource_reference) = { + child_type: "accessapproval.googleapis.com/ApprovalRequest" + }]; // A filter on the type of approval requests to retrieve. Must be one of the // following values: // - // - [not set]: Requests that are pending or have active approvals. - // - ALL: All requests. - // - PENDING: Only pending requests. - // - ACTIVE: Only active (i.e. currently approved) requests. - // - DISMISSED: Only dismissed (including expired) requests. - // + // * [not set]: Requests that are pending or have active approvals. + // * ALL: All requests. + // * PENDING: Only pending requests. + // * ACTIVE: Only active (i.e. currently approved) requests. + // * DISMISSED: Only requests that have been dismissed, or requests that + // are not approved and past expiration. + // * EXPIRED: Only requests that have been approved, and the approval has + // expired. + // * HISTORY: Active, dismissed and expired requests. string filter = 2; // Requested page size. @@ -433,14 +501,20 @@ message ListApprovalRequestsResponse { // Request to get an approval request. message GetApprovalRequestMessage { - // Name of the approval request to retrieve. - string name = 1; + // The name of the approval request to retrieve. + // Format: + // "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}" + string name = 1 [(google.api.resource_reference) = { + type: "accessapproval.googleapis.com/ApprovalRequest" + }]; } // Request to approve an ApprovalRequest. message ApproveApprovalRequestMessage { // Name of the approval request to approve. - string name = 1; + string name = 1 [(google.api.resource_reference) = { + type: "accessapproval.googleapis.com/ApprovalRequest" + }]; // The expiration time of this approval. google.protobuf.Timestamp expire_time = 2; @@ -449,13 +523,18 @@ message ApproveApprovalRequestMessage { // Request to dismiss an approval request. message DismissApprovalRequestMessage { // Name of the ApprovalRequest to dismiss. - string name = 1; + string name = 1 [(google.api.resource_reference) = { + type: "accessapproval.googleapis.com/ApprovalRequest" + }]; } // Request to get access approval settings. message GetAccessApprovalSettingsMessage { - // Name of the AccessApprovalSettings to retrieve. - string name = 1; + // The name of the AccessApprovalSettings to retrieve. + // Format: "{projects|folders|organizations}/{id}/accessApprovalSettings" + string name = 1 [(google.api.resource_reference) = { + type: "accessapproval.googleapis.com/AccessApprovalSettings" + }]; } // Request to update access approval settings. @@ -479,5 +558,7 @@ message UpdateAccessApprovalSettingsMessage { // Request to delete access approval settings. message DeleteAccessApprovalSettingsMessage { // Name of the AccessApprovalSettings to delete. - string name = 1; + string name = 1 [(google.api.resource_reference) = { + type: "accessapproval.googleapis.com/AccessApprovalSettings" + }]; } diff --git a/packages/google-cloud-accessapproval/protos/protos.d.ts b/packages/google-cloud-accessapproval/protos/protos.d.ts index 43dbdf0d5ca..c7d4d4c62f2 100644 --- a/packages/google-cloud-accessapproval/protos/protos.d.ts +++ b/packages/google-cloud-accessapproval/protos/protos.d.ts @@ -501,6 +501,9 @@ export namespace google { /** DismissDecision dismissTime */ dismissTime?: (google.protobuf.ITimestamp|null); + + /** DismissDecision implicit */ + implicit?: (boolean|null); } /** Represents a DismissDecision. */ @@ -515,6 +518,9 @@ export namespace google { /** DismissDecision dismissTime. */ public dismissTime?: (google.protobuf.ITimestamp|null); + /** DismissDecision implicit. */ + public implicit: boolean; + /** * Creates a new DismissDecision instance using the specified properties. * @param [properties] Properties to set @@ -817,6 +823,12 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** EnrollmentLevel enum. */ + enum EnrollmentLevel { + ENROLLMENT_LEVEL_UNSPECIFIED = 0, + BLOCK_ALL = 1 + } + /** Properties of an EnrolledService. */ interface IEnrolledService { @@ -913,12 +925,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** EnrollmentLevel enum. */ - enum EnrollmentLevel { - ENROLLMENT_LEVEL_UNSPECIFIED = 0, - BLOCK_ALL = 1 - } - /** Properties of an AccessApprovalSettings. */ interface IAccessApprovalSettings { @@ -2139,6 +2145,244 @@ export namespace google { UNORDERED_LIST = 6, NON_EMPTY_DEFAULT = 7 } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } /** Namespace protobuf. */ @@ -3705,6 +3949,9 @@ export namespace google { /** FileOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); } /** Represents a FileOptions. */ @@ -3877,6 +4124,9 @@ export namespace google { /** MessageOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); } /** Represents a MessageOptions. */ @@ -4000,6 +4250,9 @@ export namespace google { /** FieldOptions .google.api.fieldBehavior */ ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); } /** Represents a FieldOptions. */ diff --git a/packages/google-cloud-accessapproval/protos/protos.js b/packages/google-cloud-accessapproval/protos/protos.js index b8f63225bf4..2df050b4ec3 100644 --- a/packages/google-cloud-accessapproval/protos/protos.js +++ b/packages/google-cloud-accessapproval/protos/protos.js @@ -1020,6 +1020,7 @@ * @memberof google.cloud.accessapproval.v1 * @interface IDismissDecision * @property {google.protobuf.ITimestamp|null} [dismissTime] DismissDecision dismissTime + * @property {boolean|null} [implicit] DismissDecision implicit */ /** @@ -1045,6 +1046,14 @@ */ DismissDecision.prototype.dismissTime = null; + /** + * DismissDecision implicit. + * @member {boolean} implicit + * @memberof google.cloud.accessapproval.v1.DismissDecision + * @instance + */ + DismissDecision.prototype.implicit = false; + /** * Creates a new DismissDecision instance using the specified properties. * @function create @@ -1071,6 +1080,8 @@ writer = $Writer.create(); if (message.dismissTime != null && Object.hasOwnProperty.call(message, "dismissTime")) $root.google.protobuf.Timestamp.encode(message.dismissTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.implicit != null && Object.hasOwnProperty.call(message, "implicit")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.implicit); return writer; }; @@ -1108,6 +1119,9 @@ case 1: message.dismissTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; + case 2: + message.implicit = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -1148,6 +1162,9 @@ if (error) return "dismissTime." + error; } + if (message.implicit != null && message.hasOwnProperty("implicit")) + if (typeof message.implicit !== "boolean") + return "implicit: boolean expected"; return null; }; @@ -1168,6 +1185,8 @@ throw TypeError(".google.cloud.accessapproval.v1.DismissDecision.dismissTime: object expected"); message.dismissTime = $root.google.protobuf.Timestamp.fromObject(object.dismissTime); } + if (object.implicit != null) + message.implicit = Boolean(object.implicit); return message; }; @@ -1184,10 +1203,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.dismissTime = null; + object.implicit = false; + } if (message.dismissTime != null && message.hasOwnProperty("dismissTime")) object.dismissTime = $root.google.protobuf.Timestamp.toObject(message.dismissTime, options); + if (message.implicit != null && message.hasOwnProperty("implicit")) + object.implicit = message.implicit; return object; }; @@ -1818,6 +1841,20 @@ return ApprovalRequest; })(); + /** + * EnrollmentLevel enum. + * @name google.cloud.accessapproval.v1.EnrollmentLevel + * @enum {number} + * @property {number} ENROLLMENT_LEVEL_UNSPECIFIED=0 ENROLLMENT_LEVEL_UNSPECIFIED value + * @property {number} BLOCK_ALL=1 BLOCK_ALL value + */ + v1.EnrollmentLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENROLLMENT_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "BLOCK_ALL"] = 1; + return values; + })(); + v1.EnrolledService = (function() { /** @@ -2041,20 +2078,6 @@ return EnrolledService; })(); - /** - * EnrollmentLevel enum. - * @name google.cloud.accessapproval.v1.EnrollmentLevel - * @enum {number} - * @property {number} ENROLLMENT_LEVEL_UNSPECIFIED=0 ENROLLMENT_LEVEL_UNSPECIFIED value - * @property {number} BLOCK_ALL=1 BLOCK_ALL value - */ - v1.EnrollmentLevel = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ENROLLMENT_LEVEL_UNSPECIFIED"] = 0; - values[valuesById[1] = "BLOCK_ALL"] = 1; - return values; - })(); - v1.AccessApprovalSettings = (function() { /** @@ -4964,6 +4987,641 @@ return values; })(); + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + case 3: + message.nameField = reader.string(); + break; + case 4: + message.history = reader.int32(); + break; + case 5: + message.plural = reader.string(); + break; + case 6: + message.singular = reader.string(); + break; + case 10: + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.childType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResourceReference; + })(); + return api; })(); @@ -9157,6 +9815,7 @@ * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace * @property {string|null} [rubyPackage] FileOptions rubyPackage * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition */ /** @@ -9169,6 +9828,7 @@ */ function FileOptions(properties) { this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9343,6 +10003,14 @@ */ FileOptions.prototype.uninterpretedOption = $util.emptyArray; + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + /** * Creates a new FileOptions instance using the specified properties. * @function create @@ -9410,6 +10078,9 @@ if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); return writer; }; @@ -9509,6 +10180,11 @@ message.uninterpretedOption = []; message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; + case 1053: + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -9619,6 +10295,15 @@ return "uninterpretedOption." + error; } } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } return null; }; @@ -9696,6 +10381,16 @@ message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); } } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } return message; }; @@ -9712,8 +10407,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } if (options.defaults) { object.javaPackage = ""; object.javaOuterClassname = ""; @@ -9781,6 +10478,11 @@ for (var j = 0; j < message.uninterpretedOption.length; ++j) object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } return object; }; @@ -9825,6 +10527,7 @@ * @property {boolean|null} [deprecated] MessageOptions deprecated * @property {boolean|null} [mapEntry] MessageOptions mapEntry * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource */ /** @@ -9883,6 +10586,14 @@ */ MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + /** * Creates a new MessageOptions instance using the specified properties. * @function create @@ -9918,6 +10629,8 @@ if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); return writer; }; @@ -9969,6 +10682,9 @@ message.uninterpretedOption = []; message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; + case 1053: + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -10025,6 +10741,11 @@ return "uninterpretedOption." + error; } } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } return null; }; @@ -10058,6 +10779,11 @@ message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); } } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } return message; }; @@ -10081,6 +10807,7 @@ object.noStandardDescriptorAccessor = false; object.deprecated = false; object.mapEntry = false; + object[".google.api.resource"] = null; } if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) object.messageSetWireFormat = message.messageSetWireFormat; @@ -10095,6 +10822,8 @@ for (var j = 0; j < message.uninterpretedOption.length; ++j) object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); return object; }; @@ -10126,6 +10855,7 @@ * @property {boolean|null} [weak] FieldOptions weak * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference */ /** @@ -10209,6 +10939,14 @@ */ FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + /** * Creates a new FieldOptions instance using the specified properties. * @function create @@ -10254,6 +10992,8 @@ writer.int32(message[".google.api.fieldBehavior"][i]); writer.ldelim(); } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); return writer; }; @@ -10321,6 +11061,9 @@ } else message[".google.api.fieldBehavior"].push(reader.int32()); break; + case 1055: + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -10413,6 +11156,11 @@ break; } } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } return null; }; @@ -10515,6 +11263,11 @@ break; } } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } return message; }; @@ -10542,6 +11295,7 @@ object.lazy = false; object.jstype = options.enums === String ? "JS_NORMAL" : 0; object.weak = false; + object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; @@ -10565,6 +11319,8 @@ for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); return object; }; diff --git a/packages/google-cloud-accessapproval/protos/protos.json b/packages/google-cloud-accessapproval/protos/protos.json index d710cf663e3..0ccaa076aed 100644 --- a/packages/google-cloud-accessapproval/protos/protos.json +++ b/packages/google-cloud-accessapproval/protos/protos.json @@ -272,6 +272,10 @@ "dismissTime": { "type": "google.protobuf.Timestamp", "id": 1 + }, + "implicit": { + "type": "bool", + "id": 2 } } }, @@ -284,6 +288,10 @@ } }, "ApprovalRequest": { + "options": { + "(google.api.resource).type": "accessapproval.googleapis.com/ApprovalRequest", + "(google.api.resource).pattern": "organizations/{organization}/approvalRequests/{approval_request}" + }, "oneofs": { "decision": { "oneof": [ @@ -331,6 +339,12 @@ } } }, + "EnrollmentLevel": { + "values": { + "ENROLLMENT_LEVEL_UNSPECIFIED": 0, + "BLOCK_ALL": 1 + } + }, "EnrolledService": { "fields": { "cloudProduct": { @@ -343,17 +357,18 @@ } } }, - "EnrollmentLevel": { - "values": { - "ENROLLMENT_LEVEL_UNSPECIFIED": 0, - "BLOCK_ALL": 1 - } - }, "AccessApprovalSettings": { + "options": { + "(google.api.resource).type": "accessapproval.googleapis.com/AccessApprovalSettings", + "(google.api.resource).pattern": "organizations/{organization}/accessApprovalSettings" + }, "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.resource_reference).type": "accessapproval.googleapis.com/AccessApprovalSettings" + } }, "notificationEmails": { "rule": "repeated", @@ -378,7 +393,10 @@ "fields": { "parent": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.resource_reference).child_type": "accessapproval.googleapis.com/ApprovalRequest" + } }, "filter": { "type": "string", @@ -411,7 +429,10 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.resource_reference).type": "accessapproval.googleapis.com/ApprovalRequest" + } } } }, @@ -419,7 +440,10 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.resource_reference).type": "accessapproval.googleapis.com/ApprovalRequest" + } }, "expireTime": { "type": "google.protobuf.Timestamp", @@ -431,7 +455,10 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.resource_reference).type": "accessapproval.googleapis.com/ApprovalRequest" + } } } }, @@ -439,7 +466,10 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.resource_reference).type": "accessapproval.googleapis.com/AccessApprovalSettings" + } } } }, @@ -459,7 +489,10 @@ "fields": { "name": { "type": "string", - "id": 1 + "id": 1, + "options": { + "(google.api.resource_reference).type": "accessapproval.googleapis.com/AccessApprovalSettings" + } } } } @@ -473,7 +506,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "FieldBehaviorProto", + "java_outer_classname": "ResourceProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -599,6 +632,83 @@ "UNORDERED_LIST": 6, "NON_EMPTY_DEFAULT": 7 } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } } } }, diff --git a/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_access_approval_settings.js b/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_access_approval_settings.js index 2181cf6a080..b4cbf372dae 100644 --- a/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_access_approval_settings.js +++ b/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_access_approval_settings.js @@ -21,7 +21,8 @@ function main() { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Name of the AccessApprovalSettings to retrieve. + * The name of the AccessApprovalSettings to retrieve. + * Format: "{projects|folders|organizations}/{id}/accessApprovalSettings" */ // const name = 'abc123' diff --git a/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_approval_request.js b/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_approval_request.js index 0d540aeacf1..a703b5f5e05 100644 --- a/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_approval_request.js +++ b/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.get_approval_request.js @@ -21,7 +21,9 @@ function main() { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Name of the approval request to retrieve. + * The name of the approval request to retrieve. + * Format: + * "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}" */ // const name = 'abc123' diff --git a/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.list_approval_requests.js b/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.list_approval_requests.js index e4508340d12..427e8a8ec15 100644 --- a/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.list_approval_requests.js +++ b/packages/google-cloud-accessapproval/samples/generated/v1/access_approval.list_approval_requests.js @@ -21,18 +21,22 @@ function main() { * TODO(developer): Uncomment these variables before running the sample. */ /** - * The parent resource. This may be "projects/{project_id}", - * "folders/{folder_id}", or "organizations/{organization_id}". + * The parent resource. This may be "projects/{project}", + * "folders/{folder}", or "organizations/{organization}". */ // const parent = 'abc123' /** * A filter on the type of approval requests to retrieve. Must be one of the * following values: - * - not set: Requests that are pending or have active approvals. - * - ALL: All requests. - * - PENDING: Only pending requests. - * - ACTIVE: Only active (i.e. currently approved) requests. - * - DISMISSED: Only dismissed (including expired) requests. + * * not set: Requests that are pending or have active approvals. + * * ALL: All requests. + * * PENDING: Only pending requests. + * * ACTIVE: Only active (i.e. currently approved) requests. + * * DISMISSED: Only requests that have been dismissed, or requests that + * are not approved and past expiration. + * * EXPIRED: Only requests that have been approved, and the approval has + * expired. + * * HISTORY: Active, dismissed and expired requests. */ // const filter = 'abc123' /** diff --git a/packages/google-cloud-accessapproval/src/v1/access_approval_client.ts b/packages/google-cloud-accessapproval/src/v1/access_approval_client.ts index f91874a6a8e..255a9b65ac4 100644 --- a/packages/google-cloud-accessapproval/src/v1/access_approval_client.ts +++ b/packages/google-cloud-accessapproval/src/v1/access_approval_client.ts @@ -46,17 +46,17 @@ const version = require('../../../package.json').version; * * - The API has a collection of * {@link google.cloud.accessapproval.v1.ApprovalRequest|ApprovalRequest} - * resources, named `approvalRequests/{approval_request_id}` + * resources, named `approvalRequests/{approval_request}` * - The API has top-level settings per Project/Folder/Organization, named * `accessApprovalSettings` * * The service also periodically emails a list of recipients, defined at the * Project/Folder/Organization level in the accessApprovalSettings, when there * is a pending ApprovalRequest for them to act on. The ApprovalRequests can - * also optionally be published to a Cloud Pub/Sub topic owned by the customer - * (for Beta, the Pub/Sub setup is managed manually). + * also optionally be published to a Pub/Sub topic owned by the customer + * (contact support if you would like to enable Pub/Sub notifications). * - * ApprovalRequests can be approved or dismissed. Google personel can only + * ApprovalRequests can be approved or dismissed. Google personnel can only * access the indicated resource or resources if the request is approved * (subject to some exclusions: * https://cloud.google.com/access-approval/docs/overview#exclusions). @@ -94,6 +94,7 @@ export class AccessApprovalClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; accessApprovalStub?: Promise<{[name: string]: Function}>; /** @@ -191,6 +192,36 @@ export class AccessApprovalClient { // Load the applicable protos. this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAccessApprovalSettingsPathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/accessApprovalSettings' + ), + folderApprovalRequestPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/approvalRequests/{approval_request}' + ), + organizationAccessApprovalSettingsPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/accessApprovalSettings' + ), + organizationApprovalRequestPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/approvalRequests/{approval_request}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAccessApprovalSettingsPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/accessApprovalSettings' + ), + projectApprovalRequestPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/approvalRequests/{approval_request}' + ), + }; + // Some of the methods on this service return "paged" results, // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. @@ -347,7 +378,9 @@ export class AccessApprovalClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Name of the approval request to retrieve. + * The name of the approval request to retrieve. + * Format: + * "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}" * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -660,7 +693,8 @@ export class AccessApprovalClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Name of the AccessApprovalSettings to retrieve. + * The name of the AccessApprovalSettings to retrieve. + * Format: "{projects|folders|organizations}/{id}/accessApprovalSettings" * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -983,18 +1017,21 @@ export class AccessApprovalClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * The parent resource. This may be "projects/{project_id}", - * "folders/{folder_id}", or "organizations/{organization_id}". + * The parent resource. This may be "projects/{project}", + * "folders/{folder}", or "organizations/{organization}". * @param {string} request.filter * A filter on the type of approval requests to retrieve. Must be one of the * following values: * - * - [not set]: Requests that are pending or have active approvals. - * - ALL: All requests. - * - PENDING: Only pending requests. - * - ACTIVE: Only active (i.e. currently approved) requests. - * - DISMISSED: Only dismissed (including expired) requests. - * + * * [not set]: Requests that are pending or have active approvals. + * * ALL: All requests. + * * PENDING: Only pending requests. + * * ACTIVE: Only active (i.e. currently approved) requests. + * * DISMISSED: Only requests that have been dismissed, or requests that + * are not approved and past expiration. + * * EXPIRED: Only requests that have been approved, and the approval has + * expired. + * * HISTORY: Active, dismissed and expired requests. * @param {number} request.pageSize * Requested page size. * @param {string} request.pageToken @@ -1092,18 +1129,21 @@ export class AccessApprovalClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * The parent resource. This may be "projects/{project_id}", - * "folders/{folder_id}", or "organizations/{organization_id}". + * The parent resource. This may be "projects/{project}", + * "folders/{folder}", or "organizations/{organization}". * @param {string} request.filter * A filter on the type of approval requests to retrieve. Must be one of the * following values: * - * - [not set]: Requests that are pending or have active approvals. - * - ALL: All requests. - * - PENDING: Only pending requests. - * - ACTIVE: Only active (i.e. currently approved) requests. - * - DISMISSED: Only dismissed (including expired) requests. - * + * * [not set]: Requests that are pending or have active approvals. + * * ALL: All requests. + * * PENDING: Only pending requests. + * * ACTIVE: Only active (i.e. currently approved) requests. + * * DISMISSED: Only requests that have been dismissed, or requests that + * are not approved and past expiration. + * * EXPIRED: Only requests that have been approved, and the approval has + * expired. + * * HISTORY: Active, dismissed and expired requests. * @param {number} request.pageSize * Requested page size. * @param {string} request.pageToken @@ -1149,18 +1189,21 @@ export class AccessApprovalClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * The parent resource. This may be "projects/{project_id}", - * "folders/{folder_id}", or "organizations/{organization_id}". + * The parent resource. This may be "projects/{project}", + * "folders/{folder}", or "organizations/{organization}". * @param {string} request.filter * A filter on the type of approval requests to retrieve. Must be one of the * following values: * - * - [not set]: Requests that are pending or have active approvals. - * - ALL: All requests. - * - PENDING: Only pending requests. - * - ACTIVE: Only active (i.e. currently approved) requests. - * - DISMISSED: Only dismissed (including expired) requests. - * + * * [not set]: Requests that are pending or have active approvals. + * * ALL: All requests. + * * PENDING: Only pending requests. + * * ACTIVE: Only active (i.e. currently approved) requests. + * * DISMISSED: Only requests that have been dismissed, or requests that + * are not approved and past expiration. + * * EXPIRED: Only requests that have been approved, and the approval has + * expired. + * * HISTORY: Active, dismissed and expired requests. * @param {number} request.pageSize * Requested page size. * @param {string} request.pageToken @@ -1199,6 +1242,248 @@ export class AccessApprovalClient { callSettings ) as AsyncIterable; } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAccessApprovalSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderAccessApprovalSettingsPath(folder: string) { + return this.pathTemplates.folderAccessApprovalSettingsPathTemplate.render({ + folder: folder, + }); + } + + /** + * Parse the folder from FolderAccessApprovalSettings resource. + * + * @param {string} folderAccessApprovalSettingsName + * A fully-qualified path representing folder_accessApprovalSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAccessApprovalSettingsName( + folderAccessApprovalSettingsName: string + ) { + return this.pathTemplates.folderAccessApprovalSettingsPathTemplate.match( + folderAccessApprovalSettingsName + ).folder; + } + + /** + * Return a fully-qualified folderApprovalRequest resource name string. + * + * @param {string} folder + * @param {string} approval_request + * @returns {string} Resource name string. + */ + folderApprovalRequestPath(folder: string, approvalRequest: string) { + return this.pathTemplates.folderApprovalRequestPathTemplate.render({ + folder: folder, + approval_request: approvalRequest, + }); + } + + /** + * Parse the folder from FolderApprovalRequest resource. + * + * @param {string} folderApprovalRequestName + * A fully-qualified path representing folder_approval_request resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderApprovalRequestName(folderApprovalRequestName: string) { + return this.pathTemplates.folderApprovalRequestPathTemplate.match( + folderApprovalRequestName + ).folder; + } + + /** + * Parse the approval_request from FolderApprovalRequest resource. + * + * @param {string} folderApprovalRequestName + * A fully-qualified path representing folder_approval_request resource. + * @returns {string} A string representing the approval_request. + */ + matchApprovalRequestFromFolderApprovalRequestName( + folderApprovalRequestName: string + ) { + return this.pathTemplates.folderApprovalRequestPathTemplate.match( + folderApprovalRequestName + ).approval_request; + } + + /** + * Return a fully-qualified organizationAccessApprovalSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationAccessApprovalSettingsPath(organization: string) { + return this.pathTemplates.organizationAccessApprovalSettingsPathTemplate.render( + { + organization: organization, + } + ); + } + + /** + * Parse the organization from OrganizationAccessApprovalSettings resource. + * + * @param {string} organizationAccessApprovalSettingsName + * A fully-qualified path representing organization_accessApprovalSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAccessApprovalSettingsName( + organizationAccessApprovalSettingsName: string + ) { + return this.pathTemplates.organizationAccessApprovalSettingsPathTemplate.match( + organizationAccessApprovalSettingsName + ).organization; + } + + /** + * Return a fully-qualified organizationApprovalRequest resource name string. + * + * @param {string} organization + * @param {string} approval_request + * @returns {string} Resource name string. + */ + organizationApprovalRequestPath( + organization: string, + approvalRequest: string + ) { + return this.pathTemplates.organizationApprovalRequestPathTemplate.render({ + organization: organization, + approval_request: approvalRequest, + }); + } + + /** + * Parse the organization from OrganizationApprovalRequest resource. + * + * @param {string} organizationApprovalRequestName + * A fully-qualified path representing organization_approval_request resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationApprovalRequestName( + organizationApprovalRequestName: string + ) { + return this.pathTemplates.organizationApprovalRequestPathTemplate.match( + organizationApprovalRequestName + ).organization; + } + + /** + * Parse the approval_request from OrganizationApprovalRequest resource. + * + * @param {string} organizationApprovalRequestName + * A fully-qualified path representing organization_approval_request resource. + * @returns {string} A string representing the approval_request. + */ + matchApprovalRequestFromOrganizationApprovalRequestName( + organizationApprovalRequestName: string + ) { + return this.pathTemplates.organizationApprovalRequestPathTemplate.match( + organizationApprovalRequestName + ).approval_request; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAccessApprovalSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAccessApprovalSettingsPath(project: string) { + return this.pathTemplates.projectAccessApprovalSettingsPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAccessApprovalSettings resource. + * + * @param {string} projectAccessApprovalSettingsName + * A fully-qualified path representing project_accessApprovalSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAccessApprovalSettingsName( + projectAccessApprovalSettingsName: string + ) { + return this.pathTemplates.projectAccessApprovalSettingsPathTemplate.match( + projectAccessApprovalSettingsName + ).project; + } + + /** + * Return a fully-qualified projectApprovalRequest resource name string. + * + * @param {string} project + * @param {string} approval_request + * @returns {string} Resource name string. + */ + projectApprovalRequestPath(project: string, approvalRequest: string) { + return this.pathTemplates.projectApprovalRequestPathTemplate.render({ + project: project, + approval_request: approvalRequest, + }); + } + + /** + * Parse the project from ProjectApprovalRequest resource. + * + * @param {string} projectApprovalRequestName + * A fully-qualified path representing project_approval_request resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectApprovalRequestName( + projectApprovalRequestName: string + ) { + return this.pathTemplates.projectApprovalRequestPathTemplate.match( + projectApprovalRequestName + ).project; + } + + /** + * Parse the approval_request from ProjectApprovalRequest resource. + * + * @param {string} projectApprovalRequestName + * A fully-qualified path representing project_approval_request resource. + * @returns {string} A string representing the approval_request. + */ + matchApprovalRequestFromProjectApprovalRequestName( + projectApprovalRequestName: string + ) { + return this.pathTemplates.projectApprovalRequestPathTemplate.match( + projectApprovalRequestName + ).approval_request; + } /** * Terminate the gRPC channel and close the client. diff --git a/packages/google-cloud-accessapproval/test/gapic_access_approval_v1.ts b/packages/google-cloud-accessapproval/test/gapic_access_approval_v1.ts index ceedf389e61..e451a29838b 100644 --- a/packages/google-cloud-accessapproval/test/gapic_access_approval_v1.ts +++ b/packages/google-cloud-accessapproval/test/gapic_access_approval_v1.ts @@ -1196,4 +1196,366 @@ describe('v1.AccessApprovalClient', () => { ); }); }); + + describe('Path templates', () => { + describe('folderAccessApprovalSettings', () => { + const fakePath = '/rendered/path/folderAccessApprovalSettings'; + const expectedParameters = { + folder: 'folderValue', + }; + const client = new accessapprovalModule.v1.AccessApprovalClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAccessApprovalSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAccessApprovalSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAccessApprovalSettingsPath', () => { + const result = client.folderAccessApprovalSettingsPath('folderValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAccessApprovalSettingsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAccessApprovalSettingsName', () => { + const result = + client.matchFolderFromFolderAccessApprovalSettingsName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAccessApprovalSettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderApprovalRequest', () => { + const fakePath = '/rendered/path/folderApprovalRequest'; + const expectedParameters = { + folder: 'folderValue', + approval_request: 'approvalRequestValue', + }; + const client = new accessapprovalModule.v1.AccessApprovalClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderApprovalRequestPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderApprovalRequestPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderApprovalRequestPath', () => { + const result = client.folderApprovalRequestPath( + 'folderValue', + 'approvalRequestValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderApprovalRequestPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderApprovalRequestName', () => { + const result = + client.matchFolderFromFolderApprovalRequestName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderApprovalRequestPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchApprovalRequestFromFolderApprovalRequestName', () => { + const result = + client.matchApprovalRequestFromFolderApprovalRequestName(fakePath); + assert.strictEqual(result, 'approvalRequestValue'); + assert( + ( + client.pathTemplates.folderApprovalRequestPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAccessApprovalSettings', () => { + const fakePath = '/rendered/path/organizationAccessApprovalSettings'; + const expectedParameters = { + organization: 'organizationValue', + }; + const client = new accessapprovalModule.v1.AccessApprovalClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAccessApprovalSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAccessApprovalSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAccessApprovalSettingsPath', () => { + const result = + client.organizationAccessApprovalSettingsPath('organizationValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAccessApprovalSettingsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAccessApprovalSettingsName', () => { + const result = + client.matchOrganizationFromOrganizationAccessApprovalSettingsName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAccessApprovalSettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationApprovalRequest', () => { + const fakePath = '/rendered/path/organizationApprovalRequest'; + const expectedParameters = { + organization: 'organizationValue', + approval_request: 'approvalRequestValue', + }; + const client = new accessapprovalModule.v1.AccessApprovalClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationApprovalRequestPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationApprovalRequestPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationApprovalRequestPath', () => { + const result = client.organizationApprovalRequestPath( + 'organizationValue', + 'approvalRequestValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationApprovalRequestPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationApprovalRequestName', () => { + const result = + client.matchOrganizationFromOrganizationApprovalRequestName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationApprovalRequestPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchApprovalRequestFromOrganizationApprovalRequestName', () => { + const result = + client.matchApprovalRequestFromOrganizationApprovalRequestName( + fakePath + ); + assert.strictEqual(result, 'approvalRequestValue'); + assert( + ( + client.pathTemplates.organizationApprovalRequestPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new accessapprovalModule.v1.AccessApprovalClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAccessApprovalSettings', () => { + const fakePath = '/rendered/path/projectAccessApprovalSettings'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new accessapprovalModule.v1.AccessApprovalClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAccessApprovalSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAccessApprovalSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAccessApprovalSettingsPath', () => { + const result = client.projectAccessApprovalSettingsPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAccessApprovalSettingsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAccessApprovalSettingsName', () => { + const result = + client.matchProjectFromProjectAccessApprovalSettingsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAccessApprovalSettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectApprovalRequest', () => { + const fakePath = '/rendered/path/projectApprovalRequest'; + const expectedParameters = { + project: 'projectValue', + approval_request: 'approvalRequestValue', + }; + const client = new accessapprovalModule.v1.AccessApprovalClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectApprovalRequestPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectApprovalRequestPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectApprovalRequestPath', () => { + const result = client.projectApprovalRequestPath( + 'projectValue', + 'approvalRequestValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectApprovalRequestPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectApprovalRequestName', () => { + const result = + client.matchProjectFromProjectApprovalRequestName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectApprovalRequestPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchApprovalRequestFromProjectApprovalRequestName', () => { + const result = + client.matchApprovalRequestFromProjectApprovalRequestName(fakePath); + assert.strictEqual(result, 'approvalRequestValue'); + assert( + ( + client.pathTemplates.projectApprovalRequestPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); });