diff --git a/packages/google-cloud-policytroubleshooter/README.md b/packages/google-cloud-policytroubleshooter/README.md index e1609877df6..0d7bdae340d 100644 --- a/packages/google-cloud-policytroubleshooter/README.md +++ b/packages/google-cloud-policytroubleshooter/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [IAM Policy Troubleshooter API: Node.js Client](https://github.com/googleapis/google-cloud-node) +# [IAM Policy Troubleshooter API: Node.js Client](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-policytroubleshooter) [![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/policy-troubleshooter.svg)](https://www.npmjs.org/package/@google-cloud/policy-troubleshooter) @@ -86,13 +86,12 @@ troubelshootPolicy(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-policytroubleshooter/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Iam_checker.troubleshoot_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policytroubleshooter/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-policytroubleshooter/samples/quickstart.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policytroubleshooter/samples/test/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-policytroubleshooter/samples/test/quickstart.js,samples/README.md) | +| Iam_checker.troubleshoot_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js,packages/google-cloud-policytroubleshooter/samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policytroubleshooter/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-policytroubleshooter/samples/quickstart.js,packages/google-cloud-policytroubleshooter/samples/README.md) | diff --git a/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/checker.proto b/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/checker.proto index bd6d755878e..ebefb7b6af3 100644 --- a/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/checker.proto +++ b/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/checker.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,15 +11,16 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; package google.cloud.policytroubleshooter.v1; import public "google/cloud/policytroubleshooter/v1/explanations.proto"; + import "google/api/annotations.proto"; import "google/api/client.proto"; +import "google/rpc/status.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.PolicyTroubleshooter.V1"; @@ -35,11 +36,14 @@ option ruby_package = "Google::Cloud::PolicyTroubleshooter::V1"; // This service helps you troubleshoot access issues for Google Cloud resources. service IamChecker { option (google.api.default_host) = "policytroubleshooter.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"; - // Checks whether a member has a specific permission for a specific resource, - // and explains why the member does or does not have that permission. - rpc TroubleshootIamPolicy(TroubleshootIamPolicyRequest) returns (TroubleshootIamPolicyResponse) { + // Checks whether a principal has a specific permission for a specific + // resource, and explains why the principal does or does not have that + // permission. + rpc TroubleshootIamPolicy(TroubleshootIamPolicyRequest) + returns (TroubleshootIamPolicyResponse) { option (google.api.http) = { post: "/v1/iam:troubleshoot" body: "*" @@ -47,22 +51,24 @@ service IamChecker { } } -// Request for [TroubleshootIamPolicy][google.cloud.policytroubleshooter.v1.IamChecker.TroubleshootIamPolicy]. +// Request for +// [TroubleshootIamPolicy][google.cloud.policytroubleshooter.v1.IamChecker.TroubleshootIamPolicy]. message TroubleshootIamPolicyRequest { - // The information to use for checking whether a member has a permission for a - // resource. + // The information to use for checking whether a principal has a permission + // for a resource. AccessTuple access_tuple = 1; } -// Response for [TroubleshootIamPolicy][google.cloud.policytroubleshooter.v1.IamChecker.TroubleshootIamPolicy]. +// Response for +// [TroubleshootIamPolicy][google.cloud.policytroubleshooter.v1.IamChecker.TroubleshootIamPolicy]. message TroubleshootIamPolicyResponse { - // Indicates whether the member has the specified permission for the specified - // resource, based on evaluating all of the applicable IAM policies. + // Indicates whether the principal has the specified permission for the + // specified resource, based on evaluating all of the applicable IAM policies. AccessState access = 1; - // List of IAM policies that were evaluated to check the member's permissions, - // with annotations to indicate how each policy contributed to the final - // result. + // List of IAM policies that were evaluated to check the principal's + // permissions, with annotations to indicate how each policy contributed to + // the final result. // // The list of policies can include the policy for the resource itself. It can // also include policies that are inherited from higher levels of the resource @@ -71,4 +77,7 @@ message TroubleshootIamPolicyResponse { // To learn more about the resource hierarchy, see // https://cloud.google.com/iam/help/resource-hierarchy. repeated ExplainedPolicy explained_policies = 2; + + // The general errors contained in the troubleshooting response. + repeated google.rpc.Status errors = 3; } diff --git a/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/explanations.proto b/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/explanations.proto index 78b56b96ad6..18d4611eb1c 100644 --- a/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/explanations.proto +++ b/packages/google-cloud-policytroubleshooter/protos/google/cloud/policytroubleshooter/v1/explanations.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; @@ -26,15 +25,15 @@ option go_package = "cloud.google.com/go/policytroubleshooter/apiv1/policytroubl option php_namespace = "Google\\Cloud\\PolicyTroubleshooter\\V1"; option ruby_package = "Google::Cloud::PolicyTroubleshooter::V1"; -// Information about the member, resource, and permission to check. +// Information about the principal, resource, and permission to check. message AccessTuple { - // Required. The member, or principal, whose access you want to check, in the form of - // the email address that represents that member. For example, + // Required. The principal whose access you want to check, in the form of + // the email address that represents that principal. For example, // `alice@example.com` or // `my-service-account@my-project.iam.gserviceaccount.com`. // - // The member must be a Google Account or a service account. Other types of - // members are not supported. + // The principal must be a Google Account or a service account. Other types of + // principals are not supported. string principal = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The full resource name that identifies the resource. For example, @@ -44,7 +43,8 @@ message AccessTuple { // https://cloud.google.com/iam/help/troubleshooter/full-resource-names. string full_resource_name = 2 [(google.api.field_behavior) = REQUIRED]; - // Required. The IAM permission to check for the specified member and resource. + // Required. The IAM permission to check for the specified principal and + // resource. // // For a complete list of IAM permissions, see // https://cloud.google.com/iam/help/permissions/reference. @@ -58,12 +58,12 @@ message AccessTuple { // to the access check. message ExplainedPolicy { // Indicates whether _this policy_ provides the specified permission to the - // specified member for the specified resource. + // specified principal for the specified resource. // - // This field does _not_ indicate whether the member actually has the + // This field does _not_ indicate whether the principal actually has the // permission for the resource. There might be another policy that overrides - // this policy. To determine whether the member actually has the permission, - // use the `access` field in the + // this policy. To determine whether the principal actually has the + // permission, use the `access` field in the // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse]. AccessState access = 1; @@ -83,8 +83,8 @@ message ExplainedPolicy { // is empty. google.iam.v1.Policy policy = 3; - // Details about how each binding in the policy affects the member's ability, - // or inability, to use the permission for the resource. + // Details about how each binding in the policy affects the principal's + // ability, or inability, to use the permission for the resource. // // If the sender of the request does not have access to the policy, this field // is omitted. @@ -98,22 +98,12 @@ message ExplainedPolicy { HeuristicRelevance relevance = 5; } -// Details about how a binding in a policy affects a member's ability to use a -// permission. +// Details about how a binding in a policy affects a principal's ability to use +// a permission. message BindingExplanation { - // Details about whether the binding includes the member. - message AnnotatedMembership { - // Indicates whether the binding includes the member. - Membership membership = 1; - - // The relevance of the member's status to the overall determination for the - // binding. - HeuristicRelevance relevance = 2; - } - // Whether a role includes a specific permission. enum RolePermission { - // Reserved for future use. + // Default value. This value is unused. ROLE_PERMISSION_UNSPECIFIED = 0; // The permission is included in the role. @@ -126,37 +116,48 @@ message BindingExplanation { ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3; } - // Whether the binding includes the member. + // Whether the binding includes the principal. enum Membership { - // Reserved for future use. + // Default value. This value is unused. MEMBERSHIP_UNSPECIFIED = 0; - // The binding includes the member. The member can be included directly - // or indirectly. For example: + // The binding includes the principal. The principal can be included + // directly or indirectly. For example: // - // * A member is included directly if that member is listed in the binding. - // * A member is included indirectly if that member is in a Google group or - // G Suite domain that is listed in the binding. + // * A principal is included directly if that principal is listed in the + // binding. + // * A principal is included indirectly if that principal is in a Google + // group or Google Workspace domain that is listed in the binding. MEMBERSHIP_INCLUDED = 1; - // The binding does not include the member. + // The binding does not include the principal. MEMBERSHIP_NOT_INCLUDED = 2; // The sender of the request is not allowed to access the binding. MEMBERSHIP_UNKNOWN_INFO_DENIED = 3; - // The member is an unsupported type. Only Google Accounts and service + // The principal is an unsupported type. Only Google Accounts and service // accounts are supported. MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4; } - // Required. Indicates whether _this binding_ provides the specified permission to the - // specified member for the specified resource. + // Details about whether the binding includes the principal. + message AnnotatedMembership { + // Indicates whether the binding includes the principal. + Membership membership = 1; + + // The relevance of the principal's status to the overall determination for + // the binding. + HeuristicRelevance relevance = 2; + } + + // Required. Indicates whether _this binding_ provides the specified + // permission to the specified principal for the specified resource. // - // This field does _not_ indicate whether the member actually has the + // This field does _not_ indicate whether the principal actually has the // permission for the resource. There might be another binding that overrides - // this binding. To determine whether the member actually has the permission, - // use the `access` field in the + // this binding. To determine whether the principal actually has the + // permission, use the `access` field in the // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse]. AccessState access = 1 [(google.api.field_behavior) = REQUIRED]; @@ -175,24 +176,24 @@ message BindingExplanation { // to the overall determination for the entire policy. HeuristicRelevance role_permission_relevance = 4; - // Indicates whether each member in the binding includes the member specified - // in the request, either directly or indirectly. Each key identifies a member - // in the binding, and each value indicates whether the member in the binding - // includes the member in the request. + // Indicates whether each principal in the binding includes the principal + // specified in the request, either directly or indirectly. Each key + // identifies a principal in the binding, and each value indicates whether the + // principal in the binding includes the principal in the request. // - // For example, suppose that a binding includes the following members: + // For example, suppose that a binding includes the following principals: // // * `user:alice@example.com` // * `group:product-eng@example.com` // // You want to troubleshoot access for `user:bob@example.com`. This user is a - // member of the group `group:product-eng@example.com`. + // principal of the group `group:product-eng@example.com`. // - // For the first member in the binding, the key is `user:alice@example.com`, - // and the `membership` field in the value is set to + // For the first principal in the binding, the key is + // `user:alice@example.com`, and the `membership` field in the value is set to // `MEMBERSHIP_NOT_INCLUDED`. // - // For the second member in the binding, the key is + // For the second principal in the binding, the key is // `group:product-eng@example.com`, and the `membership` field in the value is // set to `MEMBERSHIP_INCLUDED`. map memberships = 5; @@ -201,27 +202,27 @@ message BindingExplanation { // policy. HeuristicRelevance relevance = 6; - // A condition expression that prevents access unless the expression evaluates - // to `true`. + // A condition expression that prevents this binding from granting access + // unless the expression evaluates to `true`. // // To learn about IAM Conditions, see - // http://cloud.google.com/iam/help/conditions/overview. + // https://cloud.google.com/iam/help/conditions/overview. google.type.Expr condition = 7; } -// Whether a member has a permission for a resource. +// Whether a principal has a permission for a resource. enum AccessState { - // Reserved for future use. + // Default value. This value is unused. ACCESS_STATE_UNSPECIFIED = 0; - // The member has the permission. + // The principal has the permission. GRANTED = 1; - // The member does not have the permission. + // The principal does not have the permission. NOT_GRANTED = 2; - // The member has the permission only if a condition expression evaluates to - // `true`. + // The principal has the permission only if a condition expression evaluates + // to `true`. UNKNOWN_CONDITIONAL = 3; // The sender of the request does not have access to all of the policies that @@ -229,10 +230,11 @@ enum AccessState { UNKNOWN_INFO_DENIED = 4; } -// The extent to which a single data point contributes to an overall +// The extent to which a single data point, such as the existence of a binding +// or whether a binding includes a specific principal, contributes to an overall // determination. enum HeuristicRelevance { - // Reserved for future use. + // Default value. This value is unused. HEURISTIC_RELEVANCE_UNSPECIFIED = 0; // The data point has a limited effect on the result. Changing the data point diff --git a/packages/google-cloud-policytroubleshooter/protos/protos.d.ts b/packages/google-cloud-policytroubleshooter/protos/protos.d.ts index 4821821085f..9079b4fd371 100644 --- a/packages/google-cloud-policytroubleshooter/protos/protos.d.ts +++ b/packages/google-cloud-policytroubleshooter/protos/protos.d.ts @@ -176,6 +176,9 @@ export namespace google { /** TroubleshootIamPolicyResponse explainedPolicies */ explainedPolicies?: (google.cloud.policytroubleshooter.v1.IExplainedPolicy[]|null); + + /** TroubleshootIamPolicyResponse errors */ + errors?: (google.rpc.IStatus[]|null); } /** Represents a TroubleshootIamPolicyResponse. */ @@ -193,6 +196,9 @@ export namespace google { /** TroubleshootIamPolicyResponse explainedPolicies. */ public explainedPolicies: google.cloud.policytroubleshooter.v1.IExplainedPolicy[]; + /** TroubleshootIamPolicyResponse errors. */ + public errors: google.rpc.IStatus[]; + /** * Creates a new TroubleshootIamPolicyResponse instance using the specified properties. * @param [properties] Properties to set @@ -636,6 +642,23 @@ export namespace google { namespace BindingExplanation { + /** RolePermission enum. */ + enum RolePermission { + ROLE_PERMISSION_UNSPECIFIED = 0, + ROLE_PERMISSION_INCLUDED = 1, + ROLE_PERMISSION_NOT_INCLUDED = 2, + ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3 + } + + /** Membership enum. */ + enum Membership { + MEMBERSHIP_UNSPECIFIED = 0, + MEMBERSHIP_INCLUDED = 1, + MEMBERSHIP_NOT_INCLUDED = 2, + MEMBERSHIP_UNKNOWN_INFO_DENIED = 3, + MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4 + } + /** Properties of an AnnotatedMembership. */ interface IAnnotatedMembership { @@ -738,23 +761,6 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } - - /** RolePermission enum. */ - enum RolePermission { - ROLE_PERMISSION_UNSPECIFIED = 0, - ROLE_PERMISSION_INCLUDED = 1, - ROLE_PERMISSION_NOT_INCLUDED = 2, - ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3 - } - - /** Membership enum. */ - enum Membership { - MEMBERSHIP_UNSPECIFIED = 0, - MEMBERSHIP_INCLUDED = 1, - MEMBERSHIP_NOT_INCLUDED = 2, - MEMBERSHIP_UNKNOWN_INFO_DENIED = 3, - MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4 - } } /** AccessState enum. */ @@ -4488,6 +4494,109 @@ export namespace google { } } } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @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.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @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.protobuf.Any; + + /** + * Verifies an Any 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 an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Any + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Namespace iam. */ @@ -5410,4 +5519,117 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } } + + /** Namespace rpc. */ + namespace rpc { + + /** Properties of a Status. */ + interface IStatus { + + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); + } + + /** Represents a Status. */ + class Status implements IStatus { + + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: google.rpc.IStatus); + + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create(properties?: google.rpc.IStatus): google.rpc.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @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.rpc.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @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.rpc.Status; + + /** + * Verifies a Status 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 Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { [k: string]: any }): google.rpc.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } } diff --git a/packages/google-cloud-policytroubleshooter/protos/protos.js b/packages/google-cloud-policytroubleshooter/protos/protos.js index 32f16af7156..fec2014198d 100644 --- a/packages/google-cloud-policytroubleshooter/protos/protos.js +++ b/packages/google-cloud-policytroubleshooter/protos/protos.js @@ -350,6 +350,7 @@ * @interface ITroubleshootIamPolicyResponse * @property {google.cloud.policytroubleshooter.v1.AccessState|null} [access] TroubleshootIamPolicyResponse access * @property {Array.|null} [explainedPolicies] TroubleshootIamPolicyResponse explainedPolicies + * @property {Array.|null} [errors] TroubleshootIamPolicyResponse errors */ /** @@ -362,6 +363,7 @@ */ function TroubleshootIamPolicyResponse(properties) { this.explainedPolicies = []; + this.errors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -384,6 +386,14 @@ */ TroubleshootIamPolicyResponse.prototype.explainedPolicies = $util.emptyArray; + /** + * TroubleshootIamPolicyResponse errors. + * @member {Array.} errors + * @memberof google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse + * @instance + */ + TroubleshootIamPolicyResponse.prototype.errors = $util.emptyArray; + /** * Creates a new TroubleshootIamPolicyResponse instance using the specified properties. * @function create @@ -413,6 +423,9 @@ if (message.explainedPolicies != null && message.explainedPolicies.length) for (var i = 0; i < message.explainedPolicies.length; ++i) $root.google.cloud.policytroubleshooter.v1.ExplainedPolicy.encode(message.explainedPolicies[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.errors != null && message.errors.length) + for (var i = 0; i < message.errors.length; ++i) + $root.google.rpc.Status.encode(message.errors[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -457,6 +470,12 @@ message.explainedPolicies.push($root.google.cloud.policytroubleshooter.v1.ExplainedPolicy.decode(reader, reader.uint32())); break; } + case 3: { + if (!(message.errors && message.errors.length)) + message.errors = []; + message.errors.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -512,6 +531,15 @@ return "explainedPolicies." + error; } } + if (message.errors != null && message.hasOwnProperty("errors")) { + if (!Array.isArray(message.errors)) + return "errors: array expected"; + for (var i = 0; i < message.errors.length; ++i) { + var error = $root.google.rpc.Status.verify(message.errors[i]); + if (error) + return "errors." + error; + } + } return null; }; @@ -565,6 +593,16 @@ message.explainedPolicies[i] = $root.google.cloud.policytroubleshooter.v1.ExplainedPolicy.fromObject(object.explainedPolicies[i]); } } + if (object.errors) { + if (!Array.isArray(object.errors)) + throw TypeError(".google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse.errors: array expected"); + message.errors = []; + for (var i = 0; i < object.errors.length; ++i) { + if (typeof object.errors[i] !== "object") + throw TypeError(".google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse.errors: object expected"); + message.errors[i] = $root.google.rpc.Status.fromObject(object.errors[i]); + } + } return message; }; @@ -581,8 +619,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.explainedPolicies = []; + object.errors = []; + } if (options.defaults) object.access = options.enums === String ? "ACCESS_STATE_UNSPECIFIED" : 0; if (message.access != null && message.hasOwnProperty("access")) @@ -592,6 +632,11 @@ for (var j = 0; j < message.explainedPolicies.length; ++j) object.explainedPolicies[j] = $root.google.cloud.policytroubleshooter.v1.ExplainedPolicy.toObject(message.explainedPolicies[j], options); } + if (message.errors && message.errors.length) { + object.errors = []; + for (var j = 0; j < message.errors.length; ++j) + object.errors[j] = $root.google.rpc.Status.toObject(message.errors[j], options); + } return object; }; @@ -1753,6 +1798,44 @@ return typeUrlPrefix + "/google.cloud.policytroubleshooter.v1.BindingExplanation"; }; + /** + * RolePermission enum. + * @name google.cloud.policytroubleshooter.v1.BindingExplanation.RolePermission + * @enum {number} + * @property {number} ROLE_PERMISSION_UNSPECIFIED=0 ROLE_PERMISSION_UNSPECIFIED value + * @property {number} ROLE_PERMISSION_INCLUDED=1 ROLE_PERMISSION_INCLUDED value + * @property {number} ROLE_PERMISSION_NOT_INCLUDED=2 ROLE_PERMISSION_NOT_INCLUDED value + * @property {number} ROLE_PERMISSION_UNKNOWN_INFO_DENIED=3 ROLE_PERMISSION_UNKNOWN_INFO_DENIED value + */ + BindingExplanation.RolePermission = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ROLE_PERMISSION_UNSPECIFIED"] = 0; + values[valuesById[1] = "ROLE_PERMISSION_INCLUDED"] = 1; + values[valuesById[2] = "ROLE_PERMISSION_NOT_INCLUDED"] = 2; + values[valuesById[3] = "ROLE_PERMISSION_UNKNOWN_INFO_DENIED"] = 3; + return values; + })(); + + /** + * Membership enum. + * @name google.cloud.policytroubleshooter.v1.BindingExplanation.Membership + * @enum {number} + * @property {number} MEMBERSHIP_UNSPECIFIED=0 MEMBERSHIP_UNSPECIFIED value + * @property {number} MEMBERSHIP_INCLUDED=1 MEMBERSHIP_INCLUDED value + * @property {number} MEMBERSHIP_NOT_INCLUDED=2 MEMBERSHIP_NOT_INCLUDED value + * @property {number} MEMBERSHIP_UNKNOWN_INFO_DENIED=3 MEMBERSHIP_UNKNOWN_INFO_DENIED value + * @property {number} MEMBERSHIP_UNKNOWN_UNSUPPORTED=4 MEMBERSHIP_UNKNOWN_UNSUPPORTED value + */ + BindingExplanation.Membership = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MEMBERSHIP_UNSPECIFIED"] = 0; + values[valuesById[1] = "MEMBERSHIP_INCLUDED"] = 1; + values[valuesById[2] = "MEMBERSHIP_NOT_INCLUDED"] = 2; + values[valuesById[3] = "MEMBERSHIP_UNKNOWN_INFO_DENIED"] = 3; + values[valuesById[4] = "MEMBERSHIP_UNKNOWN_UNSUPPORTED"] = 4; + return values; + })(); + BindingExplanation.AnnotatedMembership = (function() { /** @@ -2038,44 +2121,6 @@ return AnnotatedMembership; })(); - /** - * RolePermission enum. - * @name google.cloud.policytroubleshooter.v1.BindingExplanation.RolePermission - * @enum {number} - * @property {number} ROLE_PERMISSION_UNSPECIFIED=0 ROLE_PERMISSION_UNSPECIFIED value - * @property {number} ROLE_PERMISSION_INCLUDED=1 ROLE_PERMISSION_INCLUDED value - * @property {number} ROLE_PERMISSION_NOT_INCLUDED=2 ROLE_PERMISSION_NOT_INCLUDED value - * @property {number} ROLE_PERMISSION_UNKNOWN_INFO_DENIED=3 ROLE_PERMISSION_UNKNOWN_INFO_DENIED value - */ - BindingExplanation.RolePermission = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ROLE_PERMISSION_UNSPECIFIED"] = 0; - values[valuesById[1] = "ROLE_PERMISSION_INCLUDED"] = 1; - values[valuesById[2] = "ROLE_PERMISSION_NOT_INCLUDED"] = 2; - values[valuesById[3] = "ROLE_PERMISSION_UNKNOWN_INFO_DENIED"] = 3; - return values; - })(); - - /** - * Membership enum. - * @name google.cloud.policytroubleshooter.v1.BindingExplanation.Membership - * @enum {number} - * @property {number} MEMBERSHIP_UNSPECIFIED=0 MEMBERSHIP_UNSPECIFIED value - * @property {number} MEMBERSHIP_INCLUDED=1 MEMBERSHIP_INCLUDED value - * @property {number} MEMBERSHIP_NOT_INCLUDED=2 MEMBERSHIP_NOT_INCLUDED value - * @property {number} MEMBERSHIP_UNKNOWN_INFO_DENIED=3 MEMBERSHIP_UNKNOWN_INFO_DENIED value - * @property {number} MEMBERSHIP_UNKNOWN_UNSUPPORTED=4 MEMBERSHIP_UNKNOWN_UNSUPPORTED value - */ - BindingExplanation.Membership = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MEMBERSHIP_UNSPECIFIED"] = 0; - values[valuesById[1] = "MEMBERSHIP_INCLUDED"] = 1; - values[valuesById[2] = "MEMBERSHIP_NOT_INCLUDED"] = 2; - values[valuesById[3] = "MEMBERSHIP_UNKNOWN_INFO_DENIED"] = 3; - values[valuesById[4] = "MEMBERSHIP_UNKNOWN_UNSUPPORTED"] = 4; - return values; - })(); - return BindingExplanation; })(); @@ -12405,6 +12450,242 @@ return GeneratedCodeInfo; })(); + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(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]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.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.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + + return Any; + })(); + return protobuf; })(); @@ -14753,6 +15034,290 @@ return type; })(); + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + 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]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.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.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) + return object; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof google.rpc.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.rpc.Status"; + }; + + return Status; + })(); + + return rpc; + })(); + return google; })(); diff --git a/packages/google-cloud-policytroubleshooter/protos/protos.json b/packages/google-cloud-policytroubleshooter/protos/protos.json index 485a6773577..12550c6afc4 100644 --- a/packages/google-cloud-policytroubleshooter/protos/protos.json +++ b/packages/google-cloud-policytroubleshooter/protos/protos.json @@ -60,6 +60,11 @@ "rule": "repeated", "type": "ExplainedPolicy", "id": 2 + }, + "errors": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 3 } } }, @@ -149,18 +154,6 @@ } }, "nested": { - "AnnotatedMembership": { - "fields": { - "membership": { - "type": "Membership", - "id": 1 - }, - "relevance": { - "type": "HeuristicRelevance", - "id": 2 - } - } - }, "RolePermission": { "values": { "ROLE_PERMISSION_UNSPECIFIED": 0, @@ -177,6 +170,18 @@ "MEMBERSHIP_UNKNOWN_INFO_DENIED": 3, "MEMBERSHIP_UNKNOWN_UNSUPPORTED": 4 } + }, + "AnnotatedMembership": { + "fields": { + "membership": { + "type": "Membership", + "id": 1 + }, + "relevance": { + "type": "HeuristicRelevance", + "id": 2 + } + } } } }, @@ -1265,6 +1270,18 @@ } } } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } } } }, @@ -1462,6 +1479,35 @@ } } } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } } } } diff --git a/packages/google-cloud-policytroubleshooter/samples/README.md b/packages/google-cloud-policytroubleshooter/samples/README.md index 223b92d392e..ef9fc82f66d 100644 --- a/packages/google-cloud-policytroubleshooter/samples/README.md +++ b/packages/google-cloud-policytroubleshooter/samples/README.md @@ -14,7 +14,6 @@ * [Samples](#samples) * [Iam_checker.troubleshoot_iam_policy](#iam_checker.troubleshoot_iam_policy) * [Quickstart](#quickstart) - * [Quickstart](#quickstart) ## Before you begin @@ -60,23 +59,6 @@ __Usage:__ `node packages/google-cloud-policytroubleshooter/samples/quickstart.js` ------ - - - - -### Quickstart - -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-policytroubleshooter/samples/test/quickstart.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-policytroubleshooter/samples/test/quickstart.js,samples/README.md) - -__Usage:__ - - -`node packages/google-cloud-policytroubleshooter/samples/test/quickstart.js` - - diff --git a/packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js b/packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js index bc585e6ccf8..81f3d5f5e0e 100644 --- a/packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js +++ b/packages/google-cloud-policytroubleshooter/samples/generated/v1/iam_checker.troubleshoot_iam_policy.js @@ -29,8 +29,8 @@ function main() { * TODO(developer): Uncomment these variables before running the sample. */ /** - * The information to use for checking whether a member has a permission for a - * resource. + * The information to use for checking whether a principal has a permission + * for a resource. */ // const accessTuple = {} diff --git a/packages/google-cloud-policytroubleshooter/samples/generated/v1/snippet_metadata.google.cloud.policytroubleshooter.v1.json b/packages/google-cloud-policytroubleshooter/samples/generated/v1/snippet_metadata.google.cloud.policytroubleshooter.v1.json index a3853a408a7..e407feec6fa 100644 --- a/packages/google-cloud-policytroubleshooter/samples/generated/v1/snippet_metadata.google.cloud.policytroubleshooter.v1.json +++ b/packages/google-cloud-policytroubleshooter/samples/generated/v1/snippet_metadata.google.cloud.policytroubleshooter.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-policytroubleshooter", - "version": "2.0.6", + "version": "2.0.8", "language": "TYPESCRIPT", "apis": [ { @@ -15,7 +15,7 @@ "regionTag": "policytroubleshooter_v1_generated_IamChecker_TroubleshootIamPolicy_async", "title": "IamChecker troubleshootIamPolicy Sample", "origin": "API_DEFINITION", - "description": " Checks whether a member has a specific permission for a specific resource, and explains why the member does or does not have that permission.", + "description": " Checks whether a principal has a specific permission for a specific resource, and explains why the principal does or does not have that permission.", "canonical": true, "file": "iam_checker.troubleshoot_iam_policy.js", "language": "JAVASCRIPT", diff --git a/packages/google-cloud-policytroubleshooter/src/v1/iam_checker_client.ts b/packages/google-cloud-policytroubleshooter/src/v1/iam_checker_client.ts index 75ef1980eb1..d9232ccb8c7 100644 --- a/packages/google-cloud-policytroubleshooter/src/v1/iam_checker_client.ts +++ b/packages/google-cloud-policytroubleshooter/src/v1/iam_checker_client.ts @@ -306,14 +306,15 @@ export class IamCheckerClient { // -- Service calls -- // ------------------- /** - * Checks whether a member has a specific permission for a specific resource, - * and explains why the member does or does not have that permission. + * Checks whether a principal has a specific permission for a specific + * resource, and explains why the principal does or does not have that + * permission. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.policytroubleshooter.v1.AccessTuple} request.accessTuple - * The information to use for checking whether a member has a permission for a - * resource. + * The information to use for checking whether a principal has a permission + * for a resource. * @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.