Skip to content

Commit

Permalink
feat!: adds findingSecurityMarksPathTemplate (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and bcoe committed Jul 16, 2019
1 parent da61baa commit 3983ed9
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 1,341 deletions.
48 changes: 21 additions & 27 deletions packages/google-cloud-securitycenter/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,68 +18,69 @@
/**
* @namespace google.type
*/

/**
* @namespace google.type
* @namespace google.longrunning
*/

/**
* @namespace google.cloud
* @namespace google.protobuf
*/
/**
* @namespace google.cloud.securitycenter
* @namespace google.type
*/
/**
* @namespace google.cloud.securitycenter.v1beta1
* @namespace google.rpc
*/
/**
* @namespace google.cloud.securitycenter.v1
*/
/**
* @namespace google.cloud.securitycenter.v1beta1
*/
/**
* @namespace google.iam.v1
*/

/**
* @namespace google.protobuf
* @namespace google.cloud
*/
/**
* @namespace google.longrunning
* @namespace google.cloud.security-center
*/
/**
* @namespace google.rpc
* @namespace google.cloud.security-center.v1
*/

'use strict';

// Import the clients for each version supported by this package.
const gapic = Object.freeze({
v1beta1: require('./v1beta1'),
v1: require('./v1'),
});

/**
* The `securitycenter` package has the following named exports:
* The `@google-cloud/security-center` package has the following named exports:
*
* - `SecurityCenterClient` - Reference to
* {@link v1beta1.SecurityCenterClient}
* - `v1beta1` - This is used for selecting or pinning a
* {@link v1.SecurityCenterClient}
* - `v1` - This is used for selecting or pinning a
* particular backend service version. It exports:
* - `SecurityCenterClient` - Reference to
* {@link v1beta1.SecurityCenterClient}
* {@link v1.SecurityCenterClient}
*
* @module {object} @google-cloud/security-center
* @alias nodejs-securitycenter
* @alias nodejs-security-center
*
* @example <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
* npm install --save @google-cloud/security-center
*
* @example <caption>Import the client library:</caption>
* const securitycenter = require('@google-cloud/security-center');
* const security-center = require('@google-cloud/security-center');
*
* @example <caption>Create a client that uses <a href="https://goo.gl/64dyYX">Application Default Credentials (ADC)</a>:</caption>
* const client = new securitycenter.SecurityCenterClient();
* const client = new security-center.SecurityCenterClient();
*
* @example <caption>Create a client with <a href="https://goo.gl/RXp6VL">explicit credentials</a>:</caption>
* const client = new securitycenter.SecurityCenterClient({
* const client = new security-center.SecurityCenterClient({
* projectId: 'your-project-id',
* keyFilename: '/path/to/keyfile.json',
* });
Expand All @@ -88,17 +89,10 @@ const gapic = Object.freeze({
/**
* @type {object}
* @property {constructor} SecurityCenterClient
* Reference to {@link v1beta1.SecurityCenterClient}
* Reference to {@link v1.SecurityCenterClient}
*/
module.exports = gapic.v1;

/**
* @type {object}
* @property {constructor} SecurityCenterClient
* Reference to {@link v1beta1.SecurityCenterClient}
*/
module.exports.v1beta1 = gapic.v1beta1;

/**
* @type {object}
* @property {constructor} SecurityCenterClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class SecurityCenterClient {
findingPathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/{source}/findings/{finding}'
),
findingSecurityMarksPathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks'
),
organizationPathTemplate: new gax.PathTemplate(
'organizations/{organization}'
),
Expand Down Expand Up @@ -2511,6 +2514,22 @@ class SecurityCenterClient {
});
}

/**
* Return a fully-qualified finding_security_marks resource name string.
*
* @param {String} organization
* @param {String} source
* @param {String} finding
* @returns {String}
*/
findingSecurityMarksPath(organization, source, finding) {
return this._pathTemplates.findingSecurityMarksPathTemplate.render({
organization: organization,
source: source,
finding: finding,
});
}

/**
* Return a fully-qualified organization resource name string.
*
Expand Down Expand Up @@ -2609,6 +2628,45 @@ class SecurityCenterClient {
return this._pathTemplates.findingPathTemplate.match(findingName).finding;
}

/**
* Parse the findingSecurityMarksName from a finding_security_marks resource.
*
* @param {String} findingSecurityMarksName
* A fully-qualified path representing a finding_security_marks resources.
* @returns {String} - A string representing the organization.
*/
matchOrganizationFromFindingSecurityMarksName(findingSecurityMarksName) {
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
findingSecurityMarksName
).organization;
}

/**
* Parse the findingSecurityMarksName from a finding_security_marks resource.
*
* @param {String} findingSecurityMarksName
* A fully-qualified path representing a finding_security_marks resources.
* @returns {String} - A string representing the source.
*/
matchSourceFromFindingSecurityMarksName(findingSecurityMarksName) {
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
findingSecurityMarksName
).source;
}

/**
* Parse the findingSecurityMarksName from a finding_security_marks resource.
*
* @param {String} findingSecurityMarksName
* A fully-qualified path representing a finding_security_marks resources.
* @returns {String} - A string representing the finding.
*/
matchFindingFromFindingSecurityMarksName(findingSecurityMarksName) {
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
findingSecurityMarksName
).finding;
}

/**
* Parse the organizationName from a organization resource.
*
Expand Down
10 changes: 5 additions & 5 deletions packages/google-cloud-securitycenter/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-07-03T11:19:04.252185Z",
"updateTime": "2019-07-16T21:57:58.657213Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.29.3",
"dockerImage": "googleapis/artman@sha256:8900f94a81adaab0238965aa8a7b3648791f4f3a95ee65adc6a56cfcc3753101"
"version": "0.30.0",
"dockerImage": "googleapis/artman@sha256:a44d9fb6fe826ca0ea7d6f7be23c596346bed82ee513a0043f3c068279717439"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "69916b6ffbb7717fa009033351777d0c9909fb79",
"internalRef": "256241904"
"sha": "96d5a05171e99b6a2378eb0a3423f765351878b7",
"internalRef": "258424288"
}
},
{
Expand Down
25 changes: 23 additions & 2 deletions packages/google-cloud-securitycenter/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
versions = ['v1beta1', 'v1']
for version in versions:
library = gapic.node_library('securitycenter', version)
s.copy(library, excludes=['src/index.js', 'README.md', 'package.json', '.kokoro/sample-test.sh'])
s.copy(library, excludes=['README.md', 'package.json', 'test/gapic-v1beta1.js'])

# Copy common templates
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates)
s.copy(templates, excludes=['.kokoro/samples-test.sh'])

s.replace('src/v1*/doc/google/cloud/securitycenter/v1*/doc_source.js',
r"\[\\p\{L\}\\p\{N\}\]\(https:\/\/cloud\.google\.com\{\\p\{L\}\\p\{N\}_- \]\{0\,30\}\[\\p\{L\}\\p\{N\}\]\)\?",
Expand All @@ -47,6 +47,27 @@
/**
* @namespace google.type
*/
/**
* @namespace google.longrunning
*/
/**
* @namespace google.protobuf
*/
/**
* @namespace google.type
*/
/**
* @namespace google.rpc
*/
/**
* @namespace google.cloud.securitycenter.v1
*/
/**
* @namespace google.cloud.securitycenter.v1beta1
*/
/**
* @namespace google.iam.v1
*/
""")

# [START fix-dead-link]
Expand Down
Loading

0 comments on commit 3983ed9

Please sign in to comment.