-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add apis for AssuredWorkload monitoring feature and to restrict…
… allowed resources (#192) * feat: add apis for AssuredWorkload monitoring feature and to restrict allowed resources AssuredWorkload monitoring is a new feature which provides apis to fetch compliance violation for AssuredWorkloads. It also provides an api to acknowledge an unresolved violation. RestrictAllowedResources api allows restricting list of available resources in Workload environment. Committer: @ViswasK PiperOrigin-RevId: 477959383 Source-Link: googleapis/googleapis@0cad78c Source-Link: googleapis/googleapis-gen@3052e0d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzA1MmUwZDdhYzk4OWJjNTcxZmIzMDU4OTRhZGE4NTI1ZDFmMjQ4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d073994
commit fc6b73e
Showing
16 changed files
with
8,574 additions
and
194 deletions.
There are no files selected for viewing
520 changes: 426 additions & 94 deletions
520
...gle-cloud-assuredworkloads/protos/google/cloud/assuredworkloads/v1/assuredworkloads.proto
Large diffs are not rendered by default.
Oops, something went wrong.
1,600 changes: 1,580 additions & 20 deletions
1,600
packages/google-cloud-assuredworkloads/protos/protos.d.ts
Large diffs are not rendered by default.
Oops, something went wrong.
3,896 changes: 3,855 additions & 41 deletions
3,896
packages/google-cloud-assuredworkloads/protos/protos.js
Large diffs are not rendered by default.
Oops, something went wrong.
449 changes: 429 additions & 20 deletions
449
packages/google-cloud-assuredworkloads/protos/protos.json
Large diffs are not rendered by default.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
...-assuredworkloads/samples/generated/v1/assured_workloads_service.acknowledge_violation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2022 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 | ||
// | ||
// https://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. | ||
// | ||
// ** This file is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
|
||
|
||
'use strict'; | ||
|
||
function main(name, comment) { | ||
// [START assuredworkloads_v1_generated_AssuredWorkloadsService_AcknowledgeViolation_async] | ||
/** | ||
* This snippet has been automatically generated and should be regarded as a code template only. | ||
* It will require modifications to work. | ||
* It may require correct/in-range values for request initialization. | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The resource name of the Violation to acknowledge. | ||
* Format: | ||
* organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation} | ||
*/ | ||
// const name = 'abc123' | ||
/** | ||
* Required. Business justification explaining the need for violation acknowledgement | ||
*/ | ||
// const comment = 'abc123' | ||
/** | ||
* Optional. Name of the OrgPolicy which was modified with non-compliant change and | ||
* resulted in this violation. | ||
* Format: | ||
* projects/{project_number}/policies/{constraint_name} | ||
* folders/{folder_id}/policies/{constraint_name} | ||
* organizations/{organization_id}/policies/{constraint_name} | ||
*/ | ||
// const nonCompliantOrgPolicy = 'abc123' | ||
|
||
// Imports the Assuredworkloads library | ||
const {AssuredWorkloadsServiceClient} = require('@google-cloud/assured-workloads').v1; | ||
|
||
// Instantiates a client | ||
const assuredworkloadsClient = new AssuredWorkloadsServiceClient(); | ||
|
||
async function callAcknowledgeViolation() { | ||
// Construct request | ||
const request = { | ||
name, | ||
comment, | ||
}; | ||
|
||
// Run request | ||
const response = await assuredworkloadsClient.acknowledgeViolation(request); | ||
console.log(response); | ||
} | ||
|
||
callAcknowledgeViolation(); | ||
// [END assuredworkloads_v1_generated_AssuredWorkloadsService_AcknowledgeViolation_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...le-cloud-assuredworkloads/samples/generated/v1/assured_workloads_service.get_violation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2022 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 | ||
// | ||
// https://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. | ||
// | ||
// ** This file is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
|
||
|
||
'use strict'; | ||
|
||
function main(name) { | ||
// [START assuredworkloads_v1_generated_AssuredWorkloadsService_GetViolation_async] | ||
/** | ||
* This snippet has been automatically generated and should be regarded as a code template only. | ||
* It will require modifications to work. | ||
* It may require correct/in-range values for request initialization. | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The resource name of the Violation to fetch (ie. Violation.name). | ||
* Format: | ||
* organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation} | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Assuredworkloads library | ||
const {AssuredWorkloadsServiceClient} = require('@google-cloud/assured-workloads').v1; | ||
|
||
// Instantiates a client | ||
const assuredworkloadsClient = new AssuredWorkloadsServiceClient(); | ||
|
||
async function callGetViolation() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await assuredworkloadsClient.getViolation(request); | ||
console.log(response); | ||
} | ||
|
||
callGetViolation(); | ||
// [END assuredworkloads_v1_generated_AssuredWorkloadsService_GetViolation_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...-cloud-assuredworkloads/samples/generated/v1/assured_workloads_service.list_violations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright 2022 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 | ||
// | ||
// https://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. | ||
// | ||
// ** This file is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
|
||
|
||
'use strict'; | ||
|
||
function main(parent) { | ||
// [START assuredworkloads_v1_generated_AssuredWorkloadsService_ListViolations_async] | ||
/** | ||
* This snippet has been automatically generated and should be regarded as a code template only. | ||
* It will require modifications to work. | ||
* It may require correct/in-range values for request initialization. | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The Workload name. | ||
* Format `organizations/{org_id}/locations/{location}/workloads/{workload}`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Optional. Specifies the time window for retrieving active Violations. | ||
* When specified, retrieves Violations that were active between start_time | ||
* and end_time. | ||
*/ | ||
// const interval = {} | ||
/** | ||
* Optional. Page size. | ||
*/ | ||
// const pageSize = 1234 | ||
/** | ||
* Optional. Page token returned from previous request. | ||
*/ | ||
// const pageToken = 'abc123' | ||
/** | ||
* Optional. A custom filter for filtering by the Violations properties. | ||
*/ | ||
// const filter = 'abc123' | ||
|
||
// Imports the Assuredworkloads library | ||
const {AssuredWorkloadsServiceClient} = require('@google-cloud/assured-workloads').v1; | ||
|
||
// Instantiates a client | ||
const assuredworkloadsClient = new AssuredWorkloadsServiceClient(); | ||
|
||
async function callListViolations() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
}; | ||
|
||
// Run request | ||
const iterable = await assuredworkloadsClient.listViolationsAsync(request); | ||
for await (const response of iterable) { | ||
console.log(response); | ||
} | ||
} | ||
|
||
callListViolations(); | ||
// [END assuredworkloads_v1_generated_AssuredWorkloadsService_ListViolations_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
70 changes: 70 additions & 0 deletions
70
...redworkloads/samples/generated/v1/assured_workloads_service.restrict_allowed_resources.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2022 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 | ||
// | ||
// https://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. | ||
// | ||
// ** This file is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
|
||
|
||
'use strict'; | ||
|
||
function main(name, restrictionType) { | ||
// [START assuredworkloads_v1_generated_AssuredWorkloadsService_RestrictAllowedResources_async] | ||
/** | ||
* This snippet has been automatically generated and should be regarded as a code template only. | ||
* It will require modifications to work. | ||
* It may require correct/in-range values for request initialization. | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The resource name of the Workload. This is the workloads's | ||
* relative path in the API, formatted as | ||
* "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}". | ||
* For example, | ||
* "organizations/123/locations/us-east1/workloads/assured-workload-1". | ||
*/ | ||
// const name = 'abc123' | ||
/** | ||
* Required. The type of restriction for using gcp products in the Workload environment. | ||
*/ | ||
// const restrictionType = {} | ||
|
||
// Imports the Assuredworkloads library | ||
const {AssuredWorkloadsServiceClient} = require('@google-cloud/assured-workloads').v1; | ||
|
||
// Instantiates a client | ||
const assuredworkloadsClient = new AssuredWorkloadsServiceClient(); | ||
|
||
async function callRestrictAllowedResources() { | ||
// Construct request | ||
const request = { | ||
name, | ||
restrictionType, | ||
}; | ||
|
||
// Run request | ||
const response = await assuredworkloadsClient.restrictAllowedResources(request); | ||
console.log(response); | ||
} | ||
|
||
callRestrictAllowedResources(); | ||
// [END assuredworkloads_v1_generated_AssuredWorkloadsService_RestrictAllowedResources_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.