Skip to content

Commit 19d449b

Browse files
yoshi-automationcallmehiphop
authored andcommitted
feat: asset path template & matchers (#84)
1 parent 92c0b79 commit 19d449b

2 files changed

Lines changed: 131 additions & 92 deletions

File tree

packages/google-cloud-securitycenter/src/v1/security_center_client.js

Lines changed: 127 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -104,24 +104,27 @@ class SecurityCenterClient {
104104
organizationPathTemplate: new gax.PathTemplate(
105105
'organizations/{organization}'
106106
),
107-
assetSecurityMarksPathTemplate: new gax.PathTemplate(
108-
'organizations/{organization}/assets/{asset}/securityMarks'
109-
),
110-
findingSecurityMarksPathTemplate: new gax.PathTemplate(
111-
'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks'
112-
),
113107
organizationSettingsPathTemplate: new gax.PathTemplate(
114108
'organizations/{organization}/organizationSettings'
115109
),
116-
organizationSourcesPathTemplate: new gax.PathTemplate(
117-
'organizations/{organization}/sources/-'
110+
assetPathTemplate: new gax.PathTemplate(
111+
'organizations/{organization}/assets/{asset}'
112+
),
113+
assetSecurityMarksPathTemplate: new gax.PathTemplate(
114+
'organizations/{organization}/assets/{asset}/securityMarks'
118115
),
119116
sourcePathTemplate: new gax.PathTemplate(
120117
'organizations/{organization}/sources/{source}'
121118
),
119+
organizationSourcesPathTemplate: new gax.PathTemplate(
120+
'organizations/{organization}/sources/-'
121+
),
122122
findingPathTemplate: new gax.PathTemplate(
123123
'organizations/{organization}/sources/{source}/findings/{finding}'
124124
),
125+
findingSecurityMarksPathTemplate: new gax.PathTemplate(
126+
'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks'
127+
),
125128
};
126129

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

27712774
/**
2772-
* Return a fully-qualified asset_security_marks resource name string.
2775+
* Return a fully-qualified organization_settings resource name string.
2776+
*
2777+
* @param {String} organization
2778+
* @returns {String}
2779+
*/
2780+
organizationSettingsPath(organization) {
2781+
return this._pathTemplates.organizationSettingsPathTemplate.render({
2782+
organization: organization,
2783+
});
2784+
}
2785+
2786+
/**
2787+
* Return a fully-qualified asset resource name string.
27732788
*
27742789
* @param {String} organization
27752790
* @param {String} asset
27762791
* @returns {String}
27772792
*/
2778-
assetSecurityMarksPath(organization, asset) {
2779-
return this._pathTemplates.assetSecurityMarksPathTemplate.render({
2793+
assetPath(organization, asset) {
2794+
return this._pathTemplates.assetPathTemplate.render({
27802795
organization: organization,
27812796
asset: asset,
27822797
});
27832798
}
27842799

27852800
/**
2786-
* Return a fully-qualified finding_security_marks resource name string.
2801+
* Return a fully-qualified asset_security_marks resource name string.
27872802
*
27882803
* @param {String} organization
2789-
* @param {String} source
2790-
* @param {String} finding
2804+
* @param {String} asset
27912805
* @returns {String}
27922806
*/
2793-
findingSecurityMarksPath(organization, source, finding) {
2794-
return this._pathTemplates.findingSecurityMarksPathTemplate.render({
2807+
assetSecurityMarksPath(organization, asset) {
2808+
return this._pathTemplates.assetSecurityMarksPathTemplate.render({
27952809
organization: organization,
2796-
source: source,
2797-
finding: finding,
2810+
asset: asset,
27982811
});
27992812
}
28002813

28012814
/**
2802-
* Return a fully-qualified organization_settings resource name string.
2815+
* Return a fully-qualified source resource name string.
28032816
*
28042817
* @param {String} organization
2818+
* @param {String} source
28052819
* @returns {String}
28062820
*/
2807-
organizationSettingsPath(organization) {
2808-
return this._pathTemplates.organizationSettingsPathTemplate.render({
2821+
sourcePath(organization, source) {
2822+
return this._pathTemplates.sourcePathTemplate.render({
28092823
organization: organization,
2824+
source: source,
28102825
});
28112826
}
28122827

@@ -2823,29 +2838,31 @@ class SecurityCenterClient {
28232838
}
28242839

28252840
/**
2826-
* Return a fully-qualified source resource name string.
2841+
* Return a fully-qualified finding resource name string.
28272842
*
28282843
* @param {String} organization
28292844
* @param {String} source
2845+
* @param {String} finding
28302846
* @returns {String}
28312847
*/
2832-
sourcePath(organization, source) {
2833-
return this._pathTemplates.sourcePathTemplate.render({
2848+
findingPath(organization, source, finding) {
2849+
return this._pathTemplates.findingPathTemplate.render({
28342850
organization: organization,
28352851
source: source,
2852+
finding: finding,
28362853
});
28372854
}
28382855

28392856
/**
2840-
* Return a fully-qualified finding resource name string.
2857+
* Return a fully-qualified finding_security_marks resource name string.
28412858
*
28422859
* @param {String} organization
28432860
* @param {String} source
28442861
* @param {String} finding
28452862
* @returns {String}
28462863
*/
2847-
findingPath(organization, source, finding) {
2848-
return this._pathTemplates.findingPathTemplate.render({
2864+
findingSecurityMarksPath(organization, source, finding) {
2865+
return this._pathTemplates.findingSecurityMarksPathTemplate.render({
28492866
organization: organization,
28502867
source: source,
28512868
finding: finding,
@@ -2865,94 +2882,64 @@ class SecurityCenterClient {
28652882
}
28662883

28672884
/**
2868-
* Parse the assetSecurityMarksName from a asset_security_marks resource.
2885+
* Parse the organizationSettingsName from a organization_settings resource.
28692886
*
2870-
* @param {String} assetSecurityMarksName
2871-
* A fully-qualified path representing a asset_security_marks resources.
2887+
* @param {String} organizationSettingsName
2888+
* A fully-qualified path representing a organization_settings resources.
28722889
* @returns {String} - A string representing the organization.
28732890
*/
2874-
matchOrganizationFromAssetSecurityMarksName(assetSecurityMarksName) {
2875-
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
2876-
assetSecurityMarksName
2891+
matchOrganizationFromOrganizationSettingsName(organizationSettingsName) {
2892+
return this._pathTemplates.organizationSettingsPathTemplate.match(
2893+
organizationSettingsName
28772894
).organization;
28782895
}
28792896

28802897
/**
2881-
* Parse the assetSecurityMarksName from a asset_security_marks resource.
2898+
* Parse the assetName from a asset resource.
28822899
*
2883-
* @param {String} assetSecurityMarksName
2884-
* A fully-qualified path representing a asset_security_marks resources.
2885-
* @returns {String} - A string representing the asset.
2886-
*/
2887-
matchAssetFromAssetSecurityMarksName(assetSecurityMarksName) {
2888-
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
2889-
assetSecurityMarksName
2890-
).asset;
2891-
}
2892-
2893-
/**
2894-
* Parse the findingSecurityMarksName from a finding_security_marks resource.
2895-
*
2896-
* @param {String} findingSecurityMarksName
2897-
* A fully-qualified path representing a finding_security_marks resources.
2900+
* @param {String} assetName
2901+
* A fully-qualified path representing a asset resources.
28982902
* @returns {String} - A string representing the organization.
28992903
*/
2900-
matchOrganizationFromFindingSecurityMarksName(findingSecurityMarksName) {
2901-
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
2902-
findingSecurityMarksName
2903-
).organization;
2904-
}
2905-
2906-
/**
2907-
* Parse the findingSecurityMarksName from a finding_security_marks resource.
2908-
*
2909-
* @param {String} findingSecurityMarksName
2910-
* A fully-qualified path representing a finding_security_marks resources.
2911-
* @returns {String} - A string representing the source.
2912-
*/
2913-
matchSourceFromFindingSecurityMarksName(findingSecurityMarksName) {
2914-
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
2915-
findingSecurityMarksName
2916-
).source;
2904+
matchOrganizationFromAssetName(assetName) {
2905+
return this._pathTemplates.assetPathTemplate.match(assetName).organization;
29172906
}
29182907

29192908
/**
2920-
* Parse the findingSecurityMarksName from a finding_security_marks resource.
2909+
* Parse the assetName from a asset resource.
29212910
*
2922-
* @param {String} findingSecurityMarksName
2923-
* A fully-qualified path representing a finding_security_marks resources.
2924-
* @returns {String} - A string representing the finding.
2911+
* @param {String} assetName
2912+
* A fully-qualified path representing a asset resources.
2913+
* @returns {String} - A string representing the asset.
29252914
*/
2926-
matchFindingFromFindingSecurityMarksName(findingSecurityMarksName) {
2927-
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
2928-
findingSecurityMarksName
2929-
).finding;
2915+
matchAssetFromAssetName(assetName) {
2916+
return this._pathTemplates.assetPathTemplate.match(assetName).asset;
29302917
}
29312918

29322919
/**
2933-
* Parse the organizationSettingsName from a organization_settings resource.
2920+
* Parse the assetSecurityMarksName from a asset_security_marks resource.
29342921
*
2935-
* @param {String} organizationSettingsName
2936-
* A fully-qualified path representing a organization_settings resources.
2922+
* @param {String} assetSecurityMarksName
2923+
* A fully-qualified path representing a asset_security_marks resources.
29372924
* @returns {String} - A string representing the organization.
29382925
*/
2939-
matchOrganizationFromOrganizationSettingsName(organizationSettingsName) {
2940-
return this._pathTemplates.organizationSettingsPathTemplate.match(
2941-
organizationSettingsName
2926+
matchOrganizationFromAssetSecurityMarksName(assetSecurityMarksName) {
2927+
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
2928+
assetSecurityMarksName
29422929
).organization;
29432930
}
29442931

29452932
/**
2946-
* Parse the organizationSourcesName from a organization_sources resource.
2933+
* Parse the assetSecurityMarksName from a asset_security_marks resource.
29472934
*
2948-
* @param {String} organizationSourcesName
2949-
* A fully-qualified path representing a organization_sources resources.
2950-
* @returns {String} - A string representing the organization.
2935+
* @param {String} assetSecurityMarksName
2936+
* A fully-qualified path representing a asset_security_marks resources.
2937+
* @returns {String} - A string representing the asset.
29512938
*/
2952-
matchOrganizationFromOrganizationSourcesName(organizationSourcesName) {
2953-
return this._pathTemplates.organizationSourcesPathTemplate.match(
2954-
organizationSourcesName
2955-
).organization;
2939+
matchAssetFromAssetSecurityMarksName(assetSecurityMarksName) {
2940+
return this._pathTemplates.assetSecurityMarksPathTemplate.match(
2941+
assetSecurityMarksName
2942+
).asset;
29562943
}
29572944

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

2968+
/**
2969+
* Parse the organizationSourcesName from a organization_sources resource.
2970+
*
2971+
* @param {String} organizationSourcesName
2972+
* A fully-qualified path representing a organization_sources resources.
2973+
* @returns {String} - A string representing the organization.
2974+
*/
2975+
matchOrganizationFromOrganizationSourcesName(organizationSourcesName) {
2976+
return this._pathTemplates.organizationSourcesPathTemplate.match(
2977+
organizationSourcesName
2978+
).organization;
2979+
}
2980+
29812981
/**
29822982
* Parse the findingName from a finding resource.
29832983
*
@@ -3011,6 +3011,45 @@ class SecurityCenterClient {
30113011
matchFindingFromFindingName(findingName) {
30123012
return this._pathTemplates.findingPathTemplate.match(findingName).finding;
30133013
}
3014+
3015+
/**
3016+
* Parse the findingSecurityMarksName from a finding_security_marks resource.
3017+
*
3018+
* @param {String} findingSecurityMarksName
3019+
* A fully-qualified path representing a finding_security_marks resources.
3020+
* @returns {String} - A string representing the organization.
3021+
*/
3022+
matchOrganizationFromFindingSecurityMarksName(findingSecurityMarksName) {
3023+
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
3024+
findingSecurityMarksName
3025+
).organization;
3026+
}
3027+
3028+
/**
3029+
* Parse the findingSecurityMarksName from a finding_security_marks resource.
3030+
*
3031+
* @param {String} findingSecurityMarksName
3032+
* A fully-qualified path representing a finding_security_marks resources.
3033+
* @returns {String} - A string representing the source.
3034+
*/
3035+
matchSourceFromFindingSecurityMarksName(findingSecurityMarksName) {
3036+
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
3037+
findingSecurityMarksName
3038+
).source;
3039+
}
3040+
3041+
/**
3042+
* Parse the findingSecurityMarksName from a finding_security_marks resource.
3043+
*
3044+
* @param {String} findingSecurityMarksName
3045+
* A fully-qualified path representing a finding_security_marks resources.
3046+
* @returns {String} - A string representing the finding.
3047+
*/
3048+
matchFindingFromFindingSecurityMarksName(findingSecurityMarksName) {
3049+
return this._pathTemplates.findingSecurityMarksPathTemplate.match(
3050+
findingSecurityMarksName
3051+
).finding;
3052+
}
30143053
}
30153054

30163055
module.exports = SecurityCenterClient;

packages/google-cloud-securitycenter/synth.metadata

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"updateTime": "2019-04-10T11:21:52.927716Z",
2+
"updateTime": "2019-04-11T11:21:27.131524Z",
33
"sources": [
44
{
55
"generator": {
@@ -12,15 +12,15 @@
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "3f57de2fbe951640b587d9c2d503daf554747749",
16-
"internalRef": "242707837"
15+
"sha": "fecf169b1b202e7acd8c0bd3b1d1f5e52747fd63",
16+
"internalRef": "242946317"
1717
}
1818
},
1919
{
2020
"template": {
2121
"name": "node_library",
2222
"origin": "synthtool.gcp",
23-
"version": "2019.2.26"
23+
"version": "2019.4.10"
2424
}
2525
}
2626
],

0 commit comments

Comments
 (0)