Skip to content

Commit

Permalink
chore: migrate notebooks to the PHP microgenerator
Browse files Browse the repository at this point in the history
Committer: @miraleung
PiperOrigin-RevId: 365159240
  • Loading branch information
Google APIs authored and Copybara-Service committed Mar 26, 2021
1 parent bf845b2 commit cbf8e95
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 66 deletions.
15 changes: 7 additions & 8 deletions google/cloud/notebooks/v1beta1/BUILD.bazel
Expand Up @@ -175,13 +175,14 @@ py_gapic_assembly_pkg(

##############################################################################
# PHP
# DO NOT OVERRIDE this PHP microgenerator section with autogenerated rules.
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_gapic_assembly_pkg",
"php_gapic_library",
"php_grpc_library",
"php_proto_library",
php_gapic_assembly_pkg = "php_gapic_assembly_pkg2",
php_gapic_library = "php_gapic_library2",
php_grpc_library = "php_grpc_library2",
php_proto_library = "php_proto_library2",
)

php_proto_library(
Expand All @@ -197,10 +198,8 @@ php_grpc_library(

php_gapic_library(
name = "notebooks_php_gapic",
src = ":notebooks_proto_with_info",
gapic_yaml = "notebooks_gapic.yaml",
srcs = [":notebooks_proto_with_info"],
grpc_service_config = "notebooks_grpc_service_config.json",
package = "google.cloud.notebooks.v1beta1",
service_yaml = "notebooks_v1beta1.yaml",
deps = [
":notebooks_php_grpc",
Expand Down Expand Up @@ -251,8 +250,8 @@ nodejs_gapic_assembly_pkg(
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_gapic_assembly_pkg",
"ruby_cloud_gapic_library",
"ruby_gapic_assembly_pkg",
"ruby_grpc_library",
"ruby_proto_library",
)
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/notebooks/v1beta1/environment.proto
Expand Up @@ -23,7 +23,7 @@ import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1;notebooks";
option csharp_namespace = "Google.Cloud.Notebooks.V1Beta1";
option php_namespace = "Google\\Cloud\\Notebooks\\V1Beta1";
option php_namespace = "Google\\Cloud\\Notebooks\\V1beta1";
option ruby_package = "Google::Cloud::Notebooks::V1beta1";
option java_multiple_files = true;
option java_outer_classname = "EnvironmentProto";
Expand Down
57 changes: 33 additions & 24 deletions google/cloud/notebooks/v1beta1/instance.proto
Expand Up @@ -165,15 +165,18 @@ message Instance {
// Cloud Storage path (`gs://path-to-file/file-name`).
string post_startup_script = 4;

// Output only. The proxy endpoint that is used to access the Jupyter notebook.
// Output only. The proxy endpoint that is used to access the Jupyter
// notebook.
string proxy_uri = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

// Input only. The owner of this instance after creation. Format: `alias@example.com`
// Input only. The owner of this instance after creation. Format:
// `alias@example.com`
//
// Currently supports one owner only. If not specified, all of the service
// account users of your VM instance's service account can use
// the instance.
repeated string instance_owners = 6 [(google.api.field_behavior) = INPUT_ONLY];
repeated string instance_owners = 6
[(google.api.field_behavior) = INPUT_ONLY];

// The service account on this instance, giving access to other Google
// Cloud services.
Expand All @@ -185,7 +188,8 @@ message Instance {
// is used.
string service_account = 7;

// Required. The [Compute Engine machine type](https://cloud.google.com/compute/docs/machine-types) of this
// Required. The [Compute Engine machine
// type](https://cloud.google.com/compute/docs/machine-types) of this
// instance.
string machine_type = 8 [(google.api.field_behavior) = REQUIRED];

Expand All @@ -208,37 +212,40 @@ message Instance {
// If not specified, we'll automatically choose from official GPU drivers.
string custom_gpu_driver_path = 12;

// Input only. The type of the boot disk attached to this instance, defaults to
// standard persistent disk (`PD_STANDARD`).
// Input only. The type of the boot disk attached to this instance, defaults
// to standard persistent disk (`PD_STANDARD`).
DiskType boot_disk_type = 13 [(google.api.field_behavior) = INPUT_ONLY];

// Input only. The size of the boot disk in GB attached to this instance, up to a maximum
// of 64000 GB (64 TB). The minimum recommended value is
// 100 GB. If not specified, this defaults to 100.
// Input only. The size of the boot disk in GB attached to this instance, up
// to a maximum of 64000 GB (64 TB). The minimum recommended value
// is 100 GB. If not specified, this defaults to 100.
int64 boot_disk_size_gb = 14 [(google.api.field_behavior) = INPUT_ONLY];

// Input only. The type of the data disk attached to this instance, defaults to
// standard persistent disk (`PD_STANDARD`).
// Input only. The type of the data disk attached to this instance, defaults
// to standard persistent disk (`PD_STANDARD`).
DiskType data_disk_type = 25 [(google.api.field_behavior) = INPUT_ONLY];

// Input only. The size of the data disk in GB attached to this instance, up to a maximum
// of 64000 GB (64 TB). You can choose the size of the data disk
// based on how big your notebooks and data are. If not specified, this
// defaults to 100.
// Input only. The size of the data disk in GB attached to this instance, up
// to a maximum of 64000 GB (64 TB). You can choose the size of the
// data disk based on how big your notebooks and data are. If not specified,
// this defaults to 100.
int64 data_disk_size_gb = 26 [(google.api.field_behavior) = INPUT_ONLY];

// Input only. If true, the data disk will not be auto deleted when deleting the instance.
// Input only. If true, the data disk will not be auto deleted when deleting
// the instance.
bool no_remove_data_disk = 27 [(google.api.field_behavior) = INPUT_ONLY];

// Input only. Disk encryption method used on the boot and data disks, defaults to GMEK.
DiskEncryption disk_encryption = 15 [(google.api.field_behavior) = INPUT_ONLY];
// Input only. Disk encryption method used on the boot and data disks,
// defaults to GMEK.
DiskEncryption disk_encryption = 15
[(google.api.field_behavior) = INPUT_ONLY];

// Input only. The KMS key used to encrypt the disks, only applicable if disk_encryption
// is CMEK.
// Format:
// Input only. The KMS key used to encrypt the disks, only applicable if
// disk_encryption is CMEK. Format:
// `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}`
//
// Learn more about [using your own encryption keys]( https://cloud.google.com/kms/docs/quickstart).
// Learn more about [using your own encryption keys](
// https://cloud.google.com/kms/docs/quickstart).
string kms_key = 16 [(google.api.field_behavior) = INPUT_ONLY];

// If true, no public IP will be assigned to this instance.
Expand All @@ -265,8 +272,10 @@ message Instance {
map<string, string> metadata = 22;

// Output only. Instance creation time.
google.protobuf.Timestamp create_time = 23 [(google.api.field_behavior) = OUTPUT_ONLY];
google.protobuf.Timestamp create_time = 23
[(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Instance update time.
google.protobuf.Timestamp update_time = 24 [(google.api.field_behavior) = OUTPUT_ONLY];
google.protobuf.Timestamp update_time = 24
[(google.api.field_behavior) = OUTPUT_ONLY];
}
8 changes: 0 additions & 8 deletions google/cloud/notebooks/v1beta1/notebooks_gapic.yaml

This file was deleted.

67 changes: 42 additions & 25 deletions google/cloud/notebooks/v1beta1/service.proto
Expand Up @@ -35,7 +35,8 @@ option java_package = "com.google.cloud.notebooks.v1beta1";
// API v1beta1 service for Cloud AI Platform Notebooks.
service NotebookService {
option (google.api.default_host) = "notebooks.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";

// Lists instances in a given project and location.
rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) {
Expand All @@ -52,7 +53,8 @@ service NotebookService {
}

// Creates a new Instance in a given project and location.
rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) {
rpc CreateInstance(CreateInstanceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/locations/*}/instances"
body: "instance"
Expand All @@ -67,7 +69,8 @@ service NotebookService {
// Legacy instances are instances created with the legacy Compute Engine
// calls. They are not manageable by the Notebooks API out of the box. This
// call makes these instances manageable by the Notebooks API.
rpc RegisterInstance(RegisterInstanceRequest) returns (google.longrunning.Operation) {
rpc RegisterInstance(RegisterInstanceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/locations/*}/instances:register"
body: "*"
Expand All @@ -79,7 +82,8 @@ service NotebookService {
}

// Updates the guest accelerators of a single Instance.
rpc SetInstanceAccelerator(SetInstanceAcceleratorRequest) returns (google.longrunning.Operation) {
rpc SetInstanceAccelerator(SetInstanceAcceleratorRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setAccelerator"
body: "*"
Expand All @@ -91,7 +95,8 @@ service NotebookService {
}

// Updates the machine type of a single Instance.
rpc SetInstanceMachineType(SetInstanceMachineTypeRequest) returns (google.longrunning.Operation) {
rpc SetInstanceMachineType(SetInstanceMachineTypeRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setMachineType"
body: "*"
Expand All @@ -103,7 +108,8 @@ service NotebookService {
}

// Updates the labels of an Instance.
rpc SetInstanceLabels(SetInstanceLabelsRequest) returns (google.longrunning.Operation) {
rpc SetInstanceLabels(SetInstanceLabelsRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1beta1/{name=projects/*/locations/*/instances/*}:setLabels"
body: "*"
Expand All @@ -115,7 +121,8 @@ service NotebookService {
}

// Deletes a single Instance.
rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) {
rpc DeleteInstance(DeleteInstanceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/locations/*/instances/*}"
};
Expand All @@ -126,7 +133,8 @@ service NotebookService {
}

// Starts a notebook instance.
rpc StartInstance(StartInstanceRequest) returns (google.longrunning.Operation) {
rpc StartInstance(StartInstanceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/locations/*/instances/*}:start"
body: "*"
Expand All @@ -150,7 +158,8 @@ service NotebookService {
}

// Resets a notebook instance.
rpc ResetInstance(ResetInstanceRequest) returns (google.longrunning.Operation) {
rpc ResetInstance(ResetInstanceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/locations/*/instances/*}:reset"
body: "*"
Expand All @@ -165,7 +174,8 @@ service NotebookService {
// report their latest instance information to the Notebooks
// API server. The server will merge the reported information to
// the instance metadata store. Do not use this method directly.
rpc ReportInstanceInfo(ReportInstanceInfoRequest) returns (google.longrunning.Operation) {
rpc ReportInstanceInfo(ReportInstanceInfoRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/locations/*/instances/*}:report"
body: "*"
Expand All @@ -177,14 +187,16 @@ service NotebookService {
}

// Check if a notebook instance is upgradable.
rpc IsInstanceUpgradeable(IsInstanceUpgradeableRequest) returns (IsInstanceUpgradeableResponse) {
rpc IsInstanceUpgradeable(IsInstanceUpgradeableRequest)
returns (IsInstanceUpgradeableResponse) {
option (google.api.http) = {
get: "/v1beta1/{notebook_instance=projects/*/locations/*/instances/*}:isUpgradeable"
};
}

// Upgrades a notebook instance to the latest version.
rpc UpgradeInstance(UpgradeInstanceRequest) returns (google.longrunning.Operation) {
rpc UpgradeInstance(UpgradeInstanceRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/locations/*/instances/*}:upgrade"
body: "*"
Expand All @@ -197,7 +209,8 @@ service NotebookService {

// Allows notebook instances to
// call this endpoint to upgrade themselves. Do not use this method directly.
rpc UpgradeInstanceInternal(UpgradeInstanceInternalRequest) returns (google.longrunning.Operation) {
rpc UpgradeInstanceInternal(UpgradeInstanceInternalRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/locations/*/instances/*}:upgradeInternal"
body: "*"
Expand All @@ -209,7 +222,8 @@ service NotebookService {
}

// Lists environments in a project.
rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) {
rpc ListEnvironments(ListEnvironmentsRequest)
returns (ListEnvironmentsResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=projects/*/locations/*}/environments"
};
Expand All @@ -223,7 +237,8 @@ service NotebookService {
}

// Creates a new Environment.
rpc CreateEnvironment(CreateEnvironmentRequest) returns (google.longrunning.Operation) {
rpc CreateEnvironment(CreateEnvironmentRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/locations/*}/environments"
body: "environment"
Expand All @@ -235,7 +250,8 @@ service NotebookService {
}

// Deletes a single Environment.
rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.longrunning.Operation) {
rpc DeleteEnvironment(DeleteEnvironmentRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/locations/*/environments/*}"
};
Expand Down Expand Up @@ -266,7 +282,8 @@ message OperationMetadata {
// Identifies whether the user has requested cancellation
// of the operation. Operations that have successfully been cancelled
// have [Operation.error][] value with a
// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to `Code.CANCELLED`.
// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
// `Code.CANCELLED`.
bool requested_cancellation = 6;

// API version used to start the operation.
Expand Down Expand Up @@ -347,10 +364,10 @@ message SetInstanceAcceleratorRequest {
// Required. Type of this accelerator.
Instance.AcceleratorType type = 2 [(google.api.field_behavior) = REQUIRED];

// Required. Count of cores of this accelerator. Note that not all combinations
// of `type` and `core_count` are valid. Check [GPUs on
// Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to
// find a valid combination. TPUs are not supported.
// Required. Count of cores of this accelerator. Note that not all
// combinations of `type` and `core_count` are valid. Check [GPUs on Compute
// Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to find a
// valid combination. TPUs are not supported.
int64 core_count = 3 [(google.api.field_behavior) = REQUIRED];
}

Expand Down Expand Up @@ -495,10 +512,10 @@ message CreateEnvironmentRequest {
// Required. Format: `projects/{project_id}/locations/{location}`
string parent = 1 [(google.api.field_behavior) = REQUIRED];

// Required. User-defined unique ID of this environment. The `environment_id` must
// be 1 to 63 characters long and contain only lowercase letters,
// numeric characters, and dashes. The first character must be a lowercase
// letter and the last character cannot be a dash.
// Required. User-defined unique ID of this environment. The `environment_id`
// must be 1 to 63 characters long and contain only lowercase letters, numeric
// characters, and dashes. The first character must be a lowercase letter and
// the last character cannot be a dash.
string environment_id = 2 [(google.api.field_behavior) = REQUIRED];

// Required. The environment to be created.
Expand Down

0 comments on commit cbf8e95

Please sign in to comment.