You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4072 lines
157 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package logging provides access to the Stackdriver Logging API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/logging instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/logging/docs/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/logging/v2beta1"
  16. // ...
  17. // ctx := context.Background()
  18. // loggingService, err := logging.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // loggingService, err := logging.NewService(ctx, option.WithScopes(logging.LoggingWriteScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // loggingService, err := logging.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // loggingService, err := logging.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package logging // import "google.golang.org/api/logging/v2beta1"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "logging:v2beta1"
  73. const apiName = "logging"
  74. const apiVersion = "v2beta1"
  75. const basePath = "https://logging.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View your data across Google Cloud Platform services
  81. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  82. // Administrate log data for your projects
  83. LoggingAdminScope = "https://www.googleapis.com/auth/logging.admin"
  84. // View log data for your projects
  85. LoggingReadScope = "https://www.googleapis.com/auth/logging.read"
  86. // Submit log data for your projects
  87. LoggingWriteScope = "https://www.googleapis.com/auth/logging.write"
  88. )
  89. // NewService creates a new Service.
  90. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  91. scopesOption := option.WithScopes(
  92. "https://www.googleapis.com/auth/cloud-platform",
  93. "https://www.googleapis.com/auth/cloud-platform.read-only",
  94. "https://www.googleapis.com/auth/logging.admin",
  95. "https://www.googleapis.com/auth/logging.read",
  96. "https://www.googleapis.com/auth/logging.write",
  97. )
  98. // NOTE: prepend, so we don't override user-specified scopes.
  99. opts = append([]option.ClientOption{scopesOption}, opts...)
  100. client, endpoint, err := htransport.NewClient(ctx, opts...)
  101. if err != nil {
  102. return nil, err
  103. }
  104. s, err := New(client)
  105. if err != nil {
  106. return nil, err
  107. }
  108. if endpoint != "" {
  109. s.BasePath = endpoint
  110. }
  111. return s, nil
  112. }
  113. // New creates a new Service. It uses the provided http.Client for requests.
  114. //
  115. // Deprecated: please use NewService instead.
  116. // To provide a custom HTTP client, use option.WithHTTPClient.
  117. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  118. func New(client *http.Client) (*Service, error) {
  119. if client == nil {
  120. return nil, errors.New("client is nil")
  121. }
  122. s := &Service{client: client, BasePath: basePath}
  123. s.Entries = NewEntriesService(s)
  124. s.MonitoredResourceDescriptors = NewMonitoredResourceDescriptorsService(s)
  125. s.Projects = NewProjectsService(s)
  126. return s, nil
  127. }
  128. type Service struct {
  129. client *http.Client
  130. BasePath string // API endpoint base URL
  131. UserAgent string // optional additional User-Agent fragment
  132. Entries *EntriesService
  133. MonitoredResourceDescriptors *MonitoredResourceDescriptorsService
  134. Projects *ProjectsService
  135. }
  136. func (s *Service) userAgent() string {
  137. if s.UserAgent == "" {
  138. return googleapi.UserAgent
  139. }
  140. return googleapi.UserAgent + " " + s.UserAgent
  141. }
  142. func NewEntriesService(s *Service) *EntriesService {
  143. rs := &EntriesService{s: s}
  144. return rs
  145. }
  146. type EntriesService struct {
  147. s *Service
  148. }
  149. func NewMonitoredResourceDescriptorsService(s *Service) *MonitoredResourceDescriptorsService {
  150. rs := &MonitoredResourceDescriptorsService{s: s}
  151. return rs
  152. }
  153. type MonitoredResourceDescriptorsService struct {
  154. s *Service
  155. }
  156. func NewProjectsService(s *Service) *ProjectsService {
  157. rs := &ProjectsService{s: s}
  158. rs.Metrics = NewProjectsMetricsService(s)
  159. rs.Sinks = NewProjectsSinksService(s)
  160. return rs
  161. }
  162. type ProjectsService struct {
  163. s *Service
  164. Metrics *ProjectsMetricsService
  165. Sinks *ProjectsSinksService
  166. }
  167. func NewProjectsMetricsService(s *Service) *ProjectsMetricsService {
  168. rs := &ProjectsMetricsService{s: s}
  169. return rs
  170. }
  171. type ProjectsMetricsService struct {
  172. s *Service
  173. }
  174. func NewProjectsSinksService(s *Service) *ProjectsSinksService {
  175. rs := &ProjectsSinksService{s: s}
  176. return rs
  177. }
  178. type ProjectsSinksService struct {
  179. s *Service
  180. }
  181. // BucketOptions: BucketOptions describes the bucket boundaries used to
  182. // create a histogram for the distribution. The buckets can be in a
  183. // linear sequence, an exponential sequence, or each bucket can be
  184. // specified explicitly. BucketOptions does not include the number of
  185. // values in each bucket.A bucket has an inclusive lower bound and
  186. // exclusive upper bound for the values that are counted for that
  187. // bucket. The upper bound of a bucket must be strictly greater than the
  188. // lower bound. The sequence of N buckets for a distribution consists of
  189. // an underflow bucket (number 0), zero or more finite buckets (number 1
  190. // through N - 2) and an overflow bucket (number N - 1). The buckets are
  191. // contiguous: the lower bound of bucket i (i > 0) is the same as the
  192. // upper bound of bucket i - 1. The buckets span the whole range of
  193. // finite values: lower bound of the underflow bucket is -infinity and
  194. // the upper bound of the overflow bucket is +infinity. The finite
  195. // buckets are so-called because both bounds are finite.
  196. type BucketOptions struct {
  197. // ExplicitBuckets: The explicit buckets.
  198. ExplicitBuckets *Explicit `json:"explicitBuckets,omitempty"`
  199. // ExponentialBuckets: The exponential buckets.
  200. ExponentialBuckets *Exponential `json:"exponentialBuckets,omitempty"`
  201. // LinearBuckets: The linear bucket.
  202. LinearBuckets *Linear `json:"linearBuckets,omitempty"`
  203. // ForceSendFields is a list of field names (e.g. "ExplicitBuckets") to
  204. // unconditionally include in API requests. By default, fields with
  205. // empty values are omitted from API requests. However, any non-pointer,
  206. // non-interface field appearing in ForceSendFields will be sent to the
  207. // server regardless of whether the field is empty or not. This may be
  208. // used to include empty fields in Patch requests.
  209. ForceSendFields []string `json:"-"`
  210. // NullFields is a list of field names (e.g. "ExplicitBuckets") to
  211. // include in API requests with the JSON null value. By default, fields
  212. // with empty values are omitted from API requests. However, any field
  213. // with an empty value appearing in NullFields will be sent to the
  214. // server as null. It is an error if a field in this list has a
  215. // non-empty value. This may be used to include null fields in Patch
  216. // requests.
  217. NullFields []string `json:"-"`
  218. }
  219. func (s *BucketOptions) MarshalJSON() ([]byte, error) {
  220. type NoMethod BucketOptions
  221. raw := NoMethod(*s)
  222. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  223. }
  224. // Empty: A generic empty message that you can re-use to avoid defining
  225. // duplicated empty messages in your APIs. A typical example is to use
  226. // it as the request or the response type of an API method. For
  227. // instance:
  228. // service Foo {
  229. // rpc Bar(google.protobuf.Empty) returns
  230. // (google.protobuf.Empty);
  231. // }
  232. // The JSON representation for Empty is empty JSON object {}.
  233. type Empty struct {
  234. // ServerResponse contains the HTTP response code and headers from the
  235. // server.
  236. googleapi.ServerResponse `json:"-"`
  237. }
  238. // Explicit: Specifies a set of buckets with arbitrary widths.There are
  239. // size(bounds) + 1 (= N) buckets. Bucket i has the following
  240. // boundaries:Upper bound (0 <= i < N-1): boundsi Lower bound (1 <= i <
  241. // N); boundsi - 1The bounds field must contain at least one element. If
  242. // bounds has only one element, then there are no finite buckets, and
  243. // that single element is the common boundary of the overflow and
  244. // underflow buckets.
  245. type Explicit struct {
  246. // Bounds: The values must be monotonically increasing.
  247. Bounds []float64 `json:"bounds,omitempty"`
  248. // ForceSendFields is a list of field names (e.g. "Bounds") to
  249. // unconditionally include in API requests. By default, fields with
  250. // empty values are omitted from API requests. However, any non-pointer,
  251. // non-interface field appearing in ForceSendFields will be sent to the
  252. // server regardless of whether the field is empty or not. This may be
  253. // used to include empty fields in Patch requests.
  254. ForceSendFields []string `json:"-"`
  255. // NullFields is a list of field names (e.g. "Bounds") to include in API
  256. // requests with the JSON null value. By default, fields with empty
  257. // values are omitted from API requests. However, any field with an
  258. // empty value appearing in NullFields will be sent to the server as
  259. // null. It is an error if a field in this list has a non-empty value.
  260. // This may be used to include null fields in Patch requests.
  261. NullFields []string `json:"-"`
  262. }
  263. func (s *Explicit) MarshalJSON() ([]byte, error) {
  264. type NoMethod Explicit
  265. raw := NoMethod(*s)
  266. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  267. }
  268. // Exponential: Specifies an exponential sequence of buckets that have a
  269. // width that is proportional to the value of the lower bound. Each
  270. // bucket represents a constant relative uncertainty on a specific value
  271. // in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket
  272. // i has the following boundaries:Upper bound (0 <= i < N-1): scale *
  273. // (growth_factor ^ i). Lower bound (1 <= i < N): scale *
  274. // (growth_factor ^ (i - 1)).
  275. type Exponential struct {
  276. // GrowthFactor: Must be greater than 1.
  277. GrowthFactor float64 `json:"growthFactor,omitempty"`
  278. // NumFiniteBuckets: Must be greater than 0.
  279. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  280. // Scale: Must be greater than 0.
  281. Scale float64 `json:"scale,omitempty"`
  282. // ForceSendFields is a list of field names (e.g. "GrowthFactor") to
  283. // unconditionally include in API requests. By default, fields with
  284. // empty values are omitted from API requests. However, any non-pointer,
  285. // non-interface field appearing in ForceSendFields will be sent to the
  286. // server regardless of whether the field is empty or not. This may be
  287. // used to include empty fields in Patch requests.
  288. ForceSendFields []string `json:"-"`
  289. // NullFields is a list of field names (e.g. "GrowthFactor") to include
  290. // in API requests with the JSON null value. By default, fields with
  291. // empty values are omitted from API requests. However, any field with
  292. // an empty value appearing in NullFields will be sent to the server as
  293. // null. It is an error if a field in this list has a non-empty value.
  294. // This may be used to include null fields in Patch requests.
  295. NullFields []string `json:"-"`
  296. }
  297. func (s *Exponential) MarshalJSON() ([]byte, error) {
  298. type NoMethod Exponential
  299. raw := NoMethod(*s)
  300. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  301. }
  302. func (s *Exponential) UnmarshalJSON(data []byte) error {
  303. type NoMethod Exponential
  304. var s1 struct {
  305. GrowthFactor gensupport.JSONFloat64 `json:"growthFactor"`
  306. Scale gensupport.JSONFloat64 `json:"scale"`
  307. *NoMethod
  308. }
  309. s1.NoMethod = (*NoMethod)(s)
  310. if err := json.Unmarshal(data, &s1); err != nil {
  311. return err
  312. }
  313. s.GrowthFactor = float64(s1.GrowthFactor)
  314. s.Scale = float64(s1.Scale)
  315. return nil
  316. }
  317. // HttpRequest: A common proto for logging HTTP requests. Only contains
  318. // semantics defined by the HTTP specification. Product-specific logging
  319. // information MUST be defined in a separate message.
  320. type HttpRequest struct {
  321. // CacheFillBytes: The number of HTTP response bytes inserted into
  322. // cache. Set only when a cache fill was attempted.
  323. CacheFillBytes int64 `json:"cacheFillBytes,omitempty,string"`
  324. // CacheHit: Whether or not an entity was served from cache (with or
  325. // without validation).
  326. CacheHit bool `json:"cacheHit,omitempty"`
  327. // CacheLookup: Whether or not a cache lookup was attempted.
  328. CacheLookup bool `json:"cacheLookup,omitempty"`
  329. // CacheValidatedWithOriginServer: Whether or not the response was
  330. // validated with the origin server before being served from cache. This
  331. // field is only meaningful if cache_hit is True.
  332. CacheValidatedWithOriginServer bool `json:"cacheValidatedWithOriginServer,omitempty"`
  333. // Latency: The request processing latency on the server, from the time
  334. // the request was received until the response was sent.
  335. Latency string `json:"latency,omitempty"`
  336. // Protocol: Protocol used for the request. Examples: "HTTP/1.1",
  337. // "HTTP/2", "websocket"
  338. Protocol string `json:"protocol,omitempty"`
  339. // Referer: The referer URL of the request, as defined in HTTP/1.1
  340. // Header Field Definitions
  341. // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
  342. Referer string `json:"referer,omitempty"`
  343. // RemoteIp: The IP address (IPv4 or IPv6) of the client that issued the
  344. // HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
  345. RemoteIp string `json:"remoteIp,omitempty"`
  346. // RequestMethod: The request method. Examples: "GET", "HEAD", "PUT",
  347. // "POST".
  348. RequestMethod string `json:"requestMethod,omitempty"`
  349. // RequestSize: The size of the HTTP request message in bytes, including
  350. // the request headers and the request body.
  351. RequestSize int64 `json:"requestSize,omitempty,string"`
  352. // RequestUrl: The scheme (http, https), the host name, the path and the
  353. // query portion of the URL that was requested. Example:
  354. // "http://example.com/some/info?color=red".
  355. RequestUrl string `json:"requestUrl,omitempty"`
  356. // ResponseSize: The size of the HTTP response message sent back to the
  357. // client, in bytes, including the response headers and the response
  358. // body.
  359. ResponseSize int64 `json:"responseSize,omitempty,string"`
  360. // ServerIp: The IP address (IPv4 or IPv6) of the origin server that the
  361. // request was sent to.
  362. ServerIp string `json:"serverIp,omitempty"`
  363. // Status: The response code indicating the status of response.
  364. // Examples: 200, 404.
  365. Status int64 `json:"status,omitempty"`
  366. // UserAgent: The user agent sent by the client. Example: "Mozilla/4.0
  367. // (compatible; MSIE 6.0; Windows 98; Q312461; .NET
  368. // CLR 1.0.3705)".
  369. UserAgent string `json:"userAgent,omitempty"`
  370. // ForceSendFields is a list of field names (e.g. "CacheFillBytes") to
  371. // unconditionally include in API requests. By default, fields with
  372. // empty values are omitted from API requests. However, any non-pointer,
  373. // non-interface field appearing in ForceSendFields will be sent to the
  374. // server regardless of whether the field is empty or not. This may be
  375. // used to include empty fields in Patch requests.
  376. ForceSendFields []string `json:"-"`
  377. // NullFields is a list of field names (e.g. "CacheFillBytes") to
  378. // include in API requests with the JSON null value. By default, fields
  379. // with empty values are omitted from API requests. However, any field
  380. // with an empty value appearing in NullFields will be sent to the
  381. // server as null. It is an error if a field in this list has a
  382. // non-empty value. This may be used to include null fields in Patch
  383. // requests.
  384. NullFields []string `json:"-"`
  385. }
  386. func (s *HttpRequest) MarshalJSON() ([]byte, error) {
  387. type NoMethod HttpRequest
  388. raw := NoMethod(*s)
  389. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  390. }
  391. // LabelDescriptor: A description of a label.
  392. type LabelDescriptor struct {
  393. // Description: A human-readable description for the label.
  394. Description string `json:"description,omitempty"`
  395. // Key: The label key.
  396. Key string `json:"key,omitempty"`
  397. // ValueType: The type of data that can be assigned to the label.
  398. //
  399. // Possible values:
  400. // "STRING" - A variable-length string. This is the default.
  401. // "BOOL" - Boolean; true or false.
  402. // "INT64" - A 64-bit signed integer.
  403. ValueType string `json:"valueType,omitempty"`
  404. // ForceSendFields is a list of field names (e.g. "Description") to
  405. // unconditionally include in API requests. By default, fields with
  406. // empty values are omitted from API requests. However, any non-pointer,
  407. // non-interface field appearing in ForceSendFields will be sent to the
  408. // server regardless of whether the field is empty or not. This may be
  409. // used to include empty fields in Patch requests.
  410. ForceSendFields []string `json:"-"`
  411. // NullFields is a list of field names (e.g. "Description") to include
  412. // in API requests with the JSON null value. By default, fields with
  413. // empty values are omitted from API requests. However, any field with
  414. // an empty value appearing in NullFields will be sent to the server as
  415. // null. It is an error if a field in this list has a non-empty value.
  416. // This may be used to include null fields in Patch requests.
  417. NullFields []string `json:"-"`
  418. }
  419. func (s *LabelDescriptor) MarshalJSON() ([]byte, error) {
  420. type NoMethod LabelDescriptor
  421. raw := NoMethod(*s)
  422. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  423. }
  424. // Linear: Specifies a linear sequence of buckets that all have the same
  425. // width (except overflow and underflow). Each bucket represents a
  426. // constant absolute uncertainty on the specific value in the
  427. // bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has
  428. // the following boundaries:Upper bound (0 <= i < N-1): offset + (width
  429. // * i). Lower bound (1 <= i < N): offset + (width * (i - 1)).
  430. type Linear struct {
  431. // NumFiniteBuckets: Must be greater than 0.
  432. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  433. // Offset: Lower bound of the first bucket.
  434. Offset float64 `json:"offset,omitempty"`
  435. // Width: Must be greater than 0.
  436. Width float64 `json:"width,omitempty"`
  437. // ForceSendFields is a list of field names (e.g. "NumFiniteBuckets") to
  438. // unconditionally include in API requests. By default, fields with
  439. // empty values are omitted from API requests. However, any non-pointer,
  440. // non-interface field appearing in ForceSendFields will be sent to the
  441. // server regardless of whether the field is empty or not. This may be
  442. // used to include empty fields in Patch requests.
  443. ForceSendFields []string `json:"-"`
  444. // NullFields is a list of field names (e.g. "NumFiniteBuckets") to
  445. // include in API requests with the JSON null value. By default, fields
  446. // with empty values are omitted from API requests. However, any field
  447. // with an empty value appearing in NullFields will be sent to the
  448. // server as null. It is an error if a field in this list has a
  449. // non-empty value. This may be used to include null fields in Patch
  450. // requests.
  451. NullFields []string `json:"-"`
  452. }
  453. func (s *Linear) MarshalJSON() ([]byte, error) {
  454. type NoMethod Linear
  455. raw := NoMethod(*s)
  456. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  457. }
  458. func (s *Linear) UnmarshalJSON(data []byte) error {
  459. type NoMethod Linear
  460. var s1 struct {
  461. Offset gensupport.JSONFloat64 `json:"offset"`
  462. Width gensupport.JSONFloat64 `json:"width"`
  463. *NoMethod
  464. }
  465. s1.NoMethod = (*NoMethod)(s)
  466. if err := json.Unmarshal(data, &s1); err != nil {
  467. return err
  468. }
  469. s.Offset = float64(s1.Offset)
  470. s.Width = float64(s1.Width)
  471. return nil
  472. }
  473. // ListLogEntriesRequest: The parameters to ListLogEntries.
  474. type ListLogEntriesRequest struct {
  475. // Filter: Optional. A filter that chooses which log entries to return.
  476. // See Advanced Logs Filters. Only log entries that match the filter are
  477. // returned. An empty filter matches all log entries in the resources
  478. // listed in resource_names. Referencing a parent resource that is not
  479. // listed in resource_names will cause the filter to return no results.
  480. // The maximum length of the filter is 20000 characters.
  481. Filter string `json:"filter,omitempty"`
  482. // OrderBy: Optional. How the results should be sorted. Presently, the
  483. // only permitted values are "timestamp asc" (default) and "timestamp
  484. // desc". The first option returns entries in order of increasing values
  485. // of LogEntry.timestamp (oldest first), and the second option returns
  486. // entries in order of decreasing timestamps (newest first). Entries
  487. // with equal timestamps are returned in order of their insert_id
  488. // values.
  489. OrderBy string `json:"orderBy,omitempty"`
  490. // PageSize: Optional. The maximum number of results to return from this
  491. // request. Non-positive values are ignored. The presence of
  492. // next_page_token in the response indicates that more results might be
  493. // available.
  494. PageSize int64 `json:"pageSize,omitempty"`
  495. // PageToken: Optional. If present, then retrieve the next batch of
  496. // results from the preceding call to this method. page_token must be
  497. // the value of next_page_token from the previous response. The values
  498. // of other method parameters should be identical to those in the
  499. // previous call.
  500. PageToken string `json:"pageToken,omitempty"`
  501. // ProjectIds: Deprecated. Use resource_names instead. One or more
  502. // project identifiers or project numbers from which to retrieve log
  503. // entries. Example: "my-project-1A".
  504. ProjectIds []string `json:"projectIds,omitempty"`
  505. // ResourceNames: Required. Names of one or more parent resources from
  506. // which to retrieve log
  507. // entries:
  508. // "projects/[PROJECT_ID]"
  509. // "organizations/[ORGANIZATION_ID]"
  510. // "bi
  511. // llingAccounts/[BILLING_ACCOUNT_ID]"
  512. // "folders/[FOLDER_ID]"
  513. // Projects listed in the project_ids field are added to this list.
  514. ResourceNames []string `json:"resourceNames,omitempty"`
  515. // ForceSendFields is a list of field names (e.g. "Filter") to
  516. // unconditionally include in API requests. By default, fields with
  517. // empty values are omitted from API requests. However, any non-pointer,
  518. // non-interface field appearing in ForceSendFields will be sent to the
  519. // server regardless of whether the field is empty or not. This may be
  520. // used to include empty fields in Patch requests.
  521. ForceSendFields []string `json:"-"`
  522. // NullFields is a list of field names (e.g. "Filter") to include in API
  523. // requests with the JSON null value. By default, fields with empty
  524. // values are omitted from API requests. However, any field with an
  525. // empty value appearing in NullFields will be sent to the server as
  526. // null. It is an error if a field in this list has a non-empty value.
  527. // This may be used to include null fields in Patch requests.
  528. NullFields []string `json:"-"`
  529. }
  530. func (s *ListLogEntriesRequest) MarshalJSON() ([]byte, error) {
  531. type NoMethod ListLogEntriesRequest
  532. raw := NoMethod(*s)
  533. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  534. }
  535. // ListLogEntriesResponse: Result returned from ListLogEntries.
  536. type ListLogEntriesResponse struct {
  537. // Entries: A list of log entries. If entries is empty, nextPageToken
  538. // may still be returned, indicating that more entries may exist. See
  539. // nextPageToken for more information.
  540. Entries []*LogEntry `json:"entries,omitempty"`
  541. // NextPageToken: If there might be more results than those appearing in
  542. // this response, then nextPageToken is included. To get the next set of
  543. // results, call this method again using the value of nextPageToken as
  544. // pageToken.If a value for next_page_token appears and the entries
  545. // field is empty, it means that the search found no log entries so far
  546. // but it did not have time to search all the possible log entries.
  547. // Retry the method with this value for page_token to continue the
  548. // search. Alternatively, consider speeding up the search by changing
  549. // your filter to specify a single log name or resource type, or to
  550. // narrow the time range of the search.
  551. NextPageToken string `json:"nextPageToken,omitempty"`
  552. // ServerResponse contains the HTTP response code and headers from the
  553. // server.
  554. googleapi.ServerResponse `json:"-"`
  555. // ForceSendFields is a list of field names (e.g. "Entries") to
  556. // unconditionally include in API requests. By default, fields with
  557. // empty values are omitted from API requests. However, any non-pointer,
  558. // non-interface field appearing in ForceSendFields will be sent to the
  559. // server regardless of whether the field is empty or not. This may be
  560. // used to include empty fields in Patch requests.
  561. ForceSendFields []string `json:"-"`
  562. // NullFields is a list of field names (e.g. "Entries") to include in
  563. // API requests with the JSON null value. By default, fields with empty
  564. // values are omitted from API requests. However, any field with an
  565. // empty value appearing in NullFields will be sent to the server as
  566. // null. It is an error if a field in this list has a non-empty value.
  567. // This may be used to include null fields in Patch requests.
  568. NullFields []string `json:"-"`
  569. }
  570. func (s *ListLogEntriesResponse) MarshalJSON() ([]byte, error) {
  571. type NoMethod ListLogEntriesResponse
  572. raw := NoMethod(*s)
  573. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  574. }
  575. // ListLogMetricsResponse: Result returned from ListLogMetrics.
  576. type ListLogMetricsResponse struct {
  577. // Metrics: A list of logs-based metrics.
  578. Metrics []*LogMetric `json:"metrics,omitempty"`
  579. // NextPageToken: If there might be more results than appear in this
  580. // response, then nextPageToken is included. To get the next set of
  581. // results, call this method again using the value of nextPageToken as
  582. // pageToken.
  583. NextPageToken string `json:"nextPageToken,omitempty"`
  584. // ServerResponse contains the HTTP response code and headers from the
  585. // server.
  586. googleapi.ServerResponse `json:"-"`
  587. // ForceSendFields is a list of field names (e.g. "Metrics") to
  588. // unconditionally include in API requests. By default, fields with
  589. // empty values are omitted from API requests. However, any non-pointer,
  590. // non-interface field appearing in ForceSendFields will be sent to the
  591. // server regardless of whether the field is empty or not. This may be
  592. // used to include empty fields in Patch requests.
  593. ForceSendFields []string `json:"-"`
  594. // NullFields is a list of field names (e.g. "Metrics") to include in
  595. // API requests with the JSON null value. By default, fields with empty
  596. // values are omitted from API requests. However, any field with an
  597. // empty value appearing in NullFields will be sent to the server as
  598. // null. It is an error if a field in this list has a non-empty value.
  599. // This may be used to include null fields in Patch requests.
  600. NullFields []string `json:"-"`
  601. }
  602. func (s *ListLogMetricsResponse) MarshalJSON() ([]byte, error) {
  603. type NoMethod ListLogMetricsResponse
  604. raw := NoMethod(*s)
  605. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  606. }
  607. // ListMonitoredResourceDescriptorsResponse: Result returned from
  608. // ListMonitoredResourceDescriptors.
  609. type ListMonitoredResourceDescriptorsResponse struct {
  610. // NextPageToken: If there might be more results than those appearing in
  611. // this response, then nextPageToken is included. To get the next set of
  612. // results, call this method again using the value of nextPageToken as
  613. // pageToken.
  614. NextPageToken string `json:"nextPageToken,omitempty"`
  615. // ResourceDescriptors: A list of resource descriptors.
  616. ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"`
  617. // ServerResponse contains the HTTP response code and headers from the
  618. // server.
  619. googleapi.ServerResponse `json:"-"`
  620. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  621. // unconditionally include in API requests. By default, fields with
  622. // empty values are omitted from API requests. However, any non-pointer,
  623. // non-interface field appearing in ForceSendFields will be sent to the
  624. // server regardless of whether the field is empty or not. This may be
  625. // used to include empty fields in Patch requests.
  626. ForceSendFields []string `json:"-"`
  627. // NullFields is a list of field names (e.g. "NextPageToken") to include
  628. // in API requests with the JSON null value. By default, fields with
  629. // empty values are omitted from API requests. However, any field with
  630. // an empty value appearing in NullFields will be sent to the server as
  631. // null. It is an error if a field in this list has a non-empty value.
  632. // This may be used to include null fields in Patch requests.
  633. NullFields []string `json:"-"`
  634. }
  635. func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) {
  636. type NoMethod ListMonitoredResourceDescriptorsResponse
  637. raw := NoMethod(*s)
  638. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  639. }
  640. // ListSinksResponse: Result returned from ListSinks.
  641. type ListSinksResponse struct {
  642. // NextPageToken: If there might be more results than appear in this
  643. // response, then nextPageToken is included. To get the next set of
  644. // results, call the same method again using the value of nextPageToken
  645. // as pageToken.
  646. NextPageToken string `json:"nextPageToken,omitempty"`
  647. // Sinks: A list of sinks.
  648. Sinks []*LogSink `json:"sinks,omitempty"`
  649. // ServerResponse contains the HTTP response code and headers from the
  650. // server.
  651. googleapi.ServerResponse `json:"-"`
  652. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  653. // unconditionally include in API requests. By default, fields with
  654. // empty values are omitted from API requests. However, any non-pointer,
  655. // non-interface field appearing in ForceSendFields will be sent to the
  656. // server regardless of whether the field is empty or not. This may be
  657. // used to include empty fields in Patch requests.
  658. ForceSendFields []string `json:"-"`
  659. // NullFields is a list of field names (e.g. "NextPageToken") to include
  660. // in API requests with the JSON null value. By default, fields with
  661. // empty values are omitted from API requests. However, any field with
  662. // an empty value appearing in NullFields will be sent to the server as
  663. // null. It is an error if a field in this list has a non-empty value.
  664. // This may be used to include null fields in Patch requests.
  665. NullFields []string `json:"-"`
  666. }
  667. func (s *ListSinksResponse) MarshalJSON() ([]byte, error) {
  668. type NoMethod ListSinksResponse
  669. raw := NoMethod(*s)
  670. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  671. }
  672. // LogEntry: An individual entry in a log.
  673. type LogEntry struct {
  674. // HttpRequest: Optional. Information about the HTTP request associated
  675. // with this log entry, if applicable.
  676. HttpRequest *HttpRequest `json:"httpRequest,omitempty"`
  677. // InsertId: Optional. A unique identifier for the log entry. If you
  678. // provide a value, then Logging considers other log entries in the same
  679. // project, with the same timestamp, and with the same insert_id to be
  680. // duplicates which can be removed. If omitted in new log entries, then
  681. // Logging assigns its own unique identifier. The insert_id is also used
  682. // to order log entries that have the same timestamp value.
  683. InsertId string `json:"insertId,omitempty"`
  684. // JsonPayload: The log entry payload, represented as a structure that
  685. // is expressed as a JSON object.
  686. JsonPayload googleapi.RawMessage `json:"jsonPayload,omitempty"`
  687. // Labels: Optional. A set of user-defined (key, value) data that
  688. // provides additional information about the log entry.
  689. Labels map[string]string `json:"labels,omitempty"`
  690. // LogName: Required. The resource name of the log to which this log
  691. // entry
  692. // belongs:
  693. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  694. // "organizations/[ORGANIZ
  695. // ATION_ID]/logs/[LOG_ID]"
  696. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[L
  697. // OG_ID]"
  698. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  699. // A project number may optionally be used in place of PROJECT_ID. The
  700. // project number is translated to its corresponding PROJECT_ID
  701. // internally and the log_name field will contain PROJECT_ID in queries
  702. // and exports.[LOG_ID] must be URL-encoded within log_name. Example:
  703. // "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Fa
  704. // ctivity". [LOG_ID] must be less than 512 characters long and can only
  705. // include the following characters: upper and lower case alphanumeric
  706. // characters, forward-slash, underscore, hyphen, and period.For
  707. // backward compatibility, if log_name begins with a forward-slash, such
  708. // as /projects/..., then the log entry is ingested as usual but the
  709. // forward-slash is removed. Listing the log entry will not show the
  710. // leading slash and filtering for a log name with a leading slash will
  711. // never return any results.
  712. LogName string `json:"logName,omitempty"`
  713. // Metadata: Output only. Additional metadata about the monitored
  714. // resource.Only k8s_container, k8s_pod, and k8s_node MonitoredResources
  715. // have this field populated.
  716. Metadata *MonitoredResourceMetadata `json:"metadata,omitempty"`
  717. // Operation: Optional. Information about an operation associated with
  718. // the log entry, if applicable.
  719. Operation *LogEntryOperation `json:"operation,omitempty"`
  720. // ProtoPayload: The log entry payload, represented as a protocol
  721. // buffer. Some Google Cloud Platform services use this field for their
  722. // log entry payloads.
  723. ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"`
  724. // ReceiveTimestamp: Output only. The time the log entry was received by
  725. // Logging.
  726. ReceiveTimestamp string `json:"receiveTimestamp,omitempty"`
  727. // Resource: Required. The primary monitored resource associated with
  728. // this log entry.Example: a log entry that reports a database error
  729. // would be associated with the monitored resource designating the
  730. // particular database that reported the error.
  731. Resource *MonitoredResource `json:"resource,omitempty"`
  732. // Severity: Optional. The severity of the log entry. The default value
  733. // is LogSeverity.DEFAULT.
  734. //
  735. // Possible values:
  736. // "DEFAULT" - (0) The log entry has no assigned severity level.
  737. // "DEBUG" - (100) Debug or trace information.
  738. // "INFO" - (200) Routine information, such as ongoing status or
  739. // performance.
  740. // "NOTICE" - (300) Normal but significant events, such as start up,
  741. // shut down, or a configuration change.
  742. // "WARNING" - (400) Warning events might cause problems.
  743. // "ERROR" - (500) Error events are likely to cause problems.
  744. // "CRITICAL" - (600) Critical events cause more severe problems or
  745. // outages.
  746. // "ALERT" - (700) A person must take an action immediately.
  747. // "EMERGENCY" - (800) One or more systems are unusable.
  748. Severity string `json:"severity,omitempty"`
  749. // SourceLocation: Optional. Source code location information associated
  750. // with the log entry, if any.
  751. SourceLocation *LogEntrySourceLocation `json:"sourceLocation,omitempty"`
  752. // SpanId: Optional. The span ID within the trace associated with the
  753. // log entry.For Trace spans, this is the same format that the Trace API
  754. // v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such
  755. // as <code>"000000000000004a"</code>.
  756. SpanId string `json:"spanId,omitempty"`
  757. // TextPayload: The log entry payload, represented as a Unicode string
  758. // (UTF-8).
  759. TextPayload string `json:"textPayload,omitempty"`
  760. // Timestamp: Optional. The time the event described by the log entry
  761. // occurred. This time is used to compute the log entry's age and to
  762. // enforce the logs retention period. If this field is omitted in a new
  763. // log entry, then Logging assigns it the current time. Timestamps have
  764. // nanosecond accuracy, but trailing zeros in the fractional seconds
  765. // might be omitted when the timestamp is displayed.Incoming log entries
  766. // should have timestamps that are no more than the logs retention
  767. // period in the past, and no more than 24 hours in the future. Log
  768. // entries outside those time boundaries will not be available when
  769. // calling entries.list, but those log entries can still be exported
  770. // with LogSinks.
  771. Timestamp string `json:"timestamp,omitempty"`
  772. // Trace: Optional. Resource name of the trace associated with the log
  773. // entry, if any. If it contains a relative resource name, the name is
  774. // assumed to be relative to //tracing.googleapis.com. Example:
  775. // projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824
  776. Trace string `json:"trace,omitempty"`
  777. // TraceSampled: Optional. The sampling decision of the trace associated
  778. // with the log entry.True means that the trace resource name in the
  779. // trace field was sampled for storage in a trace backend. False means
  780. // that the trace was not sampled for storage when this log entry was
  781. // written, or the sampling decision was unknown at the time. A
  782. // non-sampled trace value is still useful as a request correlation
  783. // identifier. The default is False.
  784. TraceSampled bool `json:"traceSampled,omitempty"`
  785. // ForceSendFields is a list of field names (e.g. "HttpRequest") to
  786. // unconditionally include in API requests. By default, fields with
  787. // empty values are omitted from API requests. However, any non-pointer,
  788. // non-interface field appearing in ForceSendFields will be sent to the
  789. // server regardless of whether the field is empty or not. This may be
  790. // used to include empty fields in Patch requests.
  791. ForceSendFields []string `json:"-"`
  792. // NullFields is a list of field names (e.g. "HttpRequest") to include
  793. // in API requests with the JSON null value. By default, fields with
  794. // empty values are omitted from API requests. However, any field with
  795. // an empty value appearing in NullFields will be sent to the server as
  796. // null. It is an error if a field in this list has a non-empty value.
  797. // This may be used to include null fields in Patch requests.
  798. NullFields []string `json:"-"`
  799. }
  800. func (s *LogEntry) MarshalJSON() ([]byte, error) {
  801. type NoMethod LogEntry
  802. raw := NoMethod(*s)
  803. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  804. }
  805. // LogEntryOperation: Additional information about a potentially
  806. // long-running operation with which a log entry is associated.
  807. type LogEntryOperation struct {
  808. // First: Optional. Set this to True if this is the first log entry in
  809. // the operation.
  810. First bool `json:"first,omitempty"`
  811. // Id: Optional. An arbitrary operation identifier. Log entries with the
  812. // same identifier are assumed to be part of the same operation.
  813. Id string `json:"id,omitempty"`
  814. // Last: Optional. Set this to True if this is the last log entry in the
  815. // operation.
  816. Last bool `json:"last,omitempty"`
  817. // Producer: Optional. An arbitrary producer identifier. The combination
  818. // of id and producer must be globally unique. Examples for producer:
  819. // "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication".
  820. Producer string `json:"producer,omitempty"`
  821. // ForceSendFields is a list of field names (e.g. "First") to
  822. // unconditionally include in API requests. By default, fields with
  823. // empty values are omitted from API requests. However, any non-pointer,
  824. // non-interface field appearing in ForceSendFields will be sent to the
  825. // server regardless of whether the field is empty or not. This may be
  826. // used to include empty fields in Patch requests.
  827. ForceSendFields []string `json:"-"`
  828. // NullFields is a list of field names (e.g. "First") to include in API
  829. // requests with the JSON null value. By default, fields with empty
  830. // values are omitted from API requests. However, any field with an
  831. // empty value appearing in NullFields will be sent to the server as
  832. // null. It is an error if a field in this list has a non-empty value.
  833. // This may be used to include null fields in Patch requests.
  834. NullFields []string `json:"-"`
  835. }
  836. func (s *LogEntryOperation) MarshalJSON() ([]byte, error) {
  837. type NoMethod LogEntryOperation
  838. raw := NoMethod(*s)
  839. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  840. }
  841. // LogEntrySourceLocation: Additional information about the source code
  842. // location that produced the log entry.
  843. type LogEntrySourceLocation struct {
  844. // File: Optional. Source file name. Depending on the runtime
  845. // environment, this might be a simple name or a fully-qualified name.
  846. File string `json:"file,omitempty"`
  847. // Function: Optional. Human-readable name of the function or method
  848. // being invoked, with optional context such as the class or package
  849. // name. This information may be used in contexts such as the logs
  850. // viewer, where a file and line number are less meaningful. The format
  851. // can vary by language. For example: qual.if.ied.Class.method (Java),
  852. // dir/package.func (Go), function (Python).
  853. Function string `json:"function,omitempty"`
  854. // Line: Optional. Line within the source file. 1-based; 0 indicates no
  855. // line number available.
  856. Line int64 `json:"line,omitempty,string"`
  857. // ForceSendFields is a list of field names (e.g. "File") to
  858. // unconditionally include in API requests. By default, fields with
  859. // empty values are omitted from API requests. However, any non-pointer,
  860. // non-interface field appearing in ForceSendFields will be sent to the
  861. // server regardless of whether the field is empty or not. This may be
  862. // used to include empty fields in Patch requests.
  863. ForceSendFields []string `json:"-"`
  864. // NullFields is a list of field names (e.g. "File") to include in API
  865. // requests with the JSON null value. By default, fields with empty
  866. // values are omitted from API requests. However, any field with an
  867. // empty value appearing in NullFields will be sent to the server as
  868. // null. It is an error if a field in this list has a non-empty value.
  869. // This may be used to include null fields in Patch requests.
  870. NullFields []string `json:"-"`
  871. }
  872. func (s *LogEntrySourceLocation) MarshalJSON() ([]byte, error) {
  873. type NoMethod LogEntrySourceLocation
  874. raw := NoMethod(*s)
  875. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  876. }
  877. // LogLine: Application log line emitted while processing a request.
  878. type LogLine struct {
  879. // LogMessage: App-provided log message.
  880. LogMessage string `json:"logMessage,omitempty"`
  881. // Severity: Severity of this log entry.
  882. //
  883. // Possible values:
  884. // "DEFAULT" - (0) The log entry has no assigned severity level.
  885. // "DEBUG" - (100) Debug or trace information.
  886. // "INFO" - (200) Routine information, such as ongoing status or
  887. // performance.
  888. // "NOTICE" - (300) Normal but significant events, such as start up,
  889. // shut down, or a configuration change.
  890. // "WARNING" - (400) Warning events might cause problems.
  891. // "ERROR" - (500) Error events are likely to cause problems.
  892. // "CRITICAL" - (600) Critical events cause more severe problems or
  893. // outages.
  894. // "ALERT" - (700) A person must take an action immediately.
  895. // "EMERGENCY" - (800) One or more systems are unusable.
  896. Severity string `json:"severity,omitempty"`
  897. // SourceLocation: Where in the source code this log message was
  898. // written.
  899. SourceLocation *SourceLocation `json:"sourceLocation,omitempty"`
  900. // Time: Approximate time when this log entry was made.
  901. Time string `json:"time,omitempty"`
  902. // ForceSendFields is a list of field names (e.g. "LogMessage") to
  903. // unconditionally include in API requests. By default, fields with
  904. // empty values are omitted from API requests. However, any non-pointer,
  905. // non-interface field appearing in ForceSendFields will be sent to the
  906. // server regardless of whether the field is empty or not. This may be
  907. // used to include empty fields in Patch requests.
  908. ForceSendFields []string `json:"-"`
  909. // NullFields is a list of field names (e.g. "LogMessage") to include in
  910. // API requests with the JSON null value. By default, fields with empty
  911. // values are omitted from API requests. However, any field with an
  912. // empty value appearing in NullFields will be sent to the server as
  913. // null. It is an error if a field in this list has a non-empty value.
  914. // This may be used to include null fields in Patch requests.
  915. NullFields []string `json:"-"`
  916. }
  917. func (s *LogLine) MarshalJSON() ([]byte, error) {
  918. type NoMethod LogLine
  919. raw := NoMethod(*s)
  920. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  921. }
  922. // LogMetric: Describes a logs-based metric. The value of the metric is
  923. // the number of log entries that match a logs filter in a given time
  924. // interval.Logs-based metric can also be used to extract values from
  925. // logs and create a a distribution of the values. The distribution
  926. // records the statistics of the extracted values along with an optional
  927. // histogram of the values as specified by the bucket options.
  928. type LogMetric struct {
  929. // BucketOptions: Optional. The bucket_options are required when the
  930. // logs-based metric is using a DISTRIBUTION value type and it describes
  931. // the bucket boundaries used to create a histogram of the extracted
  932. // values.
  933. BucketOptions *BucketOptions `json:"bucketOptions,omitempty"`
  934. // CreateTime: Output only. The creation timestamp of the metric.This
  935. // field may not be present for older metrics.
  936. CreateTime string `json:"createTime,omitempty"`
  937. // Description: Optional. A description of this metric, which is used in
  938. // documentation. The maximum length of the description is 8000
  939. // characters.
  940. Description string `json:"description,omitempty"`
  941. // Filter: Required. An advanced logs filter which is used to match log
  942. // entries. Example:
  943. // "resource.type=gae_app AND severity>=ERROR"
  944. // The maximum length of the filter is 20000 characters.
  945. Filter string `json:"filter,omitempty"`
  946. // LabelExtractors: Optional. A map from a label key string to an
  947. // extractor expression which is used to extract data from a log entry
  948. // field and assign as the label value. Each label key specified in the
  949. // LabelDescriptor must have an associated extractor expression in this
  950. // map. The syntax of the extractor expression is the same as for the
  951. // value_extractor field.The extracted value is converted to the type
  952. // defined in the label descriptor. If the either the extraction or the
  953. // type conversion fails, the label will have a default value. The
  954. // default value for a string label is an empty string, for an integer
  955. // label its 0, and for a boolean label its false.Note that there are
  956. // upper bounds on the maximum number of labels and the number of active
  957. // time series that are allowed in a project.
  958. LabelExtractors map[string]string `json:"labelExtractors,omitempty"`
  959. // MetricDescriptor: Optional. The metric descriptor associated with the
  960. // logs-based metric. If unspecified, it uses a default metric
  961. // descriptor with a DELTA metric kind, INT64 value type, with no labels
  962. // and a unit of "1". Such a metric counts the number of log entries
  963. // matching the filter expression.The name, type, and description fields
  964. // in the metric_descriptor are output only, and is constructed using
  965. // the name and description field in the LogMetric.To create a
  966. // logs-based metric that records a distribution of log values, a DELTA
  967. // metric kind with a DISTRIBUTION value type must be used along with a
  968. // value_extractor expression in the LogMetric.Each label in the metric
  969. // descriptor must have a matching label name as the key and an
  970. // extractor expression as the value in the label_extractors map.The
  971. // metric_kind and value_type fields in the metric_descriptor cannot be
  972. // updated once initially configured. New labels can be added in the
  973. // metric_descriptor, but existing labels cannot be modified except for
  974. // their description.
  975. MetricDescriptor *MetricDescriptor `json:"metricDescriptor,omitempty"`
  976. // Name: Required. The client-assigned metric identifier. Examples:
  977. // "error_count", "nginx/requests".Metric identifiers are limited to 100
  978. // characters and can include only the following characters: A-Z, a-z,
  979. // 0-9, and the special characters _-.,+!*',()%/. The forward-slash
  980. // character (/) denotes a hierarchy of name pieces, and it cannot be
  981. // the first character of the name.The metric identifier in this field
  982. // must not be URL-encoded
  983. // (https://en.wikipedia.org/wiki/Percent-encoding). However, when the
  984. // metric identifier appears as the [METRIC_ID] part of a metric_name
  985. // API parameter, then the metric identifier must be URL-encoded.
  986. // Example: "projects/my-project/metrics/nginx%2Frequests".
  987. Name string `json:"name,omitempty"`
  988. // UpdateTime: Output only. The last update timestamp of the metric.This
  989. // field may not be present for older metrics.
  990. UpdateTime string `json:"updateTime,omitempty"`
  991. // ValueExtractor: Optional. A value_extractor is required when using a
  992. // distribution logs-based metric to extract the values to record from a
  993. // log entry. Two functions are supported for value extraction:
  994. // EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1.
  995. // field: The name of the log entry field from which the value is to be
  996. // extracted. 2. regex: A regular expression using the Google RE2
  997. // syntax (https://github.com/google/re2/wiki/Syntax) with a single
  998. // capture group to extract data from the specified log entry field.
  999. // The value of the field is converted to a string before applying the
  1000. // regex. It is an error to specify a regex that does not include
  1001. // exactly one capture group.The result of the extraction must be
  1002. // convertible to a double type, as the distribution always records
  1003. // double values. If either the extraction or the conversion to double
  1004. // fails, then those values are not recorded in the
  1005. // distribution.Example: REGEXP_EXTRACT(jsonPayload.request,
  1006. // ".*quantity=(\d+).*")
  1007. ValueExtractor string `json:"valueExtractor,omitempty"`
  1008. // Version: Deprecated. The API version that created or updated this
  1009. // metric. The v2 format is used by default and cannot be changed.
  1010. //
  1011. // Possible values:
  1012. // "V2" - Logging API v2.
  1013. // "V1" - Logging API v1.
  1014. Version string `json:"version,omitempty"`
  1015. // ServerResponse contains the HTTP response code and headers from the
  1016. // server.
  1017. googleapi.ServerResponse `json:"-"`
  1018. // ForceSendFields is a list of field names (e.g. "BucketOptions") to
  1019. // unconditionally include in API requests. By default, fields with
  1020. // empty values are omitted from API requests. However, any non-pointer,
  1021. // non-interface field appearing in ForceSendFields will be sent to the
  1022. // server regardless of whether the field is empty or not. This may be
  1023. // used to include empty fields in Patch requests.
  1024. ForceSendFields []string `json:"-"`
  1025. // NullFields is a list of field names (e.g. "BucketOptions") to include
  1026. // in API requests with the JSON null value. By default, fields with
  1027. // empty values are omitted from API requests. However, any field with
  1028. // an empty value appearing in NullFields will be sent to the server as
  1029. // null. It is an error if a field in this list has a non-empty value.
  1030. // This may be used to include null fields in Patch requests.
  1031. NullFields []string `json:"-"`
  1032. }
  1033. func (s *LogMetric) MarshalJSON() ([]byte, error) {
  1034. type NoMethod LogMetric
  1035. raw := NoMethod(*s)
  1036. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1037. }
  1038. // LogSink: Describes a sink used to export log entries to one of the
  1039. // following destinations in any project: a Cloud Storage bucket, a
  1040. // BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls
  1041. // which log entries are exported. The sink must be created within a
  1042. // project, organization, billing account, or folder.
  1043. type LogSink struct {
  1044. // CreateTime: Output only. The creation timestamp of the sink.This
  1045. // field may not be present for older sinks.
  1046. CreateTime string `json:"createTime,omitempty"`
  1047. // Destination: Required. The export
  1048. // destination:
  1049. // "storage.googleapis.com/[GCS_BUCKET]"
  1050. // "bigquery.googleapi
  1051. // s.com/projects/[PROJECT_ID]/datasets/[DATASET]"
  1052. // "pubsub.googleapis.com
  1053. // /projects/[PROJECT_ID]/topics/[TOPIC_ID]"
  1054. // The sink's writer_identity, set when the sink is created, must have
  1055. // permission to write to the destination or else the log entries are
  1056. // not exported. For more information, see Exporting Logs with Sinks.
  1057. Destination string `json:"destination,omitempty"`
  1058. // Filter: Optional. An advanced logs filter. The only exported log
  1059. // entries are those that are in the resource owning the sink and that
  1060. // match the filter. For
  1061. // example:
  1062. // logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR
  1063. //
  1064. Filter string `json:"filter,omitempty"`
  1065. // IncludeChildren: Optional. This field applies only to sinks owned by
  1066. // organizations and folders. If the field is false, the default, only
  1067. // the logs owned by the sink's parent resource are available for
  1068. // export. If the field is true, then logs from all the projects,
  1069. // folders, and billing accounts contained in the sink's parent resource
  1070. // are also available for export. Whether a particular log entry from
  1071. // the children is exported depends on the sink's filter expression. For
  1072. // example, if this field is true, then the filter
  1073. // resource.type=gce_instance would export all Compute Engine VM
  1074. // instance log entries from all projects in the sink's parent. To only
  1075. // export entries from certain child projects, filter on the project
  1076. // part of the log name:
  1077. // logName:("projects/test-project1/" OR "projects/test-project2/")
  1078. // AND
  1079. // resource.type=gce_instance
  1080. //
  1081. IncludeChildren bool `json:"includeChildren,omitempty"`
  1082. // Name: Required. The client-assigned sink identifier, unique within
  1083. // the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers
  1084. // are limited to 100 characters and can include only the following
  1085. // characters: upper and lower-case alphanumeric characters,
  1086. // underscores, hyphens, and periods.
  1087. Name string `json:"name,omitempty"`
  1088. // OutputVersionFormat: Deprecated. The log entry format to use for this
  1089. // sink's exported log entries. The v2 format is used by default and
  1090. // cannot be changed.
  1091. //
  1092. // Possible values:
  1093. // "VERSION_FORMAT_UNSPECIFIED" - An unspecified format version that
  1094. // will default to V2.
  1095. // "V2" - LogEntry version 2 format.
  1096. // "V1" - LogEntry version 1 format.
  1097. OutputVersionFormat string `json:"outputVersionFormat,omitempty"`
  1098. // UpdateTime: Output only. The last update timestamp of the sink.This
  1099. // field may not be present for older sinks.
  1100. UpdateTime string `json:"updateTime,omitempty"`
  1101. // WriterIdentity: Output only. An IAM identity&mdash;a service account
  1102. // or group&mdash;under which Logging writes the exported log entries to
  1103. // the sink's destination. This field is set by sinks.create and
  1104. // sinks.update based on the value of unique_writer_identity in those
  1105. // methods.Until you grant this identity write-access to the
  1106. // destination, log entry exports from this sink will fail. For more
  1107. // information, see Granting Access for a Resource. Consult the
  1108. // destination service's documentation to determine the appropriate IAM
  1109. // roles to assign to the identity.
  1110. WriterIdentity string `json:"writerIdentity,omitempty"`
  1111. // ServerResponse contains the HTTP response code and headers from the
  1112. // server.
  1113. googleapi.ServerResponse `json:"-"`
  1114. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1115. // unconditionally include in API requests. By default, fields with
  1116. // empty values are omitted from API requests. However, any non-pointer,
  1117. // non-interface field appearing in ForceSendFields will be sent to the
  1118. // server regardless of whether the field is empty or not. This may be
  1119. // used to include empty fields in Patch requests.
  1120. ForceSendFields []string `json:"-"`
  1121. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1122. // API requests with the JSON null value. By default, fields with empty
  1123. // values are omitted from API requests. However, any field with an
  1124. // empty value appearing in NullFields will be sent to the server as
  1125. // null. It is an error if a field in this list has a non-empty value.
  1126. // This may be used to include null fields in Patch requests.
  1127. NullFields []string `json:"-"`
  1128. }
  1129. func (s *LogSink) MarshalJSON() ([]byte, error) {
  1130. type NoMethod LogSink
  1131. raw := NoMethod(*s)
  1132. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1133. }
  1134. // MetricDescriptor: Defines a metric type and its schema. Once a metric
  1135. // descriptor is created, deleting or altering it stops data collection
  1136. // and makes the metric type's existing data unusable.
  1137. type MetricDescriptor struct {
  1138. // Description: A detailed description of the metric, which can be used
  1139. // in documentation.
  1140. Description string `json:"description,omitempty"`
  1141. // DisplayName: A concise name for the metric, which can be displayed in
  1142. // user interfaces. Use sentence case without an ending period, for
  1143. // example "Request count". This field is optional but it is recommended
  1144. // to be set for any metrics associated with user-visible concepts, such
  1145. // as Quota.
  1146. DisplayName string `json:"displayName,omitempty"`
  1147. // Labels: The set of labels that can be used to describe a specific
  1148. // instance of this metric type. For example, the
  1149. // appengine.googleapis.com/http/server/response_latencies metric type
  1150. // has a label for the HTTP response code, response_code, so you can
  1151. // look at latencies for successful responses or just for responses that
  1152. // failed.
  1153. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1154. // Metadata: Optional. Metadata which can be used to guide usage of the
  1155. // metric.
  1156. Metadata *MetricDescriptorMetadata `json:"metadata,omitempty"`
  1157. // MetricKind: Whether the metric records instantaneous values, changes
  1158. // to a value, etc. Some combinations of metric_kind and value_type
  1159. // might not be supported.
  1160. //
  1161. // Possible values:
  1162. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  1163. // "GAUGE" - An instantaneous measurement of a value.
  1164. // "DELTA" - The change in a value during a time interval.
  1165. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  1166. // measurements in a time series should have the same start time and
  1167. // increasing end times, until an event resets the cumulative value to
  1168. // zero and sets a new start time for the following points.
  1169. MetricKind string `json:"metricKind,omitempty"`
  1170. // Name: The resource name of the metric descriptor.
  1171. Name string `json:"name,omitempty"`
  1172. // Type: The metric type, including its DNS name prefix. The type is not
  1173. // URL-encoded. All user-defined metric types have the DNS name
  1174. // custom.googleapis.com or external.googleapis.com. Metric types should
  1175. // use a natural hierarchical grouping. For
  1176. // example:
  1177. // "custom.googleapis.com/invoice/paid/amount"
  1178. // "external.googlea
  1179. // pis.com/prometheus/up"
  1180. // "appengine.googleapis.com/http/server/response_
  1181. // latencies"
  1182. //
  1183. Type string `json:"type,omitempty"`
  1184. // Unit: The unit in which the metric value is reported. It is only
  1185. // applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The
  1186. // supported units are a subset of The Unified Code for Units of Measure
  1187. // (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
  1188. // bit bit
  1189. // By byte
  1190. // s second
  1191. // min minute
  1192. // h hour
  1193. // d dayPrefixes (PREFIX)
  1194. // k kilo (10**3)
  1195. // M mega (10**6)
  1196. // G giga (10**9)
  1197. // T tera (10**12)
  1198. // P peta (10**15)
  1199. // E exa (10**18)
  1200. // Z zetta (10**21)
  1201. // Y yotta (10**24)
  1202. // m milli (10**-3)
  1203. // u micro (10**-6)
  1204. // n nano (10**-9)
  1205. // p pico (10**-12)
  1206. // f femto (10**-15)
  1207. // a atto (10**-18)
  1208. // z zepto (10**-21)
  1209. // y yocto (10**-24)
  1210. // Ki kibi (2**10)
  1211. // Mi mebi (2**20)
  1212. // Gi gibi (2**30)
  1213. // Ti tebi (2**40)GrammarThe grammar also includes these connectors:
  1214. // / division (as an infix operator, e.g. 1/s).
  1215. // . multiplication (as an infix operator, e.g. GBy.d)The grammar for a
  1216. // unit is as follows:
  1217. // Expression = Component { "." Component } { "/" Component }
  1218. // ;
  1219. //
  1220. // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
  1221. // | Annotation
  1222. // | "1"
  1223. // ;
  1224. //
  1225. // Annotation = "{" NAME "}" ;
  1226. // Notes:
  1227. // Annotation is just a comment if it follows a UNIT and is equivalent
  1228. // to 1 if it is used alone. For examples, {requests}/s == 1/s,
  1229. // By{transmitted}/s == By/s.
  1230. // NAME is a sequence of non-blank printable ASCII characters not
  1231. // containing '{' or '}'.
  1232. // 1 represents dimensionless value 1, such as in 1/s.
  1233. // % represents dimensionless value 1/100, and annotates values giving
  1234. // a percentage.
  1235. Unit string `json:"unit,omitempty"`
  1236. // ValueType: Whether the measurement is an integer, a floating-point
  1237. // number, etc. Some combinations of metric_kind and value_type might
  1238. // not be supported.
  1239. //
  1240. // Possible values:
  1241. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  1242. // "BOOL" - The value is a boolean. This value type can be used only
  1243. // if the metric kind is GAUGE.
  1244. // "INT64" - The value is a signed 64-bit integer.
  1245. // "DOUBLE" - The value is a double precision floating point number.
  1246. // "STRING" - The value is a text string. This value type can be used
  1247. // only if the metric kind is GAUGE.
  1248. // "DISTRIBUTION" - The value is a Distribution.
  1249. // "MONEY" - The value is money.
  1250. ValueType string `json:"valueType,omitempty"`
  1251. // ForceSendFields is a list of field names (e.g. "Description") to
  1252. // unconditionally include in API requests. By default, fields with
  1253. // empty values are omitted from API requests. However, any non-pointer,
  1254. // non-interface field appearing in ForceSendFields will be sent to the
  1255. // server regardless of whether the field is empty or not. This may be
  1256. // used to include empty fields in Patch requests.
  1257. ForceSendFields []string `json:"-"`
  1258. // NullFields is a list of field names (e.g. "Description") to include
  1259. // in API requests with the JSON null value. By default, fields with
  1260. // empty values are omitted from API requests. However, any field with
  1261. // an empty value appearing in NullFields will be sent to the server as
  1262. // null. It is an error if a field in this list has a non-empty value.
  1263. // This may be used to include null fields in Patch requests.
  1264. NullFields []string `json:"-"`
  1265. }
  1266. func (s *MetricDescriptor) MarshalJSON() ([]byte, error) {
  1267. type NoMethod MetricDescriptor
  1268. raw := NoMethod(*s)
  1269. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1270. }
  1271. // MetricDescriptorMetadata: Additional annotations that can be used to
  1272. // guide the usage of a metric.
  1273. type MetricDescriptorMetadata struct {
  1274. // IngestDelay: The delay of data points caused by ingestion. Data
  1275. // points older than this age are guaranteed to be ingested and
  1276. // available to be read, excluding data loss due to errors.
  1277. IngestDelay string `json:"ingestDelay,omitempty"`
  1278. // LaunchStage: The launch stage of the metric definition.
  1279. //
  1280. // Possible values:
  1281. // "LAUNCH_STAGE_UNSPECIFIED" - Do not use this default value.
  1282. // "EARLY_ACCESS" - Early Access features are limited to a closed
  1283. // group of testers. To use these features, you must sign up in advance
  1284. // and sign a Trusted Tester agreement (which includes confidentiality
  1285. // provisions). These features may be unstable, changed in
  1286. // backward-incompatible ways, and are not guaranteed to be released.
  1287. // "ALPHA" - Alpha is a limited availability test for releases before
  1288. // they are cleared for widespread use. By Alpha, all significant design
  1289. // issues are resolved and we are in the process of verifying
  1290. // functionality. Alpha customers need to apply for access, agree to
  1291. // applicable terms, and have their projects whitelisted. Alpha releases
  1292. // don’t have to be feature complete, no SLAs are provided, and there
  1293. // are no technical support obligations, but they will be far enough
  1294. // along that customers can actually use them in test environments or
  1295. // for limited-use tests -- just like they would in normal production
  1296. // cases.
  1297. // "BETA" - Beta is the point at which we are ready to open a release
  1298. // for any customer to use. There are no SLA or technical support
  1299. // obligations in a Beta release. Products will be complete from a
  1300. // feature perspective, but may have some open outstanding issues. Beta
  1301. // releases are suitable for limited production use cases.
  1302. // "GA" - GA features are open to all developers and are considered
  1303. // stable and fully qualified for production use.
  1304. // "DEPRECATED" - Deprecated features are scheduled to be shut down
  1305. // and removed. For more information, see the “Deprecation Policy”
  1306. // section of our Terms of Service (https://cloud.google.com/terms/) and
  1307. // the Google Cloud Platform Subject to the Deprecation Policy
  1308. // (https://cloud.google.com/terms/deprecation) documentation.
  1309. LaunchStage string `json:"launchStage,omitempty"`
  1310. // SamplePeriod: The sampling period of metric data points. For metrics
  1311. // which are written periodically, consecutive data points are stored at
  1312. // this time interval, excluding data loss due to errors. Metrics with a
  1313. // higher granularity have a smaller sampling period.
  1314. SamplePeriod string `json:"samplePeriod,omitempty"`
  1315. // ForceSendFields is a list of field names (e.g. "IngestDelay") to
  1316. // unconditionally include in API requests. By default, fields with
  1317. // empty values are omitted from API requests. However, any non-pointer,
  1318. // non-interface field appearing in ForceSendFields will be sent to the
  1319. // server regardless of whether the field is empty or not. This may be
  1320. // used to include empty fields in Patch requests.
  1321. ForceSendFields []string `json:"-"`
  1322. // NullFields is a list of field names (e.g. "IngestDelay") to include
  1323. // in API requests with the JSON null value. By default, fields with
  1324. // empty values are omitted from API requests. However, any field with
  1325. // an empty value appearing in NullFields will be sent to the server as
  1326. // null. It is an error if a field in this list has a non-empty value.
  1327. // This may be used to include null fields in Patch requests.
  1328. NullFields []string `json:"-"`
  1329. }
  1330. func (s *MetricDescriptorMetadata) MarshalJSON() ([]byte, error) {
  1331. type NoMethod MetricDescriptorMetadata
  1332. raw := NoMethod(*s)
  1333. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1334. }
  1335. // MonitoredResource: An object representing a resource that can be used
  1336. // for monitoring, logging, billing, or other purposes. Examples include
  1337. // virtual machine instances, databases, and storage devices such as
  1338. // disks. The type field identifies a MonitoredResourceDescriptor object
  1339. // that describes the resource's schema. Information in the labels field
  1340. // identifies the actual resource and its attributes according to the
  1341. // schema. For example, a particular Compute Engine VM instance could be
  1342. // represented by the following object, because the
  1343. // MonitoredResourceDescriptor for "gce_instance" has labels
  1344. // "instance_id" and "zone":
  1345. // { "type": "gce_instance",
  1346. // "labels": { "instance_id": "12345678901234",
  1347. // "zone": "us-central1-a" }}
  1348. //
  1349. type MonitoredResource struct {
  1350. // Labels: Required. Values for all of the labels listed in the
  1351. // associated monitored resource descriptor. For example, Compute Engine
  1352. // VM instances use the labels "project_id", "instance_id", and "zone".
  1353. Labels map[string]string `json:"labels,omitempty"`
  1354. // Type: Required. The monitored resource type. This field must match
  1355. // the type field of a MonitoredResourceDescriptor object. For example,
  1356. // the type of a Compute Engine VM instance is gce_instance.
  1357. Type string `json:"type,omitempty"`
  1358. // ForceSendFields is a list of field names (e.g. "Labels") to
  1359. // unconditionally include in API requests. By default, fields with
  1360. // empty values are omitted from API requests. However, any non-pointer,
  1361. // non-interface field appearing in ForceSendFields will be sent to the
  1362. // server regardless of whether the field is empty or not. This may be
  1363. // used to include empty fields in Patch requests.
  1364. ForceSendFields []string `json:"-"`
  1365. // NullFields is a list of field names (e.g. "Labels") to include in API
  1366. // requests with the JSON null value. By default, fields with empty
  1367. // values are omitted from API requests. However, any field with an
  1368. // empty value appearing in NullFields will be sent to the server as
  1369. // null. It is an error if a field in this list has a non-empty value.
  1370. // This may be used to include null fields in Patch requests.
  1371. NullFields []string `json:"-"`
  1372. }
  1373. func (s *MonitoredResource) MarshalJSON() ([]byte, error) {
  1374. type NoMethod MonitoredResource
  1375. raw := NoMethod(*s)
  1376. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1377. }
  1378. // MonitoredResourceDescriptor: An object that describes the schema of a
  1379. // MonitoredResource object using a type name and a set of labels. For
  1380. // example, the monitored resource descriptor for Google Compute Engine
  1381. // VM instances has a type of "gce_instance" and specifies the use of
  1382. // the labels "instance_id" and "zone" to identify particular VM
  1383. // instances.Different APIs can support different monitored resource
  1384. // types. APIs generally provide a list method that returns the
  1385. // monitored resource descriptors used by the API.
  1386. type MonitoredResourceDescriptor struct {
  1387. // Description: Optional. A detailed description of the monitored
  1388. // resource type that might be used in documentation.
  1389. Description string `json:"description,omitempty"`
  1390. // DisplayName: Optional. A concise name for the monitored resource type
  1391. // that might be displayed in user interfaces. It should be a Title
  1392. // Cased Noun Phrase, without any article or other determiners. For
  1393. // example, "Google Cloud SQL Database".
  1394. DisplayName string `json:"displayName,omitempty"`
  1395. // Labels: Required. A set of labels used to describe instances of this
  1396. // monitored resource type. For example, an individual Google Cloud SQL
  1397. // database is identified by values for the labels "database_id" and
  1398. // "zone".
  1399. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1400. // Name: Optional. The resource name of the monitored resource
  1401. // descriptor:
  1402. // "projects/{project_id}/monitoredResourceDescriptors/{type}" where
  1403. // {type} is the value of the type field in this object and {project_id}
  1404. // is a project ID that provides API-specific context for accessing the
  1405. // type. APIs that do not use project information can use the resource
  1406. // name format "monitoredResourceDescriptors/{type}".
  1407. Name string `json:"name,omitempty"`
  1408. // Type: Required. The monitored resource type. For example, the type
  1409. // "cloudsql_database" represents databases in Google Cloud SQL. The
  1410. // maximum length of this value is 256 characters.
  1411. Type string `json:"type,omitempty"`
  1412. // ForceSendFields is a list of field names (e.g. "Description") to
  1413. // unconditionally include in API requests. By default, fields with
  1414. // empty values are omitted from API requests. However, any non-pointer,
  1415. // non-interface field appearing in ForceSendFields will be sent to the
  1416. // server regardless of whether the field is empty or not. This may be
  1417. // used to include empty fields in Patch requests.
  1418. ForceSendFields []string `json:"-"`
  1419. // NullFields is a list of field names (e.g. "Description") to include
  1420. // in API requests with the JSON null value. By default, fields with
  1421. // empty values are omitted from API requests. However, any field with
  1422. // an empty value appearing in NullFields will be sent to the server as
  1423. // null. It is an error if a field in this list has a non-empty value.
  1424. // This may be used to include null fields in Patch requests.
  1425. NullFields []string `json:"-"`
  1426. }
  1427. func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) {
  1428. type NoMethod MonitoredResourceDescriptor
  1429. raw := NoMethod(*s)
  1430. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1431. }
  1432. // MonitoredResourceMetadata: Auxiliary metadata for a MonitoredResource
  1433. // object. MonitoredResource objects contain the minimum set of
  1434. // information to uniquely identify a monitored resource instance. There
  1435. // is some other useful auxiliary metadata. Monitoring and Logging use
  1436. // an ingestion pipeline to extract metadata for cloud resources of all
  1437. // types, and store the metadata in this message.
  1438. type MonitoredResourceMetadata struct {
  1439. // SystemLabels: Output only. Values for predefined system metadata
  1440. // labels. System labels are a kind of metadata extracted by Google,
  1441. // including "machine_image", "vpc", "subnet_id", "security_group",
  1442. // "name", etc. System label values can be only strings, Boolean values,
  1443. // or a list of strings. For example:
  1444. // { "name": "my-test-instance",
  1445. // "security_group": ["a", "b", "c"],
  1446. // "spot_instance": false }
  1447. //
  1448. SystemLabels googleapi.RawMessage `json:"systemLabels,omitempty"`
  1449. // UserLabels: Output only. A map of user-defined metadata labels.
  1450. UserLabels map[string]string `json:"userLabels,omitempty"`
  1451. // ForceSendFields is a list of field names (e.g. "SystemLabels") to
  1452. // unconditionally include in API requests. By default, fields with
  1453. // empty values are omitted from API requests. However, any non-pointer,
  1454. // non-interface field appearing in ForceSendFields will be sent to the
  1455. // server regardless of whether the field is empty or not. This may be
  1456. // used to include empty fields in Patch requests.
  1457. ForceSendFields []string `json:"-"`
  1458. // NullFields is a list of field names (e.g. "SystemLabels") to include
  1459. // in API requests with the JSON null value. By default, fields with
  1460. // empty values are omitted from API requests. However, any field with
  1461. // an empty value appearing in NullFields will be sent to the server as
  1462. // null. It is an error if a field in this list has a non-empty value.
  1463. // This may be used to include null fields in Patch requests.
  1464. NullFields []string `json:"-"`
  1465. }
  1466. func (s *MonitoredResourceMetadata) MarshalJSON() ([]byte, error) {
  1467. type NoMethod MonitoredResourceMetadata
  1468. raw := NoMethod(*s)
  1469. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1470. }
  1471. // RequestLog: Complete log information about a single HTTP request to
  1472. // an App Engine application.
  1473. type RequestLog struct {
  1474. // AppEngineRelease: App Engine release version.
  1475. AppEngineRelease string `json:"appEngineRelease,omitempty"`
  1476. // AppId: Application that handled this request.
  1477. AppId string `json:"appId,omitempty"`
  1478. // Cost: An indication of the relative cost of serving this request.
  1479. Cost float64 `json:"cost,omitempty"`
  1480. // EndTime: Time when the request finished.
  1481. EndTime string `json:"endTime,omitempty"`
  1482. // Finished: Whether this request is finished or active.
  1483. Finished bool `json:"finished,omitempty"`
  1484. // First: Whether this is the first RequestLog entry for this request.
  1485. // If an active request has several RequestLog entries written to
  1486. // Stackdriver Logging, then this field will be set for one of them.
  1487. First bool `json:"first,omitempty"`
  1488. // Host: Internet host and port number of the resource being requested.
  1489. Host string `json:"host,omitempty"`
  1490. // HttpVersion: HTTP version of request. Example: "HTTP/1.1".
  1491. HttpVersion string `json:"httpVersion,omitempty"`
  1492. // InstanceId: An identifier for the instance that handled the request.
  1493. InstanceId string `json:"instanceId,omitempty"`
  1494. // InstanceIndex: If the instance processing this request belongs to a
  1495. // manually scaled module, then this is the 0-based index of the
  1496. // instance. Otherwise, this value is -1.
  1497. InstanceIndex int64 `json:"instanceIndex,omitempty"`
  1498. // Ip: Origin IP address.
  1499. Ip string `json:"ip,omitempty"`
  1500. // Latency: Latency of the request.
  1501. Latency string `json:"latency,omitempty"`
  1502. // Line: A list of log lines emitted by the application while serving
  1503. // this request.
  1504. Line []*LogLine `json:"line,omitempty"`
  1505. // MegaCycles: Number of CPU megacycles used to process request.
  1506. MegaCycles int64 `json:"megaCycles,omitempty,string"`
  1507. // Method: Request method. Example: "GET", "HEAD", "PUT", "POST",
  1508. // "DELETE".
  1509. Method string `json:"method,omitempty"`
  1510. // ModuleId: Module of the application that handled this request.
  1511. ModuleId string `json:"moduleId,omitempty"`
  1512. // Nickname: The logged-in user who made the request.Most likely, this
  1513. // is the part of the user's email before the @ sign. The field value is
  1514. // the same for different requests from the same user, but different
  1515. // users can have similar names. This information is also available to
  1516. // the application via the App Engine Users API.This field will be
  1517. // populated starting with App Engine 1.9.21.
  1518. Nickname string `json:"nickname,omitempty"`
  1519. // PendingTime: Time this request spent in the pending request queue.
  1520. PendingTime string `json:"pendingTime,omitempty"`
  1521. // Referrer: Referrer URL of request.
  1522. Referrer string `json:"referrer,omitempty"`
  1523. // RequestId: Globally unique identifier for a request, which is based
  1524. // on the request start time. Request IDs for requests which started
  1525. // later will compare greater as strings than those for requests which
  1526. // started earlier.
  1527. RequestId string `json:"requestId,omitempty"`
  1528. // Resource: Contains the path and query portion of the URL that was
  1529. // requested. For example, if the URL was
  1530. // "http://example.com/app?name=val", the resource would be
  1531. // "/app?name=val". The fragment identifier, which is identified by the
  1532. // # character, is not included.
  1533. Resource string `json:"resource,omitempty"`
  1534. // ResponseSize: Size in bytes sent back to client by request.
  1535. ResponseSize int64 `json:"responseSize,omitempty,string"`
  1536. // SourceReference: Source code for the application that handled this
  1537. // request. There can be more than one source reference per deployed
  1538. // application if source code is distributed among multiple
  1539. // repositories.
  1540. SourceReference []*SourceReference `json:"sourceReference,omitempty"`
  1541. // StartTime: Time when the request started.
  1542. StartTime string `json:"startTime,omitempty"`
  1543. // Status: HTTP response status code. Example: 200, 404.
  1544. Status int64 `json:"status,omitempty"`
  1545. // TaskName: Task name of the request, in the case of an offline
  1546. // request.
  1547. TaskName string `json:"taskName,omitempty"`
  1548. // TaskQueueName: Queue name of the request, in the case of an offline
  1549. // request.
  1550. TaskQueueName string `json:"taskQueueName,omitempty"`
  1551. // TraceId: Stackdriver Trace identifier for this request.
  1552. TraceId string `json:"traceId,omitempty"`
  1553. // TraceSampled: If true, the value in the 'trace_id' field was sampled
  1554. // for storage in a trace backend.
  1555. TraceSampled bool `json:"traceSampled,omitempty"`
  1556. // UrlMapEntry: File or class that handled the request.
  1557. UrlMapEntry string `json:"urlMapEntry,omitempty"`
  1558. // UserAgent: User agent that made the request.
  1559. UserAgent string `json:"userAgent,omitempty"`
  1560. // VersionId: Version of the application that handled this request.
  1561. VersionId string `json:"versionId,omitempty"`
  1562. // WasLoadingRequest: Whether this was a loading request for the
  1563. // instance.
  1564. WasLoadingRequest bool `json:"wasLoadingRequest,omitempty"`
  1565. // ForceSendFields is a list of field names (e.g. "AppEngineRelease") to
  1566. // unconditionally include in API requests. By default, fields with
  1567. // empty values are omitted from API requests. However, any non-pointer,
  1568. // non-interface field appearing in ForceSendFields will be sent to the
  1569. // server regardless of whether the field is empty or not. This may be
  1570. // used to include empty fields in Patch requests.
  1571. ForceSendFields []string `json:"-"`
  1572. // NullFields is a list of field names (e.g. "AppEngineRelease") to
  1573. // include in API requests with the JSON null value. By default, fields
  1574. // with empty values are omitted from API requests. However, any field
  1575. // with an empty value appearing in NullFields will be sent to the
  1576. // server as null. It is an error if a field in this list has a
  1577. // non-empty value. This may be used to include null fields in Patch
  1578. // requests.
  1579. NullFields []string `json:"-"`
  1580. }
  1581. func (s *RequestLog) MarshalJSON() ([]byte, error) {
  1582. type NoMethod RequestLog
  1583. raw := NoMethod(*s)
  1584. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1585. }
  1586. func (s *RequestLog) UnmarshalJSON(data []byte) error {
  1587. type NoMethod RequestLog
  1588. var s1 struct {
  1589. Cost gensupport.JSONFloat64 `json:"cost"`
  1590. *NoMethod
  1591. }
  1592. s1.NoMethod = (*NoMethod)(s)
  1593. if err := json.Unmarshal(data, &s1); err != nil {
  1594. return err
  1595. }
  1596. s.Cost = float64(s1.Cost)
  1597. return nil
  1598. }
  1599. // SourceLocation: Specifies a location in a source code file.
  1600. type SourceLocation struct {
  1601. // File: Source file name. Depending on the runtime environment, this
  1602. // might be a simple name or a fully-qualified name.
  1603. File string `json:"file,omitempty"`
  1604. // FunctionName: Human-readable name of the function or method being
  1605. // invoked, with optional context such as the class or package name.
  1606. // This information is used in contexts such as the logs viewer, where a
  1607. // file and line number are less meaningful. The format can vary by
  1608. // language. For example: qual.if.ied.Class.method (Java),
  1609. // dir/package.func (Go), function (Python).
  1610. FunctionName string `json:"functionName,omitempty"`
  1611. // Line: Line within the source file.
  1612. Line int64 `json:"line,omitempty,string"`
  1613. // ForceSendFields is a list of field names (e.g. "File") to
  1614. // unconditionally include in API requests. By default, fields with
  1615. // empty values are omitted from API requests. However, any non-pointer,
  1616. // non-interface field appearing in ForceSendFields will be sent to the
  1617. // server regardless of whether the field is empty or not. This may be
  1618. // used to include empty fields in Patch requests.
  1619. ForceSendFields []string `json:"-"`
  1620. // NullFields is a list of field names (e.g. "File") to include in API
  1621. // requests with the JSON null value. By default, fields with empty
  1622. // values are omitted from API requests. However, any field with an
  1623. // empty value appearing in NullFields will be sent to the server as
  1624. // null. It is an error if a field in this list has a non-empty value.
  1625. // This may be used to include null fields in Patch requests.
  1626. NullFields []string `json:"-"`
  1627. }
  1628. func (s *SourceLocation) MarshalJSON() ([]byte, error) {
  1629. type NoMethod SourceLocation
  1630. raw := NoMethod(*s)
  1631. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1632. }
  1633. // SourceReference: A reference to a particular snapshot of the source
  1634. // tree used to build and deploy an application.
  1635. type SourceReference struct {
  1636. // Repository: Optional. A URI string identifying the repository.
  1637. // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git"
  1638. Repository string `json:"repository,omitempty"`
  1639. // RevisionId: The canonical and persistent identifier of the deployed
  1640. // revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
  1641. RevisionId string `json:"revisionId,omitempty"`
  1642. // ForceSendFields is a list of field names (e.g. "Repository") to
  1643. // unconditionally include in API requests. By default, fields with
  1644. // empty values are omitted from API requests. However, any non-pointer,
  1645. // non-interface field appearing in ForceSendFields will be sent to the
  1646. // server regardless of whether the field is empty or not. This may be
  1647. // used to include empty fields in Patch requests.
  1648. ForceSendFields []string `json:"-"`
  1649. // NullFields is a list of field names (e.g. "Repository") to include in
  1650. // API requests with the JSON null value. By default, fields with empty
  1651. // values are omitted from API requests. However, any field with an
  1652. // empty value appearing in NullFields will be sent to the server as
  1653. // null. It is an error if a field in this list has a non-empty value.
  1654. // This may be used to include null fields in Patch requests.
  1655. NullFields []string `json:"-"`
  1656. }
  1657. func (s *SourceReference) MarshalJSON() ([]byte, error) {
  1658. type NoMethod SourceReference
  1659. raw := NoMethod(*s)
  1660. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1661. }
  1662. // WriteLogEntriesRequest: The parameters to WriteLogEntries.
  1663. type WriteLogEntriesRequest struct {
  1664. // DryRun: Optional. If true, the request should expect normal response,
  1665. // but the entries won't be persisted nor exported. Useful for checking
  1666. // whether the logging API endpoints are working properly before sending
  1667. // valuable data.
  1668. DryRun bool `json:"dryRun,omitempty"`
  1669. // Entries: Required. The log entries to send to Logging. The order of
  1670. // log entries in this list does not matter. Values supplied in this
  1671. // method's log_name, resource, and labels fields are copied into those
  1672. // log entries in this list that do not include values for their
  1673. // corresponding fields. For more information, see the LogEntry type.If
  1674. // the timestamp or insert_id fields are missing in log entries, then
  1675. // this method supplies the current time or a unique identifier,
  1676. // respectively. The supplied values are chosen so that, among the log
  1677. // entries that did not supply their own values, the entries earlier in
  1678. // the list will sort before the entries later in the list. See the
  1679. // entries.list method.Log entries with timestamps that are more than
  1680. // the logs retention period in the past or more than 24 hours in the
  1681. // future will not be available when calling entries.list. However,
  1682. // those log entries can still be exported with LogSinks.To improve
  1683. // throughput and to avoid exceeding the quota limit for calls to
  1684. // entries.write, you should try to include several log entries in this
  1685. // list, rather than calling this method for each individual log entry.
  1686. Entries []*LogEntry `json:"entries,omitempty"`
  1687. // Labels: Optional. Default labels that are added to the labels field
  1688. // of all log entries in entries. If a log entry already has a label
  1689. // with the same key as a label in this parameter, then the log entry's
  1690. // label is not changed. See LogEntry.
  1691. Labels map[string]string `json:"labels,omitempty"`
  1692. // LogName: Optional. A default log resource name that is assigned to
  1693. // all log entries in entries that do not specify a value for
  1694. // log_name:
  1695. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  1696. // "organizations/[ORGANI
  1697. // ZATION_ID]/logs/[LOG_ID]"
  1698. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[
  1699. // LOG_ID]"
  1700. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  1701. // [LOG_ID] must be URL-encoded. For
  1702. // example:
  1703. // "projects/my-project-id/logs/syslog"
  1704. // "organizations/123456789
  1705. // 0/logs/cloudresourcemanager.googleapis.com%2Factivity"
  1706. // The permission <code>logging.logEntries.create</code> is needed on
  1707. // each project, organization, billing account, or folder that is
  1708. // receiving new log entries, whether the resource is specified in
  1709. // <code>logName</code> or in an individual log entry.
  1710. LogName string `json:"logName,omitempty"`
  1711. // PartialSuccess: Optional. Whether valid entries should be written
  1712. // even if some other entries fail due to INVALID_ARGUMENT or
  1713. // PERMISSION_DENIED errors. If any entry is not written, then the
  1714. // response status is the error associated with one of the failed
  1715. // entries and the response includes error details keyed by the entries'
  1716. // zero-based index in the entries.write method.
  1717. PartialSuccess bool `json:"partialSuccess,omitempty"`
  1718. // Resource: Optional. A default monitored resource object that is
  1719. // assigned to all log entries in entries that do not specify a value
  1720. // for resource. Example:
  1721. // { "type": "gce_instance",
  1722. // "labels": {
  1723. // "zone": "us-central1-a", "instance_id": "00000000000000000000"
  1724. // }}
  1725. // See LogEntry.
  1726. Resource *MonitoredResource `json:"resource,omitempty"`
  1727. // ForceSendFields is a list of field names (e.g. "DryRun") to
  1728. // unconditionally include in API requests. By default, fields with
  1729. // empty values are omitted from API requests. However, any non-pointer,
  1730. // non-interface field appearing in ForceSendFields will be sent to the
  1731. // server regardless of whether the field is empty or not. This may be
  1732. // used to include empty fields in Patch requests.
  1733. ForceSendFields []string `json:"-"`
  1734. // NullFields is a list of field names (e.g. "DryRun") to include in API
  1735. // requests with the JSON null value. By default, fields with empty
  1736. // values are omitted from API requests. However, any field with an
  1737. // empty value appearing in NullFields will be sent to the server as
  1738. // null. It is an error if a field in this list has a non-empty value.
  1739. // This may be used to include null fields in Patch requests.
  1740. NullFields []string `json:"-"`
  1741. }
  1742. func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
  1743. type NoMethod WriteLogEntriesRequest
  1744. raw := NoMethod(*s)
  1745. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1746. }
  1747. // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
  1748. type WriteLogEntriesResponse struct {
  1749. // ServerResponse contains the HTTP response code and headers from the
  1750. // server.
  1751. googleapi.ServerResponse `json:"-"`
  1752. }
  1753. // method id "logging.entries.list":
  1754. type EntriesListCall struct {
  1755. s *Service
  1756. listlogentriesrequest *ListLogEntriesRequest
  1757. urlParams_ gensupport.URLParams
  1758. ctx_ context.Context
  1759. header_ http.Header
  1760. }
  1761. // List: Lists log entries. Use this method to retrieve log entries that
  1762. // originated from a project/folder/organization/billing account. For
  1763. // ways to export log entries, see Exporting Logs.
  1764. func (r *EntriesService) List(listlogentriesrequest *ListLogEntriesRequest) *EntriesListCall {
  1765. c := &EntriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1766. c.listlogentriesrequest = listlogentriesrequest
  1767. return c
  1768. }
  1769. // Fields allows partial responses to be retrieved. See
  1770. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1771. // for more information.
  1772. func (c *EntriesListCall) Fields(s ...googleapi.Field) *EntriesListCall {
  1773. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1774. return c
  1775. }
  1776. // Context sets the context to be used in this call's Do method. Any
  1777. // pending HTTP request will be aborted if the provided context is
  1778. // canceled.
  1779. func (c *EntriesListCall) Context(ctx context.Context) *EntriesListCall {
  1780. c.ctx_ = ctx
  1781. return c
  1782. }
  1783. // Header returns an http.Header that can be modified by the caller to
  1784. // add HTTP headers to the request.
  1785. func (c *EntriesListCall) Header() http.Header {
  1786. if c.header_ == nil {
  1787. c.header_ = make(http.Header)
  1788. }
  1789. return c.header_
  1790. }
  1791. func (c *EntriesListCall) doRequest(alt string) (*http.Response, error) {
  1792. reqHeaders := make(http.Header)
  1793. for k, v := range c.header_ {
  1794. reqHeaders[k] = v
  1795. }
  1796. reqHeaders.Set("User-Agent", c.s.userAgent())
  1797. var body io.Reader = nil
  1798. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listlogentriesrequest)
  1799. if err != nil {
  1800. return nil, err
  1801. }
  1802. reqHeaders.Set("Content-Type", "application/json")
  1803. c.urlParams_.Set("alt", alt)
  1804. c.urlParams_.Set("prettyPrint", "false")
  1805. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:list")
  1806. urls += "?" + c.urlParams_.Encode()
  1807. req, err := http.NewRequest("POST", urls, body)
  1808. if err != nil {
  1809. return nil, err
  1810. }
  1811. req.Header = reqHeaders
  1812. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1813. }
  1814. // Do executes the "logging.entries.list" call.
  1815. // Exactly one of *ListLogEntriesResponse or error will be non-nil. Any
  1816. // non-2xx status code is an error. Response headers are in either
  1817. // *ListLogEntriesResponse.ServerResponse.Header or (if a response was
  1818. // returned at all) in error.(*googleapi.Error).Header. Use
  1819. // googleapi.IsNotModified to check whether the returned error was
  1820. // because http.StatusNotModified was returned.
  1821. func (c *EntriesListCall) Do(opts ...googleapi.CallOption) (*ListLogEntriesResponse, error) {
  1822. gensupport.SetOptions(c.urlParams_, opts...)
  1823. res, err := c.doRequest("json")
  1824. if res != nil && res.StatusCode == http.StatusNotModified {
  1825. if res.Body != nil {
  1826. res.Body.Close()
  1827. }
  1828. return nil, &googleapi.Error{
  1829. Code: res.StatusCode,
  1830. Header: res.Header,
  1831. }
  1832. }
  1833. if err != nil {
  1834. return nil, err
  1835. }
  1836. defer googleapi.CloseBody(res)
  1837. if err := googleapi.CheckResponse(res); err != nil {
  1838. return nil, err
  1839. }
  1840. ret := &ListLogEntriesResponse{
  1841. ServerResponse: googleapi.ServerResponse{
  1842. Header: res.Header,
  1843. HTTPStatusCode: res.StatusCode,
  1844. },
  1845. }
  1846. target := &ret
  1847. if err := gensupport.DecodeResponse(target, res); err != nil {
  1848. return nil, err
  1849. }
  1850. return ret, nil
  1851. // {
  1852. // "description": "Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.",
  1853. // "flatPath": "v2beta1/entries:list",
  1854. // "httpMethod": "POST",
  1855. // "id": "logging.entries.list",
  1856. // "parameterOrder": [],
  1857. // "parameters": {},
  1858. // "path": "v2beta1/entries:list",
  1859. // "request": {
  1860. // "$ref": "ListLogEntriesRequest"
  1861. // },
  1862. // "response": {
  1863. // "$ref": "ListLogEntriesResponse"
  1864. // },
  1865. // "scopes": [
  1866. // "https://www.googleapis.com/auth/cloud-platform",
  1867. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  1868. // "https://www.googleapis.com/auth/logging.admin",
  1869. // "https://www.googleapis.com/auth/logging.read"
  1870. // ]
  1871. // }
  1872. }
  1873. // Pages invokes f for each page of results.
  1874. // A non-nil error returned from f will halt the iteration.
  1875. // The provided context supersedes any context provided to the Context method.
  1876. func (c *EntriesListCall) Pages(ctx context.Context, f func(*ListLogEntriesResponse) error) error {
  1877. c.ctx_ = ctx
  1878. defer func(pt string) { c.listlogentriesrequest.PageToken = pt }(c.listlogentriesrequest.PageToken) // reset paging to original point
  1879. for {
  1880. x, err := c.Do()
  1881. if err != nil {
  1882. return err
  1883. }
  1884. if err := f(x); err != nil {
  1885. return err
  1886. }
  1887. if x.NextPageToken == "" {
  1888. return nil
  1889. }
  1890. c.listlogentriesrequest.PageToken = x.NextPageToken
  1891. }
  1892. }
  1893. // method id "logging.entries.write":
  1894. type EntriesWriteCall struct {
  1895. s *Service
  1896. writelogentriesrequest *WriteLogEntriesRequest
  1897. urlParams_ gensupport.URLParams
  1898. ctx_ context.Context
  1899. header_ http.Header
  1900. }
  1901. // Write: Writes log entries to Logging. This API method is the only way
  1902. // to send log entries to Logging. This method is used, directly or
  1903. // indirectly, by the Logging agent (fluentd) and all logging libraries
  1904. // configured to use Logging. A single request may contain log entries
  1905. // for a maximum of 1000 different resources (projects, organizations,
  1906. // billing accounts or folders)
  1907. func (r *EntriesService) Write(writelogentriesrequest *WriteLogEntriesRequest) *EntriesWriteCall {
  1908. c := &EntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1909. c.writelogentriesrequest = writelogentriesrequest
  1910. return c
  1911. }
  1912. // Fields allows partial responses to be retrieved. See
  1913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1914. // for more information.
  1915. func (c *EntriesWriteCall) Fields(s ...googleapi.Field) *EntriesWriteCall {
  1916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1917. return c
  1918. }
  1919. // Context sets the context to be used in this call's Do method. Any
  1920. // pending HTTP request will be aborted if the provided context is
  1921. // canceled.
  1922. func (c *EntriesWriteCall) Context(ctx context.Context) *EntriesWriteCall {
  1923. c.ctx_ = ctx
  1924. return c
  1925. }
  1926. // Header returns an http.Header that can be modified by the caller to
  1927. // add HTTP headers to the request.
  1928. func (c *EntriesWriteCall) Header() http.Header {
  1929. if c.header_ == nil {
  1930. c.header_ = make(http.Header)
  1931. }
  1932. return c.header_
  1933. }
  1934. func (c *EntriesWriteCall) doRequest(alt string) (*http.Response, error) {
  1935. reqHeaders := make(http.Header)
  1936. for k, v := range c.header_ {
  1937. reqHeaders[k] = v
  1938. }
  1939. reqHeaders.Set("User-Agent", c.s.userAgent())
  1940. var body io.Reader = nil
  1941. body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
  1942. if err != nil {
  1943. return nil, err
  1944. }
  1945. reqHeaders.Set("Content-Type", "application/json")
  1946. c.urlParams_.Set("alt", alt)
  1947. c.urlParams_.Set("prettyPrint", "false")
  1948. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/entries:write")
  1949. urls += "?" + c.urlParams_.Encode()
  1950. req, err := http.NewRequest("POST", urls, body)
  1951. if err != nil {
  1952. return nil, err
  1953. }
  1954. req.Header = reqHeaders
  1955. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1956. }
  1957. // Do executes the "logging.entries.write" call.
  1958. // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any
  1959. // non-2xx status code is an error. Response headers are in either
  1960. // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
  1961. // returned at all) in error.(*googleapi.Error).Header. Use
  1962. // googleapi.IsNotModified to check whether the returned error was
  1963. // because http.StatusNotModified was returned.
  1964. func (c *EntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
  1965. gensupport.SetOptions(c.urlParams_, opts...)
  1966. res, err := c.doRequest("json")
  1967. if res != nil && res.StatusCode == http.StatusNotModified {
  1968. if res.Body != nil {
  1969. res.Body.Close()
  1970. }
  1971. return nil, &googleapi.Error{
  1972. Code: res.StatusCode,
  1973. Header: res.Header,
  1974. }
  1975. }
  1976. if err != nil {
  1977. return nil, err
  1978. }
  1979. defer googleapi.CloseBody(res)
  1980. if err := googleapi.CheckResponse(res); err != nil {
  1981. return nil, err
  1982. }
  1983. ret := &WriteLogEntriesResponse{
  1984. ServerResponse: googleapi.ServerResponse{
  1985. Header: res.Header,
  1986. HTTPStatusCode: res.StatusCode,
  1987. },
  1988. }
  1989. target := &ret
  1990. if err := gensupport.DecodeResponse(target, res); err != nil {
  1991. return nil, err
  1992. }
  1993. return ret, nil
  1994. // {
  1995. // "description": "Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)",
  1996. // "flatPath": "v2beta1/entries:write",
  1997. // "httpMethod": "POST",
  1998. // "id": "logging.entries.write",
  1999. // "parameterOrder": [],
  2000. // "parameters": {},
  2001. // "path": "v2beta1/entries:write",
  2002. // "request": {
  2003. // "$ref": "WriteLogEntriesRequest"
  2004. // },
  2005. // "response": {
  2006. // "$ref": "WriteLogEntriesResponse"
  2007. // },
  2008. // "scopes": [
  2009. // "https://www.googleapis.com/auth/cloud-platform",
  2010. // "https://www.googleapis.com/auth/logging.admin",
  2011. // "https://www.googleapis.com/auth/logging.write"
  2012. // ]
  2013. // }
  2014. }
  2015. // method id "logging.monitoredResourceDescriptors.list":
  2016. type MonitoredResourceDescriptorsListCall struct {
  2017. s *Service
  2018. urlParams_ gensupport.URLParams
  2019. ifNoneMatch_ string
  2020. ctx_ context.Context
  2021. header_ http.Header
  2022. }
  2023. // List: Lists the descriptors for monitored resource types used by
  2024. // Logging.
  2025. func (r *MonitoredResourceDescriptorsService) List() *MonitoredResourceDescriptorsListCall {
  2026. c := &MonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2027. return c
  2028. }
  2029. // PageSize sets the optional parameter "pageSize": The maximum number
  2030. // of results to return from this request. Non-positive values are
  2031. // ignored. The presence of nextPageToken in the response indicates that
  2032. // more results might be available.
  2033. func (c *MonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *MonitoredResourceDescriptorsListCall {
  2034. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2035. return c
  2036. }
  2037. // PageToken sets the optional parameter "pageToken": If present, then
  2038. // retrieve the next batch of results from the preceding call to this
  2039. // method. pageToken must be the value of nextPageToken from the
  2040. // previous response. The values of other method parameters should be
  2041. // identical to those in the previous call.
  2042. func (c *MonitoredResourceDescriptorsListCall) PageToken(pageToken string) *MonitoredResourceDescriptorsListCall {
  2043. c.urlParams_.Set("pageToken", pageToken)
  2044. return c
  2045. }
  2046. // Fields allows partial responses to be retrieved. See
  2047. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2048. // for more information.
  2049. func (c *MonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *MonitoredResourceDescriptorsListCall {
  2050. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2051. return c
  2052. }
  2053. // IfNoneMatch sets the optional parameter which makes the operation
  2054. // fail if the object's ETag matches the given value. This is useful for
  2055. // getting updates only after the object has changed since the last
  2056. // request. Use googleapi.IsNotModified to check whether the response
  2057. // error from Do is the result of In-None-Match.
  2058. func (c *MonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *MonitoredResourceDescriptorsListCall {
  2059. c.ifNoneMatch_ = entityTag
  2060. return c
  2061. }
  2062. // Context sets the context to be used in this call's Do method. Any
  2063. // pending HTTP request will be aborted if the provided context is
  2064. // canceled.
  2065. func (c *MonitoredResourceDescriptorsListCall) Context(ctx context.Context) *MonitoredResourceDescriptorsListCall {
  2066. c.ctx_ = ctx
  2067. return c
  2068. }
  2069. // Header returns an http.Header that can be modified by the caller to
  2070. // add HTTP headers to the request.
  2071. func (c *MonitoredResourceDescriptorsListCall) Header() http.Header {
  2072. if c.header_ == nil {
  2073. c.header_ = make(http.Header)
  2074. }
  2075. return c.header_
  2076. }
  2077. func (c *MonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  2078. reqHeaders := make(http.Header)
  2079. for k, v := range c.header_ {
  2080. reqHeaders[k] = v
  2081. }
  2082. reqHeaders.Set("User-Agent", c.s.userAgent())
  2083. if c.ifNoneMatch_ != "" {
  2084. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2085. }
  2086. var body io.Reader = nil
  2087. c.urlParams_.Set("alt", alt)
  2088. c.urlParams_.Set("prettyPrint", "false")
  2089. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/monitoredResourceDescriptors")
  2090. urls += "?" + c.urlParams_.Encode()
  2091. req, err := http.NewRequest("GET", urls, body)
  2092. if err != nil {
  2093. return nil, err
  2094. }
  2095. req.Header = reqHeaders
  2096. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2097. }
  2098. // Do executes the "logging.monitoredResourceDescriptors.list" call.
  2099. // Exactly one of *ListMonitoredResourceDescriptorsResponse or error
  2100. // will be non-nil. Any non-2xx status code is an error. Response
  2101. // headers are in either
  2102. // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or
  2103. // (if a response was returned at all) in
  2104. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2105. // whether the returned error was because http.StatusNotModified was
  2106. // returned.
  2107. func (c *MonitoredResourceDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
  2108. gensupport.SetOptions(c.urlParams_, opts...)
  2109. res, err := c.doRequest("json")
  2110. if res != nil && res.StatusCode == http.StatusNotModified {
  2111. if res.Body != nil {
  2112. res.Body.Close()
  2113. }
  2114. return nil, &googleapi.Error{
  2115. Code: res.StatusCode,
  2116. Header: res.Header,
  2117. }
  2118. }
  2119. if err != nil {
  2120. return nil, err
  2121. }
  2122. defer googleapi.CloseBody(res)
  2123. if err := googleapi.CheckResponse(res); err != nil {
  2124. return nil, err
  2125. }
  2126. ret := &ListMonitoredResourceDescriptorsResponse{
  2127. ServerResponse: googleapi.ServerResponse{
  2128. Header: res.Header,
  2129. HTTPStatusCode: res.StatusCode,
  2130. },
  2131. }
  2132. target := &ret
  2133. if err := gensupport.DecodeResponse(target, res); err != nil {
  2134. return nil, err
  2135. }
  2136. return ret, nil
  2137. // {
  2138. // "description": "Lists the descriptors for monitored resource types used by Logging.",
  2139. // "flatPath": "v2beta1/monitoredResourceDescriptors",
  2140. // "httpMethod": "GET",
  2141. // "id": "logging.monitoredResourceDescriptors.list",
  2142. // "parameterOrder": [],
  2143. // "parameters": {
  2144. // "pageSize": {
  2145. // "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
  2146. // "format": "int32",
  2147. // "location": "query",
  2148. // "type": "integer"
  2149. // },
  2150. // "pageToken": {
  2151. // "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
  2152. // "location": "query",
  2153. // "type": "string"
  2154. // }
  2155. // },
  2156. // "path": "v2beta1/monitoredResourceDescriptors",
  2157. // "response": {
  2158. // "$ref": "ListMonitoredResourceDescriptorsResponse"
  2159. // },
  2160. // "scopes": [
  2161. // "https://www.googleapis.com/auth/cloud-platform",
  2162. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2163. // "https://www.googleapis.com/auth/logging.admin",
  2164. // "https://www.googleapis.com/auth/logging.read"
  2165. // ]
  2166. // }
  2167. }
  2168. // Pages invokes f for each page of results.
  2169. // A non-nil error returned from f will halt the iteration.
  2170. // The provided context supersedes any context provided to the Context method.
  2171. func (c *MonitoredResourceDescriptorsListCall) Pages(ctx context.Context, f func(*ListMonitoredResourceDescriptorsResponse) error) error {
  2172. c.ctx_ = ctx
  2173. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2174. for {
  2175. x, err := c.Do()
  2176. if err != nil {
  2177. return err
  2178. }
  2179. if err := f(x); err != nil {
  2180. return err
  2181. }
  2182. if x.NextPageToken == "" {
  2183. return nil
  2184. }
  2185. c.PageToken(x.NextPageToken)
  2186. }
  2187. }
  2188. // method id "logging.projects.metrics.create":
  2189. type ProjectsMetricsCreateCall struct {
  2190. s *Service
  2191. parent string
  2192. logmetric *LogMetric
  2193. urlParams_ gensupport.URLParams
  2194. ctx_ context.Context
  2195. header_ http.Header
  2196. }
  2197. // Create: Creates a logs-based metric.
  2198. func (r *ProjectsMetricsService) Create(parent string, logmetric *LogMetric) *ProjectsMetricsCreateCall {
  2199. c := &ProjectsMetricsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2200. c.parent = parent
  2201. c.logmetric = logmetric
  2202. return c
  2203. }
  2204. // Fields allows partial responses to be retrieved. See
  2205. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2206. // for more information.
  2207. func (c *ProjectsMetricsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricsCreateCall {
  2208. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2209. return c
  2210. }
  2211. // Context sets the context to be used in this call's Do method. Any
  2212. // pending HTTP request will be aborted if the provided context is
  2213. // canceled.
  2214. func (c *ProjectsMetricsCreateCall) Context(ctx context.Context) *ProjectsMetricsCreateCall {
  2215. c.ctx_ = ctx
  2216. return c
  2217. }
  2218. // Header returns an http.Header that can be modified by the caller to
  2219. // add HTTP headers to the request.
  2220. func (c *ProjectsMetricsCreateCall) Header() http.Header {
  2221. if c.header_ == nil {
  2222. c.header_ = make(http.Header)
  2223. }
  2224. return c.header_
  2225. }
  2226. func (c *ProjectsMetricsCreateCall) doRequest(alt string) (*http.Response, error) {
  2227. reqHeaders := make(http.Header)
  2228. for k, v := range c.header_ {
  2229. reqHeaders[k] = v
  2230. }
  2231. reqHeaders.Set("User-Agent", c.s.userAgent())
  2232. var body io.Reader = nil
  2233. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  2234. if err != nil {
  2235. return nil, err
  2236. }
  2237. reqHeaders.Set("Content-Type", "application/json")
  2238. c.urlParams_.Set("alt", alt)
  2239. c.urlParams_.Set("prettyPrint", "false")
  2240. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/metrics")
  2241. urls += "?" + c.urlParams_.Encode()
  2242. req, err := http.NewRequest("POST", urls, body)
  2243. if err != nil {
  2244. return nil, err
  2245. }
  2246. req.Header = reqHeaders
  2247. googleapi.Expand(req.URL, map[string]string{
  2248. "parent": c.parent,
  2249. })
  2250. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2251. }
  2252. // Do executes the "logging.projects.metrics.create" call.
  2253. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  2254. // status code is an error. Response headers are in either
  2255. // *LogMetric.ServerResponse.Header or (if a response was returned at
  2256. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2257. // to check whether the returned error was because
  2258. // http.StatusNotModified was returned.
  2259. func (c *ProjectsMetricsCreateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  2260. gensupport.SetOptions(c.urlParams_, opts...)
  2261. res, err := c.doRequest("json")
  2262. if res != nil && res.StatusCode == http.StatusNotModified {
  2263. if res.Body != nil {
  2264. res.Body.Close()
  2265. }
  2266. return nil, &googleapi.Error{
  2267. Code: res.StatusCode,
  2268. Header: res.Header,
  2269. }
  2270. }
  2271. if err != nil {
  2272. return nil, err
  2273. }
  2274. defer googleapi.CloseBody(res)
  2275. if err := googleapi.CheckResponse(res); err != nil {
  2276. return nil, err
  2277. }
  2278. ret := &LogMetric{
  2279. ServerResponse: googleapi.ServerResponse{
  2280. Header: res.Header,
  2281. HTTPStatusCode: res.StatusCode,
  2282. },
  2283. }
  2284. target := &ret
  2285. if err := gensupport.DecodeResponse(target, res); err != nil {
  2286. return nil, err
  2287. }
  2288. return ret, nil
  2289. // {
  2290. // "description": "Creates a logs-based metric.",
  2291. // "flatPath": "v2beta1/projects/{projectsId}/metrics",
  2292. // "httpMethod": "POST",
  2293. // "id": "logging.projects.metrics.create",
  2294. // "parameterOrder": [
  2295. // "parent"
  2296. // ],
  2297. // "parameters": {
  2298. // "parent": {
  2299. // "description": "The resource name of the project in which to create the metric:\n\"projects/[PROJECT_ID]\"\nThe new metric must be provided in the request.",
  2300. // "location": "path",
  2301. // "pattern": "^projects/[^/]+$",
  2302. // "required": true,
  2303. // "type": "string"
  2304. // }
  2305. // },
  2306. // "path": "v2beta1/{+parent}/metrics",
  2307. // "request": {
  2308. // "$ref": "LogMetric"
  2309. // },
  2310. // "response": {
  2311. // "$ref": "LogMetric"
  2312. // },
  2313. // "scopes": [
  2314. // "https://www.googleapis.com/auth/cloud-platform",
  2315. // "https://www.googleapis.com/auth/logging.admin",
  2316. // "https://www.googleapis.com/auth/logging.write"
  2317. // ]
  2318. // }
  2319. }
  2320. // method id "logging.projects.metrics.delete":
  2321. type ProjectsMetricsDeleteCall struct {
  2322. s *Service
  2323. metricName string
  2324. urlParams_ gensupport.URLParams
  2325. ctx_ context.Context
  2326. header_ http.Header
  2327. }
  2328. // Delete: Deletes a logs-based metric.
  2329. func (r *ProjectsMetricsService) Delete(metricName string) *ProjectsMetricsDeleteCall {
  2330. c := &ProjectsMetricsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2331. c.metricName = metricName
  2332. return c
  2333. }
  2334. // Fields allows partial responses to be retrieved. See
  2335. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2336. // for more information.
  2337. func (c *ProjectsMetricsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricsDeleteCall {
  2338. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2339. return c
  2340. }
  2341. // Context sets the context to be used in this call's Do method. Any
  2342. // pending HTTP request will be aborted if the provided context is
  2343. // canceled.
  2344. func (c *ProjectsMetricsDeleteCall) Context(ctx context.Context) *ProjectsMetricsDeleteCall {
  2345. c.ctx_ = ctx
  2346. return c
  2347. }
  2348. // Header returns an http.Header that can be modified by the caller to
  2349. // add HTTP headers to the request.
  2350. func (c *ProjectsMetricsDeleteCall) Header() http.Header {
  2351. if c.header_ == nil {
  2352. c.header_ = make(http.Header)
  2353. }
  2354. return c.header_
  2355. }
  2356. func (c *ProjectsMetricsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2357. reqHeaders := make(http.Header)
  2358. for k, v := range c.header_ {
  2359. reqHeaders[k] = v
  2360. }
  2361. reqHeaders.Set("User-Agent", c.s.userAgent())
  2362. var body io.Reader = nil
  2363. c.urlParams_.Set("alt", alt)
  2364. c.urlParams_.Set("prettyPrint", "false")
  2365. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
  2366. urls += "?" + c.urlParams_.Encode()
  2367. req, err := http.NewRequest("DELETE", urls, body)
  2368. if err != nil {
  2369. return nil, err
  2370. }
  2371. req.Header = reqHeaders
  2372. googleapi.Expand(req.URL, map[string]string{
  2373. "metricName": c.metricName,
  2374. })
  2375. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2376. }
  2377. // Do executes the "logging.projects.metrics.delete" call.
  2378. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2379. // code is an error. Response headers are in either
  2380. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2381. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2382. // check whether the returned error was because http.StatusNotModified
  2383. // was returned.
  2384. func (c *ProjectsMetricsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2385. gensupport.SetOptions(c.urlParams_, opts...)
  2386. res, err := c.doRequest("json")
  2387. if res != nil && res.StatusCode == http.StatusNotModified {
  2388. if res.Body != nil {
  2389. res.Body.Close()
  2390. }
  2391. return nil, &googleapi.Error{
  2392. Code: res.StatusCode,
  2393. Header: res.Header,
  2394. }
  2395. }
  2396. if err != nil {
  2397. return nil, err
  2398. }
  2399. defer googleapi.CloseBody(res)
  2400. if err := googleapi.CheckResponse(res); err != nil {
  2401. return nil, err
  2402. }
  2403. ret := &Empty{
  2404. ServerResponse: googleapi.ServerResponse{
  2405. Header: res.Header,
  2406. HTTPStatusCode: res.StatusCode,
  2407. },
  2408. }
  2409. target := &ret
  2410. if err := gensupport.DecodeResponse(target, res); err != nil {
  2411. return nil, err
  2412. }
  2413. return ret, nil
  2414. // {
  2415. // "description": "Deletes a logs-based metric.",
  2416. // "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}",
  2417. // "httpMethod": "DELETE",
  2418. // "id": "logging.projects.metrics.delete",
  2419. // "parameterOrder": [
  2420. // "metricName"
  2421. // ],
  2422. // "parameters": {
  2423. // "metricName": {
  2424. // "description": "The resource name of the metric to delete:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  2425. // "location": "path",
  2426. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  2427. // "required": true,
  2428. // "type": "string"
  2429. // }
  2430. // },
  2431. // "path": "v2beta1/{+metricName}",
  2432. // "response": {
  2433. // "$ref": "Empty"
  2434. // },
  2435. // "scopes": [
  2436. // "https://www.googleapis.com/auth/cloud-platform",
  2437. // "https://www.googleapis.com/auth/logging.admin",
  2438. // "https://www.googleapis.com/auth/logging.write"
  2439. // ]
  2440. // }
  2441. }
  2442. // method id "logging.projects.metrics.get":
  2443. type ProjectsMetricsGetCall struct {
  2444. s *Service
  2445. metricName string
  2446. urlParams_ gensupport.URLParams
  2447. ifNoneMatch_ string
  2448. ctx_ context.Context
  2449. header_ http.Header
  2450. }
  2451. // Get: Gets a logs-based metric.
  2452. func (r *ProjectsMetricsService) Get(metricName string) *ProjectsMetricsGetCall {
  2453. c := &ProjectsMetricsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2454. c.metricName = metricName
  2455. return c
  2456. }
  2457. // Fields allows partial responses to be retrieved. See
  2458. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2459. // for more information.
  2460. func (c *ProjectsMetricsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricsGetCall {
  2461. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2462. return c
  2463. }
  2464. // IfNoneMatch sets the optional parameter which makes the operation
  2465. // fail if the object's ETag matches the given value. This is useful for
  2466. // getting updates only after the object has changed since the last
  2467. // request. Use googleapi.IsNotModified to check whether the response
  2468. // error from Do is the result of In-None-Match.
  2469. func (c *ProjectsMetricsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricsGetCall {
  2470. c.ifNoneMatch_ = entityTag
  2471. return c
  2472. }
  2473. // Context sets the context to be used in this call's Do method. Any
  2474. // pending HTTP request will be aborted if the provided context is
  2475. // canceled.
  2476. func (c *ProjectsMetricsGetCall) Context(ctx context.Context) *ProjectsMetricsGetCall {
  2477. c.ctx_ = ctx
  2478. return c
  2479. }
  2480. // Header returns an http.Header that can be modified by the caller to
  2481. // add HTTP headers to the request.
  2482. func (c *ProjectsMetricsGetCall) Header() http.Header {
  2483. if c.header_ == nil {
  2484. c.header_ = make(http.Header)
  2485. }
  2486. return c.header_
  2487. }
  2488. func (c *ProjectsMetricsGetCall) doRequest(alt string) (*http.Response, error) {
  2489. reqHeaders := make(http.Header)
  2490. for k, v := range c.header_ {
  2491. reqHeaders[k] = v
  2492. }
  2493. reqHeaders.Set("User-Agent", c.s.userAgent())
  2494. if c.ifNoneMatch_ != "" {
  2495. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2496. }
  2497. var body io.Reader = nil
  2498. c.urlParams_.Set("alt", alt)
  2499. c.urlParams_.Set("prettyPrint", "false")
  2500. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
  2501. urls += "?" + c.urlParams_.Encode()
  2502. req, err := http.NewRequest("GET", urls, body)
  2503. if err != nil {
  2504. return nil, err
  2505. }
  2506. req.Header = reqHeaders
  2507. googleapi.Expand(req.URL, map[string]string{
  2508. "metricName": c.metricName,
  2509. })
  2510. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2511. }
  2512. // Do executes the "logging.projects.metrics.get" call.
  2513. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  2514. // status code is an error. Response headers are in either
  2515. // *LogMetric.ServerResponse.Header or (if a response was returned at
  2516. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2517. // to check whether the returned error was because
  2518. // http.StatusNotModified was returned.
  2519. func (c *ProjectsMetricsGetCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  2520. gensupport.SetOptions(c.urlParams_, opts...)
  2521. res, err := c.doRequest("json")
  2522. if res != nil && res.StatusCode == http.StatusNotModified {
  2523. if res.Body != nil {
  2524. res.Body.Close()
  2525. }
  2526. return nil, &googleapi.Error{
  2527. Code: res.StatusCode,
  2528. Header: res.Header,
  2529. }
  2530. }
  2531. if err != nil {
  2532. return nil, err
  2533. }
  2534. defer googleapi.CloseBody(res)
  2535. if err := googleapi.CheckResponse(res); err != nil {
  2536. return nil, err
  2537. }
  2538. ret := &LogMetric{
  2539. ServerResponse: googleapi.ServerResponse{
  2540. Header: res.Header,
  2541. HTTPStatusCode: res.StatusCode,
  2542. },
  2543. }
  2544. target := &ret
  2545. if err := gensupport.DecodeResponse(target, res); err != nil {
  2546. return nil, err
  2547. }
  2548. return ret, nil
  2549. // {
  2550. // "description": "Gets a logs-based metric.",
  2551. // "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}",
  2552. // "httpMethod": "GET",
  2553. // "id": "logging.projects.metrics.get",
  2554. // "parameterOrder": [
  2555. // "metricName"
  2556. // ],
  2557. // "parameters": {
  2558. // "metricName": {
  2559. // "description": "The resource name of the desired metric:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  2560. // "location": "path",
  2561. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  2562. // "required": true,
  2563. // "type": "string"
  2564. // }
  2565. // },
  2566. // "path": "v2beta1/{+metricName}",
  2567. // "response": {
  2568. // "$ref": "LogMetric"
  2569. // },
  2570. // "scopes": [
  2571. // "https://www.googleapis.com/auth/cloud-platform",
  2572. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2573. // "https://www.googleapis.com/auth/logging.admin",
  2574. // "https://www.googleapis.com/auth/logging.read"
  2575. // ]
  2576. // }
  2577. }
  2578. // method id "logging.projects.metrics.list":
  2579. type ProjectsMetricsListCall struct {
  2580. s *Service
  2581. parent string
  2582. urlParams_ gensupport.URLParams
  2583. ifNoneMatch_ string
  2584. ctx_ context.Context
  2585. header_ http.Header
  2586. }
  2587. // List: Lists logs-based metrics.
  2588. func (r *ProjectsMetricsService) List(parent string) *ProjectsMetricsListCall {
  2589. c := &ProjectsMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2590. c.parent = parent
  2591. return c
  2592. }
  2593. // PageSize sets the optional parameter "pageSize": The maximum number
  2594. // of results to return from this request. Non-positive values are
  2595. // ignored. The presence of nextPageToken in the response indicates that
  2596. // more results might be available.
  2597. func (c *ProjectsMetricsListCall) PageSize(pageSize int64) *ProjectsMetricsListCall {
  2598. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2599. return c
  2600. }
  2601. // PageToken sets the optional parameter "pageToken": If present, then
  2602. // retrieve the next batch of results from the preceding call to this
  2603. // method. pageToken must be the value of nextPageToken from the
  2604. // previous response. The values of other method parameters should be
  2605. // identical to those in the previous call.
  2606. func (c *ProjectsMetricsListCall) PageToken(pageToken string) *ProjectsMetricsListCall {
  2607. c.urlParams_.Set("pageToken", pageToken)
  2608. return c
  2609. }
  2610. // Fields allows partial responses to be retrieved. See
  2611. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2612. // for more information.
  2613. func (c *ProjectsMetricsListCall) Fields(s ...googleapi.Field) *ProjectsMetricsListCall {
  2614. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2615. return c
  2616. }
  2617. // IfNoneMatch sets the optional parameter which makes the operation
  2618. // fail if the object's ETag matches the given value. This is useful for
  2619. // getting updates only after the object has changed since the last
  2620. // request. Use googleapi.IsNotModified to check whether the response
  2621. // error from Do is the result of In-None-Match.
  2622. func (c *ProjectsMetricsListCall) IfNoneMatch(entityTag string) *ProjectsMetricsListCall {
  2623. c.ifNoneMatch_ = entityTag
  2624. return c
  2625. }
  2626. // Context sets the context to be used in this call's Do method. Any
  2627. // pending HTTP request will be aborted if the provided context is
  2628. // canceled.
  2629. func (c *ProjectsMetricsListCall) Context(ctx context.Context) *ProjectsMetricsListCall {
  2630. c.ctx_ = ctx
  2631. return c
  2632. }
  2633. // Header returns an http.Header that can be modified by the caller to
  2634. // add HTTP headers to the request.
  2635. func (c *ProjectsMetricsListCall) Header() http.Header {
  2636. if c.header_ == nil {
  2637. c.header_ = make(http.Header)
  2638. }
  2639. return c.header_
  2640. }
  2641. func (c *ProjectsMetricsListCall) doRequest(alt string) (*http.Response, error) {
  2642. reqHeaders := make(http.Header)
  2643. for k, v := range c.header_ {
  2644. reqHeaders[k] = v
  2645. }
  2646. reqHeaders.Set("User-Agent", c.s.userAgent())
  2647. if c.ifNoneMatch_ != "" {
  2648. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2649. }
  2650. var body io.Reader = nil
  2651. c.urlParams_.Set("alt", alt)
  2652. c.urlParams_.Set("prettyPrint", "false")
  2653. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/metrics")
  2654. urls += "?" + c.urlParams_.Encode()
  2655. req, err := http.NewRequest("GET", urls, body)
  2656. if err != nil {
  2657. return nil, err
  2658. }
  2659. req.Header = reqHeaders
  2660. googleapi.Expand(req.URL, map[string]string{
  2661. "parent": c.parent,
  2662. })
  2663. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2664. }
  2665. // Do executes the "logging.projects.metrics.list" call.
  2666. // Exactly one of *ListLogMetricsResponse or error will be non-nil. Any
  2667. // non-2xx status code is an error. Response headers are in either
  2668. // *ListLogMetricsResponse.ServerResponse.Header or (if a response was
  2669. // returned at all) in error.(*googleapi.Error).Header. Use
  2670. // googleapi.IsNotModified to check whether the returned error was
  2671. // because http.StatusNotModified was returned.
  2672. func (c *ProjectsMetricsListCall) Do(opts ...googleapi.CallOption) (*ListLogMetricsResponse, error) {
  2673. gensupport.SetOptions(c.urlParams_, opts...)
  2674. res, err := c.doRequest("json")
  2675. if res != nil && res.StatusCode == http.StatusNotModified {
  2676. if res.Body != nil {
  2677. res.Body.Close()
  2678. }
  2679. return nil, &googleapi.Error{
  2680. Code: res.StatusCode,
  2681. Header: res.Header,
  2682. }
  2683. }
  2684. if err != nil {
  2685. return nil, err
  2686. }
  2687. defer googleapi.CloseBody(res)
  2688. if err := googleapi.CheckResponse(res); err != nil {
  2689. return nil, err
  2690. }
  2691. ret := &ListLogMetricsResponse{
  2692. ServerResponse: googleapi.ServerResponse{
  2693. Header: res.Header,
  2694. HTTPStatusCode: res.StatusCode,
  2695. },
  2696. }
  2697. target := &ret
  2698. if err := gensupport.DecodeResponse(target, res); err != nil {
  2699. return nil, err
  2700. }
  2701. return ret, nil
  2702. // {
  2703. // "description": "Lists logs-based metrics.",
  2704. // "flatPath": "v2beta1/projects/{projectsId}/metrics",
  2705. // "httpMethod": "GET",
  2706. // "id": "logging.projects.metrics.list",
  2707. // "parameterOrder": [
  2708. // "parent"
  2709. // ],
  2710. // "parameters": {
  2711. // "pageSize": {
  2712. // "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
  2713. // "format": "int32",
  2714. // "location": "query",
  2715. // "type": "integer"
  2716. // },
  2717. // "pageToken": {
  2718. // "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
  2719. // "location": "query",
  2720. // "type": "string"
  2721. // },
  2722. // "parent": {
  2723. // "description": "Required. The name of the project containing the metrics:\n\"projects/[PROJECT_ID]\"\n",
  2724. // "location": "path",
  2725. // "pattern": "^projects/[^/]+$",
  2726. // "required": true,
  2727. // "type": "string"
  2728. // }
  2729. // },
  2730. // "path": "v2beta1/{+parent}/metrics",
  2731. // "response": {
  2732. // "$ref": "ListLogMetricsResponse"
  2733. // },
  2734. // "scopes": [
  2735. // "https://www.googleapis.com/auth/cloud-platform",
  2736. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2737. // "https://www.googleapis.com/auth/logging.admin",
  2738. // "https://www.googleapis.com/auth/logging.read"
  2739. // ]
  2740. // }
  2741. }
  2742. // Pages invokes f for each page of results.
  2743. // A non-nil error returned from f will halt the iteration.
  2744. // The provided context supersedes any context provided to the Context method.
  2745. func (c *ProjectsMetricsListCall) Pages(ctx context.Context, f func(*ListLogMetricsResponse) error) error {
  2746. c.ctx_ = ctx
  2747. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2748. for {
  2749. x, err := c.Do()
  2750. if err != nil {
  2751. return err
  2752. }
  2753. if err := f(x); err != nil {
  2754. return err
  2755. }
  2756. if x.NextPageToken == "" {
  2757. return nil
  2758. }
  2759. c.PageToken(x.NextPageToken)
  2760. }
  2761. }
  2762. // method id "logging.projects.metrics.update":
  2763. type ProjectsMetricsUpdateCall struct {
  2764. s *Service
  2765. metricName string
  2766. logmetric *LogMetric
  2767. urlParams_ gensupport.URLParams
  2768. ctx_ context.Context
  2769. header_ http.Header
  2770. }
  2771. // Update: Creates or updates a logs-based metric.
  2772. func (r *ProjectsMetricsService) Update(metricName string, logmetric *LogMetric) *ProjectsMetricsUpdateCall {
  2773. c := &ProjectsMetricsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2774. c.metricName = metricName
  2775. c.logmetric = logmetric
  2776. return c
  2777. }
  2778. // Fields allows partial responses to be retrieved. See
  2779. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2780. // for more information.
  2781. func (c *ProjectsMetricsUpdateCall) Fields(s ...googleapi.Field) *ProjectsMetricsUpdateCall {
  2782. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2783. return c
  2784. }
  2785. // Context sets the context to be used in this call's Do method. Any
  2786. // pending HTTP request will be aborted if the provided context is
  2787. // canceled.
  2788. func (c *ProjectsMetricsUpdateCall) Context(ctx context.Context) *ProjectsMetricsUpdateCall {
  2789. c.ctx_ = ctx
  2790. return c
  2791. }
  2792. // Header returns an http.Header that can be modified by the caller to
  2793. // add HTTP headers to the request.
  2794. func (c *ProjectsMetricsUpdateCall) Header() http.Header {
  2795. if c.header_ == nil {
  2796. c.header_ = make(http.Header)
  2797. }
  2798. return c.header_
  2799. }
  2800. func (c *ProjectsMetricsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2801. reqHeaders := make(http.Header)
  2802. for k, v := range c.header_ {
  2803. reqHeaders[k] = v
  2804. }
  2805. reqHeaders.Set("User-Agent", c.s.userAgent())
  2806. var body io.Reader = nil
  2807. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  2808. if err != nil {
  2809. return nil, err
  2810. }
  2811. reqHeaders.Set("Content-Type", "application/json")
  2812. c.urlParams_.Set("alt", alt)
  2813. c.urlParams_.Set("prettyPrint", "false")
  2814. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+metricName}")
  2815. urls += "?" + c.urlParams_.Encode()
  2816. req, err := http.NewRequest("PUT", urls, body)
  2817. if err != nil {
  2818. return nil, err
  2819. }
  2820. req.Header = reqHeaders
  2821. googleapi.Expand(req.URL, map[string]string{
  2822. "metricName": c.metricName,
  2823. })
  2824. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2825. }
  2826. // Do executes the "logging.projects.metrics.update" call.
  2827. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  2828. // status code is an error. Response headers are in either
  2829. // *LogMetric.ServerResponse.Header or (if a response was returned at
  2830. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2831. // to check whether the returned error was because
  2832. // http.StatusNotModified was returned.
  2833. func (c *ProjectsMetricsUpdateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  2834. gensupport.SetOptions(c.urlParams_, opts...)
  2835. res, err := c.doRequest("json")
  2836. if res != nil && res.StatusCode == http.StatusNotModified {
  2837. if res.Body != nil {
  2838. res.Body.Close()
  2839. }
  2840. return nil, &googleapi.Error{
  2841. Code: res.StatusCode,
  2842. Header: res.Header,
  2843. }
  2844. }
  2845. if err != nil {
  2846. return nil, err
  2847. }
  2848. defer googleapi.CloseBody(res)
  2849. if err := googleapi.CheckResponse(res); err != nil {
  2850. return nil, err
  2851. }
  2852. ret := &LogMetric{
  2853. ServerResponse: googleapi.ServerResponse{
  2854. Header: res.Header,
  2855. HTTPStatusCode: res.StatusCode,
  2856. },
  2857. }
  2858. target := &ret
  2859. if err := gensupport.DecodeResponse(target, res); err != nil {
  2860. return nil, err
  2861. }
  2862. return ret, nil
  2863. // {
  2864. // "description": "Creates or updates a logs-based metric.",
  2865. // "flatPath": "v2beta1/projects/{projectsId}/metrics/{metricsId}",
  2866. // "httpMethod": "PUT",
  2867. // "id": "logging.projects.metrics.update",
  2868. // "parameterOrder": [
  2869. // "metricName"
  2870. // ],
  2871. // "parameters": {
  2872. // "metricName": {
  2873. // "description": "The resource name of the metric to update:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\nThe updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.",
  2874. // "location": "path",
  2875. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  2876. // "required": true,
  2877. // "type": "string"
  2878. // }
  2879. // },
  2880. // "path": "v2beta1/{+metricName}",
  2881. // "request": {
  2882. // "$ref": "LogMetric"
  2883. // },
  2884. // "response": {
  2885. // "$ref": "LogMetric"
  2886. // },
  2887. // "scopes": [
  2888. // "https://www.googleapis.com/auth/cloud-platform",
  2889. // "https://www.googleapis.com/auth/logging.admin",
  2890. // "https://www.googleapis.com/auth/logging.write"
  2891. // ]
  2892. // }
  2893. }
  2894. // method id "logging.projects.sinks.create":
  2895. type ProjectsSinksCreateCall struct {
  2896. s *Service
  2897. parent string
  2898. logsink *LogSink
  2899. urlParams_ gensupport.URLParams
  2900. ctx_ context.Context
  2901. header_ http.Header
  2902. }
  2903. // Create: Creates a sink that exports specified log entries to a
  2904. // destination. The export of newly-ingested log entries begins
  2905. // immediately, unless the sink's writer_identity is not permitted to
  2906. // write to the destination. A sink can export log entries only from the
  2907. // resource owning the sink.
  2908. func (r *ProjectsSinksService) Create(parent string, logsink *LogSink) *ProjectsSinksCreateCall {
  2909. c := &ProjectsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2910. c.parent = parent
  2911. c.logsink = logsink
  2912. return c
  2913. }
  2914. // UniqueWriterIdentity sets the optional parameter
  2915. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  2916. // as writer_identity in the new sink. If this value is omitted or set
  2917. // to false, and if the sink's parent is a project, then the value
  2918. // returned as writer_identity is the same group or service account used
  2919. // by Logging before the addition of writer identities to this API. The
  2920. // sink's destination must be in the same project as the sink itself.If
  2921. // this field is set to true, or if the sink is owned by a non-project
  2922. // resource such as an organization, then the value of writer_identity
  2923. // will be a unique service account used only for exports from the new
  2924. // sink. For more information, see writer_identity in LogSink.
  2925. func (c *ProjectsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksCreateCall {
  2926. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  2927. return c
  2928. }
  2929. // Fields allows partial responses to be retrieved. See
  2930. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2931. // for more information.
  2932. func (c *ProjectsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsSinksCreateCall {
  2933. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2934. return c
  2935. }
  2936. // Context sets the context to be used in this call's Do method. Any
  2937. // pending HTTP request will be aborted if the provided context is
  2938. // canceled.
  2939. func (c *ProjectsSinksCreateCall) Context(ctx context.Context) *ProjectsSinksCreateCall {
  2940. c.ctx_ = ctx
  2941. return c
  2942. }
  2943. // Header returns an http.Header that can be modified by the caller to
  2944. // add HTTP headers to the request.
  2945. func (c *ProjectsSinksCreateCall) Header() http.Header {
  2946. if c.header_ == nil {
  2947. c.header_ = make(http.Header)
  2948. }
  2949. return c.header_
  2950. }
  2951. func (c *ProjectsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  2952. reqHeaders := make(http.Header)
  2953. for k, v := range c.header_ {
  2954. reqHeaders[k] = v
  2955. }
  2956. reqHeaders.Set("User-Agent", c.s.userAgent())
  2957. var body io.Reader = nil
  2958. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  2959. if err != nil {
  2960. return nil, err
  2961. }
  2962. reqHeaders.Set("Content-Type", "application/json")
  2963. c.urlParams_.Set("alt", alt)
  2964. c.urlParams_.Set("prettyPrint", "false")
  2965. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/sinks")
  2966. urls += "?" + c.urlParams_.Encode()
  2967. req, err := http.NewRequest("POST", urls, body)
  2968. if err != nil {
  2969. return nil, err
  2970. }
  2971. req.Header = reqHeaders
  2972. googleapi.Expand(req.URL, map[string]string{
  2973. "parent": c.parent,
  2974. })
  2975. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2976. }
  2977. // Do executes the "logging.projects.sinks.create" call.
  2978. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2979. // code is an error. Response headers are in either
  2980. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2981. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2982. // check whether the returned error was because http.StatusNotModified
  2983. // was returned.
  2984. func (c *ProjectsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2985. gensupport.SetOptions(c.urlParams_, opts...)
  2986. res, err := c.doRequest("json")
  2987. if res != nil && res.StatusCode == http.StatusNotModified {
  2988. if res.Body != nil {
  2989. res.Body.Close()
  2990. }
  2991. return nil, &googleapi.Error{
  2992. Code: res.StatusCode,
  2993. Header: res.Header,
  2994. }
  2995. }
  2996. if err != nil {
  2997. return nil, err
  2998. }
  2999. defer googleapi.CloseBody(res)
  3000. if err := googleapi.CheckResponse(res); err != nil {
  3001. return nil, err
  3002. }
  3003. ret := &LogSink{
  3004. ServerResponse: googleapi.ServerResponse{
  3005. Header: res.Header,
  3006. HTTPStatusCode: res.StatusCode,
  3007. },
  3008. }
  3009. target := &ret
  3010. if err := gensupport.DecodeResponse(target, res); err != nil {
  3011. return nil, err
  3012. }
  3013. return ret, nil
  3014. // {
  3015. // "description": "Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.",
  3016. // "flatPath": "v2beta1/projects/{projectsId}/sinks",
  3017. // "httpMethod": "POST",
  3018. // "id": "logging.projects.sinks.create",
  3019. // "parameterOrder": [
  3020. // "parent"
  3021. // ],
  3022. // "parameters": {
  3023. // "parent": {
  3024. // "description": "Required. The resource in which to create the sink:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
  3025. // "location": "path",
  3026. // "pattern": "^projects/[^/]+$",
  3027. // "required": true,
  3028. // "type": "string"
  3029. // },
  3030. // "uniqueWriterIdentity": {
  3031. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  3032. // "location": "query",
  3033. // "type": "boolean"
  3034. // }
  3035. // },
  3036. // "path": "v2beta1/{+parent}/sinks",
  3037. // "request": {
  3038. // "$ref": "LogSink"
  3039. // },
  3040. // "response": {
  3041. // "$ref": "LogSink"
  3042. // },
  3043. // "scopes": [
  3044. // "https://www.googleapis.com/auth/cloud-platform",
  3045. // "https://www.googleapis.com/auth/logging.admin"
  3046. // ]
  3047. // }
  3048. }
  3049. // method id "logging.projects.sinks.delete":
  3050. type ProjectsSinksDeleteCall struct {
  3051. s *Service
  3052. sinkNameid string
  3053. urlParams_ gensupport.URLParams
  3054. ctx_ context.Context
  3055. header_ http.Header
  3056. }
  3057. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  3058. // then that service account is also deleted.
  3059. func (r *ProjectsSinksService) Delete(sinkNameid string) *ProjectsSinksDeleteCall {
  3060. c := &ProjectsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3061. c.sinkNameid = sinkNameid
  3062. return c
  3063. }
  3064. // Fields allows partial responses to be retrieved. See
  3065. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3066. // for more information.
  3067. func (c *ProjectsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsSinksDeleteCall {
  3068. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3069. return c
  3070. }
  3071. // Context sets the context to be used in this call's Do method. Any
  3072. // pending HTTP request will be aborted if the provided context is
  3073. // canceled.
  3074. func (c *ProjectsSinksDeleteCall) Context(ctx context.Context) *ProjectsSinksDeleteCall {
  3075. c.ctx_ = ctx
  3076. return c
  3077. }
  3078. // Header returns an http.Header that can be modified by the caller to
  3079. // add HTTP headers to the request.
  3080. func (c *ProjectsSinksDeleteCall) Header() http.Header {
  3081. if c.header_ == nil {
  3082. c.header_ = make(http.Header)
  3083. }
  3084. return c.header_
  3085. }
  3086. func (c *ProjectsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  3087. reqHeaders := make(http.Header)
  3088. for k, v := range c.header_ {
  3089. reqHeaders[k] = v
  3090. }
  3091. reqHeaders.Set("User-Agent", c.s.userAgent())
  3092. var body io.Reader = nil
  3093. c.urlParams_.Set("alt", alt)
  3094. c.urlParams_.Set("prettyPrint", "false")
  3095. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
  3096. urls += "?" + c.urlParams_.Encode()
  3097. req, err := http.NewRequest("DELETE", urls, body)
  3098. if err != nil {
  3099. return nil, err
  3100. }
  3101. req.Header = reqHeaders
  3102. googleapi.Expand(req.URL, map[string]string{
  3103. "sinkName": c.sinkNameid,
  3104. })
  3105. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3106. }
  3107. // Do executes the "logging.projects.sinks.delete" call.
  3108. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3109. // code is an error. Response headers are in either
  3110. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3111. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3112. // check whether the returned error was because http.StatusNotModified
  3113. // was returned.
  3114. func (c *ProjectsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3115. gensupport.SetOptions(c.urlParams_, opts...)
  3116. res, err := c.doRequest("json")
  3117. if res != nil && res.StatusCode == http.StatusNotModified {
  3118. if res.Body != nil {
  3119. res.Body.Close()
  3120. }
  3121. return nil, &googleapi.Error{
  3122. Code: res.StatusCode,
  3123. Header: res.Header,
  3124. }
  3125. }
  3126. if err != nil {
  3127. return nil, err
  3128. }
  3129. defer googleapi.CloseBody(res)
  3130. if err := googleapi.CheckResponse(res); err != nil {
  3131. return nil, err
  3132. }
  3133. ret := &Empty{
  3134. ServerResponse: googleapi.ServerResponse{
  3135. Header: res.Header,
  3136. HTTPStatusCode: res.StatusCode,
  3137. },
  3138. }
  3139. target := &ret
  3140. if err := gensupport.DecodeResponse(target, res); err != nil {
  3141. return nil, err
  3142. }
  3143. return ret, nil
  3144. // {
  3145. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  3146. // "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}",
  3147. // "httpMethod": "DELETE",
  3148. // "id": "logging.projects.sinks.delete",
  3149. // "parameterOrder": [
  3150. // "sinkName"
  3151. // ],
  3152. // "parameters": {
  3153. // "sinkName": {
  3154. // "description": "Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]\"\n\"folders/[FOLDER_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
  3155. // "location": "path",
  3156. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  3157. // "required": true,
  3158. // "type": "string"
  3159. // }
  3160. // },
  3161. // "path": "v2beta1/{+sinkName}",
  3162. // "response": {
  3163. // "$ref": "Empty"
  3164. // },
  3165. // "scopes": [
  3166. // "https://www.googleapis.com/auth/cloud-platform",
  3167. // "https://www.googleapis.com/auth/logging.admin"
  3168. // ]
  3169. // }
  3170. }
  3171. // method id "logging.projects.sinks.get":
  3172. type ProjectsSinksGetCall struct {
  3173. s *Service
  3174. sinkName string
  3175. urlParams_ gensupport.URLParams
  3176. ifNoneMatch_ string
  3177. ctx_ context.Context
  3178. header_ http.Header
  3179. }
  3180. // Get: Gets a sink.
  3181. func (r *ProjectsSinksService) Get(sinkName string) *ProjectsSinksGetCall {
  3182. c := &ProjectsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3183. c.sinkName = sinkName
  3184. return c
  3185. }
  3186. // Fields allows partial responses to be retrieved. See
  3187. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3188. // for more information.
  3189. func (c *ProjectsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsSinksGetCall {
  3190. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3191. return c
  3192. }
  3193. // IfNoneMatch sets the optional parameter which makes the operation
  3194. // fail if the object's ETag matches the given value. This is useful for
  3195. // getting updates only after the object has changed since the last
  3196. // request. Use googleapi.IsNotModified to check whether the response
  3197. // error from Do is the result of In-None-Match.
  3198. func (c *ProjectsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsSinksGetCall {
  3199. c.ifNoneMatch_ = entityTag
  3200. return c
  3201. }
  3202. // Context sets the context to be used in this call's Do method. Any
  3203. // pending HTTP request will be aborted if the provided context is
  3204. // canceled.
  3205. func (c *ProjectsSinksGetCall) Context(ctx context.Context) *ProjectsSinksGetCall {
  3206. c.ctx_ = ctx
  3207. return c
  3208. }
  3209. // Header returns an http.Header that can be modified by the caller to
  3210. // add HTTP headers to the request.
  3211. func (c *ProjectsSinksGetCall) Header() http.Header {
  3212. if c.header_ == nil {
  3213. c.header_ = make(http.Header)
  3214. }
  3215. return c.header_
  3216. }
  3217. func (c *ProjectsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  3218. reqHeaders := make(http.Header)
  3219. for k, v := range c.header_ {
  3220. reqHeaders[k] = v
  3221. }
  3222. reqHeaders.Set("User-Agent", c.s.userAgent())
  3223. if c.ifNoneMatch_ != "" {
  3224. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3225. }
  3226. var body io.Reader = nil
  3227. c.urlParams_.Set("alt", alt)
  3228. c.urlParams_.Set("prettyPrint", "false")
  3229. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
  3230. urls += "?" + c.urlParams_.Encode()
  3231. req, err := http.NewRequest("GET", urls, body)
  3232. if err != nil {
  3233. return nil, err
  3234. }
  3235. req.Header = reqHeaders
  3236. googleapi.Expand(req.URL, map[string]string{
  3237. "sinkName": c.sinkName,
  3238. })
  3239. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3240. }
  3241. // Do executes the "logging.projects.sinks.get" call.
  3242. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3243. // code is an error. Response headers are in either
  3244. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3245. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3246. // check whether the returned error was because http.StatusNotModified
  3247. // was returned.
  3248. func (c *ProjectsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3249. gensupport.SetOptions(c.urlParams_, opts...)
  3250. res, err := c.doRequest("json")
  3251. if res != nil && res.StatusCode == http.StatusNotModified {
  3252. if res.Body != nil {
  3253. res.Body.Close()
  3254. }
  3255. return nil, &googleapi.Error{
  3256. Code: res.StatusCode,
  3257. Header: res.Header,
  3258. }
  3259. }
  3260. if err != nil {
  3261. return nil, err
  3262. }
  3263. defer googleapi.CloseBody(res)
  3264. if err := googleapi.CheckResponse(res); err != nil {
  3265. return nil, err
  3266. }
  3267. ret := &LogSink{
  3268. ServerResponse: googleapi.ServerResponse{
  3269. Header: res.Header,
  3270. HTTPStatusCode: res.StatusCode,
  3271. },
  3272. }
  3273. target := &ret
  3274. if err := gensupport.DecodeResponse(target, res); err != nil {
  3275. return nil, err
  3276. }
  3277. return ret, nil
  3278. // {
  3279. // "description": "Gets a sink.",
  3280. // "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}",
  3281. // "httpMethod": "GET",
  3282. // "id": "logging.projects.sinks.get",
  3283. // "parameterOrder": [
  3284. // "sinkName"
  3285. // ],
  3286. // "parameters": {
  3287. // "sinkName": {
  3288. // "description": "Required. The resource name of the sink:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]\"\n\"folders/[FOLDER_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
  3289. // "location": "path",
  3290. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  3291. // "required": true,
  3292. // "type": "string"
  3293. // }
  3294. // },
  3295. // "path": "v2beta1/{+sinkName}",
  3296. // "response": {
  3297. // "$ref": "LogSink"
  3298. // },
  3299. // "scopes": [
  3300. // "https://www.googleapis.com/auth/cloud-platform",
  3301. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3302. // "https://www.googleapis.com/auth/logging.admin",
  3303. // "https://www.googleapis.com/auth/logging.read"
  3304. // ]
  3305. // }
  3306. }
  3307. // method id "logging.projects.sinks.list":
  3308. type ProjectsSinksListCall struct {
  3309. s *Service
  3310. parent string
  3311. urlParams_ gensupport.URLParams
  3312. ifNoneMatch_ string
  3313. ctx_ context.Context
  3314. header_ http.Header
  3315. }
  3316. // List: Lists sinks.
  3317. func (r *ProjectsSinksService) List(parent string) *ProjectsSinksListCall {
  3318. c := &ProjectsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3319. c.parent = parent
  3320. return c
  3321. }
  3322. // PageSize sets the optional parameter "pageSize": The maximum number
  3323. // of results to return from this request. Non-positive values are
  3324. // ignored. The presence of nextPageToken in the response indicates that
  3325. // more results might be available.
  3326. func (c *ProjectsSinksListCall) PageSize(pageSize int64) *ProjectsSinksListCall {
  3327. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3328. return c
  3329. }
  3330. // PageToken sets the optional parameter "pageToken": If present, then
  3331. // retrieve the next batch of results from the preceding call to this
  3332. // method. pageToken must be the value of nextPageToken from the
  3333. // previous response. The values of other method parameters should be
  3334. // identical to those in the previous call.
  3335. func (c *ProjectsSinksListCall) PageToken(pageToken string) *ProjectsSinksListCall {
  3336. c.urlParams_.Set("pageToken", pageToken)
  3337. return c
  3338. }
  3339. // Fields allows partial responses to be retrieved. See
  3340. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3341. // for more information.
  3342. func (c *ProjectsSinksListCall) Fields(s ...googleapi.Field) *ProjectsSinksListCall {
  3343. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3344. return c
  3345. }
  3346. // IfNoneMatch sets the optional parameter which makes the operation
  3347. // fail if the object's ETag matches the given value. This is useful for
  3348. // getting updates only after the object has changed since the last
  3349. // request. Use googleapi.IsNotModified to check whether the response
  3350. // error from Do is the result of In-None-Match.
  3351. func (c *ProjectsSinksListCall) IfNoneMatch(entityTag string) *ProjectsSinksListCall {
  3352. c.ifNoneMatch_ = entityTag
  3353. return c
  3354. }
  3355. // Context sets the context to be used in this call's Do method. Any
  3356. // pending HTTP request will be aborted if the provided context is
  3357. // canceled.
  3358. func (c *ProjectsSinksListCall) Context(ctx context.Context) *ProjectsSinksListCall {
  3359. c.ctx_ = ctx
  3360. return c
  3361. }
  3362. // Header returns an http.Header that can be modified by the caller to
  3363. // add HTTP headers to the request.
  3364. func (c *ProjectsSinksListCall) Header() http.Header {
  3365. if c.header_ == nil {
  3366. c.header_ = make(http.Header)
  3367. }
  3368. return c.header_
  3369. }
  3370. func (c *ProjectsSinksListCall) doRequest(alt string) (*http.Response, error) {
  3371. reqHeaders := make(http.Header)
  3372. for k, v := range c.header_ {
  3373. reqHeaders[k] = v
  3374. }
  3375. reqHeaders.Set("User-Agent", c.s.userAgent())
  3376. if c.ifNoneMatch_ != "" {
  3377. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3378. }
  3379. var body io.Reader = nil
  3380. c.urlParams_.Set("alt", alt)
  3381. c.urlParams_.Set("prettyPrint", "false")
  3382. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+parent}/sinks")
  3383. urls += "?" + c.urlParams_.Encode()
  3384. req, err := http.NewRequest("GET", urls, body)
  3385. if err != nil {
  3386. return nil, err
  3387. }
  3388. req.Header = reqHeaders
  3389. googleapi.Expand(req.URL, map[string]string{
  3390. "parent": c.parent,
  3391. })
  3392. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3393. }
  3394. // Do executes the "logging.projects.sinks.list" call.
  3395. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  3396. // non-2xx status code is an error. Response headers are in either
  3397. // *ListSinksResponse.ServerResponse.Header or (if a response was
  3398. // returned at all) in error.(*googleapi.Error).Header. Use
  3399. // googleapi.IsNotModified to check whether the returned error was
  3400. // because http.StatusNotModified was returned.
  3401. func (c *ProjectsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  3402. gensupport.SetOptions(c.urlParams_, opts...)
  3403. res, err := c.doRequest("json")
  3404. if res != nil && res.StatusCode == http.StatusNotModified {
  3405. if res.Body != nil {
  3406. res.Body.Close()
  3407. }
  3408. return nil, &googleapi.Error{
  3409. Code: res.StatusCode,
  3410. Header: res.Header,
  3411. }
  3412. }
  3413. if err != nil {
  3414. return nil, err
  3415. }
  3416. defer googleapi.CloseBody(res)
  3417. if err := googleapi.CheckResponse(res); err != nil {
  3418. return nil, err
  3419. }
  3420. ret := &ListSinksResponse{
  3421. ServerResponse: googleapi.ServerResponse{
  3422. Header: res.Header,
  3423. HTTPStatusCode: res.StatusCode,
  3424. },
  3425. }
  3426. target := &ret
  3427. if err := gensupport.DecodeResponse(target, res); err != nil {
  3428. return nil, err
  3429. }
  3430. return ret, nil
  3431. // {
  3432. // "description": "Lists sinks.",
  3433. // "flatPath": "v2beta1/projects/{projectsId}/sinks",
  3434. // "httpMethod": "GET",
  3435. // "id": "logging.projects.sinks.list",
  3436. // "parameterOrder": [
  3437. // "parent"
  3438. // ],
  3439. // "parameters": {
  3440. // "pageSize": {
  3441. // "description": "Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.",
  3442. // "format": "int32",
  3443. // "location": "query",
  3444. // "type": "integer"
  3445. // },
  3446. // "pageToken": {
  3447. // "description": "Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.",
  3448. // "location": "query",
  3449. // "type": "string"
  3450. // },
  3451. // "parent": {
  3452. // "description": "Required. The parent resource whose sinks are to be listed:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\n",
  3453. // "location": "path",
  3454. // "pattern": "^projects/[^/]+$",
  3455. // "required": true,
  3456. // "type": "string"
  3457. // }
  3458. // },
  3459. // "path": "v2beta1/{+parent}/sinks",
  3460. // "response": {
  3461. // "$ref": "ListSinksResponse"
  3462. // },
  3463. // "scopes": [
  3464. // "https://www.googleapis.com/auth/cloud-platform",
  3465. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3466. // "https://www.googleapis.com/auth/logging.admin",
  3467. // "https://www.googleapis.com/auth/logging.read"
  3468. // ]
  3469. // }
  3470. }
  3471. // Pages invokes f for each page of results.
  3472. // A non-nil error returned from f will halt the iteration.
  3473. // The provided context supersedes any context provided to the Context method.
  3474. func (c *ProjectsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  3475. c.ctx_ = ctx
  3476. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3477. for {
  3478. x, err := c.Do()
  3479. if err != nil {
  3480. return err
  3481. }
  3482. if err := f(x); err != nil {
  3483. return err
  3484. }
  3485. if x.NextPageToken == "" {
  3486. return nil
  3487. }
  3488. c.PageToken(x.NextPageToken)
  3489. }
  3490. }
  3491. // method id "logging.projects.sinks.update":
  3492. type ProjectsSinksUpdateCall struct {
  3493. s *Service
  3494. sinkNameid string
  3495. logsink *LogSink
  3496. urlParams_ gensupport.URLParams
  3497. ctx_ context.Context
  3498. header_ http.Header
  3499. }
  3500. // Update: Updates a sink. This method replaces the following fields in
  3501. // the existing sink with values from the new sink: destination, and
  3502. // filter.The updated sink might also have a new writer_identity; see
  3503. // the unique_writer_identity field.
  3504. func (r *ProjectsSinksService) Update(sinkNameid string, logsink *LogSink) *ProjectsSinksUpdateCall {
  3505. c := &ProjectsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3506. c.sinkNameid = sinkNameid
  3507. c.logsink = logsink
  3508. return c
  3509. }
  3510. // UniqueWriterIdentity sets the optional parameter
  3511. // "uniqueWriterIdentity": See sinks.create for a description of this
  3512. // field. When updating a sink, the effect of this field on the value of
  3513. // writer_identity in the updated sink depends on both the old and new
  3514. // values of this field:
  3515. // If the old and new values of this field are both false or both true,
  3516. // then there is no change to the sink's writer_identity.
  3517. // If the old value is false and the new value is true, then
  3518. // writer_identity is changed to a unique service account.
  3519. // It is an error if the old value is true and the new value is set to
  3520. // false or defaulted to false.
  3521. func (c *ProjectsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksUpdateCall {
  3522. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  3523. return c
  3524. }
  3525. // UpdateMask sets the optional parameter "updateMask": Field mask that
  3526. // specifies the fields in sink that need an update. A sink field will
  3527. // be overwritten if, and only if, it is in the update mask. name and
  3528. // output only fields cannot be updated.An empty updateMask is
  3529. // temporarily treated as using the following mask for backwards
  3530. // compatibility purposes: destination,filter,includeChildren At some
  3531. // point in the future, behavior will be removed and specifying an empty
  3532. // updateMask will be an error.For a detailed FieldMask definition, see
  3533. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  3534. // updateMask=filter.
  3535. func (c *ProjectsSinksUpdateCall) UpdateMask(updateMask string) *ProjectsSinksUpdateCall {
  3536. c.urlParams_.Set("updateMask", updateMask)
  3537. return c
  3538. }
  3539. // Fields allows partial responses to be retrieved. See
  3540. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3541. // for more information.
  3542. func (c *ProjectsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsSinksUpdateCall {
  3543. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3544. return c
  3545. }
  3546. // Context sets the context to be used in this call's Do method. Any
  3547. // pending HTTP request will be aborted if the provided context is
  3548. // canceled.
  3549. func (c *ProjectsSinksUpdateCall) Context(ctx context.Context) *ProjectsSinksUpdateCall {
  3550. c.ctx_ = ctx
  3551. return c
  3552. }
  3553. // Header returns an http.Header that can be modified by the caller to
  3554. // add HTTP headers to the request.
  3555. func (c *ProjectsSinksUpdateCall) Header() http.Header {
  3556. if c.header_ == nil {
  3557. c.header_ = make(http.Header)
  3558. }
  3559. return c.header_
  3560. }
  3561. func (c *ProjectsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  3562. reqHeaders := make(http.Header)
  3563. for k, v := range c.header_ {
  3564. reqHeaders[k] = v
  3565. }
  3566. reqHeaders.Set("User-Agent", c.s.userAgent())
  3567. var body io.Reader = nil
  3568. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3569. if err != nil {
  3570. return nil, err
  3571. }
  3572. reqHeaders.Set("Content-Type", "application/json")
  3573. c.urlParams_.Set("alt", alt)
  3574. c.urlParams_.Set("prettyPrint", "false")
  3575. urls := googleapi.ResolveRelative(c.s.BasePath, "v2beta1/{+sinkName}")
  3576. urls += "?" + c.urlParams_.Encode()
  3577. req, err := http.NewRequest("PUT", urls, body)
  3578. if err != nil {
  3579. return nil, err
  3580. }
  3581. req.Header = reqHeaders
  3582. googleapi.Expand(req.URL, map[string]string{
  3583. "sinkName": c.sinkNameid,
  3584. })
  3585. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3586. }
  3587. // Do executes the "logging.projects.sinks.update" call.
  3588. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3589. // code is an error. Response headers are in either
  3590. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3591. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3592. // check whether the returned error was because http.StatusNotModified
  3593. // was returned.
  3594. func (c *ProjectsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3595. gensupport.SetOptions(c.urlParams_, opts...)
  3596. res, err := c.doRequest("json")
  3597. if res != nil && res.StatusCode == http.StatusNotModified {
  3598. if res.Body != nil {
  3599. res.Body.Close()
  3600. }
  3601. return nil, &googleapi.Error{
  3602. Code: res.StatusCode,
  3603. Header: res.Header,
  3604. }
  3605. }
  3606. if err != nil {
  3607. return nil, err
  3608. }
  3609. defer googleapi.CloseBody(res)
  3610. if err := googleapi.CheckResponse(res); err != nil {
  3611. return nil, err
  3612. }
  3613. ret := &LogSink{
  3614. ServerResponse: googleapi.ServerResponse{
  3615. Header: res.Header,
  3616. HTTPStatusCode: res.StatusCode,
  3617. },
  3618. }
  3619. target := &ret
  3620. if err := gensupport.DecodeResponse(target, res); err != nil {
  3621. return nil, err
  3622. }
  3623. return ret, nil
  3624. // {
  3625. // "description": "Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field.",
  3626. // "flatPath": "v2beta1/projects/{projectsId}/sinks/{sinksId}",
  3627. // "httpMethod": "PUT",
  3628. // "id": "logging.projects.sinks.update",
  3629. // "parameterOrder": [
  3630. // "sinkName"
  3631. // ],
  3632. // "parameters": {
  3633. // "sinkName": {
  3634. // "description": "Required. The full resource name of the sink to update, including the parent resource and the sink identifier:\n\"projects/[PROJECT_ID]/sinks/[SINK_ID]\"\n\"organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]\"\n\"folders/[FOLDER_ID]/sinks/[SINK_ID]\"\nExample: \"projects/my-project-id/sinks/my-sink-id\".",
  3635. // "location": "path",
  3636. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  3637. // "required": true,
  3638. // "type": "string"
  3639. // },
  3640. // "uniqueWriterIdentity": {
  3641. // "description": "Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:\nIf the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.\nIf the old value is false and the new value is true, then writer_identity is changed to a unique service account.\nIt is an error if the old value is true and the new value is set to false or defaulted to false.",
  3642. // "location": "query",
  3643. // "type": "boolean"
  3644. // },
  3645. // "updateMask": {
  3646. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  3647. // "format": "google-fieldmask",
  3648. // "location": "query",
  3649. // "type": "string"
  3650. // }
  3651. // },
  3652. // "path": "v2beta1/{+sinkName}",
  3653. // "request": {
  3654. // "$ref": "LogSink"
  3655. // },
  3656. // "response": {
  3657. // "$ref": "LogSink"
  3658. // },
  3659. // "scopes": [
  3660. // "https://www.googleapis.com/auth/cloud-platform",
  3661. // "https://www.googleapis.com/auth/logging.admin"
  3662. // ]
  3663. // }
  3664. }