Skip to content

Commit

Permalink
feat(notebooks): update the API
Browse files Browse the repository at this point in the history
#### notebooks:v1

The following keys were added:
- resources.projects.resources.locations.resources.instances.methods.rollback.description
- resources.projects.resources.locations.resources.instances.methods.rollback.flatPath
- resources.projects.resources.locations.resources.instances.methods.rollback.httpMethod
- resources.projects.resources.locations.resources.instances.methods.rollback.id
- resources.projects.resources.locations.resources.instances.methods.rollback.parameterOrder
- resources.projects.resources.locations.resources.instances.methods.rollback.parameters.name.description
- resources.projects.resources.locations.resources.instances.methods.rollback.parameters.name.location
- resources.projects.resources.locations.resources.instances.methods.rollback.parameters.name.pattern
- resources.projects.resources.locations.resources.instances.methods.rollback.parameters.name.required
- resources.projects.resources.locations.resources.instances.methods.rollback.parameters.name.type
- resources.projects.resources.locations.resources.instances.methods.rollback.path
- resources.projects.resources.locations.resources.instances.methods.rollback.request.$ref
- resources.projects.resources.locations.resources.instances.methods.rollback.response.$ref
- resources.projects.resources.locations.resources.instances.methods.rollback.scopes
- schemas.ExecutionTemplate.properties.serviceAccount.description
- schemas.ExecutionTemplate.properties.serviceAccount.type
- schemas.Instance.properties.nicType.description
- schemas.Instance.properties.nicType.enum
- schemas.Instance.properties.nicType.enumDescriptions
- schemas.Instance.properties.nicType.type
- schemas.RollbackInstanceRequest.description
- schemas.RollbackInstanceRequest.id
- schemas.RollbackInstanceRequest.properties.targetSnapshot.description
- schemas.RollbackInstanceRequest.properties.targetSnapshot.type
- schemas.RollbackInstanceRequest.type
- schemas.VirtualMachineConfig.properties.nicType.description
- schemas.VirtualMachineConfig.properties.nicType.enum
- schemas.VirtualMachineConfig.properties.nicType.enumDescriptions
- schemas.VirtualMachineConfig.properties.nicType.type
  • Loading branch information
yoshi-automation authored and sofisl committed Apr 20, 2021
1 parent 34379f2 commit f9689bb
Show file tree
Hide file tree
Showing 2 changed files with 248 additions and 1 deletion.
73 changes: 72 additions & 1 deletion discovery/notebooks-v1.json
Expand Up @@ -719,6 +719,34 @@
"https://www.googleapis.com/auth/cloud-platform"
]
},
"rollback": {
"description": "Rollbacks a notebook instance to the previous version.",
"flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:rollback",
"httpMethod": "POST",
"id": "notebooks.projects.locations.instances.rollback",
"parameterOrder": [
"name"
],
"parameters": {
"name": {
"description": "Required. Format: `projects/{project_id}/locations/{location}/instances/{instance_id}`",
"location": "path",
"pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
"required": true,
"type": "string"
}
},
"path": "v1/{+name}:rollback",
"request": {
"$ref": "RollbackInstanceRequest"
},
"response": {
"$ref": "Operation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
},
"setAccelerator": {
"description": "Updates the guest accelerators of a single Instance.",
"flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:setAccelerator",
Expand Down Expand Up @@ -1525,7 +1553,7 @@
}
}
},
"revision": "20210323",
"revision": "20210406",
"rootUrl": "https://notebooks.googleapis.com/",
"schemas": {
"AcceleratorConfig": {
Expand Down Expand Up @@ -1859,6 +1887,10 @@
"The CUSTOM tier is not a set tier, but rather enables you to use your own cluster specification. When you use this tier, set values to configure your processing cluster according to these guidelines: * You _must_ set `TrainingInput.masterType` to specify the type of machine to use for your master node. This is the only required setting. * You _may_ set `TrainingInput.workerCount` to specify the number of workers to use. If you specify one or more workers, you _must_ also set `TrainingInput.workerType` to specify the type of machine to use for your worker nodes. * You _may_ set `TrainingInput.parameterServerCount` to specify the number of parameter servers to use. If you specify one or more parameter servers, you _must_ also set `TrainingInput.parameterServerType` to specify the type of machine to use for your parameter servers. Note that all of your workers must use the same machine type, which can be different from your parameter server type and master type. Your parameter servers must likewise use the same machine type, which can be different from your worker type and master type."
],
"type": "string"
},
"serviceAccount": {
"description": "The email address of a service account to use when running the execution. You must have the `iam.serviceAccounts.actAs` permission for the specified service account.",
"type": "string"
}
},
"type": "object"
Expand Down Expand Up @@ -2059,6 +2091,20 @@
"description": "The name of the VPC that this instance is in. Format: `projects/{project_id}/global/networks/{network_id}`",
"type": "string"
},
"nicType": {
"description": "Optional. The type of vNIC to be used on this interface. This may be gVNIC or VirtioNet.",
"enum": [
"UNSPECIFIED_NIC_TYPE",
"VIRTIO_NET",
"GVNIC"
],
"enumDescriptions": [
"No type specified.",
"VIRTIO",
"GVNIC"
],
"type": "string"
},
"noProxyAccess": {
"description": "If true, the notebook instance will not register with the proxy.",
"type": "boolean"
Expand Down Expand Up @@ -2626,6 +2672,17 @@
"properties": {},
"type": "object"
},
"RollbackInstanceRequest": {
"description": "Request for rollbacking a notebook instance",
"id": "RollbackInstanceRequest",
"properties": {
"targetSnapshot": {
"description": "Required. The snapshot for rollback. Example: \"projects/test-project/global/snapshots/krwlzipynril\".",
"type": "string"
}
},
"type": "object"
},
"Runtime": {
"description": "The definition of a Runtime for a managed notebook instance.",
"id": "Runtime",
Expand Down Expand Up @@ -3343,6 +3400,20 @@
"description": "Optional. The Compute Engine network to be used for machine communications. Cannot be specified with subnetwork. If neither `network` nor `subnet` is specified, the \"default\" network of the project is used, if it exists. A full URL or partial URI. Examples: * `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/global/default` * `projects/[project_id]/regions/global/default` Runtimes are managed resources inside Google Infrastructure. Runtimes support the following network configurations: * Google Managed Network (Network & subnet are empty) * Consumer Project VPC (network & subnet are required). Requires configuring Private Service Access. * Shared VPC (network & subnet are required). Requires configuring Private Service Access.",
"type": "string"
},
"nicType": {
"description": "Optional. The type of vNIC to be used on this interface. This may be gVNIC or VirtioNet.",
"enum": [
"UNSPECIFIED_NIC_TYPE",
"VIRTIO_NET",
"GVNIC"
],
"enumDescriptions": [
"No type specified.",
"VIRTIO",
"GVNIC"
],
"type": "string"
},
"shieldedInstanceConfig": {
"$ref": "RuntimeShieldedInstanceConfig",
"description": "Optional. Shielded VM Instance configuration settings."
Expand Down
176 changes: 176 additions & 0 deletions src/apis/notebooks/v1.ts
Expand Up @@ -348,6 +348,10 @@ export namespace notebooks_v1 {
* Required. Scale tier of the hardware used for notebook execution.
*/
scaleTier?: string | null;
/**
* The email address of a service account to use when running the execution. You must have the `iam.serviceAccounts.actAs` permission for the specified service account.
*/
serviceAccount?: string | null;
}
/**
* Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
Expand Down Expand Up @@ -468,6 +472,10 @@ export namespace notebooks_v1 {
* The name of the VPC that this instance is in. Format: `projects/{project_id\}/global/networks/{network_id\}`
*/
network?: string | null;
/**
* Optional. The type of vNIC to be used on this interface. This may be gVNIC or VirtioNet.
*/
nicType?: string | null;
/**
* If true, the notebook instance will not register with the proxy.
*/
Expand Down Expand Up @@ -869,6 +877,15 @@ export namespace notebooks_v1 {
* Request for reseting a Managed Notebook Runtime.
*/
export interface Schema$ResetRuntimeRequest {}
/**
* Request for rollbacking a notebook instance
*/
export interface Schema$RollbackInstanceRequest {
/**
* Required. The snapshot for rollback. Example: "projects/test-project/global/snapshots/krwlzipynril".
*/
targetSnapshot?: string | null;
}
/**
* The definition of a Runtime for a managed notebook instance.
*/
Expand Down Expand Up @@ -1316,6 +1333,10 @@ export namespace notebooks_v1 {
* Optional. The Compute Engine network to be used for machine communications. Cannot be specified with subnetwork. If neither `network` nor `subnet` is specified, the "default" network of the project is used, if it exists. A full URL or partial URI. Examples: * `https://www.googleapis.com/compute/v1/projects/[project_id]/regions/global/default` * `projects/[project_id]/regions/global/default` Runtimes are managed resources inside Google Infrastructure. Runtimes support the following network configurations: * Google Managed Network (Network & subnet are empty) * Consumer Project VPC (network & subnet are required). Requires configuring Private Service Access. * Shared VPC (network & subnet are required). Requires configuring Private Service Access.
*/
network?: string | null;
/**
* Optional. The type of vNIC to be used on this interface. This may be gVNIC or VirtioNet.
*/
nicType?: string | null;
/**
* Optional. Shielded VM Instance configuration settings.
*/
Expand Down Expand Up @@ -2967,6 +2988,7 @@ export namespace notebooks_v1 {
* // "metadata": {},
* // "name": "my_name",
* // "network": "my_network",
* // "nicType": "my_nicType",
* // "noProxyAccess": false,
* // "noPublicIp": false,
* // "noRemoveDataDisk": false,
Expand Down Expand Up @@ -3269,6 +3291,7 @@ export namespace notebooks_v1 {
* // "metadata": {},
* // "name": "my_name",
* // "network": "my_network",
* // "nicType": "my_nicType",
* // "noProxyAccess": false,
* // "noPublicIp": false,
* // "noRemoveDataDisk": false,
Expand Down Expand Up @@ -4342,6 +4365,147 @@ export namespace notebooks_v1 {
}
}

/**
* Rollbacks a notebook instance to the previous version.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/notebooks.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const notebooks = google.notebooks('v1');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await notebooks.projects.locations.instances.rollback({
* // Required. Format: `projects/{project_id\}/locations/{location\}/instances/{instance_id\}`
* name: 'projects/my-project/locations/my-location/instances/my-instance',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {
* // "targetSnapshot": "my_targetSnapshot"
* // }
* },
* });
* console.log(res.data);
*
* // Example response
* // {
* // "done": false,
* // "error": {},
* // "metadata": {},
* // "name": "my_name",
* // "response": {}
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
rollback(
params: Params$Resource$Projects$Locations$Instances$Rollback,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
rollback(
params?: Params$Resource$Projects$Locations$Instances$Rollback,
options?: MethodOptions
): GaxiosPromise<Schema$Operation>;
rollback(
params: Params$Resource$Projects$Locations$Instances$Rollback,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
rollback(
params: Params$Resource$Projects$Locations$Instances$Rollback,
options: MethodOptions | BodyResponseCallback<Schema$Operation>,
callback: BodyResponseCallback<Schema$Operation>
): void;
rollback(
params: Params$Resource$Projects$Locations$Instances$Rollback,
callback: BodyResponseCallback<Schema$Operation>
): void;
rollback(callback: BodyResponseCallback<Schema$Operation>): void;
rollback(
paramsOrCallback?:
| Params$Resource$Projects$Locations$Instances$Rollback
| BodyResponseCallback<Schema$Operation>
| BodyResponseCallback<Readable>,
optionsOrCallback?:
| MethodOptions
| StreamMethodOptions
| BodyResponseCallback<Schema$Operation>
| BodyResponseCallback<Readable>,
callback?:
| BodyResponseCallback<Schema$Operation>
| BodyResponseCallback<Readable>
): void | GaxiosPromise<Schema$Operation> | GaxiosPromise<Readable> {
let params = (paramsOrCallback ||
{}) as Params$Resource$Projects$Locations$Instances$Rollback;
let options = (optionsOrCallback || {}) as MethodOptions;

if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Projects$Locations$Instances$Rollback;
options = {};
}

if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}

const rootUrl = options.rootUrl || 'https://notebooks.googleapis.com/';
const parameters = {
options: Object.assign(
{
url: (rootUrl + '/v1/{+name}:rollback').replace(
/([^:]\/)\/+/g,
'$1'
),
method: 'POST',
},
options
),
params,
requiredParams: ['name'],
pathParams: ['name'],
context: this.context,
};
if (callback) {
createAPIRequest<Schema$Operation>(
parameters,
callback as BodyResponseCallback<unknown>
);
} else {
return createAPIRequest<Schema$Operation>(parameters);
}
}

/**
* Updates the guest accelerators of a single Instance.
* @example
Expand Down Expand Up @@ -5853,6 +6017,18 @@ export namespace notebooks_v1 {
*/
requestBody?: Schema$ResetInstanceRequest;
}
export interface Params$Resource$Projects$Locations$Instances$Rollback
extends StandardParameters {
/**
* Required. Format: `projects/{project_id\}/locations/{location\}/instances/{instance_id\}`
*/
name?: string;

/**
* Request body metadata
*/
requestBody?: Schema$RollbackInstanceRequest;
}
export interface Params$Resource$Projects$Locations$Instances$Setaccelerator
extends StandardParameters {
/**
Expand Down

0 comments on commit f9689bb

Please sign in to comment.