Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

4925 linhas
186 KiB

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