Skip to content

Commit

Permalink
feat: add v1p5beta1 API surface (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Jun 26, 2020
1 parent a68327e commit 128081a
Show file tree
Hide file tree
Showing 13 changed files with 3,557 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// 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.
// You may obtain a copy of the License at
//
// http://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.

syntax = "proto3";

package google.cloud.asset.v1p5beta1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/cloud/asset/v1p5beta1/assets.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Asset.V1P5Beta1";
option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1;asset";
option java_multiple_files = true;
option java_outer_classname = "AssetServiceProto";
option java_package = "com.google.cloud.asset.v1p5beta1";
option php_namespace = "Google\\Cloud\\Asset\\V1p5beta1";

// Asset service definition.
service AssetService {
option (google.api.default_host) = "cloudasset.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";

// Lists assets with time and resource types and returns paged results in
// response.
rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) {
option (google.api.http) = {
get: "/v1p5beta1/{parent=*/*}/assets"
};
}
}

// ListAssets request.
message ListAssetsRequest {
// Required. Name of the organization or project the assets belong to. Format:
// "organizations/[organization-number]" (such as "organizations/123"),
// "projects/[project-number]" (such as "projects/my-project-id"), or
// "projects/[project-id]" (such as "projects/12345").
string parent = 1 [(google.api.field_behavior) = REQUIRED];

// Timestamp to take an asset snapshot. This can only be set to a timestamp
// between 2018-10-02 UTC (inclusive) and the current time. If not specified,
// the current time will be used. Due to delays in resource data collection
// and indexing, there is a volatile window during which running the same
// query may get different results.
google.protobuf.Timestamp read_time = 2;

// A list of asset types of which to take a snapshot for. For example:
// "compute.googleapis.com/Disk". If specified, only matching assets will be
// returned. See [Introduction to Cloud Asset
// Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview)
// for all supported asset types.
repeated string asset_types = 3;

// Asset content type. If not specified, no content but the asset name will
// be returned.
ContentType content_type = 4;

// The maximum number of assets to be returned in a single response. Default
// is 100, minimum is 1, and maximum is 1000.
int32 page_size = 5;

// The `next_page_token` returned from the previous `ListAssetsResponse`, or
// unspecified for the first `ListAssetsRequest`. It is a continuation of a
// prior `ListAssets` call, and the API should return the next page of assets.
string page_token = 6;
}

// 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 mananger Policy set on an asset.
ACCESS_POLICY = 5;
}

// ListAssets response.
message ListAssetsResponse {
// Time the snapshot was taken.
google.protobuf.Timestamp read_time = 1;

// Assets.
repeated Asset assets = 2;

// Token to retrieve the next page of results. Set to empty if there are no
// remaining results.
string next_page_token = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// 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.
// You may obtain a copy of the License at
//
// http://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.

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";
option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1;asset";
option java_multiple_files = true;
option java_outer_classname = "AssetProto";
option java_package = "com.google.cloud.asset.v1p5beta1";
option php_namespace = "Google\\Cloud\\Asset\\V1p5beta1";

// Cloud asset. This includes all Google Cloud Platform resources,
// Cloud IAM policies, and other non-GCP assets.
message Asset {
option (google.api.resource) = {
type: "cloudasset.googleapis.com/Asset"
pattern: "*"
};

// The full name of the asset. For example:
// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
// See [Resource
// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
// for more information.
string name = 1;

// Type of the asset. Example: "compute.googleapis.com/Disk".
string asset_type = 2;

// Representation of the resource.
Resource resource = 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.
google.iam.v1.Policy iam_policy = 4;

// Representation of the Cloud Organization Policy set on an asset. For each
// asset, there could be multiple Organization policies with different
// constraints.
repeated google.cloud.orgpolicy.v1.Policy org_policy = 6;

// Representation of the Cloud Organization access policy.
oneof access_context_policy {
google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7;

google.identity.accesscontextmanager.v1.AccessLevel access_level = 8;

google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter =
9;
}

// Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy,
// represented as a list of relative resource names. Ancestry path starts with
// the closest CRM ancestor and ends at root. If the asset is a CRM
// project/folder/organization, this starts from the asset itself.
//
// Example: ["projects/123456789", "folders/5432", "organizations/1234"]
repeated string ancestors = 10;
}

// Representation of a cloud resource.
message Resource {
// The API version. Example: "v1".
string version = 1;

// The URL of the discovery document containing the resource's JSON schema.
// For example:
// `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`.
// It will be left unspecified for resources without a discovery-based API,
// such as Cloud Bigtable.
string discovery_document_uri = 2;

// The JSON schema name listed in the discovery document.
// Example: "Project". It will be left unspecified for resources (such as
// Cloud Bigtable) without a discovery-based API.
string discovery_name = 3;

// The REST URL for accessing the resource. An HTTP GET operation using this
// URL returns the resource itself.
// Example:
// `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
// It will be left unspecified for resources without a REST API.
string resource_url = 4;

// The full name of the immediate parent of this resource. See
// [Resource
// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
// for more information.
//
// For GCP assets, it is the parent resource defined in the [Cloud IAM policy
// hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy).
// For example:
// `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`.
//
// For third-party assets, it is up to the users to define.
string parent = 5;

// The content of the resource, in which some sensitive fields are scrubbed
// away and may not be present.
google.protobuf.Struct data = 6;
}
Loading

0 comments on commit 128081a

Please sign in to comment.