diff --git a/protos/google/analytics/admin/v1alpha/resources.proto b/protos/google/analytics/admin/v1alpha/resources.proto index cbb624f..d441d10 100644 --- a/protos/google/analytics/admin/v1alpha/resources.proto +++ b/protos/google/analytics/admin/v1alpha/resources.proto @@ -951,7 +951,7 @@ message GoogleSignalsSettings { message CustomDimension { option (google.api.resource) = { type: "analyticsadmin.googleapis.com/CustomDimension" - pattern: "properties/{property}/customDimensions" + pattern: "properties/{property}/customDimensions/{custom_dimension}" }; // Valid values for the scope of this dimension. @@ -1011,7 +1011,7 @@ message CustomDimension { message CustomMetric { option (google.api.resource) = { type: "analyticsadmin.googleapis.com/CustomMetric" - pattern: "properties/{property}/customMetrics" + pattern: "properties/{property}/customMetrics/{custom_metric}" }; // Possible types of representing the custom metric's value. diff --git a/protos/protos.json b/protos/protos.json index 299f271..1a24bd0 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -3751,7 +3751,7 @@ "CustomDimension": { "options": { "(google.api.resource).type": "analyticsadmin.googleapis.com/CustomDimension", - "(google.api.resource).pattern": "properties/{property}/customDimensions" + "(google.api.resource).pattern": "properties/{property}/customDimensions/{custom_dimension}" }, "fields": { "name": { @@ -3810,7 +3810,7 @@ "CustomMetric": { "options": { "(google.api.resource).type": "analyticsadmin.googleapis.com/CustomMetric", - "(google.api.resource).pattern": "properties/{property}/customMetrics" + "(google.api.resource).pattern": "properties/{property}/customMetrics/{custom_metric}" }, "fields": { "name": { diff --git a/src/v1alpha/analytics_admin_service_client.ts b/src/v1alpha/analytics_admin_service_client.ts index 5ac8959..b3147f5 100644 --- a/src/v1alpha/analytics_admin_service_client.ts +++ b/src/v1alpha/analytics_admin_service_client.ts @@ -178,10 +178,10 @@ export class AnalyticsAdminServiceClient { 'properties/{property}/conversionEvents/{conversion_event}' ), customDimensionPathTemplate: new this._gaxModule.PathTemplate( - 'properties/{property}/customDimensions' + 'properties/{property}/customDimensions/{custom_dimension}' ), customMetricPathTemplate: new this._gaxModule.PathTemplate( - 'properties/{property}/customMetrics' + 'properties/{property}/customMetrics/{custom_metric}' ), dataRetentionSettingsPathTemplate: new this._gaxModule.PathTemplate( 'properties/{property}/dataRetentionSettings' @@ -9512,11 +9512,13 @@ export class AnalyticsAdminServiceClient { * Return a fully-qualified customDimension resource name string. * * @param {string} property + * @param {string} custom_dimension * @returns {string} Resource name string. */ - customDimensionPath(property: string) { + customDimensionPath(property: string, customDimension: string) { return this.pathTemplates.customDimensionPathTemplate.render({ property: property, + custom_dimension: customDimension, }); } @@ -9533,15 +9535,30 @@ export class AnalyticsAdminServiceClient { ).property; } + /** + * Parse the custom_dimension from CustomDimension resource. + * + * @param {string} customDimensionName + * A fully-qualified path representing CustomDimension resource. + * @returns {string} A string representing the custom_dimension. + */ + matchCustomDimensionFromCustomDimensionName(customDimensionName: string) { + return this.pathTemplates.customDimensionPathTemplate.match( + customDimensionName + ).custom_dimension; + } + /** * Return a fully-qualified customMetric resource name string. * * @param {string} property + * @param {string} custom_metric * @returns {string} Resource name string. */ - customMetricPath(property: string) { + customMetricPath(property: string, customMetric: string) { return this.pathTemplates.customMetricPathTemplate.render({ property: property, + custom_metric: customMetric, }); } @@ -9557,6 +9574,18 @@ export class AnalyticsAdminServiceClient { .property; } + /** + * Parse the custom_metric from CustomMetric resource. + * + * @param {string} customMetricName + * A fully-qualified path representing CustomMetric resource. + * @returns {string} A string representing the custom_metric. + */ + matchCustomMetricFromCustomMetricName(customMetricName: string) { + return this.pathTemplates.customMetricPathTemplate.match(customMetricName) + .custom_metric; + } + /** * Return a fully-qualified dataRetentionSettings resource name string. * diff --git a/test/gapic_analytics_admin_service_v1alpha.ts b/test/gapic_analytics_admin_service_v1alpha.ts index ceb7c29..b723fe3 100644 --- a/test/gapic_analytics_admin_service_v1alpha.ts +++ b/test/gapic_analytics_admin_service_v1alpha.ts @@ -12622,6 +12622,7 @@ describe('v1alpha.AnalyticsAdminServiceClient', () => { const fakePath = '/rendered/path/customDimension'; const expectedParameters = { property: 'propertyValue', + custom_dimension: 'customDimensionValue', }; const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ @@ -12637,7 +12638,10 @@ describe('v1alpha.AnalyticsAdminServiceClient', () => { .returns(expectedParameters); it('customDimensionPath', () => { - const result = client.customDimensionPath('propertyValue'); + const result = client.customDimensionPath( + 'propertyValue', + 'customDimensionValue' + ); assert.strictEqual(result, fakePath); assert( (client.pathTemplates.customDimensionPathTemplate.render as SinonStub) @@ -12655,12 +12659,24 @@ describe('v1alpha.AnalyticsAdminServiceClient', () => { .calledWith(fakePath) ); }); + + it('matchCustomDimensionFromCustomDimensionName', () => { + const result = + client.matchCustomDimensionFromCustomDimensionName(fakePath); + assert.strictEqual(result, 'customDimensionValue'); + assert( + (client.pathTemplates.customDimensionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); describe('customMetric', () => { const fakePath = '/rendered/path/customMetric'; const expectedParameters = { property: 'propertyValue', + custom_metric: 'customMetricValue', }; const client = new analyticsadminserviceModule.v1alpha.AnalyticsAdminServiceClient({ @@ -12676,7 +12692,10 @@ describe('v1alpha.AnalyticsAdminServiceClient', () => { .returns(expectedParameters); it('customMetricPath', () => { - const result = client.customMetricPath('propertyValue'); + const result = client.customMetricPath( + 'propertyValue', + 'customMetricValue' + ); assert.strictEqual(result, fakePath); assert( (client.pathTemplates.customMetricPathTemplate.render as SinonStub) @@ -12694,6 +12713,16 @@ describe('v1alpha.AnalyticsAdminServiceClient', () => { .calledWith(fakePath) ); }); + + it('matchCustomMetricFromCustomMetricName', () => { + const result = client.matchCustomMetricFromCustomMetricName(fakePath); + assert.strictEqual(result, 'customMetricValue'); + assert( + (client.pathTemplates.customMetricPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); describe('dataRetentionSettings', () => {