com.google.api.services.tracing.v2.Tracing 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: 2017-02-15 17:18:02 UTC)
* on 2017-05-17 at 20:21:11 UTC
* Modify at your own risk.
*/
package com.google.api.services.tracing.v2;
/**
* Service definition for Tracing (v2).
*
*
* Send and retrieve trace data from Google Stackdriver Trace.
*
*
*
* For more information about this service, see the
* API Documentation
*
*
*
* This service uses {@link TracingRequestInitializer} to initialize global parameters via its
* {@link Builder}.
*
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class Tracing 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.22.0 of the Google Tracing 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://tracing.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 = "";
/**
* 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 Tracing(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
*/
Tracing(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 Projects collection.
*
* The typical use is:
*
* {@code Tracing tracing = new Tracing(...);}
* {@code Tracing.Projects.List request = tracing.projects().list(parameters ...)}
*
*
* @return the resource collection
*/
public Projects projects() {
return new Projects();
}
/**
* The "projects" collection of methods.
*/
public class Projects {
/**
* An accessor for creating requests from the Traces collection.
*
* The typical use is:
*
* {@code Tracing tracing = new Tracing(...);}
* {@code Tracing.Traces.List request = tracing.traces().list(parameters ...)}
*
*
* @return the resource collection
*/
public Traces traces() {
return new Traces();
}
/**
* The "traces" collection of methods.
*/
public class Traces {
/**
* Sends new spans to Stackdriver Trace or updates existing traces. If the name of a trace that you
* send matches that of an existing trace, new spans are added to the existing trace. Attempt to
* update existing spans results undefined behavior. If the name does not match, a new trace is
* created with given set of spans.
*
* Create a request for the method "traces.batchWrite".
*
* This request holds the parameters needed by the tracing server. After setting any optional
* parameters, call the {@link BatchWrite#execute()} method to invoke the remote operation.
*
* @param name Name of the project where the spans belong to. Format is
`projects/PROJECT_ID`.
* @param content the {@link com.google.api.services.tracing.v2.model.BatchWriteSpansRequest}
* @return the request
*/
public BatchWrite batchWrite(java.lang.String name, com.google.api.services.tracing.v2.model.BatchWriteSpansRequest content) throws java.io.IOException {
BatchWrite result = new BatchWrite(name, content);
initialize(result);
return result;
}
public class BatchWrite extends TracingRequest {
private static final String REST_PATH = "v2/{+name}/traces:batchWrite";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^projects/[^/]+$");
/**
* Sends new spans to Stackdriver Trace or updates existing traces. If the name of a trace that
* you send matches that of an existing trace, new spans are added to the existing trace. Attempt
* to update existing spans results undefined behavior. If the name does not match, a new trace is
* created with given set of spans.
*
* Create a request for the method "traces.batchWrite".
*
* This request holds the parameters needed by the the tracing server. After setting any optional
* parameters, call the {@link BatchWrite#execute()} method to invoke the remote operation.
* {@link
* BatchWrite#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param name Name of the project where the spans belong to. Format is
`projects/PROJECT_ID`.
* @param content the {@link com.google.api.services.tracing.v2.model.BatchWriteSpansRequest}
* @since 1.13
*/
protected BatchWrite(java.lang.String name, com.google.api.services.tracing.v2.model.BatchWriteSpansRequest content) {
super(Tracing.this, "POST", REST_PATH, content, com.google.api.services.tracing.v2.model.Empty.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^projects/[^/]+$");
}
}
@Override
public BatchWrite set$Xgafv(java.lang.String $Xgafv) {
return (BatchWrite) super.set$Xgafv($Xgafv);
}
@Override
public BatchWrite setAccessToken(java.lang.String accessToken) {
return (BatchWrite) super.setAccessToken(accessToken);
}
@Override
public BatchWrite setAlt(java.lang.String alt) {
return (BatchWrite) super.setAlt(alt);
}
@Override
public BatchWrite setBearerToken(java.lang.String bearerToken) {
return (BatchWrite) super.setBearerToken(bearerToken);
}
@Override
public BatchWrite setCallback(java.lang.String callback) {
return (BatchWrite) super.setCallback(callback);
}
@Override
public BatchWrite setFields(java.lang.String fields) {
return (BatchWrite) super.setFields(fields);
}
@Override
public BatchWrite setKey(java.lang.String key) {
return (BatchWrite) super.setKey(key);
}
@Override
public BatchWrite setOauthToken(java.lang.String oauthToken) {
return (BatchWrite) super.setOauthToken(oauthToken);
}
@Override
public BatchWrite setPp(java.lang.Boolean pp) {
return (BatchWrite) super.setPp(pp);
}
@Override
public BatchWrite setPrettyPrint(java.lang.Boolean prettyPrint) {
return (BatchWrite) super.setPrettyPrint(prettyPrint);
}
@Override
public BatchWrite setQuotaUser(java.lang.String quotaUser) {
return (BatchWrite) super.setQuotaUser(quotaUser);
}
@Override
public BatchWrite setUploadType(java.lang.String uploadType) {
return (BatchWrite) super.setUploadType(uploadType);
}
@Override
public BatchWrite setUploadProtocol(java.lang.String uploadProtocol) {
return (BatchWrite) super.setUploadProtocol(uploadProtocol);
}
/**
* Name of the project where the spans belong to. Format is `projects/PROJECT_ID`.
*/
@com.google.api.client.util.Key
private java.lang.String name;
/** Name of the project where the spans belong to. Format is `projects/PROJECT_ID`.
*/
public java.lang.String getName() {
return name;
}
/**
* Name of the project where the spans belong to. Format is `projects/PROJECT_ID`.
*/
public BatchWrite setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^projects/[^/]+$");
}
this.name = name;
return this;
}
@Override
public BatchWrite set(String parameterName, Object value) {
return (BatchWrite) super.set(parameterName, value);
}
}
/**
* Returns of a list of traces that match the specified filter conditions.
*
* Create a request for the method "traces.list".
*
* This request holds the parameters needed by the tracing server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param parent ID of the Cloud project where the trace data is stored which is
`projects/PROJECT_ID`.
* @return the request
*/
public List list(java.lang.String parent) throws java.io.IOException {
List result = new List(parent);
initialize(result);
return result;
}
public class List extends TracingRequest {
private static final String REST_PATH = "v2/{+parent}/traces";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^projects/[^/]+$");
/**
* Returns of a list of traces that match the specified filter conditions.
*
* Create a request for the method "traces.list".
*
* This request holds the parameters needed by the the tracing 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 parent ID of the Cloud project where the trace data is stored which is
`projects/PROJECT_ID`.
* @since 1.13
*/
protected List(java.lang.String parent) {
super(Tracing.this, "GET", REST_PATH, null, com.google.api.services.tracing.v2.model.ListTracesResponse.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^projects/[^/]+$");
}
}
@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 set$Xgafv(java.lang.String $Xgafv) {
return (List) super.set$Xgafv($Xgafv);
}
@Override
public List setAccessToken(java.lang.String accessToken) {
return (List) super.setAccessToken(accessToken);
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setBearerToken(java.lang.String bearerToken) {
return (List) super.setBearerToken(bearerToken);
}
@Override
public List setCallback(java.lang.String callback) {
return (List) super.setCallback(callback);
}
@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 setPp(java.lang.Boolean pp) {
return (List) super.setPp(pp);
}
@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 setUploadType(java.lang.String uploadType) {
return (List) super.setUploadType(uploadType);
}
@Override
public List setUploadProtocol(java.lang.String uploadProtocol) {
return (List) super.setUploadProtocol(uploadProtocol);
}
/**
* ID of the Cloud project where the trace data is stored which is `projects/PROJECT_ID`.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** ID of the Cloud project where the trace data is stored which is `projects/PROJECT_ID`.
*/
public java.lang.String getParent() {
return parent;
}
/**
* ID of the Cloud project where the trace data is stored which is `projects/PROJECT_ID`.
*/
public List setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^projects/[^/]+$");
}
this.parent = parent;
return this;
}
/**
* Field used to sort the returned traces. Optional. Can be one of the following:
*
* * `trace_id` * `name` (`name` field of root span in the trace) * `duration`
* (difference between `end_time` and `start_time` fields of the root span) * `start`
* (`start_time` field of the root span)
*
* Descending order can be specified by appending `desc` to the sort field (for example,
* `name desc`).
*
* Only one sort field is permitted.
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** Field used to sort the returned traces. Optional. Can be one of the following:
* `trace_id` * `name` (`name` field of root span in the trace) * `duration` (difference
between `end_time` and `start_time` fields of the root span) * `start` (`start_time` field of the
root span)
Descending order can be specified by appending `desc` to the sort field (for example, `name desc`).
Only one sort field is permitted.
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* Field used to sort the returned traces. Optional. Can be one of the following:
*
* * `trace_id` * `name` (`name` field of root span in the trace) * `duration`
* (difference between `end_time` and `start_time` fields of the root span) * `start`
* (`start_time` field of the root span)
*
* Descending order can be specified by appending `desc` to the sort field (for example,
* `name desc`).
*
* Only one sort field is permitted.
*/
public List setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/**
* An optional filter for the request. Example: `version_label_key:a
* some_label:some_label_key` returns traces from version `a` and has `some_label` with
* `some_label_key`.
*/
@com.google.api.client.util.Key
private java.lang.String filter;
/** An optional filter for the request. Example: `version_label_key:a some_label:some_label_key`
returns traces from version `a` and has `some_label` with `some_label_key`.
*/
public java.lang.String getFilter() {
return filter;
}
/**
* An optional filter for the request. Example: `version_label_key:a
* some_label:some_label_key` returns traces from version `a` and has `some_label` with
* `some_label_key`.
*/
public List setFilter(java.lang.String filter) {
this.filter = filter;
return this;
}
/**
* End of the time interval (inclusive) during which the trace data was collected from the
* application.
*/
@com.google.api.client.util.Key
private String endTime;
/** End of the time interval (inclusive) during which the trace data was collected from the
application.
*/
public String getEndTime() {
return endTime;
}
/**
* End of the time interval (inclusive) during which the trace data was collected from the
* application.
*/
public List setEndTime(String endTime) {
this.endTime = endTime;
return this;
}
/**
* Token identifying the page of results to return. If provided, use the value of the
* `next_page_token` field from a previous request. Optional.
*/
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token identifying the page of results to return. If provided, use the value of the
`next_page_token` field from a previous request. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/**
* Token identifying the page of results to return. If provided, use the value of the
* `next_page_token` field from a previous request. Optional.
*/
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
/**
* Start of the time interval (inclusive) during which the trace data was collected from the
* application.
*/
@com.google.api.client.util.Key
private String startTime;
/** Start of the time interval (inclusive) during which the trace data was collected from the
application.
*/
public String getStartTime() {
return startTime;
}
/**
* Start of the time interval (inclusive) during which the trace data was collected from the
* application.
*/
public List setStartTime(String startTime) {
this.startTime = startTime;
return this;
}
/**
* Maximum number of traces to return. If not specified or <= 0, the implementation selects
* a reasonable value. The implementation may return fewer traces than the requested page
* size. Optional.
*/
@com.google.api.client.util.Key
private java.lang.Integer pageSize;
/** Maximum number of traces to return. If not specified or <= 0, the implementation selects a
reasonable value. The implementation may return fewer traces than the requested page size.
Optional.
*/
public java.lang.Integer getPageSize() {
return pageSize;
}
/**
* Maximum number of traces to return. If not specified or <= 0, the implementation selects
* a reasonable value. The implementation may return fewer traces than the requested page
* size. Optional.
*/
public List setPageSize(java.lang.Integer pageSize) {
this.pageSize = pageSize;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Returns a list of spans within a trace.
*
* Create a request for the method "traces.listSpans".
*
* This request holds the parameters needed by the tracing server. After setting any optional
* parameters, call the {@link ListSpans#execute()} method to invoke the remote operation.
*
* @param parent ID of the trace for which to list child spans. Format is
`projects/PROJECT_ID/traces/TRACE_ID`.
* @return the request
*/
public ListSpans listSpans(java.lang.String parent) throws java.io.IOException {
ListSpans result = new ListSpans(parent);
initialize(result);
return result;
}
public class ListSpans extends TracingRequest {
private static final String REST_PATH = "v2/{+parent}:listSpans";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^projects/[^/]+/traces/[^/]+$");
/**
* Returns a list of spans within a trace.
*
* Create a request for the method "traces.listSpans".
*
* This request holds the parameters needed by the the tracing server. After setting any optional
* parameters, call the {@link ListSpans#execute()} method to invoke the remote operation.
* {@link
* ListSpans#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param parent ID of the trace for which to list child spans. Format is
`projects/PROJECT_ID/traces/TRACE_ID`.
* @since 1.13
*/
protected ListSpans(java.lang.String parent) {
super(Tracing.this, "GET", REST_PATH, null, com.google.api.services.tracing.v2.model.ListSpansResponse.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^projects/[^/]+/traces/[^/]+$");
}
}
@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 ListSpans set$Xgafv(java.lang.String $Xgafv) {
return (ListSpans) super.set$Xgafv($Xgafv);
}
@Override
public ListSpans setAccessToken(java.lang.String accessToken) {
return (ListSpans) super.setAccessToken(accessToken);
}
@Override
public ListSpans setAlt(java.lang.String alt) {
return (ListSpans) super.setAlt(alt);
}
@Override
public ListSpans setBearerToken(java.lang.String bearerToken) {
return (ListSpans) super.setBearerToken(bearerToken);
}
@Override
public ListSpans setCallback(java.lang.String callback) {
return (ListSpans) super.setCallback(callback);
}
@Override
public ListSpans setFields(java.lang.String fields) {
return (ListSpans) super.setFields(fields);
}
@Override
public ListSpans setKey(java.lang.String key) {
return (ListSpans) super.setKey(key);
}
@Override
public ListSpans setOauthToken(java.lang.String oauthToken) {
return (ListSpans) super.setOauthToken(oauthToken);
}
@Override
public ListSpans setPp(java.lang.Boolean pp) {
return (ListSpans) super.setPp(pp);
}
@Override
public ListSpans setPrettyPrint(java.lang.Boolean prettyPrint) {
return (ListSpans) super.setPrettyPrint(prettyPrint);
}
@Override
public ListSpans setQuotaUser(java.lang.String quotaUser) {
return (ListSpans) super.setQuotaUser(quotaUser);
}
@Override
public ListSpans setUploadType(java.lang.String uploadType) {
return (ListSpans) super.setUploadType(uploadType);
}
@Override
public ListSpans setUploadProtocol(java.lang.String uploadProtocol) {
return (ListSpans) super.setUploadProtocol(uploadProtocol);
}
/**
* ID of the trace for which to list child spans. Format is
* `projects/PROJECT_ID/traces/TRACE_ID`.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** ID of the trace for which to list child spans. Format is `projects/PROJECT_ID/traces/TRACE_ID`.
*/
public java.lang.String getParent() {
return parent;
}
/**
* ID of the trace for which to list child spans. Format is
* `projects/PROJECT_ID/traces/TRACE_ID`.
*/
public ListSpans setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^projects/[^/]+/traces/[^/]+$");
}
this.parent = parent;
return this;
}
/**
* Token identifying the page of results to return. If provided, use the value of the
* `nextPageToken` field from a previous request. Optional.
*/
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Token identifying the page of results to return. If provided, use the value of the `nextPageToken`
field from a previous request. Optional.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/**
* Token identifying the page of results to return. If provided, use the value of the
* `nextPageToken` field from a previous request. Optional.
*/
public ListSpans setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
@Override
public ListSpans set(String parameterName, Object value) {
return (ListSpans) super.set(parameterName, value);
}
}
/**
* An accessor for creating requests from the Spans collection.
*
* The typical use is:
*
* {@code Tracing tracing = new Tracing(...);}
* {@code Tracing.Spans.List request = tracing.spans().list(parameters ...)}
*
*
* @return the resource collection
*/
public Spans spans() {
return new Spans();
}
/**
* The "spans" collection of methods.
*/
public class Spans {
/**
* Creates a new Span.
*
* Create a request for the method "spans.create".
*
* This request holds the parameters needed by the tracing server. After setting any optional
* parameters, call the {@link Create#execute()} method to invoke the remote operation.
*
* @param name The resource name of Span in the format
`projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`.
* `TRACE_ID` is a unique identifier for a trace within a project and is a
base16-encoded,
* case-insensitive string and is required to be 32 char long.
`SPAN_ID` is a unique
* identifier for a span within a trace. It is a
base 16-encoded, case-insensitive string of
* a 8-bytes array and is required
to be 16 char long.
* @param content the {@link com.google.api.services.tracing.v2.model.Span}
* @return the request
*/
public Create create(java.lang.String name, com.google.api.services.tracing.v2.model.Span content) throws java.io.IOException {
Create result = new Create(name, content);
initialize(result);
return result;
}
public class Create extends TracingRequest {
private static final String REST_PATH = "v2/{+name}";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^projects/[^/]+/traces/[^/]+/spans/[^/]+$");
/**
* Creates a new Span.
*
* Create a request for the method "spans.create".
*
* This request holds the parameters needed by the the tracing 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 name The resource name of Span in the format
`projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`.
* `TRACE_ID` is a unique identifier for a trace within a project and is a
base16-encoded,
* case-insensitive string and is required to be 32 char long.
`SPAN_ID` is a unique
* identifier for a span within a trace. It is a
base 16-encoded, case-insensitive string of
* a 8-bytes array and is required
to be 16 char long.
* @param content the {@link com.google.api.services.tracing.v2.model.Span}
* @since 1.13
*/
protected Create(java.lang.String name, com.google.api.services.tracing.v2.model.Span content) {
super(Tracing.this, "PUT", REST_PATH, content, com.google.api.services.tracing.v2.model.Span.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^projects/[^/]+/traces/[^/]+/spans/[^/]+$");
}
}
@Override
public Create set$Xgafv(java.lang.String $Xgafv) {
return (Create) super.set$Xgafv($Xgafv);
}
@Override
public Create setAccessToken(java.lang.String accessToken) {
return (Create) super.setAccessToken(accessToken);
}
@Override
public Create setAlt(java.lang.String alt) {
return (Create) super.setAlt(alt);
}
@Override
public Create setBearerToken(java.lang.String bearerToken) {
return (Create) super.setBearerToken(bearerToken);
}
@Override
public Create setCallback(java.lang.String callback) {
return (Create) super.setCallback(callback);
}
@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 setPp(java.lang.Boolean pp) {
return (Create) super.setPp(pp);
}
@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 setUploadType(java.lang.String uploadType) {
return (Create) super.setUploadType(uploadType);
}
@Override
public Create setUploadProtocol(java.lang.String uploadProtocol) {
return (Create) super.setUploadProtocol(uploadProtocol);
}
/**
* The resource name of Span in the format
* `projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`. `TRACE_ID` is a unique identifier
* for a trace within a project and is a base16-encoded, case-insensitive string and is
* required to be 32 char long. `SPAN_ID` is a unique identifier for a span within a
* trace. It is a base 16-encoded, case-insensitive string of a 8-bytes array and is
* required to be 16 char long.
*/
@com.google.api.client.util.Key
private java.lang.String name;
/** The resource name of Span in the format `projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`.
`TRACE_ID` is a unique identifier for a trace within a project and is a base16-encoded, case-
insensitive string and is required to be 32 char long. `SPAN_ID` is a unique identifier for a span
within a trace. It is a base 16-encoded, case-insensitive string of a 8-bytes array and is required
to be 16 char long.
*/
public java.lang.String getName() {
return name;
}
/**
* The resource name of Span in the format
* `projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`. `TRACE_ID` is a unique identifier
* for a trace within a project and is a base16-encoded, case-insensitive string and is
* required to be 32 char long. `SPAN_ID` is a unique identifier for a span within a
* trace. It is a base 16-encoded, case-insensitive string of a 8-bytes array and is
* required to be 16 char long.
*/
public Create setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^projects/[^/]+/traces/[^/]+/spans/[^/]+$");
}
this.name = name;
return this;
}
@Override
public Create set(String parameterName, Object value) {
return (Create) super.set(parameterName, value);
}
}
}
}
}
/**
* Builder for {@link Tracing}.
*
*
* 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 Tracing}. */
@Override
public Tracing build() {
return new Tracing(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 TracingRequestInitializer}.
*
* @since 1.12
*/
public Builder setTracingRequestInitializer(
TracingRequestInitializer tracingRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(tracingRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}