com.google.api.services.cloudmonitoring.CloudMonitoring Maven / Gradle / Ivy
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/google/apis-client-generator/
* (build: 2015-11-16 19:10:01 UTC)
* on 2015-11-24 at 20:02:01 UTC
* Modify at your own risk.
*/
package com.google.api.services.cloudmonitoring;
/**
* Service definition for CloudMonitoring (v2beta2).
*
*
* API for accessing Google Cloud and API monitoring data.
*
*
*
* For more information about this service, see the
* API Documentation
*
*
*
* This service uses {@link CloudMonitoringRequestInitializer} to initialize global parameters via its
* {@link Builder}.
*
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class CloudMonitoring extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.21.0 of the Cloud Monitoring API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://www.googleapis.com/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "cloudmonitoring/v2beta2/projects/";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
*
* Use {@link Builder} if you need to specify any of the optional parameters.
*
*
* @param transport HTTP transport, which should normally be:
*
* - Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}
* - Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}
* - Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
*
*
* @param jsonFactory JSON factory, which may be:
*
* - Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}
* - Google GSON: {@code com.google.api.client.json.gson.GsonFactory}
* - Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}
*
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public CloudMonitoring(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
CloudMonitoring(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the MetricDescriptors collection.
*
* The typical use is:
*
* {@code CloudMonitoring cloudmonitoring = new CloudMonitoring(...);}
* {@code CloudMonitoring.MetricDescriptors.List request = cloudmonitoring.metricDescriptors().list(parameters ...)}
*
*
* @return the resource collection
*/
public MetricDescriptors metricDescriptors() {
return new MetricDescriptors();
}
/**
* The "metricDescriptors" collection of methods.
*/
public class MetricDescriptors {
/**
* Create a new metric.
*
* Create a request for the method "metricDescriptors.create".
*
* This request holds the parameters needed by the cloudmonitoring server. After setting any
* optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
*
* @param project The project id. The value can be the numeric project ID or string-based project name.
* @param content the {@link com.google.api.services.cloudmonitoring.model.MetricDescriptor}
* @return the request
*/
public Create create(java.lang.String project, com.google.api.services.cloudmonitoring.model.MetricDescriptor content) throws java.io.IOException {
Create result = new Create(project, content);
initialize(result);
return result;
}
public class Create extends CloudMonitoringRequest {
private static final String REST_PATH = "{project}/metricDescriptors";
/**
* Create a new metric.
*
* Create a request for the method "metricDescriptors.create".
*
* This request holds the parameters needed by the the cloudmonitoring server. After setting any
* optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
* {@link
* Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param project The project id. The value can be the numeric project ID or string-based project name.
* @param content the {@link com.google.api.services.cloudmonitoring.model.MetricDescriptor}
* @since 1.13
*/
protected Create(java.lang.String project, com.google.api.services.cloudmonitoring.model.MetricDescriptor content) {
super(CloudMonitoring.this, "POST", REST_PATH, content, com.google.api.services.cloudmonitoring.model.MetricDescriptor.class);
this.project = com.google.api.client.util.Preconditions.checkNotNull(project, "Required parameter project must be specified.");
}
@Override
public Create setAlt(java.lang.String alt) {
return (Create) super.setAlt(alt);
}
@Override
public Create setFields(java.lang.String fields) {
return (Create) super.setFields(fields);
}
@Override
public Create setKey(java.lang.String key) {
return (Create) super.setKey(key);
}
@Override
public Create setOauthToken(java.lang.String oauthToken) {
return (Create) super.setOauthToken(oauthToken);
}
@Override
public Create setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Create) super.setPrettyPrint(prettyPrint);
}
@Override
public Create setQuotaUser(java.lang.String quotaUser) {
return (Create) super.setQuotaUser(quotaUser);
}
@Override
public Create setUserIp(java.lang.String userIp) {
return (Create) super.setUserIp(userIp);
}
/** The project id. The value can be the numeric project ID or string-based project name. */
@com.google.api.client.util.Key
private java.lang.String project;
/** The project id. The value can be the numeric project ID or string-based project name.
*/
public java.lang.String getProject() {
return project;
}
/** The project id. The value can be the numeric project ID or string-based project name. */
public Create setProject(java.lang.String project) {
this.project = project;
return this;
}
@Override
public Create set(String parameterName, Object value) {
return (Create) super.set(parameterName, value);
}
}
/**
* Delete an existing metric.
*
* Create a request for the method "metricDescriptors.delete".
*
* This request holds the parameters needed by the cloudmonitoring server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param project The project ID to which the metric belongs.
* @param metric Name of the metric.
* @return the request
*/
public Delete delete(java.lang.String project, java.lang.String metric) throws java.io.IOException {
Delete result = new Delete(project, metric);
initialize(result);
return result;
}
public class Delete extends CloudMonitoringRequest {
private static final String REST_PATH = "{project}/metricDescriptors/{metric}";
/**
* Delete an existing metric.
*
* Create a request for the method "metricDescriptors.delete".
*
* This request holds the parameters needed by the the cloudmonitoring server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param project The project ID to which the metric belongs.
* @param metric Name of the metric.
* @since 1.13
*/
protected Delete(java.lang.String project, java.lang.String metric) {
super(CloudMonitoring.this, "DELETE", REST_PATH, null, com.google.api.services.cloudmonitoring.model.DeleteMetricDescriptorResponse.class);
this.project = com.google.api.client.util.Preconditions.checkNotNull(project, "Required parameter project must be specified.");
this.metric = com.google.api.client.util.Preconditions.checkNotNull(metric, "Required parameter metric must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/** The project ID to which the metric belongs. */
@com.google.api.client.util.Key
private java.lang.String project;
/** The project ID to which the metric belongs.
*/
public java.lang.String getProject() {
return project;
}
/** The project ID to which the metric belongs. */
public Delete setProject(java.lang.String project) {
this.project = project;
return this;
}
/** Name of the metric. */
@com.google.api.client.util.Key
private java.lang.String metric;
/** Name of the metric.
*/
public java.lang.String getMetric() {
return metric;
}
/** Name of the metric. */
public Delete setMetric(java.lang.String metric) {
this.metric = metric;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* List metric descriptors that match the query. If the query is not set, then all of the metric
* descriptors will be returned. Large responses will be paginated, use the nextPageToken returned
* in the response to request subsequent pages of results by setting the pageToken query parameter
* to the value of the nextPageToken.
*
* Create a request for the method "metricDescriptors.list".
*
* This request holds the parameters needed by the cloudmonitoring server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param project The project id. The value can be the numeric project ID or string-based project name.
* @return the request
*/
public List list(java.lang.String project) throws java.io.IOException {
List result = new List(project);
initialize(result);
return result;
}
public class List extends CloudMonitoringRequest {
private static final String REST_PATH = "{project}/metricDescriptors";
/**
* List metric descriptors that match the query. If the query is not set, then all of the metric
* descriptors will be returned. Large responses will be paginated, use the nextPageToken returned
* in the response to request subsequent pages of results by setting the pageToken query parameter
* to the value of the nextPageToken.
*
* Create a request for the method "metricDescriptors.list".
*
* This request holds the parameters needed by the the cloudmonitoring server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param project The project id. The value can be the numeric project ID or string-based project name.
* @since 1.13
*/
protected List(java.lang.String project) {
super(CloudMonitoring.this, "GET", REST_PATH, null, com.google.api.services.cloudmonitoring.model.ListMetricDescriptorsResponse.class);
this.project = com.google.api.client.util.Preconditions.checkNotNull(project, "Required parameter project must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/** The project id. The value can be the numeric project ID or string-based project name. */
@com.google.api.client.util.Key
private java.lang.String project;
/** The project id. The value can be the numeric project ID or string-based project name.
*/
public java.lang.String getProject() {
return project;
}
/** The project id. The value can be the numeric project ID or string-based project name. */
public List setProject(java.lang.String project) {
this.project = project;
return this;
}
/**
* Maximum number of metric descriptors per page. Used for pagination. If not specified, count
* = 100.
*/
@com.google.api.client.util.Key
private java.lang.Integer count;
/** Maximum number of metric descriptors per page. Used for pagination. If not specified, count = 100.
[default: 100] [minimum: 1] [maximum: 1000]
*/
public java.lang.Integer getCount() {
return count;
}
/**
* Maximum number of metric descriptors per page. Used for pagination. If not specified, count
* = 100.
*/
public List setCount(java.lang.Integer count) {
this.count = count;
return this;
}
/**
* The pagination token, which is used to page through large result sets. Set this value to
* the value of the nextPageToken to retrieve the next page of results.
*/
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** The pagination token, which is used to page through large result sets. Set this value to the value
of the nextPageToken to retrieve the next page of results.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/**
* The pagination token, which is used to page through large result sets. Set this value to
* the value of the nextPageToken to retrieve the next page of results.
*/
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* The query used to search against existing metrics. Separate keywords with a space; the
* service joins all keywords with AND, meaning that all keywords must match for a metric to
* be returned. If this field is omitted, all metrics are returned. If an empty string is
* passed with this field, no metrics are returned.
*/
@com.google.api.client.util.Key
private java.lang.String query;
/** The query used to search against existing metrics. Separate keywords with a space; the service
joins all keywords with AND, meaning that all keywords must match for a metric to be returned. If
this field is omitted, all metrics are returned. If an empty string is passed with this field, no
metrics are returned.
*/
public java.lang.String getQuery() {
return query;
}
/**
* The query used to search against existing metrics. Separate keywords with a space; the
* service joins all keywords with AND, meaning that all keywords must match for a metric to
* be returned. If this field is omitted, all metrics are returned. If an empty string is
* passed with this field, no metrics are returned.
*/
public List setQuery(java.lang.String query) {
this.query = query;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Timeseries collection.
*
* The typical use is:
*
* {@code CloudMonitoring cloudmonitoring = new CloudMonitoring(...);}
* {@code CloudMonitoring.Timeseries.List request = cloudmonitoring.timeseries().list(parameters ...)}
*
*
* @return the resource collection
*/
public Timeseries timeseries() {
return new Timeseries();
}
/**
* The "timeseries" collection of methods.
*/
public class Timeseries {
/**
* List the data points of the time series that match the metric and labels values and that have
* data points in the interval. Large responses are paginated; use the nextPageToken returned in the
* response to request subsequent pages of results by setting the pageToken query parameter to the
* value of the nextPageToken.
*
* Create a request for the method "timeseries.list".
*
* This request holds the parameters needed by the cloudmonitoring server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param project The project ID to which this time series belongs. The value can be the numeric project ID or string-
* based project name.
* @param metric Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
* @param youngest End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.
* @return the request
*/
public List list(java.lang.String project, java.lang.String metric, java.lang.String youngest) throws java.io.IOException {
List result = new List(project, metric, youngest);
initialize(result);
return result;
}
public class List extends CloudMonitoringRequest {
private static final String REST_PATH = "{project}/timeseries/{metric}";
private final java.util.regex.Pattern TIMESPAN_PATTERN =
java.util.regex.Pattern.compile("[0-9]+[smhdw]?");
private final java.util.regex.Pattern LABELS_PATTERN =
java.util.regex.Pattern.compile("(.+?)(==|=~|!=|!~)(.+)");
private final java.util.regex.Pattern WINDOW_PATTERN =
java.util.regex.Pattern.compile("[0-9]+[mhdw]?");
/**
* List the data points of the time series that match the metric and labels values and that have
* data points in the interval. Large responses are paginated; use the nextPageToken returned in
* the response to request subsequent pages of results by setting the pageToken query parameter to
* the value of the nextPageToken.
*
* Create a request for the method "timeseries.list".
*
* This request holds the parameters needed by the the cloudmonitoring server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param project The project ID to which this time series belongs. The value can be the numeric project ID or string-
* based project name.
* @param metric Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
* @param youngest End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.
* @since 1.13
*/
protected List(java.lang.String project, java.lang.String metric, java.lang.String youngest) {
super(CloudMonitoring.this, "GET", REST_PATH, null, com.google.api.services.cloudmonitoring.model.ListTimeseriesResponse.class);
this.project = com.google.api.client.util.Preconditions.checkNotNull(project, "Required parameter project must be specified.");
this.metric = com.google.api.client.util.Preconditions.checkNotNull(metric, "Required parameter metric must be specified.");
this.youngest = com.google.api.client.util.Preconditions.checkNotNull(youngest, "Required parameter youngest must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* The project ID to which this time series belongs. The value can be the numeric project ID
* or string-based project name.
*/
@com.google.api.client.util.Key
private java.lang.String project;
/** The project ID to which this time series belongs. The value can be the numeric project ID or
string-based project name.
*/
public java.lang.String getProject() {
return project;
}
/**
* The project ID to which this time series belongs. The value can be the numeric project ID
* or string-based project name.
*/
public List setProject(java.lang.String project) {
this.project = project;
return this;
}
/**
* Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
*/
@com.google.api.client.util.Key
private java.lang.String metric;
/** Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
compute.googleapis.com/instance/disk/read_ops_count.
*/
public java.lang.String getMetric() {
return metric;
}
/**
* Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
*/
public List setMetric(java.lang.String metric) {
this.metric = metric;
return this;
}
/** End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp. */
@com.google.api.client.util.Key
private java.lang.String youngest;
/** End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.
*/
public java.lang.String getYoungest() {
return youngest;
}
/** End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp. */
public List setYoungest(java.lang.String youngest) {
this.youngest = youngest;
return this;
}
/** Maximum number of data points per page, which is used for pagination of results. */
@com.google.api.client.util.Key
private java.lang.Integer count;
/** Maximum number of data points per page, which is used for pagination of results. [default: 6000]
[minimum: 1] [maximum: 12000]
*/
public java.lang.Integer getCount() {
return count;
}
/** Maximum number of data points per page, which is used for pagination of results. */
public List setCount(java.lang.Integer count) {
this.count = count;
return this;
}
/**
* Length of the time interval to query, which is an alternative way to declare the interval:
* (youngest - timespan, youngest]. The timespan and oldest parameters should not be used
* together. Units: - s: second - m: minute - h: hour - d: day - w: week Examples: 2s, 3m,
* 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.
*
* If neither oldest nor timespan is specified, the default time interval will be (youngest -
* 4 hours, youngest].
*/
@com.google.api.client.util.Key
private java.lang.String timespan;
/** Length of the time interval to query, which is an alternative way to declare the interval:
(youngest - timespan, youngest]. The timespan and oldest parameters should not be used together.
Units: - s: second - m: minute - h: hour - d: day - w: week Examples: 2s, 3m, 4w. Only one unit is
allowed, for example: 2w3d is not allowed; you should use 17d instead.
If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours,
youngest].
*/
public java.lang.String getTimespan() {
return timespan;
}
/**
* Length of the time interval to query, which is an alternative way to declare the interval:
* (youngest - timespan, youngest]. The timespan and oldest parameters should not be used
* together. Units: - s: second - m: minute - h: hour - d: day - w: week Examples: 2s, 3m,
* 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.
*
* If neither oldest nor timespan is specified, the default time interval will be (youngest -
* 4 hours, youngest].
*/
public List setTimespan(java.lang.String timespan) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(TIMESPAN_PATTERN.matcher(timespan).matches(),
"Parameter timespan must conform to the pattern " +
"[0-9]+[smhdw]?");
}
this.timespan = timespan;
return this;
}
/**
* The aggregation function that will reduce the data points in each window to a single point.
* This parameter is only valid for non-cumulative metrics with a value type of INT64 or
* DOUBLE.
*/
@com.google.api.client.util.Key
private java.lang.String aggregator;
/** The aggregation function that will reduce the data points in each window to a single point. This
parameter is only valid for non-cumulative metrics with a value type of INT64 or DOUBLE.
*/
public java.lang.String getAggregator() {
return aggregator;
}
/**
* The aggregation function that will reduce the data points in each window to a single point.
* This parameter is only valid for non-cumulative metrics with a value type of INT64 or
* DOUBLE.
*/
public List setAggregator(java.lang.String aggregator) {
this.aggregator = aggregator;
return this;
}
/**
* A collection of labels for the matching time series, which are represented as: -
* key==value: key equals the value - key=~value: key regex matches the value - key!=value:
* key does not equal the value - key!~value: key regex does not match the value For example,
* to list all of the time series descriptors for the region us-central1, you could specify:
* label=cloud.googleapis.com%2Flocation=~us-central1.*
*/
@com.google.api.client.util.Key
private java.util.List labels;
/** A collection of labels for the matching time series, which are represented as: - key==value: key
equals the value - key=~value: key regex matches the value - key!=value: key does not equal the
value - key!~value: key regex does not match the value For example, to list all of the time series
descriptors for the region us-central1, you could specify: label=cloud.googleapis.com%2Flocation
=~us-central1.*
*/
public java.util.List getLabels() {
return labels;
}
/**
* A collection of labels for the matching time series, which are represented as: -
* key==value: key equals the value - key=~value: key regex matches the value - key!=value:
* key does not equal the value - key!~value: key regex does not match the value For example,
* to list all of the time series descriptors for the region us-central1, you could specify:
* label=cloud.googleapis.com%2Flocation=~us-central1.*
*/
public List setLabels(java.util.List labels) {
if (!getSuppressPatternChecks()) {
for (String labelsElem : labels) {
com.google.api.client.util.Preconditions.checkArgument(LABELS_PATTERN.matcher(labelsElem).matches(),
"Parameter labels elements must conform to the pattern " +
"(.+?)(==|=~|!=|!~)(.+)");
}
}
this.labels = labels;
return this;
}
/**
* The pagination token, which is used to page through large result sets. Set this value to
* the value of the nextPageToken to retrieve the next page of results.
*/
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** The pagination token, which is used to page through large result sets. Set this value to the value
of the nextPageToken to retrieve the next page of results.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/**
* The pagination token, which is used to page through large result sets. Set this value to
* the value of the nextPageToken to retrieve the next page of results.
*/
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* The sampling window. At most one data point will be returned for each window in the
* requested time interval. This parameter is only valid for non-cumulative metric types.
* Units: - m: minute - h: hour - d: day - w: week Examples: 3m, 4w. Only one unit is
* allowed, for example: 2w3d is not allowed; you should use 17d instead.
*/
@com.google.api.client.util.Key
private java.lang.String window;
/** The sampling window. At most one data point will be returned for each window in the requested time
interval. This parameter is only valid for non-cumulative metric types. Units: - m: minute - h:
hour - d: day - w: week Examples: 3m, 4w. Only one unit is allowed, for example: 2w3d is not
allowed; you should use 17d instead.
*/
public java.lang.String getWindow() {
return window;
}
/**
* The sampling window. At most one data point will be returned for each window in the
* requested time interval. This parameter is only valid for non-cumulative metric types.
* Units: - m: minute - h: hour - d: day - w: week Examples: 3m, 4w. Only one unit is
* allowed, for example: 2w3d is not allowed; you should use 17d instead.
*/
public List setWindow(java.lang.String window) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(WINDOW_PATTERN.matcher(window).matches(),
"Parameter window must conform to the pattern " +
"[0-9]+[mhdw]?");
}
this.window = window;
return this;
}
/**
* Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If
* neither oldest nor timespan is specified, the default time interval will be (youngest - 4
* hours, youngest]
*/
@com.google.api.client.util.Key
private java.lang.String oldest;
/** Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If neither
oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest]
*/
public java.lang.String getOldest() {
return oldest;
}
/**
* Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If
* neither oldest nor timespan is specified, the default time interval will be (youngest - 4
* hours, youngest]
*/
public List setOldest(java.lang.String oldest) {
this.oldest = oldest;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Put data points to one or more time series for one or more metrics. If a time series does not
* exist, a new time series will be created. It is not allowed to write a time series point that is
* older than the existing youngest point of that time series. Points that are older than the
* existing youngest point of that time series will be discarded silently. Therefore, users should
* make sure that points of a time series are written sequentially in the order of their end time.
*
* Create a request for the method "timeseries.write".
*
* This request holds the parameters needed by the cloudmonitoring server. After setting any
* optional parameters, call the {@link Write#execute()} method to invoke the remote operation.
*
* @param project The project ID. The value can be the numeric project ID or string-based project name.
* @param content the {@link com.google.api.services.cloudmonitoring.model.WriteTimeseriesRequest}
* @return the request
*/
public Write write(java.lang.String project, com.google.api.services.cloudmonitoring.model.WriteTimeseriesRequest content) throws java.io.IOException {
Write result = new Write(project, content);
initialize(result);
return result;
}
public class Write extends CloudMonitoringRequest {
private static final String REST_PATH = "{project}/timeseries:write";
/**
* Put data points to one or more time series for one or more metrics. If a time series does not
* exist, a new time series will be created. It is not allowed to write a time series point that
* is older than the existing youngest point of that time series. Points that are older than the
* existing youngest point of that time series will be discarded silently. Therefore, users should
* make sure that points of a time series are written sequentially in the order of their end time.
*
* Create a request for the method "timeseries.write".
*
* This request holds the parameters needed by the the cloudmonitoring server. After setting any
* optional parameters, call the {@link Write#execute()} method to invoke the remote operation.
* {@link
* Write#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param project The project ID. The value can be the numeric project ID or string-based project name.
* @param content the {@link com.google.api.services.cloudmonitoring.model.WriteTimeseriesRequest}
* @since 1.13
*/
protected Write(java.lang.String project, com.google.api.services.cloudmonitoring.model.WriteTimeseriesRequest content) {
super(CloudMonitoring.this, "POST", REST_PATH, content, com.google.api.services.cloudmonitoring.model.WriteTimeseriesResponse.class);
this.project = com.google.api.client.util.Preconditions.checkNotNull(project, "Required parameter project must be specified.");
}
@Override
public Write setAlt(java.lang.String alt) {
return (Write) super.setAlt(alt);
}
@Override
public Write setFields(java.lang.String fields) {
return (Write) super.setFields(fields);
}
@Override
public Write setKey(java.lang.String key) {
return (Write) super.setKey(key);
}
@Override
public Write setOauthToken(java.lang.String oauthToken) {
return (Write) super.setOauthToken(oauthToken);
}
@Override
public Write setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Write) super.setPrettyPrint(prettyPrint);
}
@Override
public Write setQuotaUser(java.lang.String quotaUser) {
return (Write) super.setQuotaUser(quotaUser);
}
@Override
public Write setUserIp(java.lang.String userIp) {
return (Write) super.setUserIp(userIp);
}
/** The project ID. The value can be the numeric project ID or string-based project name. */
@com.google.api.client.util.Key
private java.lang.String project;
/** The project ID. The value can be the numeric project ID or string-based project name.
*/
public java.lang.String getProject() {
return project;
}
/** The project ID. The value can be the numeric project ID or string-based project name. */
public Write setProject(java.lang.String project) {
this.project = project;
return this;
}
@Override
public Write set(String parameterName, Object value) {
return (Write) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the TimeseriesDescriptors collection.
*
* The typical use is:
*
* {@code CloudMonitoring cloudmonitoring = new CloudMonitoring(...);}
* {@code CloudMonitoring.TimeseriesDescriptors.List request = cloudmonitoring.timeseriesDescriptors().list(parameters ...)}
*
*
* @return the resource collection
*/
public TimeseriesDescriptors timeseriesDescriptors() {
return new TimeseriesDescriptors();
}
/**
* The "timeseriesDescriptors" collection of methods.
*/
public class TimeseriesDescriptors {
/**
* List the descriptors of the time series that match the metric and labels values and that have
* data points in the interval. Large responses are paginated; use the nextPageToken returned in the
* response to request subsequent pages of results by setting the pageToken query parameter to the
* value of the nextPageToken.
*
* Create a request for the method "timeseriesDescriptors.list".
*
* This request holds the parameters needed by the cloudmonitoring server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param project The project ID to which this time series belongs. The value can be the numeric project ID or string-
* based project name.
* @param metric Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
* @param youngest End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.
* @return the request
*/
public List list(java.lang.String project, java.lang.String metric, java.lang.String youngest) throws java.io.IOException {
List result = new List(project, metric, youngest);
initialize(result);
return result;
}
public class List extends CloudMonitoringRequest {
private static final String REST_PATH = "{project}/timeseriesDescriptors/{metric}";
private final java.util.regex.Pattern TIMESPAN_PATTERN =
java.util.regex.Pattern.compile("[0-9]+[smhdw]?");
private final java.util.regex.Pattern LABELS_PATTERN =
java.util.regex.Pattern.compile("(.+?)(==|=~|!=|!~)(.+)");
private final java.util.regex.Pattern WINDOW_PATTERN =
java.util.regex.Pattern.compile("[0-9]+[mhdw]?");
/**
* List the descriptors of the time series that match the metric and labels values and that have
* data points in the interval. Large responses are paginated; use the nextPageToken returned in
* the response to request subsequent pages of results by setting the pageToken query parameter to
* the value of the nextPageToken.
*
* Create a request for the method "timeseriesDescriptors.list".
*
* This request holds the parameters needed by the the cloudmonitoring server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param project The project ID to which this time series belongs. The value can be the numeric project ID or string-
* based project name.
* @param metric Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
* @param youngest End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.
* @since 1.13
*/
protected List(java.lang.String project, java.lang.String metric, java.lang.String youngest) {
super(CloudMonitoring.this, "GET", REST_PATH, null, com.google.api.services.cloudmonitoring.model.ListTimeseriesDescriptorsResponse.class);
this.project = com.google.api.client.util.Preconditions.checkNotNull(project, "Required parameter project must be specified.");
this.metric = com.google.api.client.util.Preconditions.checkNotNull(metric, "Required parameter metric must be specified.");
this.youngest = com.google.api.client.util.Preconditions.checkNotNull(youngest, "Required parameter youngest must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/**
* The project ID to which this time series belongs. The value can be the numeric project ID
* or string-based project name.
*/
@com.google.api.client.util.Key
private java.lang.String project;
/** The project ID to which this time series belongs. The value can be the numeric project ID or
string-based project name.
*/
public java.lang.String getProject() {
return project;
}
/**
* The project ID to which this time series belongs. The value can be the numeric project ID
* or string-based project name.
*/
public List setProject(java.lang.String project) {
this.project = project;
return this;
}
/**
* Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
*/
@com.google.api.client.util.Key
private java.lang.String metric;
/** Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
compute.googleapis.com/instance/disk/read_ops_count.
*/
public java.lang.String getMetric() {
return metric;
}
/**
* Metric names are protocol-free URLs as listed in the Supported Metrics page. For example,
* compute.googleapis.com/instance/disk/read_ops_count.
*/
public List setMetric(java.lang.String metric) {
this.metric = metric;
return this;
}
/** End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp. */
@com.google.api.client.util.Key
private java.lang.String youngest;
/** End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.
*/
public java.lang.String getYoungest() {
return youngest;
}
/** End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp. */
public List setYoungest(java.lang.String youngest) {
this.youngest = youngest;
return this;
}
/**
* Maximum number of time series descriptors per page. Used for pagination. If not specified,
* count = 100.
*/
@com.google.api.client.util.Key
private java.lang.Integer count;
/** Maximum number of time series descriptors per page. Used for pagination. If not specified, count =
100. [default: 100] [minimum: 1] [maximum: 1000]
*/
public java.lang.Integer getCount() {
return count;
}
/**
* Maximum number of time series descriptors per page. Used for pagination. If not specified,
* count = 100.
*/
public List setCount(java.lang.Integer count) {
this.count = count;
return this;
}
/**
* Length of the time interval to query, which is an alternative way to declare the interval:
* (youngest - timespan, youngest]. The timespan and oldest parameters should not be used
* together. Units: - s: second - m: minute - h: hour - d: day - w: week Examples: 2s, 3m,
* 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.
*
* If neither oldest nor timespan is specified, the default time interval will be (youngest -
* 4 hours, youngest].
*/
@com.google.api.client.util.Key
private java.lang.String timespan;
/** Length of the time interval to query, which is an alternative way to declare the interval:
(youngest - timespan, youngest]. The timespan and oldest parameters should not be used together.
Units: - s: second - m: minute - h: hour - d: day - w: week Examples: 2s, 3m, 4w. Only one unit is
allowed, for example: 2w3d is not allowed; you should use 17d instead.
If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours,
youngest].
*/
public java.lang.String getTimespan() {
return timespan;
}
/**
* Length of the time interval to query, which is an alternative way to declare the interval:
* (youngest - timespan, youngest]. The timespan and oldest parameters should not be used
* together. Units: - s: second - m: minute - h: hour - d: day - w: week Examples: 2s, 3m,
* 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.
*
* If neither oldest nor timespan is specified, the default time interval will be (youngest -
* 4 hours, youngest].
*/
public List setTimespan(java.lang.String timespan) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(TIMESPAN_PATTERN.matcher(timespan).matches(),
"Parameter timespan must conform to the pattern " +
"[0-9]+[smhdw]?");
}
this.timespan = timespan;
return this;
}
/**
* The aggregation function that will reduce the data points in each window to a single point.
* This parameter is only valid for non-cumulative metrics with a value type of INT64 or
* DOUBLE.
*/
@com.google.api.client.util.Key
private java.lang.String aggregator;
/** The aggregation function that will reduce the data points in each window to a single point. This
parameter is only valid for non-cumulative metrics with a value type of INT64 or DOUBLE.
*/
public java.lang.String getAggregator() {
return aggregator;
}
/**
* The aggregation function that will reduce the data points in each window to a single point.
* This parameter is only valid for non-cumulative metrics with a value type of INT64 or
* DOUBLE.
*/
public List setAggregator(java.lang.String aggregator) {
this.aggregator = aggregator;
return this;
}
/**
* A collection of labels for the matching time series, which are represented as: -
* key==value: key equals the value - key=~value: key regex matches the value - key!=value:
* key does not equal the value - key!~value: key regex does not match the value For example,
* to list all of the time series descriptors for the region us-central1, you could specify:
* label=cloud.googleapis.com%2Flocation=~us-central1.*
*/
@com.google.api.client.util.Key
private java.util.List labels;
/** A collection of labels for the matching time series, which are represented as: - key==value: key
equals the value - key=~value: key regex matches the value - key!=value: key does not equal the
value - key!~value: key regex does not match the value For example, to list all of the time series
descriptors for the region us-central1, you could specify: label=cloud.googleapis.com%2Flocation
=~us-central1.*
*/
public java.util.List getLabels() {
return labels;
}
/**
* A collection of labels for the matching time series, which are represented as: -
* key==value: key equals the value - key=~value: key regex matches the value - key!=value:
* key does not equal the value - key!~value: key regex does not match the value For example,
* to list all of the time series descriptors for the region us-central1, you could specify:
* label=cloud.googleapis.com%2Flocation=~us-central1.*
*/
public List setLabels(java.util.List labels) {
if (!getSuppressPatternChecks()) {
for (String labelsElem : labels) {
com.google.api.client.util.Preconditions.checkArgument(LABELS_PATTERN.matcher(labelsElem).matches(),
"Parameter labels elements must conform to the pattern " +
"(.+?)(==|=~|!=|!~)(.+)");
}
}
this.labels = labels;
return this;
}
/**
* The pagination token, which is used to page through large result sets. Set this value to
* the value of the nextPageToken to retrieve the next page of results.
*/
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** The pagination token, which is used to page through large result sets. Set this value to the value
of the nextPageToken to retrieve the next page of results.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/**
* The pagination token, which is used to page through large result sets. Set this value to
* the value of the nextPageToken to retrieve the next page of results.
*/
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* The sampling window. At most one data point will be returned for each window in the
* requested time interval. This parameter is only valid for non-cumulative metric types.
* Units: - m: minute - h: hour - d: day - w: week Examples: 3m, 4w. Only one unit is
* allowed, for example: 2w3d is not allowed; you should use 17d instead.
*/
@com.google.api.client.util.Key
private java.lang.String window;
/** The sampling window. At most one data point will be returned for each window in the requested time
interval. This parameter is only valid for non-cumulative metric types. Units: - m: minute - h:
hour - d: day - w: week Examples: 3m, 4w. Only one unit is allowed, for example: 2w3d is not
allowed; you should use 17d instead.
*/
public java.lang.String getWindow() {
return window;
}
/**
* The sampling window. At most one data point will be returned for each window in the
* requested time interval. This parameter is only valid for non-cumulative metric types.
* Units: - m: minute - h: hour - d: day - w: week Examples: 3m, 4w. Only one unit is
* allowed, for example: 2w3d is not allowed; you should use 17d instead.
*/
public List setWindow(java.lang.String window) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(WINDOW_PATTERN.matcher(window).matches(),
"Parameter window must conform to the pattern " +
"[0-9]+[mhdw]?");
}
this.window = window;
return this;
}
/**
* Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If
* neither oldest nor timespan is specified, the default time interval will be (youngest - 4
* hours, youngest]
*/
@com.google.api.client.util.Key
private java.lang.String oldest;
/** Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If neither
oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest]
*/
public java.lang.String getOldest() {
return oldest;
}
/**
* Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If
* neither oldest nor timespan is specified, the default time interval will be (youngest - 4
* hours, youngest]
*/
public List setOldest(java.lang.String oldest) {
this.oldest = oldest;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
/**
* Builder for {@link CloudMonitoring}.
*
*
* Implementation is not thread-safe.
*
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
*
* - Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}
* - Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}
* - Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
*
*
* @param jsonFactory JSON factory, which may be:
*
* - Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}
* - Google GSON: {@code com.google.api.client.json.gson.GsonFactory}
* - Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}
*
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
}
/** Builds a new instance of {@link CloudMonitoring}. */
@Override
public CloudMonitoring build() {
return new CloudMonitoring(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link CloudMonitoringRequestInitializer}.
*
* @since 1.12
*/
public Builder setCloudMonitoringRequestInitializer(
CloudMonitoringRequestInitializer cloudmonitoringRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(cloudmonitoringRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}