Skip to content

Commit

Permalink
feat: asset path template & matchers (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and callmehiphop committed Apr 11, 2019
1 parent 92c0b79 commit 19d449b
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 92 deletions.
215 changes: 127 additions & 88 deletions packages/google-cloud-securitycenter/src/v1/security_center_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,27 @@ class SecurityCenterClient {
organizationPathTemplate: new gax.PathTemplate(
'organizations/{organization}'
),
assetSecurityMarksPathTemplate: new gax.PathTemplate(
'organizations/{organization}/assets/{asset}/securityMarks'
),
findingSecurityMarksPathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks'
),
organizationSettingsPathTemplate: new gax.PathTemplate(
'organizations/{organization}/organizationSettings'
),
organizationSourcesPathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/-'
assetPathTemplate: new gax.PathTemplate(
'organizations/{organization}/assets/{asset}'
),
assetSecurityMarksPathTemplate: new gax.PathTemplate(
'organizations/{organization}/assets/{asset}/securityMarks'
),
sourcePathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/{source}'
),
organizationSourcesPathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/-'
),
findingPathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/{source}/findings/{finding}'
),
findingSecurityMarksPathTemplate: new gax.PathTemplate(
'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks'
),
};

// Some of the methods on this service return "paged" results,
Expand Down Expand Up @@ -2769,44 +2772,56 @@ class SecurityCenterClient {
}

/**
* Return a fully-qualified asset_security_marks resource name string.
* Return a fully-qualified organization_settings resource name string.
*
* @param {String} organization
* @returns {String}
*/
organizationSettingsPath(organization) {
return this._pathTemplates.organizationSettingsPathTemplate.render({
organization: organization,
});
}

/**
* Return a fully-qualified asset resource name string.
*
* @param {String} organization
* @param {String} asset
* @returns {String}
*/
assetSecurityMarksPath(organization, asset) {
return this._pathTemplates.assetSecurityMarksPathTemplate.render({
assetPath(organization, asset) {
return this._pathTemplates.assetPathTemplate.render({
organization: organization,
asset: asset,
});
}

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

/**
* Return a fully-qualified organization_settings resource name string.
* Return a fully-qualified source resource name string.
*
* @param {String} organization
* @param {String} source
* @returns {String}
*/
organizationSettingsPath(organization) {
return this._pathTemplates.organizationSettingsPathTemplate.render({
sourcePath(organization, source) {
return this._pathTemplates.sourcePathTemplate.render({
organization: organization,
source: source,
});
}

Expand All @@ -2823,29 +2838,31 @@ class SecurityCenterClient {
}

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

/**
* Return a fully-qualified finding resource name string.
* Return a fully-qualified finding_security_marks resource name string.
*
* @param {String} organization
* @param {String} source
* @param {String} finding
* @returns {String}
*/
findingPath(organization, source, finding) {
return this._pathTemplates.findingPathTemplate.render({
findingSecurityMarksPath(organization, source, finding) {
return this._pathTemplates.findingSecurityMarksPathTemplate.render({
organization: organization,
source: source,
finding: finding,
Expand All @@ -2865,94 +2882,64 @@ class SecurityCenterClient {
}

/**
* Parse the assetSecurityMarksName from a asset_security_marks resource.
* Parse the organizationSettingsName from a organization_settings resource.
*
* @param {String} assetSecurityMarksName
* A fully-qualified path representing a asset_security_marks resources.
* @param {String} organizationSettingsName
* A fully-qualified path representing a organization_settings resources.
* @returns {String} - A string representing the organization.
*/
matchOrganizationFromAssetSecurityMarksName(assetSecurityMarksName) {
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
assetSecurityMarksName
matchOrganizationFromOrganizationSettingsName(organizationSettingsName) {
return this._pathTemplates.organizationSettingsPathTemplate.match(
organizationSettingsName
).organization;
}

/**
* Parse the assetSecurityMarksName from a asset_security_marks resource.
* Parse the assetName from a asset resource.
*
* @param {String} assetSecurityMarksName
* A fully-qualified path representing a asset_security_marks resources.
* @returns {String} - A string representing the asset.
*/
matchAssetFromAssetSecurityMarksName(assetSecurityMarksName) {
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
assetSecurityMarksName
).asset;
}

/**
* Parse the findingSecurityMarksName from a finding_security_marks resource.
*
* @param {String} findingSecurityMarksName
* A fully-qualified path representing a finding_security_marks resources.
* @param {String} assetName
* A fully-qualified path representing a asset 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;
matchOrganizationFromAssetName(assetName) {
return this._pathTemplates.assetPathTemplate.match(assetName).organization;
}

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

/**
* Parse the organizationSettingsName from a organization_settings resource.
* Parse the assetSecurityMarksName from a asset_security_marks resource.
*
* @param {String} organizationSettingsName
* A fully-qualified path representing a organization_settings resources.
* @param {String} assetSecurityMarksName
* A fully-qualified path representing a asset_security_marks resources.
* @returns {String} - A string representing the organization.
*/
matchOrganizationFromOrganizationSettingsName(organizationSettingsName) {
return this._pathTemplates.organizationSettingsPathTemplate.match(
organizationSettingsName
matchOrganizationFromAssetSecurityMarksName(assetSecurityMarksName) {
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
assetSecurityMarksName
).organization;
}

/**
* Parse the organizationSourcesName from a organization_sources resource.
* Parse the assetSecurityMarksName from a asset_security_marks resource.
*
* @param {String} organizationSourcesName
* A fully-qualified path representing a organization_sources resources.
* @returns {String} - A string representing the organization.
* @param {String} assetSecurityMarksName
* A fully-qualified path representing a asset_security_marks resources.
* @returns {String} - A string representing the asset.
*/
matchOrganizationFromOrganizationSourcesName(organizationSourcesName) {
return this._pathTemplates.organizationSourcesPathTemplate.match(
organizationSourcesName
).organization;
matchAssetFromAssetSecurityMarksName(assetSecurityMarksName) {
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
assetSecurityMarksName
).asset;
}

/**
Expand All @@ -2978,6 +2965,19 @@ class SecurityCenterClient {
return this._pathTemplates.sourcePathTemplate.match(sourceName).source;
}

/**
* Parse the organizationSourcesName from a organization_sources resource.
*
* @param {String} organizationSourcesName
* A fully-qualified path representing a organization_sources resources.
* @returns {String} - A string representing the organization.
*/
matchOrganizationFromOrganizationSourcesName(organizationSourcesName) {
return this._pathTemplates.organizationSourcesPathTemplate.match(
organizationSourcesName
).organization;
}

/**
* Parse the findingName from a finding resource.
*
Expand Down Expand Up @@ -3011,6 +3011,45 @@ class SecurityCenterClient {
matchFindingFromFindingName(findingName) {
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;
}
}

module.exports = SecurityCenterClient;
8 changes: 4 additions & 4 deletions packages/google-cloud-securitycenter/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"updateTime": "2019-04-10T11:21:52.927716Z",
"updateTime": "2019-04-11T11:21:27.131524Z",
"sources": [
{
"generator": {
Expand All @@ -12,15 +12,15 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "3f57de2fbe951640b587d9c2d503daf554747749",
"internalRef": "242707837"
"sha": "fecf169b1b202e7acd8c0bd3b1d1f5e52747fd63",
"internalRef": "242946317"
}
},
{
"template": {
"name": "node_library",
"origin": "synthtool.gcp",
"version": "2019.2.26"
"version": "2019.4.10"
}
}
],
Expand Down

0 comments on commit 19d449b

Please sign in to comment.