From 2f896c4fc347823549bd0b38df39fa30c25663bc Mon Sep 17 00:00:00 2001 From: Xiaozhen Liu Date: Wed, 20 May 2020 14:46:29 -0700 Subject: [PATCH] feat: add `SearchAllResources` and `SearchAllIamPolicies` rpcs in asset service proto (#332) * run compile protos * fix from package.json --- package.json | 2 +- .../google/cloud/asset/v1/asset_service.proto | 212 +- protos/google/cloud/asset/v1/assets.proto | 164 +- protos/protos.d.ts | 1322 +++++- protos/protos.js | 3619 +++++++++++++---- protos/protos.json | 209 + src/v1/asset_service_client.ts | 716 +++- src/v1/asset_service_client_config.json | 8 + synth.metadata | 10 +- test/gapic_asset_service_v1.ts | 697 ++++ 10 files changed, 6009 insertions(+), 950 deletions(-) diff --git a/package.json b/package.json index c3d5a742..1f78da5f 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "fix": "gts fix", "lint": "gts check", "predocs-test": "npm run docs", - "prepare": "npm run compile", + "prepare": "npm run compile-protos && npm run compile", "system-test": "c8 mocha build/system-test", "test": "c8 mocha build/test", "prelint": "cd samples; npm link ../; npm install", diff --git a/protos/google/cloud/asset/v1/asset_service.proto b/protos/google/cloud/asset/v1/asset_service.proto index 9c7b16d0..0eab6efd 100644 --- a/protos/google/cloud/asset/v1/asset_service.proto +++ b/protos/google/cloud/asset/v1/asset_service.proto @@ -37,12 +37,14 @@ option php_namespace = "Google\\Cloud\\Asset\\V1"; // Asset service definition. service AssetService { option (google.api.default_host) = "cloudasset.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"; // Exports assets with time and resource types to a given Cloud Storage // location. The output format is newline-delimited JSON. - // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you - // to keep track of the export. + // This API implements the + // [google.longrunning.Operation][google.longrunning.Operation] API allowing + // you to keep track of the export. rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1/{parent=*/*}:exportAssets" @@ -61,7 +63,8 @@ service AssetService { // attached IAM POLICY both exist. This can create gaps in the output history. // If a specified asset does not exist, this API returns an INVALID_ARGUMENT // error. - rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) { + rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) + returns (BatchGetAssetsHistoryResponse) { option (google.api.http) = { get: "/v1/{parent=*/*}:batchGetAssetsHistory" }; @@ -109,6 +112,30 @@ service AssetService { }; option (google.api.method_signature) = "name"; } + + // Searches all the resources within the given accessible scope (e.g., a + // project, a folder or an organization). Callers should have + // cloud.assets.SearchAllResources permission upon the requested scope, + // otherwise the request will be rejected. + rpc SearchAllResources(SearchAllResourcesRequest) + returns (SearchAllResourcesResponse) { + option (google.api.http) = { + get: "/v1/{scope=*/*}:searchAllResources" + }; + option (google.api.method_signature) = "scope,query,asset_types"; + } + + // Searches all the IAM policies within the given accessible scope (e.g., a + // project, a folder or an organization). Callers should have + // cloud.assets.SearchAllIamPolicies permission upon the requested scope, + // otherwise the request will be rejected. + rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) + returns (SearchAllIamPoliciesResponse) { + option (google.api.http) = { + get: "/v1/{scope=*/*}:searchAllIamPolicies" + }; + option (google.api.method_signature) = "scope,query"; + } } // Export asset request. @@ -148,8 +175,10 @@ message ExportAssetsRequest { } // The export asset response. This message is returned by the -// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned -// [google.longrunning.Operation.response][google.longrunning.Operation.response] field. +// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] +// method in the returned +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field. message ExportAssetsResponse { // Time the snapshot was taken. google.protobuf.Timestamp read_time = 1; @@ -214,9 +243,8 @@ message CreateFeedRequest { // be unique under a specific parent project/folder/organization. string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; - // Required. The feed details. The field `name` must be empty and it will be generated - // in the format of: - // projects/project_number/feeds/feed_id + // Required. The feed details. The field `name` must be empty and it will be + // generated in the format of: projects/project_number/feeds/feed_id // folders/folder_number/feeds/feed_id // organizations/organization_number/feeds/feed_id Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; @@ -230,9 +258,7 @@ message GetFeedRequest { // organizations/organization_number/feeds/feed_id string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } + (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } ]; } @@ -251,8 +277,8 @@ message ListFeedsResponse { // Update asset feed request. message UpdateFeedRequest { - // Required. The new values of feed details. It must match an existing feed and the - // field `name` must be in the format of: + // Required. The new values of feed details. It must match an existing feed + // and the field `name` must be in the format of: // projects/project_number/feeds/feed_id or // folders/folder_number/feeds/feed_id or // organizations/organization_number/feeds/feed_id. @@ -261,7 +287,8 @@ message UpdateFeedRequest { // Required. Only updates the `feed` fields indicated by this mask. // The field mask must not be empty, and it must not contain fields that // are immutable or only set by the server. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; } message DeleteFeedRequest { @@ -271,9 +298,7 @@ message DeleteFeedRequest { // organizations/organization_number/feeds/feed_id string name = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } + (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } ]; } @@ -401,7 +426,156 @@ message Feed { // Required. Feed output configuration defining where the asset updates are // published to. - FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED]; + FeedOutputConfig feed_output_config = 5 + [(google.api.field_behavior) = REQUIRED]; +} + +// Search all resources request. +message SearchAllResourcesRequest { + // Required. A scope can be a project, a folder or an organization. The search + // is limited to the resources within the `scope`. + // + // The allowed values are: + // + // * projects/{PROJECT_ID} + // * projects/{PROJECT_NUMBER} + // * folders/{FOLDER_NUMBER} + // * organizations/{ORGANIZATION_NUMBER} + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. An empty query can be specified to search + // all the resources of certain `asset_types` within the given `scope`. + // + // Examples: + // + // * `name : "Important"` to find Cloud resources whose name contains + // "Important" as a word. + // * `displayName : "Impor*"` to find Cloud resources whose display name + // contains "Impor" as a word prefix. + // * `description : "*por*"` to find Cloud resources whose description + // contains "por" as a substring. + // * `location : "us-west*"` to find Cloud resources whose location is + // prefixed with "us-west". + // * `labels : "prod"` to find Cloud resources whose labels contain "prod" as + // a key or value. + // * `labels.env : "prod"` to find Cloud resources which have a label "env" + // and its value is "prod". + // * `labels.env : *` to find Cloud resources which have a label "env". + // * `"Important"` to find Cloud resources which contain "Important" as a word + // in any of the searchable fields. + // * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix + // in any of the searchable fields. + // * `"*por*"` to find Cloud resources which contain "por" as a substring in + // any of the searchable fields. + // * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud + // resources which contain "Important" as a word in any of the searchable + // fields and are also located in the "us-west1" region or the "global" + // location. + // + // See [how to construct a + // query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + // for more details. + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of asset types that this request searches for. If empty, + // it will search all the [searchable asset + // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). + repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page size for search result pagination. Page size is capped + // at 500 even if a larger value is given. If set to zero, server will pick an + // appropriate default. Returned results may be fewer than requested. When + // this happens, there could be more results as long as `next_page_token` is + // returned. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, then retrieve the next batch of results from the + // preceding call to this method. `page_token` must be the value of + // `next_page_token` from the previous response. The values of all other + // method parameters, must be identical to those in the previous call. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A comma separated list of fields specifying the sorting order of + // the results. The default order is ascending. Add " DESC" after the field + // name to indicate descending order. Redundant space characters are ignored. + // Example: "location DESC, name". See [supported resource metadata + // fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields) + // for more details. + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all resources response. +message SearchAllResourcesResponse { + // A list of Resources that match the search query. It contains the resource + // standard metadata information. + repeated ResourceSearchResult results = 1; + + // If there are more results than those appearing in this response, then + // `next_page_token` is included. To get the next set of results, call this + // method again using the value of `next_page_token` as `page_token`. + string next_page_token = 2; +} + +// Search all IAM policies request. +message SearchAllIamPoliciesRequest { + // Required. A scope can be a project, a folder or an organization. The search + // is limited to the IAM policies within the `scope`. + // + // The allowed values are: + // + // * projects/{PROJECT_ID} + // * projects/{PROJECT_NUMBER} + // * folders/{FOLDER_NUMBER} + // * organizations/{ORGANIZATION_NUMBER} + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. An empty query can be specified to search + // all the IAM policies within the given `scope`. + // + // Examples: + // + // * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that + // specify user "amy@gmail.com". + // * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that + // specify the Compute Admin role. + // * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM + // policy bindings that specify a role containing "storage.buckets.update" + // permission. + // * `resource : "organizations/123"` to find Cloud IAM policy bindings that + // are set on "organizations/123". + // * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")` + // to find Cloud IAM policy bindings that are set on "organizations/123" or + // "folders/1234", and also specify user "amy". + // + // See [how to construct a + // query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) + // for more details. + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The page size for search result pagination. Page size is capped + // at 500 even if a larger value is given. If set to zero, server will pick an + // appropriate default. Returned results may be fewer than requested. When + // this happens, there could be more results as long as `next_page_token` is + // returned. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, retrieve the next batch of results from the preceding + // call to this method. `page_token` must be the value of `next_page_token` + // from the previous response. The values of all other method parameters must + // be identical to those in the previous call. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all IAM policies response. +message SearchAllIamPoliciesResponse { + // A list of IamPolicy that match the search query. Related information such + // as the associated resource is returned along with the policy. + repeated IamPolicySearchResult results = 1; + + // Set if there are more results than those appearing in this response; to get + // the next set of results, call this method again, using this value as the + // `page_token`. + string next_page_token = 2; } // Asset content type. diff --git a/protos/google/cloud/asset/v1/assets.proto b/protos/google/cloud/asset/v1/assets.proto index 1e8b40a1..4e537d5c 100644 --- a/protos/google/cloud/asset/v1/assets.proto +++ b/protos/google/cloud/asset/v1/assets.proto @@ -16,6 +16,7 @@ syntax = "proto3"; package google.cloud.asset.v1; +import "google/api/annotations.proto"; import "google/api/resource.proto"; import "google/cloud/orgpolicy/v1/orgpolicy.proto"; import "google/iam/v1/policy.proto"; @@ -25,7 +26,6 @@ import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; import "google/protobuf/any.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Asset.V1"; @@ -111,7 +111,8 @@ message Asset { google.identity.accesscontextmanager.v1.AccessLevel access_level = 8; - google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = 9; + google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = + 9; } // The ancestry path of an asset in Google Cloud [resource @@ -169,4 +170,163 @@ message Resource { // The content of the resource, in which some sensitive fields are removed // and may not be present. google.protobuf.Struct data = 6; + + // The location of the resource in Google Cloud, such as its zone and region. + // For more information, see https://cloud.google.com/about/locations/. + string location = 8; +} + +// A result of Resource Search, containing information of a cloud resoure. +message ResourceSearchResult { + // The full resource name of this resource. Example: + // "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1". + // See [Cloud Asset Inventory Resource Name + // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // for more information. + // + // To search against the `name`: + // + // * use a field query. Example: `name : "instance1"` + // * use a free text query. Example: `"instance1"` + string name = 1; + + // The type of this resource. Example: "compute.googleapis.com/Disk". + // + // To search against the `asset_type`: + // + // * specify the `asset_type` field in your search request. + string asset_type = 2; + + // The project that this resource belongs to, in the form of + // projects/{PROJECT_NUMBER}. + // + // To search against the `project`: + // + // * specify the `scope` field as this project in your search request. + string project = 3; + + // The display name of this resource. + // + // To search against the `display_name`: + // + // * use a field query. Example: `displayName : "My Instance"` + // * use a free text query. Example: `"My Instance"` + string display_name = 4; + + // One or more paragraphs of text description of this resource. Maximum length + // could be up to 1M bytes. + // + // To search against the `description`: + // + // * use a field query. Example: `description : "*important instance*"` + // * use a free text query. Example: `"*important instance*"` + string description = 5; + + // Location can be "global", regional like "us-east1", or zonal like + // "us-west1-b". + // + // To search against the `location`: + // + // * use a field query. Example: `location : "us-west*"` + // * use a free text query. Example: `"us-west*"` + string location = 6; + + // Labels associated with this resource. See [Labelling and grouping GCP + // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) + // for more information. + // + // To search against the `labels`: + // + // * use a field query, as following: + // - query on any label's key or value. Example: `labels : "prod"` + // - query by a given label. Example: `labels.env : "prod"` + // - query by a given label'sexistence. Example: `labels.env : *` + // * use a free text query. Example: `"prod"` + map labels = 7; + + // Network tags associated with this resource. Like labels, network tags are a + // type of annotations used to group GCP resources. See [Labelling GCP + // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) + // for more information. + // + // To search against the `network_tags`: + // + // * use a field query. Example: `networkTags : "internal"` + // * use a free text query. Example: `"internal"` + repeated string network_tags = 8; + + // The additional attributes of this resource. The attributes may vary from + // one resource type to another. Examples: "projectId" for Project, + // "dnsName" for DNS ManagedZone. + // + // To search against the `additional_attributes`: + // + // * use a free text query to match the attributes values. Example: to search + // additional_attributes = { dnsName: "foobar" }, you can issue a query + // `"foobar"`. + google.protobuf.Struct additional_attributes = 9; +} + +// A result of IAM Policy search, containing information of an IAM policy. +message IamPolicySearchResult { + // Explanation about the IAM policy search result. + message Explanation { + // IAM permissions + message Permissions { + // A list of permissions. A sample permission string: "compute.disk.get". + repeated string permissions = 1; + } + + // The map from roles to their included permissions that match the + // permission query (i.e., a query containing `policy.role.permissions:`). + // Example: if query `policy.role.permissions : "compute.disk.get"` + // matches a policy binding that contains owner role, the + // matched_permissions will be {"roles/owner": ["compute.disk.get"]}. The + // roles can also be found in the returned `policy` bindings. Note that the + // map is populated only for requests with permission queries. + map matched_permissions = 1; + } + + // The full resource name of the resource associated with this IAM policy. + // Example: + // "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1". + // See [Cloud Asset Inventory Resource Name + // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // for more information. + // + // To search against the `resource`: + // + // * use a field query. Example: `resource : "organizations/123"` + string resource = 1; + + // The project that the associated GCP resource belongs to, in the form of + // projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource (like VM + // instance, Cloud Storage bucket), the project field will indicate the + // project that contains the resource. If an IAM policy is set on a folder or + // orgnization, the project field will be empty. + // + // To search against the `project`: + // + // * specify the `scope` field as this project in your search request. + string project = 2; + + // The IAM policy directly set on the given resource. Note that the original + // IAM policy can contain multiple bindings. This only contains the bindings + // that match the given query. For queries that don't contain a constrain on + // policies (e.g., an empty query), this contains all the bindings. + // + // To search against the `policy` bindings: + // + // * use a field query, as following: + // - query by the policy contained members. Example: + // `policy : "amy@gmail.com"` + // - query by the policy contained roles. Example: + // `policy : "roles/compute.admin"` + // - query by the policy contained roles' implied permissions. Example: + // `policy.role.permissions : "compute.instances.create"` + google.iam.v1.Policy policy = 3; + + // Explanation about the IAM policy search result. It contains additional + // information to explain why the search result matches the query. + Explanation explanation = 4; } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 5ab4595f..734e82f0 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -143,6 +143,34 @@ export namespace google { * @returns Promise */ public deleteFeed(request: google.cloud.asset.v1.IDeleteFeedRequest): Promise; + + /** + * Calls SearchAllResources. + * @param request SearchAllResourcesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchAllResourcesResponse + */ + public searchAllResources(request: google.cloud.asset.v1.ISearchAllResourcesRequest, callback: google.cloud.asset.v1.AssetService.SearchAllResourcesCallback): void; + + /** + * Calls SearchAllResources. + * @param request SearchAllResourcesRequest message or plain object + * @returns Promise + */ + public searchAllResources(request: google.cloud.asset.v1.ISearchAllResourcesRequest): Promise; + + /** + * Calls SearchAllIamPolicies. + * @param request SearchAllIamPoliciesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchAllIamPoliciesResponse + */ + public searchAllIamPolicies(request: google.cloud.asset.v1.ISearchAllIamPoliciesRequest, callback: google.cloud.asset.v1.AssetService.SearchAllIamPoliciesCallback): void; + + /** + * Calls SearchAllIamPolicies. + * @param request SearchAllIamPoliciesRequest message or plain object + * @returns Promise + */ + public searchAllIamPolicies(request: google.cloud.asset.v1.ISearchAllIamPoliciesRequest): Promise; } namespace AssetService { @@ -195,6 +223,20 @@ export namespace google { * @param [response] Empty */ type DeleteFeedCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.asset.v1.AssetService#searchAllResources}. + * @param error Error, if any + * @param [response] SearchAllResourcesResponse + */ + type SearchAllResourcesCallback = (error: (Error|null), response?: google.cloud.asset.v1.SearchAllResourcesResponse) => void; + + /** + * Callback as used by {@link google.cloud.asset.v1.AssetService#searchAllIamPolicies}. + * @param error Error, if any + * @param [response] SearchAllIamPoliciesResponse + */ + type SearchAllIamPoliciesCallback = (error: (Error|null), response?: google.cloud.asset.v1.SearchAllIamPoliciesResponse) => void; } /** Properties of an ExportAssetsRequest. */ @@ -1760,473 +1802,1331 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** ContentType enum. */ - enum ContentType { - CONTENT_TYPE_UNSPECIFIED = 0, - RESOURCE = 1, - IAM_POLICY = 2, - ORG_POLICY = 4, - ACCESS_POLICY = 5 - } + /** Properties of a SearchAllResourcesRequest. */ + interface ISearchAllResourcesRequest { - /** Properties of a TemporalAsset. */ - interface ITemporalAsset { + /** SearchAllResourcesRequest scope */ + scope?: (string|null); - /** TemporalAsset window */ - window?: (google.cloud.asset.v1.ITimeWindow|null); + /** SearchAllResourcesRequest query */ + query?: (string|null); - /** TemporalAsset deleted */ - deleted?: (boolean|null); + /** SearchAllResourcesRequest assetTypes */ + assetTypes?: (string[]|null); - /** TemporalAsset asset */ - asset?: (google.cloud.asset.v1.IAsset|null); + /** SearchAllResourcesRequest pageSize */ + pageSize?: (number|null); + + /** SearchAllResourcesRequest pageToken */ + pageToken?: (string|null); + + /** SearchAllResourcesRequest orderBy */ + orderBy?: (string|null); } - /** Represents a TemporalAsset. */ - class TemporalAsset implements ITemporalAsset { + /** Represents a SearchAllResourcesRequest. */ + class SearchAllResourcesRequest implements ISearchAllResourcesRequest { /** - * Constructs a new TemporalAsset. + * Constructs a new SearchAllResourcesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.asset.v1.ITemporalAsset); + constructor(properties?: google.cloud.asset.v1.ISearchAllResourcesRequest); - /** TemporalAsset window. */ - public window?: (google.cloud.asset.v1.ITimeWindow|null); + /** SearchAllResourcesRequest scope. */ + public scope: string; - /** TemporalAsset deleted. */ - public deleted: boolean; + /** SearchAllResourcesRequest query. */ + public query: string; - /** TemporalAsset asset. */ - public asset?: (google.cloud.asset.v1.IAsset|null); + /** SearchAllResourcesRequest assetTypes. */ + public assetTypes: string[]; + + /** SearchAllResourcesRequest pageSize. */ + public pageSize: number; + + /** SearchAllResourcesRequest pageToken. */ + public pageToken: string; + + /** SearchAllResourcesRequest orderBy. */ + public orderBy: string; /** - * Creates a new TemporalAsset instance using the specified properties. + * Creates a new SearchAllResourcesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns TemporalAsset instance + * @returns SearchAllResourcesRequest instance */ - public static create(properties?: google.cloud.asset.v1.ITemporalAsset): google.cloud.asset.v1.TemporalAsset; + public static create(properties?: google.cloud.asset.v1.ISearchAllResourcesRequest): google.cloud.asset.v1.SearchAllResourcesRequest; /** - * Encodes the specified TemporalAsset message. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. - * @param message TemporalAsset message or plain object to encode + * Encodes the specified SearchAllResourcesRequest message. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesRequest.verify|verify} messages. + * @param message SearchAllResourcesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.asset.v1.ITemporalAsset, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.asset.v1.ISearchAllResourcesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified TemporalAsset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. - * @param message TemporalAsset message or plain object to encode + * Encodes the specified SearchAllResourcesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesRequest.verify|verify} messages. + * @param message SearchAllResourcesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.asset.v1.ITemporalAsset, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.asset.v1.ISearchAllResourcesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a TemporalAsset message from the specified reader or buffer. + * Decodes a SearchAllResourcesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns TemporalAsset + * @returns SearchAllResourcesRequest * @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.cloud.asset.v1.TemporalAsset; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1.SearchAllResourcesRequest; /** - * Decodes a TemporalAsset message from the specified reader or buffer, length delimited. + * Decodes a SearchAllResourcesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns TemporalAsset + * @returns SearchAllResourcesRequest * @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.cloud.asset.v1.TemporalAsset; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1.SearchAllResourcesRequest; /** - * Verifies a TemporalAsset message. + * Verifies a SearchAllResourcesRequest 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 TemporalAsset message from a plain object. Also converts values to their respective internal types. + * Creates a SearchAllResourcesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns TemporalAsset + * @returns SearchAllResourcesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.TemporalAsset; + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.SearchAllResourcesRequest; /** - * Creates a plain object from a TemporalAsset message. Also converts values to other types if specified. - * @param message TemporalAsset + * Creates a plain object from a SearchAllResourcesRequest message. Also converts values to other types if specified. + * @param message SearchAllResourcesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.asset.v1.TemporalAsset, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.asset.v1.SearchAllResourcesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this TemporalAsset to JSON. + * Converts this SearchAllResourcesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a TimeWindow. */ - interface ITimeWindow { + /** Properties of a SearchAllResourcesResponse. */ + interface ISearchAllResourcesResponse { - /** TimeWindow startTime */ - startTime?: (google.protobuf.ITimestamp|null); + /** SearchAllResourcesResponse results */ + results?: (google.cloud.asset.v1.IResourceSearchResult[]|null); - /** TimeWindow endTime */ - endTime?: (google.protobuf.ITimestamp|null); + /** SearchAllResourcesResponse nextPageToken */ + nextPageToken?: (string|null); } - /** Represents a TimeWindow. */ - class TimeWindow implements ITimeWindow { + /** Represents a SearchAllResourcesResponse. */ + class SearchAllResourcesResponse implements ISearchAllResourcesResponse { /** - * Constructs a new TimeWindow. + * Constructs a new SearchAllResourcesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.asset.v1.ITimeWindow); + constructor(properties?: google.cloud.asset.v1.ISearchAllResourcesResponse); - /** TimeWindow startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); + /** SearchAllResourcesResponse results. */ + public results: google.cloud.asset.v1.IResourceSearchResult[]; - /** TimeWindow endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); + /** SearchAllResourcesResponse nextPageToken. */ + public nextPageToken: string; /** - * Creates a new TimeWindow instance using the specified properties. + * Creates a new SearchAllResourcesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns TimeWindow instance + * @returns SearchAllResourcesResponse instance */ - public static create(properties?: google.cloud.asset.v1.ITimeWindow): google.cloud.asset.v1.TimeWindow; + public static create(properties?: google.cloud.asset.v1.ISearchAllResourcesResponse): google.cloud.asset.v1.SearchAllResourcesResponse; /** - * Encodes the specified TimeWindow message. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. - * @param message TimeWindow message or plain object to encode + * Encodes the specified SearchAllResourcesResponse message. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesResponse.verify|verify} messages. + * @param message SearchAllResourcesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.asset.v1.ITimeWindow, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.asset.v1.ISearchAllResourcesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified TimeWindow message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. - * @param message TimeWindow message or plain object to encode + * Encodes the specified SearchAllResourcesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesResponse.verify|verify} messages. + * @param message SearchAllResourcesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.asset.v1.ITimeWindow, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.asset.v1.ISearchAllResourcesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a TimeWindow message from the specified reader or buffer. + * Decodes a SearchAllResourcesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns TimeWindow + * @returns SearchAllResourcesResponse * @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.cloud.asset.v1.TimeWindow; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1.SearchAllResourcesResponse; /** - * Decodes a TimeWindow message from the specified reader or buffer, length delimited. + * Decodes a SearchAllResourcesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns TimeWindow + * @returns SearchAllResourcesResponse * @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.cloud.asset.v1.TimeWindow; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1.SearchAllResourcesResponse; /** - * Verifies a TimeWindow message. + * Verifies a SearchAllResourcesResponse 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 TimeWindow message from a plain object. Also converts values to their respective internal types. + * Creates a SearchAllResourcesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns TimeWindow + * @returns SearchAllResourcesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.TimeWindow; + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.SearchAllResourcesResponse; /** - * Creates a plain object from a TimeWindow message. Also converts values to other types if specified. - * @param message TimeWindow + * Creates a plain object from a SearchAllResourcesResponse message. Also converts values to other types if specified. + * @param message SearchAllResourcesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.asset.v1.TimeWindow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.asset.v1.SearchAllResourcesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this TimeWindow to JSON. + * Converts this SearchAllResourcesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Asset. */ - interface IAsset { + /** Properties of a SearchAllIamPoliciesRequest. */ + interface ISearchAllIamPoliciesRequest { - /** Asset name */ - name?: (string|null); + /** SearchAllIamPoliciesRequest scope */ + scope?: (string|null); - /** Asset assetType */ - assetType?: (string|null); + /** SearchAllIamPoliciesRequest query */ + query?: (string|null); - /** Asset resource */ - resource?: (google.cloud.asset.v1.IResource|null); + /** SearchAllIamPoliciesRequest pageSize */ + pageSize?: (number|null); - /** Asset iamPolicy */ - iamPolicy?: (google.iam.v1.IPolicy|null); + /** SearchAllIamPoliciesRequest pageToken */ + pageToken?: (string|null); + } - /** Asset orgPolicy */ - orgPolicy?: (google.cloud.orgpolicy.v1.IPolicy[]|null); + /** Represents a SearchAllIamPoliciesRequest. */ + class SearchAllIamPoliciesRequest implements ISearchAllIamPoliciesRequest { - /** Asset accessPolicy */ - accessPolicy?: (google.identity.accesscontextmanager.v1.IAccessPolicy|null); + /** + * Constructs a new SearchAllIamPoliciesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.ISearchAllIamPoliciesRequest); - /** Asset accessLevel */ - accessLevel?: (google.identity.accesscontextmanager.v1.IAccessLevel|null); + /** SearchAllIamPoliciesRequest scope. */ + public scope: string; - /** Asset servicePerimeter */ - servicePerimeter?: (google.identity.accesscontextmanager.v1.IServicePerimeter|null); + /** SearchAllIamPoliciesRequest query. */ + public query: string; - /** Asset ancestors */ - ancestors?: (string[]|null); - } + /** SearchAllIamPoliciesRequest pageSize. */ + public pageSize: number; - /** Represents an Asset. */ - class Asset implements IAsset { + /** SearchAllIamPoliciesRequest pageToken. */ + public pageToken: string; /** - * Constructs a new Asset. + * Creates a new SearchAllIamPoliciesRequest instance using the specified properties. * @param [properties] Properties to set + * @returns SearchAllIamPoliciesRequest instance */ - constructor(properties?: google.cloud.asset.v1.IAsset); - - /** Asset name. */ - public name: string; + public static create(properties?: google.cloud.asset.v1.ISearchAllIamPoliciesRequest): google.cloud.asset.v1.SearchAllIamPoliciesRequest; - /** Asset assetType. */ - public assetType: string; + /** + * Encodes the specified SearchAllIamPoliciesRequest message. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesRequest.verify|verify} messages. + * @param message SearchAllIamPoliciesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.ISearchAllIamPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - /** Asset resource. */ + /** + * Encodes the specified SearchAllIamPoliciesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesRequest.verify|verify} messages. + * @param message SearchAllIamPoliciesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.ISearchAllIamPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchAllIamPoliciesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchAllIamPoliciesRequest + * @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.cloud.asset.v1.SearchAllIamPoliciesRequest; + + /** + * Decodes a SearchAllIamPoliciesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchAllIamPoliciesRequest + * @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.cloud.asset.v1.SearchAllIamPoliciesRequest; + + /** + * Verifies a SearchAllIamPoliciesRequest 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 SearchAllIamPoliciesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchAllIamPoliciesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.SearchAllIamPoliciesRequest; + + /** + * Creates a plain object from a SearchAllIamPoliciesRequest message. Also converts values to other types if specified. + * @param message SearchAllIamPoliciesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.SearchAllIamPoliciesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchAllIamPoliciesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SearchAllIamPoliciesResponse. */ + interface ISearchAllIamPoliciesResponse { + + /** SearchAllIamPoliciesResponse results */ + results?: (google.cloud.asset.v1.IIamPolicySearchResult[]|null); + + /** SearchAllIamPoliciesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a SearchAllIamPoliciesResponse. */ + class SearchAllIamPoliciesResponse implements ISearchAllIamPoliciesResponse { + + /** + * Constructs a new SearchAllIamPoliciesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.ISearchAllIamPoliciesResponse); + + /** SearchAllIamPoliciesResponse results. */ + public results: google.cloud.asset.v1.IIamPolicySearchResult[]; + + /** SearchAllIamPoliciesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new SearchAllIamPoliciesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchAllIamPoliciesResponse instance + */ + public static create(properties?: google.cloud.asset.v1.ISearchAllIamPoliciesResponse): google.cloud.asset.v1.SearchAllIamPoliciesResponse; + + /** + * Encodes the specified SearchAllIamPoliciesResponse message. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesResponse.verify|verify} messages. + * @param message SearchAllIamPoliciesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.ISearchAllIamPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchAllIamPoliciesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesResponse.verify|verify} messages. + * @param message SearchAllIamPoliciesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.ISearchAllIamPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchAllIamPoliciesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchAllIamPoliciesResponse + * @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.cloud.asset.v1.SearchAllIamPoliciesResponse; + + /** + * Decodes a SearchAllIamPoliciesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchAllIamPoliciesResponse + * @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.cloud.asset.v1.SearchAllIamPoliciesResponse; + + /** + * Verifies a SearchAllIamPoliciesResponse 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 SearchAllIamPoliciesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchAllIamPoliciesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.SearchAllIamPoliciesResponse; + + /** + * Creates a plain object from a SearchAllIamPoliciesResponse message. Also converts values to other types if specified. + * @param message SearchAllIamPoliciesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.SearchAllIamPoliciesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchAllIamPoliciesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** ContentType enum. */ + enum ContentType { + CONTENT_TYPE_UNSPECIFIED = 0, + RESOURCE = 1, + IAM_POLICY = 2, + ORG_POLICY = 4, + ACCESS_POLICY = 5 + } + + /** Properties of a TemporalAsset. */ + interface ITemporalAsset { + + /** TemporalAsset window */ + window?: (google.cloud.asset.v1.ITimeWindow|null); + + /** TemporalAsset deleted */ + deleted?: (boolean|null); + + /** TemporalAsset asset */ + asset?: (google.cloud.asset.v1.IAsset|null); + } + + /** Represents a TemporalAsset. */ + class TemporalAsset implements ITemporalAsset { + + /** + * Constructs a new TemporalAsset. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.ITemporalAsset); + + /** TemporalAsset window. */ + public window?: (google.cloud.asset.v1.ITimeWindow|null); + + /** TemporalAsset deleted. */ + public deleted: boolean; + + /** TemporalAsset asset. */ + public asset?: (google.cloud.asset.v1.IAsset|null); + + /** + * Creates a new TemporalAsset instance using the specified properties. + * @param [properties] Properties to set + * @returns TemporalAsset instance + */ + public static create(properties?: google.cloud.asset.v1.ITemporalAsset): google.cloud.asset.v1.TemporalAsset; + + /** + * Encodes the specified TemporalAsset message. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. + * @param message TemporalAsset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.ITemporalAsset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TemporalAsset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. + * @param message TemporalAsset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.ITemporalAsset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TemporalAsset message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TemporalAsset + * @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.cloud.asset.v1.TemporalAsset; + + /** + * Decodes a TemporalAsset message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TemporalAsset + * @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.cloud.asset.v1.TemporalAsset; + + /** + * Verifies a TemporalAsset 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 TemporalAsset message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TemporalAsset + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.TemporalAsset; + + /** + * Creates a plain object from a TemporalAsset message. Also converts values to other types if specified. + * @param message TemporalAsset + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.TemporalAsset, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TemporalAsset to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TimeWindow. */ + interface ITimeWindow { + + /** TimeWindow startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** TimeWindow endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TimeWindow. */ + class TimeWindow implements ITimeWindow { + + /** + * Constructs a new TimeWindow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.ITimeWindow); + + /** TimeWindow startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** TimeWindow endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TimeWindow instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeWindow instance + */ + public static create(properties?: google.cloud.asset.v1.ITimeWindow): google.cloud.asset.v1.TimeWindow; + + /** + * Encodes the specified TimeWindow message. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. + * @param message TimeWindow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.ITimeWindow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeWindow message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. + * @param message TimeWindow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.ITimeWindow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeWindow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeWindow + * @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.cloud.asset.v1.TimeWindow; + + /** + * Decodes a TimeWindow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeWindow + * @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.cloud.asset.v1.TimeWindow; + + /** + * Verifies a TimeWindow 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 TimeWindow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeWindow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.TimeWindow; + + /** + * Creates a plain object from a TimeWindow message. Also converts values to other types if specified. + * @param message TimeWindow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.TimeWindow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeWindow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Asset. */ + interface IAsset { + + /** Asset name */ + name?: (string|null); + + /** Asset assetType */ + assetType?: (string|null); + + /** Asset resource */ + resource?: (google.cloud.asset.v1.IResource|null); + + /** Asset iamPolicy */ + iamPolicy?: (google.iam.v1.IPolicy|null); + + /** Asset orgPolicy */ + orgPolicy?: (google.cloud.orgpolicy.v1.IPolicy[]|null); + + /** Asset accessPolicy */ + accessPolicy?: (google.identity.accesscontextmanager.v1.IAccessPolicy|null); + + /** Asset accessLevel */ + accessLevel?: (google.identity.accesscontextmanager.v1.IAccessLevel|null); + + /** Asset servicePerimeter */ + servicePerimeter?: (google.identity.accesscontextmanager.v1.IServicePerimeter|null); + + /** Asset ancestors */ + ancestors?: (string[]|null); + } + + /** Represents an Asset. */ + class Asset implements IAsset { + + /** + * Constructs a new Asset. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IAsset); + + /** Asset name. */ + public name: string; + + /** Asset assetType. */ + public assetType: string; + + /** Asset resource. */ public resource?: (google.cloud.asset.v1.IResource|null); - /** Asset iamPolicy. */ - public iamPolicy?: (google.iam.v1.IPolicy|null); + /** Asset iamPolicy. */ + public iamPolicy?: (google.iam.v1.IPolicy|null); + + /** Asset orgPolicy. */ + public orgPolicy: google.cloud.orgpolicy.v1.IPolicy[]; + + /** Asset accessPolicy. */ + public accessPolicy?: (google.identity.accesscontextmanager.v1.IAccessPolicy|null); + + /** Asset accessLevel. */ + public accessLevel?: (google.identity.accesscontextmanager.v1.IAccessLevel|null); + + /** Asset servicePerimeter. */ + public servicePerimeter?: (google.identity.accesscontextmanager.v1.IServicePerimeter|null); + + /** Asset ancestors. */ + public ancestors: string[]; + + /** Asset accessContextPolicy. */ + public accessContextPolicy?: ("accessPolicy"|"accessLevel"|"servicePerimeter"); + + /** + * Creates a new Asset instance using the specified properties. + * @param [properties] Properties to set + * @returns Asset instance + */ + public static create(properties?: google.cloud.asset.v1.IAsset): google.cloud.asset.v1.Asset; + + /** + * Encodes the specified Asset message. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. + * @param message Asset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IAsset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Asset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. + * @param message Asset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IAsset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Asset message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Asset + * @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.cloud.asset.v1.Asset; + + /** + * Decodes an Asset message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Asset + * @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.cloud.asset.v1.Asset; + + /** + * Verifies an Asset 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 Asset message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Asset + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.Asset; + + /** + * Creates a plain object from an Asset message. Also converts values to other types if specified. + * @param message Asset + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.Asset, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Asset to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Resource. */ + interface IResource { + + /** Resource version */ + version?: (string|null); + + /** Resource discoveryDocumentUri */ + discoveryDocumentUri?: (string|null); + + /** Resource discoveryName */ + discoveryName?: (string|null); + + /** Resource resourceUrl */ + resourceUrl?: (string|null); + + /** Resource parent */ + parent?: (string|null); + + /** Resource data */ + data?: (google.protobuf.IStruct|null); + + /** Resource location */ + location?: (string|null); + } + + /** Represents a Resource. */ + class Resource implements IResource { + + /** + * Constructs a new Resource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IResource); + + /** Resource version. */ + public version: string; + + /** Resource discoveryDocumentUri. */ + public discoveryDocumentUri: string; + + /** Resource discoveryName. */ + public discoveryName: string; + + /** Resource resourceUrl. */ + public resourceUrl: string; + + /** Resource parent. */ + public parent: string; + + /** Resource data. */ + public data?: (google.protobuf.IStruct|null); + + /** Resource location. */ + public location: string; + + /** + * Creates a new Resource instance using the specified properties. + * @param [properties] Properties to set + * @returns Resource instance + */ + public static create(properties?: google.cloud.asset.v1.IResource): google.cloud.asset.v1.Resource; + + /** + * Encodes the specified Resource message. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. + * @param message Resource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IResource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Resource message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. + * @param message Resource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IResource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Resource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Resource + * @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.cloud.asset.v1.Resource; + + /** + * Decodes a Resource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Resource + * @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.cloud.asset.v1.Resource; + + /** + * Verifies a Resource 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 Resource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Resource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.Resource; + + /** + * Creates a plain object from a Resource message. Also converts values to other types if specified. + * @param message Resource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.Resource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Resource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** Asset orgPolicy. */ - public orgPolicy: google.cloud.orgpolicy.v1.IPolicy[]; + /** Properties of a ResourceSearchResult. */ + interface IResourceSearchResult { - /** Asset accessPolicy. */ - public accessPolicy?: (google.identity.accesscontextmanager.v1.IAccessPolicy|null); + /** ResourceSearchResult name */ + name?: (string|null); - /** Asset accessLevel. */ - public accessLevel?: (google.identity.accesscontextmanager.v1.IAccessLevel|null); + /** ResourceSearchResult assetType */ + assetType?: (string|null); - /** Asset servicePerimeter. */ - public servicePerimeter?: (google.identity.accesscontextmanager.v1.IServicePerimeter|null); + /** ResourceSearchResult project */ + project?: (string|null); - /** Asset ancestors. */ - public ancestors: string[]; + /** ResourceSearchResult displayName */ + displayName?: (string|null); - /** Asset accessContextPolicy. */ - public accessContextPolicy?: ("accessPolicy"|"accessLevel"|"servicePerimeter"); + /** ResourceSearchResult description */ + description?: (string|null); + + /** ResourceSearchResult location */ + location?: (string|null); + + /** ResourceSearchResult labels */ + labels?: ({ [k: string]: string }|null); + + /** ResourceSearchResult networkTags */ + networkTags?: (string[]|null); + + /** ResourceSearchResult additionalAttributes */ + additionalAttributes?: (google.protobuf.IStruct|null); + } + + /** Represents a ResourceSearchResult. */ + class ResourceSearchResult implements IResourceSearchResult { /** - * Creates a new Asset instance using the specified properties. + * Constructs a new ResourceSearchResult. * @param [properties] Properties to set - * @returns Asset instance */ - public static create(properties?: google.cloud.asset.v1.IAsset): google.cloud.asset.v1.Asset; + constructor(properties?: google.cloud.asset.v1.IResourceSearchResult); + + /** ResourceSearchResult name. */ + public name: string; + + /** ResourceSearchResult assetType. */ + public assetType: string; + + /** ResourceSearchResult project. */ + public project: string; + + /** ResourceSearchResult displayName. */ + public displayName: string; + + /** ResourceSearchResult description. */ + public description: string; + + /** ResourceSearchResult location. */ + public location: string; + + /** ResourceSearchResult labels. */ + public labels: { [k: string]: string }; + + /** ResourceSearchResult networkTags. */ + public networkTags: string[]; + + /** ResourceSearchResult additionalAttributes. */ + public additionalAttributes?: (google.protobuf.IStruct|null); /** - * Encodes the specified Asset message. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. - * @param message Asset message or plain object to encode + * Creates a new ResourceSearchResult instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceSearchResult instance + */ + public static create(properties?: google.cloud.asset.v1.IResourceSearchResult): google.cloud.asset.v1.ResourceSearchResult; + + /** + * Encodes the specified ResourceSearchResult message. Does not implicitly {@link google.cloud.asset.v1.ResourceSearchResult.verify|verify} messages. + * @param message ResourceSearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.asset.v1.IAsset, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.asset.v1.IResourceSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Asset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. - * @param message Asset message or plain object to encode + * Encodes the specified ResourceSearchResult message, length delimited. Does not implicitly {@link google.cloud.asset.v1.ResourceSearchResult.verify|verify} messages. + * @param message ResourceSearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.asset.v1.IAsset, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.asset.v1.IResourceSearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Asset message from the specified reader or buffer. + * Decodes a ResourceSearchResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Asset + * @returns ResourceSearchResult * @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.cloud.asset.v1.Asset; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1.ResourceSearchResult; /** - * Decodes an Asset message from the specified reader or buffer, length delimited. + * Decodes a ResourceSearchResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Asset + * @returns ResourceSearchResult * @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.cloud.asset.v1.Asset; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1.ResourceSearchResult; /** - * Verifies an Asset message. + * Verifies a ResourceSearchResult 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 Asset message from a plain object. Also converts values to their respective internal types. + * Creates a ResourceSearchResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Asset + * @returns ResourceSearchResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.Asset; + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.ResourceSearchResult; /** - * Creates a plain object from an Asset message. Also converts values to other types if specified. - * @param message Asset + * Creates a plain object from a ResourceSearchResult message. Also converts values to other types if specified. + * @param message ResourceSearchResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.asset.v1.Asset, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.asset.v1.ResourceSearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Asset to JSON. + * Converts this ResourceSearchResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Resource. */ - interface IResource { - - /** Resource version */ - version?: (string|null); - - /** Resource discoveryDocumentUri */ - discoveryDocumentUri?: (string|null); + /** Properties of an IamPolicySearchResult. */ + interface IIamPolicySearchResult { - /** Resource discoveryName */ - discoveryName?: (string|null); + /** IamPolicySearchResult resource */ + resource?: (string|null); - /** Resource resourceUrl */ - resourceUrl?: (string|null); + /** IamPolicySearchResult project */ + project?: (string|null); - /** Resource parent */ - parent?: (string|null); + /** IamPolicySearchResult policy */ + policy?: (google.iam.v1.IPolicy|null); - /** Resource data */ - data?: (google.protobuf.IStruct|null); + /** IamPolicySearchResult explanation */ + explanation?: (google.cloud.asset.v1.IamPolicySearchResult.IExplanation|null); } - /** Represents a Resource. */ - class Resource implements IResource { + /** Represents an IamPolicySearchResult. */ + class IamPolicySearchResult implements IIamPolicySearchResult { /** - * Constructs a new Resource. + * Constructs a new IamPolicySearchResult. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.asset.v1.IResource); - - /** Resource version. */ - public version: string; - - /** Resource discoveryDocumentUri. */ - public discoveryDocumentUri: string; + constructor(properties?: google.cloud.asset.v1.IIamPolicySearchResult); - /** Resource discoveryName. */ - public discoveryName: string; + /** IamPolicySearchResult resource. */ + public resource: string; - /** Resource resourceUrl. */ - public resourceUrl: string; + /** IamPolicySearchResult project. */ + public project: string; - /** Resource parent. */ - public parent: string; + /** IamPolicySearchResult policy. */ + public policy?: (google.iam.v1.IPolicy|null); - /** Resource data. */ - public data?: (google.protobuf.IStruct|null); + /** IamPolicySearchResult explanation. */ + public explanation?: (google.cloud.asset.v1.IamPolicySearchResult.IExplanation|null); /** - * Creates a new Resource instance using the specified properties. + * Creates a new IamPolicySearchResult instance using the specified properties. * @param [properties] Properties to set - * @returns Resource instance + * @returns IamPolicySearchResult instance */ - public static create(properties?: google.cloud.asset.v1.IResource): google.cloud.asset.v1.Resource; + public static create(properties?: google.cloud.asset.v1.IIamPolicySearchResult): google.cloud.asset.v1.IamPolicySearchResult; /** - * Encodes the specified Resource message. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. - * @param message Resource message or plain object to encode + * Encodes the specified IamPolicySearchResult message. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.verify|verify} messages. + * @param message IamPolicySearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.asset.v1.IResource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.asset.v1.IIamPolicySearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Resource message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. - * @param message Resource message or plain object to encode + * Encodes the specified IamPolicySearchResult message, length delimited. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.verify|verify} messages. + * @param message IamPolicySearchResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.asset.v1.IResource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.asset.v1.IIamPolicySearchResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Resource message from the specified reader or buffer. + * Decodes an IamPolicySearchResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Resource + * @returns IamPolicySearchResult * @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.cloud.asset.v1.Resource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1.IamPolicySearchResult; /** - * Decodes a Resource message from the specified reader or buffer, length delimited. + * Decodes an IamPolicySearchResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Resource + * @returns IamPolicySearchResult * @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.cloud.asset.v1.Resource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1.IamPolicySearchResult; /** - * Verifies a Resource message. + * Verifies an IamPolicySearchResult 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 Resource message from a plain object. Also converts values to their respective internal types. + * Creates an IamPolicySearchResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Resource + * @returns IamPolicySearchResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.Resource; + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.IamPolicySearchResult; /** - * Creates a plain object from a Resource message. Also converts values to other types if specified. - * @param message Resource + * Creates a plain object from an IamPolicySearchResult message. Also converts values to other types if specified. + * @param message IamPolicySearchResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.asset.v1.Resource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.asset.v1.IamPolicySearchResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Resource to JSON. + * Converts this IamPolicySearchResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + + namespace IamPolicySearchResult { + + /** Properties of an Explanation. */ + interface IExplanation { + + /** Explanation matchedPermissions */ + matchedPermissions?: ({ [k: string]: google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions }|null); + } + + /** Represents an Explanation. */ + class Explanation implements IExplanation { + + /** + * Constructs a new Explanation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IamPolicySearchResult.IExplanation); + + /** Explanation matchedPermissions. */ + public matchedPermissions: { [k: string]: google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions }; + + /** + * Creates a new Explanation instance using the specified properties. + * @param [properties] Properties to set + * @returns Explanation instance + */ + public static create(properties?: google.cloud.asset.v1.IamPolicySearchResult.IExplanation): google.cloud.asset.v1.IamPolicySearchResult.Explanation; + + /** + * Encodes the specified Explanation message. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.verify|verify} messages. + * @param message Explanation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IamPolicySearchResult.IExplanation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Explanation message, length delimited. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.verify|verify} messages. + * @param message Explanation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IamPolicySearchResult.IExplanation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Explanation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Explanation + * @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.cloud.asset.v1.IamPolicySearchResult.Explanation; + + /** + * Decodes an Explanation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Explanation + * @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.cloud.asset.v1.IamPolicySearchResult.Explanation; + + /** + * Verifies an Explanation 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 Explanation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Explanation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.IamPolicySearchResult.Explanation; + + /** + * Creates a plain object from an Explanation message. Also converts values to other types if specified. + * @param message Explanation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.IamPolicySearchResult.Explanation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Explanation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Explanation { + + /** Properties of a Permissions. */ + interface IPermissions { + + /** Permissions permissions */ + permissions?: (string[]|null); + } + + /** Represents a Permissions. */ + class Permissions implements IPermissions { + + /** + * Constructs a new Permissions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions); + + /** Permissions permissions. */ + public permissions: string[]; + + /** + * Creates a new Permissions instance using the specified properties. + * @param [properties] Properties to set + * @returns Permissions instance + */ + public static create(properties?: google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions): google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions; + + /** + * Encodes the specified Permissions message. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.verify|verify} messages. + * @param message Permissions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Permissions message, length delimited. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.verify|verify} messages. + * @param message Permissions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Permissions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Permissions + * @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.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions; + + /** + * Decodes a Permissions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Permissions + * @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.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions; + + /** + * Verifies a Permissions 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 Permissions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Permissions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions; + + /** + * Creates a plain object from a Permissions message. Also converts values to other types if specified. + * @param message Permissions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Permissions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } } /** Namespace v1beta1. */ diff --git a/protos/protos.js b/protos/protos.js index c3fada77..ef733355 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -329,6 +329,72 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.asset.v1.AssetService#searchAllResources}. + * @memberof google.cloud.asset.v1.AssetService + * @typedef SearchAllResourcesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.asset.v1.SearchAllResourcesResponse} [response] SearchAllResourcesResponse + */ + + /** + * Calls SearchAllResources. + * @function searchAllResources + * @memberof google.cloud.asset.v1.AssetService + * @instance + * @param {google.cloud.asset.v1.ISearchAllResourcesRequest} request SearchAllResourcesRequest message or plain object + * @param {google.cloud.asset.v1.AssetService.SearchAllResourcesCallback} callback Node-style callback called with the error, if any, and SearchAllResourcesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AssetService.prototype.searchAllResources = function searchAllResources(request, callback) { + return this.rpcCall(searchAllResources, $root.google.cloud.asset.v1.SearchAllResourcesRequest, $root.google.cloud.asset.v1.SearchAllResourcesResponse, request, callback); + }, "name", { value: "SearchAllResources" }); + + /** + * Calls SearchAllResources. + * @function searchAllResources + * @memberof google.cloud.asset.v1.AssetService + * @instance + * @param {google.cloud.asset.v1.ISearchAllResourcesRequest} request SearchAllResourcesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.asset.v1.AssetService#searchAllIamPolicies}. + * @memberof google.cloud.asset.v1.AssetService + * @typedef SearchAllIamPoliciesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.asset.v1.SearchAllIamPoliciesResponse} [response] SearchAllIamPoliciesResponse + */ + + /** + * Calls SearchAllIamPolicies. + * @function searchAllIamPolicies + * @memberof google.cloud.asset.v1.AssetService + * @instance + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesRequest} request SearchAllIamPoliciesRequest message or plain object + * @param {google.cloud.asset.v1.AssetService.SearchAllIamPoliciesCallback} callback Node-style callback called with the error, if any, and SearchAllIamPoliciesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AssetService.prototype.searchAllIamPolicies = function searchAllIamPolicies(request, callback) { + return this.rpcCall(searchAllIamPolicies, $root.google.cloud.asset.v1.SearchAllIamPoliciesRequest, $root.google.cloud.asset.v1.SearchAllIamPoliciesResponse, request, callback); + }, "name", { value: "SearchAllIamPolicies" }); + + /** + * Calls SearchAllIamPolicies. + * @function searchAllIamPolicies + * @memberof google.cloud.asset.v1.AssetService + * @instance + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesRequest} request SearchAllIamPoliciesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return AssetService; })(); @@ -4072,46 +4138,30 @@ return Feed; })(); - /** - * ContentType enum. - * @name google.cloud.asset.v1.ContentType - * @enum {number} - * @property {number} CONTENT_TYPE_UNSPECIFIED=0 CONTENT_TYPE_UNSPECIFIED value - * @property {number} RESOURCE=1 RESOURCE value - * @property {number} IAM_POLICY=2 IAM_POLICY value - * @property {number} ORG_POLICY=4 ORG_POLICY value - * @property {number} ACCESS_POLICY=5 ACCESS_POLICY value - */ - v1.ContentType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONTENT_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RESOURCE"] = 1; - values[valuesById[2] = "IAM_POLICY"] = 2; - values[valuesById[4] = "ORG_POLICY"] = 4; - values[valuesById[5] = "ACCESS_POLICY"] = 5; - return values; - })(); - - v1.TemporalAsset = (function() { + v1.SearchAllResourcesRequest = (function() { /** - * Properties of a TemporalAsset. + * Properties of a SearchAllResourcesRequest. * @memberof google.cloud.asset.v1 - * @interface ITemporalAsset - * @property {google.cloud.asset.v1.ITimeWindow|null} [window] TemporalAsset window - * @property {boolean|null} [deleted] TemporalAsset deleted - * @property {google.cloud.asset.v1.IAsset|null} [asset] TemporalAsset asset + * @interface ISearchAllResourcesRequest + * @property {string|null} [scope] SearchAllResourcesRequest scope + * @property {string|null} [query] SearchAllResourcesRequest query + * @property {Array.|null} [assetTypes] SearchAllResourcesRequest assetTypes + * @property {number|null} [pageSize] SearchAllResourcesRequest pageSize + * @property {string|null} [pageToken] SearchAllResourcesRequest pageToken + * @property {string|null} [orderBy] SearchAllResourcesRequest orderBy */ /** - * Constructs a new TemporalAsset. + * Constructs a new SearchAllResourcesRequest. * @memberof google.cloud.asset.v1 - * @classdesc Represents a TemporalAsset. - * @implements ITemporalAsset + * @classdesc Represents a SearchAllResourcesRequest. + * @implements ISearchAllResourcesRequest * @constructor - * @param {google.cloud.asset.v1.ITemporalAsset=} [properties] Properties to set + * @param {google.cloud.asset.v1.ISearchAllResourcesRequest=} [properties] Properties to set */ - function TemporalAsset(properties) { + function SearchAllResourcesRequest(properties) { + this.assetTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4119,101 +4169,143 @@ } /** - * TemporalAsset window. - * @member {google.cloud.asset.v1.ITimeWindow|null|undefined} window - * @memberof google.cloud.asset.v1.TemporalAsset + * SearchAllResourcesRequest scope. + * @member {string} scope + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @instance */ - TemporalAsset.prototype.window = null; + SearchAllResourcesRequest.prototype.scope = ""; /** - * TemporalAsset deleted. - * @member {boolean} deleted - * @memberof google.cloud.asset.v1.TemporalAsset + * SearchAllResourcesRequest query. + * @member {string} query + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @instance */ - TemporalAsset.prototype.deleted = false; + SearchAllResourcesRequest.prototype.query = ""; /** - * TemporalAsset asset. - * @member {google.cloud.asset.v1.IAsset|null|undefined} asset - * @memberof google.cloud.asset.v1.TemporalAsset + * SearchAllResourcesRequest assetTypes. + * @member {Array.} assetTypes + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @instance */ - TemporalAsset.prototype.asset = null; + SearchAllResourcesRequest.prototype.assetTypes = $util.emptyArray; /** - * Creates a new TemporalAsset instance using the specified properties. + * SearchAllResourcesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest + * @instance + */ + SearchAllResourcesRequest.prototype.pageSize = 0; + + /** + * SearchAllResourcesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest + * @instance + */ + SearchAllResourcesRequest.prototype.pageToken = ""; + + /** + * SearchAllResourcesRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest + * @instance + */ + SearchAllResourcesRequest.prototype.orderBy = ""; + + /** + * Creates a new SearchAllResourcesRequest instance using the specified properties. * @function create - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static - * @param {google.cloud.asset.v1.ITemporalAsset=} [properties] Properties to set - * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset instance + * @param {google.cloud.asset.v1.ISearchAllResourcesRequest=} [properties] Properties to set + * @returns {google.cloud.asset.v1.SearchAllResourcesRequest} SearchAllResourcesRequest instance */ - TemporalAsset.create = function create(properties) { - return new TemporalAsset(properties); + SearchAllResourcesRequest.create = function create(properties) { + return new SearchAllResourcesRequest(properties); }; /** - * Encodes the specified TemporalAsset message. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. + * Encodes the specified SearchAllResourcesRequest message. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static - * @param {google.cloud.asset.v1.ITemporalAsset} message TemporalAsset message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllResourcesRequest} message SearchAllResourcesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TemporalAsset.encode = function encode(message, writer) { + SearchAllResourcesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.window != null && Object.hasOwnProperty.call(message, "window")) - $root.google.cloud.asset.v1.TimeWindow.encode(message.window, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.deleted != null && Object.hasOwnProperty.call(message, "deleted")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.deleted); - if (message.asset != null && Object.hasOwnProperty.call(message, "asset")) - $root.google.cloud.asset.v1.Asset.encode(message.asset, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.scope != null && Object.hasOwnProperty.call(message, "scope")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.scope); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.assetTypes != null && message.assetTypes.length) + for (var i = 0; i < message.assetTypes.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.assetTypes[i]); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pageToken); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); return writer; }; /** - * Encodes the specified TemporalAsset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. + * Encodes the specified SearchAllResourcesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static - * @param {google.cloud.asset.v1.ITemporalAsset} message TemporalAsset message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllResourcesRequest} message SearchAllResourcesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TemporalAsset.encodeDelimited = function encodeDelimited(message, writer) { + SearchAllResourcesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TemporalAsset message from the specified reader or buffer. + * Decodes a SearchAllResourcesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset + * @returns {google.cloud.asset.v1.SearchAllResourcesRequest} SearchAllResourcesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TemporalAsset.decode = function decode(reader, length) { + SearchAllResourcesRequest.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.cloud.asset.v1.TemporalAsset(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.asset.v1.SearchAllResourcesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.window = $root.google.cloud.asset.v1.TimeWindow.decode(reader, reader.uint32()); + message.scope = reader.string(); break; case 2: - message.deleted = reader.bool(); + message.query = reader.string(); break; case 3: - message.asset = $root.google.cloud.asset.v1.Asset.decode(reader, reader.uint32()); + if (!(message.assetTypes && message.assetTypes.length)) + message.assetTypes = []; + message.assetTypes.push(reader.string()); + break; + case 4: + message.pageSize = reader.int32(); + break; + case 5: + message.pageToken = reader.string(); + break; + case 6: + message.orderBy = reader.string(); break; default: reader.skipType(tag & 7); @@ -4224,135 +4316,163 @@ }; /** - * Decodes a TemporalAsset message from the specified reader or buffer, length delimited. + * Decodes a SearchAllResourcesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset + * @returns {google.cloud.asset.v1.SearchAllResourcesRequest} SearchAllResourcesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TemporalAsset.decodeDelimited = function decodeDelimited(reader) { + SearchAllResourcesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TemporalAsset message. + * Verifies a SearchAllResourcesRequest message. * @function verify - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TemporalAsset.verify = function verify(message) { + SearchAllResourcesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.window != null && message.hasOwnProperty("window")) { - var error = $root.google.cloud.asset.v1.TimeWindow.verify(message.window); - if (error) - return "window." + error; - } - if (message.deleted != null && message.hasOwnProperty("deleted")) - if (typeof message.deleted !== "boolean") - return "deleted: boolean expected"; - if (message.asset != null && message.hasOwnProperty("asset")) { - var error = $root.google.cloud.asset.v1.Asset.verify(message.asset); - if (error) - return "asset." + error; + if (message.scope != null && message.hasOwnProperty("scope")) + if (!$util.isString(message.scope)) + return "scope: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.assetTypes != null && message.hasOwnProperty("assetTypes")) { + if (!Array.isArray(message.assetTypes)) + return "assetTypes: array expected"; + for (var i = 0; i < message.assetTypes.length; ++i) + if (!$util.isString(message.assetTypes[i])) + return "assetTypes: string[] expected"; } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; return null; }; /** - * Creates a TemporalAsset message from a plain object. Also converts values to their respective internal types. + * Creates a SearchAllResourcesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset + * @returns {google.cloud.asset.v1.SearchAllResourcesRequest} SearchAllResourcesRequest */ - TemporalAsset.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.asset.v1.TemporalAsset) + SearchAllResourcesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.SearchAllResourcesRequest) return object; - var message = new $root.google.cloud.asset.v1.TemporalAsset(); - if (object.window != null) { - if (typeof object.window !== "object") - throw TypeError(".google.cloud.asset.v1.TemporalAsset.window: object expected"); - message.window = $root.google.cloud.asset.v1.TimeWindow.fromObject(object.window); - } - if (object.deleted != null) - message.deleted = Boolean(object.deleted); - if (object.asset != null) { - if (typeof object.asset !== "object") - throw TypeError(".google.cloud.asset.v1.TemporalAsset.asset: object expected"); - message.asset = $root.google.cloud.asset.v1.Asset.fromObject(object.asset); + var message = new $root.google.cloud.asset.v1.SearchAllResourcesRequest(); + if (object.scope != null) + message.scope = String(object.scope); + if (object.query != null) + message.query = String(object.query); + if (object.assetTypes) { + if (!Array.isArray(object.assetTypes)) + throw TypeError(".google.cloud.asset.v1.SearchAllResourcesRequest.assetTypes: array expected"); + message.assetTypes = []; + for (var i = 0; i < object.assetTypes.length; ++i) + message.assetTypes[i] = String(object.assetTypes[i]); } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); return message; }; /** - * Creates a plain object from a TemporalAsset message. Also converts values to other types if specified. + * Creates a plain object from a SearchAllResourcesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @static - * @param {google.cloud.asset.v1.TemporalAsset} message TemporalAsset + * @param {google.cloud.asset.v1.SearchAllResourcesRequest} message SearchAllResourcesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TemporalAsset.toObject = function toObject(message, options) { + SearchAllResourcesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.assetTypes = []; if (options.defaults) { - object.window = null; - object.deleted = false; - object.asset = null; + object.scope = ""; + object.query = ""; + object.pageSize = 0; + object.pageToken = ""; + object.orderBy = ""; } - if (message.window != null && message.hasOwnProperty("window")) - object.window = $root.google.cloud.asset.v1.TimeWindow.toObject(message.window, options); - if (message.deleted != null && message.hasOwnProperty("deleted")) - object.deleted = message.deleted; - if (message.asset != null && message.hasOwnProperty("asset")) - object.asset = $root.google.cloud.asset.v1.Asset.toObject(message.asset, options); + if (message.scope != null && message.hasOwnProperty("scope")) + object.scope = message.scope; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.assetTypes && message.assetTypes.length) { + object.assetTypes = []; + for (var j = 0; j < message.assetTypes.length; ++j) + object.assetTypes[j] = message.assetTypes[j]; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; return object; }; /** - * Converts this TemporalAsset to JSON. + * Converts this SearchAllResourcesRequest to JSON. * @function toJSON - * @memberof google.cloud.asset.v1.TemporalAsset + * @memberof google.cloud.asset.v1.SearchAllResourcesRequest * @instance * @returns {Object.} JSON object */ - TemporalAsset.prototype.toJSON = function toJSON() { + SearchAllResourcesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return TemporalAsset; + return SearchAllResourcesRequest; })(); - v1.TimeWindow = (function() { + v1.SearchAllResourcesResponse = (function() { /** - * Properties of a TimeWindow. + * Properties of a SearchAllResourcesResponse. * @memberof google.cloud.asset.v1 - * @interface ITimeWindow - * @property {google.protobuf.ITimestamp|null} [startTime] TimeWindow startTime - * @property {google.protobuf.ITimestamp|null} [endTime] TimeWindow endTime + * @interface ISearchAllResourcesResponse + * @property {Array.|null} [results] SearchAllResourcesResponse results + * @property {string|null} [nextPageToken] SearchAllResourcesResponse nextPageToken */ /** - * Constructs a new TimeWindow. + * Constructs a new SearchAllResourcesResponse. * @memberof google.cloud.asset.v1 - * @classdesc Represents a TimeWindow. - * @implements ITimeWindow + * @classdesc Represents a SearchAllResourcesResponse. + * @implements ISearchAllResourcesResponse * @constructor - * @param {google.cloud.asset.v1.ITimeWindow=} [properties] Properties to set + * @param {google.cloud.asset.v1.ISearchAllResourcesResponse=} [properties] Properties to set */ - function TimeWindow(properties) { + function SearchAllResourcesResponse(properties) { + this.results = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4360,88 +4480,91 @@ } /** - * TimeWindow startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.asset.v1.TimeWindow + * SearchAllResourcesResponse results. + * @member {Array.} results + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @instance */ - TimeWindow.prototype.startTime = null; + SearchAllResourcesResponse.prototype.results = $util.emptyArray; /** - * TimeWindow endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.asset.v1.TimeWindow + * SearchAllResourcesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @instance */ - TimeWindow.prototype.endTime = null; + SearchAllResourcesResponse.prototype.nextPageToken = ""; /** - * Creates a new TimeWindow instance using the specified properties. + * Creates a new SearchAllResourcesResponse instance using the specified properties. * @function create - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static - * @param {google.cloud.asset.v1.ITimeWindow=} [properties] Properties to set - * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow instance + * @param {google.cloud.asset.v1.ISearchAllResourcesResponse=} [properties] Properties to set + * @returns {google.cloud.asset.v1.SearchAllResourcesResponse} SearchAllResourcesResponse instance */ - TimeWindow.create = function create(properties) { - return new TimeWindow(properties); + SearchAllResourcesResponse.create = function create(properties) { + return new SearchAllResourcesResponse(properties); }; /** - * Encodes the specified TimeWindow message. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. + * Encodes the specified SearchAllResourcesResponse message. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static - * @param {google.cloud.asset.v1.ITimeWindow} message TimeWindow message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllResourcesResponse} message SearchAllResourcesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TimeWindow.encode = function encode(message, writer) { + SearchAllResourcesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.asset.v1.ResourceSearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified TimeWindow message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. + * Encodes the specified SearchAllResourcesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllResourcesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static - * @param {google.cloud.asset.v1.ITimeWindow} message TimeWindow message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllResourcesResponse} message SearchAllResourcesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TimeWindow.encodeDelimited = function encodeDelimited(message, writer) { + SearchAllResourcesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TimeWindow message from the specified reader or buffer. + * Decodes a SearchAllResourcesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow + * @returns {google.cloud.asset.v1.SearchAllResourcesResponse} SearchAllResourcesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeWindow.decode = function decode(reader, length) { + SearchAllResourcesResponse.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.cloud.asset.v1.TimeWindow(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.asset.v1.SearchAllResourcesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.asset.v1.ResourceSearchResult.decode(reader, reader.uint32())); break; case 2: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -4452,136 +4575,136 @@ }; /** - * Decodes a TimeWindow message from the specified reader or buffer, length delimited. + * Decodes a SearchAllResourcesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow + * @returns {google.cloud.asset.v1.SearchAllResourcesResponse} SearchAllResourcesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TimeWindow.decodeDelimited = function decodeDelimited(reader) { + SearchAllResourcesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TimeWindow message. + * Verifies a SearchAllResourcesResponse message. * @function verify - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TimeWindow.verify = function verify(message) { + SearchAllResourcesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.asset.v1.ResourceSearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates a TimeWindow message from a plain object. Also converts values to their respective internal types. + * Creates a SearchAllResourcesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow + * @returns {google.cloud.asset.v1.SearchAllResourcesResponse} SearchAllResourcesResponse */ - TimeWindow.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.asset.v1.TimeWindow) + SearchAllResourcesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.SearchAllResourcesResponse) return object; - var message = new $root.google.cloud.asset.v1.TimeWindow(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.asset.v1.TimeWindow.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.asset.v1.TimeWindow.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + var message = new $root.google.cloud.asset.v1.SearchAllResourcesResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.asset.v1.SearchAllResourcesResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.asset.v1.SearchAllResourcesResponse.results: object expected"); + message.results[i] = $root.google.cloud.asset.v1.ResourceSearchResult.fromObject(object.results[i]); + } } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a TimeWindow message. Also converts values to other types if specified. + * Creates a plain object from a SearchAllResourcesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @static - * @param {google.cloud.asset.v1.TimeWindow} message TimeWindow + * @param {google.cloud.asset.v1.SearchAllResourcesResponse} message SearchAllResourcesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TimeWindow.toObject = function toObject(message, options) { + SearchAllResourcesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.startTime = null; - object.endTime = null; + if (options.arrays || options.defaults) + object.results = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.asset.v1.ResourceSearchResult.toObject(message.results[j], options); } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this TimeWindow to JSON. + * Converts this SearchAllResourcesResponse to JSON. * @function toJSON - * @memberof google.cloud.asset.v1.TimeWindow + * @memberof google.cloud.asset.v1.SearchAllResourcesResponse * @instance * @returns {Object.} JSON object */ - TimeWindow.prototype.toJSON = function toJSON() { + SearchAllResourcesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return TimeWindow; + return SearchAllResourcesResponse; })(); - v1.Asset = (function() { + v1.SearchAllIamPoliciesRequest = (function() { /** - * Properties of an Asset. + * Properties of a SearchAllIamPoliciesRequest. * @memberof google.cloud.asset.v1 - * @interface IAsset - * @property {string|null} [name] Asset name - * @property {string|null} [assetType] Asset assetType - * @property {google.cloud.asset.v1.IResource|null} [resource] Asset resource - * @property {google.iam.v1.IPolicy|null} [iamPolicy] Asset iamPolicy - * @property {Array.|null} [orgPolicy] Asset orgPolicy - * @property {google.identity.accesscontextmanager.v1.IAccessPolicy|null} [accessPolicy] Asset accessPolicy - * @property {google.identity.accesscontextmanager.v1.IAccessLevel|null} [accessLevel] Asset accessLevel - * @property {google.identity.accesscontextmanager.v1.IServicePerimeter|null} [servicePerimeter] Asset servicePerimeter - * @property {Array.|null} [ancestors] Asset ancestors + * @interface ISearchAllIamPoliciesRequest + * @property {string|null} [scope] SearchAllIamPoliciesRequest scope + * @property {string|null} [query] SearchAllIamPoliciesRequest query + * @property {number|null} [pageSize] SearchAllIamPoliciesRequest pageSize + * @property {string|null} [pageToken] SearchAllIamPoliciesRequest pageToken */ /** - * Constructs a new Asset. + * Constructs a new SearchAllIamPoliciesRequest. * @memberof google.cloud.asset.v1 - * @classdesc Represents an Asset. - * @implements IAsset + * @classdesc Represents a SearchAllIamPoliciesRequest. + * @implements ISearchAllIamPoliciesRequest * @constructor - * @param {google.cloud.asset.v1.IAsset=} [properties] Properties to set + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesRequest=} [properties] Properties to set */ - function Asset(properties) { - this.orgPolicy = []; - this.ancestors = []; + function SearchAllIamPoliciesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4589,199 +4712,114 @@ } /** - * Asset name. - * @member {string} name - * @memberof google.cloud.asset.v1.Asset + * SearchAllIamPoliciesRequest scope. + * @member {string} scope + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @instance */ - Asset.prototype.name = ""; + SearchAllIamPoliciesRequest.prototype.scope = ""; /** - * Asset assetType. - * @member {string} assetType - * @memberof google.cloud.asset.v1.Asset - * @instance - */ - Asset.prototype.assetType = ""; - - /** - * Asset resource. - * @member {google.cloud.asset.v1.IResource|null|undefined} resource - * @memberof google.cloud.asset.v1.Asset - * @instance - */ - Asset.prototype.resource = null; - - /** - * Asset iamPolicy. - * @member {google.iam.v1.IPolicy|null|undefined} iamPolicy - * @memberof google.cloud.asset.v1.Asset - * @instance - */ - Asset.prototype.iamPolicy = null; - - /** - * Asset orgPolicy. - * @member {Array.} orgPolicy - * @memberof google.cloud.asset.v1.Asset - * @instance - */ - Asset.prototype.orgPolicy = $util.emptyArray; - - /** - * Asset accessPolicy. - * @member {google.identity.accesscontextmanager.v1.IAccessPolicy|null|undefined} accessPolicy - * @memberof google.cloud.asset.v1.Asset - * @instance - */ - Asset.prototype.accessPolicy = null; - - /** - * Asset accessLevel. - * @member {google.identity.accesscontextmanager.v1.IAccessLevel|null|undefined} accessLevel - * @memberof google.cloud.asset.v1.Asset - * @instance - */ - Asset.prototype.accessLevel = null; - - /** - * Asset servicePerimeter. - * @member {google.identity.accesscontextmanager.v1.IServicePerimeter|null|undefined} servicePerimeter - * @memberof google.cloud.asset.v1.Asset + * SearchAllIamPoliciesRequest query. + * @member {string} query + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @instance */ - Asset.prototype.servicePerimeter = null; + SearchAllIamPoliciesRequest.prototype.query = ""; /** - * Asset ancestors. - * @member {Array.} ancestors - * @memberof google.cloud.asset.v1.Asset + * SearchAllIamPoliciesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @instance */ - Asset.prototype.ancestors = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + SearchAllIamPoliciesRequest.prototype.pageSize = 0; /** - * Asset accessContextPolicy. - * @member {"accessPolicy"|"accessLevel"|"servicePerimeter"|undefined} accessContextPolicy - * @memberof google.cloud.asset.v1.Asset + * SearchAllIamPoliciesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @instance */ - Object.defineProperty(Asset.prototype, "accessContextPolicy", { - get: $util.oneOfGetter($oneOfFields = ["accessPolicy", "accessLevel", "servicePerimeter"]), - set: $util.oneOfSetter($oneOfFields) - }); + SearchAllIamPoliciesRequest.prototype.pageToken = ""; /** - * Creates a new Asset instance using the specified properties. + * Creates a new SearchAllIamPoliciesRequest instance using the specified properties. * @function create - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static - * @param {google.cloud.asset.v1.IAsset=} [properties] Properties to set - * @returns {google.cloud.asset.v1.Asset} Asset instance + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesRequest=} [properties] Properties to set + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesRequest} SearchAllIamPoliciesRequest instance */ - Asset.create = function create(properties) { - return new Asset(properties); + SearchAllIamPoliciesRequest.create = function create(properties) { + return new SearchAllIamPoliciesRequest(properties); }; /** - * Encodes the specified Asset message. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. + * Encodes the specified SearchAllIamPoliciesRequest message. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static - * @param {google.cloud.asset.v1.IAsset} message Asset message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesRequest} message SearchAllIamPoliciesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Asset.encode = function encode(message, writer) { + SearchAllIamPoliciesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.assetType != null && Object.hasOwnProperty.call(message, "assetType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.assetType); - if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) - $root.google.cloud.asset.v1.Resource.encode(message.resource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.iamPolicy != null && Object.hasOwnProperty.call(message, "iamPolicy")) - $root.google.iam.v1.Policy.encode(message.iamPolicy, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.orgPolicy != null && message.orgPolicy.length) - for (var i = 0; i < message.orgPolicy.length; ++i) - $root.google.cloud.orgpolicy.v1.Policy.encode(message.orgPolicy[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.accessPolicy != null && Object.hasOwnProperty.call(message, "accessPolicy")) - $root.google.identity.accesscontextmanager.v1.AccessPolicy.encode(message.accessPolicy, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.accessLevel != null && Object.hasOwnProperty.call(message, "accessLevel")) - $root.google.identity.accesscontextmanager.v1.AccessLevel.encode(message.accessLevel, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.servicePerimeter != null && Object.hasOwnProperty.call(message, "servicePerimeter")) - $root.google.identity.accesscontextmanager.v1.ServicePerimeter.encode(message.servicePerimeter, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.ancestors != null && message.ancestors.length) - for (var i = 0; i < message.ancestors.length; ++i) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.ancestors[i]); + if (message.scope != null && Object.hasOwnProperty.call(message, "scope")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.scope); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.query); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); return writer; }; /** - * Encodes the specified Asset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. + * Encodes the specified SearchAllIamPoliciesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static - * @param {google.cloud.asset.v1.IAsset} message Asset message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesRequest} message SearchAllIamPoliciesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Asset.encodeDelimited = function encodeDelimited(message, writer) { + SearchAllIamPoliciesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Asset message from the specified reader or buffer. + * Decodes a SearchAllIamPoliciesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.asset.v1.Asset} Asset + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesRequest} SearchAllIamPoliciesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Asset.decode = function decode(reader, length) { + SearchAllIamPoliciesRequest.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.cloud.asset.v1.Asset(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.asset.v1.SearchAllIamPoliciesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.scope = reader.string(); break; case 2: - message.assetType = reader.string(); + message.query = reader.string(); break; case 3: - message.resource = $root.google.cloud.asset.v1.Resource.decode(reader, reader.uint32()); + message.pageSize = reader.int32(); break; case 4: - message.iamPolicy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); - break; - case 6: - if (!(message.orgPolicy && message.orgPolicy.length)) - message.orgPolicy = []; - message.orgPolicy.push($root.google.cloud.orgpolicy.v1.Policy.decode(reader, reader.uint32())); - break; - case 7: - message.accessPolicy = $root.google.identity.accesscontextmanager.v1.AccessPolicy.decode(reader, reader.uint32()); - break; - case 8: - message.accessLevel = $root.google.identity.accesscontextmanager.v1.AccessLevel.decode(reader, reader.uint32()); - break; - case 9: - message.servicePerimeter = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.decode(reader, reader.uint32()); - break; - case 10: - if (!(message.ancestors && message.ancestors.length)) - message.ancestors = []; - message.ancestors.push(reader.string()); + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -4792,253 +4830,134 @@ }; /** - * Decodes an Asset message from the specified reader or buffer, length delimited. + * Decodes a SearchAllIamPoliciesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.asset.v1.Asset} Asset + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesRequest} SearchAllIamPoliciesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Asset.decodeDelimited = function decodeDelimited(reader) { + SearchAllIamPoliciesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Asset message. + * Verifies a SearchAllIamPoliciesRequest message. * @function verify - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Asset.verify = function verify(message) { + SearchAllIamPoliciesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.assetType != null && message.hasOwnProperty("assetType")) - if (!$util.isString(message.assetType)) - return "assetType: string expected"; - if (message.resource != null && message.hasOwnProperty("resource")) { - var error = $root.google.cloud.asset.v1.Resource.verify(message.resource); - if (error) - return "resource." + error; - } - if (message.iamPolicy != null && message.hasOwnProperty("iamPolicy")) { - var error = $root.google.iam.v1.Policy.verify(message.iamPolicy); - if (error) - return "iamPolicy." + error; - } - if (message.orgPolicy != null && message.hasOwnProperty("orgPolicy")) { - if (!Array.isArray(message.orgPolicy)) - return "orgPolicy: array expected"; - for (var i = 0; i < message.orgPolicy.length; ++i) { - var error = $root.google.cloud.orgpolicy.v1.Policy.verify(message.orgPolicy[i]); - if (error) - return "orgPolicy." + error; - } - } - if (message.accessPolicy != null && message.hasOwnProperty("accessPolicy")) { - properties.accessContextPolicy = 1; - { - var error = $root.google.identity.accesscontextmanager.v1.AccessPolicy.verify(message.accessPolicy); - if (error) - return "accessPolicy." + error; - } - } - if (message.accessLevel != null && message.hasOwnProperty("accessLevel")) { - if (properties.accessContextPolicy === 1) - return "accessContextPolicy: multiple values"; - properties.accessContextPolicy = 1; - { - var error = $root.google.identity.accesscontextmanager.v1.AccessLevel.verify(message.accessLevel); - if (error) - return "accessLevel." + error; - } - } - if (message.servicePerimeter != null && message.hasOwnProperty("servicePerimeter")) { - if (properties.accessContextPolicy === 1) - return "accessContextPolicy: multiple values"; - properties.accessContextPolicy = 1; - { - var error = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.verify(message.servicePerimeter); - if (error) - return "servicePerimeter." + error; - } - } - if (message.ancestors != null && message.hasOwnProperty("ancestors")) { - if (!Array.isArray(message.ancestors)) - return "ancestors: array expected"; - for (var i = 0; i < message.ancestors.length; ++i) - if (!$util.isString(message.ancestors[i])) - return "ancestors: string[] expected"; - } + if (message.scope != null && message.hasOwnProperty("scope")) + if (!$util.isString(message.scope)) + return "scope: string expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates an Asset message from a plain object. Also converts values to their respective internal types. + * Creates a SearchAllIamPoliciesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.asset.v1.Asset} Asset + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesRequest} SearchAllIamPoliciesRequest */ - Asset.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.asset.v1.Asset) + SearchAllIamPoliciesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.SearchAllIamPoliciesRequest) return object; - var message = new $root.google.cloud.asset.v1.Asset(); - if (object.name != null) - message.name = String(object.name); - if (object.assetType != null) - message.assetType = String(object.assetType); - if (object.resource != null) { - if (typeof object.resource !== "object") - throw TypeError(".google.cloud.asset.v1.Asset.resource: object expected"); - message.resource = $root.google.cloud.asset.v1.Resource.fromObject(object.resource); - } - if (object.iamPolicy != null) { - if (typeof object.iamPolicy !== "object") - throw TypeError(".google.cloud.asset.v1.Asset.iamPolicy: object expected"); - message.iamPolicy = $root.google.iam.v1.Policy.fromObject(object.iamPolicy); - } - if (object.orgPolicy) { - if (!Array.isArray(object.orgPolicy)) - throw TypeError(".google.cloud.asset.v1.Asset.orgPolicy: array expected"); - message.orgPolicy = []; - for (var i = 0; i < object.orgPolicy.length; ++i) { - if (typeof object.orgPolicy[i] !== "object") - throw TypeError(".google.cloud.asset.v1.Asset.orgPolicy: object expected"); - message.orgPolicy[i] = $root.google.cloud.orgpolicy.v1.Policy.fromObject(object.orgPolicy[i]); - } - } - if (object.accessPolicy != null) { - if (typeof object.accessPolicy !== "object") - throw TypeError(".google.cloud.asset.v1.Asset.accessPolicy: object expected"); - message.accessPolicy = $root.google.identity.accesscontextmanager.v1.AccessPolicy.fromObject(object.accessPolicy); - } - if (object.accessLevel != null) { - if (typeof object.accessLevel !== "object") - throw TypeError(".google.cloud.asset.v1.Asset.accessLevel: object expected"); - message.accessLevel = $root.google.identity.accesscontextmanager.v1.AccessLevel.fromObject(object.accessLevel); - } - if (object.servicePerimeter != null) { - if (typeof object.servicePerimeter !== "object") - throw TypeError(".google.cloud.asset.v1.Asset.servicePerimeter: object expected"); - message.servicePerimeter = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.fromObject(object.servicePerimeter); - } - if (object.ancestors) { - if (!Array.isArray(object.ancestors)) - throw TypeError(".google.cloud.asset.v1.Asset.ancestors: array expected"); - message.ancestors = []; - for (var i = 0; i < object.ancestors.length; ++i) - message.ancestors[i] = String(object.ancestors[i]); - } + var message = new $root.google.cloud.asset.v1.SearchAllIamPoliciesRequest(); + if (object.scope != null) + message.scope = String(object.scope); + if (object.query != null) + message.query = String(object.query); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from an Asset message. Also converts values to other types if specified. + * Creates a plain object from a SearchAllIamPoliciesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @static - * @param {google.cloud.asset.v1.Asset} message Asset + * @param {google.cloud.asset.v1.SearchAllIamPoliciesRequest} message SearchAllIamPoliciesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Asset.toObject = function toObject(message, options) { + SearchAllIamPoliciesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.orgPolicy = []; - object.ancestors = []; - } if (options.defaults) { - object.name = ""; - object.assetType = ""; - object.resource = null; - object.iamPolicy = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.assetType != null && message.hasOwnProperty("assetType")) - object.assetType = message.assetType; - if (message.resource != null && message.hasOwnProperty("resource")) - object.resource = $root.google.cloud.asset.v1.Resource.toObject(message.resource, options); - if (message.iamPolicy != null && message.hasOwnProperty("iamPolicy")) - object.iamPolicy = $root.google.iam.v1.Policy.toObject(message.iamPolicy, options); - if (message.orgPolicy && message.orgPolicy.length) { - object.orgPolicy = []; - for (var j = 0; j < message.orgPolicy.length; ++j) - object.orgPolicy[j] = $root.google.cloud.orgpolicy.v1.Policy.toObject(message.orgPolicy[j], options); - } - if (message.accessPolicy != null && message.hasOwnProperty("accessPolicy")) { - object.accessPolicy = $root.google.identity.accesscontextmanager.v1.AccessPolicy.toObject(message.accessPolicy, options); - if (options.oneofs) - object.accessContextPolicy = "accessPolicy"; - } - if (message.accessLevel != null && message.hasOwnProperty("accessLevel")) { - object.accessLevel = $root.google.identity.accesscontextmanager.v1.AccessLevel.toObject(message.accessLevel, options); - if (options.oneofs) - object.accessContextPolicy = "accessLevel"; - } - if (message.servicePerimeter != null && message.hasOwnProperty("servicePerimeter")) { - object.servicePerimeter = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.toObject(message.servicePerimeter, options); - if (options.oneofs) - object.accessContextPolicy = "servicePerimeter"; - } - if (message.ancestors && message.ancestors.length) { - object.ancestors = []; - for (var j = 0; j < message.ancestors.length; ++j) - object.ancestors[j] = message.ancestors[j]; + object.scope = ""; + object.query = ""; + object.pageSize = 0; + object.pageToken = ""; } + if (message.scope != null && message.hasOwnProperty("scope")) + object.scope = message.scope; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; return object; }; /** - * Converts this Asset to JSON. + * Converts this SearchAllIamPoliciesRequest to JSON. * @function toJSON - * @memberof google.cloud.asset.v1.Asset + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesRequest * @instance * @returns {Object.} JSON object */ - Asset.prototype.toJSON = function toJSON() { + SearchAllIamPoliciesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Asset; + return SearchAllIamPoliciesRequest; })(); - v1.Resource = (function() { + v1.SearchAllIamPoliciesResponse = (function() { /** - * Properties of a Resource. + * Properties of a SearchAllIamPoliciesResponse. * @memberof google.cloud.asset.v1 - * @interface IResource - * @property {string|null} [version] Resource version - * @property {string|null} [discoveryDocumentUri] Resource discoveryDocumentUri - * @property {string|null} [discoveryName] Resource discoveryName - * @property {string|null} [resourceUrl] Resource resourceUrl - * @property {string|null} [parent] Resource parent - * @property {google.protobuf.IStruct|null} [data] Resource data + * @interface ISearchAllIamPoliciesResponse + * @property {Array.|null} [results] SearchAllIamPoliciesResponse results + * @property {string|null} [nextPageToken] SearchAllIamPoliciesResponse nextPageToken */ /** - * Constructs a new Resource. + * Constructs a new SearchAllIamPoliciesResponse. * @memberof google.cloud.asset.v1 - * @classdesc Represents a Resource. - * @implements IResource + * @classdesc Represents a SearchAllIamPoliciesResponse. + * @implements ISearchAllIamPoliciesResponse * @constructor - * @param {google.cloud.asset.v1.IResource=} [properties] Properties to set + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesResponse=} [properties] Properties to set */ - function Resource(properties) { + function SearchAllIamPoliciesResponse(properties) { + this.results = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5046,140 +4965,91 @@ } /** - * Resource version. - * @member {string} version - * @memberof google.cloud.asset.v1.Resource - * @instance - */ - Resource.prototype.version = ""; - - /** - * Resource discoveryDocumentUri. - * @member {string} discoveryDocumentUri - * @memberof google.cloud.asset.v1.Resource - * @instance - */ - Resource.prototype.discoveryDocumentUri = ""; - - /** - * Resource discoveryName. - * @member {string} discoveryName - * @memberof google.cloud.asset.v1.Resource - * @instance - */ - Resource.prototype.discoveryName = ""; - - /** - * Resource resourceUrl. - * @member {string} resourceUrl - * @memberof google.cloud.asset.v1.Resource - * @instance - */ - Resource.prototype.resourceUrl = ""; - - /** - * Resource parent. - * @member {string} parent - * @memberof google.cloud.asset.v1.Resource + * SearchAllIamPoliciesResponse results. + * @member {Array.} results + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @instance */ - Resource.prototype.parent = ""; + SearchAllIamPoliciesResponse.prototype.results = $util.emptyArray; /** - * Resource data. - * @member {google.protobuf.IStruct|null|undefined} data - * @memberof google.cloud.asset.v1.Resource + * SearchAllIamPoliciesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @instance */ - Resource.prototype.data = null; + SearchAllIamPoliciesResponse.prototype.nextPageToken = ""; /** - * Creates a new Resource instance using the specified properties. + * Creates a new SearchAllIamPoliciesResponse instance using the specified properties. * @function create - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static - * @param {google.cloud.asset.v1.IResource=} [properties] Properties to set - * @returns {google.cloud.asset.v1.Resource} Resource instance + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesResponse=} [properties] Properties to set + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesResponse} SearchAllIamPoliciesResponse instance */ - Resource.create = function create(properties) { - return new Resource(properties); + SearchAllIamPoliciesResponse.create = function create(properties) { + return new SearchAllIamPoliciesResponse(properties); }; /** - * Encodes the specified Resource message. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. + * Encodes the specified SearchAllIamPoliciesResponse message. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static - * @param {google.cloud.asset.v1.IResource} message Resource message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesResponse} message SearchAllIamPoliciesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Resource.encode = function encode(message, writer) { + SearchAllIamPoliciesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); - if (message.discoveryDocumentUri != null && Object.hasOwnProperty.call(message, "discoveryDocumentUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.discoveryDocumentUri); - if (message.discoveryName != null && Object.hasOwnProperty.call(message, "discoveryName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.discoveryName); - if (message.resourceUrl != null && Object.hasOwnProperty.call(message, "resourceUrl")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.resourceUrl); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.parent); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - $root.google.protobuf.Struct.encode(message.data, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.asset.v1.IamPolicySearchResult.encode(message.results[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; /** - * Encodes the specified Resource message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. + * Encodes the specified SearchAllIamPoliciesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.SearchAllIamPoliciesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static - * @param {google.cloud.asset.v1.IResource} message Resource message or plain object to encode + * @param {google.cloud.asset.v1.ISearchAllIamPoliciesResponse} message SearchAllIamPoliciesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Resource.encodeDelimited = function encodeDelimited(message, writer) { + SearchAllIamPoliciesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Resource message from the specified reader or buffer. + * Decodes a SearchAllIamPoliciesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.asset.v1.Resource} Resource + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesResponse} SearchAllIamPoliciesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Resource.decode = function decode(reader, length) { + SearchAllIamPoliciesResponse.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.cloud.asset.v1.Resource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.asset.v1.SearchAllIamPoliciesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.version = reader.string(); + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.asset.v1.IamPolicySearchResult.decode(reader, reader.uint32())); break; case 2: - message.discoveryDocumentUri = reader.string(); - break; - case 3: - message.discoveryName = reader.string(); - break; - case 4: - message.resourceUrl = reader.string(); - break; - case 5: - message.parent = reader.string(); - break; - case 6: - message.data = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + message.nextPageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -5190,133 +5060,2472 @@ }; /** - * Decodes a Resource message from the specified reader or buffer, length delimited. + * Decodes a SearchAllIamPoliciesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.asset.v1.Resource} Resource + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesResponse} SearchAllIamPoliciesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Resource.decodeDelimited = function decodeDelimited(reader) { + SearchAllIamPoliciesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Resource message. + * Verifies a SearchAllIamPoliciesResponse message. * @function verify - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Resource.verify = function verify(message) { + SearchAllIamPoliciesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.discoveryDocumentUri != null && message.hasOwnProperty("discoveryDocumentUri")) - if (!$util.isString(message.discoveryDocumentUri)) - return "discoveryDocumentUri: string expected"; - if (message.discoveryName != null && message.hasOwnProperty("discoveryName")) - if (!$util.isString(message.discoveryName)) - return "discoveryName: string expected"; - if (message.resourceUrl != null && message.hasOwnProperty("resourceUrl")) - if (!$util.isString(message.resourceUrl)) - return "resourceUrl: string expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.data != null && message.hasOwnProperty("data")) { - var error = $root.google.protobuf.Struct.verify(message.data); - if (error) - return "data." + error; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.asset.v1.IamPolicySearchResult.verify(message.results[i]); + if (error) + return "results." + error; + } } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; return null; }; /** - * Creates a Resource message from a plain object. Also converts values to their respective internal types. + * Creates a SearchAllIamPoliciesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.asset.v1.Resource} Resource + * @returns {google.cloud.asset.v1.SearchAllIamPoliciesResponse} SearchAllIamPoliciesResponse */ - Resource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.asset.v1.Resource) + SearchAllIamPoliciesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.SearchAllIamPoliciesResponse) return object; - var message = new $root.google.cloud.asset.v1.Resource(); - if (object.version != null) - message.version = String(object.version); - if (object.discoveryDocumentUri != null) - message.discoveryDocumentUri = String(object.discoveryDocumentUri); - if (object.discoveryName != null) - message.discoveryName = String(object.discoveryName); - if (object.resourceUrl != null) - message.resourceUrl = String(object.resourceUrl); - if (object.parent != null) - message.parent = String(object.parent); - if (object.data != null) { - if (typeof object.data !== "object") - throw TypeError(".google.cloud.asset.v1.Resource.data: object expected"); - message.data = $root.google.protobuf.Struct.fromObject(object.data); + var message = new $root.google.cloud.asset.v1.SearchAllIamPoliciesResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.asset.v1.SearchAllIamPoliciesResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.asset.v1.SearchAllIamPoliciesResponse.results: object expected"); + message.results[i] = $root.google.cloud.asset.v1.IamPolicySearchResult.fromObject(object.results[i]); + } } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); return message; }; /** - * Creates a plain object from a Resource message. Also converts values to other types if specified. + * Creates a plain object from a SearchAllIamPoliciesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @static - * @param {google.cloud.asset.v1.Resource} message Resource + * @param {google.cloud.asset.v1.SearchAllIamPoliciesResponse} message SearchAllIamPoliciesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Resource.toObject = function toObject(message, options) { + SearchAllIamPoliciesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.version = ""; - object.discoveryDocumentUri = ""; - object.discoveryName = ""; - object.resourceUrl = ""; - object.parent = ""; - object.data = null; + if (options.arrays || options.defaults) + object.results = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.asset.v1.IamPolicySearchResult.toObject(message.results[j], options); } - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.discoveryDocumentUri != null && message.hasOwnProperty("discoveryDocumentUri")) - object.discoveryDocumentUri = message.discoveryDocumentUri; - if (message.discoveryName != null && message.hasOwnProperty("discoveryName")) - object.discoveryName = message.discoveryName; - if (message.resourceUrl != null && message.hasOwnProperty("resourceUrl")) - object.resourceUrl = message.resourceUrl; - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.data != null && message.hasOwnProperty("data")) - object.data = $root.google.protobuf.Struct.toObject(message.data, options); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; return object; }; /** - * Converts this Resource to JSON. + * Converts this SearchAllIamPoliciesResponse to JSON. * @function toJSON - * @memberof google.cloud.asset.v1.Resource + * @memberof google.cloud.asset.v1.SearchAllIamPoliciesResponse * @instance * @returns {Object.} JSON object */ - Resource.prototype.toJSON = function toJSON() { + SearchAllIamPoliciesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Resource; + return SearchAllIamPoliciesResponse; + })(); + + /** + * ContentType enum. + * @name google.cloud.asset.v1.ContentType + * @enum {number} + * @property {number} CONTENT_TYPE_UNSPECIFIED=0 CONTENT_TYPE_UNSPECIFIED value + * @property {number} RESOURCE=1 RESOURCE value + * @property {number} IAM_POLICY=2 IAM_POLICY value + * @property {number} ORG_POLICY=4 ORG_POLICY value + * @property {number} ACCESS_POLICY=5 ACCESS_POLICY value + */ + v1.ContentType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONTENT_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RESOURCE"] = 1; + values[valuesById[2] = "IAM_POLICY"] = 2; + values[valuesById[4] = "ORG_POLICY"] = 4; + values[valuesById[5] = "ACCESS_POLICY"] = 5; + return values; + })(); + + v1.TemporalAsset = (function() { + + /** + * Properties of a TemporalAsset. + * @memberof google.cloud.asset.v1 + * @interface ITemporalAsset + * @property {google.cloud.asset.v1.ITimeWindow|null} [window] TemporalAsset window + * @property {boolean|null} [deleted] TemporalAsset deleted + * @property {google.cloud.asset.v1.IAsset|null} [asset] TemporalAsset asset + */ + + /** + * Constructs a new TemporalAsset. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a TemporalAsset. + * @implements ITemporalAsset + * @constructor + * @param {google.cloud.asset.v1.ITemporalAsset=} [properties] Properties to set + */ + function TemporalAsset(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]]; + } + + /** + * TemporalAsset window. + * @member {google.cloud.asset.v1.ITimeWindow|null|undefined} window + * @memberof google.cloud.asset.v1.TemporalAsset + * @instance + */ + TemporalAsset.prototype.window = null; + + /** + * TemporalAsset deleted. + * @member {boolean} deleted + * @memberof google.cloud.asset.v1.TemporalAsset + * @instance + */ + TemporalAsset.prototype.deleted = false; + + /** + * TemporalAsset asset. + * @member {google.cloud.asset.v1.IAsset|null|undefined} asset + * @memberof google.cloud.asset.v1.TemporalAsset + * @instance + */ + TemporalAsset.prototype.asset = null; + + /** + * Creates a new TemporalAsset instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {google.cloud.asset.v1.ITemporalAsset=} [properties] Properties to set + * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset instance + */ + TemporalAsset.create = function create(properties) { + return new TemporalAsset(properties); + }; + + /** + * Encodes the specified TemporalAsset message. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {google.cloud.asset.v1.ITemporalAsset} message TemporalAsset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemporalAsset.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.window != null && Object.hasOwnProperty.call(message, "window")) + $root.google.cloud.asset.v1.TimeWindow.encode(message.window, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.deleted != null && Object.hasOwnProperty.call(message, "deleted")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.deleted); + if (message.asset != null && Object.hasOwnProperty.call(message, "asset")) + $root.google.cloud.asset.v1.Asset.encode(message.asset, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TemporalAsset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TemporalAsset.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {google.cloud.asset.v1.ITemporalAsset} message TemporalAsset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemporalAsset.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TemporalAsset message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemporalAsset.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.cloud.asset.v1.TemporalAsset(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.window = $root.google.cloud.asset.v1.TimeWindow.decode(reader, reader.uint32()); + break; + case 2: + message.deleted = reader.bool(); + break; + case 3: + message.asset = $root.google.cloud.asset.v1.Asset.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TemporalAsset message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemporalAsset.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TemporalAsset message. + * @function verify + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TemporalAsset.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.window != null && message.hasOwnProperty("window")) { + var error = $root.google.cloud.asset.v1.TimeWindow.verify(message.window); + if (error) + return "window." + error; + } + if (message.deleted != null && message.hasOwnProperty("deleted")) + if (typeof message.deleted !== "boolean") + return "deleted: boolean expected"; + if (message.asset != null && message.hasOwnProperty("asset")) { + var error = $root.google.cloud.asset.v1.Asset.verify(message.asset); + if (error) + return "asset." + error; + } + return null; + }; + + /** + * Creates a TemporalAsset message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.TemporalAsset} TemporalAsset + */ + TemporalAsset.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.TemporalAsset) + return object; + var message = new $root.google.cloud.asset.v1.TemporalAsset(); + if (object.window != null) { + if (typeof object.window !== "object") + throw TypeError(".google.cloud.asset.v1.TemporalAsset.window: object expected"); + message.window = $root.google.cloud.asset.v1.TimeWindow.fromObject(object.window); + } + if (object.deleted != null) + message.deleted = Boolean(object.deleted); + if (object.asset != null) { + if (typeof object.asset !== "object") + throw TypeError(".google.cloud.asset.v1.TemporalAsset.asset: object expected"); + message.asset = $root.google.cloud.asset.v1.Asset.fromObject(object.asset); + } + return message; + }; + + /** + * Creates a plain object from a TemporalAsset message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.TemporalAsset + * @static + * @param {google.cloud.asset.v1.TemporalAsset} message TemporalAsset + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TemporalAsset.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.window = null; + object.deleted = false; + object.asset = null; + } + if (message.window != null && message.hasOwnProperty("window")) + object.window = $root.google.cloud.asset.v1.TimeWindow.toObject(message.window, options); + if (message.deleted != null && message.hasOwnProperty("deleted")) + object.deleted = message.deleted; + if (message.asset != null && message.hasOwnProperty("asset")) + object.asset = $root.google.cloud.asset.v1.Asset.toObject(message.asset, options); + return object; + }; + + /** + * Converts this TemporalAsset to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.TemporalAsset + * @instance + * @returns {Object.} JSON object + */ + TemporalAsset.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TemporalAsset; + })(); + + v1.TimeWindow = (function() { + + /** + * Properties of a TimeWindow. + * @memberof google.cloud.asset.v1 + * @interface ITimeWindow + * @property {google.protobuf.ITimestamp|null} [startTime] TimeWindow startTime + * @property {google.protobuf.ITimestamp|null} [endTime] TimeWindow endTime + */ + + /** + * Constructs a new TimeWindow. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a TimeWindow. + * @implements ITimeWindow + * @constructor + * @param {google.cloud.asset.v1.ITimeWindow=} [properties] Properties to set + */ + function TimeWindow(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]]; + } + + /** + * TimeWindow startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.asset.v1.TimeWindow + * @instance + */ + TimeWindow.prototype.startTime = null; + + /** + * TimeWindow endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.asset.v1.TimeWindow + * @instance + */ + TimeWindow.prototype.endTime = null; + + /** + * Creates a new TimeWindow instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {google.cloud.asset.v1.ITimeWindow=} [properties] Properties to set + * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow instance + */ + TimeWindow.create = function create(properties) { + return new TimeWindow(properties); + }; + + /** + * Encodes the specified TimeWindow message. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {google.cloud.asset.v1.ITimeWindow} message TimeWindow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeWindow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeWindow message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TimeWindow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {google.cloud.asset.v1.ITimeWindow} message TimeWindow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeWindow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeWindow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeWindow.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.cloud.asset.v1.TimeWindow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeWindow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeWindow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeWindow message. + * @function verify + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeWindow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates a TimeWindow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.TimeWindow} TimeWindow + */ + TimeWindow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.TimeWindow) + return object; + var message = new $root.google.cloud.asset.v1.TimeWindow(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.asset.v1.TimeWindow.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.asset.v1.TimeWindow.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a TimeWindow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.TimeWindow + * @static + * @param {google.cloud.asset.v1.TimeWindow} message TimeWindow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeWindow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this TimeWindow to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.TimeWindow + * @instance + * @returns {Object.} JSON object + */ + TimeWindow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TimeWindow; + })(); + + v1.Asset = (function() { + + /** + * Properties of an Asset. + * @memberof google.cloud.asset.v1 + * @interface IAsset + * @property {string|null} [name] Asset name + * @property {string|null} [assetType] Asset assetType + * @property {google.cloud.asset.v1.IResource|null} [resource] Asset resource + * @property {google.iam.v1.IPolicy|null} [iamPolicy] Asset iamPolicy + * @property {Array.|null} [orgPolicy] Asset orgPolicy + * @property {google.identity.accesscontextmanager.v1.IAccessPolicy|null} [accessPolicy] Asset accessPolicy + * @property {google.identity.accesscontextmanager.v1.IAccessLevel|null} [accessLevel] Asset accessLevel + * @property {google.identity.accesscontextmanager.v1.IServicePerimeter|null} [servicePerimeter] Asset servicePerimeter + * @property {Array.|null} [ancestors] Asset ancestors + */ + + /** + * Constructs a new Asset. + * @memberof google.cloud.asset.v1 + * @classdesc Represents an Asset. + * @implements IAsset + * @constructor + * @param {google.cloud.asset.v1.IAsset=} [properties] Properties to set + */ + function Asset(properties) { + this.orgPolicy = []; + this.ancestors = []; + 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]]; + } + + /** + * Asset name. + * @member {string} name + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.name = ""; + + /** + * Asset assetType. + * @member {string} assetType + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.assetType = ""; + + /** + * Asset resource. + * @member {google.cloud.asset.v1.IResource|null|undefined} resource + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.resource = null; + + /** + * Asset iamPolicy. + * @member {google.iam.v1.IPolicy|null|undefined} iamPolicy + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.iamPolicy = null; + + /** + * Asset orgPolicy. + * @member {Array.} orgPolicy + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.orgPolicy = $util.emptyArray; + + /** + * Asset accessPolicy. + * @member {google.identity.accesscontextmanager.v1.IAccessPolicy|null|undefined} accessPolicy + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.accessPolicy = null; + + /** + * Asset accessLevel. + * @member {google.identity.accesscontextmanager.v1.IAccessLevel|null|undefined} accessLevel + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.accessLevel = null; + + /** + * Asset servicePerimeter. + * @member {google.identity.accesscontextmanager.v1.IServicePerimeter|null|undefined} servicePerimeter + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.servicePerimeter = null; + + /** + * Asset ancestors. + * @member {Array.} ancestors + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Asset.prototype.ancestors = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Asset accessContextPolicy. + * @member {"accessPolicy"|"accessLevel"|"servicePerimeter"|undefined} accessContextPolicy + * @memberof google.cloud.asset.v1.Asset + * @instance + */ + Object.defineProperty(Asset.prototype, "accessContextPolicy", { + get: $util.oneOfGetter($oneOfFields = ["accessPolicy", "accessLevel", "servicePerimeter"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Asset instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {google.cloud.asset.v1.IAsset=} [properties] Properties to set + * @returns {google.cloud.asset.v1.Asset} Asset instance + */ + Asset.create = function create(properties) { + return new Asset(properties); + }; + + /** + * Encodes the specified Asset message. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {google.cloud.asset.v1.IAsset} message Asset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Asset.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.assetType != null && Object.hasOwnProperty.call(message, "assetType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.assetType); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + $root.google.cloud.asset.v1.Resource.encode(message.resource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.iamPolicy != null && Object.hasOwnProperty.call(message, "iamPolicy")) + $root.google.iam.v1.Policy.encode(message.iamPolicy, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.orgPolicy != null && message.orgPolicy.length) + for (var i = 0; i < message.orgPolicy.length; ++i) + $root.google.cloud.orgpolicy.v1.Policy.encode(message.orgPolicy[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.accessPolicy != null && Object.hasOwnProperty.call(message, "accessPolicy")) + $root.google.identity.accesscontextmanager.v1.AccessPolicy.encode(message.accessPolicy, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.accessLevel != null && Object.hasOwnProperty.call(message, "accessLevel")) + $root.google.identity.accesscontextmanager.v1.AccessLevel.encode(message.accessLevel, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.servicePerimeter != null && Object.hasOwnProperty.call(message, "servicePerimeter")) + $root.google.identity.accesscontextmanager.v1.ServicePerimeter.encode(message.servicePerimeter, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.ancestors != null && message.ancestors.length) + for (var i = 0; i < message.ancestors.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.ancestors[i]); + return writer; + }; + + /** + * Encodes the specified Asset message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Asset.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {google.cloud.asset.v1.IAsset} message Asset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Asset.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Asset message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.Asset} Asset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Asset.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.cloud.asset.v1.Asset(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.assetType = reader.string(); + break; + case 3: + message.resource = $root.google.cloud.asset.v1.Resource.decode(reader, reader.uint32()); + break; + case 4: + message.iamPolicy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); + break; + case 6: + if (!(message.orgPolicy && message.orgPolicy.length)) + message.orgPolicy = []; + message.orgPolicy.push($root.google.cloud.orgpolicy.v1.Policy.decode(reader, reader.uint32())); + break; + case 7: + message.accessPolicy = $root.google.identity.accesscontextmanager.v1.AccessPolicy.decode(reader, reader.uint32()); + break; + case 8: + message.accessLevel = $root.google.identity.accesscontextmanager.v1.AccessLevel.decode(reader, reader.uint32()); + break; + case 9: + message.servicePerimeter = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.decode(reader, reader.uint32()); + break; + case 10: + if (!(message.ancestors && message.ancestors.length)) + message.ancestors = []; + message.ancestors.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Asset message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.Asset} Asset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Asset.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Asset message. + * @function verify + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Asset.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.assetType != null && message.hasOwnProperty("assetType")) + if (!$util.isString(message.assetType)) + return "assetType: string expected"; + if (message.resource != null && message.hasOwnProperty("resource")) { + var error = $root.google.cloud.asset.v1.Resource.verify(message.resource); + if (error) + return "resource." + error; + } + if (message.iamPolicy != null && message.hasOwnProperty("iamPolicy")) { + var error = $root.google.iam.v1.Policy.verify(message.iamPolicy); + if (error) + return "iamPolicy." + error; + } + if (message.orgPolicy != null && message.hasOwnProperty("orgPolicy")) { + if (!Array.isArray(message.orgPolicy)) + return "orgPolicy: array expected"; + for (var i = 0; i < message.orgPolicy.length; ++i) { + var error = $root.google.cloud.orgpolicy.v1.Policy.verify(message.orgPolicy[i]); + if (error) + return "orgPolicy." + error; + } + } + if (message.accessPolicy != null && message.hasOwnProperty("accessPolicy")) { + properties.accessContextPolicy = 1; + { + var error = $root.google.identity.accesscontextmanager.v1.AccessPolicy.verify(message.accessPolicy); + if (error) + return "accessPolicy." + error; + } + } + if (message.accessLevel != null && message.hasOwnProperty("accessLevel")) { + if (properties.accessContextPolicy === 1) + return "accessContextPolicy: multiple values"; + properties.accessContextPolicy = 1; + { + var error = $root.google.identity.accesscontextmanager.v1.AccessLevel.verify(message.accessLevel); + if (error) + return "accessLevel." + error; + } + } + if (message.servicePerimeter != null && message.hasOwnProperty("servicePerimeter")) { + if (properties.accessContextPolicy === 1) + return "accessContextPolicy: multiple values"; + properties.accessContextPolicy = 1; + { + var error = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.verify(message.servicePerimeter); + if (error) + return "servicePerimeter." + error; + } + } + if (message.ancestors != null && message.hasOwnProperty("ancestors")) { + if (!Array.isArray(message.ancestors)) + return "ancestors: array expected"; + for (var i = 0; i < message.ancestors.length; ++i) + if (!$util.isString(message.ancestors[i])) + return "ancestors: string[] expected"; + } + return null; + }; + + /** + * Creates an Asset message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.Asset} Asset + */ + Asset.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.Asset) + return object; + var message = new $root.google.cloud.asset.v1.Asset(); + if (object.name != null) + message.name = String(object.name); + if (object.assetType != null) + message.assetType = String(object.assetType); + if (object.resource != null) { + if (typeof object.resource !== "object") + throw TypeError(".google.cloud.asset.v1.Asset.resource: object expected"); + message.resource = $root.google.cloud.asset.v1.Resource.fromObject(object.resource); + } + if (object.iamPolicy != null) { + if (typeof object.iamPolicy !== "object") + throw TypeError(".google.cloud.asset.v1.Asset.iamPolicy: object expected"); + message.iamPolicy = $root.google.iam.v1.Policy.fromObject(object.iamPolicy); + } + if (object.orgPolicy) { + if (!Array.isArray(object.orgPolicy)) + throw TypeError(".google.cloud.asset.v1.Asset.orgPolicy: array expected"); + message.orgPolicy = []; + for (var i = 0; i < object.orgPolicy.length; ++i) { + if (typeof object.orgPolicy[i] !== "object") + throw TypeError(".google.cloud.asset.v1.Asset.orgPolicy: object expected"); + message.orgPolicy[i] = $root.google.cloud.orgpolicy.v1.Policy.fromObject(object.orgPolicy[i]); + } + } + if (object.accessPolicy != null) { + if (typeof object.accessPolicy !== "object") + throw TypeError(".google.cloud.asset.v1.Asset.accessPolicy: object expected"); + message.accessPolicy = $root.google.identity.accesscontextmanager.v1.AccessPolicy.fromObject(object.accessPolicy); + } + if (object.accessLevel != null) { + if (typeof object.accessLevel !== "object") + throw TypeError(".google.cloud.asset.v1.Asset.accessLevel: object expected"); + message.accessLevel = $root.google.identity.accesscontextmanager.v1.AccessLevel.fromObject(object.accessLevel); + } + if (object.servicePerimeter != null) { + if (typeof object.servicePerimeter !== "object") + throw TypeError(".google.cloud.asset.v1.Asset.servicePerimeter: object expected"); + message.servicePerimeter = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.fromObject(object.servicePerimeter); + } + if (object.ancestors) { + if (!Array.isArray(object.ancestors)) + throw TypeError(".google.cloud.asset.v1.Asset.ancestors: array expected"); + message.ancestors = []; + for (var i = 0; i < object.ancestors.length; ++i) + message.ancestors[i] = String(object.ancestors[i]); + } + return message; + }; + + /** + * Creates a plain object from an Asset message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.Asset + * @static + * @param {google.cloud.asset.v1.Asset} message Asset + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Asset.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.orgPolicy = []; + object.ancestors = []; + } + if (options.defaults) { + object.name = ""; + object.assetType = ""; + object.resource = null; + object.iamPolicy = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.assetType != null && message.hasOwnProperty("assetType")) + object.assetType = message.assetType; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = $root.google.cloud.asset.v1.Resource.toObject(message.resource, options); + if (message.iamPolicy != null && message.hasOwnProperty("iamPolicy")) + object.iamPolicy = $root.google.iam.v1.Policy.toObject(message.iamPolicy, options); + if (message.orgPolicy && message.orgPolicy.length) { + object.orgPolicy = []; + for (var j = 0; j < message.orgPolicy.length; ++j) + object.orgPolicy[j] = $root.google.cloud.orgpolicy.v1.Policy.toObject(message.orgPolicy[j], options); + } + if (message.accessPolicy != null && message.hasOwnProperty("accessPolicy")) { + object.accessPolicy = $root.google.identity.accesscontextmanager.v1.AccessPolicy.toObject(message.accessPolicy, options); + if (options.oneofs) + object.accessContextPolicy = "accessPolicy"; + } + if (message.accessLevel != null && message.hasOwnProperty("accessLevel")) { + object.accessLevel = $root.google.identity.accesscontextmanager.v1.AccessLevel.toObject(message.accessLevel, options); + if (options.oneofs) + object.accessContextPolicy = "accessLevel"; + } + if (message.servicePerimeter != null && message.hasOwnProperty("servicePerimeter")) { + object.servicePerimeter = $root.google.identity.accesscontextmanager.v1.ServicePerimeter.toObject(message.servicePerimeter, options); + if (options.oneofs) + object.accessContextPolicy = "servicePerimeter"; + } + if (message.ancestors && message.ancestors.length) { + object.ancestors = []; + for (var j = 0; j < message.ancestors.length; ++j) + object.ancestors[j] = message.ancestors[j]; + } + return object; + }; + + /** + * Converts this Asset to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.Asset + * @instance + * @returns {Object.} JSON object + */ + Asset.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Asset; + })(); + + v1.Resource = (function() { + + /** + * Properties of a Resource. + * @memberof google.cloud.asset.v1 + * @interface IResource + * @property {string|null} [version] Resource version + * @property {string|null} [discoveryDocumentUri] Resource discoveryDocumentUri + * @property {string|null} [discoveryName] Resource discoveryName + * @property {string|null} [resourceUrl] Resource resourceUrl + * @property {string|null} [parent] Resource parent + * @property {google.protobuf.IStruct|null} [data] Resource data + * @property {string|null} [location] Resource location + */ + + /** + * Constructs a new Resource. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a Resource. + * @implements IResource + * @constructor + * @param {google.cloud.asset.v1.IResource=} [properties] Properties to set + */ + function Resource(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]]; + } + + /** + * Resource version. + * @member {string} version + * @memberof google.cloud.asset.v1.Resource + * @instance + */ + Resource.prototype.version = ""; + + /** + * Resource discoveryDocumentUri. + * @member {string} discoveryDocumentUri + * @memberof google.cloud.asset.v1.Resource + * @instance + */ + Resource.prototype.discoveryDocumentUri = ""; + + /** + * Resource discoveryName. + * @member {string} discoveryName + * @memberof google.cloud.asset.v1.Resource + * @instance + */ + Resource.prototype.discoveryName = ""; + + /** + * Resource resourceUrl. + * @member {string} resourceUrl + * @memberof google.cloud.asset.v1.Resource + * @instance + */ + Resource.prototype.resourceUrl = ""; + + /** + * Resource parent. + * @member {string} parent + * @memberof google.cloud.asset.v1.Resource + * @instance + */ + Resource.prototype.parent = ""; + + /** + * Resource data. + * @member {google.protobuf.IStruct|null|undefined} data + * @memberof google.cloud.asset.v1.Resource + * @instance + */ + Resource.prototype.data = null; + + /** + * Resource location. + * @member {string} location + * @memberof google.cloud.asset.v1.Resource + * @instance + */ + Resource.prototype.location = ""; + + /** + * Creates a new Resource instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {google.cloud.asset.v1.IResource=} [properties] Properties to set + * @returns {google.cloud.asset.v1.Resource} Resource instance + */ + Resource.create = function create(properties) { + return new Resource(properties); + }; + + /** + * Encodes the specified Resource message. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {google.cloud.asset.v1.IResource} message Resource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Resource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.discoveryDocumentUri != null && Object.hasOwnProperty.call(message, "discoveryDocumentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.discoveryDocumentUri); + if (message.discoveryName != null && Object.hasOwnProperty.call(message, "discoveryName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.discoveryName); + if (message.resourceUrl != null && Object.hasOwnProperty.call(message, "resourceUrl")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.resourceUrl); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.parent); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + $root.google.protobuf.Struct.encode(message.data, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.location); + return writer; + }; + + /** + * Encodes the specified Resource message, length delimited. Does not implicitly {@link google.cloud.asset.v1.Resource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {google.cloud.asset.v1.IResource} message Resource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Resource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Resource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.Resource} Resource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Resource.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.cloud.asset.v1.Resource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.discoveryDocumentUri = reader.string(); + break; + case 3: + message.discoveryName = reader.string(); + break; + case 4: + message.resourceUrl = reader.string(); + break; + case 5: + message.parent = reader.string(); + break; + case 6: + message.data = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 8: + message.location = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Resource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.Resource} Resource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Resource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Resource message. + * @function verify + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Resource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.discoveryDocumentUri != null && message.hasOwnProperty("discoveryDocumentUri")) + if (!$util.isString(message.discoveryDocumentUri)) + return "discoveryDocumentUri: string expected"; + if (message.discoveryName != null && message.hasOwnProperty("discoveryName")) + if (!$util.isString(message.discoveryName)) + return "discoveryName: string expected"; + if (message.resourceUrl != null && message.hasOwnProperty("resourceUrl")) + if (!$util.isString(message.resourceUrl)) + return "resourceUrl: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.data != null && message.hasOwnProperty("data")) { + var error = $root.google.protobuf.Struct.verify(message.data); + if (error) + return "data." + error; + } + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + return null; + }; + + /** + * Creates a Resource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.Resource} Resource + */ + Resource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.Resource) + return object; + var message = new $root.google.cloud.asset.v1.Resource(); + if (object.version != null) + message.version = String(object.version); + if (object.discoveryDocumentUri != null) + message.discoveryDocumentUri = String(object.discoveryDocumentUri); + if (object.discoveryName != null) + message.discoveryName = String(object.discoveryName); + if (object.resourceUrl != null) + message.resourceUrl = String(object.resourceUrl); + if (object.parent != null) + message.parent = String(object.parent); + if (object.data != null) { + if (typeof object.data !== "object") + throw TypeError(".google.cloud.asset.v1.Resource.data: object expected"); + message.data = $root.google.protobuf.Struct.fromObject(object.data); + } + if (object.location != null) + message.location = String(object.location); + return message; + }; + + /** + * Creates a plain object from a Resource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.Resource + * @static + * @param {google.cloud.asset.v1.Resource} message Resource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Resource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.discoveryDocumentUri = ""; + object.discoveryName = ""; + object.resourceUrl = ""; + object.parent = ""; + object.data = null; + object.location = ""; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.discoveryDocumentUri != null && message.hasOwnProperty("discoveryDocumentUri")) + object.discoveryDocumentUri = message.discoveryDocumentUri; + if (message.discoveryName != null && message.hasOwnProperty("discoveryName")) + object.discoveryName = message.discoveryName; + if (message.resourceUrl != null && message.hasOwnProperty("resourceUrl")) + object.resourceUrl = message.resourceUrl; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.data != null && message.hasOwnProperty("data")) + object.data = $root.google.protobuf.Struct.toObject(message.data, options); + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + return object; + }; + + /** + * Converts this Resource to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.Resource + * @instance + * @returns {Object.} JSON object + */ + Resource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Resource; + })(); + + v1.ResourceSearchResult = (function() { + + /** + * Properties of a ResourceSearchResult. + * @memberof google.cloud.asset.v1 + * @interface IResourceSearchResult + * @property {string|null} [name] ResourceSearchResult name + * @property {string|null} [assetType] ResourceSearchResult assetType + * @property {string|null} [project] ResourceSearchResult project + * @property {string|null} [displayName] ResourceSearchResult displayName + * @property {string|null} [description] ResourceSearchResult description + * @property {string|null} [location] ResourceSearchResult location + * @property {Object.|null} [labels] ResourceSearchResult labels + * @property {Array.|null} [networkTags] ResourceSearchResult networkTags + * @property {google.protobuf.IStruct|null} [additionalAttributes] ResourceSearchResult additionalAttributes + */ + + /** + * Constructs a new ResourceSearchResult. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a ResourceSearchResult. + * @implements IResourceSearchResult + * @constructor + * @param {google.cloud.asset.v1.IResourceSearchResult=} [properties] Properties to set + */ + function ResourceSearchResult(properties) { + this.labels = {}; + this.networkTags = []; + 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]]; + } + + /** + * ResourceSearchResult name. + * @member {string} name + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.name = ""; + + /** + * ResourceSearchResult assetType. + * @member {string} assetType + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.assetType = ""; + + /** + * ResourceSearchResult project. + * @member {string} project + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.project = ""; + + /** + * ResourceSearchResult displayName. + * @member {string} displayName + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.displayName = ""; + + /** + * ResourceSearchResult description. + * @member {string} description + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.description = ""; + + /** + * ResourceSearchResult location. + * @member {string} location + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.location = ""; + + /** + * ResourceSearchResult labels. + * @member {Object.} labels + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.labels = $util.emptyObject; + + /** + * ResourceSearchResult networkTags. + * @member {Array.} networkTags + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.networkTags = $util.emptyArray; + + /** + * ResourceSearchResult additionalAttributes. + * @member {google.protobuf.IStruct|null|undefined} additionalAttributes + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + */ + ResourceSearchResult.prototype.additionalAttributes = null; + + /** + * Creates a new ResourceSearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {google.cloud.asset.v1.IResourceSearchResult=} [properties] Properties to set + * @returns {google.cloud.asset.v1.ResourceSearchResult} ResourceSearchResult instance + */ + ResourceSearchResult.create = function create(properties) { + return new ResourceSearchResult(properties); + }; + + /** + * Encodes the specified ResourceSearchResult message. Does not implicitly {@link google.cloud.asset.v1.ResourceSearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {google.cloud.asset.v1.IResourceSearchResult} message ResourceSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceSearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.assetType != null && Object.hasOwnProperty.call(message, "assetType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.assetType); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.location); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.networkTags != null && message.networkTags.length) + for (var i = 0; i < message.networkTags.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.networkTags[i]); + if (message.additionalAttributes != null && Object.hasOwnProperty.call(message, "additionalAttributes")) + $root.google.protobuf.Struct.encode(message.additionalAttributes, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ResourceSearchResult message, length delimited. Does not implicitly {@link google.cloud.asset.v1.ResourceSearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {google.cloud.asset.v1.IResourceSearchResult} message ResourceSearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceSearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceSearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.ResourceSearchResult} ResourceSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceSearchResult.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.cloud.asset.v1.ResourceSearchResult(), key; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.assetType = reader.string(); + break; + case 3: + message.project = reader.string(); + break; + case 4: + message.displayName = reader.string(); + break; + case 5: + message.description = reader.string(); + break; + case 6: + message.location = reader.string(); + break; + case 7: + reader.skip().pos++; + if (message.labels === $util.emptyObject) + message.labels = {}; + key = reader.string(); + reader.pos++; + message.labels[key] = reader.string(); + break; + case 8: + if (!(message.networkTags && message.networkTags.length)) + message.networkTags = []; + message.networkTags.push(reader.string()); + break; + case 9: + message.additionalAttributes = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceSearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.ResourceSearchResult} ResourceSearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceSearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceSearchResult message. + * @function verify + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceSearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.assetType != null && message.hasOwnProperty("assetType")) + if (!$util.isString(message.assetType)) + return "assetType: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.networkTags != null && message.hasOwnProperty("networkTags")) { + if (!Array.isArray(message.networkTags)) + return "networkTags: array expected"; + for (var i = 0; i < message.networkTags.length; ++i) + if (!$util.isString(message.networkTags[i])) + return "networkTags: string[] expected"; + } + if (message.additionalAttributes != null && message.hasOwnProperty("additionalAttributes")) { + var error = $root.google.protobuf.Struct.verify(message.additionalAttributes); + if (error) + return "additionalAttributes." + error; + } + return null; + }; + + /** + * Creates a ResourceSearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.ResourceSearchResult} ResourceSearchResult + */ + ResourceSearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.ResourceSearchResult) + return object; + var message = new $root.google.cloud.asset.v1.ResourceSearchResult(); + if (object.name != null) + message.name = String(object.name); + if (object.assetType != null) + message.assetType = String(object.assetType); + if (object.project != null) + message.project = String(object.project); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.location != null) + message.location = String(object.location); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.asset.v1.ResourceSearchResult.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.networkTags) { + if (!Array.isArray(object.networkTags)) + throw TypeError(".google.cloud.asset.v1.ResourceSearchResult.networkTags: array expected"); + message.networkTags = []; + for (var i = 0; i < object.networkTags.length; ++i) + message.networkTags[i] = String(object.networkTags[i]); + } + if (object.additionalAttributes != null) { + if (typeof object.additionalAttributes !== "object") + throw TypeError(".google.cloud.asset.v1.ResourceSearchResult.additionalAttributes: object expected"); + message.additionalAttributes = $root.google.protobuf.Struct.fromObject(object.additionalAttributes); + } + return message; + }; + + /** + * Creates a plain object from a ResourceSearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @static + * @param {google.cloud.asset.v1.ResourceSearchResult} message ResourceSearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceSearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.networkTags = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.assetType = ""; + object.project = ""; + object.displayName = ""; + object.description = ""; + object.location = ""; + object.additionalAttributes = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.assetType != null && message.hasOwnProperty("assetType")) + object.assetType = message.assetType; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.networkTags && message.networkTags.length) { + object.networkTags = []; + for (var j = 0; j < message.networkTags.length; ++j) + object.networkTags[j] = message.networkTags[j]; + } + if (message.additionalAttributes != null && message.hasOwnProperty("additionalAttributes")) + object.additionalAttributes = $root.google.protobuf.Struct.toObject(message.additionalAttributes, options); + return object; + }; + + /** + * Converts this ResourceSearchResult to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.ResourceSearchResult + * @instance + * @returns {Object.} JSON object + */ + ResourceSearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResourceSearchResult; + })(); + + v1.IamPolicySearchResult = (function() { + + /** + * Properties of an IamPolicySearchResult. + * @memberof google.cloud.asset.v1 + * @interface IIamPolicySearchResult + * @property {string|null} [resource] IamPolicySearchResult resource + * @property {string|null} [project] IamPolicySearchResult project + * @property {google.iam.v1.IPolicy|null} [policy] IamPolicySearchResult policy + * @property {google.cloud.asset.v1.IamPolicySearchResult.IExplanation|null} [explanation] IamPolicySearchResult explanation + */ + + /** + * Constructs a new IamPolicySearchResult. + * @memberof google.cloud.asset.v1 + * @classdesc Represents an IamPolicySearchResult. + * @implements IIamPolicySearchResult + * @constructor + * @param {google.cloud.asset.v1.IIamPolicySearchResult=} [properties] Properties to set + */ + function IamPolicySearchResult(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]]; + } + + /** + * IamPolicySearchResult resource. + * @member {string} resource + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @instance + */ + IamPolicySearchResult.prototype.resource = ""; + + /** + * IamPolicySearchResult project. + * @member {string} project + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @instance + */ + IamPolicySearchResult.prototype.project = ""; + + /** + * IamPolicySearchResult policy. + * @member {google.iam.v1.IPolicy|null|undefined} policy + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @instance + */ + IamPolicySearchResult.prototype.policy = null; + + /** + * IamPolicySearchResult explanation. + * @member {google.cloud.asset.v1.IamPolicySearchResult.IExplanation|null|undefined} explanation + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @instance + */ + IamPolicySearchResult.prototype.explanation = null; + + /** + * Creates a new IamPolicySearchResult instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {google.cloud.asset.v1.IIamPolicySearchResult=} [properties] Properties to set + * @returns {google.cloud.asset.v1.IamPolicySearchResult} IamPolicySearchResult instance + */ + IamPolicySearchResult.create = function create(properties) { + return new IamPolicySearchResult(properties); + }; + + /** + * Encodes the specified IamPolicySearchResult message. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {google.cloud.asset.v1.IIamPolicySearchResult} message IamPolicySearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IamPolicySearchResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.policy != null && Object.hasOwnProperty.call(message, "policy")) + $root.google.iam.v1.Policy.encode(message.policy, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.explanation != null && Object.hasOwnProperty.call(message, "explanation")) + $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.encode(message.explanation, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IamPolicySearchResult message, length delimited. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {google.cloud.asset.v1.IIamPolicySearchResult} message IamPolicySearchResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IamPolicySearchResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IamPolicySearchResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.IamPolicySearchResult} IamPolicySearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IamPolicySearchResult.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.cloud.asset.v1.IamPolicySearchResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resource = reader.string(); + break; + case 2: + message.project = reader.string(); + break; + case 3: + message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); + break; + case 4: + message.explanation = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IamPolicySearchResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.IamPolicySearchResult} IamPolicySearchResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IamPolicySearchResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IamPolicySearchResult message. + * @function verify + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IamPolicySearchResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.policy != null && message.hasOwnProperty("policy")) { + var error = $root.google.iam.v1.Policy.verify(message.policy); + if (error) + return "policy." + error; + } + if (message.explanation != null && message.hasOwnProperty("explanation")) { + var error = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.verify(message.explanation); + if (error) + return "explanation." + error; + } + return null; + }; + + /** + * Creates an IamPolicySearchResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.IamPolicySearchResult} IamPolicySearchResult + */ + IamPolicySearchResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.IamPolicySearchResult) + return object; + var message = new $root.google.cloud.asset.v1.IamPolicySearchResult(); + if (object.resource != null) + message.resource = String(object.resource); + if (object.project != null) + message.project = String(object.project); + if (object.policy != null) { + if (typeof object.policy !== "object") + throw TypeError(".google.cloud.asset.v1.IamPolicySearchResult.policy: object expected"); + message.policy = $root.google.iam.v1.Policy.fromObject(object.policy); + } + if (object.explanation != null) { + if (typeof object.explanation !== "object") + throw TypeError(".google.cloud.asset.v1.IamPolicySearchResult.explanation: object expected"); + message.explanation = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.fromObject(object.explanation); + } + return message; + }; + + /** + * Creates a plain object from an IamPolicySearchResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult} message IamPolicySearchResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IamPolicySearchResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resource = ""; + object.project = ""; + object.policy = null; + object.explanation = null; + } + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.policy != null && message.hasOwnProperty("policy")) + object.policy = $root.google.iam.v1.Policy.toObject(message.policy, options); + if (message.explanation != null && message.hasOwnProperty("explanation")) + object.explanation = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.toObject(message.explanation, options); + return object; + }; + + /** + * Converts this IamPolicySearchResult to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @instance + * @returns {Object.} JSON object + */ + IamPolicySearchResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + IamPolicySearchResult.Explanation = (function() { + + /** + * Properties of an Explanation. + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @interface IExplanation + * @property {Object.|null} [matchedPermissions] Explanation matchedPermissions + */ + + /** + * Constructs a new Explanation. + * @memberof google.cloud.asset.v1.IamPolicySearchResult + * @classdesc Represents an Explanation. + * @implements IExplanation + * @constructor + * @param {google.cloud.asset.v1.IamPolicySearchResult.IExplanation=} [properties] Properties to set + */ + function Explanation(properties) { + this.matchedPermissions = {}; + 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]]; + } + + /** + * Explanation matchedPermissions. + * @member {Object.} matchedPermissions + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @instance + */ + Explanation.prototype.matchedPermissions = $util.emptyObject; + + /** + * Creates a new Explanation instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.IExplanation=} [properties] Properties to set + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation} Explanation instance + */ + Explanation.create = function create(properties) { + return new Explanation(properties); + }; + + /** + * Encodes the specified Explanation message. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.IExplanation} message Explanation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Explanation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.matchedPermissions != null && Object.hasOwnProperty.call(message, "matchedPermissions")) + for (var keys = Object.keys(message.matchedPermissions), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.encode(message.matchedPermissions[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Explanation message, length delimited. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.IExplanation} message Explanation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Explanation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Explanation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation} Explanation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Explanation.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.cloud.asset.v1.IamPolicySearchResult.Explanation(), key; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + reader.skip().pos++; + if (message.matchedPermissions === $util.emptyObject) + message.matchedPermissions = {}; + key = reader.string(); + reader.pos++; + message.matchedPermissions[key] = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Explanation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation} Explanation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Explanation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Explanation message. + * @function verify + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Explanation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.matchedPermissions != null && message.hasOwnProperty("matchedPermissions")) { + if (!$util.isObject(message.matchedPermissions)) + return "matchedPermissions: object expected"; + var key = Object.keys(message.matchedPermissions); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.verify(message.matchedPermissions[key[i]]); + if (error) + return "matchedPermissions." + error; + } + } + return null; + }; + + /** + * Creates an Explanation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation} Explanation + */ + Explanation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation) + return object; + var message = new $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation(); + if (object.matchedPermissions) { + if (typeof object.matchedPermissions !== "object") + throw TypeError(".google.cloud.asset.v1.IamPolicySearchResult.Explanation.matchedPermissions: object expected"); + message.matchedPermissions = {}; + for (var keys = Object.keys(object.matchedPermissions), i = 0; i < keys.length; ++i) { + if (typeof object.matchedPermissions[keys[i]] !== "object") + throw TypeError(".google.cloud.asset.v1.IamPolicySearchResult.Explanation.matchedPermissions: object expected"); + message.matchedPermissions[keys[i]] = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.fromObject(object.matchedPermissions[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from an Explanation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.Explanation} message Explanation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Explanation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.matchedPermissions = {}; + var keys2; + if (message.matchedPermissions && (keys2 = Object.keys(message.matchedPermissions)).length) { + object.matchedPermissions = {}; + for (var j = 0; j < keys2.length; ++j) + object.matchedPermissions[keys2[j]] = $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.toObject(message.matchedPermissions[keys2[j]], options); + } + return object; + }; + + /** + * Converts this Explanation to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @instance + * @returns {Object.} JSON object + */ + Explanation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Explanation.Permissions = (function() { + + /** + * Properties of a Permissions. + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @interface IPermissions + * @property {Array.|null} [permissions] Permissions permissions + */ + + /** + * Constructs a new Permissions. + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation + * @classdesc Represents a Permissions. + * @implements IPermissions + * @constructor + * @param {google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions=} [properties] Properties to set + */ + function Permissions(properties) { + this.permissions = []; + 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]]; + } + + /** + * Permissions permissions. + * @member {Array.} permissions + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @instance + */ + Permissions.prototype.permissions = $util.emptyArray; + + /** + * Creates a new Permissions instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions=} [properties] Properties to set + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions} Permissions instance + */ + Permissions.create = function create(properties) { + return new Permissions(properties); + }; + + /** + * Encodes the specified Permissions message. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions} message Permissions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Permissions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.permissions != null && message.permissions.length) + for (var i = 0; i < message.permissions.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.permissions[i]); + return writer; + }; + + /** + * Encodes the specified Permissions message, length delimited. Does not implicitly {@link google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.Explanation.IPermissions} message Permissions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Permissions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Permissions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions} Permissions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Permissions.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.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Permissions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions} Permissions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Permissions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Permissions message. + * @function verify + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Permissions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.permissions != null && message.hasOwnProperty("permissions")) { + if (!Array.isArray(message.permissions)) + return "permissions: array expected"; + for (var i = 0; i < message.permissions.length; ++i) + if (!$util.isString(message.permissions[i])) + return "permissions: string[] expected"; + } + return null; + }; + + /** + * Creates a Permissions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions} Permissions + */ + Permissions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) + return object; + var message = new $root.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions(); + if (object.permissions) { + if (!Array.isArray(object.permissions)) + throw TypeError(".google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.permissions: array expected"); + message.permissions = []; + for (var i = 0; i < object.permissions.length; ++i) + message.permissions[i] = String(object.permissions[i]); + } + return message; + }; + + /** + * Creates a plain object from a Permissions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @static + * @param {google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions} message Permissions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Permissions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.permissions = []; + if (message.permissions && message.permissions.length) { + object.permissions = []; + for (var j = 0; j < message.permissions.length; ++j) + object.permissions[j] = message.permissions[j]; + } + return object; + }; + + /** + * Converts this Permissions to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions + * @instance + * @returns {Object.} JSON object + */ + Permissions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Permissions; + })(); + + return Explanation; + })(); + + return IamPolicySearchResult; })(); return v1; diff --git a/protos/protos.json b/protos/protos.json index 6950b05a..ae2da2f4 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -81,6 +81,22 @@ "(google.api.http).delete": "/v1/{name=*/*/feeds/*}", "(google.api.method_signature)": "name" } + }, + "SearchAllResources": { + "requestType": "SearchAllResourcesRequest", + "responseType": "SearchAllResourcesResponse", + "options": { + "(google.api.http).get": "/v1/{scope=*/*}:searchAllResources", + "(google.api.method_signature)": "scope,query,asset_types" + } + }, + "SearchAllIamPolicies": { + "requestType": "SearchAllIamPoliciesRequest", + "responseType": "SearchAllIamPoliciesResponse", + "options": { + "(google.api.http).get": "/v1/{scope=*/*}:searchAllIamPolicies", + "(google.api.method_signature)": "scope,query" + } } } }, @@ -377,6 +393,111 @@ } } }, + "SearchAllResourcesRequest": { + "fields": { + "scope": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "query": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "assetTypes": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SearchAllResourcesResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "ResourceSearchResult", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "SearchAllIamPoliciesRequest": { + "fields": { + "scope": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "query": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SearchAllIamPoliciesResponse": { + "fields": { + "results": { + "rule": "repeated", + "type": "IamPolicySearchResult", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, "ContentType": { "values": { "CONTENT_TYPE_UNSPECIFIED": 0, @@ -494,6 +615,94 @@ "data": { "type": "google.protobuf.Struct", "id": 6 + }, + "location": { + "type": "string", + "id": 8 + } + } + }, + "ResourceSearchResult": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "assetType": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + }, + "displayName": { + "type": "string", + "id": 4 + }, + "description": { + "type": "string", + "id": 5 + }, + "location": { + "type": "string", + "id": 6 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 7 + }, + "networkTags": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "additionalAttributes": { + "type": "google.protobuf.Struct", + "id": 9 + } + } + }, + "IamPolicySearchResult": { + "fields": { + "resource": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "policy": { + "type": "google.iam.v1.Policy", + "id": 3 + }, + "explanation": { + "type": "Explanation", + "id": 4 + } + }, + "nested": { + "Explanation": { + "fields": { + "matchedPermissions": { + "keyType": "string", + "type": "Permissions", + "id": 1 + } + }, + "nested": { + "Permissions": { + "fields": { + "permissions": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } } } } diff --git a/src/v1/asset_service_client.ts b/src/v1/asset_service_client.ts index 25c2f889..99c2983f 100644 --- a/src/v1/asset_service_client.ts +++ b/src/v1/asset_service_client.ts @@ -23,9 +23,13 @@ import { Descriptors, ClientOptions, LROperation, + PaginationCallback, + GaxCall, } from 'google-gax'; import * as path from 'path'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import * as gapicConfig from './asset_service_client_config.json'; import {operationsProtos} from 'google-gax'; @@ -165,6 +169,22 @@ export class AssetServiceClient { ), }; + // 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. + this.descriptors.page = { + searchAllResources: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'results' + ), + searchAllIamPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'results' + ), + }; + // This API contains "long-running operations", which return a // an Operation object that allows for tracking of the operation, // rather than holding a request open. @@ -249,6 +269,8 @@ export class AssetServiceClient { 'listFeeds', 'updateFeed', 'deleteFeed', + 'searchAllResources', + 'searchAllIamPolicies', ]; for (const methodName of assetServiceStubMethods) { const callPromise = this.assetServiceStub.then( @@ -487,9 +509,8 @@ export class AssetServiceClient { * Required. This is the client-assigned asset feed identifier and it needs to * be unique under a specific parent project/folder/organization. * @param {google.cloud.asset.v1.Feed} request.feed - * Required. The feed details. The field `name` must be empty and it will be generated - * in the format of: - * projects/project_number/feeds/feed_id + * Required. The feed details. The field `name` must be empty and it will be + * generated in the format of: projects/project_number/feeds/feed_id * folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id * @param {object} [options] @@ -736,8 +757,8 @@ export class AssetServiceClient { * @param {Object} request * The request object that will be sent. * @param {google.cloud.asset.v1.Feed} request.feed - * Required. The new values of feed details. It must match an existing feed and the - * field `name` must be in the format of: + * Required. The new values of feed details. It must match an existing feed + * and the field `name` must be in the format of: * projects/project_number/feeds/feed_id or * folders/folder_number/feeds/feed_id or * organizations/organization_number/feeds/feed_id. @@ -914,8 +935,9 @@ export class AssetServiceClient { /** * Exports assets with time and resource types to a given Cloud Storage * location. The output format is newline-delimited JSON. - * This API implements the {@link google.longrunning.Operation|google.longrunning.Operation} API allowing you - * to keep track of the export. + * This API implements the + * {@link google.longrunning.Operation|google.longrunning.Operation} API allowing + * you to keep track of the export. * * @param {Object} request * The request object that will be sent. @@ -1033,6 +1055,686 @@ export class AssetServiceClient { protos.google.cloud.asset.v1.ExportAssetsRequest >; } + searchAllResources( + request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.asset.v1.IResourceSearchResult[], + protos.google.cloud.asset.v1.ISearchAllResourcesRequest | null, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse + ] + >; + searchAllResources( + request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + | protos.google.cloud.asset.v1.ISearchAllResourcesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IResourceSearchResult + > + ): void; + searchAllResources( + request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + | protos.google.cloud.asset.v1.ISearchAllResourcesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IResourceSearchResult + > + ): void; + /** + * Searches all the resources within the given accessible scope (e.g., a + * project, a folder or an organization). Callers should have + * cloud.assets.SearchAllResources permission upon the requested scope, + * otherwise the request will be rejected. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. A scope can be a project, a folder or an organization. The search + * is limited to the resources within the `scope`. + * + * The allowed values are: + * + * * projects/{PROJECT_ID} + * * projects/{PROJECT_NUMBER} + * * folders/{FOLDER_NUMBER} + * * organizations/{ORGANIZATION_NUMBER} + * @param {string} [request.query] + * Optional. The query statement. An empty query can be specified to search + * all the resources of certain `asset_types` within the given `scope`. + * + * Examples: + * + * * `name : "Important"` to find Cloud resources whose name contains + * "Important" as a word. + * * `displayName : "Impor*"` to find Cloud resources whose display name + * contains "Impor" as a word prefix. + * * `description : "*por*"` to find Cloud resources whose description + * contains "por" as a substring. + * * `location : "us-west*"` to find Cloud resources whose location is + * prefixed with "us-west". + * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as + * a key or value. + * * `labels.env : "prod"` to find Cloud resources which have a label "env" + * and its value is "prod". + * * `labels.env : *` to find Cloud resources which have a label "env". + * * `"Important"` to find Cloud resources which contain "Important" as a word + * in any of the searchable fields. + * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix + * in any of the searchable fields. + * * `"*por*"` to find Cloud resources which contain "por" as a substring in + * any of the searchable fields. + * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud + * resources which contain "Important" as a word in any of the searchable + * fields and are also located in the "us-west1" region or the "global" + * location. + * + * See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more details. + * @param {string[]} [request.assetTypes] + * Optional. A list of asset types that this request searches for. If empty, + * it will search all the [searchable asset + * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). + * @param {number} [request.pageSize] + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of all other + * method parameters, must be identical to those in the previous call. + * @param {string} [request.orderBy] + * Optional. A comma separated list of fields specifying the sorting order of + * the results. The default order is ascending. Add " DESC" after the field + * name to indicate descending order. Redundant space characters are ignored. + * Example: "location DESC, name". See [supported resource metadata + * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields) + * for more details. + * @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. + * The first element of the array is Array of [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [SearchAllResourcesRequest]{@link google.cloud.asset.v1.SearchAllResourcesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [SearchAllResourcesResponse]{@link google.cloud.asset.v1.SearchAllResourcesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + searchAllResources( + request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + optionsOrCallback?: + | gax.CallOptions + | PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + | protos.google.cloud.asset.v1.ISearchAllResourcesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IResourceSearchResult + >, + callback?: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + | protos.google.cloud.asset.v1.ISearchAllResourcesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IResourceSearchResult + > + ): Promise< + [ + protos.google.cloud.asset.v1.IResourceSearchResult[], + protos.google.cloud.asset.v1.ISearchAllResourcesRequest | null, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + scope: request.scope || '', + }); + this.initialize(); + return this.innerApiCalls.searchAllResources(request, options, callback); + } + + /** + * Equivalent to {@link searchAllResources}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link searchAllResources} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. A scope can be a project, a folder or an organization. The search + * is limited to the resources within the `scope`. + * + * The allowed values are: + * + * * projects/{PROJECT_ID} + * * projects/{PROJECT_NUMBER} + * * folders/{FOLDER_NUMBER} + * * organizations/{ORGANIZATION_NUMBER} + * @param {string} [request.query] + * Optional. The query statement. An empty query can be specified to search + * all the resources of certain `asset_types` within the given `scope`. + * + * Examples: + * + * * `name : "Important"` to find Cloud resources whose name contains + * "Important" as a word. + * * `displayName : "Impor*"` to find Cloud resources whose display name + * contains "Impor" as a word prefix. + * * `description : "*por*"` to find Cloud resources whose description + * contains "por" as a substring. + * * `location : "us-west*"` to find Cloud resources whose location is + * prefixed with "us-west". + * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as + * a key or value. + * * `labels.env : "prod"` to find Cloud resources which have a label "env" + * and its value is "prod". + * * `labels.env : *` to find Cloud resources which have a label "env". + * * `"Important"` to find Cloud resources which contain "Important" as a word + * in any of the searchable fields. + * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix + * in any of the searchable fields. + * * `"*por*"` to find Cloud resources which contain "por" as a substring in + * any of the searchable fields. + * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud + * resources which contain "Important" as a word in any of the searchable + * fields and are also located in the "us-west1" region or the "global" + * location. + * + * See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more details. + * @param {string[]} [request.assetTypes] + * Optional. A list of asset types that this request searches for. If empty, + * it will search all the [searchable asset + * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). + * @param {number} [request.pageSize] + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of all other + * method parameters, must be identical to those in the previous call. + * @param {string} [request.orderBy] + * Optional. A comma separated list of fields specifying the sorting order of + * the results. The default order is ascending. Add " DESC" after the field + * name to indicate descending order. Redundant space characters are ignored. + * Example: "location DESC, name". See [supported resource metadata + * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields) + * for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult} on 'data' event. + */ + searchAllResourcesStream( + request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + scope: request.scope || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAllResources.createStream( + this.innerApiCalls.searchAllResources as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to {@link searchAllResources}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. A scope can be a project, a folder or an organization. The search + * is limited to the resources within the `scope`. + * + * The allowed values are: + * + * * projects/{PROJECT_ID} + * * projects/{PROJECT_NUMBER} + * * folders/{FOLDER_NUMBER} + * * organizations/{ORGANIZATION_NUMBER} + * @param {string} [request.query] + * Optional. The query statement. An empty query can be specified to search + * all the resources of certain `asset_types` within the given `scope`. + * + * Examples: + * + * * `name : "Important"` to find Cloud resources whose name contains + * "Important" as a word. + * * `displayName : "Impor*"` to find Cloud resources whose display name + * contains "Impor" as a word prefix. + * * `description : "*por*"` to find Cloud resources whose description + * contains "por" as a substring. + * * `location : "us-west*"` to find Cloud resources whose location is + * prefixed with "us-west". + * * `labels : "prod"` to find Cloud resources whose labels contain "prod" as + * a key or value. + * * `labels.env : "prod"` to find Cloud resources which have a label "env" + * and its value is "prod". + * * `labels.env : *` to find Cloud resources which have a label "env". + * * `"Important"` to find Cloud resources which contain "Important" as a word + * in any of the searchable fields. + * * `"Impor*"` to find Cloud resources which contain "Impor" as a word prefix + * in any of the searchable fields. + * * `"*por*"` to find Cloud resources which contain "por" as a substring in + * any of the searchable fields. + * * `("Important" AND location : ("us-west1" OR "global"))` to find Cloud + * resources which contain "Important" as a word in any of the searchable + * fields and are also located in the "us-west1" region or the "global" + * location. + * + * See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more details. + * @param {string[]} [request.assetTypes] + * Optional. A list of asset types that this request searches for. If empty, + * it will search all the [searchable asset + * types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). + * @param {number} [request.pageSize] + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of all other + * method parameters, must be identical to those in the previous call. + * @param {string} [request.orderBy] + * Optional. A comma separated list of fields specifying the sorting order of + * the results. The default order is ascending. Add " DESC" after the field + * name to indicate descending order. Redundant space characters are ignored. + * Example: "location DESC, name". See [supported resource metadata + * fields](https://cloud.google.com/asset-inventory/docs/searching-resources#query_on_resource_metadata_fields) + * for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + searchAllResourcesAsync( + request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options?: gax.CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + scope: request.scope || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAllResources.asyncIterate( + this.innerApiCalls['searchAllResources'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + searchAllIamPolicies( + request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.asset.v1.IIamPolicySearchResult[], + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest | null, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + ] + >; + searchAllIamPolicies( + request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + | protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult + > + ): void; + searchAllIamPolicies( + request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + | protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult + > + ): void; + /** + * Searches all the IAM policies within the given accessible scope (e.g., a + * project, a folder or an organization). Callers should have + * cloud.assets.SearchAllIamPolicies permission upon the requested scope, + * otherwise the request will be rejected. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. A scope can be a project, a folder or an organization. The search + * is limited to the IAM policies within the `scope`. + * + * The allowed values are: + * + * * projects/{PROJECT_ID} + * * projects/{PROJECT_NUMBER} + * * folders/{FOLDER_NUMBER} + * * organizations/{ORGANIZATION_NUMBER} + * @param {string} [request.query] + * Optional. The query statement. An empty query can be specified to search + * all the IAM policies within the given `scope`. + * + * Examples: + * + * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that + * specify user "amy@gmail.com". + * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that + * specify the Compute Admin role. + * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM + * policy bindings that specify a role containing "storage.buckets.update" + * permission. + * * `resource : "organizations/123"` to find Cloud IAM policy bindings that + * are set on "organizations/123". + * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")` + * to find Cloud IAM policy bindings that are set on "organizations/123" or + * "folders/1234", and also specify user "amy". + * + * See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) + * for more details. + * @param {number} [request.pageSize] + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. + * @param {string} [request.pageToken] + * Optional. If present, retrieve the next batch of results from the preceding + * call to this method. `page_token` must be the value of `next_page_token` + * from the previous response. The values of all other method parameters must + * be identical to those in the previous call. + * @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. + * The first element of the array is Array of [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [SearchAllIamPoliciesRequest]{@link google.cloud.asset.v1.SearchAllIamPoliciesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [SearchAllIamPoliciesResponse]{@link google.cloud.asset.v1.SearchAllIamPoliciesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + searchAllIamPolicies( + request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + optionsOrCallback?: + | gax.CallOptions + | PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + | protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult + >, + callback?: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + | protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + | null + | undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult + > + ): Promise< + [ + protos.google.cloud.asset.v1.IIamPolicySearchResult[], + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest | null, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + scope: request.scope || '', + }); + this.initialize(); + return this.innerApiCalls.searchAllIamPolicies(request, options, callback); + } + + /** + * Equivalent to {@link searchAllIamPolicies}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link searchAllIamPolicies} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. A scope can be a project, a folder or an organization. The search + * is limited to the IAM policies within the `scope`. + * + * The allowed values are: + * + * * projects/{PROJECT_ID} + * * projects/{PROJECT_NUMBER} + * * folders/{FOLDER_NUMBER} + * * organizations/{ORGANIZATION_NUMBER} + * @param {string} [request.query] + * Optional. The query statement. An empty query can be specified to search + * all the IAM policies within the given `scope`. + * + * Examples: + * + * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that + * specify user "amy@gmail.com". + * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that + * specify the Compute Admin role. + * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM + * policy bindings that specify a role containing "storage.buckets.update" + * permission. + * * `resource : "organizations/123"` to find Cloud IAM policy bindings that + * are set on "organizations/123". + * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")` + * to find Cloud IAM policy bindings that are set on "organizations/123" or + * "folders/1234", and also specify user "amy". + * + * See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) + * for more details. + * @param {number} [request.pageSize] + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. + * @param {string} [request.pageToken] + * Optional. If present, retrieve the next batch of results from the preceding + * call to this method. `page_token` must be the value of `next_page_token` + * from the previous response. The values of all other method parameters must + * be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult} on 'data' event. + */ + searchAllIamPoliciesStream( + request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + scope: request.scope || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAllIamPolicies.createStream( + this.innerApiCalls.searchAllIamPolicies as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to {@link searchAllIamPolicies}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. A scope can be a project, a folder or an organization. The search + * is limited to the IAM policies within the `scope`. + * + * The allowed values are: + * + * * projects/{PROJECT_ID} + * * projects/{PROJECT_NUMBER} + * * folders/{FOLDER_NUMBER} + * * organizations/{ORGANIZATION_NUMBER} + * @param {string} [request.query] + * Optional. The query statement. An empty query can be specified to search + * all the IAM policies within the given `scope`. + * + * Examples: + * + * * `policy : "amy@gmail.com"` to find Cloud IAM policy bindings that + * specify user "amy@gmail.com". + * * `policy : "roles/compute.admin"` to find Cloud IAM policy bindings that + * specify the Compute Admin role. + * * `policy.role.permissions : "storage.buckets.update"` to find Cloud IAM + * policy bindings that specify a role containing "storage.buckets.update" + * permission. + * * `resource : "organizations/123"` to find Cloud IAM policy bindings that + * are set on "organizations/123". + * * `(resource : ("organizations/123" OR "folders/1234") AND policy : "amy")` + * to find Cloud IAM policy bindings that are set on "organizations/123" or + * "folders/1234", and also specify user "amy". + * + * See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) + * for more details. + * @param {number} [request.pageSize] + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. + * @param {string} [request.pageToken] + * Optional. If present, retrieve the next batch of results from the preceding + * call to this method. `page_token` must be the value of `next_page_token` + * from the previous response. The values of all other method parameters must + * be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + searchAllIamPoliciesAsync( + request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options?: gax.CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + scope: request.scope || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.searchAllIamPolicies.asyncIterate( + this.innerApiCalls['searchAllIamPolicies'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- diff --git a/src/v1/asset_service_client_config.json b/src/v1/asset_service_client_config.json index f114f91b..cac505fc 100644 --- a/src/v1/asset_service_client_config.json +++ b/src/v1/asset_service_client_config.json @@ -47,6 +47,14 @@ "DeleteFeed": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "SearchAllResources": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SearchAllIamPolicies": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/synth.metadata b/synth.metadata index 098be354..8112f52d 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,23 +3,23 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-asset.git", - "sha": "488a18ba934dbd3902595a5d4ea783033486b040" + "remote": "git@github.com:googleapis/nodejs-asset.git", + "sha": "238c11abedd65bc896762383a753e3c9bc4acddf" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2fc2caaacb15949c7f80426bfc7dafdd41dbc333", - "internalRef": "310239576" + "sha": "cdf59a76184d5ddc24531f41567cf2411ae74593", + "internalRef": "312479172" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "be74d3e532faa47eb59f1a0eaebde0860d1d8ab4" + "sha": "7ee92820e64c0aea379781b82399d6b3f3c8655f" } } ], diff --git a/test/gapic_asset_service_v1.ts b/test/gapic_asset_service_v1.ts index 708f2acf..40976e91 100644 --- a/test/gapic_asset_service_v1.ts +++ b/test/gapic_asset_service_v1.ts @@ -23,6 +23,8 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as assetserviceModule from '../src'; +import {PassThrough} from 'stream'; + import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { @@ -82,6 +84,67 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v1.AssetServiceClient', () => { it('has servicePath', () => { const servicePath = assetserviceModule.v1.AssetServiceClient.servicePath; @@ -1028,6 +1091,640 @@ describe('v1.AssetServiceClient', () => { }); }); + describe('searchAllResources', () => { + it('invokes searchAllResources without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllResourcesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + ]; + client.innerApiCalls.searchAllResources = stubSimpleCall( + expectedResponse + ); + const [response] = await client.searchAllResources(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes searchAllResources without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllResourcesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + ]; + client.innerApiCalls.searchAllResources = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.searchAllResources( + request, + ( + err?: Error | null, + result?: protos.google.cloud.asset.v1.IResourceSearchResult[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes searchAllResources with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllResourcesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAllResources = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.searchAllResources(request), expectedError); + assert( + (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes searchAllResourcesStream without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllResourcesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + ]; + client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.searchAllResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; + stream.on( + 'data', + (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAllResources, request) + ); + assert.strictEqual( + (client.descriptors.page.searchAllResources + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes searchAllResourcesStream with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllResourcesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.searchAllResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; + stream.on( + 'data', + (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAllResources, request) + ); + assert.strictEqual( + (client.descriptors.page.searchAllResources + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAllResources without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllResourcesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.ResourceSearchResult() + ), + ]; + client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; + const iterable = client.searchAllResourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAllResources + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.searchAllResources + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAllResources with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllResourcesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.searchAllResourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAllResources + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.searchAllResources + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('searchAllIamPolicies', () => { + it('invokes searchAllIamPolicies without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllIamPoliciesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + ]; + client.innerApiCalls.searchAllIamPolicies = stubSimpleCall( + expectedResponse + ); + const [response] = await client.searchAllIamPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes searchAllIamPolicies without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllIamPoliciesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + ]; + client.innerApiCalls.searchAllIamPolicies = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.searchAllIamPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.asset.v1.IIamPolicySearchResult[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes searchAllIamPolicies with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllIamPoliciesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAllIamPolicies = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.searchAllIamPolicies(request), expectedError); + assert( + (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes searchAllIamPoliciesStream without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllIamPoliciesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + ]; + client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.searchAllIamPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; + stream.on( + 'data', + (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAllIamPolicies, request) + ); + assert.strictEqual( + (client.descriptors.page.searchAllIamPolicies + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes searchAllIamPoliciesStream with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllIamPoliciesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.searchAllIamPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; + stream.on( + 'data', + (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAllIamPolicies, request) + ); + assert.strictEqual( + (client.descriptors.page.searchAllIamPolicies + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAllIamPolicies without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllIamPoliciesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + generateSampleMessage( + new protos.google.cloud.asset.v1.IamPolicySearchResult() + ), + ]; + client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; + const iterable = client.searchAllIamPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAllIamPolicies + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.searchAllIamPolicies + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with searchAllIamPolicies with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.SearchAllIamPoliciesRequest() + ); + request.scope = ''; + const expectedHeaderRequestParams = 'scope='; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.searchAllIamPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAllIamPolicies + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.searchAllIamPolicies + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + describe('Path templates', () => { describe('folderFeed', () => { const fakePath = '/rendered/path/folderFeed';