Skip to content

Commit

Permalink
feat: TPU v2alpha1 public protos (#43)
Browse files Browse the repository at this point in the history
Committer: @rosbo
PiperOrigin-RevId: 403400668
Source-Link: googleapis/googleapis@8f48b97
Source-Link: googleapis/googleapis-gen@f966fd0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjk2NmZkMDJiZDBkMjQ4ZTlhZGVmZmUzYmIyZGFhNTNiZjQ0YTI1MiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Oct 19, 2021
1 parent a3ce9b1 commit 6207f89
Show file tree
Hide file tree
Showing 36 changed files with 21,444 additions and 8 deletions.

Large diffs are not rendered by default.

3,790 changes: 3,790 additions & 0 deletions packages/google-cloud-tpu/protos/protos.d.ts

Large diffs are not rendered by default.

8,936 changes: 8,936 additions & 0 deletions packages/google-cloud-tpu/protos/protos.js

Large diffs are not rendered by default.

975 changes: 975 additions & 0 deletions packages/google-cloud-tpu/protos/protos.json

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions packages/google-cloud-tpu/samples/generated/v1/tpu.create_node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2021 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.

'use strict';

function main(parent, node) {
// [START tpu_v1_generated_Tpu_CreateNode_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource name.
*/
// const parent = 'abc123'
/**
* The unqualified resource name.
*/
// const nodeId = 'abc123'
/**
* Required. The node.
*/
// const node = ''

// Imports the Tpu library
const {TpuClient} = require('@google-cloud/tpu').v1;

// Instantiates a client
const tpuClient = new TpuClient();

async function createNode() {
// Construct request
const request = {
parent,
node,
};

// Run request
const [operation] = await tpuClient.createNode(request);
const [response] = await operation.promise();
console.log(response);
}

createNode();
// [END tpu_v1_generated_Tpu_CreateNode_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
53 changes: 53 additions & 0 deletions packages/google-cloud-tpu/samples/generated/v1/tpu.delete_node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright 2021 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.

'use strict';

function main(name) {
// [START tpu_v1_generated_Tpu_DeleteNode_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name.
*/
// const name = 'abc123'

// Imports the Tpu library
const {TpuClient} = require('@google-cloud/tpu').v1;

// Instantiates a client
const tpuClient = new TpuClient();

async function deleteNode() {
// Construct request
const request = {
name,
};

// Run request
const [operation] = await tpuClient.deleteNode(request);
const [response] = await operation.promise();
console.log(response);
}

deleteNode();
// [END tpu_v1_generated_Tpu_DeleteNode_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2021 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.

'use strict';

function main(name) {
// [START tpu_v1_generated_Tpu_GetAcceleratorType_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name.
*/
// const name = 'abc123'

// Imports the Tpu library
const {TpuClient} = require('@google-cloud/tpu').v1;

// Instantiates a client
const tpuClient = new TpuClient();

async function getAcceleratorType() {
// Construct request
const request = {
name,
};

// Run request
const response = await tpuClient.getAcceleratorType(request);
console.log(response);
}

getAcceleratorType();
// [END tpu_v1_generated_Tpu_GetAcceleratorType_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
52 changes: 52 additions & 0 deletions packages/google-cloud-tpu/samples/generated/v1/tpu.get_node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2021 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.

'use strict';

function main(name) {
// [START tpu_v1_generated_Tpu_GetNode_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name.
*/
// const name = 'abc123'

// Imports the Tpu library
const {TpuClient} = require('@google-cloud/tpu').v1;

// Instantiates a client
const tpuClient = new TpuClient();

async function getNode() {
// Construct request
const request = {
name,
};

// Run request
const response = await tpuClient.getNode(request);
console.log(response);
}

getNode();
// [END tpu_v1_generated_Tpu_GetNode_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2021 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.

'use strict';

function main(name) {
// [START tpu_v1_generated_Tpu_GetTensorFlowVersion_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name.
*/
// const name = 'abc123'

// Imports the Tpu library
const {TpuClient} = require('@google-cloud/tpu').v1;

// Instantiates a client
const tpuClient = new TpuClient();

async function getTensorFlowVersion() {
// Construct request
const request = {
name,
};

// Run request
const response = await tpuClient.getTensorFlowVersion(request);
console.log(response);
}

getTensorFlowVersion();
// [END tpu_v1_generated_Tpu_GetTensorFlowVersion_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright 2021 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.

'use strict';

function main(parent) {
// [START tpu_v1_generated_Tpu_ListAcceleratorTypes_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource name.
*/
// const parent = 'abc123'
/**
* The maximum number of items to return.
*/
// const pageSize = 1234
/**
* The next_page_token value returned from a previous List request, if any.
*/
// const pageToken = 'abc123'
/**
* List filter.
*/
// const filter = 'abc123'
/**
* Sort results.
*/
// const orderBy = 'abc123'

// Imports the Tpu library
const {TpuClient} = require('@google-cloud/tpu').v1;

// Instantiates a client
const tpuClient = new TpuClient();

async function listAcceleratorTypes() {
// Construct request
const request = {
parent,
};

// Run request
const iterable = await tpuClient.listAcceleratorTypesAsync(request);
for await (const response of iterable) {
console.log(response);
}
}

listAcceleratorTypes();
// [END tpu_v1_generated_Tpu_ListAcceleratorTypes_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit 6207f89

Please sign in to comment.