diff --git a/packages/google-cloud-asset/protos/google/cloud/asset/v1/asset_service.proto b/packages/google-cloud-asset/protos/google/cloud/asset/v1/asset_service.proto index cf5812226161..1c34327291db 100644 --- a/packages/google-cloud-asset/protos/google/cloud/asset/v1/asset_service.proto +++ b/packages/google-cloud-asset/protos/google/cloud/asset/v1/asset_service.proto @@ -26,6 +26,7 @@ import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; import "google/type/expr.proto"; @@ -197,6 +198,27 @@ service AssetService { }; } + // Issue a job that queries assets using a SQL statement compatible with + // [BigQuery Standard + // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + // + // If the query execution finishes within timeout and there's no pagination, + // the full query results will be returned in the `QueryAssetsResponse`. + // + // Otherwise, full query results can be obtained by issuing extra requests + // with the `job_reference` from the a previous `QueryAssets` call. + // + // Note, the query result has approximately 10 GB limitation enforced by + // BigQuery + // https://cloud.google.com/bigquery/docs/best-practices-performance-output, + // queries return larger results will result in errors. + rpc QueryAssets(QueryAssetsRequest) returns (QueryAssetsResponse) { + option (google.api.http) = { + post: "/v1/{parent=*/*}:queryAssets" + body: "*" + }; + } + // Creates a saved query in a parent project/folder/organization. rpc CreateSavedQuery(CreateSavedQueryRequest) returns (SavedQuery) { option (google.api.http) = { @@ -856,6 +878,14 @@ message SearchAllResourcesRequest { // * `labels.env:*` to find Cloud resources that have a label "env". // * `kmsKey:key` to find Cloud resources encrypted with a customer-managed // encryption key whose name contains the word "key". + // * `relationships:instance-group-1` to find Cloud resources that have + // relationships with "instance-group-1" in the related resource name. + // * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + // have relationships of type "INSTANCE_TO_INSTANCEGROUP". + // * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + // compute instances that have relationships with "instance-group-1" in the + // compute instance group resource name, for relationship type + // "INSTANCE_TO_INSTANCEGROUP". // * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a // word. // * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain @@ -999,8 +1029,8 @@ message SearchAllIamPoliciesRequest { // compared against each Cloud IAM policy binding, including its principals, // roles, and Cloud IAM conditions. The returned Cloud IAM policies will only // contain the bindings that match your query. To learn more about the IAM - // policy structure, see [IAM policy - // doc](https://cloud.google.com/iam/docs/policies#structure). + // policy structure, see the [IAM policy + // documentation](https://cloud.google.com/iam/help/allow-policies/structure). // // Examples: // @@ -1730,28 +1760,203 @@ message MoveImpact { string detail = 1; } -// Asset content type. -enum ContentType { - // Unspecified content type. - CONTENT_TYPE_UNSPECIFIED = 0; +// Output configuration query assets. +message QueryAssetsOutputConfig { + // BigQuery destination. + message BigQueryDestination { + // Required. The BigQuery dataset where the query results will be saved. It + // has the format of "projects/{projectId}/datasets/{datasetId}". + string dataset = 1 [(google.api.field_behavior) = REQUIRED]; - // Resource metadata. - RESOURCE = 1; + // Required. The BigQuery table where the query results will be saved. If + // this table does not exist, a new table with the given name will be + // created. + string table = 2 [(google.api.field_behavior) = REQUIRED]; - // The actual IAM policy set on a resource. - IAM_POLICY = 2; + // Specifies the action that occurs if the destination table or partition + // already exists. The following values are supported: + // + // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery + // overwrites the entire table or all the partitions data. + // * WRITE_APPEND: If the table or partition already exists, BigQuery + // appends the data to the table or the latest partition. + // * WRITE_EMPTY: If the table already exists and contains data, an error is + // returned. + string write_disposition = 3; + } - // The Cloud Organization Policy set on an asset. - ORG_POLICY = 4; + // BigQuery destination where the query results will be saved. + BigQueryDestination bigquery_destination = 1; +} - // The Cloud Access context manager Policy set on an asset. - ACCESS_POLICY = 5; +// QueryAssets request. +message QueryAssetsRequest { + // Required. The relative name of the root asset. This can only be an + // organization number (such as "organizations/123"), a project ID (such as + // "projects/my-project-id"), or a project number (such as "projects/12345"), + // or a folder number (such as "folders/123"). + // + // Only assets belonging to the `parent` will be returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/Asset" + } + ]; - // The runtime OS Inventory information. - OS_INVENTORY = 6; + oneof query { + // Optional. A SQL statement that's compatible with [BigQuery Standard + // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + string statement = 2 [(google.api.field_behavior) = OPTIONAL]; - // The related resources. - RELATIONSHIP = 7; + // Optional. Reference to the query job, which is from the + // `QueryAssetsResponse` of previous `QueryAssets` call. + string job_reference = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The maximum number of rows to return in the results. Responses + // are limited to 10 MB and 1000 rows. + // + // By default, the maximum row count is 1000. When the byte or row count limit + // is reached, the rest of the query results will be paginated. + // + // The field will be ignored when [output_config] is specified. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token received from previous `QueryAssets`. + // + // The field will be ignored when [output_config] is specified. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the maximum amount of time that the client is willing + // to wait for the query to complete. By default, this limit is 5 min for the + // first query, and 1 minute for the following queries. If the query is + // complete, the `done` field in the `QueryAssetsResponse` is true, otherwise + // false. + // + // Like BigQuery [jobs.query + // API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) + // The call is not guaranteed to wait for the specified timeout; it typically + // returns after around 200 seconds (200,000 milliseconds), even if the query + // is not complete. + // + // The field will be ignored when [output_config] is specified. + google.protobuf.Duration timeout = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Specifies what time period or point in time to query asset metadata at. + // * unset - query asset metadata as it is right now + // * [read_time_window] - query asset metadata as it was at any point in time + // between [start_time] and [end_time]. + // * [read_time] - query asset metadata as it was at that point in time. + // If data for the timestamp/date range selected does not exist, + // it will simply return a valid response with no rows. + oneof time { + // Optional. [start_time] is required. [start_time] must be less than + // [end_time] Defaults [end_time] to now if [start_time] is set and + // [end_time] isn't. Maximum permitted time range is 7 days. + TimeWindow read_time_window = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Queries cloud assets as they appeared at the specified point in + // time. + google.protobuf.Timestamp read_time = 8 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Destination where the query results will be saved. + // + // When this field is specified, the query results won't be saved in the + // [QueryAssetsResponse.query_result]. Instead + // [QueryAssetsResponse.output_config] will be set. + // + // Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used + // to check the status of the query job when passed to a following + // [QueryAssets] API call. + QueryAssetsOutputConfig output_config = 9 + [(google.api.field_behavior) = OPTIONAL]; +} + +// QueryAssets response. +message QueryAssetsResponse { + // Reference to a query job. + string job_reference = 1; + + // The query response, which can be either an `error` or a valid `response`. + // + // If `done` == `false` and the query result is being saved in a output, the + // output_config field will be set. + // If `done` == `true`, exactly one of + // `error`, `query_result` or `output_config` will be set. + bool done = 2; + + oneof response { + // Error status. + google.rpc.Status error = 3; + + // Result of the query. + QueryResult query_result = 4; + + // Output configuration which indicates instead of being returned in API + // response on the fly, the query result will be saved in a specific output. + QueryAssetsOutputConfig output_config = 5; + } +} + +// Execution results of the query. +// +// The result is formatted as rows represented by BigQuery compatible [schema]. +// When pagination is necessary, it will contains the page token to retrieve +// the results of following pages. +message QueryResult { + // Each row hold a query result in the format of `Struct`. + repeated google.protobuf.Struct rows = 1; + + // Describes the format of the [rows]. + TableSchema schema = 2; + + // Token to retrieve the next page of the results. + string next_page_token = 3; + + // Total rows of the whole query results. + int64 total_rows = 4; +} + +// BigQuery Compatible table schema. +message TableSchema { + // Describes the fields in a table. + repeated TableFieldSchema fields = 1; +} + +// A field in TableSchema. +message TableFieldSchema { + // The field name. The name must contain only letters (a-z, A-Z), + // numbers (0-9), or underscores (_), and must start with a letter or + // underscore. The maximum length is 128 characters. + string field = 1; + + // The field data type. Possible values include + // * STRING + // * BYTES + // * INTEGER + // * FLOAT + // * BOOLEAN + // * TIMESTAMP + // * DATE + // * TIME + // * DATETIME + // * GEOGRAPHY, + // * NUMERIC, + // * BIGNUMERIC, + // * RECORD + // (where RECORD indicates that the field contains a nested schema). + string type = 2; + + // The field mode. Possible values include NULLABLE, REQUIRED and + // REPEATED. The default value is NULLABLE. + string mode = 3; + + // Describes the nested schema fields if the type property is set + // to RECORD. + repeated TableFieldSchema fields = 4; } // A request message for @@ -1841,3 +2046,27 @@ message BatchGetEffectiveIamPoliciesResponse { // [EffectiveIamPolicy.policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]. repeated EffectiveIamPolicy policy_results = 2; } + +// Asset content type. +enum ContentType { + // Unspecified content type. + CONTENT_TYPE_UNSPECIFIED = 0; + + // Resource metadata. + RESOURCE = 1; + + // The actual IAM policy set on a resource. + IAM_POLICY = 2; + + // The Cloud Organization Policy set on an asset. + ORG_POLICY = 4; + + // The Cloud Access context manager Policy set on an asset. + ACCESS_POLICY = 5; + + // The runtime OS Inventory information. + OS_INVENTORY = 6; + + // The related resources. + RELATIONSHIP = 7; +} diff --git a/packages/google-cloud-asset/protos/google/cloud/asset/v1/assets.proto b/packages/google-cloud-asset/protos/google/cloud/asset/v1/assets.proto index ebc093ca388e..83a23693ae80 100644 --- a/packages/google-cloud-asset/protos/google/cloud/asset/v1/assets.proto +++ b/packages/google-cloud-asset/protos/google/cloud/asset/v1/assets.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.cloud.asset.v1; -import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/orgpolicy/v1/orgpolicy.proto"; import "google/cloud/osconfig/v1/inventory.proto"; @@ -128,8 +127,8 @@ message Asset { // effectively policy is the union of both the policy set on this resource // and each policy set on all of the resource's ancestry resource levels in // the hierarchy. See - // [this topic](https://cloud.google.com/iam/docs/policies#inheritance) for - // more information. + // [this topic](https://cloud.google.com/iam/help/allow-policies/inheritance) + // for more information. google.iam.v1.Policy iam_policy = 4; // A representation of an [organization @@ -307,6 +306,7 @@ message RelatedAsset { } // A result of Resource Search, containing information of a cloud resource. +// Next ID: 29 message ResourceSearchResult { // The full resource name of this resource. Example: // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. diff --git a/packages/google-cloud-asset/protos/google/cloud/asset/v1p1beta1/assets.proto b/packages/google-cloud-asset/protos/google/cloud/asset/v1p1beta1/assets.proto index 549ea688ba9c..c0ac1403acc8 100644 --- a/packages/google-cloud-asset/protos/google/cloud/asset/v1p1beta1/assets.proto +++ b/packages/google-cloud-asset/protos/google/cloud/asset/v1p1beta1/assets.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package google.cloud.asset.v1p1beta1; import "google/iam/v1/policy.proto"; -import "google/api/annotations.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Asset.V1P1Beta1"; diff --git a/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/asset_service.proto b/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/asset_service.proto index a19ee75fabd1..92f285f86524 100644 --- a/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/asset_service.proto +++ b/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/asset_service.proto @@ -22,10 +22,8 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/asset/v1p2beta1/assets.proto"; -import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Asset.V1p2Beta1"; option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset"; diff --git a/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/assets.proto b/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/assets.proto index 33d93e1c3b32..bc2a9c511f28 100644 --- a/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/assets.proto +++ b/packages/google-cloud-asset/protos/google/cloud/asset/v1p2beta1/assets.proto @@ -17,9 +17,7 @@ syntax = "proto3"; package google.cloud.asset.v1p2beta1; -import "google/api/annotations.proto"; import "google/iam/v1/policy.proto"; -import "google/protobuf/any.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-asset/protos/google/cloud/asset/v1p5beta1/assets.proto b/packages/google-cloud-asset/protos/google/cloud/asset/v1p5beta1/assets.proto index b9d1e1991570..7ad133a5484f 100644 --- a/packages/google-cloud-asset/protos/google/cloud/asset/v1p5beta1/assets.proto +++ b/packages/google-cloud-asset/protos/google/cloud/asset/v1p5beta1/assets.proto @@ -16,16 +16,13 @@ syntax = "proto3"; package google.cloud.asset.v1p5beta1; -import "google/api/annotations.proto"; import "google/api/resource.proto"; import "google/cloud/orgpolicy/v1/orgpolicy.proto"; import "google/iam/v1/policy.proto"; import "google/identity/accesscontextmanager/v1/access_level.proto"; import "google/identity/accesscontextmanager/v1/access_policy.proto"; import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; -import "google/protobuf/any.proto"; import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Asset.V1p5Beta1"; diff --git a/packages/google-cloud-asset/protos/protos.d.ts b/packages/google-cloud-asset/protos/protos.d.ts index 9e8aa4d040e1..6c2a5502b27b 100644 --- a/packages/google-cloud-asset/protos/protos.d.ts +++ b/packages/google-cloud-asset/protos/protos.d.ts @@ -228,6 +228,20 @@ export namespace google { */ public analyzeMove(request: google.cloud.asset.v1.IAnalyzeMoveRequest): Promise; + /** + * Calls QueryAssets. + * @param request QueryAssetsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QueryAssetsResponse + */ + public queryAssets(request: google.cloud.asset.v1.IQueryAssetsRequest, callback: google.cloud.asset.v1.AssetService.QueryAssetsCallback): void; + + /** + * Calls QueryAssets. + * @param request QueryAssetsRequest message or plain object + * @returns Promise + */ + public queryAssets(request: google.cloud.asset.v1.IQueryAssetsRequest): Promise; + /** * Calls CreateSavedQuery. * @param request CreateSavedQueryRequest message or plain object @@ -406,6 +420,13 @@ export namespace google { */ type AnalyzeMoveCallback = (error: (Error|null), response?: google.cloud.asset.v1.AnalyzeMoveResponse) => void; + /** + * Callback as used by {@link google.cloud.asset.v1.AssetService#queryAssets}. + * @param error Error, if any + * @param [response] QueryAssetsResponse + */ + type QueryAssetsCallback = (error: (Error|null), response?: google.cloud.asset.v1.QueryAssetsResponse) => void; + /** * Callback as used by {@link google.cloud.asset.v1.AssetService#createSavedQuery}. * @param error Error, if any @@ -5818,344 +5839,1095 @@ 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, - OS_INVENTORY = 6, - RELATIONSHIP = 7 - } - - /** Properties of a BatchGetEffectiveIamPoliciesRequest. */ - interface IBatchGetEffectiveIamPoliciesRequest { - - /** BatchGetEffectiveIamPoliciesRequest scope */ - scope?: (string|null); + /** Properties of a QueryAssetsOutputConfig. */ + interface IQueryAssetsOutputConfig { - /** BatchGetEffectiveIamPoliciesRequest names */ - names?: (string[]|null); + /** QueryAssetsOutputConfig bigqueryDestination */ + bigqueryDestination?: (google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination|null); } - /** Represents a BatchGetEffectiveIamPoliciesRequest. */ - class BatchGetEffectiveIamPoliciesRequest implements IBatchGetEffectiveIamPoliciesRequest { + /** Represents a QueryAssetsOutputConfig. */ + class QueryAssetsOutputConfig implements IQueryAssetsOutputConfig { /** - * Constructs a new BatchGetEffectiveIamPoliciesRequest. + * Constructs a new QueryAssetsOutputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest); - - /** BatchGetEffectiveIamPoliciesRequest scope. */ - public scope: string; + constructor(properties?: google.cloud.asset.v1.IQueryAssetsOutputConfig); - /** BatchGetEffectiveIamPoliciesRequest names. */ - public names: string[]; + /** QueryAssetsOutputConfig bigqueryDestination. */ + public bigqueryDestination?: (google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination|null); /** - * Creates a new BatchGetEffectiveIamPoliciesRequest instance using the specified properties. + * Creates a new QueryAssetsOutputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns BatchGetEffectiveIamPoliciesRequest instance + * @returns QueryAssetsOutputConfig instance */ - public static create(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest; + public static create(properties?: google.cloud.asset.v1.IQueryAssetsOutputConfig): google.cloud.asset.v1.QueryAssetsOutputConfig; /** - * Encodes the specified BatchGetEffectiveIamPoliciesRequest message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. - * @param message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * Encodes the specified QueryAssetsOutputConfig message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.verify|verify} messages. + * @param message QueryAssetsOutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.asset.v1.IQueryAssetsOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchGetEffectiveIamPoliciesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. - * @param message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * Encodes the specified QueryAssetsOutputConfig message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.verify|verify} messages. + * @param message QueryAssetsOutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.asset.v1.IQueryAssetsOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer. + * Decodes a QueryAssetsOutputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchGetEffectiveIamPoliciesRequest + * @returns QueryAssetsOutputConfig * @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.BatchGetEffectiveIamPoliciesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1.QueryAssetsOutputConfig; /** - * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer, length delimited. + * Decodes a QueryAssetsOutputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchGetEffectiveIamPoliciesRequest + * @returns QueryAssetsOutputConfig * @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.BatchGetEffectiveIamPoliciesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1.QueryAssetsOutputConfig; /** - * Verifies a BatchGetEffectiveIamPoliciesRequest message. + * Verifies a QueryAssetsOutputConfig 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 BatchGetEffectiveIamPoliciesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a QueryAssetsOutputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchGetEffectiveIamPoliciesRequest + * @returns QueryAssetsOutputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.QueryAssetsOutputConfig; /** - * Creates a plain object from a BatchGetEffectiveIamPoliciesRequest message. Also converts values to other types if specified. - * @param message BatchGetEffectiveIamPoliciesRequest + * Creates a plain object from a QueryAssetsOutputConfig message. Also converts values to other types if specified. + * @param message QueryAssetsOutputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.asset.v1.QueryAssetsOutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchGetEffectiveIamPoliciesRequest to JSON. + * Converts this QueryAssetsOutputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchGetEffectiveIamPoliciesResponse. */ - interface IBatchGetEffectiveIamPoliciesResponse { - - /** BatchGetEffectiveIamPoliciesResponse policyResults */ - policyResults?: (google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy[]|null); - } - - /** Represents a BatchGetEffectiveIamPoliciesResponse. */ - class BatchGetEffectiveIamPoliciesResponse implements IBatchGetEffectiveIamPoliciesResponse { - - /** - * Constructs a new BatchGetEffectiveIamPoliciesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse); - - /** BatchGetEffectiveIamPoliciesResponse policyResults. */ - public policyResults: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy[]; - - /** - * Creates a new BatchGetEffectiveIamPoliciesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchGetEffectiveIamPoliciesResponse instance - */ - public static create(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse; - - /** - * Encodes the specified BatchGetEffectiveIamPoliciesResponse message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. - * @param message BatchGetEffectiveIamPoliciesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BatchGetEffectiveIamPoliciesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. - * @param message BatchGetEffectiveIamPoliciesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BatchGetEffectiveIamPoliciesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BatchGetEffectiveIamPoliciesResponse - * @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.BatchGetEffectiveIamPoliciesResponse; - - /** - * Decodes a BatchGetEffectiveIamPoliciesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BatchGetEffectiveIamPoliciesResponse - * @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.BatchGetEffectiveIamPoliciesResponse; - - /** - * Verifies a BatchGetEffectiveIamPoliciesResponse 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 BatchGetEffectiveIamPoliciesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchGetEffectiveIamPoliciesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse; - - /** - * Creates a plain object from a BatchGetEffectiveIamPoliciesResponse message. Also converts values to other types if specified. - * @param message BatchGetEffectiveIamPoliciesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BatchGetEffectiveIamPoliciesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + namespace QueryAssetsOutputConfig { - namespace BatchGetEffectiveIamPoliciesResponse { + /** Properties of a BigQueryDestination. */ + interface IBigQueryDestination { - /** Properties of an EffectiveIamPolicy. */ - interface IEffectiveIamPolicy { + /** BigQueryDestination dataset */ + dataset?: (string|null); - /** EffectiveIamPolicy fullResourceName */ - fullResourceName?: (string|null); + /** BigQueryDestination table */ + table?: (string|null); - /** EffectiveIamPolicy policies */ - policies?: (google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo[]|null); + /** BigQueryDestination writeDisposition */ + writeDisposition?: (string|null); } - /** Represents an EffectiveIamPolicy. */ - class EffectiveIamPolicy implements IEffectiveIamPolicy { + /** Represents a BigQueryDestination. */ + class BigQueryDestination implements IBigQueryDestination { /** - * Constructs a new EffectiveIamPolicy. + * Constructs a new BigQueryDestination. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy); + constructor(properties?: google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination); - /** EffectiveIamPolicy fullResourceName. */ - public fullResourceName: string; + /** BigQueryDestination dataset. */ + public dataset: string; - /** EffectiveIamPolicy policies. */ - public policies: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo[]; + /** BigQueryDestination table. */ + public table: string; + + /** BigQueryDestination writeDisposition. */ + public writeDisposition: string; /** - * Creates a new EffectiveIamPolicy instance using the specified properties. + * Creates a new BigQueryDestination instance using the specified properties. * @param [properties] Properties to set - * @returns EffectiveIamPolicy instance + * @returns BigQueryDestination instance */ - public static create(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + public static create(properties?: google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination): google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination; /** - * Encodes the specified EffectiveIamPolicy message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.verify|verify} messages. - * @param message EffectiveIamPolicy message or plain object to encode + * Encodes the specified BigQueryDestination message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.verify|verify} messages. + * @param message BigQueryDestination message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EffectiveIamPolicy message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.verify|verify} messages. - * @param message EffectiveIamPolicy message or plain object to encode + * Encodes the specified BigQueryDestination message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.verify|verify} messages. + * @param message BigQueryDestination message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EffectiveIamPolicy message from the specified reader or buffer. + * Decodes a BigQueryDestination message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EffectiveIamPolicy + * @returns BigQueryDestination * @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.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination; /** - * Decodes an EffectiveIamPolicy message from the specified reader or buffer, length delimited. + * Decodes a BigQueryDestination message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EffectiveIamPolicy + * @returns BigQueryDestination * @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.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination; /** - * Verifies an EffectiveIamPolicy message. + * Verifies a BigQueryDestination 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 EffectiveIamPolicy message from a plain object. Also converts values to their respective internal types. + * Creates a BigQueryDestination message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EffectiveIamPolicy + * @returns BigQueryDestination */ - public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination; /** - * Creates a plain object from an EffectiveIamPolicy message. Also converts values to other types if specified. - * @param message EffectiveIamPolicy + * Creates a plain object from a BigQueryDestination message. Also converts values to other types if specified. + * @param message BigQueryDestination * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EffectiveIamPolicy to JSON. + * Converts this BigQueryDestination to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + } - namespace EffectiveIamPolicy { + /** Properties of a QueryAssetsRequest. */ + interface IQueryAssetsRequest { - /** Properties of a PolicyInfo. */ - interface IPolicyInfo { + /** QueryAssetsRequest parent */ + parent?: (string|null); - /** PolicyInfo attachedResource */ - attachedResource?: (string|null); + /** QueryAssetsRequest statement */ + statement?: (string|null); - /** PolicyInfo policy */ - policy?: (google.iam.v1.IPolicy|null); - } + /** QueryAssetsRequest jobReference */ + jobReference?: (string|null); - /** Represents a PolicyInfo. */ - class PolicyInfo implements IPolicyInfo { + /** QueryAssetsRequest pageSize */ + pageSize?: (number|null); - /** - * Constructs a new PolicyInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo); + /** QueryAssetsRequest pageToken */ + pageToken?: (string|null); - /** PolicyInfo attachedResource. */ - public attachedResource: string; + /** QueryAssetsRequest timeout */ + timeout?: (google.protobuf.IDuration|null); - /** PolicyInfo policy. */ - public policy?: (google.iam.v1.IPolicy|null); + /** QueryAssetsRequest readTimeWindow */ + readTimeWindow?: (google.cloud.asset.v1.ITimeWindow|null); - /** - * Creates a new PolicyInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns PolicyInfo instance - */ - public static create(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo; + /** QueryAssetsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); - /** - * Encodes the specified PolicyInfo message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.verify|verify} messages. - * @param message PolicyInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo, writer?: $protobuf.Writer): $protobuf.Writer; + /** QueryAssetsRequest outputConfig */ + outputConfig?: (google.cloud.asset.v1.IQueryAssetsOutputConfig|null); + } - /** + /** Represents a QueryAssetsRequest. */ + class QueryAssetsRequest implements IQueryAssetsRequest { + + /** + * Constructs a new QueryAssetsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IQueryAssetsRequest); + + /** QueryAssetsRequest parent. */ + public parent: string; + + /** QueryAssetsRequest statement. */ + public statement?: (string|null); + + /** QueryAssetsRequest jobReference. */ + public jobReference?: (string|null); + + /** QueryAssetsRequest pageSize. */ + public pageSize: number; + + /** QueryAssetsRequest pageToken. */ + public pageToken: string; + + /** QueryAssetsRequest timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** QueryAssetsRequest readTimeWindow. */ + public readTimeWindow?: (google.cloud.asset.v1.ITimeWindow|null); + + /** QueryAssetsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** QueryAssetsRequest outputConfig. */ + public outputConfig?: (google.cloud.asset.v1.IQueryAssetsOutputConfig|null); + + /** QueryAssetsRequest query. */ + public query?: ("statement"|"jobReference"); + + /** QueryAssetsRequest time. */ + public time?: ("readTimeWindow"|"readTime"); + + /** + * Creates a new QueryAssetsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryAssetsRequest instance + */ + public static create(properties?: google.cloud.asset.v1.IQueryAssetsRequest): google.cloud.asset.v1.QueryAssetsRequest; + + /** + * Encodes the specified QueryAssetsRequest message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsRequest.verify|verify} messages. + * @param message QueryAssetsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IQueryAssetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryAssetsRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsRequest.verify|verify} messages. + * @param message QueryAssetsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IQueryAssetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryAssetsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryAssetsRequest + * @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.QueryAssetsRequest; + + /** + * Decodes a QueryAssetsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryAssetsRequest + * @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.QueryAssetsRequest; + + /** + * Verifies a QueryAssetsRequest 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 QueryAssetsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryAssetsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.QueryAssetsRequest; + + /** + * Creates a plain object from a QueryAssetsRequest message. Also converts values to other types if specified. + * @param message QueryAssetsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.QueryAssetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryAssetsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a QueryAssetsResponse. */ + interface IQueryAssetsResponse { + + /** QueryAssetsResponse jobReference */ + jobReference?: (string|null); + + /** QueryAssetsResponse done */ + done?: (boolean|null); + + /** QueryAssetsResponse error */ + error?: (google.rpc.IStatus|null); + + /** QueryAssetsResponse queryResult */ + queryResult?: (google.cloud.asset.v1.IQueryResult|null); + + /** QueryAssetsResponse outputConfig */ + outputConfig?: (google.cloud.asset.v1.IQueryAssetsOutputConfig|null); + } + + /** Represents a QueryAssetsResponse. */ + class QueryAssetsResponse implements IQueryAssetsResponse { + + /** + * Constructs a new QueryAssetsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IQueryAssetsResponse); + + /** QueryAssetsResponse jobReference. */ + public jobReference: string; + + /** QueryAssetsResponse done. */ + public done: boolean; + + /** QueryAssetsResponse error. */ + public error?: (google.rpc.IStatus|null); + + /** QueryAssetsResponse queryResult. */ + public queryResult?: (google.cloud.asset.v1.IQueryResult|null); + + /** QueryAssetsResponse outputConfig. */ + public outputConfig?: (google.cloud.asset.v1.IQueryAssetsOutputConfig|null); + + /** QueryAssetsResponse response. */ + public response?: ("error"|"queryResult"|"outputConfig"); + + /** + * Creates a new QueryAssetsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryAssetsResponse instance + */ + public static create(properties?: google.cloud.asset.v1.IQueryAssetsResponse): google.cloud.asset.v1.QueryAssetsResponse; + + /** + * Encodes the specified QueryAssetsResponse message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsResponse.verify|verify} messages. + * @param message QueryAssetsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IQueryAssetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryAssetsResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsResponse.verify|verify} messages. + * @param message QueryAssetsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IQueryAssetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryAssetsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryAssetsResponse + * @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.QueryAssetsResponse; + + /** + * Decodes a QueryAssetsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryAssetsResponse + * @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.QueryAssetsResponse; + + /** + * Verifies a QueryAssetsResponse 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 QueryAssetsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryAssetsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.QueryAssetsResponse; + + /** + * Creates a plain object from a QueryAssetsResponse message. Also converts values to other types if specified. + * @param message QueryAssetsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.QueryAssetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryAssetsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a QueryResult. */ + interface IQueryResult { + + /** QueryResult rows */ + rows?: (google.protobuf.IStruct[]|null); + + /** QueryResult schema */ + schema?: (google.cloud.asset.v1.ITableSchema|null); + + /** QueryResult nextPageToken */ + nextPageToken?: (string|null); + + /** QueryResult totalRows */ + totalRows?: (number|Long|string|null); + } + + /** Represents a QueryResult. */ + class QueryResult implements IQueryResult { + + /** + * Constructs a new QueryResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IQueryResult); + + /** QueryResult rows. */ + public rows: google.protobuf.IStruct[]; + + /** QueryResult schema. */ + public schema?: (google.cloud.asset.v1.ITableSchema|null); + + /** QueryResult nextPageToken. */ + public nextPageToken: string; + + /** QueryResult totalRows. */ + public totalRows: (number|Long|string); + + /** + * Creates a new QueryResult instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryResult instance + */ + public static create(properties?: google.cloud.asset.v1.IQueryResult): google.cloud.asset.v1.QueryResult; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.asset.v1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryResult + * @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.QueryResult; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryResult + * @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.QueryResult; + + /** + * Verifies a QueryResult 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 QueryResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.QueryResult; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @param message QueryResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableSchema. */ + interface ITableSchema { + + /** TableSchema fields */ + fields?: (google.cloud.asset.v1.ITableFieldSchema[]|null); + } + + /** Represents a TableSchema. */ + class TableSchema implements ITableSchema { + + /** + * Constructs a new TableSchema. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.ITableSchema); + + /** TableSchema fields. */ + public fields: google.cloud.asset.v1.ITableFieldSchema[]; + + /** + * Creates a new TableSchema instance using the specified properties. + * @param [properties] Properties to set + * @returns TableSchema instance + */ + public static create(properties?: google.cloud.asset.v1.ITableSchema): google.cloud.asset.v1.TableSchema; + + /** + * Encodes the specified TableSchema message. Does not implicitly {@link google.cloud.asset.v1.TableSchema.verify|verify} messages. + * @param message TableSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.ITableSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableSchema message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TableSchema.verify|verify} messages. + * @param message TableSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.ITableSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableSchema message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableSchema + * @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.TableSchema; + + /** + * Decodes a TableSchema message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableSchema + * @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.TableSchema; + + /** + * Verifies a TableSchema 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 TableSchema message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableSchema + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.TableSchema; + + /** + * Creates a plain object from a TableSchema message. Also converts values to other types if specified. + * @param message TableSchema + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.TableSchema, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableSchema to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableFieldSchema. */ + interface ITableFieldSchema { + + /** TableFieldSchema field */ + field?: (string|null); + + /** TableFieldSchema type */ + type?: (string|null); + + /** TableFieldSchema mode */ + mode?: (string|null); + + /** TableFieldSchema fields */ + fields?: (google.cloud.asset.v1.ITableFieldSchema[]|null); + } + + /** Represents a TableFieldSchema. */ + class TableFieldSchema implements ITableFieldSchema { + + /** + * Constructs a new TableFieldSchema. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.ITableFieldSchema); + + /** TableFieldSchema field. */ + public field: string; + + /** TableFieldSchema type. */ + public type: string; + + /** TableFieldSchema mode. */ + public mode: string; + + /** TableFieldSchema fields. */ + public fields: google.cloud.asset.v1.ITableFieldSchema[]; + + /** + * Creates a new TableFieldSchema instance using the specified properties. + * @param [properties] Properties to set + * @returns TableFieldSchema instance + */ + public static create(properties?: google.cloud.asset.v1.ITableFieldSchema): google.cloud.asset.v1.TableFieldSchema; + + /** + * Encodes the specified TableFieldSchema message. Does not implicitly {@link google.cloud.asset.v1.TableFieldSchema.verify|verify} messages. + * @param message TableFieldSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.ITableFieldSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableFieldSchema message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TableFieldSchema.verify|verify} messages. + * @param message TableFieldSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.ITableFieldSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableFieldSchema message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableFieldSchema + * @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.TableFieldSchema; + + /** + * Decodes a TableFieldSchema message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableFieldSchema + * @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.TableFieldSchema; + + /** + * Verifies a TableFieldSchema 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 TableFieldSchema message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableFieldSchema + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.TableFieldSchema; + + /** + * Creates a plain object from a TableFieldSchema message. Also converts values to other types if specified. + * @param message TableFieldSchema + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.TableFieldSchema, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableFieldSchema to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchGetEffectiveIamPoliciesRequest. */ + interface IBatchGetEffectiveIamPoliciesRequest { + + /** BatchGetEffectiveIamPoliciesRequest scope */ + scope?: (string|null); + + /** BatchGetEffectiveIamPoliciesRequest names */ + names?: (string[]|null); + } + + /** Represents a BatchGetEffectiveIamPoliciesRequest. */ + class BatchGetEffectiveIamPoliciesRequest implements IBatchGetEffectiveIamPoliciesRequest { + + /** + * Constructs a new BatchGetEffectiveIamPoliciesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest); + + /** BatchGetEffectiveIamPoliciesRequest scope. */ + public scope: string; + + /** BatchGetEffectiveIamPoliciesRequest names. */ + public names: string[]; + + /** + * Creates a new BatchGetEffectiveIamPoliciesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchGetEffectiveIamPoliciesRequest instance + */ + public static create(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesRequest message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. + * @param message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. + * @param message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchGetEffectiveIamPoliciesRequest + * @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.BatchGetEffectiveIamPoliciesRequest; + + /** + * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchGetEffectiveIamPoliciesRequest + * @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.BatchGetEffectiveIamPoliciesRequest; + + /** + * Verifies a BatchGetEffectiveIamPoliciesRequest 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 BatchGetEffectiveIamPoliciesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchGetEffectiveIamPoliciesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest; + + /** + * Creates a plain object from a BatchGetEffectiveIamPoliciesRequest message. Also converts values to other types if specified. + * @param message BatchGetEffectiveIamPoliciesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchGetEffectiveIamPoliciesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchGetEffectiveIamPoliciesResponse. */ + interface IBatchGetEffectiveIamPoliciesResponse { + + /** BatchGetEffectiveIamPoliciesResponse policyResults */ + policyResults?: (google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy[]|null); + } + + /** Represents a BatchGetEffectiveIamPoliciesResponse. */ + class BatchGetEffectiveIamPoliciesResponse implements IBatchGetEffectiveIamPoliciesResponse { + + /** + * Constructs a new BatchGetEffectiveIamPoliciesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse); + + /** BatchGetEffectiveIamPoliciesResponse policyResults. */ + public policyResults: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy[]; + + /** + * Creates a new BatchGetEffectiveIamPoliciesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchGetEffectiveIamPoliciesResponse instance + */ + public static create(properties?: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesResponse message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. + * @param message BatchGetEffectiveIamPoliciesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. + * @param message BatchGetEffectiveIamPoliciesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchGetEffectiveIamPoliciesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchGetEffectiveIamPoliciesResponse + * @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.BatchGetEffectiveIamPoliciesResponse; + + /** + * Decodes a BatchGetEffectiveIamPoliciesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchGetEffectiveIamPoliciesResponse + * @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.BatchGetEffectiveIamPoliciesResponse; + + /** + * Verifies a BatchGetEffectiveIamPoliciesResponse 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 BatchGetEffectiveIamPoliciesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchGetEffectiveIamPoliciesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse; + + /** + * Creates a plain object from a BatchGetEffectiveIamPoliciesResponse message. Also converts values to other types if specified. + * @param message BatchGetEffectiveIamPoliciesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchGetEffectiveIamPoliciesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BatchGetEffectiveIamPoliciesResponse { + + /** Properties of an EffectiveIamPolicy. */ + interface IEffectiveIamPolicy { + + /** EffectiveIamPolicy fullResourceName */ + fullResourceName?: (string|null); + + /** EffectiveIamPolicy policies */ + policies?: (google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo[]|null); + } + + /** Represents an EffectiveIamPolicy. */ + class EffectiveIamPolicy implements IEffectiveIamPolicy { + + /** + * Constructs a new EffectiveIamPolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy); + + /** EffectiveIamPolicy fullResourceName. */ + public fullResourceName: string; + + /** EffectiveIamPolicy policies. */ + public policies: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo[]; + + /** + * Creates a new EffectiveIamPolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns EffectiveIamPolicy instance + */ + public static create(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + + /** + * Encodes the specified EffectiveIamPolicy message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.verify|verify} messages. + * @param message EffectiveIamPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EffectiveIamPolicy message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.verify|verify} messages. + * @param message EffectiveIamPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.IEffectiveIamPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EffectiveIamPolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EffectiveIamPolicy + * @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.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + + /** + * Decodes an EffectiveIamPolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EffectiveIamPolicy + * @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.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + + /** + * Verifies an EffectiveIamPolicy 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 EffectiveIamPolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EffectiveIamPolicy + */ + public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy; + + /** + * Creates a plain object from an EffectiveIamPolicy message. Also converts values to other types if specified. + * @param message EffectiveIamPolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EffectiveIamPolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EffectiveIamPolicy { + + /** Properties of a PolicyInfo. */ + interface IPolicyInfo { + + /** PolicyInfo attachedResource */ + attachedResource?: (string|null); + + /** PolicyInfo policy */ + policy?: (google.iam.v1.IPolicy|null); + } + + /** Represents a PolicyInfo. */ + class PolicyInfo implements IPolicyInfo { + + /** + * Constructs a new PolicyInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo); + + /** PolicyInfo attachedResource. */ + public attachedResource: string; + + /** PolicyInfo policy. */ + public policy?: (google.iam.v1.IPolicy|null); + + /** + * Creates a new PolicyInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PolicyInfo instance + */ + public static create(properties?: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo): google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo; + + /** + * Encodes the specified PolicyInfo message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.verify|verify} messages. + * @param message PolicyInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.IPolicyInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** * Encodes the specified PolicyInfo message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.verify|verify} messages. * @param message PolicyInfo message or plain object to encode * @param [writer] Writer to encode to @@ -6213,6 +6985,17 @@ export namespace google { } } + /** ContentType enum. */ + enum ContentType { + CONTENT_TYPE_UNSPECIFIED = 0, + RESOURCE = 1, + IAM_POLICY = 2, + ORG_POLICY = 4, + ACCESS_POLICY = 5, + OS_INVENTORY = 6, + RELATIONSHIP = 7 + } + /** Properties of a TemporalAsset. */ interface ITemporalAsset { diff --git a/packages/google-cloud-asset/protos/protos.js b/packages/google-cloud-asset/protos/protos.js index db3d462a0486..9e10617b8519 100644 --- a/packages/google-cloud-asset/protos/protos.js +++ b/packages/google-cloud-asset/protos/protos.js @@ -527,6 +527,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.asset.v1.AssetService#queryAssets}. + * @memberof google.cloud.asset.v1.AssetService + * @typedef QueryAssetsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.asset.v1.QueryAssetsResponse} [response] QueryAssetsResponse + */ + + /** + * Calls QueryAssets. + * @function queryAssets + * @memberof google.cloud.asset.v1.AssetService + * @instance + * @param {google.cloud.asset.v1.IQueryAssetsRequest} request QueryAssetsRequest message or plain object + * @param {google.cloud.asset.v1.AssetService.QueryAssetsCallback} callback Node-style callback called with the error, if any, and QueryAssetsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AssetService.prototype.queryAssets = function queryAssets(request, callback) { + return this.rpcCall(queryAssets, $root.google.cloud.asset.v1.QueryAssetsRequest, $root.google.cloud.asset.v1.QueryAssetsResponse, request, callback); + }, "name", { value: "QueryAssets" }); + + /** + * Calls QueryAssets. + * @function queryAssets + * @memberof google.cloud.asset.v1.AssetService + * @instance + * @param {google.cloud.asset.v1.IQueryAssetsRequest} request QueryAssetsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.asset.v1.AssetService#createSavedQuery}. * @memberof google.cloud.asset.v1.AssetService @@ -13787,50 +13820,24 @@ return MoveImpact; })(); - /** - * 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 - * @property {number} OS_INVENTORY=6 OS_INVENTORY value - * @property {number} RELATIONSHIP=7 RELATIONSHIP 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; - values[valuesById[6] = "OS_INVENTORY"] = 6; - values[valuesById[7] = "RELATIONSHIP"] = 7; - return values; - })(); - - v1.BatchGetEffectiveIamPoliciesRequest = (function() { + v1.QueryAssetsOutputConfig = (function() { /** - * Properties of a BatchGetEffectiveIamPoliciesRequest. + * Properties of a QueryAssetsOutputConfig. * @memberof google.cloud.asset.v1 - * @interface IBatchGetEffectiveIamPoliciesRequest - * @property {string|null} [scope] BatchGetEffectiveIamPoliciesRequest scope - * @property {Array.|null} [names] BatchGetEffectiveIamPoliciesRequest names + * @interface IQueryAssetsOutputConfig + * @property {google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination|null} [bigqueryDestination] QueryAssetsOutputConfig bigqueryDestination */ /** - * Constructs a new BatchGetEffectiveIamPoliciesRequest. + * Constructs a new QueryAssetsOutputConfig. * @memberof google.cloud.asset.v1 - * @classdesc Represents a BatchGetEffectiveIamPoliciesRequest. - * @implements IBatchGetEffectiveIamPoliciesRequest + * @classdesc Represents a QueryAssetsOutputConfig. + * @implements IQueryAssetsOutputConfig * @constructor - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest=} [properties] Properties to set + * @param {google.cloud.asset.v1.IQueryAssetsOutputConfig=} [properties] Properties to set */ - function BatchGetEffectiveIamPoliciesRequest(properties) { - this.names = []; + function QueryAssetsOutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -13838,91 +13845,75 @@ } /** - * BatchGetEffectiveIamPoliciesRequest scope. - * @member {string} scope - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest - * @instance - */ - BatchGetEffectiveIamPoliciesRequest.prototype.scope = ""; - - /** - * BatchGetEffectiveIamPoliciesRequest names. - * @member {Array.} names - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * QueryAssetsOutputConfig bigqueryDestination. + * @member {google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination|null|undefined} bigqueryDestination + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @instance */ - BatchGetEffectiveIamPoliciesRequest.prototype.names = $util.emptyArray; + QueryAssetsOutputConfig.prototype.bigqueryDestination = null; /** - * Creates a new BatchGetEffectiveIamPoliciesRequest instance using the specified properties. + * Creates a new QueryAssetsOutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @static - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest=} [properties] Properties to set - * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest instance + * @param {google.cloud.asset.v1.IQueryAssetsOutputConfig=} [properties] Properties to set + * @returns {google.cloud.asset.v1.QueryAssetsOutputConfig} QueryAssetsOutputConfig instance */ - BatchGetEffectiveIamPoliciesRequest.create = function create(properties) { - return new BatchGetEffectiveIamPoliciesRequest(properties); + QueryAssetsOutputConfig.create = function create(properties) { + return new QueryAssetsOutputConfig(properties); }; /** - * Encodes the specified BatchGetEffectiveIamPoliciesRequest message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. + * Encodes the specified QueryAssetsOutputConfig message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @static - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest} message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * @param {google.cloud.asset.v1.IQueryAssetsOutputConfig} message QueryAssetsOutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchGetEffectiveIamPoliciesRequest.encode = function encode(message, writer) { + QueryAssetsOutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.scope != null && Object.hasOwnProperty.call(message, "scope")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.scope); - if (message.names != null && message.names.length) - for (var i = 0; i < message.names.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.names[i]); + if (message.bigqueryDestination != null && Object.hasOwnProperty.call(message, "bigqueryDestination")) + $root.google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.encode(message.bigqueryDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified BatchGetEffectiveIamPoliciesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. + * Encodes the specified QueryAssetsOutputConfig message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @static - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest} message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * @param {google.cloud.asset.v1.IQueryAssetsOutputConfig} message QueryAssetsOutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchGetEffectiveIamPoliciesRequest.encodeDelimited = function encodeDelimited(message, writer) { + QueryAssetsOutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer. + * Decodes a QueryAssetsOutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @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.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest + * @returns {google.cloud.asset.v1.QueryAssetsOutputConfig} QueryAssetsOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchGetEffectiveIamPoliciesRequest.decode = function decode(reader, length) { + QueryAssetsOutputConfig.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.BatchGetEffectiveIamPoliciesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.asset.v1.QueryAssetsOutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.scope = reader.string(); - break; - case 3: - if (!(message.names && message.names.length)) - message.names = []; - message.names.push(reader.string()); + message.bigqueryDestination = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -13933,181 +13924,2159 @@ }; /** - * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer, length delimited. + * Decodes a QueryAssetsOutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest + * @returns {google.cloud.asset.v1.QueryAssetsOutputConfig} QueryAssetsOutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchGetEffectiveIamPoliciesRequest.decodeDelimited = function decodeDelimited(reader) { + QueryAssetsOutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchGetEffectiveIamPoliciesRequest message. + * Verifies a QueryAssetsOutputConfig message. * @function verify - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchGetEffectiveIamPoliciesRequest.verify = function verify(message) { + QueryAssetsOutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.scope != null && message.hasOwnProperty("scope")) - if (!$util.isString(message.scope)) - return "scope: string expected"; - if (message.names != null && message.hasOwnProperty("names")) { - if (!Array.isArray(message.names)) - return "names: array expected"; - for (var i = 0; i < message.names.length; ++i) - if (!$util.isString(message.names[i])) - return "names: string[] expected"; + if (message.bigqueryDestination != null && message.hasOwnProperty("bigqueryDestination")) { + var error = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.verify(message.bigqueryDestination); + if (error) + return "bigqueryDestination." + error; } return null; }; /** - * Creates a BatchGetEffectiveIamPoliciesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a QueryAssetsOutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest + * @returns {google.cloud.asset.v1.QueryAssetsOutputConfig} QueryAssetsOutputConfig */ - BatchGetEffectiveIamPoliciesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest) + QueryAssetsOutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.QueryAssetsOutputConfig) return object; - var message = new $root.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest(); - if (object.scope != null) - message.scope = String(object.scope); - if (object.names) { - if (!Array.isArray(object.names)) - throw TypeError(".google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names: array expected"); - message.names = []; - for (var i = 0; i < object.names.length; ++i) - message.names[i] = String(object.names[i]); + var message = new $root.google.cloud.asset.v1.QueryAssetsOutputConfig(); + if (object.bigqueryDestination != null) { + if (typeof object.bigqueryDestination !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsOutputConfig.bigqueryDestination: object expected"); + message.bigqueryDestination = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.fromObject(object.bigqueryDestination); } return message; }; /** - * Creates a plain object from a BatchGetEffectiveIamPoliciesRequest message. Also converts values to other types if specified. + * Creates a plain object from a QueryAssetsOutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @static - * @param {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} message BatchGetEffectiveIamPoliciesRequest + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig} message QueryAssetsOutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchGetEffectiveIamPoliciesRequest.toObject = function toObject(message, options) { + QueryAssetsOutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.names = []; if (options.defaults) - object.scope = ""; - if (message.scope != null && message.hasOwnProperty("scope")) - object.scope = message.scope; - if (message.names && message.names.length) { - object.names = []; - for (var j = 0; j < message.names.length; ++j) - object.names[j] = message.names[j]; - } + object.bigqueryDestination = null; + if (message.bigqueryDestination != null && message.hasOwnProperty("bigqueryDestination")) + object.bigqueryDestination = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.toObject(message.bigqueryDestination, options); return object; }; /** - * Converts this BatchGetEffectiveIamPoliciesRequest to JSON. + * Converts this QueryAssetsOutputConfig to JSON. * @function toJSON - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig * @instance * @returns {Object.} JSON object */ - BatchGetEffectiveIamPoliciesRequest.prototype.toJSON = function toJSON() { + QueryAssetsOutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchGetEffectiveIamPoliciesRequest; - })(); + QueryAssetsOutputConfig.BigQueryDestination = (function() { - v1.BatchGetEffectiveIamPoliciesResponse = (function() { + /** + * Properties of a BigQueryDestination. + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig + * @interface IBigQueryDestination + * @property {string|null} [dataset] BigQueryDestination dataset + * @property {string|null} [table] BigQueryDestination table + * @property {string|null} [writeDisposition] BigQueryDestination writeDisposition + */ - /** - * Properties of a BatchGetEffectiveIamPoliciesResponse. - * @memberof google.cloud.asset.v1 - * @interface IBatchGetEffectiveIamPoliciesResponse - * @property {Array.|null} [policyResults] BatchGetEffectiveIamPoliciesResponse policyResults - */ + /** + * Constructs a new BigQueryDestination. + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig + * @classdesc Represents a BigQueryDestination. + * @implements IBigQueryDestination + * @constructor + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination=} [properties] Properties to set + */ + function BigQueryDestination(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]]; + } - /** - * Constructs a new BatchGetEffectiveIamPoliciesResponse. - * @memberof google.cloud.asset.v1 - * @classdesc Represents a BatchGetEffectiveIamPoliciesResponse. - * @implements IBatchGetEffectiveIamPoliciesResponse - * @constructor - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse=} [properties] Properties to set - */ - function BatchGetEffectiveIamPoliciesResponse(properties) { - this.policyResults = []; - 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]]; - } + /** + * BigQueryDestination dataset. + * @member {string} dataset + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @instance + */ + BigQueryDestination.prototype.dataset = ""; - /** - * BatchGetEffectiveIamPoliciesResponse policyResults. - * @member {Array.} policyResults - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse - * @instance - */ - BatchGetEffectiveIamPoliciesResponse.prototype.policyResults = $util.emptyArray; + /** + * BigQueryDestination table. + * @member {string} table + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @instance + */ + BigQueryDestination.prototype.table = ""; - /** - * Creates a new BatchGetEffectiveIamPoliciesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse - * @static - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse=} [properties] Properties to set - * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse} BatchGetEffectiveIamPoliciesResponse instance - */ - BatchGetEffectiveIamPoliciesResponse.create = function create(properties) { - return new BatchGetEffectiveIamPoliciesResponse(properties); - }; + /** + * BigQueryDestination writeDisposition. + * @member {string} writeDisposition + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @instance + */ + BigQueryDestination.prototype.writeDisposition = ""; - /** - * Encodes the specified BatchGetEffectiveIamPoliciesResponse message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse - * @static - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse} message BatchGetEffectiveIamPoliciesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchGetEffectiveIamPoliciesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.policyResults != null && message.policyResults.length) - for (var i = 0; i < message.policyResults.length; ++i) - $root.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.encode(message.policyResults[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Creates a new BigQueryDestination instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @static + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination=} [properties] Properties to set + * @returns {google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination} BigQueryDestination instance + */ + BigQueryDestination.create = function create(properties) { + return new BigQueryDestination(properties); + }; - /** - * Encodes the specified BatchGetEffectiveIamPoliciesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse - * @static - * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse} message BatchGetEffectiveIamPoliciesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + /** + * Encodes the specified BigQueryDestination message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @static + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination} message BigQueryDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryDestination.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.dataset); + if (message.table != null && Object.hasOwnProperty.call(message, "table")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.table); + if (message.writeDisposition != null && Object.hasOwnProperty.call(message, "writeDisposition")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.writeDisposition); + return writer; + }; + + /** + * Encodes the specified BigQueryDestination message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @static + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig.IBigQueryDestination} message BigQueryDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQueryDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @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.QueryAssetsOutputConfig.BigQueryDestination} BigQueryDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryDestination.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.QueryAssetsOutputConfig.BigQueryDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dataset = reader.string(); + break; + case 2: + message.table = reader.string(); + break; + case 3: + message.writeDisposition = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQueryDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination} BigQueryDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQueryDestination message. + * @function verify + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQueryDestination.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + if (message.table != null && message.hasOwnProperty("table")) + if (!$util.isString(message.table)) + return "table: string expected"; + if (message.writeDisposition != null && message.hasOwnProperty("writeDisposition")) + if (!$util.isString(message.writeDisposition)) + return "writeDisposition: string expected"; + return null; + }; + + /** + * Creates a BigQueryDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination} BigQueryDestination + */ + BigQueryDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination) + return object; + var message = new $root.google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination(); + if (object.dataset != null) + message.dataset = String(object.dataset); + if (object.table != null) + message.table = String(object.table); + if (object.writeDisposition != null) + message.writeDisposition = String(object.writeDisposition); + return message; + }; + + /** + * Creates a plain object from a BigQueryDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @static + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination} message BigQueryDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQueryDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.dataset = ""; + object.table = ""; + object.writeDisposition = ""; + } + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + if (message.table != null && message.hasOwnProperty("table")) + object.table = message.table; + if (message.writeDisposition != null && message.hasOwnProperty("writeDisposition")) + object.writeDisposition = message.writeDisposition; + return object; + }; + + /** + * Converts this BigQueryDestination to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination + * @instance + * @returns {Object.} JSON object + */ + BigQueryDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BigQueryDestination; + })(); + + return QueryAssetsOutputConfig; + })(); + + v1.QueryAssetsRequest = (function() { + + /** + * Properties of a QueryAssetsRequest. + * @memberof google.cloud.asset.v1 + * @interface IQueryAssetsRequest + * @property {string|null} [parent] QueryAssetsRequest parent + * @property {string|null} [statement] QueryAssetsRequest statement + * @property {string|null} [jobReference] QueryAssetsRequest jobReference + * @property {number|null} [pageSize] QueryAssetsRequest pageSize + * @property {string|null} [pageToken] QueryAssetsRequest pageToken + * @property {google.protobuf.IDuration|null} [timeout] QueryAssetsRequest timeout + * @property {google.cloud.asset.v1.ITimeWindow|null} [readTimeWindow] QueryAssetsRequest readTimeWindow + * @property {google.protobuf.ITimestamp|null} [readTime] QueryAssetsRequest readTime + * @property {google.cloud.asset.v1.IQueryAssetsOutputConfig|null} [outputConfig] QueryAssetsRequest outputConfig + */ + + /** + * Constructs a new QueryAssetsRequest. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a QueryAssetsRequest. + * @implements IQueryAssetsRequest + * @constructor + * @param {google.cloud.asset.v1.IQueryAssetsRequest=} [properties] Properties to set + */ + function QueryAssetsRequest(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]]; + } + + /** + * QueryAssetsRequest parent. + * @member {string} parent + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.parent = ""; + + /** + * QueryAssetsRequest statement. + * @member {string|null|undefined} statement + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.statement = null; + + /** + * QueryAssetsRequest jobReference. + * @member {string|null|undefined} jobReference + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.jobReference = null; + + /** + * QueryAssetsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.pageSize = 0; + + /** + * QueryAssetsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.pageToken = ""; + + /** + * QueryAssetsRequest timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.timeout = null; + + /** + * QueryAssetsRequest readTimeWindow. + * @member {google.cloud.asset.v1.ITimeWindow|null|undefined} readTimeWindow + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.readTimeWindow = null; + + /** + * QueryAssetsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.readTime = null; + + /** + * QueryAssetsRequest outputConfig. + * @member {google.cloud.asset.v1.IQueryAssetsOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + QueryAssetsRequest.prototype.outputConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryAssetsRequest query. + * @member {"statement"|"jobReference"|undefined} query + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + Object.defineProperty(QueryAssetsRequest.prototype, "query", { + get: $util.oneOfGetter($oneOfFields = ["statement", "jobReference"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * QueryAssetsRequest time. + * @member {"readTimeWindow"|"readTime"|undefined} time + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + */ + Object.defineProperty(QueryAssetsRequest.prototype, "time", { + get: $util.oneOfGetter($oneOfFields = ["readTimeWindow", "readTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryAssetsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @static + * @param {google.cloud.asset.v1.IQueryAssetsRequest=} [properties] Properties to set + * @returns {google.cloud.asset.v1.QueryAssetsRequest} QueryAssetsRequest instance + */ + QueryAssetsRequest.create = function create(properties) { + return new QueryAssetsRequest(properties); + }; + + /** + * Encodes the specified QueryAssetsRequest message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @static + * @param {google.cloud.asset.v1.IQueryAssetsRequest} message QueryAssetsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAssetsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.statement != null && Object.hasOwnProperty.call(message, "statement")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.statement); + if (message.jobReference != null && Object.hasOwnProperty.call(message, "jobReference")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.jobReference); + 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.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.readTimeWindow != null && Object.hasOwnProperty.call(message, "readTimeWindow")) + $root.google.cloud.asset.v1.TimeWindow.encode(message.readTimeWindow, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.asset.v1.QueryAssetsOutputConfig.encode(message.outputConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryAssetsRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @static + * @param {google.cloud.asset.v1.IQueryAssetsRequest} message QueryAssetsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAssetsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAssetsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @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.QueryAssetsRequest} QueryAssetsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAssetsRequest.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.QueryAssetsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.statement = reader.string(); + break; + case 3: + message.jobReference = reader.string(); + break; + case 4: + message.pageSize = reader.int32(); + break; + case 5: + message.pageToken = reader.string(); + break; + case 6: + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 7: + message.readTimeWindow = $root.google.cloud.asset.v1.TimeWindow.decode(reader, reader.uint32()); + break; + case 8: + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.outputConfig = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAssetsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.QueryAssetsRequest} QueryAssetsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAssetsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAssetsRequest message. + * @function verify + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAssetsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.statement != null && message.hasOwnProperty("statement")) { + properties.query = 1; + if (!$util.isString(message.statement)) + return "statement: string expected"; + } + if (message.jobReference != null && message.hasOwnProperty("jobReference")) { + if (properties.query === 1) + return "query: multiple values"; + properties.query = 1; + if (!$util.isString(message.jobReference)) + return "jobReference: 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.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + if (message.readTimeWindow != null && message.hasOwnProperty("readTimeWindow")) { + properties.time = 1; + { + var error = $root.google.cloud.asset.v1.TimeWindow.verify(message.readTimeWindow); + if (error) + return "readTimeWindow." + error; + } + } + if (message.readTime != null && message.hasOwnProperty("readTime")) { + if (properties.time === 1) + return "time: multiple values"; + properties.time = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.readTime); + if (error) + return "readTime." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + return null; + }; + + /** + * Creates a QueryAssetsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.QueryAssetsRequest} QueryAssetsRequest + */ + QueryAssetsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.QueryAssetsRequest) + return object; + var message = new $root.google.cloud.asset.v1.QueryAssetsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.statement != null) + message.statement = String(object.statement); + if (object.jobReference != null) + message.jobReference = String(object.jobReference); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsRequest.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + if (object.readTimeWindow != null) { + if (typeof object.readTimeWindow !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsRequest.readTimeWindow: object expected"); + message.readTimeWindow = $root.google.cloud.asset.v1.TimeWindow.fromObject(object.readTimeWindow); + } + if (object.readTime != null) { + if (typeof object.readTime !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.fromObject(object.outputConfig); + } + return message; + }; + + /** + * Creates a plain object from a QueryAssetsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @static + * @param {google.cloud.asset.v1.QueryAssetsRequest} message QueryAssetsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAssetsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.timeout = null; + object.outputConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.statement != null && message.hasOwnProperty("statement")) { + object.statement = message.statement; + if (options.oneofs) + object.query = "statement"; + } + if (message.jobReference != null && message.hasOwnProperty("jobReference")) { + object.jobReference = message.jobReference; + if (options.oneofs) + object.query = "jobReference"; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + if (message.readTimeWindow != null && message.hasOwnProperty("readTimeWindow")) { + object.readTimeWindow = $root.google.cloud.asset.v1.TimeWindow.toObject(message.readTimeWindow, options); + if (options.oneofs) + object.time = "readTimeWindow"; + } + if (message.readTime != null && message.hasOwnProperty("readTime")) { + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); + if (options.oneofs) + object.time = "readTime"; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.toObject(message.outputConfig, options); + return object; + }; + + /** + * Converts this QueryAssetsRequest to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.QueryAssetsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryAssetsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAssetsRequest; + })(); + + v1.QueryAssetsResponse = (function() { + + /** + * Properties of a QueryAssetsResponse. + * @memberof google.cloud.asset.v1 + * @interface IQueryAssetsResponse + * @property {string|null} [jobReference] QueryAssetsResponse jobReference + * @property {boolean|null} [done] QueryAssetsResponse done + * @property {google.rpc.IStatus|null} [error] QueryAssetsResponse error + * @property {google.cloud.asset.v1.IQueryResult|null} [queryResult] QueryAssetsResponse queryResult + * @property {google.cloud.asset.v1.IQueryAssetsOutputConfig|null} [outputConfig] QueryAssetsResponse outputConfig + */ + + /** + * Constructs a new QueryAssetsResponse. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a QueryAssetsResponse. + * @implements IQueryAssetsResponse + * @constructor + * @param {google.cloud.asset.v1.IQueryAssetsResponse=} [properties] Properties to set + */ + function QueryAssetsResponse(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]]; + } + + /** + * QueryAssetsResponse jobReference. + * @member {string} jobReference + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @instance + */ + QueryAssetsResponse.prototype.jobReference = ""; + + /** + * QueryAssetsResponse done. + * @member {boolean} done + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @instance + */ + QueryAssetsResponse.prototype.done = false; + + /** + * QueryAssetsResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @instance + */ + QueryAssetsResponse.prototype.error = null; + + /** + * QueryAssetsResponse queryResult. + * @member {google.cloud.asset.v1.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @instance + */ + QueryAssetsResponse.prototype.queryResult = null; + + /** + * QueryAssetsResponse outputConfig. + * @member {google.cloud.asset.v1.IQueryAssetsOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @instance + */ + QueryAssetsResponse.prototype.outputConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryAssetsResponse response. + * @member {"error"|"queryResult"|"outputConfig"|undefined} response + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @instance + */ + Object.defineProperty(QueryAssetsResponse.prototype, "response", { + get: $util.oneOfGetter($oneOfFields = ["error", "queryResult", "outputConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryAssetsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @static + * @param {google.cloud.asset.v1.IQueryAssetsResponse=} [properties] Properties to set + * @returns {google.cloud.asset.v1.QueryAssetsResponse} QueryAssetsResponse instance + */ + QueryAssetsResponse.create = function create(properties) { + return new QueryAssetsResponse(properties); + }; + + /** + * Encodes the specified QueryAssetsResponse message. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @static + * @param {google.cloud.asset.v1.IQueryAssetsResponse} message QueryAssetsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAssetsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.jobReference != null && Object.hasOwnProperty.call(message, "jobReference")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.jobReference); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.asset.v1.QueryResult.encode(message.queryResult, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputConfig != null && Object.hasOwnProperty.call(message, "outputConfig")) + $root.google.cloud.asset.v1.QueryAssetsOutputConfig.encode(message.outputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryAssetsResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryAssetsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @static + * @param {google.cloud.asset.v1.IQueryAssetsResponse} message QueryAssetsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAssetsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAssetsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @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.QueryAssetsResponse} QueryAssetsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAssetsResponse.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.QueryAssetsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.jobReference = reader.string(); + break; + case 2: + message.done = reader.bool(); + break; + case 3: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 4: + message.queryResult = $root.google.cloud.asset.v1.QueryResult.decode(reader, reader.uint32()); + break; + case 5: + message.outputConfig = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAssetsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.QueryAssetsResponse} QueryAssetsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAssetsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAssetsResponse message. + * @function verify + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAssetsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.jobReference != null && message.hasOwnProperty("jobReference")) + if (!$util.isString(message.jobReference)) + return "jobReference: string expected"; + if (message.done != null && message.hasOwnProperty("done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && message.hasOwnProperty("error")) { + properties.response = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + if (properties.response === 1) + return "response: multiple values"; + properties.response = 1; + { + var error = $root.google.cloud.asset.v1.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + if (properties.response === 1) + return "response: multiple values"; + properties.response = 1; + { + var error = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } + } + return null; + }; + + /** + * Creates a QueryAssetsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.QueryAssetsResponse} QueryAssetsResponse + */ + QueryAssetsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.QueryAssetsResponse) + return object; + var message = new $root.google.cloud.asset.v1.QueryAssetsResponse(); + if (object.jobReference != null) + message.jobReference = String(object.jobReference); + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsResponse.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsResponse.queryResult: object expected"); + message.queryResult = $root.google.cloud.asset.v1.QueryResult.fromObject(object.queryResult); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.asset.v1.QueryAssetsResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.fromObject(object.outputConfig); + } + return message; + }; + + /** + * Creates a plain object from a QueryAssetsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @static + * @param {google.cloud.asset.v1.QueryAssetsResponse} message QueryAssetsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAssetsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.jobReference = ""; + object.done = false; + } + if (message.jobReference != null && message.hasOwnProperty("jobReference")) + object.jobReference = message.jobReference; + if (message.done != null && message.hasOwnProperty("done")) + object.done = message.done; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.response = "error"; + } + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + object.queryResult = $root.google.cloud.asset.v1.QueryResult.toObject(message.queryResult, options); + if (options.oneofs) + object.response = "queryResult"; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + object.outputConfig = $root.google.cloud.asset.v1.QueryAssetsOutputConfig.toObject(message.outputConfig, options); + if (options.oneofs) + object.response = "outputConfig"; + } + return object; + }; + + /** + * Converts this QueryAssetsResponse to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.QueryAssetsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryAssetsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAssetsResponse; + })(); + + v1.QueryResult = (function() { + + /** + * Properties of a QueryResult. + * @memberof google.cloud.asset.v1 + * @interface IQueryResult + * @property {Array.|null} [rows] QueryResult rows + * @property {google.cloud.asset.v1.ITableSchema|null} [schema] QueryResult schema + * @property {string|null} [nextPageToken] QueryResult nextPageToken + * @property {number|Long|null} [totalRows] QueryResult totalRows + */ + + /** + * Constructs a new QueryResult. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a QueryResult. + * @implements IQueryResult + * @constructor + * @param {google.cloud.asset.v1.IQueryResult=} [properties] Properties to set + */ + function QueryResult(properties) { + this.rows = []; + 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]]; + } + + /** + * QueryResult rows. + * @member {Array.} rows + * @memberof google.cloud.asset.v1.QueryResult + * @instance + */ + QueryResult.prototype.rows = $util.emptyArray; + + /** + * QueryResult schema. + * @member {google.cloud.asset.v1.ITableSchema|null|undefined} schema + * @memberof google.cloud.asset.v1.QueryResult + * @instance + */ + QueryResult.prototype.schema = null; + + /** + * QueryResult nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.asset.v1.QueryResult + * @instance + */ + QueryResult.prototype.nextPageToken = ""; + + /** + * QueryResult totalRows. + * @member {number|Long} totalRows + * @memberof google.cloud.asset.v1.QueryResult + * @instance + */ + QueryResult.prototype.totalRows = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new QueryResult instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.QueryResult + * @static + * @param {google.cloud.asset.v1.IQueryResult=} [properties] Properties to set + * @returns {google.cloud.asset.v1.QueryResult} QueryResult instance + */ + QueryResult.create = function create(properties) { + return new QueryResult(properties); + }; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.asset.v1.QueryResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.QueryResult + * @static + * @param {google.cloud.asset.v1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rows != null && message.rows.length) + for (var i = 0; i < message.rows.length; ++i) + $root.google.protobuf.Struct.encode(message.rows[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.schema != null && Object.hasOwnProperty.call(message, "schema")) + $root.google.cloud.asset.v1.TableSchema.encode(message.schema, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + if (message.totalRows != null && Object.hasOwnProperty.call(message, "totalRows")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.totalRows); + return writer; + }; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.asset.v1.QueryResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.QueryResult + * @static + * @param {google.cloud.asset.v1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.QueryResult + * @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.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.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.QueryResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rows && message.rows.length)) + message.rows = []; + message.rows.push($root.google.protobuf.Struct.decode(reader, reader.uint32())); + break; + case 2: + message.schema = $root.google.cloud.asset.v1.TableSchema.decode(reader, reader.uint32()); + break; + case 3: + message.nextPageToken = reader.string(); + break; + case 4: + message.totalRows = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryResult message. + * @function verify + * @memberof google.cloud.asset.v1.QueryResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rows != null && message.hasOwnProperty("rows")) { + if (!Array.isArray(message.rows)) + return "rows: array expected"; + for (var i = 0; i < message.rows.length; ++i) { + var error = $root.google.protobuf.Struct.verify(message.rows[i]); + if (error) + return "rows." + error; + } + } + if (message.schema != null && message.hasOwnProperty("schema")) { + var error = $root.google.cloud.asset.v1.TableSchema.verify(message.schema); + if (error) + return "schema." + error; + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalRows != null && message.hasOwnProperty("totalRows")) + if (!$util.isInteger(message.totalRows) && !(message.totalRows && $util.isInteger(message.totalRows.low) && $util.isInteger(message.totalRows.high))) + return "totalRows: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.QueryResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.QueryResult} QueryResult + */ + QueryResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.QueryResult) + return object; + var message = new $root.google.cloud.asset.v1.QueryResult(); + if (object.rows) { + if (!Array.isArray(object.rows)) + throw TypeError(".google.cloud.asset.v1.QueryResult.rows: array expected"); + message.rows = []; + for (var i = 0; i < object.rows.length; ++i) { + if (typeof object.rows[i] !== "object") + throw TypeError(".google.cloud.asset.v1.QueryResult.rows: object expected"); + message.rows[i] = $root.google.protobuf.Struct.fromObject(object.rows[i]); + } + } + if (object.schema != null) { + if (typeof object.schema !== "object") + throw TypeError(".google.cloud.asset.v1.QueryResult.schema: object expected"); + message.schema = $root.google.cloud.asset.v1.TableSchema.fromObject(object.schema); + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalRows != null) + if ($util.Long) + (message.totalRows = $util.Long.fromValue(object.totalRows)).unsigned = false; + else if (typeof object.totalRows === "string") + message.totalRows = parseInt(object.totalRows, 10); + else if (typeof object.totalRows === "number") + message.totalRows = object.totalRows; + else if (typeof object.totalRows === "object") + message.totalRows = new $util.LongBits(object.totalRows.low >>> 0, object.totalRows.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.QueryResult + * @static + * @param {google.cloud.asset.v1.QueryResult} message QueryResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rows = []; + if (options.defaults) { + object.schema = null; + object.nextPageToken = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalRows = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalRows = options.longs === String ? "0" : 0; + } + if (message.rows && message.rows.length) { + object.rows = []; + for (var j = 0; j < message.rows.length; ++j) + object.rows[j] = $root.google.protobuf.Struct.toObject(message.rows[j], options); + } + if (message.schema != null && message.hasOwnProperty("schema")) + object.schema = $root.google.cloud.asset.v1.TableSchema.toObject(message.schema, options); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalRows != null && message.hasOwnProperty("totalRows")) + if (typeof message.totalRows === "number") + object.totalRows = options.longs === String ? String(message.totalRows) : message.totalRows; + else + object.totalRows = options.longs === String ? $util.Long.prototype.toString.call(message.totalRows) : options.longs === Number ? new $util.LongBits(message.totalRows.low >>> 0, message.totalRows.high >>> 0).toNumber() : message.totalRows; + return object; + }; + + /** + * Converts this QueryResult to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.QueryResult + * @instance + * @returns {Object.} JSON object + */ + QueryResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryResult; + })(); + + v1.TableSchema = (function() { + + /** + * Properties of a TableSchema. + * @memberof google.cloud.asset.v1 + * @interface ITableSchema + * @property {Array.|null} [fields] TableSchema fields + */ + + /** + * Constructs a new TableSchema. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a TableSchema. + * @implements ITableSchema + * @constructor + * @param {google.cloud.asset.v1.ITableSchema=} [properties] Properties to set + */ + function TableSchema(properties) { + this.fields = []; + 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]]; + } + + /** + * TableSchema fields. + * @member {Array.} fields + * @memberof google.cloud.asset.v1.TableSchema + * @instance + */ + TableSchema.prototype.fields = $util.emptyArray; + + /** + * Creates a new TableSchema instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.TableSchema + * @static + * @param {google.cloud.asset.v1.ITableSchema=} [properties] Properties to set + * @returns {google.cloud.asset.v1.TableSchema} TableSchema instance + */ + TableSchema.create = function create(properties) { + return new TableSchema(properties); + }; + + /** + * Encodes the specified TableSchema message. Does not implicitly {@link google.cloud.asset.v1.TableSchema.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.TableSchema + * @static + * @param {google.cloud.asset.v1.ITableSchema} message TableSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableSchema.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fields != null && message.fields.length) + for (var i = 0; i < message.fields.length; ++i) + $root.google.cloud.asset.v1.TableFieldSchema.encode(message.fields[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableSchema message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TableSchema.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.TableSchema + * @static + * @param {google.cloud.asset.v1.ITableSchema} message TableSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableSchema.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableSchema message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.TableSchema + * @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.TableSchema} TableSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableSchema.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.TableSchema(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.fields && message.fields.length)) + message.fields = []; + message.fields.push($root.google.cloud.asset.v1.TableFieldSchema.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableSchema message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.TableSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.TableSchema} TableSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableSchema.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableSchema message. + * @function verify + * @memberof google.cloud.asset.v1.TableSchema + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableSchema.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fields != null && message.hasOwnProperty("fields")) { + if (!Array.isArray(message.fields)) + return "fields: array expected"; + for (var i = 0; i < message.fields.length; ++i) { + var error = $root.google.cloud.asset.v1.TableFieldSchema.verify(message.fields[i]); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a TableSchema message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.TableSchema + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.TableSchema} TableSchema + */ + TableSchema.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.TableSchema) + return object; + var message = new $root.google.cloud.asset.v1.TableSchema(); + if (object.fields) { + if (!Array.isArray(object.fields)) + throw TypeError(".google.cloud.asset.v1.TableSchema.fields: array expected"); + message.fields = []; + for (var i = 0; i < object.fields.length; ++i) { + if (typeof object.fields[i] !== "object") + throw TypeError(".google.cloud.asset.v1.TableSchema.fields: object expected"); + message.fields[i] = $root.google.cloud.asset.v1.TableFieldSchema.fromObject(object.fields[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableSchema message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.TableSchema + * @static + * @param {google.cloud.asset.v1.TableSchema} message TableSchema + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableSchema.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.fields = []; + if (message.fields && message.fields.length) { + object.fields = []; + for (var j = 0; j < message.fields.length; ++j) + object.fields[j] = $root.google.cloud.asset.v1.TableFieldSchema.toObject(message.fields[j], options); + } + return object; + }; + + /** + * Converts this TableSchema to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.TableSchema + * @instance + * @returns {Object.} JSON object + */ + TableSchema.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableSchema; + })(); + + v1.TableFieldSchema = (function() { + + /** + * Properties of a TableFieldSchema. + * @memberof google.cloud.asset.v1 + * @interface ITableFieldSchema + * @property {string|null} [field] TableFieldSchema field + * @property {string|null} [type] TableFieldSchema type + * @property {string|null} [mode] TableFieldSchema mode + * @property {Array.|null} [fields] TableFieldSchema fields + */ + + /** + * Constructs a new TableFieldSchema. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a TableFieldSchema. + * @implements ITableFieldSchema + * @constructor + * @param {google.cloud.asset.v1.ITableFieldSchema=} [properties] Properties to set + */ + function TableFieldSchema(properties) { + this.fields = []; + 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]]; + } + + /** + * TableFieldSchema field. + * @member {string} field + * @memberof google.cloud.asset.v1.TableFieldSchema + * @instance + */ + TableFieldSchema.prototype.field = ""; + + /** + * TableFieldSchema type. + * @member {string} type + * @memberof google.cloud.asset.v1.TableFieldSchema + * @instance + */ + TableFieldSchema.prototype.type = ""; + + /** + * TableFieldSchema mode. + * @member {string} mode + * @memberof google.cloud.asset.v1.TableFieldSchema + * @instance + */ + TableFieldSchema.prototype.mode = ""; + + /** + * TableFieldSchema fields. + * @member {Array.} fields + * @memberof google.cloud.asset.v1.TableFieldSchema + * @instance + */ + TableFieldSchema.prototype.fields = $util.emptyArray; + + /** + * Creates a new TableFieldSchema instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.TableFieldSchema + * @static + * @param {google.cloud.asset.v1.ITableFieldSchema=} [properties] Properties to set + * @returns {google.cloud.asset.v1.TableFieldSchema} TableFieldSchema instance + */ + TableFieldSchema.create = function create(properties) { + return new TableFieldSchema(properties); + }; + + /** + * Encodes the specified TableFieldSchema message. Does not implicitly {@link google.cloud.asset.v1.TableFieldSchema.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.TableFieldSchema + * @static + * @param {google.cloud.asset.v1.ITableFieldSchema} message TableFieldSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableFieldSchema.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.field != null && Object.hasOwnProperty.call(message, "field")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.field); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mode); + if (message.fields != null && message.fields.length) + for (var i = 0; i < message.fields.length; ++i) + $root.google.cloud.asset.v1.TableFieldSchema.encode(message.fields[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableFieldSchema message, length delimited. Does not implicitly {@link google.cloud.asset.v1.TableFieldSchema.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.TableFieldSchema + * @static + * @param {google.cloud.asset.v1.ITableFieldSchema} message TableFieldSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableFieldSchema.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableFieldSchema message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.TableFieldSchema + * @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.TableFieldSchema} TableFieldSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableFieldSchema.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.TableFieldSchema(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.field = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.mode = reader.string(); + break; + case 4: + if (!(message.fields && message.fields.length)) + message.fields = []; + message.fields.push($root.google.cloud.asset.v1.TableFieldSchema.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableFieldSchema message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.TableFieldSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.TableFieldSchema} TableFieldSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableFieldSchema.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableFieldSchema message. + * @function verify + * @memberof google.cloud.asset.v1.TableFieldSchema + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableFieldSchema.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.field != null && message.hasOwnProperty("field")) + if (!$util.isString(message.field)) + return "field: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + if (!$util.isString(message.mode)) + return "mode: string expected"; + if (message.fields != null && message.hasOwnProperty("fields")) { + if (!Array.isArray(message.fields)) + return "fields: array expected"; + for (var i = 0; i < message.fields.length; ++i) { + var error = $root.google.cloud.asset.v1.TableFieldSchema.verify(message.fields[i]); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a TableFieldSchema message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.TableFieldSchema + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.TableFieldSchema} TableFieldSchema + */ + TableFieldSchema.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.TableFieldSchema) + return object; + var message = new $root.google.cloud.asset.v1.TableFieldSchema(); + if (object.field != null) + message.field = String(object.field); + if (object.type != null) + message.type = String(object.type); + if (object.mode != null) + message.mode = String(object.mode); + if (object.fields) { + if (!Array.isArray(object.fields)) + throw TypeError(".google.cloud.asset.v1.TableFieldSchema.fields: array expected"); + message.fields = []; + for (var i = 0; i < object.fields.length; ++i) { + if (typeof object.fields[i] !== "object") + throw TypeError(".google.cloud.asset.v1.TableFieldSchema.fields: object expected"); + message.fields[i] = $root.google.cloud.asset.v1.TableFieldSchema.fromObject(object.fields[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableFieldSchema message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.TableFieldSchema + * @static + * @param {google.cloud.asset.v1.TableFieldSchema} message TableFieldSchema + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableFieldSchema.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.fields = []; + if (options.defaults) { + object.field = ""; + object.type = ""; + object.mode = ""; + } + if (message.field != null && message.hasOwnProperty("field")) + object.field = message.field; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = message.mode; + if (message.fields && message.fields.length) { + object.fields = []; + for (var j = 0; j < message.fields.length; ++j) + object.fields[j] = $root.google.cloud.asset.v1.TableFieldSchema.toObject(message.fields[j], options); + } + return object; + }; + + /** + * Converts this TableFieldSchema to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.TableFieldSchema + * @instance + * @returns {Object.} JSON object + */ + TableFieldSchema.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableFieldSchema; + })(); + + v1.BatchGetEffectiveIamPoliciesRequest = (function() { + + /** + * Properties of a BatchGetEffectiveIamPoliciesRequest. + * @memberof google.cloud.asset.v1 + * @interface IBatchGetEffectiveIamPoliciesRequest + * @property {string|null} [scope] BatchGetEffectiveIamPoliciesRequest scope + * @property {Array.|null} [names] BatchGetEffectiveIamPoliciesRequest names + */ + + /** + * Constructs a new BatchGetEffectiveIamPoliciesRequest. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a BatchGetEffectiveIamPoliciesRequest. + * @implements IBatchGetEffectiveIamPoliciesRequest + * @constructor + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest=} [properties] Properties to set + */ + function BatchGetEffectiveIamPoliciesRequest(properties) { + this.names = []; + 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]]; + } + + /** + * BatchGetEffectiveIamPoliciesRequest scope. + * @member {string} scope + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @instance + */ + BatchGetEffectiveIamPoliciesRequest.prototype.scope = ""; + + /** + * BatchGetEffectiveIamPoliciesRequest names. + * @member {Array.} names + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @instance + */ + BatchGetEffectiveIamPoliciesRequest.prototype.names = $util.emptyArray; + + /** + * Creates a new BatchGetEffectiveIamPoliciesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @static + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest=} [properties] Properties to set + * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest instance + */ + BatchGetEffectiveIamPoliciesRequest.create = function create(properties) { + return new BatchGetEffectiveIamPoliciesRequest(properties); + }; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesRequest message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @static + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest} message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetEffectiveIamPoliciesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.scope != null && Object.hasOwnProperty.call(message, "scope")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.scope); + if (message.names != null && message.names.length) + for (var i = 0; i < message.names.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.names[i]); + return writer; + }; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesRequest message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @static + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest} message BatchGetEffectiveIamPoliciesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetEffectiveIamPoliciesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @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.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetEffectiveIamPoliciesRequest.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.BatchGetEffectiveIamPoliciesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.scope = reader.string(); + break; + case 3: + if (!(message.names && message.names.length)) + message.names = []; + message.names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchGetEffectiveIamPoliciesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchGetEffectiveIamPoliciesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchGetEffectiveIamPoliciesRequest message. + * @function verify + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchGetEffectiveIamPoliciesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.scope != null && message.hasOwnProperty("scope")) + if (!$util.isString(message.scope)) + return "scope: string expected"; + if (message.names != null && message.hasOwnProperty("names")) { + if (!Array.isArray(message.names)) + return "names: array expected"; + for (var i = 0; i < message.names.length; ++i) + if (!$util.isString(message.names[i])) + return "names: string[] expected"; + } + return null; + }; + + /** + * Creates a BatchGetEffectiveIamPoliciesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} BatchGetEffectiveIamPoliciesRequest + */ + BatchGetEffectiveIamPoliciesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest) + return object; + var message = new $root.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest(); + if (object.scope != null) + message.scope = String(object.scope); + if (object.names) { + if (!Array.isArray(object.names)) + throw TypeError(".google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names: array expected"); + message.names = []; + for (var i = 0; i < object.names.length; ++i) + message.names[i] = String(object.names[i]); + } + return message; + }; + + /** + * Creates a plain object from a BatchGetEffectiveIamPoliciesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @static + * @param {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest} message BatchGetEffectiveIamPoliciesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchGetEffectiveIamPoliciesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.names = []; + if (options.defaults) + object.scope = ""; + if (message.scope != null && message.hasOwnProperty("scope")) + object.scope = message.scope; + if (message.names && message.names.length) { + object.names = []; + for (var j = 0; j < message.names.length; ++j) + object.names[j] = message.names[j]; + } + return object; + }; + + /** + * Converts this BatchGetEffectiveIamPoliciesRequest to JSON. + * @function toJSON + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchGetEffectiveIamPoliciesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchGetEffectiveIamPoliciesRequest; + })(); + + v1.BatchGetEffectiveIamPoliciesResponse = (function() { + + /** + * Properties of a BatchGetEffectiveIamPoliciesResponse. + * @memberof google.cloud.asset.v1 + * @interface IBatchGetEffectiveIamPoliciesResponse + * @property {Array.|null} [policyResults] BatchGetEffectiveIamPoliciesResponse policyResults + */ + + /** + * Constructs a new BatchGetEffectiveIamPoliciesResponse. + * @memberof google.cloud.asset.v1 + * @classdesc Represents a BatchGetEffectiveIamPoliciesResponse. + * @implements IBatchGetEffectiveIamPoliciesResponse + * @constructor + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse=} [properties] Properties to set + */ + function BatchGetEffectiveIamPoliciesResponse(properties) { + this.policyResults = []; + 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]]; + } + + /** + * BatchGetEffectiveIamPoliciesResponse policyResults. + * @member {Array.} policyResults + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse + * @instance + */ + BatchGetEffectiveIamPoliciesResponse.prototype.policyResults = $util.emptyArray; + + /** + * Creates a new BatchGetEffectiveIamPoliciesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse + * @static + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse=} [properties] Properties to set + * @returns {google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse} BatchGetEffectiveIamPoliciesResponse instance + */ + BatchGetEffectiveIamPoliciesResponse.create = function create(properties) { + return new BatchGetEffectiveIamPoliciesResponse(properties); + }; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesResponse message. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse + * @static + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse} message BatchGetEffectiveIamPoliciesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchGetEffectiveIamPoliciesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.policyResults != null && message.policyResults.length) + for (var i = 0; i < message.policyResults.length; ++i) + $root.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.encode(message.policyResults[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchGetEffectiveIamPoliciesResponse message, length delimited. Does not implicitly {@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse + * @static + * @param {google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse} message BatchGetEffectiveIamPoliciesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ BatchGetEffectiveIamPoliciesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); @@ -14691,6 +16660,30 @@ return BatchGetEffectiveIamPoliciesResponse; })(); + /** + * 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 + * @property {number} OS_INVENTORY=6 OS_INVENTORY value + * @property {number} RELATIONSHIP=7 RELATIONSHIP 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; + values[valuesById[6] = "OS_INVENTORY"] = 6; + values[valuesById[7] = "RELATIONSHIP"] = 7; + return values; + })(); + v1.TemporalAsset = (function() { /** diff --git a/packages/google-cloud-asset/protos/protos.json b/packages/google-cloud-asset/protos/protos.json index acc1f37e9312..073cdd91fb86 100644 --- a/packages/google-cloud-asset/protos/protos.json +++ b/packages/google-cloud-asset/protos/protos.json @@ -261,6 +261,22 @@ } ] }, + "QueryAssets": { + "requestType": "QueryAssetsRequest", + "responseType": "QueryAssetsResponse", + "options": { + "(google.api.http).post": "/v1/{parent=*/*}:queryAssets", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=*/*}:queryAssets", + "body": "*" + } + } + ] + }, "CreateSavedQuery": { "requestType": "CreateSavedQueryRequest", "responseType": "SavedQuery", @@ -1517,15 +1533,202 @@ } } }, - "ContentType": { - "values": { - "CONTENT_TYPE_UNSPECIFIED": 0, - "RESOURCE": 1, - "IAM_POLICY": 2, - "ORG_POLICY": 4, - "ACCESS_POLICY": 5, - "OS_INVENTORY": 6, - "RELATIONSHIP": 7 + "QueryAssetsOutputConfig": { + "fields": { + "bigqueryDestination": { + "type": "BigQueryDestination", + "id": 1 + } + }, + "nested": { + "BigQueryDestination": { + "fields": { + "dataset": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "table": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "writeDisposition": { + "type": "string", + "id": 3 + } + } + } + } + }, + "QueryAssetsRequest": { + "oneofs": { + "query": { + "oneof": [ + "statement", + "jobReference" + ] + }, + "time": { + "oneof": [ + "readTimeWindow", + "readTime" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudasset.googleapis.com/Asset" + } + }, + "statement": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "jobReference": { + "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" + } + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "readTimeWindow": { + "type": "TimeWindow", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "outputConfig": { + "type": "QueryAssetsOutputConfig", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "QueryAssetsResponse": { + "oneofs": { + "response": { + "oneof": [ + "error", + "queryResult", + "outputConfig" + ] + } + }, + "fields": { + "jobReference": { + "type": "string", + "id": 1 + }, + "done": { + "type": "bool", + "id": 2 + }, + "error": { + "type": "google.rpc.Status", + "id": 3 + }, + "queryResult": { + "type": "QueryResult", + "id": 4 + }, + "outputConfig": { + "type": "QueryAssetsOutputConfig", + "id": 5 + } + } + }, + "QueryResult": { + "fields": { + "rows": { + "rule": "repeated", + "type": "google.protobuf.Struct", + "id": 1 + }, + "schema": { + "type": "TableSchema", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + }, + "totalRows": { + "type": "int64", + "id": 4 + } + } + }, + "TableSchema": { + "fields": { + "fields": { + "rule": "repeated", + "type": "TableFieldSchema", + "id": 1 + } + } + }, + "TableFieldSchema": { + "fields": { + "field": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "mode": { + "type": "string", + "id": 3 + }, + "fields": { + "rule": "repeated", + "type": "TableFieldSchema", + "id": 4 + } } }, "BatchGetEffectiveIamPoliciesRequest": { @@ -1587,6 +1790,17 @@ } } }, + "ContentType": { + "values": { + "CONTENT_TYPE_UNSPECIFIED": 0, + "RESOURCE": 1, + "IAM_POLICY": 2, + "ORG_POLICY": 4, + "ACCESS_POLICY": 5, + "OS_INVENTORY": 6, + "RELATIONSHIP": 7 + } + }, "TemporalAsset": { "fields": { "window": { diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.query_assets.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.query_assets.js new file mode 100644 index 000000000000..b84f4a568af5 --- /dev/null +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.query_assets.js @@ -0,0 +1,120 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudasset_v1_generated_AssetService_QueryAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative name of the root asset. This can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"), + * or a folder number (such as "folders/123"). + * Only assets belonging to the `parent` will be returned. + */ + // const parent = 'abc123' + /** + * Optional. A SQL statement that's compatible with BigQuery Standard + * SQL (http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + */ + // const statement = 'abc123' + /** + * Optional. Reference to the query job, which is from the + * `QueryAssetsResponse` of previous `QueryAssets` call. + */ + // const jobReference = 'abc123' + /** + * Optional. The maximum number of rows to return in the results. Responses + * are limited to 10 MB and 1000 rows. + * By default, the maximum row count is 1000. When the byte or row count limit + * is reached, the rest of the query results will be paginated. + * The field will be ignored when output_config is specified. + */ + // const pageSize = 1234 + /** + * Optional. A page token received from previous `QueryAssets`. + * The field will be ignored when output_config is specified. + */ + // const pageToken = 'abc123' + /** + * Optional. Specifies the maximum amount of time that the client is willing + * to wait for the query to complete. By default, this limit is 5 min for the + * first query, and 1 minute for the following queries. If the query is + * complete, the `done` field in the `QueryAssetsResponse` is true, otherwise + * false. + * Like BigQuery jobs.query + * API (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) + * The call is not guaranteed to wait for the specified timeout; it typically + * returns after around 200 seconds (200,000 milliseconds), even if the query + * is not complete. + * The field will be ignored when output_config is specified. + */ + // const timeout = {} + /** + * Optional. start_time is required. start_time must be less than + * end_time Defaults end_time to now if start_time is set and + * end_time isn't. Maximum permitted time range is 7 days. + */ + // const readTimeWindow = {} + /** + * Optional. Queries cloud assets as they appeared at the specified point in + * time. + */ + // const readTime = {} + /** + * Optional. Destination where the query results will be saved. + * When this field is specified, the query results won't be saved in the + * QueryAssetsResponse.query_result. Instead + * QueryAssetsResponse.output_config will be set. + * Meanwhile, QueryAssetsResponse.job_reference will be set and can be used + * to check the status of the query job when passed to a following + * QueryAssets API call. + */ + // const outputConfig = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callQueryAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await assetClient.queryAssets(request); + console.log(response); + } + + callQueryAssets(); + // [END cloudasset_v1_generated_AssetService_QueryAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js index 110dd00f85c6..4149c7d86ef8 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js @@ -46,8 +46,8 @@ function main(scope) { * compared against each Cloud IAM policy binding, including its principals, * roles, and Cloud IAM conditions. The returned Cloud IAM policies will only * contain the bindings that match your query. To learn more about the IAM - * policy structure, see IAM policy - * doc (https://cloud.google.com/iam/docs/policies#structure). + * policy structure, see the IAM policy + * documentation (https://cloud.google.com/iam/help/allow-policies/structure). * Examples: * * `policy:amy@gmail.com` to find IAM policy bindings that specify user * "amy@gmail.com". diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js index 8c22917886c9..a893363d6fd8 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js @@ -59,6 +59,14 @@ function main(scope) { * * `labels.env:*` to find Cloud resources that have a label "env". * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a * word. * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain diff --git a/packages/google-cloud-asset/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json b/packages/google-cloud-asset/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json index 8d55ae162dac..df028f8ba000 100644 --- a/packages/google-cloud-asset/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json +++ b/packages/google-cloud-asset/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json @@ -414,7 +414,7 @@ "segments": [ { "start": 25, - "end": 185, + "end": 193, "type": "FULL" } ], @@ -671,6 +671,78 @@ } } }, + { + "regionTag": "cloudasset_v1_generated_AssetService_QueryAssets_async", + "title": "AssetService queryAssets Sample", + "origin": "API_DEFINITION", + "description": " Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`. Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call. Note, the query result has approximately 10 GB limitation enforced by BigQuery https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger results will result in errors.", + "canonical": true, + "file": "asset_service.query_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 112, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "QueryAssets", + "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "statement", + "type": "TYPE_STRING" + }, + { + "name": "job_reference", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "timeout", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time_window", + "type": ".google.cloud.asset.v1.TimeWindow" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "output_config", + "type": ".google.cloud.asset.v1.QueryAssetsOutputConfig" + } + ], + "resultType": ".google.cloud.asset.v1.QueryAssetsResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "QueryAssets", + "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, { "regionTag": "cloudasset_v1_generated_AssetService_CreateSavedQuery_async", "title": "AssetService createSavedQuery Sample", diff --git a/packages/google-cloud-asset/src/v1/asset_service_client.ts b/packages/google-cloud-asset/src/v1/asset_service_client.ts index e76fc628c399..ac27f5f4a84e 100644 --- a/packages/google-cloud-asset/src/v1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1/asset_service_client.ts @@ -340,6 +340,7 @@ export class AssetServiceClient { 'analyzeIamPolicy', 'analyzeIamPolicyLongrunning', 'analyzeMove', + 'queryAssets', 'createSavedQuery', 'getSavedQuery', 'listSavedQueries', @@ -1223,6 +1224,156 @@ export class AssetServiceClient { this.initialize(); return this.innerApiCalls.analyzeMove(request, options, callback); } + /** + * Issue a job that queries assets using a SQL statement compatible with + * [BigQuery Standard + * SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + * + * If the query execution finishes within timeout and there's no pagination, + * the full query results will be returned in the `QueryAssetsResponse`. + * + * Otherwise, full query results can be obtained by issuing extra requests + * with the `job_reference` from the a previous `QueryAssets` call. + * + * Note, the query result has approximately 10 GB limitation enforced by + * BigQuery + * https://cloud.google.com/bigquery/docs/best-practices-performance-output, + * queries return larger results will result in errors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative name of the root asset. This can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"), + * or a folder number (such as "folders/123"). + * + * Only assets belonging to the `parent` will be returned. + * @param {string} [request.statement] + * Optional. A SQL statement that's compatible with [BigQuery Standard + * SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + * @param {string} [request.jobReference] + * Optional. Reference to the query job, which is from the + * `QueryAssetsResponse` of previous `QueryAssets` call. + * @param {number} [request.pageSize] + * Optional. The maximum number of rows to return in the results. Responses + * are limited to 10 MB and 1000 rows. + * + * By default, the maximum row count is 1000. When the byte or row count limit + * is reached, the rest of the query results will be paginated. + * + * The field will be ignored when [output_config] is specified. + * @param {string} [request.pageToken] + * Optional. A page token received from previous `QueryAssets`. + * + * The field will be ignored when [output_config] is specified. + * @param {google.protobuf.Duration} [request.timeout] + * Optional. Specifies the maximum amount of time that the client is willing + * to wait for the query to complete. By default, this limit is 5 min for the + * first query, and 1 minute for the following queries. If the query is + * complete, the `done` field in the `QueryAssetsResponse` is true, otherwise + * false. + * + * Like BigQuery [jobs.query + * API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) + * The call is not guaranteed to wait for the specified timeout; it typically + * returns after around 200 seconds (200,000 milliseconds), even if the query + * is not complete. + * + * The field will be ignored when [output_config] is specified. + * @param {google.cloud.asset.v1.TimeWindow} [request.readTimeWindow] + * Optional. [start_time] is required. [start_time] must be less than + * [end_time] Defaults [end_time] to now if [start_time] is set and + * [end_time] isn't. Maximum permitted time range is 7 days. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Queries cloud assets as they appeared at the specified point in + * time. + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig} [request.outputConfig] + * Optional. Destination where the query results will be saved. + * + * When this field is specified, the query results won't be saved in the + * [QueryAssetsResponse.query_result]. Instead + * [QueryAssetsResponse.output_config] will be set. + * + * Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used + * to check the status of the query job when passed to a following + * [QueryAssets] API 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 an object representing [QueryAssetsResponse]{@link google.cloud.asset.v1.QueryAssetsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.query_assets.js + * region_tag:cloudasset_v1_generated_AssetService_QueryAssets_async + */ + queryAssets( + request?: protos.google.cloud.asset.v1.IQueryAssetsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest | undefined, + {} | undefined + ] + >; + queryAssets( + request: protos.google.cloud.asset.v1.IQueryAssetsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, + {} | null | undefined + > + ): void; + queryAssets( + request: protos.google.cloud.asset.v1.IQueryAssetsRequest, + callback: Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, + {} | null | undefined + > + ): void; + queryAssets( + request?: protos.google.cloud.asset.v1.IQueryAssetsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.queryAssets(request, options, callback); + } /** * Creates a saved query in a parent project/folder/organization. * @@ -2460,6 +2611,14 @@ export class AssetServiceClient { * * `labels.env:*` to find Cloud resources that have a label "env". * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a * word. * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain @@ -2687,6 +2846,14 @@ export class AssetServiceClient { * * `labels.env:*` to find Cloud resources that have a label "env". * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a * word. * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain @@ -2862,6 +3029,14 @@ export class AssetServiceClient { * * `labels.env:*` to find Cloud resources that have a label "env". * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a * word. * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain @@ -3024,8 +3199,8 @@ export class AssetServiceClient { * compared against each Cloud IAM policy binding, including its principals, * roles, and Cloud IAM conditions. The returned Cloud IAM policies will only * contain the bindings that match your query. To learn more about the IAM - * policy structure, see [IAM policy - * doc](https://cloud.google.com/iam/docs/policies#structure). + * policy structure, see the [IAM policy + * documentation](https://cloud.google.com/iam/help/allow-policies/structure). * * Examples: * @@ -3212,8 +3387,8 @@ export class AssetServiceClient { * compared against each Cloud IAM policy binding, including its principals, * roles, and Cloud IAM conditions. The returned Cloud IAM policies will only * contain the bindings that match your query. To learn more about the IAM - * policy structure, see [IAM policy - * doc](https://cloud.google.com/iam/docs/policies#structure). + * policy structure, see the [IAM policy + * documentation](https://cloud.google.com/iam/help/allow-policies/structure). * * Examples: * @@ -3348,8 +3523,8 @@ export class AssetServiceClient { * compared against each Cloud IAM policy binding, including its principals, * roles, and Cloud IAM conditions. The returned Cloud IAM policies will only * contain the bindings that match your query. To learn more about the IAM - * policy structure, see [IAM policy - * doc](https://cloud.google.com/iam/docs/policies#structure). + * policy structure, see the [IAM policy + * documentation](https://cloud.google.com/iam/help/allow-policies/structure). * * Examples: * @@ -3691,6 +3866,183 @@ export class AssetServiceClient { callSettings ) as AsyncIterable; } + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. 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.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- diff --git a/packages/google-cloud-asset/src/v1/asset_service_client_config.json b/packages/google-cloud-asset/src/v1/asset_service_client_config.json index 9be8722e81e9..c74ddac1ee18 100644 --- a/packages/google-cloud-asset/src/v1/asset_service_client_config.json +++ b/packages/google-cloud-asset/src/v1/asset_service_client_config.json @@ -87,6 +87,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "QueryAssets": { + "timeout_millis": 200000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, "CreateSavedQuery": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" @@ -108,7 +113,8 @@ "retry_params_name": "default" }, "BatchGetEffectiveIamPolicies": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 300000, + "retry_codes_name": "unavailable", "retry_params_name": "default" } } diff --git a/packages/google-cloud-asset/src/v1/gapic_metadata.json b/packages/google-cloud-asset/src/v1/gapic_metadata.json index 1aceb2f63ab5..452c8a6e6af6 100644 --- a/packages/google-cloud-asset/src/v1/gapic_metadata.json +++ b/packages/google-cloud-asset/src/v1/gapic_metadata.json @@ -50,6 +50,11 @@ "analyzeMove" ] }, + "QueryAssets": { + "methods": [ + "queryAssets" + ] + }, "CreateSavedQuery": { "methods": [ "createSavedQuery" @@ -158,6 +163,11 @@ "analyzeMove" ] }, + "QueryAssets": { + "methods": [ + "queryAssets" + ] + }, "CreateSavedQuery": { "methods": [ "createSavedQuery" diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1.ts index 5fd697ad2ce0..56132b55739b 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1.ts @@ -1257,6 +1257,132 @@ describe('v1.AssetServiceClient', () => { }); }); + describe('queryAssets', () => { + it('invokes queryAssets 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.QueryAssetsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.QueryAssetsResponse() + ); + client.innerApiCalls.queryAssets = stubSimpleCall(expectedResponse); + const [response] = await client.queryAssets(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes queryAssets 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.QueryAssetsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.QueryAssetsResponse() + ); + client.innerApiCalls.queryAssets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.queryAssets( + request, + ( + err?: Error | null, + result?: protos.google.cloud.asset.v1.IQueryAssetsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes queryAssets 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.QueryAssetsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.queryAssets = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.queryAssets(request), expectedError); + assert( + (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes queryAssets with closed client', 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.QueryAssetsRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.queryAssets(request), expectedError); + }); + }); + describe('createSavedQuery', () => { it('invokes createSavedQuery without error', async () => { const client = new assetserviceModule.v1.AssetServiceClient({ @@ -3471,6 +3597,311 @@ describe('v1.AssetServiceClient', () => { ); }); }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); describe('Path templates', () => { describe('accessLevel', () => {