Skip to content

Commit

Permalink
feat: added support for project id, order_by in SearchAllResources, s…
Browse files Browse the repository at this point in the history
…earch on location, labels and networkTags field
  • Loading branch information
yoshi-automation authored Apr 29, 2020
1 parent b418e7b commit c2c6e5f
Show file tree
Hide file tree
Showing 7 changed files with 905 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

Expand Down Expand Up @@ -68,6 +67,7 @@ message SearchAllResourcesRequest {
// * Organization number (such as "organizations/123")
// * Folder number(such as "folders/1234")
// * Project number (such as "projects/12345")
// * Project id (such as "projects/abc")
string scope = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. The query statement.
Expand All @@ -88,6 +88,12 @@ message SearchAllResourcesRequest {
// the previous response. The values of all other method parameters, must be
// identical to those in the previous call.
string page_token = 5 [(google.api.field_behavior) = OPTIONAL];

// Optional. A comma separated list of fields specifying the sorting order of the
// results. The default order is ascending. Add " desc" after the field name
// to indicate descending order. Redundant space characters are ignored. For
// example, " foo , bar desc ".
string order_by = 10 [(google.api.field_behavior) = OPTIONAL];
}

// Search all resources response.
Expand All @@ -108,6 +114,7 @@ message SearchAllIamPoliciesRequest {
// * Organization number (such as "organizations/123")
// * Folder number(such as "folders/1234")
// * Project number (such as "projects/12345")
// * Project id (such as "projects/abc")
string scope = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. The query statement.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC.
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

Expand Down Expand Up @@ -56,10 +55,35 @@ message StandardResourceMetadata {
// Informational only. The exact set of attributes is subject to change.
// For example: project id, DNS name etc.
repeated string additional_attributes = 10;

// Location can be "global", regional like "us-east1", or zonal like
// "us-west1-b".
string location = 11;

// Labels associated with this resource. See [Labelling and grouping GCP
// resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
// for more information.
map<string, string> labels = 12;

// Network tags associated with this resource. Like labels, network tags are a
// type of annotations used to group GCP resources. See [Labelling GCP
// resources](lhttps://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
// for more information.
repeated string network_tags = 13;
}

// The result for a IAM Policy search.
message IamPolicySearchResult {
// Explanation about the IAM policy search result.
message Explanation {
// The map from roles to their included permission matching the permission
// query (e.g. containing `policy.role.permissions:`). A sample role string:
// "roles/compute.instanceAdmin". The roles can also be found in the
// returned `policy` bindings. Note that the map is populated only if
// requesting with a permission query.
map<string, Permissions> matched_permissions = 1;
}

// The [full resource
// name](https://cloud.google.com/apis/design/resource_names#full_resource_name)
// of the resource associated with this IAM policy.
Expand All @@ -72,7 +96,19 @@ message IamPolicySearchResult {
// orgnization, the project field will be empty.
string project = 3;

// Representation of the actual Cloud IAM policy set on a cloud resource. For
// each resource, there must be at most one Cloud IAM policy set on it.
// The IAM policy directly set on the given resource. Note that the original
// IAM policy can contain multiple bindings. This only contains the bindings
// that match the given query. For queries that don't contain a constrain on
// policies (e.g. an empty query), this contains all the bindings.
google.iam.v1.Policy policy = 4;

// Explanation about the IAM policy search result. It contains additional
// information to explain why the search result matches the query.
Explanation explanation = 5;
}

// IAM permissions
message Permissions {
// A list of permissions. A sample permission string: "compute.disk.get".
repeated string permissions = 1;
}
213 changes: 213 additions & 0 deletions packages/google-cloud-asset/protos/protos.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3418,6 +3418,9 @@ export namespace google {

/** SearchAllResourcesRequest pageToken */
pageToken?: (string|null);

/** SearchAllResourcesRequest orderBy */
orderBy?: (string|null);
}

/** Represents a SearchAllResourcesRequest. */
Expand All @@ -3444,6 +3447,9 @@ export namespace google {
/** SearchAllResourcesRequest pageToken. */
public pageToken: string;

/** SearchAllResourcesRequest orderBy. */
public orderBy: string;

/**
* Creates a new SearchAllResourcesRequest instance using the specified properties.
* @param [properties] Properties to set
Expand Down Expand Up @@ -3835,6 +3841,15 @@ export namespace google {

/** StandardResourceMetadata additionalAttributes */
additionalAttributes?: (string[]|null);

/** StandardResourceMetadata location */
location?: (string|null);

/** StandardResourceMetadata labels */
labels?: ({ [k: string]: string }|null);

/** StandardResourceMetadata networkTags */
networkTags?: (string[]|null);
}

/** Represents a StandardResourceMetadata. */
Expand Down Expand Up @@ -3864,6 +3879,15 @@ export namespace google {
/** StandardResourceMetadata additionalAttributes. */
public additionalAttributes: string[];

/** StandardResourceMetadata location. */
public location: string;

/** StandardResourceMetadata labels. */
public labels: { [k: string]: string };

/** StandardResourceMetadata networkTags. */
public networkTags: string[];

/**
* Creates a new StandardResourceMetadata instance using the specified properties.
* @param [properties] Properties to set
Expand Down Expand Up @@ -3946,6 +3970,9 @@ export namespace google {

/** IamPolicySearchResult policy */
policy?: (google.iam.v1.IPolicy|null);

/** IamPolicySearchResult explanation */
explanation?: (google.cloud.asset.v1p1beta1.IamPolicySearchResult.IExplanation|null);
}

/** Represents an IamPolicySearchResult. */
Expand All @@ -3966,6 +3993,9 @@ export namespace google {
/** IamPolicySearchResult policy. */
public policy?: (google.iam.v1.IPolicy|null);

/** IamPolicySearchResult explanation. */
public explanation?: (google.cloud.asset.v1p1beta1.IamPolicySearchResult.IExplanation|null);

/**
* Creates a new IamPolicySearchResult instance using the specified properties.
* @param [properties] Properties to set
Expand Down Expand Up @@ -4036,6 +4066,189 @@ export namespace google {
*/
public toJSON(): { [k: string]: any };
}

namespace IamPolicySearchResult {

/** Properties of an Explanation. */
interface IExplanation {

/** Explanation matchedPermissions */
matchedPermissions?: ({ [k: string]: google.cloud.asset.v1p1beta1.IPermissions }|null);
}

/** Represents an Explanation. */
class Explanation implements IExplanation {

/**
* Constructs a new Explanation.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.asset.v1p1beta1.IamPolicySearchResult.IExplanation);

/** Explanation matchedPermissions. */
public matchedPermissions: { [k: string]: google.cloud.asset.v1p1beta1.IPermissions };

/**
* Creates a new Explanation instance using the specified properties.
* @param [properties] Properties to set
* @returns Explanation instance
*/
public static create(properties?: google.cloud.asset.v1p1beta1.IamPolicySearchResult.IExplanation): google.cloud.asset.v1p1beta1.IamPolicySearchResult.Explanation;

/**
* Encodes the specified Explanation message. Does not implicitly {@link google.cloud.asset.v1p1beta1.IamPolicySearchResult.Explanation.verify|verify} messages.
* @param message Explanation message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.asset.v1p1beta1.IamPolicySearchResult.IExplanation, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Encodes the specified Explanation message, length delimited. Does not implicitly {@link google.cloud.asset.v1p1beta1.IamPolicySearchResult.Explanation.verify|verify} messages.
* @param message Explanation message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.asset.v1p1beta1.IamPolicySearchResult.IExplanation, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Decodes an Explanation message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Explanation
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1p1beta1.IamPolicySearchResult.Explanation;

/**
* Decodes an Explanation message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Explanation
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1p1beta1.IamPolicySearchResult.Explanation;

/**
* Verifies an Explanation message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);

/**
* Creates an Explanation message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Explanation
*/
public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1p1beta1.IamPolicySearchResult.Explanation;

/**
* Creates a plain object from an Explanation message. Also converts values to other types if specified.
* @param message Explanation
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.asset.v1p1beta1.IamPolicySearchResult.Explanation, options?: $protobuf.IConversionOptions): { [k: string]: any };

/**
* Converts this Explanation to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
}

/** Properties of a Permissions. */
interface IPermissions {

/** Permissions permissions */
permissions?: (string[]|null);
}

/** Represents a Permissions. */
class Permissions implements IPermissions {

/**
* Constructs a new Permissions.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.asset.v1p1beta1.IPermissions);

/** Permissions permissions. */
public permissions: string[];

/**
* Creates a new Permissions instance using the specified properties.
* @param [properties] Properties to set
* @returns Permissions instance
*/
public static create(properties?: google.cloud.asset.v1p1beta1.IPermissions): google.cloud.asset.v1p1beta1.Permissions;

/**
* Encodes the specified Permissions message. Does not implicitly {@link google.cloud.asset.v1p1beta1.Permissions.verify|verify} messages.
* @param message Permissions message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.asset.v1p1beta1.IPermissions, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Encodes the specified Permissions message, length delimited. Does not implicitly {@link google.cloud.asset.v1p1beta1.Permissions.verify|verify} messages.
* @param message Permissions message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.asset.v1p1beta1.IPermissions, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Decodes a Permissions message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Permissions
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.asset.v1p1beta1.Permissions;

/**
* Decodes a Permissions message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Permissions
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.asset.v1p1beta1.Permissions;

/**
* Verifies a Permissions message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);

/**
* Creates a Permissions message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Permissions
*/
public static fromObject(object: { [k: string]: any }): google.cloud.asset.v1p1beta1.Permissions;

/**
* Creates a plain object from a Permissions message. Also converts values to other types if specified.
* @param message Permissions
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.asset.v1p1beta1.Permissions, options?: $protobuf.IConversionOptions): { [k: string]: any };

/**
* Converts this Permissions to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
}

/** Namespace v1p2beta1. */
Expand Down
Loading

0 comments on commit c2c6e5f

Please sign in to comment.