diff --git a/samples/generated/v1beta1/binauthz_management_service_v1_beta1.create_attestor.js b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.create_attestor.js new file mode 100644 index 0000000..72d0b15 --- /dev/null +++ b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.create_attestor.js @@ -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, attestorId, attestor) { + // [START binaryauthorization_create_attestor_sample] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent of this + * [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. + */ + // const parent = 'abc123' + /** + * Required. The + * [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] ID. + */ + // const attestorId = 'abc123' + /** + * Required. The initial + * [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] value. The + * service will overwrite the [attestor + * name][google.cloud.binaryauthorization.v1beta1.Attestor.name] field with + * the resource name, in the format `projects/* /attestors/*`. + */ + // const attestor = '' + + // Imports the Binaryauthorization library + const {BinauthzManagementServiceV1Beta1Client} = + require('@google-cloud/binary-authorization').v1beta1; + + // Instantiates a client + const binaryauthorizationClient = + new BinauthzManagementServiceV1Beta1Client(); + + async function createAttestor() { + // Construct request + const request = { + parent, + attestorId, + attestor, + }; + + // Run request + const response = await binaryauthorizationClient.createAttestor(request); + console.log(response); + } + + createAttestor(); + // [END binaryauthorization_create_attestor_sample] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1beta1/binauthz_management_service_v1_beta1.delete_attestor.js b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.delete_attestor.js new file mode 100644 index 0000000..3f42bf8 --- /dev/null +++ b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.delete_attestor.js @@ -0,0 +1,56 @@ +// 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 binaryauthorization_delete_attestor_sample] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] to delete, + * in the format `projects/* /attestors/*`. + */ + // const name = 'abc123' + + // Imports the Binaryauthorization library + const {BinauthzManagementServiceV1Beta1Client} = + require('@google-cloud/binary-authorization').v1beta1; + + // Instantiates a client + const binaryauthorizationClient = + new BinauthzManagementServiceV1Beta1Client(); + + async function deleteAttestor() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await binaryauthorizationClient.deleteAttestor(request); + console.log(response); + } + + deleteAttestor(); + // [END binaryauthorization_delete_attestor_sample] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1beta1/binauthz_management_service_v1_beta1.get_attestor.js b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.get_attestor.js new file mode 100644 index 0000000..c34ef01 --- /dev/null +++ b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.get_attestor.js @@ -0,0 +1,56 @@ +// 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 binaryauthorization_get_attestor_sample] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the + * [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] to retrieve, + * in the format `projects/* /attestors/*`. + */ + // const name = 'abc123' + + // Imports the Binaryauthorization library + const {BinauthzManagementServiceV1Beta1Client} = + require('@google-cloud/binary-authorization').v1beta1; + + // Instantiates a client + const binaryauthorizationClient = + new BinauthzManagementServiceV1Beta1Client(); + + async function getAttestor() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await binaryauthorizationClient.getAttestor(request); + console.log(response); + } + + getAttestor(); + // [END binaryauthorization_get_attestor_sample] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1beta1/binauthz_management_service_v1_beta1.get_policy.js b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.get_policy.js new file mode 100644 index 0000000..5a6669e --- /dev/null +++ b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.get_policy.js @@ -0,0 +1,56 @@ +// 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 binaryauthorization_get_policy_sample] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * [policy][google.cloud.binaryauthorization.v1beta1.Policy] to retrieve, in + * the format `projects/* /policy`. + */ + // const name = 'abc123' + + // Imports the Binaryauthorization library + const {BinauthzManagementServiceV1Beta1Client} = + require('@google-cloud/binary-authorization').v1beta1; + + // Instantiates a client + const binaryauthorizationClient = + new BinauthzManagementServiceV1Beta1Client(); + + async function getPolicy() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await binaryauthorizationClient.getPolicy(request); + console.log(response); + } + + getPolicy(); + // [END binaryauthorization_get_policy_sample] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1beta1/binauthz_management_service_v1_beta1.list_attestors.js b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.list_attestors.js new file mode 100644 index 0000000..58823d2 --- /dev/null +++ b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.list_attestors.js @@ -0,0 +1,72 @@ +// 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 binaryauthorization_list_attestors_sample] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the project associated with the + * [attestors][google.cloud.binaryauthorization.v1beta1.Attestor], in the + * format `projects/*`. + */ + // const parent = 'abc123' + /** + * Requested page size. The server may return fewer results than requested. If + * unspecified, the server will pick an appropriate default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results the server should return. Typically, + * this is the value of + * [ListAttestorsResponse.next_page_token][google.cloud.binaryauthorization.v1beta1.ListAttestorsResponse.next_page_token] + * returned from the previous call to the `ListAttestors` method. + */ + // const pageToken = 'abc123' + + // Imports the Binaryauthorization library + const {BinauthzManagementServiceV1Beta1Client} = + require('@google-cloud/binary-authorization').v1beta1; + + // Instantiates a client + const binaryauthorizationClient = + new BinauthzManagementServiceV1Beta1Client(); + + async function listAttestors() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await binaryauthorizationClient.listAttestorsAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + listAttestors(); + // [END binaryauthorization_list_attestors_sample] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1beta1/binauthz_management_service_v1_beta1.update_attestor.js b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.update_attestor.js new file mode 100644 index 0000000..fb7be5d --- /dev/null +++ b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.update_attestor.js @@ -0,0 +1,59 @@ +// 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(attestor) { + // [START binaryauthorization_update_attestor_sample] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The updated + * [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] value. The + * service will overwrite the [attestor + * name][google.cloud.binaryauthorization.v1beta1.Attestor.name] field with + * the resource name in the request URL, in the format + * `projects/* /attestors/*`. + */ + // const attestor = '' + + // Imports the Binaryauthorization library + const {BinauthzManagementServiceV1Beta1Client} = + require('@google-cloud/binary-authorization').v1beta1; + + // Instantiates a client + const binaryauthorizationClient = + new BinauthzManagementServiceV1Beta1Client(); + + async function updateAttestor() { + // Construct request + const request = { + attestor, + }; + + // Run request + const response = await binaryauthorizationClient.updateAttestor(request); + console.log(response); + } + + updateAttestor(); + // [END binaryauthorization_update_attestor_sample] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v1beta1/binauthz_management_service_v1_beta1.update_policy.js b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.update_policy.js new file mode 100644 index 0000000..da2ab8c --- /dev/null +++ b/samples/generated/v1beta1/binauthz_management_service_v1_beta1.update_policy.js @@ -0,0 +1,58 @@ +// 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(policy) { + // [START binaryauthorization_update_policy_sample] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. A new or updated + * [policy][google.cloud.binaryauthorization.v1beta1.Policy] value. The + * service will overwrite the [policy + * name][google.cloud.binaryauthorization.v1beta1.Policy.name] field with the + * resource name in the request URL, in the format `projects/* /policy`. + */ + // const policy = '' + + // Imports the Binaryauthorization library + const {BinauthzManagementServiceV1Beta1Client} = + require('@google-cloud/binary-authorization').v1beta1; + + // Instantiates a client + const binaryauthorizationClient = + new BinauthzManagementServiceV1Beta1Client(); + + async function updatePolicy() { + // Construct request + const request = { + policy, + }; + + // Run request + const response = await binaryauthorizationClient.updatePolicy(request); + console.log(response); + } + + updatePolicy(); + // [END binaryauthorization_update_policy_sample] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/src/v1beta1/binauthz_management_service_v1_beta1_client.ts b/src/v1beta1/binauthz_management_service_v1_beta1_client.ts index 154f13b..e120ca3 100644 --- a/src/v1beta1/binauthz_management_service_v1_beta1_client.ts +++ b/src/v1beta1/binauthz_management_service_v1_beta1_client.ts @@ -394,6 +394,10 @@ export class BinauthzManagementServiceV1Beta1Client { * for more details and examples. * @example * const [response] = await client.getPolicy(request); + * + * @example