diff --git a/discovery/monitoring-v3.json b/discovery/monitoring-v3.json index da013942bc..75513bd09a 100644 --- a/discovery/monitoring-v3.json +++ b/discovery/monitoring-v3.json @@ -1679,6 +1679,36 @@ "https://www.googleapis.com/auth/monitoring.write" ] }, + "createService": { + "description": "Creates or adds data to one or more service time series. A service time series is a time series for a metric from a Google Cloud service. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response. This endpoint rejects writes to user-defined metrics. This method is only for use by Google Cloud services. Use projects.timeSeries.create instead.", + "flatPath": "v3/projects/{projectsId}/timeSeries:createService", + "httpMethod": "POST", + "id": "monitoring.projects.timeSeries.createService", + "parameterOrder": [ + "name" + ], + "parameters": { + "name": { + "description": "Required. The project (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER] ", + "location": "path", + "pattern": "^projects/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v3/{+name}/timeSeries:createService", + "request": { + "$ref": "CreateTimeSeriesRequest" + }, + "response": { + "$ref": "Empty" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/monitoring.write" + ] + }, "list": { "description": "Lists time series that match a filter. This method does not require a Workspace.", "flatPath": "v3/projects/{projectsId}/timeSeries", @@ -2541,7 +2571,7 @@ } } }, - "revision": "20210830", + "revision": "20210926", "rootUrl": "https://monitoring.googleapis.com/", "schemas": { "Aggregation": { @@ -2726,7 +2756,7 @@ "id": "AlertStrategy", "properties": { "autoClose": { - "description": "If an alert policy that was active has no data for this log, any open incidents will close", + "description": "If an alert policy that was active has no data for this long, any open incidents will close", "format": "google-duration", "type": "string" }, diff --git a/src/apis/monitoring/v3.ts b/src/apis/monitoring/v3.ts index 1c3a8366e8..47c19bf35e 100644 --- a/src/apis/monitoring/v3.ts +++ b/src/apis/monitoring/v3.ts @@ -212,7 +212,7 @@ export namespace monitoring_v3 { */ export interface Schema$AlertStrategy { /** - * If an alert policy that was active has no data for this log, any open incidents will close + * If an alert policy that was active has no data for this long, any open incidents will close */ autoClose?: string | null; /** @@ -7229,6 +7229,145 @@ export namespace monitoring_v3 { } } + /** + * Creates or adds data to one or more service time series. A service time series is a time series for a metric from a Google Cloud service. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response. This endpoint rejects writes to user-defined metrics. This method is only for use by Google Cloud services. Use projects.timeSeries.create instead. + * @example + * ```js + * // Before running the sample: + * // - Enable the API at: + * // https://console.developers.google.com/apis/api/monitoring.googleapis.com + * // - Login into gcloud by running: + * // `$ gcloud auth application-default login` + * // - Install the npm module by running: + * // `$ npm install googleapis` + * + * const {google} = require('googleapis'); + * const monitoring = google.monitoring('v3'); + * + * async function main() { + * const auth = new google.auth.GoogleAuth({ + * // Scopes can be specified either as an array or as a single, space-delimited string. + * scopes: [ + * 'https://www.googleapis.com/auth/cloud-platform', + * 'https://www.googleapis.com/auth/monitoring', + * 'https://www.googleapis.com/auth/monitoring.write', + * ], + * }); + * + * // Acquire an auth client, and bind it to all future calls + * const authClient = await auth.getClient(); + * google.options({auth: authClient}); + * + * // Do the magic + * const res = await monitoring.projects.timeSeries.createService({ + * // Required. The project (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER] + * name: 'projects/my-project', + * + * // Request body metadata + * requestBody: { + * // request body parameters + * // { + * // "timeSeries": [] + * // } + * }, + * }); + * console.log(res.data); + * + * // Example response + * // {} + * } + * + * main().catch(e => { + * console.error(e); + * throw e; + * }); + * + * ``` + * + * @param params - Parameters for request + * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. + * @param callback - Optional callback that handles the response. + * @returns A promise if used with async/await, or void if used with a callback. + */ + createService( + params: Params$Resource$Projects$Timeseries$Createservice, + options: StreamMethodOptions + ): GaxiosPromise; + createService( + params?: Params$Resource$Projects$Timeseries$Createservice, + options?: MethodOptions + ): GaxiosPromise; + createService( + params: Params$Resource$Projects$Timeseries$Createservice, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + createService( + params: Params$Resource$Projects$Timeseries$Createservice, + options: MethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + createService( + params: Params$Resource$Projects$Timeseries$Createservice, + callback: BodyResponseCallback + ): void; + createService(callback: BodyResponseCallback): void; + createService( + paramsOrCallback?: + | Params$Resource$Projects$Timeseries$Createservice + | BodyResponseCallback + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback + | BodyResponseCallback, + callback?: + | BodyResponseCallback + | BodyResponseCallback + ): void | GaxiosPromise | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Projects$Timeseries$Createservice; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Projects$Timeseries$Createservice; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = options.rootUrl || 'https://monitoring.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v3/{+name}/timeSeries:createService').replace( + /([^:]\/)\/+/g, + '$1' + ), + method: 'POST', + }, + options + ), + params, + requiredParams: ['name'], + pathParams: ['name'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback + ); + } else { + return createAPIRequest(parameters); + } + } + /** * Lists time series that match a filter. This method does not require a Workspace. * @example @@ -7564,6 +7703,18 @@ export namespace monitoring_v3 { */ requestBody?: Schema$CreateTimeSeriesRequest; } + export interface Params$Resource$Projects$Timeseries$Createservice + extends StandardParameters { + /** + * Required. The project (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER] + */ + name?: string; + + /** + * Request body metadata + */ + requestBody?: Schema$CreateTimeSeriesRequest; + } export interface Params$Resource$Projects$Timeseries$List extends StandardParameters { /**