Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, 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));
Original file line number Diff line number Diff line change
@@ -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));
Original file line number Diff line number Diff line change
@@ -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));
Original file line number Diff line number Diff line change
@@ -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));
Original file line number Diff line number Diff line change
@@ -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));
Original file line number Diff line number Diff line change
@@ -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));
Loading