Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

13969 řádky
505 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package logging provides access to the Stackdriver Logging API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/logging instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/logging/docs/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/logging/v2"
  16. // ...
  17. // ctx := context.Background()
  18. // loggingService, err := logging.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // loggingService, err := logging.NewService(ctx, option.WithScopes(logging.LoggingWriteScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // loggingService, err := logging.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // loggingService, err := logging.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package logging // import "google.golang.org/api/logging/v2"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "logging:v2"
  73. const apiName = "logging"
  74. const apiVersion = "v2"
  75. const basePath = "https://logging.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View your data across Google Cloud Platform services
  81. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  82. // Administrate log data for your projects
  83. LoggingAdminScope = "https://www.googleapis.com/auth/logging.admin"
  84. // View log data for your projects
  85. LoggingReadScope = "https://www.googleapis.com/auth/logging.read"
  86. // Submit log data for your projects
  87. LoggingWriteScope = "https://www.googleapis.com/auth/logging.write"
  88. )
  89. // NewService creates a new Service.
  90. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  91. scopesOption := option.WithScopes(
  92. "https://www.googleapis.com/auth/cloud-platform",
  93. "https://www.googleapis.com/auth/cloud-platform.read-only",
  94. "https://www.googleapis.com/auth/logging.admin",
  95. "https://www.googleapis.com/auth/logging.read",
  96. "https://www.googleapis.com/auth/logging.write",
  97. )
  98. // NOTE: prepend, so we don't override user-specified scopes.
  99. opts = append([]option.ClientOption{scopesOption}, opts...)
  100. client, endpoint, err := htransport.NewClient(ctx, opts...)
  101. if err != nil {
  102. return nil, err
  103. }
  104. s, err := New(client)
  105. if err != nil {
  106. return nil, err
  107. }
  108. if endpoint != "" {
  109. s.BasePath = endpoint
  110. }
  111. return s, nil
  112. }
  113. // New creates a new Service. It uses the provided http.Client for requests.
  114. //
  115. // Deprecated: please use NewService instead.
  116. // To provide a custom HTTP client, use option.WithHTTPClient.
  117. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  118. func New(client *http.Client) (*Service, error) {
  119. if client == nil {
  120. return nil, errors.New("client is nil")
  121. }
  122. s := &Service{client: client, BasePath: basePath}
  123. s.BillingAccounts = NewBillingAccountsService(s)
  124. s.Entries = NewEntriesService(s)
  125. s.Exclusions = NewExclusionsService(s)
  126. s.Folders = NewFoldersService(s)
  127. s.Logs = NewLogsService(s)
  128. s.MonitoredResourceDescriptors = NewMonitoredResourceDescriptorsService(s)
  129. s.Organizations = NewOrganizationsService(s)
  130. s.Projects = NewProjectsService(s)
  131. s.Sinks = NewSinksService(s)
  132. return s, nil
  133. }
  134. type Service struct {
  135. client *http.Client
  136. BasePath string // API endpoint base URL
  137. UserAgent string // optional additional User-Agent fragment
  138. BillingAccounts *BillingAccountsService
  139. Entries *EntriesService
  140. Exclusions *ExclusionsService
  141. Folders *FoldersService
  142. Logs *LogsService
  143. MonitoredResourceDescriptors *MonitoredResourceDescriptorsService
  144. Organizations *OrganizationsService
  145. Projects *ProjectsService
  146. Sinks *SinksService
  147. }
  148. func (s *Service) userAgent() string {
  149. if s.UserAgent == "" {
  150. return googleapi.UserAgent
  151. }
  152. return googleapi.UserAgent + " " + s.UserAgent
  153. }
  154. func NewBillingAccountsService(s *Service) *BillingAccountsService {
  155. rs := &BillingAccountsService{s: s}
  156. rs.Exclusions = NewBillingAccountsExclusionsService(s)
  157. rs.Logs = NewBillingAccountsLogsService(s)
  158. rs.Sinks = NewBillingAccountsSinksService(s)
  159. return rs
  160. }
  161. type BillingAccountsService struct {
  162. s *Service
  163. Exclusions *BillingAccountsExclusionsService
  164. Logs *BillingAccountsLogsService
  165. Sinks *BillingAccountsSinksService
  166. }
  167. func NewBillingAccountsExclusionsService(s *Service) *BillingAccountsExclusionsService {
  168. rs := &BillingAccountsExclusionsService{s: s}
  169. return rs
  170. }
  171. type BillingAccountsExclusionsService struct {
  172. s *Service
  173. }
  174. func NewBillingAccountsLogsService(s *Service) *BillingAccountsLogsService {
  175. rs := &BillingAccountsLogsService{s: s}
  176. return rs
  177. }
  178. type BillingAccountsLogsService struct {
  179. s *Service
  180. }
  181. func NewBillingAccountsSinksService(s *Service) *BillingAccountsSinksService {
  182. rs := &BillingAccountsSinksService{s: s}
  183. return rs
  184. }
  185. type BillingAccountsSinksService struct {
  186. s *Service
  187. }
  188. func NewEntriesService(s *Service) *EntriesService {
  189. rs := &EntriesService{s: s}
  190. return rs
  191. }
  192. type EntriesService struct {
  193. s *Service
  194. }
  195. func NewExclusionsService(s *Service) *ExclusionsService {
  196. rs := &ExclusionsService{s: s}
  197. return rs
  198. }
  199. type ExclusionsService struct {
  200. s *Service
  201. }
  202. func NewFoldersService(s *Service) *FoldersService {
  203. rs := &FoldersService{s: s}
  204. rs.Exclusions = NewFoldersExclusionsService(s)
  205. rs.Logs = NewFoldersLogsService(s)
  206. rs.Sinks = NewFoldersSinksService(s)
  207. return rs
  208. }
  209. type FoldersService struct {
  210. s *Service
  211. Exclusions *FoldersExclusionsService
  212. Logs *FoldersLogsService
  213. Sinks *FoldersSinksService
  214. }
  215. func NewFoldersExclusionsService(s *Service) *FoldersExclusionsService {
  216. rs := &FoldersExclusionsService{s: s}
  217. return rs
  218. }
  219. type FoldersExclusionsService struct {
  220. s *Service
  221. }
  222. func NewFoldersLogsService(s *Service) *FoldersLogsService {
  223. rs := &FoldersLogsService{s: s}
  224. return rs
  225. }
  226. type FoldersLogsService struct {
  227. s *Service
  228. }
  229. func NewFoldersSinksService(s *Service) *FoldersSinksService {
  230. rs := &FoldersSinksService{s: s}
  231. return rs
  232. }
  233. type FoldersSinksService struct {
  234. s *Service
  235. }
  236. func NewLogsService(s *Service) *LogsService {
  237. rs := &LogsService{s: s}
  238. return rs
  239. }
  240. type LogsService struct {
  241. s *Service
  242. }
  243. func NewMonitoredResourceDescriptorsService(s *Service) *MonitoredResourceDescriptorsService {
  244. rs := &MonitoredResourceDescriptorsService{s: s}
  245. return rs
  246. }
  247. type MonitoredResourceDescriptorsService struct {
  248. s *Service
  249. }
  250. func NewOrganizationsService(s *Service) *OrganizationsService {
  251. rs := &OrganizationsService{s: s}
  252. rs.Exclusions = NewOrganizationsExclusionsService(s)
  253. rs.Logs = NewOrganizationsLogsService(s)
  254. rs.Sinks = NewOrganizationsSinksService(s)
  255. return rs
  256. }
  257. type OrganizationsService struct {
  258. s *Service
  259. Exclusions *OrganizationsExclusionsService
  260. Logs *OrganizationsLogsService
  261. Sinks *OrganizationsSinksService
  262. }
  263. func NewOrganizationsExclusionsService(s *Service) *OrganizationsExclusionsService {
  264. rs := &OrganizationsExclusionsService{s: s}
  265. return rs
  266. }
  267. type OrganizationsExclusionsService struct {
  268. s *Service
  269. }
  270. func NewOrganizationsLogsService(s *Service) *OrganizationsLogsService {
  271. rs := &OrganizationsLogsService{s: s}
  272. return rs
  273. }
  274. type OrganizationsLogsService struct {
  275. s *Service
  276. }
  277. func NewOrganizationsSinksService(s *Service) *OrganizationsSinksService {
  278. rs := &OrganizationsSinksService{s: s}
  279. return rs
  280. }
  281. type OrganizationsSinksService struct {
  282. s *Service
  283. }
  284. func NewProjectsService(s *Service) *ProjectsService {
  285. rs := &ProjectsService{s: s}
  286. rs.Exclusions = NewProjectsExclusionsService(s)
  287. rs.Logs = NewProjectsLogsService(s)
  288. rs.Metrics = NewProjectsMetricsService(s)
  289. rs.Sinks = NewProjectsSinksService(s)
  290. return rs
  291. }
  292. type ProjectsService struct {
  293. s *Service
  294. Exclusions *ProjectsExclusionsService
  295. Logs *ProjectsLogsService
  296. Metrics *ProjectsMetricsService
  297. Sinks *ProjectsSinksService
  298. }
  299. func NewProjectsExclusionsService(s *Service) *ProjectsExclusionsService {
  300. rs := &ProjectsExclusionsService{s: s}
  301. return rs
  302. }
  303. type ProjectsExclusionsService struct {
  304. s *Service
  305. }
  306. func NewProjectsLogsService(s *Service) *ProjectsLogsService {
  307. rs := &ProjectsLogsService{s: s}
  308. return rs
  309. }
  310. type ProjectsLogsService struct {
  311. s *Service
  312. }
  313. func NewProjectsMetricsService(s *Service) *ProjectsMetricsService {
  314. rs := &ProjectsMetricsService{s: s}
  315. return rs
  316. }
  317. type ProjectsMetricsService struct {
  318. s *Service
  319. }
  320. func NewProjectsSinksService(s *Service) *ProjectsSinksService {
  321. rs := &ProjectsSinksService{s: s}
  322. return rs
  323. }
  324. type ProjectsSinksService struct {
  325. s *Service
  326. }
  327. func NewSinksService(s *Service) *SinksService {
  328. rs := &SinksService{s: s}
  329. return rs
  330. }
  331. type SinksService struct {
  332. s *Service
  333. }
  334. // BucketOptions: BucketOptions describes the bucket boundaries used to
  335. // create a histogram for the distribution. The buckets can be in a
  336. // linear sequence, an exponential sequence, or each bucket can be
  337. // specified explicitly. BucketOptions does not include the number of
  338. // values in each bucket.A bucket has an inclusive lower bound and
  339. // exclusive upper bound for the values that are counted for that
  340. // bucket. The upper bound of a bucket must be strictly greater than the
  341. // lower bound. The sequence of N buckets for a distribution consists of
  342. // an underflow bucket (number 0), zero or more finite buckets (number 1
  343. // through N - 2) and an overflow bucket (number N - 1). The buckets are
  344. // contiguous: the lower bound of bucket i (i > 0) is the same as the
  345. // upper bound of bucket i - 1. The buckets span the whole range of
  346. // finite values: lower bound of the underflow bucket is -infinity and
  347. // the upper bound of the overflow bucket is +infinity. The finite
  348. // buckets are so-called because both bounds are finite.
  349. type BucketOptions struct {
  350. // ExplicitBuckets: The explicit buckets.
  351. ExplicitBuckets *Explicit `json:"explicitBuckets,omitempty"`
  352. // ExponentialBuckets: The exponential buckets.
  353. ExponentialBuckets *Exponential `json:"exponentialBuckets,omitempty"`
  354. // LinearBuckets: The linear bucket.
  355. LinearBuckets *Linear `json:"linearBuckets,omitempty"`
  356. // ForceSendFields is a list of field names (e.g. "ExplicitBuckets") to
  357. // unconditionally include in API requests. By default, fields with
  358. // empty values are omitted from API requests. However, any non-pointer,
  359. // non-interface field appearing in ForceSendFields will be sent to the
  360. // server regardless of whether the field is empty or not. This may be
  361. // used to include empty fields in Patch requests.
  362. ForceSendFields []string `json:"-"`
  363. // NullFields is a list of field names (e.g. "ExplicitBuckets") to
  364. // include in API requests with the JSON null value. By default, fields
  365. // with empty values are omitted from API requests. However, any field
  366. // with an empty value appearing in NullFields will be sent to the
  367. // server as null. It is an error if a field in this list has a
  368. // non-empty value. This may be used to include null fields in Patch
  369. // requests.
  370. NullFields []string `json:"-"`
  371. }
  372. func (s *BucketOptions) MarshalJSON() ([]byte, error) {
  373. type NoMethod BucketOptions
  374. raw := NoMethod(*s)
  375. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  376. }
  377. // Empty: A generic empty message that you can re-use to avoid defining
  378. // duplicated empty messages in your APIs. A typical example is to use
  379. // it as the request or the response type of an API method. For
  380. // instance:
  381. // service Foo {
  382. // rpc Bar(google.protobuf.Empty) returns
  383. // (google.protobuf.Empty);
  384. // }
  385. // The JSON representation for Empty is empty JSON object {}.
  386. type Empty struct {
  387. // ServerResponse contains the HTTP response code and headers from the
  388. // server.
  389. googleapi.ServerResponse `json:"-"`
  390. }
  391. // Explicit: Specifies a set of buckets with arbitrary widths.There are
  392. // size(bounds) + 1 (= N) buckets. Bucket i has the following
  393. // boundaries:Upper bound (0 <= i < N-1): boundsi Lower bound (1 <= i <
  394. // N); boundsi - 1The bounds field must contain at least one element. If
  395. // bounds has only one element, then there are no finite buckets, and
  396. // that single element is the common boundary of the overflow and
  397. // underflow buckets.
  398. type Explicit struct {
  399. // Bounds: The values must be monotonically increasing.
  400. Bounds []float64 `json:"bounds,omitempty"`
  401. // ForceSendFields is a list of field names (e.g. "Bounds") to
  402. // unconditionally include in API requests. By default, fields with
  403. // empty values are omitted from API requests. However, any non-pointer,
  404. // non-interface field appearing in ForceSendFields will be sent to the
  405. // server regardless of whether the field is empty or not. This may be
  406. // used to include empty fields in Patch requests.
  407. ForceSendFields []string `json:"-"`
  408. // NullFields is a list of field names (e.g. "Bounds") to include in API
  409. // requests with the JSON null value. By default, fields with empty
  410. // values are omitted from API requests. However, any field with an
  411. // empty value appearing in NullFields will be sent to the server as
  412. // null. It is an error if a field in this list has a non-empty value.
  413. // This may be used to include null fields in Patch requests.
  414. NullFields []string `json:"-"`
  415. }
  416. func (s *Explicit) MarshalJSON() ([]byte, error) {
  417. type NoMethod Explicit
  418. raw := NoMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  420. }
  421. // Exponential: Specifies an exponential sequence of buckets that have a
  422. // width that is proportional to the value of the lower bound. Each
  423. // bucket represents a constant relative uncertainty on a specific value
  424. // in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket
  425. // i has the following boundaries:Upper bound (0 <= i < N-1): scale *
  426. // (growth_factor ^ i). Lower bound (1 <= i < N): scale *
  427. // (growth_factor ^ (i - 1)).
  428. type Exponential struct {
  429. // GrowthFactor: Must be greater than 1.
  430. GrowthFactor float64 `json:"growthFactor,omitempty"`
  431. // NumFiniteBuckets: Must be greater than 0.
  432. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  433. // Scale: Must be greater than 0.
  434. Scale float64 `json:"scale,omitempty"`
  435. // ForceSendFields is a list of field names (e.g. "GrowthFactor") to
  436. // unconditionally include in API requests. By default, fields with
  437. // empty values are omitted from API requests. However, any non-pointer,
  438. // non-interface field appearing in ForceSendFields will be sent to the
  439. // server regardless of whether the field is empty or not. This may be
  440. // used to include empty fields in Patch requests.
  441. ForceSendFields []string `json:"-"`
  442. // NullFields is a list of field names (e.g. "GrowthFactor") to include
  443. // in API requests with the JSON null value. By default, fields with
  444. // empty values are omitted from API requests. However, any field with
  445. // an empty value appearing in NullFields will be sent to the server as
  446. // null. It is an error if a field in this list has a non-empty value.
  447. // This may be used to include null fields in Patch requests.
  448. NullFields []string `json:"-"`
  449. }
  450. func (s *Exponential) MarshalJSON() ([]byte, error) {
  451. type NoMethod Exponential
  452. raw := NoMethod(*s)
  453. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  454. }
  455. func (s *Exponential) UnmarshalJSON(data []byte) error {
  456. type NoMethod Exponential
  457. var s1 struct {
  458. GrowthFactor gensupport.JSONFloat64 `json:"growthFactor"`
  459. Scale gensupport.JSONFloat64 `json:"scale"`
  460. *NoMethod
  461. }
  462. s1.NoMethod = (*NoMethod)(s)
  463. if err := json.Unmarshal(data, &s1); err != nil {
  464. return err
  465. }
  466. s.GrowthFactor = float64(s1.GrowthFactor)
  467. s.Scale = float64(s1.Scale)
  468. return nil
  469. }
  470. // HttpRequest: A common proto for logging HTTP requests. Only contains
  471. // semantics defined by the HTTP specification. Product-specific logging
  472. // information MUST be defined in a separate message.
  473. type HttpRequest struct {
  474. // CacheFillBytes: The number of HTTP response bytes inserted into
  475. // cache. Set only when a cache fill was attempted.
  476. CacheFillBytes int64 `json:"cacheFillBytes,omitempty,string"`
  477. // CacheHit: Whether or not an entity was served from cache (with or
  478. // without validation).
  479. CacheHit bool `json:"cacheHit,omitempty"`
  480. // CacheLookup: Whether or not a cache lookup was attempted.
  481. CacheLookup bool `json:"cacheLookup,omitempty"`
  482. // CacheValidatedWithOriginServer: Whether or not the response was
  483. // validated with the origin server before being served from cache. This
  484. // field is only meaningful if cache_hit is True.
  485. CacheValidatedWithOriginServer bool `json:"cacheValidatedWithOriginServer,omitempty"`
  486. // Latency: The request processing latency on the server, from the time
  487. // the request was received until the response was sent.
  488. Latency string `json:"latency,omitempty"`
  489. // Protocol: Protocol used for the request. Examples: "HTTP/1.1",
  490. // "HTTP/2", "websocket"
  491. Protocol string `json:"protocol,omitempty"`
  492. // Referer: The referer URL of the request, as defined in HTTP/1.1
  493. // Header Field Definitions
  494. // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
  495. Referer string `json:"referer,omitempty"`
  496. // RemoteIp: The IP address (IPv4 or IPv6) of the client that issued the
  497. // HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
  498. RemoteIp string `json:"remoteIp,omitempty"`
  499. // RequestMethod: The request method. Examples: "GET", "HEAD", "PUT",
  500. // "POST".
  501. RequestMethod string `json:"requestMethod,omitempty"`
  502. // RequestSize: The size of the HTTP request message in bytes, including
  503. // the request headers and the request body.
  504. RequestSize int64 `json:"requestSize,omitempty,string"`
  505. // RequestUrl: The scheme (http, https), the host name, the path and the
  506. // query portion of the URL that was requested. Example:
  507. // "http://example.com/some/info?color=red".
  508. RequestUrl string `json:"requestUrl,omitempty"`
  509. // ResponseSize: The size of the HTTP response message sent back to the
  510. // client, in bytes, including the response headers and the response
  511. // body.
  512. ResponseSize int64 `json:"responseSize,omitempty,string"`
  513. // ServerIp: The IP address (IPv4 or IPv6) of the origin server that the
  514. // request was sent to.
  515. ServerIp string `json:"serverIp,omitempty"`
  516. // Status: The response code indicating the status of response.
  517. // Examples: 200, 404.
  518. Status int64 `json:"status,omitempty"`
  519. // UserAgent: The user agent sent by the client. Example: "Mozilla/4.0
  520. // (compatible; MSIE 6.0; Windows 98; Q312461; .NET
  521. // CLR 1.0.3705)".
  522. UserAgent string `json:"userAgent,omitempty"`
  523. // ForceSendFields is a list of field names (e.g. "CacheFillBytes") to
  524. // unconditionally include in API requests. By default, fields with
  525. // empty values are omitted from API requests. However, any non-pointer,
  526. // non-interface field appearing in ForceSendFields will be sent to the
  527. // server regardless of whether the field is empty or not. This may be
  528. // used to include empty fields in Patch requests.
  529. ForceSendFields []string `json:"-"`
  530. // NullFields is a list of field names (e.g. "CacheFillBytes") to
  531. // include in API requests with the JSON null value. By default, fields
  532. // with empty values are omitted from API requests. However, any field
  533. // with an empty value appearing in NullFields will be sent to the
  534. // server as null. It is an error if a field in this list has a
  535. // non-empty value. This may be used to include null fields in Patch
  536. // requests.
  537. NullFields []string `json:"-"`
  538. }
  539. func (s *HttpRequest) MarshalJSON() ([]byte, error) {
  540. type NoMethod HttpRequest
  541. raw := NoMethod(*s)
  542. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  543. }
  544. // LabelDescriptor: A description of a label.
  545. type LabelDescriptor struct {
  546. // Description: A human-readable description for the label.
  547. Description string `json:"description,omitempty"`
  548. // Key: The label key.
  549. Key string `json:"key,omitempty"`
  550. // ValueType: The type of data that can be assigned to the label.
  551. //
  552. // Possible values:
  553. // "STRING" - A variable-length string. This is the default.
  554. // "BOOL" - Boolean; true or false.
  555. // "INT64" - A 64-bit signed integer.
  556. ValueType string `json:"valueType,omitempty"`
  557. // ForceSendFields is a list of field names (e.g. "Description") to
  558. // unconditionally include in API requests. By default, fields with
  559. // empty values are omitted from API requests. However, any non-pointer,
  560. // non-interface field appearing in ForceSendFields will be sent to the
  561. // server regardless of whether the field is empty or not. This may be
  562. // used to include empty fields in Patch requests.
  563. ForceSendFields []string `json:"-"`
  564. // NullFields is a list of field names (e.g. "Description") to include
  565. // in API requests with the JSON null value. By default, fields with
  566. // empty values are omitted from API requests. However, any field with
  567. // an empty value appearing in NullFields will be sent to the server as
  568. // null. It is an error if a field in this list has a non-empty value.
  569. // This may be used to include null fields in Patch requests.
  570. NullFields []string `json:"-"`
  571. }
  572. func (s *LabelDescriptor) MarshalJSON() ([]byte, error) {
  573. type NoMethod LabelDescriptor
  574. raw := NoMethod(*s)
  575. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  576. }
  577. // Linear: Specifies a linear sequence of buckets that all have the same
  578. // width (except overflow and underflow). Each bucket represents a
  579. // constant absolute uncertainty on the specific value in the
  580. // bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has
  581. // the following boundaries:Upper bound (0 <= i < N-1): offset + (width
  582. // * i). Lower bound (1 <= i < N): offset + (width * (i - 1)).
  583. type Linear struct {
  584. // NumFiniteBuckets: Must be greater than 0.
  585. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  586. // Offset: Lower bound of the first bucket.
  587. Offset float64 `json:"offset,omitempty"`
  588. // Width: Must be greater than 0.
  589. Width float64 `json:"width,omitempty"`
  590. // ForceSendFields is a list of field names (e.g. "NumFiniteBuckets") to
  591. // unconditionally include in API requests. By default, fields with
  592. // empty values are omitted from API requests. However, any non-pointer,
  593. // non-interface field appearing in ForceSendFields will be sent to the
  594. // server regardless of whether the field is empty or not. This may be
  595. // used to include empty fields in Patch requests.
  596. ForceSendFields []string `json:"-"`
  597. // NullFields is a list of field names (e.g. "NumFiniteBuckets") to
  598. // include in API requests with the JSON null value. By default, fields
  599. // with empty values are omitted from API requests. However, any field
  600. // with an empty value appearing in NullFields will be sent to the
  601. // server as null. It is an error if a field in this list has a
  602. // non-empty value. This may be used to include null fields in Patch
  603. // requests.
  604. NullFields []string `json:"-"`
  605. }
  606. func (s *Linear) MarshalJSON() ([]byte, error) {
  607. type NoMethod Linear
  608. raw := NoMethod(*s)
  609. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  610. }
  611. func (s *Linear) UnmarshalJSON(data []byte) error {
  612. type NoMethod Linear
  613. var s1 struct {
  614. Offset gensupport.JSONFloat64 `json:"offset"`
  615. Width gensupport.JSONFloat64 `json:"width"`
  616. *NoMethod
  617. }
  618. s1.NoMethod = (*NoMethod)(s)
  619. if err := json.Unmarshal(data, &s1); err != nil {
  620. return err
  621. }
  622. s.Offset = float64(s1.Offset)
  623. s.Width = float64(s1.Width)
  624. return nil
  625. }
  626. // ListExclusionsResponse: Result returned from ListExclusions.
  627. type ListExclusionsResponse struct {
  628. // Exclusions: A list of exclusions.
  629. Exclusions []*LogExclusion `json:"exclusions,omitempty"`
  630. // NextPageToken: If there might be more results than appear in this
  631. // response, then nextPageToken is included. To get the next set of
  632. // results, call the same method again using the value of nextPageToken
  633. // as pageToken.
  634. NextPageToken string `json:"nextPageToken,omitempty"`
  635. // ServerResponse contains the HTTP response code and headers from the
  636. // server.
  637. googleapi.ServerResponse `json:"-"`
  638. // ForceSendFields is a list of field names (e.g. "Exclusions") to
  639. // unconditionally include in API requests. By default, fields with
  640. // empty values are omitted from API requests. However, any non-pointer,
  641. // non-interface field appearing in ForceSendFields will be sent to the
  642. // server regardless of whether the field is empty or not. This may be
  643. // used to include empty fields in Patch requests.
  644. ForceSendFields []string `json:"-"`
  645. // NullFields is a list of field names (e.g. "Exclusions") to include in
  646. // API requests with the JSON null value. By default, fields with empty
  647. // values are omitted from API requests. However, any field with an
  648. // empty value appearing in NullFields will be sent to the server as
  649. // null. It is an error if a field in this list has a non-empty value.
  650. // This may be used to include null fields in Patch requests.
  651. NullFields []string `json:"-"`
  652. }
  653. func (s *ListExclusionsResponse) MarshalJSON() ([]byte, error) {
  654. type NoMethod ListExclusionsResponse
  655. raw := NoMethod(*s)
  656. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  657. }
  658. // ListLogEntriesRequest: The parameters to ListLogEntries.
  659. type ListLogEntriesRequest struct {
  660. // Filter: Optional. A filter that chooses which log entries to return.
  661. // See Advanced Logs Filters. Only log entries that match the filter are
  662. // returned. An empty filter matches all log entries in the resources
  663. // listed in resource_names. Referencing a parent resource that is not
  664. // listed in resource_names will cause the filter to return no results.
  665. // The maximum length of the filter is 20000 characters.
  666. Filter string `json:"filter,omitempty"`
  667. // OrderBy: Optional. How the results should be sorted. Presently, the
  668. // only permitted values are "timestamp asc" (default) and "timestamp
  669. // desc". The first option returns entries in order of increasing values
  670. // of LogEntry.timestamp (oldest first), and the second option returns
  671. // entries in order of decreasing timestamps (newest first). Entries
  672. // with equal timestamps are returned in order of their insert_id
  673. // values.
  674. OrderBy string `json:"orderBy,omitempty"`
  675. // PageSize: Optional. The maximum number of results to return from this
  676. // request. Non-positive values are ignored. The presence of
  677. // next_page_token in the response indicates that more results might be
  678. // available.
  679. PageSize int64 `json:"pageSize,omitempty"`
  680. // PageToken: Optional. If present, then retrieve the next batch of
  681. // results from the preceding call to this method. page_token must be
  682. // the value of next_page_token from the previous response. The values
  683. // of other method parameters should be identical to those in the
  684. // previous call.
  685. PageToken string `json:"pageToken,omitempty"`
  686. // ProjectIds: Deprecated. Use resource_names instead. One or more
  687. // project identifiers or project numbers from which to retrieve log
  688. // entries. Example: "my-project-1A".
  689. ProjectIds []string `json:"projectIds,omitempty"`
  690. // ResourceNames: Required. Names of one or more parent resources from
  691. // which to retrieve log
  692. // entries:
  693. // "projects/[PROJECT_ID]"
  694. // "organizations/[ORGANIZATION_ID]"
  695. // "bi
  696. // llingAccounts/[BILLING_ACCOUNT_ID]"
  697. // "folders/[FOLDER_ID]"
  698. // Projects listed in the project_ids field are added to this list.
  699. ResourceNames []string `json:"resourceNames,omitempty"`
  700. // ForceSendFields is a list of field names (e.g. "Filter") to
  701. // unconditionally include in API requests. By default, fields with
  702. // empty values are omitted from API requests. However, any non-pointer,
  703. // non-interface field appearing in ForceSendFields will be sent to the
  704. // server regardless of whether the field is empty or not. This may be
  705. // used to include empty fields in Patch requests.
  706. ForceSendFields []string `json:"-"`
  707. // NullFields is a list of field names (e.g. "Filter") to include in API
  708. // requests with the JSON null value. By default, fields with empty
  709. // values are omitted from API requests. However, any field with an
  710. // empty value appearing in NullFields will be sent to the server as
  711. // null. It is an error if a field in this list has a non-empty value.
  712. // This may be used to include null fields in Patch requests.
  713. NullFields []string `json:"-"`
  714. }
  715. func (s *ListLogEntriesRequest) MarshalJSON() ([]byte, error) {
  716. type NoMethod ListLogEntriesRequest
  717. raw := NoMethod(*s)
  718. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  719. }
  720. // ListLogEntriesResponse: Result returned from ListLogEntries.
  721. type ListLogEntriesResponse struct {
  722. // Entries: A list of log entries. If entries is empty, nextPageToken
  723. // may still be returned, indicating that more entries may exist. See
  724. // nextPageToken for more information.
  725. Entries []*LogEntry `json:"entries,omitempty"`
  726. // NextPageToken: If there might be more results than those appearing in
  727. // this response, then nextPageToken is included. To get the next set of
  728. // results, call this method again using the value of nextPageToken as
  729. // pageToken.If a value for next_page_token appears and the entries
  730. // field is empty, it means that the search found no log entries so far
  731. // but it did not have time to search all the possible log entries.
  732. // Retry the method with this value for page_token to continue the
  733. // search. Alternatively, consider speeding up the search by changing
  734. // your filter to specify a single log name or resource type, or to
  735. // narrow the time range of the search.
  736. NextPageToken string `json:"nextPageToken,omitempty"`
  737. // ServerResponse contains the HTTP response code and headers from the
  738. // server.
  739. googleapi.ServerResponse `json:"-"`
  740. // ForceSendFields is a list of field names (e.g. "Entries") to
  741. // unconditionally include in API requests. By default, fields with
  742. // empty values are omitted from API requests. However, any non-pointer,
  743. // non-interface field appearing in ForceSendFields will be sent to the
  744. // server regardless of whether the field is empty or not. This may be
  745. // used to include empty fields in Patch requests.
  746. ForceSendFields []string `json:"-"`
  747. // NullFields is a list of field names (e.g. "Entries") to include in
  748. // API requests with the JSON null value. By default, fields with empty
  749. // values are omitted from API requests. However, any field with an
  750. // empty value appearing in NullFields will be sent to the server as
  751. // null. It is an error if a field in this list has a non-empty value.
  752. // This may be used to include null fields in Patch requests.
  753. NullFields []string `json:"-"`
  754. }
  755. func (s *ListLogEntriesResponse) MarshalJSON() ([]byte, error) {
  756. type NoMethod ListLogEntriesResponse
  757. raw := NoMethod(*s)
  758. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  759. }
  760. // ListLogMetricsResponse: Result returned from ListLogMetrics.
  761. type ListLogMetricsResponse struct {
  762. // Metrics: A list of logs-based metrics.
  763. Metrics []*LogMetric `json:"metrics,omitempty"`
  764. // NextPageToken: If there might be more results than appear in this
  765. // response, then nextPageToken is included. To get the next set of
  766. // results, call this method again using the value of nextPageToken as
  767. // pageToken.
  768. NextPageToken string `json:"nextPageToken,omitempty"`
  769. // ServerResponse contains the HTTP response code and headers from the
  770. // server.
  771. googleapi.ServerResponse `json:"-"`
  772. // ForceSendFields is a list of field names (e.g. "Metrics") to
  773. // unconditionally include in API requests. By default, fields with
  774. // empty values are omitted from API requests. However, any non-pointer,
  775. // non-interface field appearing in ForceSendFields will be sent to the
  776. // server regardless of whether the field is empty or not. This may be
  777. // used to include empty fields in Patch requests.
  778. ForceSendFields []string `json:"-"`
  779. // NullFields is a list of field names (e.g. "Metrics") to include in
  780. // API requests with the JSON null value. By default, fields with empty
  781. // values are omitted from API requests. However, any field with an
  782. // empty value appearing in NullFields will be sent to the server as
  783. // null. It is an error if a field in this list has a non-empty value.
  784. // This may be used to include null fields in Patch requests.
  785. NullFields []string `json:"-"`
  786. }
  787. func (s *ListLogMetricsResponse) MarshalJSON() ([]byte, error) {
  788. type NoMethod ListLogMetricsResponse
  789. raw := NoMethod(*s)
  790. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  791. }
  792. // ListLogsResponse: Result returned from ListLogs.
  793. type ListLogsResponse struct {
  794. // LogNames: A list of log names. For example,
  795. // "projects/my-project/syslog" or
  796. // "organizations/123/cloudresourcemanager.googleapis.com%2Factivity".
  797. LogNames []string `json:"logNames,omitempty"`
  798. // NextPageToken: If there might be more results than those appearing in
  799. // this response, then nextPageToken is included. To get the next set of
  800. // results, call this method again using the value of nextPageToken as
  801. // pageToken.
  802. NextPageToken string `json:"nextPageToken,omitempty"`
  803. // ServerResponse contains the HTTP response code and headers from the
  804. // server.
  805. googleapi.ServerResponse `json:"-"`
  806. // ForceSendFields is a list of field names (e.g. "LogNames") to
  807. // unconditionally include in API requests. By default, fields with
  808. // empty values are omitted from API requests. However, any non-pointer,
  809. // non-interface field appearing in ForceSendFields will be sent to the
  810. // server regardless of whether the field is empty or not. This may be
  811. // used to include empty fields in Patch requests.
  812. ForceSendFields []string `json:"-"`
  813. // NullFields is a list of field names (e.g. "LogNames") to include in
  814. // API requests with the JSON null value. By default, fields with empty
  815. // values are omitted from API requests. However, any field with an
  816. // empty value appearing in NullFields will be sent to the server as
  817. // null. It is an error if a field in this list has a non-empty value.
  818. // This may be used to include null fields in Patch requests.
  819. NullFields []string `json:"-"`
  820. }
  821. func (s *ListLogsResponse) MarshalJSON() ([]byte, error) {
  822. type NoMethod ListLogsResponse
  823. raw := NoMethod(*s)
  824. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  825. }
  826. // ListMonitoredResourceDescriptorsResponse: Result returned from
  827. // ListMonitoredResourceDescriptors.
  828. type ListMonitoredResourceDescriptorsResponse struct {
  829. // NextPageToken: If there might be more results than those appearing in
  830. // this response, then nextPageToken is included. To get the next set of
  831. // results, call this method again using the value of nextPageToken as
  832. // pageToken.
  833. NextPageToken string `json:"nextPageToken,omitempty"`
  834. // ResourceDescriptors: A list of resource descriptors.
  835. ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"`
  836. // ServerResponse contains the HTTP response code and headers from the
  837. // server.
  838. googleapi.ServerResponse `json:"-"`
  839. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  840. // unconditionally include in API requests. By default, fields with
  841. // empty values are omitted from API requests. However, any non-pointer,
  842. // non-interface field appearing in ForceSendFields will be sent to the
  843. // server regardless of whether the field is empty or not. This may be
  844. // used to include empty fields in Patch requests.
  845. ForceSendFields []string `json:"-"`
  846. // NullFields is a list of field names (e.g. "NextPageToken") to include
  847. // in API requests with the JSON null value. By default, fields with
  848. // empty values are omitted from API requests. However, any field with
  849. // an empty value appearing in NullFields will be sent to the server as
  850. // null. It is an error if a field in this list has a non-empty value.
  851. // This may be used to include null fields in Patch requests.
  852. NullFields []string `json:"-"`
  853. }
  854. func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) {
  855. type NoMethod ListMonitoredResourceDescriptorsResponse
  856. raw := NoMethod(*s)
  857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  858. }
  859. // ListSinksResponse: Result returned from ListSinks.
  860. type ListSinksResponse struct {
  861. // NextPageToken: If there might be more results than appear in this
  862. // response, then nextPageToken is included. To get the next set of
  863. // results, call the same method again using the value of nextPageToken
  864. // as pageToken.
  865. NextPageToken string `json:"nextPageToken,omitempty"`
  866. // Sinks: A list of sinks.
  867. Sinks []*LogSink `json:"sinks,omitempty"`
  868. // ServerResponse contains the HTTP response code and headers from the
  869. // server.
  870. googleapi.ServerResponse `json:"-"`
  871. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  872. // unconditionally include in API requests. By default, fields with
  873. // empty values are omitted from API requests. However, any non-pointer,
  874. // non-interface field appearing in ForceSendFields will be sent to the
  875. // server regardless of whether the field is empty or not. This may be
  876. // used to include empty fields in Patch requests.
  877. ForceSendFields []string `json:"-"`
  878. // NullFields is a list of field names (e.g. "NextPageToken") to include
  879. // in API requests with the JSON null value. By default, fields with
  880. // empty values are omitted from API requests. However, any field with
  881. // an empty value appearing in NullFields will be sent to the server as
  882. // null. It is an error if a field in this list has a non-empty value.
  883. // This may be used to include null fields in Patch requests.
  884. NullFields []string `json:"-"`
  885. }
  886. func (s *ListSinksResponse) MarshalJSON() ([]byte, error) {
  887. type NoMethod ListSinksResponse
  888. raw := NoMethod(*s)
  889. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  890. }
  891. // LogEntry: An individual entry in a log.
  892. type LogEntry struct {
  893. // HttpRequest: Optional. Information about the HTTP request associated
  894. // with this log entry, if applicable.
  895. HttpRequest *HttpRequest `json:"httpRequest,omitempty"`
  896. // InsertId: Optional. A unique identifier for the log entry. If you
  897. // provide a value, then Logging considers other log entries in the same
  898. // project, with the same timestamp, and with the same insert_id to be
  899. // duplicates which can be removed. If omitted in new log entries, then
  900. // Logging assigns its own unique identifier. The insert_id is also used
  901. // to order log entries that have the same timestamp value.
  902. InsertId string `json:"insertId,omitempty"`
  903. // JsonPayload: The log entry payload, represented as a structure that
  904. // is expressed as a JSON object.
  905. JsonPayload googleapi.RawMessage `json:"jsonPayload,omitempty"`
  906. // Labels: Optional. A set of user-defined (key, value) data that
  907. // provides additional information about the log entry.
  908. Labels map[string]string `json:"labels,omitempty"`
  909. // LogName: Required. The resource name of the log to which this log
  910. // entry
  911. // belongs:
  912. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  913. // "organizations/[ORGANIZ
  914. // ATION_ID]/logs/[LOG_ID]"
  915. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[L
  916. // OG_ID]"
  917. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  918. // A project number may optionally be used in place of PROJECT_ID. The
  919. // project number is translated to its corresponding PROJECT_ID
  920. // internally and the log_name field will contain PROJECT_ID in queries
  921. // and exports.[LOG_ID] must be URL-encoded within log_name. Example:
  922. // "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Fa
  923. // ctivity". [LOG_ID] must be less than 512 characters long and can only
  924. // include the following characters: upper and lower case alphanumeric
  925. // characters, forward-slash, underscore, hyphen, and period.For
  926. // backward compatibility, if log_name begins with a forward-slash, such
  927. // as /projects/..., then the log entry is ingested as usual but the
  928. // forward-slash is removed. Listing the log entry will not show the
  929. // leading slash and filtering for a log name with a leading slash will
  930. // never return any results.
  931. LogName string `json:"logName,omitempty"`
  932. // Metadata: Output only. Additional metadata about the monitored
  933. // resource.Only k8s_container, k8s_pod, and k8s_node MonitoredResources
  934. // have this field populated.
  935. Metadata *MonitoredResourceMetadata `json:"metadata,omitempty"`
  936. // Operation: Optional. Information about an operation associated with
  937. // the log entry, if applicable.
  938. Operation *LogEntryOperation `json:"operation,omitempty"`
  939. // ProtoPayload: The log entry payload, represented as a protocol
  940. // buffer. Some Google Cloud Platform services use this field for their
  941. // log entry payloads.
  942. ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"`
  943. // ReceiveTimestamp: Output only. The time the log entry was received by
  944. // Logging.
  945. ReceiveTimestamp string `json:"receiveTimestamp,omitempty"`
  946. // Resource: Required. The primary monitored resource associated with
  947. // this log entry.Example: a log entry that reports a database error
  948. // would be associated with the monitored resource designating the
  949. // particular database that reported the error.
  950. Resource *MonitoredResource `json:"resource,omitempty"`
  951. // Severity: Optional. The severity of the log entry. The default value
  952. // is LogSeverity.DEFAULT.
  953. //
  954. // Possible values:
  955. // "DEFAULT" - (0) The log entry has no assigned severity level.
  956. // "DEBUG" - (100) Debug or trace information.
  957. // "INFO" - (200) Routine information, such as ongoing status or
  958. // performance.
  959. // "NOTICE" - (300) Normal but significant events, such as start up,
  960. // shut down, or a configuration change.
  961. // "WARNING" - (400) Warning events might cause problems.
  962. // "ERROR" - (500) Error events are likely to cause problems.
  963. // "CRITICAL" - (600) Critical events cause more severe problems or
  964. // outages.
  965. // "ALERT" - (700) A person must take an action immediately.
  966. // "EMERGENCY" - (800) One or more systems are unusable.
  967. Severity string `json:"severity,omitempty"`
  968. // SourceLocation: Optional. Source code location information associated
  969. // with the log entry, if any.
  970. SourceLocation *LogEntrySourceLocation `json:"sourceLocation,omitempty"`
  971. // SpanId: Optional. The span ID within the trace associated with the
  972. // log entry.For Trace spans, this is the same format that the Trace API
  973. // v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such
  974. // as <code>"000000000000004a"</code>.
  975. SpanId string `json:"spanId,omitempty"`
  976. // TextPayload: The log entry payload, represented as a Unicode string
  977. // (UTF-8).
  978. TextPayload string `json:"textPayload,omitempty"`
  979. // Timestamp: Optional. The time the event described by the log entry
  980. // occurred. This time is used to compute the log entry's age and to
  981. // enforce the logs retention period. If this field is omitted in a new
  982. // log entry, then Logging assigns it the current time. Timestamps have
  983. // nanosecond accuracy, but trailing zeros in the fractional seconds
  984. // might be omitted when the timestamp is displayed.Incoming log entries
  985. // should have timestamps that are no more than the logs retention
  986. // period in the past, and no more than 24 hours in the future. Log
  987. // entries outside those time boundaries will not be available when
  988. // calling entries.list, but those log entries can still be exported
  989. // with LogSinks.
  990. Timestamp string `json:"timestamp,omitempty"`
  991. // Trace: Optional. Resource name of the trace associated with the log
  992. // entry, if any. If it contains a relative resource name, the name is
  993. // assumed to be relative to //tracing.googleapis.com. Example:
  994. // projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824
  995. Trace string `json:"trace,omitempty"`
  996. // TraceSampled: Optional. The sampling decision of the trace associated
  997. // with the log entry.True means that the trace resource name in the
  998. // trace field was sampled for storage in a trace backend. False means
  999. // that the trace was not sampled for storage when this log entry was
  1000. // written, or the sampling decision was unknown at the time. A
  1001. // non-sampled trace value is still useful as a request correlation
  1002. // identifier. The default is False.
  1003. TraceSampled bool `json:"traceSampled,omitempty"`
  1004. // ForceSendFields is a list of field names (e.g. "HttpRequest") to
  1005. // unconditionally include in API requests. By default, fields with
  1006. // empty values are omitted from API requests. However, any non-pointer,
  1007. // non-interface field appearing in ForceSendFields will be sent to the
  1008. // server regardless of whether the field is empty or not. This may be
  1009. // used to include empty fields in Patch requests.
  1010. ForceSendFields []string `json:"-"`
  1011. // NullFields is a list of field names (e.g. "HttpRequest") to include
  1012. // in API requests with the JSON null value. By default, fields with
  1013. // empty values are omitted from API requests. However, any field with
  1014. // an empty value appearing in NullFields will be sent to the server as
  1015. // null. It is an error if a field in this list has a non-empty value.
  1016. // This may be used to include null fields in Patch requests.
  1017. NullFields []string `json:"-"`
  1018. }
  1019. func (s *LogEntry) MarshalJSON() ([]byte, error) {
  1020. type NoMethod LogEntry
  1021. raw := NoMethod(*s)
  1022. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1023. }
  1024. // LogEntryOperation: Additional information about a potentially
  1025. // long-running operation with which a log entry is associated.
  1026. type LogEntryOperation struct {
  1027. // First: Optional. Set this to True if this is the first log entry in
  1028. // the operation.
  1029. First bool `json:"first,omitempty"`
  1030. // Id: Optional. An arbitrary operation identifier. Log entries with the
  1031. // same identifier are assumed to be part of the same operation.
  1032. Id string `json:"id,omitempty"`
  1033. // Last: Optional. Set this to True if this is the last log entry in the
  1034. // operation.
  1035. Last bool `json:"last,omitempty"`
  1036. // Producer: Optional. An arbitrary producer identifier. The combination
  1037. // of id and producer must be globally unique. Examples for producer:
  1038. // "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication".
  1039. Producer string `json:"producer,omitempty"`
  1040. // ForceSendFields is a list of field names (e.g. "First") to
  1041. // unconditionally include in API requests. By default, fields with
  1042. // empty values are omitted from API requests. However, any non-pointer,
  1043. // non-interface field appearing in ForceSendFields will be sent to the
  1044. // server regardless of whether the field is empty or not. This may be
  1045. // used to include empty fields in Patch requests.
  1046. ForceSendFields []string `json:"-"`
  1047. // NullFields is a list of field names (e.g. "First") to include in API
  1048. // requests with the JSON null value. By default, fields with empty
  1049. // values are omitted from API requests. However, any field with an
  1050. // empty value appearing in NullFields will be sent to the server as
  1051. // null. It is an error if a field in this list has a non-empty value.
  1052. // This may be used to include null fields in Patch requests.
  1053. NullFields []string `json:"-"`
  1054. }
  1055. func (s *LogEntryOperation) MarshalJSON() ([]byte, error) {
  1056. type NoMethod LogEntryOperation
  1057. raw := NoMethod(*s)
  1058. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1059. }
  1060. // LogEntrySourceLocation: Additional information about the source code
  1061. // location that produced the log entry.
  1062. type LogEntrySourceLocation struct {
  1063. // File: Optional. Source file name. Depending on the runtime
  1064. // environment, this might be a simple name or a fully-qualified name.
  1065. File string `json:"file,omitempty"`
  1066. // Function: Optional. Human-readable name of the function or method
  1067. // being invoked, with optional context such as the class or package
  1068. // name. This information may be used in contexts such as the logs
  1069. // viewer, where a file and line number are less meaningful. The format
  1070. // can vary by language. For example: qual.if.ied.Class.method (Java),
  1071. // dir/package.func (Go), function (Python).
  1072. Function string `json:"function,omitempty"`
  1073. // Line: Optional. Line within the source file. 1-based; 0 indicates no
  1074. // line number available.
  1075. Line int64 `json:"line,omitempty,string"`
  1076. // ForceSendFields is a list of field names (e.g. "File") to
  1077. // unconditionally include in API requests. By default, fields with
  1078. // empty values are omitted from API requests. However, any non-pointer,
  1079. // non-interface field appearing in ForceSendFields will be sent to the
  1080. // server regardless of whether the field is empty or not. This may be
  1081. // used to include empty fields in Patch requests.
  1082. ForceSendFields []string `json:"-"`
  1083. // NullFields is a list of field names (e.g. "File") to include in API
  1084. // requests with the JSON null value. By default, fields with empty
  1085. // values are omitted from API requests. However, any field with an
  1086. // empty value appearing in NullFields will be sent to the server as
  1087. // null. It is an error if a field in this list has a non-empty value.
  1088. // This may be used to include null fields in Patch requests.
  1089. NullFields []string `json:"-"`
  1090. }
  1091. func (s *LogEntrySourceLocation) MarshalJSON() ([]byte, error) {
  1092. type NoMethod LogEntrySourceLocation
  1093. raw := NoMethod(*s)
  1094. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1095. }
  1096. // LogExclusion: Specifies a set of log entries that are not to be
  1097. // stored in Logging. If your project receives a large volume of logs,
  1098. // you might be able to use exclusions to reduce your chargeable logs.
  1099. // Exclusions are processed after log sinks, so you can export log
  1100. // entries before they are excluded. Audit log entries and log entries
  1101. // from Amazon Web Services are never excluded.
  1102. type LogExclusion struct {
  1103. // CreateTime: Output only. The creation timestamp of the exclusion.This
  1104. // field may not be present for older exclusions.
  1105. CreateTime string `json:"createTime,omitempty"`
  1106. // Description: Optional. A description of this exclusion.
  1107. Description string `json:"description,omitempty"`
  1108. // Disabled: Optional. If set to True, then this exclusion is disabled
  1109. // and it does not exclude any log entries. You can update an exclusion
  1110. // to change the value of this field.
  1111. Disabled bool `json:"disabled,omitempty"`
  1112. // Filter: Required. An advanced logs filter that matches the log
  1113. // entries to be excluded. By using the sample function, you can exclude
  1114. // less than 100% of the matching log entries. For example, the
  1115. // following filter matches 99% of low-severity log entries from load
  1116. // balancers:"resource.type=http_load_balancer severity<ERROR
  1117. // sample(insertId, 0.99)"
  1118. Filter string `json:"filter,omitempty"`
  1119. // Name: Required. A client-assigned identifier, such as
  1120. // "load-balancer-exclusion". Identifiers are limited to 100 characters
  1121. // and can include only letters, digits, underscores, hyphens, and
  1122. // periods.
  1123. Name string `json:"name,omitempty"`
  1124. // UpdateTime: Output only. The last update timestamp of the
  1125. // exclusion.This field may not be present for older exclusions.
  1126. UpdateTime string `json:"updateTime,omitempty"`
  1127. // ServerResponse contains the HTTP response code and headers from the
  1128. // server.
  1129. googleapi.ServerResponse `json:"-"`
  1130. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1131. // unconditionally include in API requests. By default, fields with
  1132. // empty values are omitted from API requests. However, any non-pointer,
  1133. // non-interface field appearing in ForceSendFields will be sent to the
  1134. // server regardless of whether the field is empty or not. This may be
  1135. // used to include empty fields in Patch requests.
  1136. ForceSendFields []string `json:"-"`
  1137. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1138. // API requests with the JSON null value. By default, fields with empty
  1139. // values are omitted from API requests. However, any field with an
  1140. // empty value appearing in NullFields will be sent to the server as
  1141. // null. It is an error if a field in this list has a non-empty value.
  1142. // This may be used to include null fields in Patch requests.
  1143. NullFields []string `json:"-"`
  1144. }
  1145. func (s *LogExclusion) MarshalJSON() ([]byte, error) {
  1146. type NoMethod LogExclusion
  1147. raw := NoMethod(*s)
  1148. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1149. }
  1150. // LogLine: Application log line emitted while processing a request.
  1151. type LogLine struct {
  1152. // LogMessage: App-provided log message.
  1153. LogMessage string `json:"logMessage,omitempty"`
  1154. // Severity: Severity of this log entry.
  1155. //
  1156. // Possible values:
  1157. // "DEFAULT" - (0) The log entry has no assigned severity level.
  1158. // "DEBUG" - (100) Debug or trace information.
  1159. // "INFO" - (200) Routine information, such as ongoing status or
  1160. // performance.
  1161. // "NOTICE" - (300) Normal but significant events, such as start up,
  1162. // shut down, or a configuration change.
  1163. // "WARNING" - (400) Warning events might cause problems.
  1164. // "ERROR" - (500) Error events are likely to cause problems.
  1165. // "CRITICAL" - (600) Critical events cause more severe problems or
  1166. // outages.
  1167. // "ALERT" - (700) A person must take an action immediately.
  1168. // "EMERGENCY" - (800) One or more systems are unusable.
  1169. Severity string `json:"severity,omitempty"`
  1170. // SourceLocation: Where in the source code this log message was
  1171. // written.
  1172. SourceLocation *SourceLocation `json:"sourceLocation,omitempty"`
  1173. // Time: Approximate time when this log entry was made.
  1174. Time string `json:"time,omitempty"`
  1175. // ForceSendFields is a list of field names (e.g. "LogMessage") to
  1176. // unconditionally include in API requests. By default, fields with
  1177. // empty values are omitted from API requests. However, any non-pointer,
  1178. // non-interface field appearing in ForceSendFields will be sent to the
  1179. // server regardless of whether the field is empty or not. This may be
  1180. // used to include empty fields in Patch requests.
  1181. ForceSendFields []string `json:"-"`
  1182. // NullFields is a list of field names (e.g. "LogMessage") to include in
  1183. // API requests with the JSON null value. By default, fields with empty
  1184. // values are omitted from API requests. However, any field with an
  1185. // empty value appearing in NullFields will be sent to the server as
  1186. // null. It is an error if a field in this list has a non-empty value.
  1187. // This may be used to include null fields in Patch requests.
  1188. NullFields []string `json:"-"`
  1189. }
  1190. func (s *LogLine) MarshalJSON() ([]byte, error) {
  1191. type NoMethod LogLine
  1192. raw := NoMethod(*s)
  1193. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1194. }
  1195. // LogMetric: Describes a logs-based metric. The value of the metric is
  1196. // the number of log entries that match a logs filter in a given time
  1197. // interval.Logs-based metric can also be used to extract values from
  1198. // logs and create a a distribution of the values. The distribution
  1199. // records the statistics of the extracted values along with an optional
  1200. // histogram of the values as specified by the bucket options.
  1201. type LogMetric struct {
  1202. // BucketOptions: Optional. The bucket_options are required when the
  1203. // logs-based metric is using a DISTRIBUTION value type and it describes
  1204. // the bucket boundaries used to create a histogram of the extracted
  1205. // values.
  1206. BucketOptions *BucketOptions `json:"bucketOptions,omitempty"`
  1207. // CreateTime: Output only. The creation timestamp of the metric.This
  1208. // field may not be present for older metrics.
  1209. CreateTime string `json:"createTime,omitempty"`
  1210. // Description: Optional. A description of this metric, which is used in
  1211. // documentation. The maximum length of the description is 8000
  1212. // characters.
  1213. Description string `json:"description,omitempty"`
  1214. // Filter: Required. An advanced logs filter which is used to match log
  1215. // entries. Example:
  1216. // "resource.type=gae_app AND severity>=ERROR"
  1217. // The maximum length of the filter is 20000 characters.
  1218. Filter string `json:"filter,omitempty"`
  1219. // LabelExtractors: Optional. A map from a label key string to an
  1220. // extractor expression which is used to extract data from a log entry
  1221. // field and assign as the label value. Each label key specified in the
  1222. // LabelDescriptor must have an associated extractor expression in this
  1223. // map. The syntax of the extractor expression is the same as for the
  1224. // value_extractor field.The extracted value is converted to the type
  1225. // defined in the label descriptor. If the either the extraction or the
  1226. // type conversion fails, the label will have a default value. The
  1227. // default value for a string label is an empty string, for an integer
  1228. // label its 0, and for a boolean label its false.Note that there are
  1229. // upper bounds on the maximum number of labels and the number of active
  1230. // time series that are allowed in a project.
  1231. LabelExtractors map[string]string `json:"labelExtractors,omitempty"`
  1232. // MetricDescriptor: Optional. The metric descriptor associated with the
  1233. // logs-based metric. If unspecified, it uses a default metric
  1234. // descriptor with a DELTA metric kind, INT64 value type, with no labels
  1235. // and a unit of "1". Such a metric counts the number of log entries
  1236. // matching the filter expression.The name, type, and description fields
  1237. // in the metric_descriptor are output only, and is constructed using
  1238. // the name and description field in the LogMetric.To create a
  1239. // logs-based metric that records a distribution of log values, a DELTA
  1240. // metric kind with a DISTRIBUTION value type must be used along with a
  1241. // value_extractor expression in the LogMetric.Each label in the metric
  1242. // descriptor must have a matching label name as the key and an
  1243. // extractor expression as the value in the label_extractors map.The
  1244. // metric_kind and value_type fields in the metric_descriptor cannot be
  1245. // updated once initially configured. New labels can be added in the
  1246. // metric_descriptor, but existing labels cannot be modified except for
  1247. // their description.
  1248. MetricDescriptor *MetricDescriptor `json:"metricDescriptor,omitempty"`
  1249. // Name: Required. The client-assigned metric identifier. Examples:
  1250. // "error_count", "nginx/requests".Metric identifiers are limited to 100
  1251. // characters and can include only the following characters: A-Z, a-z,
  1252. // 0-9, and the special characters _-.,+!*',()%/. The forward-slash
  1253. // character (/) denotes a hierarchy of name pieces, and it cannot be
  1254. // the first character of the name.The metric identifier in this field
  1255. // must not be URL-encoded
  1256. // (https://en.wikipedia.org/wiki/Percent-encoding). However, when the
  1257. // metric identifier appears as the [METRIC_ID] part of a metric_name
  1258. // API parameter, then the metric identifier must be URL-encoded.
  1259. // Example: "projects/my-project/metrics/nginx%2Frequests".
  1260. Name string `json:"name,omitempty"`
  1261. // UpdateTime: Output only. The last update timestamp of the metric.This
  1262. // field may not be present for older metrics.
  1263. UpdateTime string `json:"updateTime,omitempty"`
  1264. // ValueExtractor: Optional. A value_extractor is required when using a
  1265. // distribution logs-based metric to extract the values to record from a
  1266. // log entry. Two functions are supported for value extraction:
  1267. // EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1.
  1268. // field: The name of the log entry field from which the value is to be
  1269. // extracted. 2. regex: A regular expression using the Google RE2
  1270. // syntax (https://github.com/google/re2/wiki/Syntax) with a single
  1271. // capture group to extract data from the specified log entry field.
  1272. // The value of the field is converted to a string before applying the
  1273. // regex. It is an error to specify a regex that does not include
  1274. // exactly one capture group.The result of the extraction must be
  1275. // convertible to a double type, as the distribution always records
  1276. // double values. If either the extraction or the conversion to double
  1277. // fails, then those values are not recorded in the
  1278. // distribution.Example: REGEXP_EXTRACT(jsonPayload.request,
  1279. // ".*quantity=(\d+).*")
  1280. ValueExtractor string `json:"valueExtractor,omitempty"`
  1281. // Version: Deprecated. The API version that created or updated this
  1282. // metric. The v2 format is used by default and cannot be changed.
  1283. //
  1284. // Possible values:
  1285. // "V2" - Logging API v2.
  1286. // "V1" - Logging API v1.
  1287. Version string `json:"version,omitempty"`
  1288. // ServerResponse contains the HTTP response code and headers from the
  1289. // server.
  1290. googleapi.ServerResponse `json:"-"`
  1291. // ForceSendFields is a list of field names (e.g. "BucketOptions") to
  1292. // unconditionally include in API requests. By default, fields with
  1293. // empty values are omitted from API requests. However, any non-pointer,
  1294. // non-interface field appearing in ForceSendFields will be sent to the
  1295. // server regardless of whether the field is empty or not. This may be
  1296. // used to include empty fields in Patch requests.
  1297. ForceSendFields []string `json:"-"`
  1298. // NullFields is a list of field names (e.g. "BucketOptions") to include
  1299. // in API requests with the JSON null value. By default, fields with
  1300. // empty values are omitted from API requests. However, any field with
  1301. // an empty value appearing in NullFields will be sent to the server as
  1302. // null. It is an error if a field in this list has a non-empty value.
  1303. // This may be used to include null fields in Patch requests.
  1304. NullFields []string `json:"-"`
  1305. }
  1306. func (s *LogMetric) MarshalJSON() ([]byte, error) {
  1307. type NoMethod LogMetric
  1308. raw := NoMethod(*s)
  1309. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1310. }
  1311. // LogSink: Describes a sink used to export log entries to one of the
  1312. // following destinations in any project: a Cloud Storage bucket, a
  1313. // BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls
  1314. // which log entries are exported. The sink must be created within a
  1315. // project, organization, billing account, or folder.
  1316. type LogSink struct {
  1317. // CreateTime: Output only. The creation timestamp of the sink.This
  1318. // field may not be present for older sinks.
  1319. CreateTime string `json:"createTime,omitempty"`
  1320. // Destination: Required. The export
  1321. // destination:
  1322. // "storage.googleapis.com/[GCS_BUCKET]"
  1323. // "bigquery.googleapi
  1324. // s.com/projects/[PROJECT_ID]/datasets/[DATASET]"
  1325. // "pubsub.googleapis.com
  1326. // /projects/[PROJECT_ID]/topics/[TOPIC_ID]"
  1327. // The sink's writer_identity, set when the sink is created, must have
  1328. // permission to write to the destination or else the log entries are
  1329. // not exported. For more information, see Exporting Logs with Sinks.
  1330. Destination string `json:"destination,omitempty"`
  1331. // Filter: Optional. An advanced logs filter. The only exported log
  1332. // entries are those that are in the resource owning the sink and that
  1333. // match the filter. For
  1334. // example:
  1335. // logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR
  1336. //
  1337. Filter string `json:"filter,omitempty"`
  1338. // IncludeChildren: Optional. This field applies only to sinks owned by
  1339. // organizations and folders. If the field is false, the default, only
  1340. // the logs owned by the sink's parent resource are available for
  1341. // export. If the field is true, then logs from all the projects,
  1342. // folders, and billing accounts contained in the sink's parent resource
  1343. // are also available for export. Whether a particular log entry from
  1344. // the children is exported depends on the sink's filter expression. For
  1345. // example, if this field is true, then the filter
  1346. // resource.type=gce_instance would export all Compute Engine VM
  1347. // instance log entries from all projects in the sink's parent. To only
  1348. // export entries from certain child projects, filter on the project
  1349. // part of the log name:
  1350. // logName:("projects/test-project1/" OR "projects/test-project2/")
  1351. // AND
  1352. // resource.type=gce_instance
  1353. //
  1354. IncludeChildren bool `json:"includeChildren,omitempty"`
  1355. // Name: Required. The client-assigned sink identifier, unique within
  1356. // the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers
  1357. // are limited to 100 characters and can include only the following
  1358. // characters: upper and lower-case alphanumeric characters,
  1359. // underscores, hyphens, and periods.
  1360. Name string `json:"name,omitempty"`
  1361. // OutputVersionFormat: Deprecated. The log entry format to use for this
  1362. // sink's exported log entries. The v2 format is used by default and
  1363. // cannot be changed.
  1364. //
  1365. // Possible values:
  1366. // "VERSION_FORMAT_UNSPECIFIED" - An unspecified format version that
  1367. // will default to V2.
  1368. // "V2" - LogEntry version 2 format.
  1369. // "V1" - LogEntry version 1 format.
  1370. OutputVersionFormat string `json:"outputVersionFormat,omitempty"`
  1371. // UpdateTime: Output only. The last update timestamp of the sink.This
  1372. // field may not be present for older sinks.
  1373. UpdateTime string `json:"updateTime,omitempty"`
  1374. // WriterIdentity: Output only. An IAM identity&mdash;a service account
  1375. // or group&mdash;under which Logging writes the exported log entries to
  1376. // the sink's destination. This field is set by sinks.create and
  1377. // sinks.update based on the value of unique_writer_identity in those
  1378. // methods.Until you grant this identity write-access to the
  1379. // destination, log entry exports from this sink will fail. For more
  1380. // information, see Granting Access for a Resource. Consult the
  1381. // destination service's documentation to determine the appropriate IAM
  1382. // roles to assign to the identity.
  1383. WriterIdentity string `json:"writerIdentity,omitempty"`
  1384. // ServerResponse contains the HTTP response code and headers from the
  1385. // server.
  1386. googleapi.ServerResponse `json:"-"`
  1387. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1388. // unconditionally include in API requests. By default, fields with
  1389. // empty values are omitted from API requests. However, any non-pointer,
  1390. // non-interface field appearing in ForceSendFields will be sent to the
  1391. // server regardless of whether the field is empty or not. This may be
  1392. // used to include empty fields in Patch requests.
  1393. ForceSendFields []string `json:"-"`
  1394. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1395. // API requests with the JSON null value. By default, fields with empty
  1396. // values are omitted from API requests. However, any field with an
  1397. // empty value appearing in NullFields will be sent to the server as
  1398. // null. It is an error if a field in this list has a non-empty value.
  1399. // This may be used to include null fields in Patch requests.
  1400. NullFields []string `json:"-"`
  1401. }
  1402. func (s *LogSink) MarshalJSON() ([]byte, error) {
  1403. type NoMethod LogSink
  1404. raw := NoMethod(*s)
  1405. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1406. }
  1407. // MetricDescriptor: Defines a metric type and its schema. Once a metric
  1408. // descriptor is created, deleting or altering it stops data collection
  1409. // and makes the metric type's existing data unusable.
  1410. type MetricDescriptor struct {
  1411. // Description: A detailed description of the metric, which can be used
  1412. // in documentation.
  1413. Description string `json:"description,omitempty"`
  1414. // DisplayName: A concise name for the metric, which can be displayed in
  1415. // user interfaces. Use sentence case without an ending period, for
  1416. // example "Request count". This field is optional but it is recommended
  1417. // to be set for any metrics associated with user-visible concepts, such
  1418. // as Quota.
  1419. DisplayName string `json:"displayName,omitempty"`
  1420. // Labels: The set of labels that can be used to describe a specific
  1421. // instance of this metric type. For example, the
  1422. // appengine.googleapis.com/http/server/response_latencies metric type
  1423. // has a label for the HTTP response code, response_code, so you can
  1424. // look at latencies for successful responses or just for responses that
  1425. // failed.
  1426. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1427. // Metadata: Optional. Metadata which can be used to guide usage of the
  1428. // metric.
  1429. Metadata *MetricDescriptorMetadata `json:"metadata,omitempty"`
  1430. // MetricKind: Whether the metric records instantaneous values, changes
  1431. // to a value, etc. Some combinations of metric_kind and value_type
  1432. // might not be supported.
  1433. //
  1434. // Possible values:
  1435. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  1436. // "GAUGE" - An instantaneous measurement of a value.
  1437. // "DELTA" - The change in a value during a time interval.
  1438. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  1439. // measurements in a time series should have the same start time and
  1440. // increasing end times, until an event resets the cumulative value to
  1441. // zero and sets a new start time for the following points.
  1442. MetricKind string `json:"metricKind,omitempty"`
  1443. // Name: The resource name of the metric descriptor.
  1444. Name string `json:"name,omitempty"`
  1445. // Type: The metric type, including its DNS name prefix. The type is not
  1446. // URL-encoded. All user-defined metric types have the DNS name
  1447. // custom.googleapis.com or external.googleapis.com. Metric types should
  1448. // use a natural hierarchical grouping. For
  1449. // example:
  1450. // "custom.googleapis.com/invoice/paid/amount"
  1451. // "external.googlea
  1452. // pis.com/prometheus/up"
  1453. // "appengine.googleapis.com/http/server/response_
  1454. // latencies"
  1455. //
  1456. Type string `json:"type,omitempty"`
  1457. // Unit: The unit in which the metric value is reported. It is only
  1458. // applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The
  1459. // supported units are a subset of The Unified Code for Units of Measure
  1460. // (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
  1461. // bit bit
  1462. // By byte
  1463. // s second
  1464. // min minute
  1465. // h hour
  1466. // d dayPrefixes (PREFIX)
  1467. // k kilo (10**3)
  1468. // M mega (10**6)
  1469. // G giga (10**9)
  1470. // T tera (10**12)
  1471. // P peta (10**15)
  1472. // E exa (10**18)
  1473. // Z zetta (10**21)
  1474. // Y yotta (10**24)
  1475. // m milli (10**-3)
  1476. // u micro (10**-6)
  1477. // n nano (10**-9)
  1478. // p pico (10**-12)
  1479. // f femto (10**-15)
  1480. // a atto (10**-18)
  1481. // z zepto (10**-21)
  1482. // y yocto (10**-24)
  1483. // Ki kibi (2**10)
  1484. // Mi mebi (2**20)
  1485. // Gi gibi (2**30)
  1486. // Ti tebi (2**40)GrammarThe grammar also includes these connectors:
  1487. // / division (as an infix operator, e.g. 1/s).
  1488. // . multiplication (as an infix operator, e.g. GBy.d)The grammar for a
  1489. // unit is as follows:
  1490. // Expression = Component { "." Component } { "/" Component }
  1491. // ;
  1492. //
  1493. // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
  1494. // | Annotation
  1495. // | "1"
  1496. // ;
  1497. //
  1498. // Annotation = "{" NAME "}" ;
  1499. // Notes:
  1500. // Annotation is just a comment if it follows a UNIT and is equivalent
  1501. // to 1 if it is used alone. For examples, {requests}/s == 1/s,
  1502. // By{transmitted}/s == By/s.
  1503. // NAME is a sequence of non-blank printable ASCII characters not
  1504. // containing '{' or '}'.
  1505. // 1 represents dimensionless value 1, such as in 1/s.
  1506. // % represents dimensionless value 1/100, and annotates values giving
  1507. // a percentage.
  1508. Unit string `json:"unit,omitempty"`
  1509. // ValueType: Whether the measurement is an integer, a floating-point
  1510. // number, etc. Some combinations of metric_kind and value_type might
  1511. // not be supported.
  1512. //
  1513. // Possible values:
  1514. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  1515. // "BOOL" - The value is a boolean. This value type can be used only
  1516. // if the metric kind is GAUGE.
  1517. // "INT64" - The value is a signed 64-bit integer.
  1518. // "DOUBLE" - The value is a double precision floating point number.
  1519. // "STRING" - The value is a text string. This value type can be used
  1520. // only if the metric kind is GAUGE.
  1521. // "DISTRIBUTION" - The value is a Distribution.
  1522. // "MONEY" - The value is money.
  1523. ValueType string `json:"valueType,omitempty"`
  1524. // ForceSendFields is a list of field names (e.g. "Description") to
  1525. // unconditionally include in API requests. By default, fields with
  1526. // empty values are omitted from API requests. However, any non-pointer,
  1527. // non-interface field appearing in ForceSendFields will be sent to the
  1528. // server regardless of whether the field is empty or not. This may be
  1529. // used to include empty fields in Patch requests.
  1530. ForceSendFields []string `json:"-"`
  1531. // NullFields is a list of field names (e.g. "Description") to include
  1532. // in API requests with the JSON null value. By default, fields with
  1533. // empty values are omitted from API requests. However, any field with
  1534. // an empty value appearing in NullFields will be sent to the server as
  1535. // null. It is an error if a field in this list has a non-empty value.
  1536. // This may be used to include null fields in Patch requests.
  1537. NullFields []string `json:"-"`
  1538. }
  1539. func (s *MetricDescriptor) MarshalJSON() ([]byte, error) {
  1540. type NoMethod MetricDescriptor
  1541. raw := NoMethod(*s)
  1542. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1543. }
  1544. // MetricDescriptorMetadata: Additional annotations that can be used to
  1545. // guide the usage of a metric.
  1546. type MetricDescriptorMetadata struct {
  1547. // IngestDelay: The delay of data points caused by ingestion. Data
  1548. // points older than this age are guaranteed to be ingested and
  1549. // available to be read, excluding data loss due to errors.
  1550. IngestDelay string `json:"ingestDelay,omitempty"`
  1551. // LaunchStage: The launch stage of the metric definition.
  1552. //
  1553. // Possible values:
  1554. // "LAUNCH_STAGE_UNSPECIFIED" - Do not use this default value.
  1555. // "EARLY_ACCESS" - Early Access features are limited to a closed
  1556. // group of testers. To use these features, you must sign up in advance
  1557. // and sign a Trusted Tester agreement (which includes confidentiality
  1558. // provisions). These features may be unstable, changed in
  1559. // backward-incompatible ways, and are not guaranteed to be released.
  1560. // "ALPHA" - Alpha is a limited availability test for releases before
  1561. // they are cleared for widespread use. By Alpha, all significant design
  1562. // issues are resolved and we are in the process of verifying
  1563. // functionality. Alpha customers need to apply for access, agree to
  1564. // applicable terms, and have their projects whitelisted. Alpha releases
  1565. // don’t have to be feature complete, no SLAs are provided, and there
  1566. // are no technical support obligations, but they will be far enough
  1567. // along that customers can actually use them in test environments or
  1568. // for limited-use tests -- just like they would in normal production
  1569. // cases.
  1570. // "BETA" - Beta is the point at which we are ready to open a release
  1571. // for any customer to use. There are no SLA or technical support
  1572. // obligations in a Beta release. Products will be complete from a
  1573. // feature perspective, but may have some open outstanding issues. Beta
  1574. // releases are suitable for limited production use cases.
  1575. // "GA" - GA features are open to all developers and are considered
  1576. // stable and fully qualified for production use.
  1577. // "DEPRECATED" - Deprecated features are scheduled to be shut down
  1578. // and removed. For more information, see the “Deprecation Policy”
  1579. // section of our Terms of Service (https://cloud.google.com/terms/) and
  1580. // the Google Cloud Platform Subject to the Deprecation Policy
  1581. // (https://cloud.google.com/terms/deprecation) documentation.
  1582. LaunchStage string `json:"launchStage,omitempty"`
  1583. // SamplePeriod: The sampling period of metric data points. For metrics
  1584. // which are written periodically, consecutive data points are stored at
  1585. // this time interval, excluding data loss due to errors. Metrics with a
  1586. // higher granularity have a smaller sampling period.
  1587. SamplePeriod string `json:"samplePeriod,omitempty"`
  1588. // ForceSendFields is a list of field names (e.g. "IngestDelay") to
  1589. // unconditionally include in API requests. By default, fields with
  1590. // empty values are omitted from API requests. However, any non-pointer,
  1591. // non-interface field appearing in ForceSendFields will be sent to the
  1592. // server regardless of whether the field is empty or not. This may be
  1593. // used to include empty fields in Patch requests.
  1594. ForceSendFields []string `json:"-"`
  1595. // NullFields is a list of field names (e.g. "IngestDelay") to include
  1596. // in API requests with the JSON null value. By default, fields with
  1597. // empty values are omitted from API requests. However, any field with
  1598. // an empty value appearing in NullFields will be sent to the server as
  1599. // null. It is an error if a field in this list has a non-empty value.
  1600. // This may be used to include null fields in Patch requests.
  1601. NullFields []string `json:"-"`
  1602. }
  1603. func (s *MetricDescriptorMetadata) MarshalJSON() ([]byte, error) {
  1604. type NoMethod MetricDescriptorMetadata
  1605. raw := NoMethod(*s)
  1606. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1607. }
  1608. // MonitoredResource: An object representing a resource that can be used
  1609. // for monitoring, logging, billing, or other purposes. Examples include
  1610. // virtual machine instances, databases, and storage devices such as
  1611. // disks. The type field identifies a MonitoredResourceDescriptor object
  1612. // that describes the resource's schema. Information in the labels field
  1613. // identifies the actual resource and its attributes according to the
  1614. // schema. For example, a particular Compute Engine VM instance could be
  1615. // represented by the following object, because the
  1616. // MonitoredResourceDescriptor for "gce_instance" has labels
  1617. // "instance_id" and "zone":
  1618. // { "type": "gce_instance",
  1619. // "labels": { "instance_id": "12345678901234",
  1620. // "zone": "us-central1-a" }}
  1621. //
  1622. type MonitoredResource struct {
  1623. // Labels: Required. Values for all of the labels listed in the
  1624. // associated monitored resource descriptor. For example, Compute Engine
  1625. // VM instances use the labels "project_id", "instance_id", and "zone".
  1626. Labels map[string]string `json:"labels,omitempty"`
  1627. // Type: Required. The monitored resource type. This field must match
  1628. // the type field of a MonitoredResourceDescriptor object. For example,
  1629. // the type of a Compute Engine VM instance is gce_instance.
  1630. Type string `json:"type,omitempty"`
  1631. // ForceSendFields is a list of field names (e.g. "Labels") to
  1632. // unconditionally include in API requests. By default, fields with
  1633. // empty values are omitted from API requests. However, any non-pointer,
  1634. // non-interface field appearing in ForceSendFields will be sent to the
  1635. // server regardless of whether the field is empty or not. This may be
  1636. // used to include empty fields in Patch requests.
  1637. ForceSendFields []string `json:"-"`
  1638. // NullFields is a list of field names (e.g. "Labels") to include in API
  1639. // requests with the JSON null value. By default, fields with empty
  1640. // values are omitted from API requests. However, any field with an
  1641. // empty value appearing in NullFields will be sent to the server as
  1642. // null. It is an error if a field in this list has a non-empty value.
  1643. // This may be used to include null fields in Patch requests.
  1644. NullFields []string `json:"-"`
  1645. }
  1646. func (s *MonitoredResource) MarshalJSON() ([]byte, error) {
  1647. type NoMethod MonitoredResource
  1648. raw := NoMethod(*s)
  1649. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1650. }
  1651. // MonitoredResourceDescriptor: An object that describes the schema of a
  1652. // MonitoredResource object using a type name and a set of labels. For
  1653. // example, the monitored resource descriptor for Google Compute Engine
  1654. // VM instances has a type of "gce_instance" and specifies the use of
  1655. // the labels "instance_id" and "zone" to identify particular VM
  1656. // instances.Different APIs can support different monitored resource
  1657. // types. APIs generally provide a list method that returns the
  1658. // monitored resource descriptors used by the API.
  1659. type MonitoredResourceDescriptor struct {
  1660. // Description: Optional. A detailed description of the monitored
  1661. // resource type that might be used in documentation.
  1662. Description string `json:"description,omitempty"`
  1663. // DisplayName: Optional. A concise name for the monitored resource type
  1664. // that might be displayed in user interfaces. It should be a Title
  1665. // Cased Noun Phrase, without any article or other determiners. For
  1666. // example, "Google Cloud SQL Database".
  1667. DisplayName string `json:"displayName,omitempty"`
  1668. // Labels: Required. A set of labels used to describe instances of this
  1669. // monitored resource type. For example, an individual Google Cloud SQL
  1670. // database is identified by values for the labels "database_id" and
  1671. // "zone".
  1672. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1673. // Name: Optional. The resource name of the monitored resource
  1674. // descriptor:
  1675. // "projects/{project_id}/monitoredResourceDescriptors/{type}" where
  1676. // {type} is the value of the type field in this object and {project_id}
  1677. // is a project ID that provides API-specific context for accessing the
  1678. // type. APIs that do not use project information can use the resource
  1679. // name format "monitoredResourceDescriptors/{type}".
  1680. Name string `json:"name,omitempty"`
  1681. // Type: Required. The monitored resource type. For example, the type
  1682. // "cloudsql_database" represents databases in Google Cloud SQL. The
  1683. // maximum length of this value is 256 characters.
  1684. Type string `json:"type,omitempty"`
  1685. // ForceSendFields is a list of field names (e.g. "Description") to
  1686. // unconditionally include in API requests. By default, fields with
  1687. // empty values are omitted from API requests. However, any non-pointer,
  1688. // non-interface field appearing in ForceSendFields will be sent to the
  1689. // server regardless of whether the field is empty or not. This may be
  1690. // used to include empty fields in Patch requests.
  1691. ForceSendFields []string `json:"-"`
  1692. // NullFields is a list of field names (e.g. "Description") to include
  1693. // in API requests with the JSON null value. By default, fields with
  1694. // empty values are omitted from API requests. However, any field with
  1695. // an empty value appearing in NullFields will be sent to the server as
  1696. // null. It is an error if a field in this list has a non-empty value.
  1697. // This may be used to include null fields in Patch requests.
  1698. NullFields []string `json:"-"`
  1699. }
  1700. func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) {
  1701. type NoMethod MonitoredResourceDescriptor
  1702. raw := NoMethod(*s)
  1703. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1704. }
  1705. // MonitoredResourceMetadata: Auxiliary metadata for a MonitoredResource
  1706. // object. MonitoredResource objects contain the minimum set of
  1707. // information to uniquely identify a monitored resource instance. There
  1708. // is some other useful auxiliary metadata. Monitoring and Logging use
  1709. // an ingestion pipeline to extract metadata for cloud resources of all
  1710. // types, and store the metadata in this message.
  1711. type MonitoredResourceMetadata struct {
  1712. // SystemLabels: Output only. Values for predefined system metadata
  1713. // labels. System labels are a kind of metadata extracted by Google,
  1714. // including "machine_image", "vpc", "subnet_id", "security_group",
  1715. // "name", etc. System label values can be only strings, Boolean values,
  1716. // or a list of strings. For example:
  1717. // { "name": "my-test-instance",
  1718. // "security_group": ["a", "b", "c"],
  1719. // "spot_instance": false }
  1720. //
  1721. SystemLabels googleapi.RawMessage `json:"systemLabels,omitempty"`
  1722. // UserLabels: Output only. A map of user-defined metadata labels.
  1723. UserLabels map[string]string `json:"userLabels,omitempty"`
  1724. // ForceSendFields is a list of field names (e.g. "SystemLabels") to
  1725. // unconditionally include in API requests. By default, fields with
  1726. // empty values are omitted from API requests. However, any non-pointer,
  1727. // non-interface field appearing in ForceSendFields will be sent to the
  1728. // server regardless of whether the field is empty or not. This may be
  1729. // used to include empty fields in Patch requests.
  1730. ForceSendFields []string `json:"-"`
  1731. // NullFields is a list of field names (e.g. "SystemLabels") to include
  1732. // in API requests with the JSON null value. By default, fields with
  1733. // empty values are omitted from API requests. However, any field with
  1734. // an empty value appearing in NullFields will be sent to the server as
  1735. // null. It is an error if a field in this list has a non-empty value.
  1736. // This may be used to include null fields in Patch requests.
  1737. NullFields []string `json:"-"`
  1738. }
  1739. func (s *MonitoredResourceMetadata) MarshalJSON() ([]byte, error) {
  1740. type NoMethod MonitoredResourceMetadata
  1741. raw := NoMethod(*s)
  1742. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1743. }
  1744. // RequestLog: Complete log information about a single HTTP request to
  1745. // an App Engine application.
  1746. type RequestLog struct {
  1747. // AppEngineRelease: App Engine release version.
  1748. AppEngineRelease string `json:"appEngineRelease,omitempty"`
  1749. // AppId: Application that handled this request.
  1750. AppId string `json:"appId,omitempty"`
  1751. // Cost: An indication of the relative cost of serving this request.
  1752. Cost float64 `json:"cost,omitempty"`
  1753. // EndTime: Time when the request finished.
  1754. EndTime string `json:"endTime,omitempty"`
  1755. // Finished: Whether this request is finished or active.
  1756. Finished bool `json:"finished,omitempty"`
  1757. // First: Whether this is the first RequestLog entry for this request.
  1758. // If an active request has several RequestLog entries written to
  1759. // Stackdriver Logging, then this field will be set for one of them.
  1760. First bool `json:"first,omitempty"`
  1761. // Host: Internet host and port number of the resource being requested.
  1762. Host string `json:"host,omitempty"`
  1763. // HttpVersion: HTTP version of request. Example: "HTTP/1.1".
  1764. HttpVersion string `json:"httpVersion,omitempty"`
  1765. // InstanceId: An identifier for the instance that handled the request.
  1766. InstanceId string `json:"instanceId,omitempty"`
  1767. // InstanceIndex: If the instance processing this request belongs to a
  1768. // manually scaled module, then this is the 0-based index of the
  1769. // instance. Otherwise, this value is -1.
  1770. InstanceIndex int64 `json:"instanceIndex,omitempty"`
  1771. // Ip: Origin IP address.
  1772. Ip string `json:"ip,omitempty"`
  1773. // Latency: Latency of the request.
  1774. Latency string `json:"latency,omitempty"`
  1775. // Line: A list of log lines emitted by the application while serving
  1776. // this request.
  1777. Line []*LogLine `json:"line,omitempty"`
  1778. // MegaCycles: Number of CPU megacycles used to process request.
  1779. MegaCycles int64 `json:"megaCycles,omitempty,string"`
  1780. // Method: Request method. Example: "GET", "HEAD", "PUT", "POST",
  1781. // "DELETE".
  1782. Method string `json:"method,omitempty"`
  1783. // ModuleId: Module of the application that handled this request.
  1784. ModuleId string `json:"moduleId,omitempty"`
  1785. // Nickname: The logged-in user who made the request.Most likely, this
  1786. // is the part of the user's email before the @ sign. The field value is
  1787. // the same for different requests from the same user, but different
  1788. // users can have similar names. This information is also available to
  1789. // the application via the App Engine Users API.This field will be
  1790. // populated starting with App Engine 1.9.21.
  1791. Nickname string `json:"nickname,omitempty"`
  1792. // PendingTime: Time this request spent in the pending request queue.
  1793. PendingTime string `json:"pendingTime,omitempty"`
  1794. // Referrer: Referrer URL of request.
  1795. Referrer string `json:"referrer,omitempty"`
  1796. // RequestId: Globally unique identifier for a request, which is based
  1797. // on the request start time. Request IDs for requests which started
  1798. // later will compare greater as strings than those for requests which
  1799. // started earlier.
  1800. RequestId string `json:"requestId,omitempty"`
  1801. // Resource: Contains the path and query portion of the URL that was
  1802. // requested. For example, if the URL was
  1803. // "http://example.com/app?name=val", the resource would be
  1804. // "/app?name=val". The fragment identifier, which is identified by the
  1805. // # character, is not included.
  1806. Resource string `json:"resource,omitempty"`
  1807. // ResponseSize: Size in bytes sent back to client by request.
  1808. ResponseSize int64 `json:"responseSize,omitempty,string"`
  1809. // SourceReference: Source code for the application that handled this
  1810. // request. There can be more than one source reference per deployed
  1811. // application if source code is distributed among multiple
  1812. // repositories.
  1813. SourceReference []*SourceReference `json:"sourceReference,omitempty"`
  1814. // StartTime: Time when the request started.
  1815. StartTime string `json:"startTime,omitempty"`
  1816. // Status: HTTP response status code. Example: 200, 404.
  1817. Status int64 `json:"status,omitempty"`
  1818. // TaskName: Task name of the request, in the case of an offline
  1819. // request.
  1820. TaskName string `json:"taskName,omitempty"`
  1821. // TaskQueueName: Queue name of the request, in the case of an offline
  1822. // request.
  1823. TaskQueueName string `json:"taskQueueName,omitempty"`
  1824. // TraceId: Stackdriver Trace identifier for this request.
  1825. TraceId string `json:"traceId,omitempty"`
  1826. // TraceSampled: If true, the value in the 'trace_id' field was sampled
  1827. // for storage in a trace backend.
  1828. TraceSampled bool `json:"traceSampled,omitempty"`
  1829. // UrlMapEntry: File or class that handled the request.
  1830. UrlMapEntry string `json:"urlMapEntry,omitempty"`
  1831. // UserAgent: User agent that made the request.
  1832. UserAgent string `json:"userAgent,omitempty"`
  1833. // VersionId: Version of the application that handled this request.
  1834. VersionId string `json:"versionId,omitempty"`
  1835. // WasLoadingRequest: Whether this was a loading request for the
  1836. // instance.
  1837. WasLoadingRequest bool `json:"wasLoadingRequest,omitempty"`
  1838. // ForceSendFields is a list of field names (e.g. "AppEngineRelease") to
  1839. // unconditionally include in API requests. By default, fields with
  1840. // empty values are omitted from API requests. However, any non-pointer,
  1841. // non-interface field appearing in ForceSendFields will be sent to the
  1842. // server regardless of whether the field is empty or not. This may be
  1843. // used to include empty fields in Patch requests.
  1844. ForceSendFields []string `json:"-"`
  1845. // NullFields is a list of field names (e.g. "AppEngineRelease") to
  1846. // include in API requests with the JSON null value. By default, fields
  1847. // with empty values are omitted from API requests. However, any field
  1848. // with an empty value appearing in NullFields will be sent to the
  1849. // server as null. It is an error if a field in this list has a
  1850. // non-empty value. This may be used to include null fields in Patch
  1851. // requests.
  1852. NullFields []string `json:"-"`
  1853. }
  1854. func (s *RequestLog) MarshalJSON() ([]byte, error) {
  1855. type NoMethod RequestLog
  1856. raw := NoMethod(*s)
  1857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1858. }
  1859. func (s *RequestLog) UnmarshalJSON(data []byte) error {
  1860. type NoMethod RequestLog
  1861. var s1 struct {
  1862. Cost gensupport.JSONFloat64 `json:"cost"`
  1863. *NoMethod
  1864. }
  1865. s1.NoMethod = (*NoMethod)(s)
  1866. if err := json.Unmarshal(data, &s1); err != nil {
  1867. return err
  1868. }
  1869. s.Cost = float64(s1.Cost)
  1870. return nil
  1871. }
  1872. // SourceLocation: Specifies a location in a source code file.
  1873. type SourceLocation struct {
  1874. // File: Source file name. Depending on the runtime environment, this
  1875. // might be a simple name or a fully-qualified name.
  1876. File string `json:"file,omitempty"`
  1877. // FunctionName: Human-readable name of the function or method being
  1878. // invoked, with optional context such as the class or package name.
  1879. // This information is used in contexts such as the logs viewer, where a
  1880. // file and line number are less meaningful. The format can vary by
  1881. // language. For example: qual.if.ied.Class.method (Java),
  1882. // dir/package.func (Go), function (Python).
  1883. FunctionName string `json:"functionName,omitempty"`
  1884. // Line: Line within the source file.
  1885. Line int64 `json:"line,omitempty,string"`
  1886. // ForceSendFields is a list of field names (e.g. "File") to
  1887. // unconditionally include in API requests. By default, fields with
  1888. // empty values are omitted from API requests. However, any non-pointer,
  1889. // non-interface field appearing in ForceSendFields will be sent to the
  1890. // server regardless of whether the field is empty or not. This may be
  1891. // used to include empty fields in Patch requests.
  1892. ForceSendFields []string `json:"-"`
  1893. // NullFields is a list of field names (e.g. "File") to include in API
  1894. // requests with the JSON null value. By default, fields with empty
  1895. // values are omitted from API requests. However, any field with an
  1896. // empty value appearing in NullFields will be sent to the server as
  1897. // null. It is an error if a field in this list has a non-empty value.
  1898. // This may be used to include null fields in Patch requests.
  1899. NullFields []string `json:"-"`
  1900. }
  1901. func (s *SourceLocation) MarshalJSON() ([]byte, error) {
  1902. type NoMethod SourceLocation
  1903. raw := NoMethod(*s)
  1904. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1905. }
  1906. // SourceReference: A reference to a particular snapshot of the source
  1907. // tree used to build and deploy an application.
  1908. type SourceReference struct {
  1909. // Repository: Optional. A URI string identifying the repository.
  1910. // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git"
  1911. Repository string `json:"repository,omitempty"`
  1912. // RevisionId: The canonical and persistent identifier of the deployed
  1913. // revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
  1914. RevisionId string `json:"revisionId,omitempty"`
  1915. // ForceSendFields is a list of field names (e.g. "Repository") to
  1916. // unconditionally include in API requests. By default, fields with
  1917. // empty values are omitted from API requests. However, any non-pointer,
  1918. // non-interface field appearing in ForceSendFields will be sent to the
  1919. // server regardless of whether the field is empty or not. This may be
  1920. // used to include empty fields in Patch requests.
  1921. ForceSendFields []string `json:"-"`
  1922. // NullFields is a list of field names (e.g. "Repository") to include in
  1923. // API requests with the JSON null value. By default, fields with empty
  1924. // values are omitted from API requests. However, any field with an
  1925. // empty value appearing in NullFields will be sent to the server as
  1926. // null. It is an error if a field in this list has a non-empty value.
  1927. // This may be used to include null fields in Patch requests.
  1928. NullFields []string `json:"-"`
  1929. }
  1930. func (s *SourceReference) MarshalJSON() ([]byte, error) {
  1931. type NoMethod SourceReference
  1932. raw := NoMethod(*s)
  1933. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1934. }
  1935. // WriteLogEntriesRequest: The parameters to WriteLogEntries.
  1936. type WriteLogEntriesRequest struct {
  1937. // DryRun: Optional. If true, the request should expect normal response,
  1938. // but the entries won't be persisted nor exported. Useful for checking
  1939. // whether the logging API endpoints are working properly before sending
  1940. // valuable data.
  1941. DryRun bool `json:"dryRun,omitempty"`
  1942. // Entries: Required. The log entries to send to Logging. The order of
  1943. // log entries in this list does not matter. Values supplied in this
  1944. // method's log_name, resource, and labels fields are copied into those
  1945. // log entries in this list that do not include values for their
  1946. // corresponding fields. For more information, see the LogEntry type.If
  1947. // the timestamp or insert_id fields are missing in log entries, then
  1948. // this method supplies the current time or a unique identifier,
  1949. // respectively. The supplied values are chosen so that, among the log
  1950. // entries that did not supply their own values, the entries earlier in
  1951. // the list will sort before the entries later in the list. See the
  1952. // entries.list method.Log entries with timestamps that are more than
  1953. // the logs retention period in the past or more than 24 hours in the
  1954. // future will not be available when calling entries.list. However,
  1955. // those log entries can still be exported with LogSinks.To improve
  1956. // throughput and to avoid exceeding the quota limit for calls to
  1957. // entries.write, you should try to include several log entries in this
  1958. // list, rather than calling this method for each individual log entry.
  1959. Entries []*LogEntry `json:"entries,omitempty"`
  1960. // Labels: Optional. Default labels that are added to the labels field
  1961. // of all log entries in entries. If a log entry already has a label
  1962. // with the same key as a label in this parameter, then the log entry's
  1963. // label is not changed. See LogEntry.
  1964. Labels map[string]string `json:"labels,omitempty"`
  1965. // LogName: Optional. A default log resource name that is assigned to
  1966. // all log entries in entries that do not specify a value for
  1967. // log_name:
  1968. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  1969. // "organizations/[ORGANI
  1970. // ZATION_ID]/logs/[LOG_ID]"
  1971. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[
  1972. // LOG_ID]"
  1973. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  1974. // [LOG_ID] must be URL-encoded. For
  1975. // example:
  1976. // "projects/my-project-id/logs/syslog"
  1977. // "organizations/123456789
  1978. // 0/logs/cloudresourcemanager.googleapis.com%2Factivity"
  1979. // The permission <code>logging.logEntries.create</code> is needed on
  1980. // each project, organization, billing account, or folder that is
  1981. // receiving new log entries, whether the resource is specified in
  1982. // <code>logName</code> or in an individual log entry.
  1983. LogName string `json:"logName,omitempty"`
  1984. // PartialSuccess: Optional. Whether valid entries should be written
  1985. // even if some other entries fail due to INVALID_ARGUMENT or
  1986. // PERMISSION_DENIED errors. If any entry is not written, then the
  1987. // response status is the error associated with one of the failed
  1988. // entries and the response includes error details keyed by the entries'
  1989. // zero-based index in the entries.write method.
  1990. PartialSuccess bool `json:"partialSuccess,omitempty"`
  1991. // Resource: Optional. A default monitored resource object that is
  1992. // assigned to all log entries in entries that do not specify a value
  1993. // for resource. Example:
  1994. // { "type": "gce_instance",
  1995. // "labels": {
  1996. // "zone": "us-central1-a", "instance_id": "00000000000000000000"
  1997. // }}
  1998. // See LogEntry.
  1999. Resource *MonitoredResource `json:"resource,omitempty"`
  2000. // ForceSendFields is a list of field names (e.g. "DryRun") to
  2001. // unconditionally include in API requests. By default, fields with
  2002. // empty values are omitted from API requests. However, any non-pointer,
  2003. // non-interface field appearing in ForceSendFields will be sent to the
  2004. // server regardless of whether the field is empty or not. This may be
  2005. // used to include empty fields in Patch requests.
  2006. ForceSendFields []string `json:"-"`
  2007. // NullFields is a list of field names (e.g. "DryRun") to include in API
  2008. // requests with the JSON null value. By default, fields with empty
  2009. // values are omitted from API requests. However, any field with an
  2010. // empty value appearing in NullFields will be sent to the server as
  2011. // null. It is an error if a field in this list has a non-empty value.
  2012. // This may be used to include null fields in Patch requests.
  2013. NullFields []string `json:"-"`
  2014. }
  2015. func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
  2016. type NoMethod WriteLogEntriesRequest
  2017. raw := NoMethod(*s)
  2018. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2019. }
  2020. // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
  2021. type WriteLogEntriesResponse struct {
  2022. // ServerResponse contains the HTTP response code and headers from the
  2023. // server.
  2024. googleapi.ServerResponse `json:"-"`
  2025. }
  2026. // method id "logging.billingAccounts.exclusions.create":
  2027. type BillingAccountsExclusionsCreateCall struct {
  2028. s *Service
  2029. parent string
  2030. logexclusion *LogExclusion
  2031. urlParams_ gensupport.URLParams
  2032. ctx_ context.Context
  2033. header_ http.Header
  2034. }
  2035. // Create: Creates a new exclusion in a specified parent resource. Only
  2036. // log entries belonging to that resource can be excluded. You can have
  2037. // up to 10 exclusions in a resource.
  2038. func (r *BillingAccountsExclusionsService) Create(parent string, logexclusion *LogExclusion) *BillingAccountsExclusionsCreateCall {
  2039. c := &BillingAccountsExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2040. c.parent = parent
  2041. c.logexclusion = logexclusion
  2042. return c
  2043. }
  2044. // Fields allows partial responses to be retrieved. See
  2045. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2046. // for more information.
  2047. func (c *BillingAccountsExclusionsCreateCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsCreateCall {
  2048. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2049. return c
  2050. }
  2051. // Context sets the context to be used in this call's Do method. Any
  2052. // pending HTTP request will be aborted if the provided context is
  2053. // canceled.
  2054. func (c *BillingAccountsExclusionsCreateCall) Context(ctx context.Context) *BillingAccountsExclusionsCreateCall {
  2055. c.ctx_ = ctx
  2056. return c
  2057. }
  2058. // Header returns an http.Header that can be modified by the caller to
  2059. // add HTTP headers to the request.
  2060. func (c *BillingAccountsExclusionsCreateCall) Header() http.Header {
  2061. if c.header_ == nil {
  2062. c.header_ = make(http.Header)
  2063. }
  2064. return c.header_
  2065. }
  2066. func (c *BillingAccountsExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  2067. reqHeaders := make(http.Header)
  2068. for k, v := range c.header_ {
  2069. reqHeaders[k] = v
  2070. }
  2071. reqHeaders.Set("User-Agent", c.s.userAgent())
  2072. var body io.Reader = nil
  2073. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  2074. if err != nil {
  2075. return nil, err
  2076. }
  2077. reqHeaders.Set("Content-Type", "application/json")
  2078. c.urlParams_.Set("alt", alt)
  2079. c.urlParams_.Set("prettyPrint", "false")
  2080. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  2081. urls += "?" + c.urlParams_.Encode()
  2082. req, err := http.NewRequest("POST", urls, body)
  2083. if err != nil {
  2084. return nil, err
  2085. }
  2086. req.Header = reqHeaders
  2087. googleapi.Expand(req.URL, map[string]string{
  2088. "parent": c.parent,
  2089. })
  2090. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2091. }
  2092. // Do executes the "logging.billingAccounts.exclusions.create" call.
  2093. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  2094. // status code is an error. Response headers are in either
  2095. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  2096. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2097. // to check whether the returned error was because
  2098. // http.StatusNotModified was returned.
  2099. func (c *BillingAccountsExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  2100. gensupport.SetOptions(c.urlParams_, opts...)
  2101. res, err := c.doRequest("json")
  2102. if res != nil && res.StatusCode == http.StatusNotModified {
  2103. if res.Body != nil {
  2104. res.Body.Close()
  2105. }
  2106. return nil, &googleapi.Error{
  2107. Code: res.StatusCode,
  2108. Header: res.Header,
  2109. }
  2110. }
  2111. if err != nil {
  2112. return nil, err
  2113. }
  2114. defer googleapi.CloseBody(res)
  2115. if err := googleapi.CheckResponse(res); err != nil {
  2116. return nil, err
  2117. }
  2118. ret := &LogExclusion{
  2119. ServerResponse: googleapi.ServerResponse{
  2120. Header: res.Header,
  2121. HTTPStatusCode: res.StatusCode,
  2122. },
  2123. }
  2124. target := &ret
  2125. if err := gensupport.DecodeResponse(target, res); err != nil {
  2126. return nil, err
  2127. }
  2128. return ret, nil
  2129. // {
  2130. // "description": "Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.",
  2131. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions",
  2132. // "httpMethod": "POST",
  2133. // "id": "logging.billingAccounts.exclusions.create",
  2134. // "parameterOrder": [
  2135. // "parent"
  2136. // ],
  2137. // "parameters": {
  2138. // "parent": {
  2139. // "description": "Required. The parent resource in which to create the exclusion:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
  2140. // "location": "path",
  2141. // "pattern": "^billingAccounts/[^/]+$",
  2142. // "required": true,
  2143. // "type": "string"
  2144. // }
  2145. // },
  2146. // "path": "v2/{+parent}/exclusions",
  2147. // "request": {
  2148. // "$ref": "LogExclusion"
  2149. // },
  2150. // "response": {
  2151. // "$ref": "LogExclusion"
  2152. // },
  2153. // "scopes": [
  2154. // "https://www.googleapis.com/auth/cloud-platform",
  2155. // "https://www.googleapis.com/auth/logging.admin"
  2156. // ]
  2157. // }
  2158. }
  2159. // method id "logging.billingAccounts.exclusions.delete":
  2160. type BillingAccountsExclusionsDeleteCall struct {
  2161. s *Service
  2162. name string
  2163. urlParams_ gensupport.URLParams
  2164. ctx_ context.Context
  2165. header_ http.Header
  2166. }
  2167. // Delete: Deletes an exclusion.
  2168. func (r *BillingAccountsExclusionsService) Delete(name string) *BillingAccountsExclusionsDeleteCall {
  2169. c := &BillingAccountsExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2170. c.name = name
  2171. return c
  2172. }
  2173. // Fields allows partial responses to be retrieved. See
  2174. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2175. // for more information.
  2176. func (c *BillingAccountsExclusionsDeleteCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsDeleteCall {
  2177. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2178. return c
  2179. }
  2180. // Context sets the context to be used in this call's Do method. Any
  2181. // pending HTTP request will be aborted if the provided context is
  2182. // canceled.
  2183. func (c *BillingAccountsExclusionsDeleteCall) Context(ctx context.Context) *BillingAccountsExclusionsDeleteCall {
  2184. c.ctx_ = ctx
  2185. return c
  2186. }
  2187. // Header returns an http.Header that can be modified by the caller to
  2188. // add HTTP headers to the request.
  2189. func (c *BillingAccountsExclusionsDeleteCall) Header() http.Header {
  2190. if c.header_ == nil {
  2191. c.header_ = make(http.Header)
  2192. }
  2193. return c.header_
  2194. }
  2195. func (c *BillingAccountsExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2196. reqHeaders := make(http.Header)
  2197. for k, v := range c.header_ {
  2198. reqHeaders[k] = v
  2199. }
  2200. reqHeaders.Set("User-Agent", c.s.userAgent())
  2201. var body io.Reader = nil
  2202. c.urlParams_.Set("alt", alt)
  2203. c.urlParams_.Set("prettyPrint", "false")
  2204. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2205. urls += "?" + c.urlParams_.Encode()
  2206. req, err := http.NewRequest("DELETE", urls, body)
  2207. if err != nil {
  2208. return nil, err
  2209. }
  2210. req.Header = reqHeaders
  2211. googleapi.Expand(req.URL, map[string]string{
  2212. "name": c.name,
  2213. })
  2214. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2215. }
  2216. // Do executes the "logging.billingAccounts.exclusions.delete" call.
  2217. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2218. // code is an error. Response headers are in either
  2219. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2220. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2221. // check whether the returned error was because http.StatusNotModified
  2222. // was returned.
  2223. func (c *BillingAccountsExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2224. gensupport.SetOptions(c.urlParams_, opts...)
  2225. res, err := c.doRequest("json")
  2226. if res != nil && res.StatusCode == http.StatusNotModified {
  2227. if res.Body != nil {
  2228. res.Body.Close()
  2229. }
  2230. return nil, &googleapi.Error{
  2231. Code: res.StatusCode,
  2232. Header: res.Header,
  2233. }
  2234. }
  2235. if err != nil {
  2236. return nil, err
  2237. }
  2238. defer googleapi.CloseBody(res)
  2239. if err := googleapi.CheckResponse(res); err != nil {
  2240. return nil, err
  2241. }
  2242. ret := &Empty{
  2243. ServerResponse: googleapi.ServerResponse{
  2244. Header: res.Header,
  2245. HTTPStatusCode: res.StatusCode,
  2246. },
  2247. }
  2248. target := &ret
  2249. if err := gensupport.DecodeResponse(target, res); err != nil {
  2250. return nil, err
  2251. }
  2252. return ret, nil
  2253. // {
  2254. // "description": "Deletes an exclusion.",
  2255. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions/{exclusionsId}",
  2256. // "httpMethod": "DELETE",
  2257. // "id": "logging.billingAccounts.exclusions.delete",
  2258. // "parameterOrder": [
  2259. // "name"
  2260. // ],
  2261. // "parameters": {
  2262. // "name": {
  2263. // "description": "Required. The resource name of an existing exclusion to delete:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  2264. // "location": "path",
  2265. // "pattern": "^billingAccounts/[^/]+/exclusions/[^/]+$",
  2266. // "required": true,
  2267. // "type": "string"
  2268. // }
  2269. // },
  2270. // "path": "v2/{+name}",
  2271. // "response": {
  2272. // "$ref": "Empty"
  2273. // },
  2274. // "scopes": [
  2275. // "https://www.googleapis.com/auth/cloud-platform",
  2276. // "https://www.googleapis.com/auth/logging.admin"
  2277. // ]
  2278. // }
  2279. }
  2280. // method id "logging.billingAccounts.exclusions.get":
  2281. type BillingAccountsExclusionsGetCall struct {
  2282. s *Service
  2283. name string
  2284. urlParams_ gensupport.URLParams
  2285. ifNoneMatch_ string
  2286. ctx_ context.Context
  2287. header_ http.Header
  2288. }
  2289. // Get: Gets the description of an exclusion.
  2290. func (r *BillingAccountsExclusionsService) Get(name string) *BillingAccountsExclusionsGetCall {
  2291. c := &BillingAccountsExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2292. c.name = name
  2293. return c
  2294. }
  2295. // Fields allows partial responses to be retrieved. See
  2296. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2297. // for more information.
  2298. func (c *BillingAccountsExclusionsGetCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsGetCall {
  2299. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2300. return c
  2301. }
  2302. // IfNoneMatch sets the optional parameter which makes the operation
  2303. // fail if the object's ETag matches the given value. This is useful for
  2304. // getting updates only after the object has changed since the last
  2305. // request. Use googleapi.IsNotModified to check whether the response
  2306. // error from Do is the result of In-None-Match.
  2307. func (c *BillingAccountsExclusionsGetCall) IfNoneMatch(entityTag string) *BillingAccountsExclusionsGetCall {
  2308. c.ifNoneMatch_ = entityTag
  2309. return c
  2310. }
  2311. // Context sets the context to be used in this call's Do method. Any
  2312. // pending HTTP request will be aborted if the provided context is
  2313. // canceled.
  2314. func (c *BillingAccountsExclusionsGetCall) Context(ctx context.Context) *BillingAccountsExclusionsGetCall {
  2315. c.ctx_ = ctx
  2316. return c
  2317. }
  2318. // Header returns an http.Header that can be modified by the caller to
  2319. // add HTTP headers to the request.
  2320. func (c *BillingAccountsExclusionsGetCall) Header() http.Header {
  2321. if c.header_ == nil {
  2322. c.header_ = make(http.Header)
  2323. }
  2324. return c.header_
  2325. }
  2326. func (c *BillingAccountsExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  2327. reqHeaders := make(http.Header)
  2328. for k, v := range c.header_ {
  2329. reqHeaders[k] = v
  2330. }
  2331. reqHeaders.Set("User-Agent", c.s.userAgent())
  2332. if c.ifNoneMatch_ != "" {
  2333. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2334. }
  2335. var body io.Reader = nil
  2336. c.urlParams_.Set("alt", alt)
  2337. c.urlParams_.Set("prettyPrint", "false")
  2338. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2339. urls += "?" + c.urlParams_.Encode()
  2340. req, err := http.NewRequest("GET", urls, body)
  2341. if err != nil {
  2342. return nil, err
  2343. }
  2344. req.Header = reqHeaders
  2345. googleapi.Expand(req.URL, map[string]string{
  2346. "name": c.name,
  2347. })
  2348. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2349. }
  2350. // Do executes the "logging.billingAccounts.exclusions.get" call.
  2351. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  2352. // status code is an error. Response headers are in either
  2353. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  2354. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2355. // to check whether the returned error was because
  2356. // http.StatusNotModified was returned.
  2357. func (c *BillingAccountsExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  2358. gensupport.SetOptions(c.urlParams_, opts...)
  2359. res, err := c.doRequest("json")
  2360. if res != nil && res.StatusCode == http.StatusNotModified {
  2361. if res.Body != nil {
  2362. res.Body.Close()
  2363. }
  2364. return nil, &googleapi.Error{
  2365. Code: res.StatusCode,
  2366. Header: res.Header,
  2367. }
  2368. }
  2369. if err != nil {
  2370. return nil, err
  2371. }
  2372. defer googleapi.CloseBody(res)
  2373. if err := googleapi.CheckResponse(res); err != nil {
  2374. return nil, err
  2375. }
  2376. ret := &LogExclusion{
  2377. ServerResponse: googleapi.ServerResponse{
  2378. Header: res.Header,
  2379. HTTPStatusCode: res.StatusCode,
  2380. },
  2381. }
  2382. target := &ret
  2383. if err := gensupport.DecodeResponse(target, res); err != nil {
  2384. return nil, err
  2385. }
  2386. return ret, nil
  2387. // {
  2388. // "description": "Gets the description of an exclusion.",
  2389. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions/{exclusionsId}",
  2390. // "httpMethod": "GET",
  2391. // "id": "logging.billingAccounts.exclusions.get",
  2392. // "parameterOrder": [
  2393. // "name"
  2394. // ],
  2395. // "parameters": {
  2396. // "name": {
  2397. // "description": "Required. The resource name of an existing exclusion:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  2398. // "location": "path",
  2399. // "pattern": "^billingAccounts/[^/]+/exclusions/[^/]+$",
  2400. // "required": true,
  2401. // "type": "string"
  2402. // }
  2403. // },
  2404. // "path": "v2/{+name}",
  2405. // "response": {
  2406. // "$ref": "LogExclusion"
  2407. // },
  2408. // "scopes": [
  2409. // "https://www.googleapis.com/auth/cloud-platform",
  2410. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2411. // "https://www.googleapis.com/auth/logging.admin",
  2412. // "https://www.googleapis.com/auth/logging.read"
  2413. // ]
  2414. // }
  2415. }
  2416. // method id "logging.billingAccounts.exclusions.list":
  2417. type BillingAccountsExclusionsListCall struct {
  2418. s *Service
  2419. parent string
  2420. urlParams_ gensupport.URLParams
  2421. ifNoneMatch_ string
  2422. ctx_ context.Context
  2423. header_ http.Header
  2424. }
  2425. // List: Lists all the exclusions in a parent resource.
  2426. func (r *BillingAccountsExclusionsService) List(parent string) *BillingAccountsExclusionsListCall {
  2427. c := &BillingAccountsExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2428. c.parent = parent
  2429. return c
  2430. }
  2431. // PageSize sets the optional parameter "pageSize": The maximum number
  2432. // of results to return from this request. Non-positive values are
  2433. // ignored. The presence of nextPageToken in the response indicates that
  2434. // more results might be available.
  2435. func (c *BillingAccountsExclusionsListCall) PageSize(pageSize int64) *BillingAccountsExclusionsListCall {
  2436. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2437. return c
  2438. }
  2439. // PageToken sets the optional parameter "pageToken": If present, then
  2440. // retrieve the next batch of results from the preceding call to this
  2441. // method. pageToken must be the value of nextPageToken from the
  2442. // previous response. The values of other method parameters should be
  2443. // identical to those in the previous call.
  2444. func (c *BillingAccountsExclusionsListCall) PageToken(pageToken string) *BillingAccountsExclusionsListCall {
  2445. c.urlParams_.Set("pageToken", pageToken)
  2446. return c
  2447. }
  2448. // Fields allows partial responses to be retrieved. See
  2449. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2450. // for more information.
  2451. func (c *BillingAccountsExclusionsListCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsListCall {
  2452. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2453. return c
  2454. }
  2455. // IfNoneMatch sets the optional parameter which makes the operation
  2456. // fail if the object's ETag matches the given value. This is useful for
  2457. // getting updates only after the object has changed since the last
  2458. // request. Use googleapi.IsNotModified to check whether the response
  2459. // error from Do is the result of In-None-Match.
  2460. func (c *BillingAccountsExclusionsListCall) IfNoneMatch(entityTag string) *BillingAccountsExclusionsListCall {
  2461. c.ifNoneMatch_ = entityTag
  2462. return c
  2463. }
  2464. // Context sets the context to be used in this call's Do method. Any
  2465. // pending HTTP request will be aborted if the provided context is
  2466. // canceled.
  2467. func (c *BillingAccountsExclusionsListCall) Context(ctx context.Context) *BillingAccountsExclusionsListCall {
  2468. c.ctx_ = ctx
  2469. return c
  2470. }
  2471. // Header returns an http.Header that can be modified by the caller to
  2472. // add HTTP headers to the request.
  2473. func (c *BillingAccountsExclusionsListCall) Header() http.Header {
  2474. if c.header_ == nil {
  2475. c.header_ = make(http.Header)
  2476. }
  2477. return c.header_
  2478. }
  2479. func (c *BillingAccountsExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  2480. reqHeaders := make(http.Header)
  2481. for k, v := range c.header_ {
  2482. reqHeaders[k] = v
  2483. }
  2484. reqHeaders.Set("User-Agent", c.s.userAgent())
  2485. if c.ifNoneMatch_ != "" {
  2486. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2487. }
  2488. var body io.Reader = nil
  2489. c.urlParams_.Set("alt", alt)
  2490. c.urlParams_.Set("prettyPrint", "false")
  2491. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  2492. urls += "?" + c.urlParams_.Encode()
  2493. req, err := http.NewRequest("GET", urls, body)
  2494. if err != nil {
  2495. return nil, err
  2496. }
  2497. req.Header = reqHeaders
  2498. googleapi.Expand(req.URL, map[string]string{
  2499. "parent": c.parent,
  2500. })
  2501. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2502. }
  2503. // Do executes the "logging.billingAccounts.exclusions.list" call.
  2504. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  2505. // non-2xx status code is an error. Response headers are in either
  2506. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  2507. // returned at all) in error.(*googleapi.Error).Header. Use
  2508. // googleapi.IsNotModified to check whether the returned error was
  2509. // because http.StatusNotModified was returned.
  2510. func (c *BillingAccountsExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  2511. gensupport.SetOptions(c.urlParams_, opts...)
  2512. res, err := c.doRequest("json")
  2513. if res != nil && res.StatusCode == http.StatusNotModified {
  2514. if res.Body != nil {
  2515. res.Body.Close()
  2516. }
  2517. return nil, &googleapi.Error{
  2518. Code: res.StatusCode,
  2519. Header: res.Header,
  2520. }
  2521. }
  2522. if err != nil {
  2523. return nil, err
  2524. }
  2525. defer googleapi.CloseBody(res)
  2526. if err := googleapi.CheckResponse(res); err != nil {
  2527. return nil, err
  2528. }
  2529. ret := &ListExclusionsResponse{
  2530. ServerResponse: googleapi.ServerResponse{
  2531. Header: res.Header,
  2532. HTTPStatusCode: res.StatusCode,
  2533. },
  2534. }
  2535. target := &ret
  2536. if err := gensupport.DecodeResponse(target, res); err != nil {
  2537. return nil, err
  2538. }
  2539. return ret, nil
  2540. // {
  2541. // "description": "Lists all the exclusions in a parent resource.",
  2542. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions",
  2543. // "httpMethod": "GET",
  2544. // "id": "logging.billingAccounts.exclusions.list",
  2545. // "parameterOrder": [
  2546. // "parent"
  2547. // ],
  2548. // "parameters": {
  2549. // "pageSize": {
  2550. // "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.",
  2551. // "format": "int32",
  2552. // "location": "query",
  2553. // "type": "integer"
  2554. // },
  2555. // "pageToken": {
  2556. // "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.",
  2557. // "location": "query",
  2558. // "type": "string"
  2559. // },
  2560. // "parent": {
  2561. // "description": "Required. The parent resource whose exclusions are to be listed.\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\n",
  2562. // "location": "path",
  2563. // "pattern": "^billingAccounts/[^/]+$",
  2564. // "required": true,
  2565. // "type": "string"
  2566. // }
  2567. // },
  2568. // "path": "v2/{+parent}/exclusions",
  2569. // "response": {
  2570. // "$ref": "ListExclusionsResponse"
  2571. // },
  2572. // "scopes": [
  2573. // "https://www.googleapis.com/auth/cloud-platform",
  2574. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2575. // "https://www.googleapis.com/auth/logging.admin",
  2576. // "https://www.googleapis.com/auth/logging.read"
  2577. // ]
  2578. // }
  2579. }
  2580. // Pages invokes f for each page of results.
  2581. // A non-nil error returned from f will halt the iteration.
  2582. // The provided context supersedes any context provided to the Context method.
  2583. func (c *BillingAccountsExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  2584. c.ctx_ = ctx
  2585. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2586. for {
  2587. x, err := c.Do()
  2588. if err != nil {
  2589. return err
  2590. }
  2591. if err := f(x); err != nil {
  2592. return err
  2593. }
  2594. if x.NextPageToken == "" {
  2595. return nil
  2596. }
  2597. c.PageToken(x.NextPageToken)
  2598. }
  2599. }
  2600. // method id "logging.billingAccounts.exclusions.patch":
  2601. type BillingAccountsExclusionsPatchCall struct {
  2602. s *Service
  2603. name string
  2604. logexclusion *LogExclusion
  2605. urlParams_ gensupport.URLParams
  2606. ctx_ context.Context
  2607. header_ http.Header
  2608. }
  2609. // Patch: Changes one or more properties of an existing exclusion.
  2610. func (r *BillingAccountsExclusionsService) Patch(name string, logexclusion *LogExclusion) *BillingAccountsExclusionsPatchCall {
  2611. c := &BillingAccountsExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2612. c.name = name
  2613. c.logexclusion = logexclusion
  2614. return c
  2615. }
  2616. // UpdateMask sets the optional parameter "updateMask": Required. A
  2617. // nonempty list of fields to change in the existing exclusion. New
  2618. // values for the fields are taken from the corresponding fields in the
  2619. // LogExclusion included in this request. Fields not mentioned in
  2620. // update_mask are not changed and are ignored in the request.For
  2621. // example, to change the filter and description of an exclusion,
  2622. // specify an update_mask of "filter,description".
  2623. func (c *BillingAccountsExclusionsPatchCall) UpdateMask(updateMask string) *BillingAccountsExclusionsPatchCall {
  2624. c.urlParams_.Set("updateMask", updateMask)
  2625. return c
  2626. }
  2627. // Fields allows partial responses to be retrieved. See
  2628. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2629. // for more information.
  2630. func (c *BillingAccountsExclusionsPatchCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsPatchCall {
  2631. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2632. return c
  2633. }
  2634. // Context sets the context to be used in this call's Do method. Any
  2635. // pending HTTP request will be aborted if the provided context is
  2636. // canceled.
  2637. func (c *BillingAccountsExclusionsPatchCall) Context(ctx context.Context) *BillingAccountsExclusionsPatchCall {
  2638. c.ctx_ = ctx
  2639. return c
  2640. }
  2641. // Header returns an http.Header that can be modified by the caller to
  2642. // add HTTP headers to the request.
  2643. func (c *BillingAccountsExclusionsPatchCall) Header() http.Header {
  2644. if c.header_ == nil {
  2645. c.header_ = make(http.Header)
  2646. }
  2647. return c.header_
  2648. }
  2649. func (c *BillingAccountsExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  2650. reqHeaders := make(http.Header)
  2651. for k, v := range c.header_ {
  2652. reqHeaders[k] = v
  2653. }
  2654. reqHeaders.Set("User-Agent", c.s.userAgent())
  2655. var body io.Reader = nil
  2656. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  2657. if err != nil {
  2658. return nil, err
  2659. }
  2660. reqHeaders.Set("Content-Type", "application/json")
  2661. c.urlParams_.Set("alt", alt)
  2662. c.urlParams_.Set("prettyPrint", "false")
  2663. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2664. urls += "?" + c.urlParams_.Encode()
  2665. req, err := http.NewRequest("PATCH", urls, body)
  2666. if err != nil {
  2667. return nil, err
  2668. }
  2669. req.Header = reqHeaders
  2670. googleapi.Expand(req.URL, map[string]string{
  2671. "name": c.name,
  2672. })
  2673. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2674. }
  2675. // Do executes the "logging.billingAccounts.exclusions.patch" call.
  2676. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  2677. // status code is an error. Response headers are in either
  2678. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  2679. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2680. // to check whether the returned error was because
  2681. // http.StatusNotModified was returned.
  2682. func (c *BillingAccountsExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  2683. gensupport.SetOptions(c.urlParams_, opts...)
  2684. res, err := c.doRequest("json")
  2685. if res != nil && res.StatusCode == http.StatusNotModified {
  2686. if res.Body != nil {
  2687. res.Body.Close()
  2688. }
  2689. return nil, &googleapi.Error{
  2690. Code: res.StatusCode,
  2691. Header: res.Header,
  2692. }
  2693. }
  2694. if err != nil {
  2695. return nil, err
  2696. }
  2697. defer googleapi.CloseBody(res)
  2698. if err := googleapi.CheckResponse(res); err != nil {
  2699. return nil, err
  2700. }
  2701. ret := &LogExclusion{
  2702. ServerResponse: googleapi.ServerResponse{
  2703. Header: res.Header,
  2704. HTTPStatusCode: res.StatusCode,
  2705. },
  2706. }
  2707. target := &ret
  2708. if err := gensupport.DecodeResponse(target, res); err != nil {
  2709. return nil, err
  2710. }
  2711. return ret, nil
  2712. // {
  2713. // "description": "Changes one or more properties of an existing exclusion.",
  2714. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions/{exclusionsId}",
  2715. // "httpMethod": "PATCH",
  2716. // "id": "logging.billingAccounts.exclusions.patch",
  2717. // "parameterOrder": [
  2718. // "name"
  2719. // ],
  2720. // "parameters": {
  2721. // "name": {
  2722. // "description": "Required. The resource name of the exclusion to update:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  2723. // "location": "path",
  2724. // "pattern": "^billingAccounts/[^/]+/exclusions/[^/]+$",
  2725. // "required": true,
  2726. // "type": "string"
  2727. // },
  2728. // "updateMask": {
  2729. // "description": "Required. A nonempty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the LogExclusion included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.For example, to change the filter and description of an exclusion, specify an update_mask of \"filter,description\".",
  2730. // "format": "google-fieldmask",
  2731. // "location": "query",
  2732. // "type": "string"
  2733. // }
  2734. // },
  2735. // "path": "v2/{+name}",
  2736. // "request": {
  2737. // "$ref": "LogExclusion"
  2738. // },
  2739. // "response": {
  2740. // "$ref": "LogExclusion"
  2741. // },
  2742. // "scopes": [
  2743. // "https://www.googleapis.com/auth/cloud-platform",
  2744. // "https://www.googleapis.com/auth/logging.admin"
  2745. // ]
  2746. // }
  2747. }
  2748. // method id "logging.billingAccounts.logs.delete":
  2749. type BillingAccountsLogsDeleteCall struct {
  2750. s *Service
  2751. logName string
  2752. urlParams_ gensupport.URLParams
  2753. ctx_ context.Context
  2754. header_ http.Header
  2755. }
  2756. // Delete: Deletes all the log entries in a log. The log reappears if it
  2757. // receives new entries. Log entries written shortly before the delete
  2758. // operation might not be deleted.
  2759. func (r *BillingAccountsLogsService) Delete(logName string) *BillingAccountsLogsDeleteCall {
  2760. c := &BillingAccountsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2761. c.logName = logName
  2762. return c
  2763. }
  2764. // Fields allows partial responses to be retrieved. See
  2765. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2766. // for more information.
  2767. func (c *BillingAccountsLogsDeleteCall) Fields(s ...googleapi.Field) *BillingAccountsLogsDeleteCall {
  2768. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2769. return c
  2770. }
  2771. // Context sets the context to be used in this call's Do method. Any
  2772. // pending HTTP request will be aborted if the provided context is
  2773. // canceled.
  2774. func (c *BillingAccountsLogsDeleteCall) Context(ctx context.Context) *BillingAccountsLogsDeleteCall {
  2775. c.ctx_ = ctx
  2776. return c
  2777. }
  2778. // Header returns an http.Header that can be modified by the caller to
  2779. // add HTTP headers to the request.
  2780. func (c *BillingAccountsLogsDeleteCall) Header() http.Header {
  2781. if c.header_ == nil {
  2782. c.header_ = make(http.Header)
  2783. }
  2784. return c.header_
  2785. }
  2786. func (c *BillingAccountsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2787. reqHeaders := make(http.Header)
  2788. for k, v := range c.header_ {
  2789. reqHeaders[k] = v
  2790. }
  2791. reqHeaders.Set("User-Agent", c.s.userAgent())
  2792. var body io.Reader = nil
  2793. c.urlParams_.Set("alt", alt)
  2794. c.urlParams_.Set("prettyPrint", "false")
  2795. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  2796. urls += "?" + c.urlParams_.Encode()
  2797. req, err := http.NewRequest("DELETE", urls, body)
  2798. if err != nil {
  2799. return nil, err
  2800. }
  2801. req.Header = reqHeaders
  2802. googleapi.Expand(req.URL, map[string]string{
  2803. "logName": c.logName,
  2804. })
  2805. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2806. }
  2807. // Do executes the "logging.billingAccounts.logs.delete" call.
  2808. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2809. // code is an error. Response headers are in either
  2810. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2811. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2812. // check whether the returned error was because http.StatusNotModified
  2813. // was returned.
  2814. func (c *BillingAccountsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2815. gensupport.SetOptions(c.urlParams_, opts...)
  2816. res, err := c.doRequest("json")
  2817. if res != nil && res.StatusCode == http.StatusNotModified {
  2818. if res.Body != nil {
  2819. res.Body.Close()
  2820. }
  2821. return nil, &googleapi.Error{
  2822. Code: res.StatusCode,
  2823. Header: res.Header,
  2824. }
  2825. }
  2826. if err != nil {
  2827. return nil, err
  2828. }
  2829. defer googleapi.CloseBody(res)
  2830. if err := googleapi.CheckResponse(res); err != nil {
  2831. return nil, err
  2832. }
  2833. ret := &Empty{
  2834. ServerResponse: googleapi.ServerResponse{
  2835. Header: res.Header,
  2836. HTTPStatusCode: res.StatusCode,
  2837. },
  2838. }
  2839. target := &ret
  2840. if err := gensupport.DecodeResponse(target, res); err != nil {
  2841. return nil, err
  2842. }
  2843. return ret, nil
  2844. // {
  2845. // "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.",
  2846. // "flatPath": "v2/billingAccounts/{billingAccountsId}/logs/{logsId}",
  2847. // "httpMethod": "DELETE",
  2848. // "id": "logging.billingAccounts.logs.delete",
  2849. // "parameterOrder": [
  2850. // "logName"
  2851. // ],
  2852. // "parameters": {
  2853. // "logName": {
  2854. // "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.",
  2855. // "location": "path",
  2856. // "pattern": "^billingAccounts/[^/]+/logs/[^/]+$",
  2857. // "required": true,
  2858. // "type": "string"
  2859. // }
  2860. // },
  2861. // "path": "v2/{+logName}",
  2862. // "response": {
  2863. // "$ref": "Empty"
  2864. // },
  2865. // "scopes": [
  2866. // "https://www.googleapis.com/auth/cloud-platform",
  2867. // "https://www.googleapis.com/auth/logging.admin"
  2868. // ]
  2869. // }
  2870. }
  2871. // method id "logging.billingAccounts.logs.list":
  2872. type BillingAccountsLogsListCall struct {
  2873. s *Service
  2874. parent string
  2875. urlParams_ gensupport.URLParams
  2876. ifNoneMatch_ string
  2877. ctx_ context.Context
  2878. header_ http.Header
  2879. }
  2880. // List: Lists the logs in projects, organizations, folders, or billing
  2881. // accounts. Only logs that have entries are listed.
  2882. func (r *BillingAccountsLogsService) List(parent string) *BillingAccountsLogsListCall {
  2883. c := &BillingAccountsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2884. c.parent = parent
  2885. return c
  2886. }
  2887. // PageSize sets the optional parameter "pageSize": The maximum number
  2888. // of results to return from this request. Non-positive values are
  2889. // ignored. The presence of nextPageToken in the response indicates that
  2890. // more results might be available.
  2891. func (c *BillingAccountsLogsListCall) PageSize(pageSize int64) *BillingAccountsLogsListCall {
  2892. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2893. return c
  2894. }
  2895. // PageToken sets the optional parameter "pageToken": If present, then
  2896. // retrieve the next batch of results from the preceding call to this
  2897. // method. pageToken must be the value of nextPageToken from the
  2898. // previous response. The values of other method parameters should be
  2899. // identical to those in the previous call.
  2900. func (c *BillingAccountsLogsListCall) PageToken(pageToken string) *BillingAccountsLogsListCall {
  2901. c.urlParams_.Set("pageToken", pageToken)
  2902. return c
  2903. }
  2904. // Fields allows partial responses to be retrieved. See
  2905. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2906. // for more information.
  2907. func (c *BillingAccountsLogsListCall) Fields(s ...googleapi.Field) *BillingAccountsLogsListCall {
  2908. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2909. return c
  2910. }
  2911. // IfNoneMatch sets the optional parameter which makes the operation
  2912. // fail if the object's ETag matches the given value. This is useful for
  2913. // getting updates only after the object has changed since the last
  2914. // request. Use googleapi.IsNotModified to check whether the response
  2915. // error from Do is the result of In-None-Match.
  2916. func (c *BillingAccountsLogsListCall) IfNoneMatch(entityTag string) *BillingAccountsLogsListCall {
  2917. c.ifNoneMatch_ = entityTag
  2918. return c
  2919. }
  2920. // Context sets the context to be used in this call's Do method. Any
  2921. // pending HTTP request will be aborted if the provided context is
  2922. // canceled.
  2923. func (c *BillingAccountsLogsListCall) Context(ctx context.Context) *BillingAccountsLogsListCall {
  2924. c.ctx_ = ctx
  2925. return c
  2926. }
  2927. // Header returns an http.Header that can be modified by the caller to
  2928. // add HTTP headers to the request.
  2929. func (c *BillingAccountsLogsListCall) Header() http.Header {
  2930. if c.header_ == nil {
  2931. c.header_ = make(http.Header)
  2932. }
  2933. return c.header_
  2934. }
  2935. func (c *BillingAccountsLogsListCall) doRequest(alt string) (*http.Response, error) {
  2936. reqHeaders := make(http.Header)
  2937. for k, v := range c.header_ {
  2938. reqHeaders[k] = v
  2939. }
  2940. reqHeaders.Set("User-Agent", c.s.userAgent())
  2941. if c.ifNoneMatch_ != "" {
  2942. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2943. }
  2944. var body io.Reader = nil
  2945. c.urlParams_.Set("alt", alt)
  2946. c.urlParams_.Set("prettyPrint", "false")
  2947. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  2948. urls += "?" + c.urlParams_.Encode()
  2949. req, err := http.NewRequest("GET", urls, body)
  2950. if err != nil {
  2951. return nil, err
  2952. }
  2953. req.Header = reqHeaders
  2954. googleapi.Expand(req.URL, map[string]string{
  2955. "parent": c.parent,
  2956. })
  2957. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2958. }
  2959. // Do executes the "logging.billingAccounts.logs.list" call.
  2960. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  2961. // non-2xx status code is an error. Response headers are in either
  2962. // *ListLogsResponse.ServerResponse.Header or (if a response was
  2963. // returned at all) in error.(*googleapi.Error).Header. Use
  2964. // googleapi.IsNotModified to check whether the returned error was
  2965. // because http.StatusNotModified was returned.
  2966. func (c *BillingAccountsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  2967. gensupport.SetOptions(c.urlParams_, opts...)
  2968. res, err := c.doRequest("json")
  2969. if res != nil && res.StatusCode == http.StatusNotModified {
  2970. if res.Body != nil {
  2971. res.Body.Close()
  2972. }
  2973. return nil, &googleapi.Error{
  2974. Code: res.StatusCode,
  2975. Header: res.Header,
  2976. }
  2977. }
  2978. if err != nil {
  2979. return nil, err
  2980. }
  2981. defer googleapi.CloseBody(res)
  2982. if err := googleapi.CheckResponse(res); err != nil {
  2983. return nil, err
  2984. }
  2985. ret := &ListLogsResponse{
  2986. ServerResponse: googleapi.ServerResponse{
  2987. Header: res.Header,
  2988. HTTPStatusCode: res.StatusCode,
  2989. },
  2990. }
  2991. target := &ret
  2992. if err := gensupport.DecodeResponse(target, res); err != nil {
  2993. return nil, err
  2994. }
  2995. return ret, nil
  2996. // {
  2997. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  2998. // "flatPath": "v2/billingAccounts/{billingAccountsId}/logs",
  2999. // "httpMethod": "GET",
  3000. // "id": "logging.billingAccounts.logs.list",
  3001. // "parameterOrder": [
  3002. // "parent"
  3003. // ],
  3004. // "parameters": {
  3005. // "pageSize": {
  3006. // "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.",
  3007. // "format": "int32",
  3008. // "location": "query",
  3009. // "type": "integer"
  3010. // },
  3011. // "pageToken": {
  3012. // "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.",
  3013. // "location": "query",
  3014. // "type": "string"
  3015. // },
  3016. // "parent": {
  3017. // "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",
  3018. // "location": "path",
  3019. // "pattern": "^billingAccounts/[^/]+$",
  3020. // "required": true,
  3021. // "type": "string"
  3022. // }
  3023. // },
  3024. // "path": "v2/{+parent}/logs",
  3025. // "response": {
  3026. // "$ref": "ListLogsResponse"
  3027. // },
  3028. // "scopes": [
  3029. // "https://www.googleapis.com/auth/cloud-platform",
  3030. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3031. // "https://www.googleapis.com/auth/logging.admin",
  3032. // "https://www.googleapis.com/auth/logging.read"
  3033. // ]
  3034. // }
  3035. }
  3036. // Pages invokes f for each page of results.
  3037. // A non-nil error returned from f will halt the iteration.
  3038. // The provided context supersedes any context provided to the Context method.
  3039. func (c *BillingAccountsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  3040. c.ctx_ = ctx
  3041. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3042. for {
  3043. x, err := c.Do()
  3044. if err != nil {
  3045. return err
  3046. }
  3047. if err := f(x); err != nil {
  3048. return err
  3049. }
  3050. if x.NextPageToken == "" {
  3051. return nil
  3052. }
  3053. c.PageToken(x.NextPageToken)
  3054. }
  3055. }
  3056. // method id "logging.billingAccounts.sinks.create":
  3057. type BillingAccountsSinksCreateCall struct {
  3058. s *Service
  3059. parent string
  3060. logsink *LogSink
  3061. urlParams_ gensupport.URLParams
  3062. ctx_ context.Context
  3063. header_ http.Header
  3064. }
  3065. // Create: Creates a sink that exports specified log entries to a
  3066. // destination. The export of newly-ingested log entries begins
  3067. // immediately, unless the sink's writer_identity is not permitted to
  3068. // write to the destination. A sink can export log entries only from the
  3069. // resource owning the sink.
  3070. func (r *BillingAccountsSinksService) Create(parent string, logsink *LogSink) *BillingAccountsSinksCreateCall {
  3071. c := &BillingAccountsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3072. c.parent = parent
  3073. c.logsink = logsink
  3074. return c
  3075. }
  3076. // UniqueWriterIdentity sets the optional parameter
  3077. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  3078. // as writer_identity in the new sink. If this value is omitted or set
  3079. // to false, and if the sink's parent is a project, then the value
  3080. // returned as writer_identity is the same group or service account used
  3081. // by Logging before the addition of writer identities to this API. The
  3082. // sink's destination must be in the same project as the sink itself.If
  3083. // this field is set to true, or if the sink is owned by a non-project
  3084. // resource such as an organization, then the value of writer_identity
  3085. // will be a unique service account used only for exports from the new
  3086. // sink. For more information, see writer_identity in LogSink.
  3087. func (c *BillingAccountsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *BillingAccountsSinksCreateCall {
  3088. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  3089. return c
  3090. }
  3091. // Fields allows partial responses to be retrieved. See
  3092. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3093. // for more information.
  3094. func (c *BillingAccountsSinksCreateCall) Fields(s ...googleapi.Field) *BillingAccountsSinksCreateCall {
  3095. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3096. return c
  3097. }
  3098. // Context sets the context to be used in this call's Do method. Any
  3099. // pending HTTP request will be aborted if the provided context is
  3100. // canceled.
  3101. func (c *BillingAccountsSinksCreateCall) Context(ctx context.Context) *BillingAccountsSinksCreateCall {
  3102. c.ctx_ = ctx
  3103. return c
  3104. }
  3105. // Header returns an http.Header that can be modified by the caller to
  3106. // add HTTP headers to the request.
  3107. func (c *BillingAccountsSinksCreateCall) Header() http.Header {
  3108. if c.header_ == nil {
  3109. c.header_ = make(http.Header)
  3110. }
  3111. return c.header_
  3112. }
  3113. func (c *BillingAccountsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  3114. reqHeaders := make(http.Header)
  3115. for k, v := range c.header_ {
  3116. reqHeaders[k] = v
  3117. }
  3118. reqHeaders.Set("User-Agent", c.s.userAgent())
  3119. var body io.Reader = nil
  3120. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3121. if err != nil {
  3122. return nil, err
  3123. }
  3124. reqHeaders.Set("Content-Type", "application/json")
  3125. c.urlParams_.Set("alt", alt)
  3126. c.urlParams_.Set("prettyPrint", "false")
  3127. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  3128. urls += "?" + c.urlParams_.Encode()
  3129. req, err := http.NewRequest("POST", urls, body)
  3130. if err != nil {
  3131. return nil, err
  3132. }
  3133. req.Header = reqHeaders
  3134. googleapi.Expand(req.URL, map[string]string{
  3135. "parent": c.parent,
  3136. })
  3137. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3138. }
  3139. // Do executes the "logging.billingAccounts.sinks.create" call.
  3140. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3141. // code is an error. Response headers are in either
  3142. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3143. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3144. // check whether the returned error was because http.StatusNotModified
  3145. // was returned.
  3146. func (c *BillingAccountsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3147. gensupport.SetOptions(c.urlParams_, opts...)
  3148. res, err := c.doRequest("json")
  3149. if res != nil && res.StatusCode == http.StatusNotModified {
  3150. if res.Body != nil {
  3151. res.Body.Close()
  3152. }
  3153. return nil, &googleapi.Error{
  3154. Code: res.StatusCode,
  3155. Header: res.Header,
  3156. }
  3157. }
  3158. if err != nil {
  3159. return nil, err
  3160. }
  3161. defer googleapi.CloseBody(res)
  3162. if err := googleapi.CheckResponse(res); err != nil {
  3163. return nil, err
  3164. }
  3165. ret := &LogSink{
  3166. ServerResponse: googleapi.ServerResponse{
  3167. Header: res.Header,
  3168. HTTPStatusCode: res.StatusCode,
  3169. },
  3170. }
  3171. target := &ret
  3172. if err := gensupport.DecodeResponse(target, res); err != nil {
  3173. return nil, err
  3174. }
  3175. return ret, nil
  3176. // {
  3177. // "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.",
  3178. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks",
  3179. // "httpMethod": "POST",
  3180. // "id": "logging.billingAccounts.sinks.create",
  3181. // "parameterOrder": [
  3182. // "parent"
  3183. // ],
  3184. // "parameters": {
  3185. // "parent": {
  3186. // "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\".",
  3187. // "location": "path",
  3188. // "pattern": "^billingAccounts/[^/]+$",
  3189. // "required": true,
  3190. // "type": "string"
  3191. // },
  3192. // "uniqueWriterIdentity": {
  3193. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  3194. // "location": "query",
  3195. // "type": "boolean"
  3196. // }
  3197. // },
  3198. // "path": "v2/{+parent}/sinks",
  3199. // "request": {
  3200. // "$ref": "LogSink"
  3201. // },
  3202. // "response": {
  3203. // "$ref": "LogSink"
  3204. // },
  3205. // "scopes": [
  3206. // "https://www.googleapis.com/auth/cloud-platform",
  3207. // "https://www.googleapis.com/auth/logging.admin"
  3208. // ]
  3209. // }
  3210. }
  3211. // method id "logging.billingAccounts.sinks.delete":
  3212. type BillingAccountsSinksDeleteCall struct {
  3213. s *Service
  3214. sinkNameid string
  3215. urlParams_ gensupport.URLParams
  3216. ctx_ context.Context
  3217. header_ http.Header
  3218. }
  3219. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  3220. // then that service account is also deleted.
  3221. func (r *BillingAccountsSinksService) Delete(sinkNameid string) *BillingAccountsSinksDeleteCall {
  3222. c := &BillingAccountsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3223. c.sinkNameid = sinkNameid
  3224. return c
  3225. }
  3226. // Fields allows partial responses to be retrieved. See
  3227. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3228. // for more information.
  3229. func (c *BillingAccountsSinksDeleteCall) Fields(s ...googleapi.Field) *BillingAccountsSinksDeleteCall {
  3230. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3231. return c
  3232. }
  3233. // Context sets the context to be used in this call's Do method. Any
  3234. // pending HTTP request will be aborted if the provided context is
  3235. // canceled.
  3236. func (c *BillingAccountsSinksDeleteCall) Context(ctx context.Context) *BillingAccountsSinksDeleteCall {
  3237. c.ctx_ = ctx
  3238. return c
  3239. }
  3240. // Header returns an http.Header that can be modified by the caller to
  3241. // add HTTP headers to the request.
  3242. func (c *BillingAccountsSinksDeleteCall) Header() http.Header {
  3243. if c.header_ == nil {
  3244. c.header_ = make(http.Header)
  3245. }
  3246. return c.header_
  3247. }
  3248. func (c *BillingAccountsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  3249. reqHeaders := make(http.Header)
  3250. for k, v := range c.header_ {
  3251. reqHeaders[k] = v
  3252. }
  3253. reqHeaders.Set("User-Agent", c.s.userAgent())
  3254. var body io.Reader = nil
  3255. c.urlParams_.Set("alt", alt)
  3256. c.urlParams_.Set("prettyPrint", "false")
  3257. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3258. urls += "?" + c.urlParams_.Encode()
  3259. req, err := http.NewRequest("DELETE", urls, body)
  3260. if err != nil {
  3261. return nil, err
  3262. }
  3263. req.Header = reqHeaders
  3264. googleapi.Expand(req.URL, map[string]string{
  3265. "sinkName": c.sinkNameid,
  3266. })
  3267. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3268. }
  3269. // Do executes the "logging.billingAccounts.sinks.delete" call.
  3270. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3271. // code is an error. Response headers are in either
  3272. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3273. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3274. // check whether the returned error was because http.StatusNotModified
  3275. // was returned.
  3276. func (c *BillingAccountsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3277. gensupport.SetOptions(c.urlParams_, opts...)
  3278. res, err := c.doRequest("json")
  3279. if res != nil && res.StatusCode == http.StatusNotModified {
  3280. if res.Body != nil {
  3281. res.Body.Close()
  3282. }
  3283. return nil, &googleapi.Error{
  3284. Code: res.StatusCode,
  3285. Header: res.Header,
  3286. }
  3287. }
  3288. if err != nil {
  3289. return nil, err
  3290. }
  3291. defer googleapi.CloseBody(res)
  3292. if err := googleapi.CheckResponse(res); err != nil {
  3293. return nil, err
  3294. }
  3295. ret := &Empty{
  3296. ServerResponse: googleapi.ServerResponse{
  3297. Header: res.Header,
  3298. HTTPStatusCode: res.StatusCode,
  3299. },
  3300. }
  3301. target := &ret
  3302. if err := gensupport.DecodeResponse(target, res); err != nil {
  3303. return nil, err
  3304. }
  3305. return ret, nil
  3306. // {
  3307. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  3308. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3309. // "httpMethod": "DELETE",
  3310. // "id": "logging.billingAccounts.sinks.delete",
  3311. // "parameterOrder": [
  3312. // "sinkName"
  3313. // ],
  3314. // "parameters": {
  3315. // "sinkName": {
  3316. // "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\".",
  3317. // "location": "path",
  3318. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3319. // "required": true,
  3320. // "type": "string"
  3321. // }
  3322. // },
  3323. // "path": "v2/{+sinkName}",
  3324. // "response": {
  3325. // "$ref": "Empty"
  3326. // },
  3327. // "scopes": [
  3328. // "https://www.googleapis.com/auth/cloud-platform",
  3329. // "https://www.googleapis.com/auth/logging.admin"
  3330. // ]
  3331. // }
  3332. }
  3333. // method id "logging.billingAccounts.sinks.get":
  3334. type BillingAccountsSinksGetCall struct {
  3335. s *Service
  3336. sinkName string
  3337. urlParams_ gensupport.URLParams
  3338. ifNoneMatch_ string
  3339. ctx_ context.Context
  3340. header_ http.Header
  3341. }
  3342. // Get: Gets a sink.
  3343. func (r *BillingAccountsSinksService) Get(sinkName string) *BillingAccountsSinksGetCall {
  3344. c := &BillingAccountsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3345. c.sinkName = sinkName
  3346. return c
  3347. }
  3348. // Fields allows partial responses to be retrieved. See
  3349. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3350. // for more information.
  3351. func (c *BillingAccountsSinksGetCall) Fields(s ...googleapi.Field) *BillingAccountsSinksGetCall {
  3352. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3353. return c
  3354. }
  3355. // IfNoneMatch sets the optional parameter which makes the operation
  3356. // fail if the object's ETag matches the given value. This is useful for
  3357. // getting updates only after the object has changed since the last
  3358. // request. Use googleapi.IsNotModified to check whether the response
  3359. // error from Do is the result of In-None-Match.
  3360. func (c *BillingAccountsSinksGetCall) IfNoneMatch(entityTag string) *BillingAccountsSinksGetCall {
  3361. c.ifNoneMatch_ = entityTag
  3362. return c
  3363. }
  3364. // Context sets the context to be used in this call's Do method. Any
  3365. // pending HTTP request will be aborted if the provided context is
  3366. // canceled.
  3367. func (c *BillingAccountsSinksGetCall) Context(ctx context.Context) *BillingAccountsSinksGetCall {
  3368. c.ctx_ = ctx
  3369. return c
  3370. }
  3371. // Header returns an http.Header that can be modified by the caller to
  3372. // add HTTP headers to the request.
  3373. func (c *BillingAccountsSinksGetCall) Header() http.Header {
  3374. if c.header_ == nil {
  3375. c.header_ = make(http.Header)
  3376. }
  3377. return c.header_
  3378. }
  3379. func (c *BillingAccountsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  3380. reqHeaders := make(http.Header)
  3381. for k, v := range c.header_ {
  3382. reqHeaders[k] = v
  3383. }
  3384. reqHeaders.Set("User-Agent", c.s.userAgent())
  3385. if c.ifNoneMatch_ != "" {
  3386. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3387. }
  3388. var body io.Reader = nil
  3389. c.urlParams_.Set("alt", alt)
  3390. c.urlParams_.Set("prettyPrint", "false")
  3391. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3392. urls += "?" + c.urlParams_.Encode()
  3393. req, err := http.NewRequest("GET", urls, body)
  3394. if err != nil {
  3395. return nil, err
  3396. }
  3397. req.Header = reqHeaders
  3398. googleapi.Expand(req.URL, map[string]string{
  3399. "sinkName": c.sinkName,
  3400. })
  3401. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3402. }
  3403. // Do executes the "logging.billingAccounts.sinks.get" call.
  3404. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3405. // code is an error. Response headers are in either
  3406. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3407. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3408. // check whether the returned error was because http.StatusNotModified
  3409. // was returned.
  3410. func (c *BillingAccountsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3411. gensupport.SetOptions(c.urlParams_, opts...)
  3412. res, err := c.doRequest("json")
  3413. if res != nil && res.StatusCode == http.StatusNotModified {
  3414. if res.Body != nil {
  3415. res.Body.Close()
  3416. }
  3417. return nil, &googleapi.Error{
  3418. Code: res.StatusCode,
  3419. Header: res.Header,
  3420. }
  3421. }
  3422. if err != nil {
  3423. return nil, err
  3424. }
  3425. defer googleapi.CloseBody(res)
  3426. if err := googleapi.CheckResponse(res); err != nil {
  3427. return nil, err
  3428. }
  3429. ret := &LogSink{
  3430. ServerResponse: googleapi.ServerResponse{
  3431. Header: res.Header,
  3432. HTTPStatusCode: res.StatusCode,
  3433. },
  3434. }
  3435. target := &ret
  3436. if err := gensupport.DecodeResponse(target, res); err != nil {
  3437. return nil, err
  3438. }
  3439. return ret, nil
  3440. // {
  3441. // "description": "Gets a sink.",
  3442. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3443. // "httpMethod": "GET",
  3444. // "id": "logging.billingAccounts.sinks.get",
  3445. // "parameterOrder": [
  3446. // "sinkName"
  3447. // ],
  3448. // "parameters": {
  3449. // "sinkName": {
  3450. // "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\".",
  3451. // "location": "path",
  3452. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3453. // "required": true,
  3454. // "type": "string"
  3455. // }
  3456. // },
  3457. // "path": "v2/{+sinkName}",
  3458. // "response": {
  3459. // "$ref": "LogSink"
  3460. // },
  3461. // "scopes": [
  3462. // "https://www.googleapis.com/auth/cloud-platform",
  3463. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3464. // "https://www.googleapis.com/auth/logging.admin",
  3465. // "https://www.googleapis.com/auth/logging.read"
  3466. // ]
  3467. // }
  3468. }
  3469. // method id "logging.billingAccounts.sinks.list":
  3470. type BillingAccountsSinksListCall struct {
  3471. s *Service
  3472. parent string
  3473. urlParams_ gensupport.URLParams
  3474. ifNoneMatch_ string
  3475. ctx_ context.Context
  3476. header_ http.Header
  3477. }
  3478. // List: Lists sinks.
  3479. func (r *BillingAccountsSinksService) List(parent string) *BillingAccountsSinksListCall {
  3480. c := &BillingAccountsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3481. c.parent = parent
  3482. return c
  3483. }
  3484. // PageSize sets the optional parameter "pageSize": The maximum number
  3485. // of results to return from this request. Non-positive values are
  3486. // ignored. The presence of nextPageToken in the response indicates that
  3487. // more results might be available.
  3488. func (c *BillingAccountsSinksListCall) PageSize(pageSize int64) *BillingAccountsSinksListCall {
  3489. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3490. return c
  3491. }
  3492. // PageToken sets the optional parameter "pageToken": If present, then
  3493. // retrieve the next batch of results from the preceding call to this
  3494. // method. pageToken must be the value of nextPageToken from the
  3495. // previous response. The values of other method parameters should be
  3496. // identical to those in the previous call.
  3497. func (c *BillingAccountsSinksListCall) PageToken(pageToken string) *BillingAccountsSinksListCall {
  3498. c.urlParams_.Set("pageToken", pageToken)
  3499. return c
  3500. }
  3501. // Fields allows partial responses to be retrieved. See
  3502. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3503. // for more information.
  3504. func (c *BillingAccountsSinksListCall) Fields(s ...googleapi.Field) *BillingAccountsSinksListCall {
  3505. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3506. return c
  3507. }
  3508. // IfNoneMatch sets the optional parameter which makes the operation
  3509. // fail if the object's ETag matches the given value. This is useful for
  3510. // getting updates only after the object has changed since the last
  3511. // request. Use googleapi.IsNotModified to check whether the response
  3512. // error from Do is the result of In-None-Match.
  3513. func (c *BillingAccountsSinksListCall) IfNoneMatch(entityTag string) *BillingAccountsSinksListCall {
  3514. c.ifNoneMatch_ = entityTag
  3515. return c
  3516. }
  3517. // Context sets the context to be used in this call's Do method. Any
  3518. // pending HTTP request will be aborted if the provided context is
  3519. // canceled.
  3520. func (c *BillingAccountsSinksListCall) Context(ctx context.Context) *BillingAccountsSinksListCall {
  3521. c.ctx_ = ctx
  3522. return c
  3523. }
  3524. // Header returns an http.Header that can be modified by the caller to
  3525. // add HTTP headers to the request.
  3526. func (c *BillingAccountsSinksListCall) Header() http.Header {
  3527. if c.header_ == nil {
  3528. c.header_ = make(http.Header)
  3529. }
  3530. return c.header_
  3531. }
  3532. func (c *BillingAccountsSinksListCall) doRequest(alt string) (*http.Response, error) {
  3533. reqHeaders := make(http.Header)
  3534. for k, v := range c.header_ {
  3535. reqHeaders[k] = v
  3536. }
  3537. reqHeaders.Set("User-Agent", c.s.userAgent())
  3538. if c.ifNoneMatch_ != "" {
  3539. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3540. }
  3541. var body io.Reader = nil
  3542. c.urlParams_.Set("alt", alt)
  3543. c.urlParams_.Set("prettyPrint", "false")
  3544. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  3545. urls += "?" + c.urlParams_.Encode()
  3546. req, err := http.NewRequest("GET", urls, body)
  3547. if err != nil {
  3548. return nil, err
  3549. }
  3550. req.Header = reqHeaders
  3551. googleapi.Expand(req.URL, map[string]string{
  3552. "parent": c.parent,
  3553. })
  3554. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3555. }
  3556. // Do executes the "logging.billingAccounts.sinks.list" call.
  3557. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  3558. // non-2xx status code is an error. Response headers are in either
  3559. // *ListSinksResponse.ServerResponse.Header or (if a response was
  3560. // returned at all) in error.(*googleapi.Error).Header. Use
  3561. // googleapi.IsNotModified to check whether the returned error was
  3562. // because http.StatusNotModified was returned.
  3563. func (c *BillingAccountsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  3564. gensupport.SetOptions(c.urlParams_, opts...)
  3565. res, err := c.doRequest("json")
  3566. if res != nil && res.StatusCode == http.StatusNotModified {
  3567. if res.Body != nil {
  3568. res.Body.Close()
  3569. }
  3570. return nil, &googleapi.Error{
  3571. Code: res.StatusCode,
  3572. Header: res.Header,
  3573. }
  3574. }
  3575. if err != nil {
  3576. return nil, err
  3577. }
  3578. defer googleapi.CloseBody(res)
  3579. if err := googleapi.CheckResponse(res); err != nil {
  3580. return nil, err
  3581. }
  3582. ret := &ListSinksResponse{
  3583. ServerResponse: googleapi.ServerResponse{
  3584. Header: res.Header,
  3585. HTTPStatusCode: res.StatusCode,
  3586. },
  3587. }
  3588. target := &ret
  3589. if err := gensupport.DecodeResponse(target, res); err != nil {
  3590. return nil, err
  3591. }
  3592. return ret, nil
  3593. // {
  3594. // "description": "Lists sinks.",
  3595. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks",
  3596. // "httpMethod": "GET",
  3597. // "id": "logging.billingAccounts.sinks.list",
  3598. // "parameterOrder": [
  3599. // "parent"
  3600. // ],
  3601. // "parameters": {
  3602. // "pageSize": {
  3603. // "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.",
  3604. // "format": "int32",
  3605. // "location": "query",
  3606. // "type": "integer"
  3607. // },
  3608. // "pageToken": {
  3609. // "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.",
  3610. // "location": "query",
  3611. // "type": "string"
  3612. // },
  3613. // "parent": {
  3614. // "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",
  3615. // "location": "path",
  3616. // "pattern": "^billingAccounts/[^/]+$",
  3617. // "required": true,
  3618. // "type": "string"
  3619. // }
  3620. // },
  3621. // "path": "v2/{+parent}/sinks",
  3622. // "response": {
  3623. // "$ref": "ListSinksResponse"
  3624. // },
  3625. // "scopes": [
  3626. // "https://www.googleapis.com/auth/cloud-platform",
  3627. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3628. // "https://www.googleapis.com/auth/logging.admin",
  3629. // "https://www.googleapis.com/auth/logging.read"
  3630. // ]
  3631. // }
  3632. }
  3633. // Pages invokes f for each page of results.
  3634. // A non-nil error returned from f will halt the iteration.
  3635. // The provided context supersedes any context provided to the Context method.
  3636. func (c *BillingAccountsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  3637. c.ctx_ = ctx
  3638. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3639. for {
  3640. x, err := c.Do()
  3641. if err != nil {
  3642. return err
  3643. }
  3644. if err := f(x); err != nil {
  3645. return err
  3646. }
  3647. if x.NextPageToken == "" {
  3648. return nil
  3649. }
  3650. c.PageToken(x.NextPageToken)
  3651. }
  3652. }
  3653. // method id "logging.billingAccounts.sinks.patch":
  3654. type BillingAccountsSinksPatchCall struct {
  3655. s *Service
  3656. sinkNameid string
  3657. logsink *LogSink
  3658. urlParams_ gensupport.URLParams
  3659. ctx_ context.Context
  3660. header_ http.Header
  3661. }
  3662. // Patch: Updates a sink. This method replaces the following fields in
  3663. // the existing sink with values from the new sink: destination, and
  3664. // filter.The updated sink might also have a new writer_identity; see
  3665. // the unique_writer_identity field.
  3666. func (r *BillingAccountsSinksService) Patch(sinkNameid string, logsink *LogSink) *BillingAccountsSinksPatchCall {
  3667. c := &BillingAccountsSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3668. c.sinkNameid = sinkNameid
  3669. c.logsink = logsink
  3670. return c
  3671. }
  3672. // UniqueWriterIdentity sets the optional parameter
  3673. // "uniqueWriterIdentity": See sinks.create for a description of this
  3674. // field. When updating a sink, the effect of this field on the value of
  3675. // writer_identity in the updated sink depends on both the old and new
  3676. // values of this field:
  3677. // If the old and new values of this field are both false or both true,
  3678. // then there is no change to the sink's writer_identity.
  3679. // If the old value is false and the new value is true, then
  3680. // writer_identity is changed to a unique service account.
  3681. // It is an error if the old value is true and the new value is set to
  3682. // false or defaulted to false.
  3683. func (c *BillingAccountsSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *BillingAccountsSinksPatchCall {
  3684. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  3685. return c
  3686. }
  3687. // UpdateMask sets the optional parameter "updateMask": Field mask that
  3688. // specifies the fields in sink that need an update. A sink field will
  3689. // be overwritten if, and only if, it is in the update mask. name and
  3690. // output only fields cannot be updated.An empty updateMask is
  3691. // temporarily treated as using the following mask for backwards
  3692. // compatibility purposes: destination,filter,includeChildren At some
  3693. // point in the future, behavior will be removed and specifying an empty
  3694. // updateMask will be an error.For a detailed FieldMask definition, see
  3695. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  3696. // updateMask=filter.
  3697. func (c *BillingAccountsSinksPatchCall) UpdateMask(updateMask string) *BillingAccountsSinksPatchCall {
  3698. c.urlParams_.Set("updateMask", updateMask)
  3699. return c
  3700. }
  3701. // Fields allows partial responses to be retrieved. See
  3702. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3703. // for more information.
  3704. func (c *BillingAccountsSinksPatchCall) Fields(s ...googleapi.Field) *BillingAccountsSinksPatchCall {
  3705. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3706. return c
  3707. }
  3708. // Context sets the context to be used in this call's Do method. Any
  3709. // pending HTTP request will be aborted if the provided context is
  3710. // canceled.
  3711. func (c *BillingAccountsSinksPatchCall) Context(ctx context.Context) *BillingAccountsSinksPatchCall {
  3712. c.ctx_ = ctx
  3713. return c
  3714. }
  3715. // Header returns an http.Header that can be modified by the caller to
  3716. // add HTTP headers to the request.
  3717. func (c *BillingAccountsSinksPatchCall) Header() http.Header {
  3718. if c.header_ == nil {
  3719. c.header_ = make(http.Header)
  3720. }
  3721. return c.header_
  3722. }
  3723. func (c *BillingAccountsSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  3724. reqHeaders := make(http.Header)
  3725. for k, v := range c.header_ {
  3726. reqHeaders[k] = v
  3727. }
  3728. reqHeaders.Set("User-Agent", c.s.userAgent())
  3729. var body io.Reader = nil
  3730. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3731. if err != nil {
  3732. return nil, err
  3733. }
  3734. reqHeaders.Set("Content-Type", "application/json")
  3735. c.urlParams_.Set("alt", alt)
  3736. c.urlParams_.Set("prettyPrint", "false")
  3737. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3738. urls += "?" + c.urlParams_.Encode()
  3739. req, err := http.NewRequest("PATCH", urls, body)
  3740. if err != nil {
  3741. return nil, err
  3742. }
  3743. req.Header = reqHeaders
  3744. googleapi.Expand(req.URL, map[string]string{
  3745. "sinkName": c.sinkNameid,
  3746. })
  3747. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3748. }
  3749. // Do executes the "logging.billingAccounts.sinks.patch" call.
  3750. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3751. // code is an error. Response headers are in either
  3752. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3753. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3754. // check whether the returned error was because http.StatusNotModified
  3755. // was returned.
  3756. func (c *BillingAccountsSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3757. gensupport.SetOptions(c.urlParams_, opts...)
  3758. res, err := c.doRequest("json")
  3759. if res != nil && res.StatusCode == http.StatusNotModified {
  3760. if res.Body != nil {
  3761. res.Body.Close()
  3762. }
  3763. return nil, &googleapi.Error{
  3764. Code: res.StatusCode,
  3765. Header: res.Header,
  3766. }
  3767. }
  3768. if err != nil {
  3769. return nil, err
  3770. }
  3771. defer googleapi.CloseBody(res)
  3772. if err := googleapi.CheckResponse(res); err != nil {
  3773. return nil, err
  3774. }
  3775. ret := &LogSink{
  3776. ServerResponse: googleapi.ServerResponse{
  3777. Header: res.Header,
  3778. HTTPStatusCode: res.StatusCode,
  3779. },
  3780. }
  3781. target := &ret
  3782. if err := gensupport.DecodeResponse(target, res); err != nil {
  3783. return nil, err
  3784. }
  3785. return ret, nil
  3786. // {
  3787. // "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.",
  3788. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3789. // "httpMethod": "PATCH",
  3790. // "id": "logging.billingAccounts.sinks.patch",
  3791. // "parameterOrder": [
  3792. // "sinkName"
  3793. // ],
  3794. // "parameters": {
  3795. // "sinkName": {
  3796. // "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\".",
  3797. // "location": "path",
  3798. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3799. // "required": true,
  3800. // "type": "string"
  3801. // },
  3802. // "uniqueWriterIdentity": {
  3803. // "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.",
  3804. // "location": "query",
  3805. // "type": "boolean"
  3806. // },
  3807. // "updateMask": {
  3808. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  3809. // "format": "google-fieldmask",
  3810. // "location": "query",
  3811. // "type": "string"
  3812. // }
  3813. // },
  3814. // "path": "v2/{+sinkName}",
  3815. // "request": {
  3816. // "$ref": "LogSink"
  3817. // },
  3818. // "response": {
  3819. // "$ref": "LogSink"
  3820. // },
  3821. // "scopes": [
  3822. // "https://www.googleapis.com/auth/cloud-platform",
  3823. // "https://www.googleapis.com/auth/logging.admin"
  3824. // ]
  3825. // }
  3826. }
  3827. // method id "logging.billingAccounts.sinks.update":
  3828. type BillingAccountsSinksUpdateCall struct {
  3829. s *Service
  3830. sinkNameid string
  3831. logsink *LogSink
  3832. urlParams_ gensupport.URLParams
  3833. ctx_ context.Context
  3834. header_ http.Header
  3835. }
  3836. // Update: Updates a sink. This method replaces the following fields in
  3837. // the existing sink with values from the new sink: destination, and
  3838. // filter.The updated sink might also have a new writer_identity; see
  3839. // the unique_writer_identity field.
  3840. func (r *BillingAccountsSinksService) Update(sinkNameid string, logsink *LogSink) *BillingAccountsSinksUpdateCall {
  3841. c := &BillingAccountsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3842. c.sinkNameid = sinkNameid
  3843. c.logsink = logsink
  3844. return c
  3845. }
  3846. // UniqueWriterIdentity sets the optional parameter
  3847. // "uniqueWriterIdentity": See sinks.create for a description of this
  3848. // field. When updating a sink, the effect of this field on the value of
  3849. // writer_identity in the updated sink depends on both the old and new
  3850. // values of this field:
  3851. // If the old and new values of this field are both false or both true,
  3852. // then there is no change to the sink's writer_identity.
  3853. // If the old value is false and the new value is true, then
  3854. // writer_identity is changed to a unique service account.
  3855. // It is an error if the old value is true and the new value is set to
  3856. // false or defaulted to false.
  3857. func (c *BillingAccountsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *BillingAccountsSinksUpdateCall {
  3858. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  3859. return c
  3860. }
  3861. // UpdateMask sets the optional parameter "updateMask": Field mask that
  3862. // specifies the fields in sink that need an update. A sink field will
  3863. // be overwritten if, and only if, it is in the update mask. name and
  3864. // output only fields cannot be updated.An empty updateMask is
  3865. // temporarily treated as using the following mask for backwards
  3866. // compatibility purposes: destination,filter,includeChildren At some
  3867. // point in the future, behavior will be removed and specifying an empty
  3868. // updateMask will be an error.For a detailed FieldMask definition, see
  3869. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  3870. // updateMask=filter.
  3871. func (c *BillingAccountsSinksUpdateCall) UpdateMask(updateMask string) *BillingAccountsSinksUpdateCall {
  3872. c.urlParams_.Set("updateMask", updateMask)
  3873. return c
  3874. }
  3875. // Fields allows partial responses to be retrieved. See
  3876. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3877. // for more information.
  3878. func (c *BillingAccountsSinksUpdateCall) Fields(s ...googleapi.Field) *BillingAccountsSinksUpdateCall {
  3879. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3880. return c
  3881. }
  3882. // Context sets the context to be used in this call's Do method. Any
  3883. // pending HTTP request will be aborted if the provided context is
  3884. // canceled.
  3885. func (c *BillingAccountsSinksUpdateCall) Context(ctx context.Context) *BillingAccountsSinksUpdateCall {
  3886. c.ctx_ = ctx
  3887. return c
  3888. }
  3889. // Header returns an http.Header that can be modified by the caller to
  3890. // add HTTP headers to the request.
  3891. func (c *BillingAccountsSinksUpdateCall) Header() http.Header {
  3892. if c.header_ == nil {
  3893. c.header_ = make(http.Header)
  3894. }
  3895. return c.header_
  3896. }
  3897. func (c *BillingAccountsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  3898. reqHeaders := make(http.Header)
  3899. for k, v := range c.header_ {
  3900. reqHeaders[k] = v
  3901. }
  3902. reqHeaders.Set("User-Agent", c.s.userAgent())
  3903. var body io.Reader = nil
  3904. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3905. if err != nil {
  3906. return nil, err
  3907. }
  3908. reqHeaders.Set("Content-Type", "application/json")
  3909. c.urlParams_.Set("alt", alt)
  3910. c.urlParams_.Set("prettyPrint", "false")
  3911. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3912. urls += "?" + c.urlParams_.Encode()
  3913. req, err := http.NewRequest("PUT", urls, body)
  3914. if err != nil {
  3915. return nil, err
  3916. }
  3917. req.Header = reqHeaders
  3918. googleapi.Expand(req.URL, map[string]string{
  3919. "sinkName": c.sinkNameid,
  3920. })
  3921. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3922. }
  3923. // Do executes the "logging.billingAccounts.sinks.update" call.
  3924. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3925. // code is an error. Response headers are in either
  3926. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3927. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3928. // check whether the returned error was because http.StatusNotModified
  3929. // was returned.
  3930. func (c *BillingAccountsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3931. gensupport.SetOptions(c.urlParams_, opts...)
  3932. res, err := c.doRequest("json")
  3933. if res != nil && res.StatusCode == http.StatusNotModified {
  3934. if res.Body != nil {
  3935. res.Body.Close()
  3936. }
  3937. return nil, &googleapi.Error{
  3938. Code: res.StatusCode,
  3939. Header: res.Header,
  3940. }
  3941. }
  3942. if err != nil {
  3943. return nil, err
  3944. }
  3945. defer googleapi.CloseBody(res)
  3946. if err := googleapi.CheckResponse(res); err != nil {
  3947. return nil, err
  3948. }
  3949. ret := &LogSink{
  3950. ServerResponse: googleapi.ServerResponse{
  3951. Header: res.Header,
  3952. HTTPStatusCode: res.StatusCode,
  3953. },
  3954. }
  3955. target := &ret
  3956. if err := gensupport.DecodeResponse(target, res); err != nil {
  3957. return nil, err
  3958. }
  3959. return ret, nil
  3960. // {
  3961. // "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.",
  3962. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3963. // "httpMethod": "PUT",
  3964. // "id": "logging.billingAccounts.sinks.update",
  3965. // "parameterOrder": [
  3966. // "sinkName"
  3967. // ],
  3968. // "parameters": {
  3969. // "sinkName": {
  3970. // "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\".",
  3971. // "location": "path",
  3972. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3973. // "required": true,
  3974. // "type": "string"
  3975. // },
  3976. // "uniqueWriterIdentity": {
  3977. // "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.",
  3978. // "location": "query",
  3979. // "type": "boolean"
  3980. // },
  3981. // "updateMask": {
  3982. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  3983. // "format": "google-fieldmask",
  3984. // "location": "query",
  3985. // "type": "string"
  3986. // }
  3987. // },
  3988. // "path": "v2/{+sinkName}",
  3989. // "request": {
  3990. // "$ref": "LogSink"
  3991. // },
  3992. // "response": {
  3993. // "$ref": "LogSink"
  3994. // },
  3995. // "scopes": [
  3996. // "https://www.googleapis.com/auth/cloud-platform",
  3997. // "https://www.googleapis.com/auth/logging.admin"
  3998. // ]
  3999. // }
  4000. }
  4001. // method id "logging.entries.list":
  4002. type EntriesListCall struct {
  4003. s *Service
  4004. listlogentriesrequest *ListLogEntriesRequest
  4005. urlParams_ gensupport.URLParams
  4006. ctx_ context.Context
  4007. header_ http.Header
  4008. }
  4009. // List: Lists log entries. Use this method to retrieve log entries that
  4010. // originated from a project/folder/organization/billing account. For
  4011. // ways to export log entries, see Exporting Logs.
  4012. func (r *EntriesService) List(listlogentriesrequest *ListLogEntriesRequest) *EntriesListCall {
  4013. c := &EntriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4014. c.listlogentriesrequest = listlogentriesrequest
  4015. return c
  4016. }
  4017. // Fields allows partial responses to be retrieved. See
  4018. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4019. // for more information.
  4020. func (c *EntriesListCall) Fields(s ...googleapi.Field) *EntriesListCall {
  4021. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4022. return c
  4023. }
  4024. // Context sets the context to be used in this call's Do method. Any
  4025. // pending HTTP request will be aborted if the provided context is
  4026. // canceled.
  4027. func (c *EntriesListCall) Context(ctx context.Context) *EntriesListCall {
  4028. c.ctx_ = ctx
  4029. return c
  4030. }
  4031. // Header returns an http.Header that can be modified by the caller to
  4032. // add HTTP headers to the request.
  4033. func (c *EntriesListCall) Header() http.Header {
  4034. if c.header_ == nil {
  4035. c.header_ = make(http.Header)
  4036. }
  4037. return c.header_
  4038. }
  4039. func (c *EntriesListCall) doRequest(alt string) (*http.Response, error) {
  4040. reqHeaders := make(http.Header)
  4041. for k, v := range c.header_ {
  4042. reqHeaders[k] = v
  4043. }
  4044. reqHeaders.Set("User-Agent", c.s.userAgent())
  4045. var body io.Reader = nil
  4046. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listlogentriesrequest)
  4047. if err != nil {
  4048. return nil, err
  4049. }
  4050. reqHeaders.Set("Content-Type", "application/json")
  4051. c.urlParams_.Set("alt", alt)
  4052. c.urlParams_.Set("prettyPrint", "false")
  4053. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/entries:list")
  4054. urls += "?" + c.urlParams_.Encode()
  4055. req, err := http.NewRequest("POST", urls, body)
  4056. if err != nil {
  4057. return nil, err
  4058. }
  4059. req.Header = reqHeaders
  4060. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4061. }
  4062. // Do executes the "logging.entries.list" call.
  4063. // Exactly one of *ListLogEntriesResponse or error will be non-nil. Any
  4064. // non-2xx status code is an error. Response headers are in either
  4065. // *ListLogEntriesResponse.ServerResponse.Header or (if a response was
  4066. // returned at all) in error.(*googleapi.Error).Header. Use
  4067. // googleapi.IsNotModified to check whether the returned error was
  4068. // because http.StatusNotModified was returned.
  4069. func (c *EntriesListCall) Do(opts ...googleapi.CallOption) (*ListLogEntriesResponse, error) {
  4070. gensupport.SetOptions(c.urlParams_, opts...)
  4071. res, err := c.doRequest("json")
  4072. if res != nil && res.StatusCode == http.StatusNotModified {
  4073. if res.Body != nil {
  4074. res.Body.Close()
  4075. }
  4076. return nil, &googleapi.Error{
  4077. Code: res.StatusCode,
  4078. Header: res.Header,
  4079. }
  4080. }
  4081. if err != nil {
  4082. return nil, err
  4083. }
  4084. defer googleapi.CloseBody(res)
  4085. if err := googleapi.CheckResponse(res); err != nil {
  4086. return nil, err
  4087. }
  4088. ret := &ListLogEntriesResponse{
  4089. ServerResponse: googleapi.ServerResponse{
  4090. Header: res.Header,
  4091. HTTPStatusCode: res.StatusCode,
  4092. },
  4093. }
  4094. target := &ret
  4095. if err := gensupport.DecodeResponse(target, res); err != nil {
  4096. return nil, err
  4097. }
  4098. return ret, nil
  4099. // {
  4100. // "description": "Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.",
  4101. // "flatPath": "v2/entries:list",
  4102. // "httpMethod": "POST",
  4103. // "id": "logging.entries.list",
  4104. // "parameterOrder": [],
  4105. // "parameters": {},
  4106. // "path": "v2/entries:list",
  4107. // "request": {
  4108. // "$ref": "ListLogEntriesRequest"
  4109. // },
  4110. // "response": {
  4111. // "$ref": "ListLogEntriesResponse"
  4112. // },
  4113. // "scopes": [
  4114. // "https://www.googleapis.com/auth/cloud-platform",
  4115. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4116. // "https://www.googleapis.com/auth/logging.admin",
  4117. // "https://www.googleapis.com/auth/logging.read"
  4118. // ]
  4119. // }
  4120. }
  4121. // Pages invokes f for each page of results.
  4122. // A non-nil error returned from f will halt the iteration.
  4123. // The provided context supersedes any context provided to the Context method.
  4124. func (c *EntriesListCall) Pages(ctx context.Context, f func(*ListLogEntriesResponse) error) error {
  4125. c.ctx_ = ctx
  4126. defer func(pt string) { c.listlogentriesrequest.PageToken = pt }(c.listlogentriesrequest.PageToken) // reset paging to original point
  4127. for {
  4128. x, err := c.Do()
  4129. if err != nil {
  4130. return err
  4131. }
  4132. if err := f(x); err != nil {
  4133. return err
  4134. }
  4135. if x.NextPageToken == "" {
  4136. return nil
  4137. }
  4138. c.listlogentriesrequest.PageToken = x.NextPageToken
  4139. }
  4140. }
  4141. // method id "logging.entries.write":
  4142. type EntriesWriteCall struct {
  4143. s *Service
  4144. writelogentriesrequest *WriteLogEntriesRequest
  4145. urlParams_ gensupport.URLParams
  4146. ctx_ context.Context
  4147. header_ http.Header
  4148. }
  4149. // Write: Writes log entries to Logging. This API method is the only way
  4150. // to send log entries to Logging. This method is used, directly or
  4151. // indirectly, by the Logging agent (fluentd) and all logging libraries
  4152. // configured to use Logging. A single request may contain log entries
  4153. // for a maximum of 1000 different resources (projects, organizations,
  4154. // billing accounts or folders)
  4155. func (r *EntriesService) Write(writelogentriesrequest *WriteLogEntriesRequest) *EntriesWriteCall {
  4156. c := &EntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4157. c.writelogentriesrequest = writelogentriesrequest
  4158. return c
  4159. }
  4160. // Fields allows partial responses to be retrieved. See
  4161. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4162. // for more information.
  4163. func (c *EntriesWriteCall) Fields(s ...googleapi.Field) *EntriesWriteCall {
  4164. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4165. return c
  4166. }
  4167. // Context sets the context to be used in this call's Do method. Any
  4168. // pending HTTP request will be aborted if the provided context is
  4169. // canceled.
  4170. func (c *EntriesWriteCall) Context(ctx context.Context) *EntriesWriteCall {
  4171. c.ctx_ = ctx
  4172. return c
  4173. }
  4174. // Header returns an http.Header that can be modified by the caller to
  4175. // add HTTP headers to the request.
  4176. func (c *EntriesWriteCall) Header() http.Header {
  4177. if c.header_ == nil {
  4178. c.header_ = make(http.Header)
  4179. }
  4180. return c.header_
  4181. }
  4182. func (c *EntriesWriteCall) doRequest(alt string) (*http.Response, error) {
  4183. reqHeaders := make(http.Header)
  4184. for k, v := range c.header_ {
  4185. reqHeaders[k] = v
  4186. }
  4187. reqHeaders.Set("User-Agent", c.s.userAgent())
  4188. var body io.Reader = nil
  4189. body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
  4190. if err != nil {
  4191. return nil, err
  4192. }
  4193. reqHeaders.Set("Content-Type", "application/json")
  4194. c.urlParams_.Set("alt", alt)
  4195. c.urlParams_.Set("prettyPrint", "false")
  4196. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/entries:write")
  4197. urls += "?" + c.urlParams_.Encode()
  4198. req, err := http.NewRequest("POST", urls, body)
  4199. if err != nil {
  4200. return nil, err
  4201. }
  4202. req.Header = reqHeaders
  4203. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4204. }
  4205. // Do executes the "logging.entries.write" call.
  4206. // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any
  4207. // non-2xx status code is an error. Response headers are in either
  4208. // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
  4209. // returned at all) in error.(*googleapi.Error).Header. Use
  4210. // googleapi.IsNotModified to check whether the returned error was
  4211. // because http.StatusNotModified was returned.
  4212. func (c *EntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
  4213. gensupport.SetOptions(c.urlParams_, opts...)
  4214. res, err := c.doRequest("json")
  4215. if res != nil && res.StatusCode == http.StatusNotModified {
  4216. if res.Body != nil {
  4217. res.Body.Close()
  4218. }
  4219. return nil, &googleapi.Error{
  4220. Code: res.StatusCode,
  4221. Header: res.Header,
  4222. }
  4223. }
  4224. if err != nil {
  4225. return nil, err
  4226. }
  4227. defer googleapi.CloseBody(res)
  4228. if err := googleapi.CheckResponse(res); err != nil {
  4229. return nil, err
  4230. }
  4231. ret := &WriteLogEntriesResponse{
  4232. ServerResponse: googleapi.ServerResponse{
  4233. Header: res.Header,
  4234. HTTPStatusCode: res.StatusCode,
  4235. },
  4236. }
  4237. target := &ret
  4238. if err := gensupport.DecodeResponse(target, res); err != nil {
  4239. return nil, err
  4240. }
  4241. return ret, nil
  4242. // {
  4243. // "description": "Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)",
  4244. // "flatPath": "v2/entries:write",
  4245. // "httpMethod": "POST",
  4246. // "id": "logging.entries.write",
  4247. // "parameterOrder": [],
  4248. // "parameters": {},
  4249. // "path": "v2/entries:write",
  4250. // "request": {
  4251. // "$ref": "WriteLogEntriesRequest"
  4252. // },
  4253. // "response": {
  4254. // "$ref": "WriteLogEntriesResponse"
  4255. // },
  4256. // "scopes": [
  4257. // "https://www.googleapis.com/auth/cloud-platform",
  4258. // "https://www.googleapis.com/auth/logging.admin",
  4259. // "https://www.googleapis.com/auth/logging.write"
  4260. // ]
  4261. // }
  4262. }
  4263. // method id "logging.exclusions.create":
  4264. type ExclusionsCreateCall struct {
  4265. s *Service
  4266. parent string
  4267. logexclusion *LogExclusion
  4268. urlParams_ gensupport.URLParams
  4269. ctx_ context.Context
  4270. header_ http.Header
  4271. }
  4272. // Create: Creates a new exclusion in a specified parent resource. Only
  4273. // log entries belonging to that resource can be excluded. You can have
  4274. // up to 10 exclusions in a resource.
  4275. func (r *ExclusionsService) Create(parent string, logexclusion *LogExclusion) *ExclusionsCreateCall {
  4276. c := &ExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4277. c.parent = parent
  4278. c.logexclusion = logexclusion
  4279. return c
  4280. }
  4281. // Fields allows partial responses to be retrieved. See
  4282. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4283. // for more information.
  4284. func (c *ExclusionsCreateCall) Fields(s ...googleapi.Field) *ExclusionsCreateCall {
  4285. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4286. return c
  4287. }
  4288. // Context sets the context to be used in this call's Do method. Any
  4289. // pending HTTP request will be aborted if the provided context is
  4290. // canceled.
  4291. func (c *ExclusionsCreateCall) Context(ctx context.Context) *ExclusionsCreateCall {
  4292. c.ctx_ = ctx
  4293. return c
  4294. }
  4295. // Header returns an http.Header that can be modified by the caller to
  4296. // add HTTP headers to the request.
  4297. func (c *ExclusionsCreateCall) Header() http.Header {
  4298. if c.header_ == nil {
  4299. c.header_ = make(http.Header)
  4300. }
  4301. return c.header_
  4302. }
  4303. func (c *ExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  4304. reqHeaders := make(http.Header)
  4305. for k, v := range c.header_ {
  4306. reqHeaders[k] = v
  4307. }
  4308. reqHeaders.Set("User-Agent", c.s.userAgent())
  4309. var body io.Reader = nil
  4310. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  4311. if err != nil {
  4312. return nil, err
  4313. }
  4314. reqHeaders.Set("Content-Type", "application/json")
  4315. c.urlParams_.Set("alt", alt)
  4316. c.urlParams_.Set("prettyPrint", "false")
  4317. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  4318. urls += "?" + c.urlParams_.Encode()
  4319. req, err := http.NewRequest("POST", urls, body)
  4320. if err != nil {
  4321. return nil, err
  4322. }
  4323. req.Header = reqHeaders
  4324. googleapi.Expand(req.URL, map[string]string{
  4325. "parent": c.parent,
  4326. })
  4327. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4328. }
  4329. // Do executes the "logging.exclusions.create" call.
  4330. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  4331. // status code is an error. Response headers are in either
  4332. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  4333. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4334. // to check whether the returned error was because
  4335. // http.StatusNotModified was returned.
  4336. func (c *ExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  4337. gensupport.SetOptions(c.urlParams_, opts...)
  4338. res, err := c.doRequest("json")
  4339. if res != nil && res.StatusCode == http.StatusNotModified {
  4340. if res.Body != nil {
  4341. res.Body.Close()
  4342. }
  4343. return nil, &googleapi.Error{
  4344. Code: res.StatusCode,
  4345. Header: res.Header,
  4346. }
  4347. }
  4348. if err != nil {
  4349. return nil, err
  4350. }
  4351. defer googleapi.CloseBody(res)
  4352. if err := googleapi.CheckResponse(res); err != nil {
  4353. return nil, err
  4354. }
  4355. ret := &LogExclusion{
  4356. ServerResponse: googleapi.ServerResponse{
  4357. Header: res.Header,
  4358. HTTPStatusCode: res.StatusCode,
  4359. },
  4360. }
  4361. target := &ret
  4362. if err := gensupport.DecodeResponse(target, res); err != nil {
  4363. return nil, err
  4364. }
  4365. return ret, nil
  4366. // {
  4367. // "description": "Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.",
  4368. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions",
  4369. // "httpMethod": "POST",
  4370. // "id": "logging.exclusions.create",
  4371. // "parameterOrder": [
  4372. // "parent"
  4373. // ],
  4374. // "parameters": {
  4375. // "parent": {
  4376. // "description": "Required. The parent resource in which to create the exclusion:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
  4377. // "location": "path",
  4378. // "pattern": "^[^/]+/[^/]+$",
  4379. // "required": true,
  4380. // "type": "string"
  4381. // }
  4382. // },
  4383. // "path": "v2/{+parent}/exclusions",
  4384. // "request": {
  4385. // "$ref": "LogExclusion"
  4386. // },
  4387. // "response": {
  4388. // "$ref": "LogExclusion"
  4389. // },
  4390. // "scopes": [
  4391. // "https://www.googleapis.com/auth/cloud-platform",
  4392. // "https://www.googleapis.com/auth/logging.admin"
  4393. // ]
  4394. // }
  4395. }
  4396. // method id "logging.exclusions.delete":
  4397. type ExclusionsDeleteCall struct {
  4398. s *Service
  4399. name string
  4400. urlParams_ gensupport.URLParams
  4401. ctx_ context.Context
  4402. header_ http.Header
  4403. }
  4404. // Delete: Deletes an exclusion.
  4405. func (r *ExclusionsService) Delete(name string) *ExclusionsDeleteCall {
  4406. c := &ExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4407. c.name = name
  4408. return c
  4409. }
  4410. // Fields allows partial responses to be retrieved. See
  4411. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4412. // for more information.
  4413. func (c *ExclusionsDeleteCall) Fields(s ...googleapi.Field) *ExclusionsDeleteCall {
  4414. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4415. return c
  4416. }
  4417. // Context sets the context to be used in this call's Do method. Any
  4418. // pending HTTP request will be aborted if the provided context is
  4419. // canceled.
  4420. func (c *ExclusionsDeleteCall) Context(ctx context.Context) *ExclusionsDeleteCall {
  4421. c.ctx_ = ctx
  4422. return c
  4423. }
  4424. // Header returns an http.Header that can be modified by the caller to
  4425. // add HTTP headers to the request.
  4426. func (c *ExclusionsDeleteCall) Header() http.Header {
  4427. if c.header_ == nil {
  4428. c.header_ = make(http.Header)
  4429. }
  4430. return c.header_
  4431. }
  4432. func (c *ExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4433. reqHeaders := make(http.Header)
  4434. for k, v := range c.header_ {
  4435. reqHeaders[k] = v
  4436. }
  4437. reqHeaders.Set("User-Agent", c.s.userAgent())
  4438. var body io.Reader = nil
  4439. c.urlParams_.Set("alt", alt)
  4440. c.urlParams_.Set("prettyPrint", "false")
  4441. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  4442. urls += "?" + c.urlParams_.Encode()
  4443. req, err := http.NewRequest("DELETE", urls, body)
  4444. if err != nil {
  4445. return nil, err
  4446. }
  4447. req.Header = reqHeaders
  4448. googleapi.Expand(req.URL, map[string]string{
  4449. "name": c.name,
  4450. })
  4451. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4452. }
  4453. // Do executes the "logging.exclusions.delete" call.
  4454. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4455. // code is an error. Response headers are in either
  4456. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4457. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4458. // check whether the returned error was because http.StatusNotModified
  4459. // was returned.
  4460. func (c *ExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4461. gensupport.SetOptions(c.urlParams_, opts...)
  4462. res, err := c.doRequest("json")
  4463. if res != nil && res.StatusCode == http.StatusNotModified {
  4464. if res.Body != nil {
  4465. res.Body.Close()
  4466. }
  4467. return nil, &googleapi.Error{
  4468. Code: res.StatusCode,
  4469. Header: res.Header,
  4470. }
  4471. }
  4472. if err != nil {
  4473. return nil, err
  4474. }
  4475. defer googleapi.CloseBody(res)
  4476. if err := googleapi.CheckResponse(res); err != nil {
  4477. return nil, err
  4478. }
  4479. ret := &Empty{
  4480. ServerResponse: googleapi.ServerResponse{
  4481. Header: res.Header,
  4482. HTTPStatusCode: res.StatusCode,
  4483. },
  4484. }
  4485. target := &ret
  4486. if err := gensupport.DecodeResponse(target, res); err != nil {
  4487. return nil, err
  4488. }
  4489. return ret, nil
  4490. // {
  4491. // "description": "Deletes an exclusion.",
  4492. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions/{exclusionsId}",
  4493. // "httpMethod": "DELETE",
  4494. // "id": "logging.exclusions.delete",
  4495. // "parameterOrder": [
  4496. // "name"
  4497. // ],
  4498. // "parameters": {
  4499. // "name": {
  4500. // "description": "Required. The resource name of an existing exclusion to delete:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  4501. // "location": "path",
  4502. // "pattern": "^[^/]+/[^/]+/exclusions/[^/]+$",
  4503. // "required": true,
  4504. // "type": "string"
  4505. // }
  4506. // },
  4507. // "path": "v2/{+name}",
  4508. // "response": {
  4509. // "$ref": "Empty"
  4510. // },
  4511. // "scopes": [
  4512. // "https://www.googleapis.com/auth/cloud-platform",
  4513. // "https://www.googleapis.com/auth/logging.admin"
  4514. // ]
  4515. // }
  4516. }
  4517. // method id "logging.exclusions.get":
  4518. type ExclusionsGetCall struct {
  4519. s *Service
  4520. name string
  4521. urlParams_ gensupport.URLParams
  4522. ifNoneMatch_ string
  4523. ctx_ context.Context
  4524. header_ http.Header
  4525. }
  4526. // Get: Gets the description of an exclusion.
  4527. func (r *ExclusionsService) Get(name string) *ExclusionsGetCall {
  4528. c := &ExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4529. c.name = name
  4530. return c
  4531. }
  4532. // Fields allows partial responses to be retrieved. See
  4533. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4534. // for more information.
  4535. func (c *ExclusionsGetCall) Fields(s ...googleapi.Field) *ExclusionsGetCall {
  4536. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4537. return c
  4538. }
  4539. // IfNoneMatch sets the optional parameter which makes the operation
  4540. // fail if the object's ETag matches the given value. This is useful for
  4541. // getting updates only after the object has changed since the last
  4542. // request. Use googleapi.IsNotModified to check whether the response
  4543. // error from Do is the result of In-None-Match.
  4544. func (c *ExclusionsGetCall) IfNoneMatch(entityTag string) *ExclusionsGetCall {
  4545. c.ifNoneMatch_ = entityTag
  4546. return c
  4547. }
  4548. // Context sets the context to be used in this call's Do method. Any
  4549. // pending HTTP request will be aborted if the provided context is
  4550. // canceled.
  4551. func (c *ExclusionsGetCall) Context(ctx context.Context) *ExclusionsGetCall {
  4552. c.ctx_ = ctx
  4553. return c
  4554. }
  4555. // Header returns an http.Header that can be modified by the caller to
  4556. // add HTTP headers to the request.
  4557. func (c *ExclusionsGetCall) Header() http.Header {
  4558. if c.header_ == nil {
  4559. c.header_ = make(http.Header)
  4560. }
  4561. return c.header_
  4562. }
  4563. func (c *ExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  4564. reqHeaders := make(http.Header)
  4565. for k, v := range c.header_ {
  4566. reqHeaders[k] = v
  4567. }
  4568. reqHeaders.Set("User-Agent", c.s.userAgent())
  4569. if c.ifNoneMatch_ != "" {
  4570. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4571. }
  4572. var body io.Reader = nil
  4573. c.urlParams_.Set("alt", alt)
  4574. c.urlParams_.Set("prettyPrint", "false")
  4575. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  4576. urls += "?" + c.urlParams_.Encode()
  4577. req, err := http.NewRequest("GET", urls, body)
  4578. if err != nil {
  4579. return nil, err
  4580. }
  4581. req.Header = reqHeaders
  4582. googleapi.Expand(req.URL, map[string]string{
  4583. "name": c.name,
  4584. })
  4585. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4586. }
  4587. // Do executes the "logging.exclusions.get" call.
  4588. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  4589. // status code is an error. Response headers are in either
  4590. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  4591. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4592. // to check whether the returned error was because
  4593. // http.StatusNotModified was returned.
  4594. func (c *ExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  4595. gensupport.SetOptions(c.urlParams_, opts...)
  4596. res, err := c.doRequest("json")
  4597. if res != nil && res.StatusCode == http.StatusNotModified {
  4598. if res.Body != nil {
  4599. res.Body.Close()
  4600. }
  4601. return nil, &googleapi.Error{
  4602. Code: res.StatusCode,
  4603. Header: res.Header,
  4604. }
  4605. }
  4606. if err != nil {
  4607. return nil, err
  4608. }
  4609. defer googleapi.CloseBody(res)
  4610. if err := googleapi.CheckResponse(res); err != nil {
  4611. return nil, err
  4612. }
  4613. ret := &LogExclusion{
  4614. ServerResponse: googleapi.ServerResponse{
  4615. Header: res.Header,
  4616. HTTPStatusCode: res.StatusCode,
  4617. },
  4618. }
  4619. target := &ret
  4620. if err := gensupport.DecodeResponse(target, res); err != nil {
  4621. return nil, err
  4622. }
  4623. return ret, nil
  4624. // {
  4625. // "description": "Gets the description of an exclusion.",
  4626. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions/{exclusionsId}",
  4627. // "httpMethod": "GET",
  4628. // "id": "logging.exclusions.get",
  4629. // "parameterOrder": [
  4630. // "name"
  4631. // ],
  4632. // "parameters": {
  4633. // "name": {
  4634. // "description": "Required. The resource name of an existing exclusion:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  4635. // "location": "path",
  4636. // "pattern": "^[^/]+/[^/]+/exclusions/[^/]+$",
  4637. // "required": true,
  4638. // "type": "string"
  4639. // }
  4640. // },
  4641. // "path": "v2/{+name}",
  4642. // "response": {
  4643. // "$ref": "LogExclusion"
  4644. // },
  4645. // "scopes": [
  4646. // "https://www.googleapis.com/auth/cloud-platform",
  4647. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4648. // "https://www.googleapis.com/auth/logging.admin",
  4649. // "https://www.googleapis.com/auth/logging.read"
  4650. // ]
  4651. // }
  4652. }
  4653. // method id "logging.exclusions.list":
  4654. type ExclusionsListCall struct {
  4655. s *Service
  4656. parent string
  4657. urlParams_ gensupport.URLParams
  4658. ifNoneMatch_ string
  4659. ctx_ context.Context
  4660. header_ http.Header
  4661. }
  4662. // List: Lists all the exclusions in a parent resource.
  4663. func (r *ExclusionsService) List(parent string) *ExclusionsListCall {
  4664. c := &ExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4665. c.parent = parent
  4666. return c
  4667. }
  4668. // PageSize sets the optional parameter "pageSize": The maximum number
  4669. // of results to return from this request. Non-positive values are
  4670. // ignored. The presence of nextPageToken in the response indicates that
  4671. // more results might be available.
  4672. func (c *ExclusionsListCall) PageSize(pageSize int64) *ExclusionsListCall {
  4673. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4674. return c
  4675. }
  4676. // PageToken sets the optional parameter "pageToken": If present, then
  4677. // retrieve the next batch of results from the preceding call to this
  4678. // method. pageToken must be the value of nextPageToken from the
  4679. // previous response. The values of other method parameters should be
  4680. // identical to those in the previous call.
  4681. func (c *ExclusionsListCall) PageToken(pageToken string) *ExclusionsListCall {
  4682. c.urlParams_.Set("pageToken", pageToken)
  4683. return c
  4684. }
  4685. // Fields allows partial responses to be retrieved. See
  4686. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4687. // for more information.
  4688. func (c *ExclusionsListCall) Fields(s ...googleapi.Field) *ExclusionsListCall {
  4689. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4690. return c
  4691. }
  4692. // IfNoneMatch sets the optional parameter which makes the operation
  4693. // fail if the object's ETag matches the given value. This is useful for
  4694. // getting updates only after the object has changed since the last
  4695. // request. Use googleapi.IsNotModified to check whether the response
  4696. // error from Do is the result of In-None-Match.
  4697. func (c *ExclusionsListCall) IfNoneMatch(entityTag string) *ExclusionsListCall {
  4698. c.ifNoneMatch_ = entityTag
  4699. return c
  4700. }
  4701. // Context sets the context to be used in this call's Do method. Any
  4702. // pending HTTP request will be aborted if the provided context is
  4703. // canceled.
  4704. func (c *ExclusionsListCall) Context(ctx context.Context) *ExclusionsListCall {
  4705. c.ctx_ = ctx
  4706. return c
  4707. }
  4708. // Header returns an http.Header that can be modified by the caller to
  4709. // add HTTP headers to the request.
  4710. func (c *ExclusionsListCall) Header() http.Header {
  4711. if c.header_ == nil {
  4712. c.header_ = make(http.Header)
  4713. }
  4714. return c.header_
  4715. }
  4716. func (c *ExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  4717. reqHeaders := make(http.Header)
  4718. for k, v := range c.header_ {
  4719. reqHeaders[k] = v
  4720. }
  4721. reqHeaders.Set("User-Agent", c.s.userAgent())
  4722. if c.ifNoneMatch_ != "" {
  4723. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4724. }
  4725. var body io.Reader = nil
  4726. c.urlParams_.Set("alt", alt)
  4727. c.urlParams_.Set("prettyPrint", "false")
  4728. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  4729. urls += "?" + c.urlParams_.Encode()
  4730. req, err := http.NewRequest("GET", urls, body)
  4731. if err != nil {
  4732. return nil, err
  4733. }
  4734. req.Header = reqHeaders
  4735. googleapi.Expand(req.URL, map[string]string{
  4736. "parent": c.parent,
  4737. })
  4738. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4739. }
  4740. // Do executes the "logging.exclusions.list" call.
  4741. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  4742. // non-2xx status code is an error. Response headers are in either
  4743. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  4744. // returned at all) in error.(*googleapi.Error).Header. Use
  4745. // googleapi.IsNotModified to check whether the returned error was
  4746. // because http.StatusNotModified was returned.
  4747. func (c *ExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  4748. gensupport.SetOptions(c.urlParams_, opts...)
  4749. res, err := c.doRequest("json")
  4750. if res != nil && res.StatusCode == http.StatusNotModified {
  4751. if res.Body != nil {
  4752. res.Body.Close()
  4753. }
  4754. return nil, &googleapi.Error{
  4755. Code: res.StatusCode,
  4756. Header: res.Header,
  4757. }
  4758. }
  4759. if err != nil {
  4760. return nil, err
  4761. }
  4762. defer googleapi.CloseBody(res)
  4763. if err := googleapi.CheckResponse(res); err != nil {
  4764. return nil, err
  4765. }
  4766. ret := &ListExclusionsResponse{
  4767. ServerResponse: googleapi.ServerResponse{
  4768. Header: res.Header,
  4769. HTTPStatusCode: res.StatusCode,
  4770. },
  4771. }
  4772. target := &ret
  4773. if err := gensupport.DecodeResponse(target, res); err != nil {
  4774. return nil, err
  4775. }
  4776. return ret, nil
  4777. // {
  4778. // "description": "Lists all the exclusions in a parent resource.",
  4779. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions",
  4780. // "httpMethod": "GET",
  4781. // "id": "logging.exclusions.list",
  4782. // "parameterOrder": [
  4783. // "parent"
  4784. // ],
  4785. // "parameters": {
  4786. // "pageSize": {
  4787. // "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.",
  4788. // "format": "int32",
  4789. // "location": "query",
  4790. // "type": "integer"
  4791. // },
  4792. // "pageToken": {
  4793. // "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.",
  4794. // "location": "query",
  4795. // "type": "string"
  4796. // },
  4797. // "parent": {
  4798. // "description": "Required. The parent resource whose exclusions are to be listed.\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\n",
  4799. // "location": "path",
  4800. // "pattern": "^[^/]+/[^/]+$",
  4801. // "required": true,
  4802. // "type": "string"
  4803. // }
  4804. // },
  4805. // "path": "v2/{+parent}/exclusions",
  4806. // "response": {
  4807. // "$ref": "ListExclusionsResponse"
  4808. // },
  4809. // "scopes": [
  4810. // "https://www.googleapis.com/auth/cloud-platform",
  4811. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4812. // "https://www.googleapis.com/auth/logging.admin",
  4813. // "https://www.googleapis.com/auth/logging.read"
  4814. // ]
  4815. // }
  4816. }
  4817. // Pages invokes f for each page of results.
  4818. // A non-nil error returned from f will halt the iteration.
  4819. // The provided context supersedes any context provided to the Context method.
  4820. func (c *ExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  4821. c.ctx_ = ctx
  4822. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4823. for {
  4824. x, err := c.Do()
  4825. if err != nil {
  4826. return err
  4827. }
  4828. if err := f(x); err != nil {
  4829. return err
  4830. }
  4831. if x.NextPageToken == "" {
  4832. return nil
  4833. }
  4834. c.PageToken(x.NextPageToken)
  4835. }
  4836. }
  4837. // method id "logging.exclusions.patch":
  4838. type ExclusionsPatchCall struct {
  4839. s *Service
  4840. name string
  4841. logexclusion *LogExclusion
  4842. urlParams_ gensupport.URLParams
  4843. ctx_ context.Context
  4844. header_ http.Header
  4845. }
  4846. // Patch: Changes one or more properties of an existing exclusion.
  4847. func (r *ExclusionsService) Patch(name string, logexclusion *LogExclusion) *ExclusionsPatchCall {
  4848. c := &ExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4849. c.name = name
  4850. c.logexclusion = logexclusion
  4851. return c
  4852. }
  4853. // UpdateMask sets the optional parameter "updateMask": Required. A
  4854. // nonempty list of fields to change in the existing exclusion. New
  4855. // values for the fields are taken from the corresponding fields in the
  4856. // LogExclusion included in this request. Fields not mentioned in
  4857. // update_mask are not changed and are ignored in the request.For
  4858. // example, to change the filter and description of an exclusion,
  4859. // specify an update_mask of "filter,description".
  4860. func (c *ExclusionsPatchCall) UpdateMask(updateMask string) *ExclusionsPatchCall {
  4861. c.urlParams_.Set("updateMask", updateMask)
  4862. return c
  4863. }
  4864. // Fields allows partial responses to be retrieved. See
  4865. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4866. // for more information.
  4867. func (c *ExclusionsPatchCall) Fields(s ...googleapi.Field) *ExclusionsPatchCall {
  4868. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4869. return c
  4870. }
  4871. // Context sets the context to be used in this call's Do method. Any
  4872. // pending HTTP request will be aborted if the provided context is
  4873. // canceled.
  4874. func (c *ExclusionsPatchCall) Context(ctx context.Context) *ExclusionsPatchCall {
  4875. c.ctx_ = ctx
  4876. return c
  4877. }
  4878. // Header returns an http.Header that can be modified by the caller to
  4879. // add HTTP headers to the request.
  4880. func (c *ExclusionsPatchCall) Header() http.Header {
  4881. if c.header_ == nil {
  4882. c.header_ = make(http.Header)
  4883. }
  4884. return c.header_
  4885. }
  4886. func (c *ExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  4887. reqHeaders := make(http.Header)
  4888. for k, v := range c.header_ {
  4889. reqHeaders[k] = v
  4890. }
  4891. reqHeaders.Set("User-Agent", c.s.userAgent())
  4892. var body io.Reader = nil
  4893. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  4894. if err != nil {
  4895. return nil, err
  4896. }
  4897. reqHeaders.Set("Content-Type", "application/json")
  4898. c.urlParams_.Set("alt", alt)
  4899. c.urlParams_.Set("prettyPrint", "false")
  4900. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  4901. urls += "?" + c.urlParams_.Encode()
  4902. req, err := http.NewRequest("PATCH", urls, body)
  4903. if err != nil {
  4904. return nil, err
  4905. }
  4906. req.Header = reqHeaders
  4907. googleapi.Expand(req.URL, map[string]string{
  4908. "name": c.name,
  4909. })
  4910. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4911. }
  4912. // Do executes the "logging.exclusions.patch" call.
  4913. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  4914. // status code is an error. Response headers are in either
  4915. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  4916. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4917. // to check whether the returned error was because
  4918. // http.StatusNotModified was returned.
  4919. func (c *ExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  4920. gensupport.SetOptions(c.urlParams_, opts...)
  4921. res, err := c.doRequest("json")
  4922. if res != nil && res.StatusCode == http.StatusNotModified {
  4923. if res.Body != nil {
  4924. res.Body.Close()
  4925. }
  4926. return nil, &googleapi.Error{
  4927. Code: res.StatusCode,
  4928. Header: res.Header,
  4929. }
  4930. }
  4931. if err != nil {
  4932. return nil, err
  4933. }
  4934. defer googleapi.CloseBody(res)
  4935. if err := googleapi.CheckResponse(res); err != nil {
  4936. return nil, err
  4937. }
  4938. ret := &LogExclusion{
  4939. ServerResponse: googleapi.ServerResponse{
  4940. Header: res.Header,
  4941. HTTPStatusCode: res.StatusCode,
  4942. },
  4943. }
  4944. target := &ret
  4945. if err := gensupport.DecodeResponse(target, res); err != nil {
  4946. return nil, err
  4947. }
  4948. return ret, nil
  4949. // {
  4950. // "description": "Changes one or more properties of an existing exclusion.",
  4951. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions/{exclusionsId}",
  4952. // "httpMethod": "PATCH",
  4953. // "id": "logging.exclusions.patch",
  4954. // "parameterOrder": [
  4955. // "name"
  4956. // ],
  4957. // "parameters": {
  4958. // "name": {
  4959. // "description": "Required. The resource name of the exclusion to update:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  4960. // "location": "path",
  4961. // "pattern": "^[^/]+/[^/]+/exclusions/[^/]+$",
  4962. // "required": true,
  4963. // "type": "string"
  4964. // },
  4965. // "updateMask": {
  4966. // "description": "Required. A nonempty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the LogExclusion included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.For example, to change the filter and description of an exclusion, specify an update_mask of \"filter,description\".",
  4967. // "format": "google-fieldmask",
  4968. // "location": "query",
  4969. // "type": "string"
  4970. // }
  4971. // },
  4972. // "path": "v2/{+name}",
  4973. // "request": {
  4974. // "$ref": "LogExclusion"
  4975. // },
  4976. // "response": {
  4977. // "$ref": "LogExclusion"
  4978. // },
  4979. // "scopes": [
  4980. // "https://www.googleapis.com/auth/cloud-platform",
  4981. // "https://www.googleapis.com/auth/logging.admin"
  4982. // ]
  4983. // }
  4984. }
  4985. // method id "logging.folders.exclusions.create":
  4986. type FoldersExclusionsCreateCall struct {
  4987. s *Service
  4988. parent string
  4989. logexclusion *LogExclusion
  4990. urlParams_ gensupport.URLParams
  4991. ctx_ context.Context
  4992. header_ http.Header
  4993. }
  4994. // Create: Creates a new exclusion in a specified parent resource. Only
  4995. // log entries belonging to that resource can be excluded. You can have
  4996. // up to 10 exclusions in a resource.
  4997. func (r *FoldersExclusionsService) Create(parent string, logexclusion *LogExclusion) *FoldersExclusionsCreateCall {
  4998. c := &FoldersExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4999. c.parent = parent
  5000. c.logexclusion = logexclusion
  5001. return c
  5002. }
  5003. // Fields allows partial responses to be retrieved. See
  5004. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5005. // for more information.
  5006. func (c *FoldersExclusionsCreateCall) Fields(s ...googleapi.Field) *FoldersExclusionsCreateCall {
  5007. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5008. return c
  5009. }
  5010. // Context sets the context to be used in this call's Do method. Any
  5011. // pending HTTP request will be aborted if the provided context is
  5012. // canceled.
  5013. func (c *FoldersExclusionsCreateCall) Context(ctx context.Context) *FoldersExclusionsCreateCall {
  5014. c.ctx_ = ctx
  5015. return c
  5016. }
  5017. // Header returns an http.Header that can be modified by the caller to
  5018. // add HTTP headers to the request.
  5019. func (c *FoldersExclusionsCreateCall) Header() http.Header {
  5020. if c.header_ == nil {
  5021. c.header_ = make(http.Header)
  5022. }
  5023. return c.header_
  5024. }
  5025. func (c *FoldersExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  5026. reqHeaders := make(http.Header)
  5027. for k, v := range c.header_ {
  5028. reqHeaders[k] = v
  5029. }
  5030. reqHeaders.Set("User-Agent", c.s.userAgent())
  5031. var body io.Reader = nil
  5032. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  5033. if err != nil {
  5034. return nil, err
  5035. }
  5036. reqHeaders.Set("Content-Type", "application/json")
  5037. c.urlParams_.Set("alt", alt)
  5038. c.urlParams_.Set("prettyPrint", "false")
  5039. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  5040. urls += "?" + c.urlParams_.Encode()
  5041. req, err := http.NewRequest("POST", urls, body)
  5042. if err != nil {
  5043. return nil, err
  5044. }
  5045. req.Header = reqHeaders
  5046. googleapi.Expand(req.URL, map[string]string{
  5047. "parent": c.parent,
  5048. })
  5049. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5050. }
  5051. // Do executes the "logging.folders.exclusions.create" call.
  5052. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  5053. // status code is an error. Response headers are in either
  5054. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  5055. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5056. // to check whether the returned error was because
  5057. // http.StatusNotModified was returned.
  5058. func (c *FoldersExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  5059. gensupport.SetOptions(c.urlParams_, opts...)
  5060. res, err := c.doRequest("json")
  5061. if res != nil && res.StatusCode == http.StatusNotModified {
  5062. if res.Body != nil {
  5063. res.Body.Close()
  5064. }
  5065. return nil, &googleapi.Error{
  5066. Code: res.StatusCode,
  5067. Header: res.Header,
  5068. }
  5069. }
  5070. if err != nil {
  5071. return nil, err
  5072. }
  5073. defer googleapi.CloseBody(res)
  5074. if err := googleapi.CheckResponse(res); err != nil {
  5075. return nil, err
  5076. }
  5077. ret := &LogExclusion{
  5078. ServerResponse: googleapi.ServerResponse{
  5079. Header: res.Header,
  5080. HTTPStatusCode: res.StatusCode,
  5081. },
  5082. }
  5083. target := &ret
  5084. if err := gensupport.DecodeResponse(target, res); err != nil {
  5085. return nil, err
  5086. }
  5087. return ret, nil
  5088. // {
  5089. // "description": "Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.",
  5090. // "flatPath": "v2/folders/{foldersId}/exclusions",
  5091. // "httpMethod": "POST",
  5092. // "id": "logging.folders.exclusions.create",
  5093. // "parameterOrder": [
  5094. // "parent"
  5095. // ],
  5096. // "parameters": {
  5097. // "parent": {
  5098. // "description": "Required. The parent resource in which to create the exclusion:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
  5099. // "location": "path",
  5100. // "pattern": "^folders/[^/]+$",
  5101. // "required": true,
  5102. // "type": "string"
  5103. // }
  5104. // },
  5105. // "path": "v2/{+parent}/exclusions",
  5106. // "request": {
  5107. // "$ref": "LogExclusion"
  5108. // },
  5109. // "response": {
  5110. // "$ref": "LogExclusion"
  5111. // },
  5112. // "scopes": [
  5113. // "https://www.googleapis.com/auth/cloud-platform",
  5114. // "https://www.googleapis.com/auth/logging.admin"
  5115. // ]
  5116. // }
  5117. }
  5118. // method id "logging.folders.exclusions.delete":
  5119. type FoldersExclusionsDeleteCall struct {
  5120. s *Service
  5121. name string
  5122. urlParams_ gensupport.URLParams
  5123. ctx_ context.Context
  5124. header_ http.Header
  5125. }
  5126. // Delete: Deletes an exclusion.
  5127. func (r *FoldersExclusionsService) Delete(name string) *FoldersExclusionsDeleteCall {
  5128. c := &FoldersExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5129. c.name = name
  5130. return c
  5131. }
  5132. // Fields allows partial responses to be retrieved. See
  5133. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5134. // for more information.
  5135. func (c *FoldersExclusionsDeleteCall) Fields(s ...googleapi.Field) *FoldersExclusionsDeleteCall {
  5136. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5137. return c
  5138. }
  5139. // Context sets the context to be used in this call's Do method. Any
  5140. // pending HTTP request will be aborted if the provided context is
  5141. // canceled.
  5142. func (c *FoldersExclusionsDeleteCall) Context(ctx context.Context) *FoldersExclusionsDeleteCall {
  5143. c.ctx_ = ctx
  5144. return c
  5145. }
  5146. // Header returns an http.Header that can be modified by the caller to
  5147. // add HTTP headers to the request.
  5148. func (c *FoldersExclusionsDeleteCall) Header() http.Header {
  5149. if c.header_ == nil {
  5150. c.header_ = make(http.Header)
  5151. }
  5152. return c.header_
  5153. }
  5154. func (c *FoldersExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5155. reqHeaders := make(http.Header)
  5156. for k, v := range c.header_ {
  5157. reqHeaders[k] = v
  5158. }
  5159. reqHeaders.Set("User-Agent", c.s.userAgent())
  5160. var body io.Reader = nil
  5161. c.urlParams_.Set("alt", alt)
  5162. c.urlParams_.Set("prettyPrint", "false")
  5163. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  5164. urls += "?" + c.urlParams_.Encode()
  5165. req, err := http.NewRequest("DELETE", urls, body)
  5166. if err != nil {
  5167. return nil, err
  5168. }
  5169. req.Header = reqHeaders
  5170. googleapi.Expand(req.URL, map[string]string{
  5171. "name": c.name,
  5172. })
  5173. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5174. }
  5175. // Do executes the "logging.folders.exclusions.delete" call.
  5176. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5177. // code is an error. Response headers are in either
  5178. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5179. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5180. // check whether the returned error was because http.StatusNotModified
  5181. // was returned.
  5182. func (c *FoldersExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5183. gensupport.SetOptions(c.urlParams_, opts...)
  5184. res, err := c.doRequest("json")
  5185. if res != nil && res.StatusCode == http.StatusNotModified {
  5186. if res.Body != nil {
  5187. res.Body.Close()
  5188. }
  5189. return nil, &googleapi.Error{
  5190. Code: res.StatusCode,
  5191. Header: res.Header,
  5192. }
  5193. }
  5194. if err != nil {
  5195. return nil, err
  5196. }
  5197. defer googleapi.CloseBody(res)
  5198. if err := googleapi.CheckResponse(res); err != nil {
  5199. return nil, err
  5200. }
  5201. ret := &Empty{
  5202. ServerResponse: googleapi.ServerResponse{
  5203. Header: res.Header,
  5204. HTTPStatusCode: res.StatusCode,
  5205. },
  5206. }
  5207. target := &ret
  5208. if err := gensupport.DecodeResponse(target, res); err != nil {
  5209. return nil, err
  5210. }
  5211. return ret, nil
  5212. // {
  5213. // "description": "Deletes an exclusion.",
  5214. // "flatPath": "v2/folders/{foldersId}/exclusions/{exclusionsId}",
  5215. // "httpMethod": "DELETE",
  5216. // "id": "logging.folders.exclusions.delete",
  5217. // "parameterOrder": [
  5218. // "name"
  5219. // ],
  5220. // "parameters": {
  5221. // "name": {
  5222. // "description": "Required. The resource name of an existing exclusion to delete:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  5223. // "location": "path",
  5224. // "pattern": "^folders/[^/]+/exclusions/[^/]+$",
  5225. // "required": true,
  5226. // "type": "string"
  5227. // }
  5228. // },
  5229. // "path": "v2/{+name}",
  5230. // "response": {
  5231. // "$ref": "Empty"
  5232. // },
  5233. // "scopes": [
  5234. // "https://www.googleapis.com/auth/cloud-platform",
  5235. // "https://www.googleapis.com/auth/logging.admin"
  5236. // ]
  5237. // }
  5238. }
  5239. // method id "logging.folders.exclusions.get":
  5240. type FoldersExclusionsGetCall struct {
  5241. s *Service
  5242. name string
  5243. urlParams_ gensupport.URLParams
  5244. ifNoneMatch_ string
  5245. ctx_ context.Context
  5246. header_ http.Header
  5247. }
  5248. // Get: Gets the description of an exclusion.
  5249. func (r *FoldersExclusionsService) Get(name string) *FoldersExclusionsGetCall {
  5250. c := &FoldersExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5251. c.name = name
  5252. return c
  5253. }
  5254. // Fields allows partial responses to be retrieved. See
  5255. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5256. // for more information.
  5257. func (c *FoldersExclusionsGetCall) Fields(s ...googleapi.Field) *FoldersExclusionsGetCall {
  5258. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5259. return c
  5260. }
  5261. // IfNoneMatch sets the optional parameter which makes the operation
  5262. // fail if the object's ETag matches the given value. This is useful for
  5263. // getting updates only after the object has changed since the last
  5264. // request. Use googleapi.IsNotModified to check whether the response
  5265. // error from Do is the result of In-None-Match.
  5266. func (c *FoldersExclusionsGetCall) IfNoneMatch(entityTag string) *FoldersExclusionsGetCall {
  5267. c.ifNoneMatch_ = entityTag
  5268. return c
  5269. }
  5270. // Context sets the context to be used in this call's Do method. Any
  5271. // pending HTTP request will be aborted if the provided context is
  5272. // canceled.
  5273. func (c *FoldersExclusionsGetCall) Context(ctx context.Context) *FoldersExclusionsGetCall {
  5274. c.ctx_ = ctx
  5275. return c
  5276. }
  5277. // Header returns an http.Header that can be modified by the caller to
  5278. // add HTTP headers to the request.
  5279. func (c *FoldersExclusionsGetCall) Header() http.Header {
  5280. if c.header_ == nil {
  5281. c.header_ = make(http.Header)
  5282. }
  5283. return c.header_
  5284. }
  5285. func (c *FoldersExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  5286. reqHeaders := make(http.Header)
  5287. for k, v := range c.header_ {
  5288. reqHeaders[k] = v
  5289. }
  5290. reqHeaders.Set("User-Agent", c.s.userAgent())
  5291. if c.ifNoneMatch_ != "" {
  5292. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5293. }
  5294. var body io.Reader = nil
  5295. c.urlParams_.Set("alt", alt)
  5296. c.urlParams_.Set("prettyPrint", "false")
  5297. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  5298. urls += "?" + c.urlParams_.Encode()
  5299. req, err := http.NewRequest("GET", urls, body)
  5300. if err != nil {
  5301. return nil, err
  5302. }
  5303. req.Header = reqHeaders
  5304. googleapi.Expand(req.URL, map[string]string{
  5305. "name": c.name,
  5306. })
  5307. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5308. }
  5309. // Do executes the "logging.folders.exclusions.get" call.
  5310. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  5311. // status code is an error. Response headers are in either
  5312. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  5313. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5314. // to check whether the returned error was because
  5315. // http.StatusNotModified was returned.
  5316. func (c *FoldersExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  5317. gensupport.SetOptions(c.urlParams_, opts...)
  5318. res, err := c.doRequest("json")
  5319. if res != nil && res.StatusCode == http.StatusNotModified {
  5320. if res.Body != nil {
  5321. res.Body.Close()
  5322. }
  5323. return nil, &googleapi.Error{
  5324. Code: res.StatusCode,
  5325. Header: res.Header,
  5326. }
  5327. }
  5328. if err != nil {
  5329. return nil, err
  5330. }
  5331. defer googleapi.CloseBody(res)
  5332. if err := googleapi.CheckResponse(res); err != nil {
  5333. return nil, err
  5334. }
  5335. ret := &LogExclusion{
  5336. ServerResponse: googleapi.ServerResponse{
  5337. Header: res.Header,
  5338. HTTPStatusCode: res.StatusCode,
  5339. },
  5340. }
  5341. target := &ret
  5342. if err := gensupport.DecodeResponse(target, res); err != nil {
  5343. return nil, err
  5344. }
  5345. return ret, nil
  5346. // {
  5347. // "description": "Gets the description of an exclusion.",
  5348. // "flatPath": "v2/folders/{foldersId}/exclusions/{exclusionsId}",
  5349. // "httpMethod": "GET",
  5350. // "id": "logging.folders.exclusions.get",
  5351. // "parameterOrder": [
  5352. // "name"
  5353. // ],
  5354. // "parameters": {
  5355. // "name": {
  5356. // "description": "Required. The resource name of an existing exclusion:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  5357. // "location": "path",
  5358. // "pattern": "^folders/[^/]+/exclusions/[^/]+$",
  5359. // "required": true,
  5360. // "type": "string"
  5361. // }
  5362. // },
  5363. // "path": "v2/{+name}",
  5364. // "response": {
  5365. // "$ref": "LogExclusion"
  5366. // },
  5367. // "scopes": [
  5368. // "https://www.googleapis.com/auth/cloud-platform",
  5369. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5370. // "https://www.googleapis.com/auth/logging.admin",
  5371. // "https://www.googleapis.com/auth/logging.read"
  5372. // ]
  5373. // }
  5374. }
  5375. // method id "logging.folders.exclusions.list":
  5376. type FoldersExclusionsListCall struct {
  5377. s *Service
  5378. parent string
  5379. urlParams_ gensupport.URLParams
  5380. ifNoneMatch_ string
  5381. ctx_ context.Context
  5382. header_ http.Header
  5383. }
  5384. // List: Lists all the exclusions in a parent resource.
  5385. func (r *FoldersExclusionsService) List(parent string) *FoldersExclusionsListCall {
  5386. c := &FoldersExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5387. c.parent = parent
  5388. return c
  5389. }
  5390. // PageSize sets the optional parameter "pageSize": The maximum number
  5391. // of results to return from this request. Non-positive values are
  5392. // ignored. The presence of nextPageToken in the response indicates that
  5393. // more results might be available.
  5394. func (c *FoldersExclusionsListCall) PageSize(pageSize int64) *FoldersExclusionsListCall {
  5395. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5396. return c
  5397. }
  5398. // PageToken sets the optional parameter "pageToken": If present, then
  5399. // retrieve the next batch of results from the preceding call to this
  5400. // method. pageToken must be the value of nextPageToken from the
  5401. // previous response. The values of other method parameters should be
  5402. // identical to those in the previous call.
  5403. func (c *FoldersExclusionsListCall) PageToken(pageToken string) *FoldersExclusionsListCall {
  5404. c.urlParams_.Set("pageToken", pageToken)
  5405. return c
  5406. }
  5407. // Fields allows partial responses to be retrieved. See
  5408. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5409. // for more information.
  5410. func (c *FoldersExclusionsListCall) Fields(s ...googleapi.Field) *FoldersExclusionsListCall {
  5411. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5412. return c
  5413. }
  5414. // IfNoneMatch sets the optional parameter which makes the operation
  5415. // fail if the object's ETag matches the given value. This is useful for
  5416. // getting updates only after the object has changed since the last
  5417. // request. Use googleapi.IsNotModified to check whether the response
  5418. // error from Do is the result of In-None-Match.
  5419. func (c *FoldersExclusionsListCall) IfNoneMatch(entityTag string) *FoldersExclusionsListCall {
  5420. c.ifNoneMatch_ = entityTag
  5421. return c
  5422. }
  5423. // Context sets the context to be used in this call's Do method. Any
  5424. // pending HTTP request will be aborted if the provided context is
  5425. // canceled.
  5426. func (c *FoldersExclusionsListCall) Context(ctx context.Context) *FoldersExclusionsListCall {
  5427. c.ctx_ = ctx
  5428. return c
  5429. }
  5430. // Header returns an http.Header that can be modified by the caller to
  5431. // add HTTP headers to the request.
  5432. func (c *FoldersExclusionsListCall) Header() http.Header {
  5433. if c.header_ == nil {
  5434. c.header_ = make(http.Header)
  5435. }
  5436. return c.header_
  5437. }
  5438. func (c *FoldersExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  5439. reqHeaders := make(http.Header)
  5440. for k, v := range c.header_ {
  5441. reqHeaders[k] = v
  5442. }
  5443. reqHeaders.Set("User-Agent", c.s.userAgent())
  5444. if c.ifNoneMatch_ != "" {
  5445. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5446. }
  5447. var body io.Reader = nil
  5448. c.urlParams_.Set("alt", alt)
  5449. c.urlParams_.Set("prettyPrint", "false")
  5450. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  5451. urls += "?" + c.urlParams_.Encode()
  5452. req, err := http.NewRequest("GET", urls, body)
  5453. if err != nil {
  5454. return nil, err
  5455. }
  5456. req.Header = reqHeaders
  5457. googleapi.Expand(req.URL, map[string]string{
  5458. "parent": c.parent,
  5459. })
  5460. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5461. }
  5462. // Do executes the "logging.folders.exclusions.list" call.
  5463. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  5464. // non-2xx status code is an error. Response headers are in either
  5465. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  5466. // returned at all) in error.(*googleapi.Error).Header. Use
  5467. // googleapi.IsNotModified to check whether the returned error was
  5468. // because http.StatusNotModified was returned.
  5469. func (c *FoldersExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  5470. gensupport.SetOptions(c.urlParams_, opts...)
  5471. res, err := c.doRequest("json")
  5472. if res != nil && res.StatusCode == http.StatusNotModified {
  5473. if res.Body != nil {
  5474. res.Body.Close()
  5475. }
  5476. return nil, &googleapi.Error{
  5477. Code: res.StatusCode,
  5478. Header: res.Header,
  5479. }
  5480. }
  5481. if err != nil {
  5482. return nil, err
  5483. }
  5484. defer googleapi.CloseBody(res)
  5485. if err := googleapi.CheckResponse(res); err != nil {
  5486. return nil, err
  5487. }
  5488. ret := &ListExclusionsResponse{
  5489. ServerResponse: googleapi.ServerResponse{
  5490. Header: res.Header,
  5491. HTTPStatusCode: res.StatusCode,
  5492. },
  5493. }
  5494. target := &ret
  5495. if err := gensupport.DecodeResponse(target, res); err != nil {
  5496. return nil, err
  5497. }
  5498. return ret, nil
  5499. // {
  5500. // "description": "Lists all the exclusions in a parent resource.",
  5501. // "flatPath": "v2/folders/{foldersId}/exclusions",
  5502. // "httpMethod": "GET",
  5503. // "id": "logging.folders.exclusions.list",
  5504. // "parameterOrder": [
  5505. // "parent"
  5506. // ],
  5507. // "parameters": {
  5508. // "pageSize": {
  5509. // "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.",
  5510. // "format": "int32",
  5511. // "location": "query",
  5512. // "type": "integer"
  5513. // },
  5514. // "pageToken": {
  5515. // "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.",
  5516. // "location": "query",
  5517. // "type": "string"
  5518. // },
  5519. // "parent": {
  5520. // "description": "Required. The parent resource whose exclusions are to be listed.\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\n",
  5521. // "location": "path",
  5522. // "pattern": "^folders/[^/]+$",
  5523. // "required": true,
  5524. // "type": "string"
  5525. // }
  5526. // },
  5527. // "path": "v2/{+parent}/exclusions",
  5528. // "response": {
  5529. // "$ref": "ListExclusionsResponse"
  5530. // },
  5531. // "scopes": [
  5532. // "https://www.googleapis.com/auth/cloud-platform",
  5533. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5534. // "https://www.googleapis.com/auth/logging.admin",
  5535. // "https://www.googleapis.com/auth/logging.read"
  5536. // ]
  5537. // }
  5538. }
  5539. // Pages invokes f for each page of results.
  5540. // A non-nil error returned from f will halt the iteration.
  5541. // The provided context supersedes any context provided to the Context method.
  5542. func (c *FoldersExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  5543. c.ctx_ = ctx
  5544. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5545. for {
  5546. x, err := c.Do()
  5547. if err != nil {
  5548. return err
  5549. }
  5550. if err := f(x); err != nil {
  5551. return err
  5552. }
  5553. if x.NextPageToken == "" {
  5554. return nil
  5555. }
  5556. c.PageToken(x.NextPageToken)
  5557. }
  5558. }
  5559. // method id "logging.folders.exclusions.patch":
  5560. type FoldersExclusionsPatchCall struct {
  5561. s *Service
  5562. name string
  5563. logexclusion *LogExclusion
  5564. urlParams_ gensupport.URLParams
  5565. ctx_ context.Context
  5566. header_ http.Header
  5567. }
  5568. // Patch: Changes one or more properties of an existing exclusion.
  5569. func (r *FoldersExclusionsService) Patch(name string, logexclusion *LogExclusion) *FoldersExclusionsPatchCall {
  5570. c := &FoldersExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5571. c.name = name
  5572. c.logexclusion = logexclusion
  5573. return c
  5574. }
  5575. // UpdateMask sets the optional parameter "updateMask": Required. A
  5576. // nonempty list of fields to change in the existing exclusion. New
  5577. // values for the fields are taken from the corresponding fields in the
  5578. // LogExclusion included in this request. Fields not mentioned in
  5579. // update_mask are not changed and are ignored in the request.For
  5580. // example, to change the filter and description of an exclusion,
  5581. // specify an update_mask of "filter,description".
  5582. func (c *FoldersExclusionsPatchCall) UpdateMask(updateMask string) *FoldersExclusionsPatchCall {
  5583. c.urlParams_.Set("updateMask", updateMask)
  5584. return c
  5585. }
  5586. // Fields allows partial responses to be retrieved. See
  5587. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5588. // for more information.
  5589. func (c *FoldersExclusionsPatchCall) Fields(s ...googleapi.Field) *FoldersExclusionsPatchCall {
  5590. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5591. return c
  5592. }
  5593. // Context sets the context to be used in this call's Do method. Any
  5594. // pending HTTP request will be aborted if the provided context is
  5595. // canceled.
  5596. func (c *FoldersExclusionsPatchCall) Context(ctx context.Context) *FoldersExclusionsPatchCall {
  5597. c.ctx_ = ctx
  5598. return c
  5599. }
  5600. // Header returns an http.Header that can be modified by the caller to
  5601. // add HTTP headers to the request.
  5602. func (c *FoldersExclusionsPatchCall) Header() http.Header {
  5603. if c.header_ == nil {
  5604. c.header_ = make(http.Header)
  5605. }
  5606. return c.header_
  5607. }
  5608. func (c *FoldersExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  5609. reqHeaders := make(http.Header)
  5610. for k, v := range c.header_ {
  5611. reqHeaders[k] = v
  5612. }
  5613. reqHeaders.Set("User-Agent", c.s.userAgent())
  5614. var body io.Reader = nil
  5615. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  5616. if err != nil {
  5617. return nil, err
  5618. }
  5619. reqHeaders.Set("Content-Type", "application/json")
  5620. c.urlParams_.Set("alt", alt)
  5621. c.urlParams_.Set("prettyPrint", "false")
  5622. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  5623. urls += "?" + c.urlParams_.Encode()
  5624. req, err := http.NewRequest("PATCH", urls, body)
  5625. if err != nil {
  5626. return nil, err
  5627. }
  5628. req.Header = reqHeaders
  5629. googleapi.Expand(req.URL, map[string]string{
  5630. "name": c.name,
  5631. })
  5632. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5633. }
  5634. // Do executes the "logging.folders.exclusions.patch" call.
  5635. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  5636. // status code is an error. Response headers are in either
  5637. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  5638. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5639. // to check whether the returned error was because
  5640. // http.StatusNotModified was returned.
  5641. func (c *FoldersExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  5642. gensupport.SetOptions(c.urlParams_, opts...)
  5643. res, err := c.doRequest("json")
  5644. if res != nil && res.StatusCode == http.StatusNotModified {
  5645. if res.Body != nil {
  5646. res.Body.Close()
  5647. }
  5648. return nil, &googleapi.Error{
  5649. Code: res.StatusCode,
  5650. Header: res.Header,
  5651. }
  5652. }
  5653. if err != nil {
  5654. return nil, err
  5655. }
  5656. defer googleapi.CloseBody(res)
  5657. if err := googleapi.CheckResponse(res); err != nil {
  5658. return nil, err
  5659. }
  5660. ret := &LogExclusion{
  5661. ServerResponse: googleapi.ServerResponse{
  5662. Header: res.Header,
  5663. HTTPStatusCode: res.StatusCode,
  5664. },
  5665. }
  5666. target := &ret
  5667. if err := gensupport.DecodeResponse(target, res); err != nil {
  5668. return nil, err
  5669. }
  5670. return ret, nil
  5671. // {
  5672. // "description": "Changes one or more properties of an existing exclusion.",
  5673. // "flatPath": "v2/folders/{foldersId}/exclusions/{exclusionsId}",
  5674. // "httpMethod": "PATCH",
  5675. // "id": "logging.folders.exclusions.patch",
  5676. // "parameterOrder": [
  5677. // "name"
  5678. // ],
  5679. // "parameters": {
  5680. // "name": {
  5681. // "description": "Required. The resource name of the exclusion to update:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  5682. // "location": "path",
  5683. // "pattern": "^folders/[^/]+/exclusions/[^/]+$",
  5684. // "required": true,
  5685. // "type": "string"
  5686. // },
  5687. // "updateMask": {
  5688. // "description": "Required. A nonempty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the LogExclusion included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.For example, to change the filter and description of an exclusion, specify an update_mask of \"filter,description\".",
  5689. // "format": "google-fieldmask",
  5690. // "location": "query",
  5691. // "type": "string"
  5692. // }
  5693. // },
  5694. // "path": "v2/{+name}",
  5695. // "request": {
  5696. // "$ref": "LogExclusion"
  5697. // },
  5698. // "response": {
  5699. // "$ref": "LogExclusion"
  5700. // },
  5701. // "scopes": [
  5702. // "https://www.googleapis.com/auth/cloud-platform",
  5703. // "https://www.googleapis.com/auth/logging.admin"
  5704. // ]
  5705. // }
  5706. }
  5707. // method id "logging.folders.logs.delete":
  5708. type FoldersLogsDeleteCall struct {
  5709. s *Service
  5710. logName string
  5711. urlParams_ gensupport.URLParams
  5712. ctx_ context.Context
  5713. header_ http.Header
  5714. }
  5715. // Delete: Deletes all the log entries in a log. The log reappears if it
  5716. // receives new entries. Log entries written shortly before the delete
  5717. // operation might not be deleted.
  5718. func (r *FoldersLogsService) Delete(logName string) *FoldersLogsDeleteCall {
  5719. c := &FoldersLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5720. c.logName = logName
  5721. return c
  5722. }
  5723. // Fields allows partial responses to be retrieved. See
  5724. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5725. // for more information.
  5726. func (c *FoldersLogsDeleteCall) Fields(s ...googleapi.Field) *FoldersLogsDeleteCall {
  5727. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5728. return c
  5729. }
  5730. // Context sets the context to be used in this call's Do method. Any
  5731. // pending HTTP request will be aborted if the provided context is
  5732. // canceled.
  5733. func (c *FoldersLogsDeleteCall) Context(ctx context.Context) *FoldersLogsDeleteCall {
  5734. c.ctx_ = ctx
  5735. return c
  5736. }
  5737. // Header returns an http.Header that can be modified by the caller to
  5738. // add HTTP headers to the request.
  5739. func (c *FoldersLogsDeleteCall) Header() http.Header {
  5740. if c.header_ == nil {
  5741. c.header_ = make(http.Header)
  5742. }
  5743. return c.header_
  5744. }
  5745. func (c *FoldersLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5746. reqHeaders := make(http.Header)
  5747. for k, v := range c.header_ {
  5748. reqHeaders[k] = v
  5749. }
  5750. reqHeaders.Set("User-Agent", c.s.userAgent())
  5751. var body io.Reader = nil
  5752. c.urlParams_.Set("alt", alt)
  5753. c.urlParams_.Set("prettyPrint", "false")
  5754. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  5755. urls += "?" + c.urlParams_.Encode()
  5756. req, err := http.NewRequest("DELETE", urls, body)
  5757. if err != nil {
  5758. return nil, err
  5759. }
  5760. req.Header = reqHeaders
  5761. googleapi.Expand(req.URL, map[string]string{
  5762. "logName": c.logName,
  5763. })
  5764. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5765. }
  5766. // Do executes the "logging.folders.logs.delete" call.
  5767. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5768. // code is an error. Response headers are in either
  5769. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5770. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5771. // check whether the returned error was because http.StatusNotModified
  5772. // was returned.
  5773. func (c *FoldersLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5774. gensupport.SetOptions(c.urlParams_, opts...)
  5775. res, err := c.doRequest("json")
  5776. if res != nil && res.StatusCode == http.StatusNotModified {
  5777. if res.Body != nil {
  5778. res.Body.Close()
  5779. }
  5780. return nil, &googleapi.Error{
  5781. Code: res.StatusCode,
  5782. Header: res.Header,
  5783. }
  5784. }
  5785. if err != nil {
  5786. return nil, err
  5787. }
  5788. defer googleapi.CloseBody(res)
  5789. if err := googleapi.CheckResponse(res); err != nil {
  5790. return nil, err
  5791. }
  5792. ret := &Empty{
  5793. ServerResponse: googleapi.ServerResponse{
  5794. Header: res.Header,
  5795. HTTPStatusCode: res.StatusCode,
  5796. },
  5797. }
  5798. target := &ret
  5799. if err := gensupport.DecodeResponse(target, res); err != nil {
  5800. return nil, err
  5801. }
  5802. return ret, nil
  5803. // {
  5804. // "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.",
  5805. // "flatPath": "v2/folders/{foldersId}/logs/{logsId}",
  5806. // "httpMethod": "DELETE",
  5807. // "id": "logging.folders.logs.delete",
  5808. // "parameterOrder": [
  5809. // "logName"
  5810. // ],
  5811. // "parameters": {
  5812. // "logName": {
  5813. // "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.",
  5814. // "location": "path",
  5815. // "pattern": "^folders/[^/]+/logs/[^/]+$",
  5816. // "required": true,
  5817. // "type": "string"
  5818. // }
  5819. // },
  5820. // "path": "v2/{+logName}",
  5821. // "response": {
  5822. // "$ref": "Empty"
  5823. // },
  5824. // "scopes": [
  5825. // "https://www.googleapis.com/auth/cloud-platform",
  5826. // "https://www.googleapis.com/auth/logging.admin"
  5827. // ]
  5828. // }
  5829. }
  5830. // method id "logging.folders.logs.list":
  5831. type FoldersLogsListCall struct {
  5832. s *Service
  5833. parent string
  5834. urlParams_ gensupport.URLParams
  5835. ifNoneMatch_ string
  5836. ctx_ context.Context
  5837. header_ http.Header
  5838. }
  5839. // List: Lists the logs in projects, organizations, folders, or billing
  5840. // accounts. Only logs that have entries are listed.
  5841. func (r *FoldersLogsService) List(parent string) *FoldersLogsListCall {
  5842. c := &FoldersLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5843. c.parent = parent
  5844. return c
  5845. }
  5846. // PageSize sets the optional parameter "pageSize": The maximum number
  5847. // of results to return from this request. Non-positive values are
  5848. // ignored. The presence of nextPageToken in the response indicates that
  5849. // more results might be available.
  5850. func (c *FoldersLogsListCall) PageSize(pageSize int64) *FoldersLogsListCall {
  5851. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5852. return c
  5853. }
  5854. // PageToken sets the optional parameter "pageToken": If present, then
  5855. // retrieve the next batch of results from the preceding call to this
  5856. // method. pageToken must be the value of nextPageToken from the
  5857. // previous response. The values of other method parameters should be
  5858. // identical to those in the previous call.
  5859. func (c *FoldersLogsListCall) PageToken(pageToken string) *FoldersLogsListCall {
  5860. c.urlParams_.Set("pageToken", pageToken)
  5861. return c
  5862. }
  5863. // Fields allows partial responses to be retrieved. See
  5864. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5865. // for more information.
  5866. func (c *FoldersLogsListCall) Fields(s ...googleapi.Field) *FoldersLogsListCall {
  5867. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5868. return c
  5869. }
  5870. // IfNoneMatch sets the optional parameter which makes the operation
  5871. // fail if the object's ETag matches the given value. This is useful for
  5872. // getting updates only after the object has changed since the last
  5873. // request. Use googleapi.IsNotModified to check whether the response
  5874. // error from Do is the result of In-None-Match.
  5875. func (c *FoldersLogsListCall) IfNoneMatch(entityTag string) *FoldersLogsListCall {
  5876. c.ifNoneMatch_ = entityTag
  5877. return c
  5878. }
  5879. // Context sets the context to be used in this call's Do method. Any
  5880. // pending HTTP request will be aborted if the provided context is
  5881. // canceled.
  5882. func (c *FoldersLogsListCall) Context(ctx context.Context) *FoldersLogsListCall {
  5883. c.ctx_ = ctx
  5884. return c
  5885. }
  5886. // Header returns an http.Header that can be modified by the caller to
  5887. // add HTTP headers to the request.
  5888. func (c *FoldersLogsListCall) Header() http.Header {
  5889. if c.header_ == nil {
  5890. c.header_ = make(http.Header)
  5891. }
  5892. return c.header_
  5893. }
  5894. func (c *FoldersLogsListCall) doRequest(alt string) (*http.Response, error) {
  5895. reqHeaders := make(http.Header)
  5896. for k, v := range c.header_ {
  5897. reqHeaders[k] = v
  5898. }
  5899. reqHeaders.Set("User-Agent", c.s.userAgent())
  5900. if c.ifNoneMatch_ != "" {
  5901. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5902. }
  5903. var body io.Reader = nil
  5904. c.urlParams_.Set("alt", alt)
  5905. c.urlParams_.Set("prettyPrint", "false")
  5906. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  5907. urls += "?" + c.urlParams_.Encode()
  5908. req, err := http.NewRequest("GET", urls, body)
  5909. if err != nil {
  5910. return nil, err
  5911. }
  5912. req.Header = reqHeaders
  5913. googleapi.Expand(req.URL, map[string]string{
  5914. "parent": c.parent,
  5915. })
  5916. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5917. }
  5918. // Do executes the "logging.folders.logs.list" call.
  5919. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  5920. // non-2xx status code is an error. Response headers are in either
  5921. // *ListLogsResponse.ServerResponse.Header or (if a response was
  5922. // returned at all) in error.(*googleapi.Error).Header. Use
  5923. // googleapi.IsNotModified to check whether the returned error was
  5924. // because http.StatusNotModified was returned.
  5925. func (c *FoldersLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  5926. gensupport.SetOptions(c.urlParams_, opts...)
  5927. res, err := c.doRequest("json")
  5928. if res != nil && res.StatusCode == http.StatusNotModified {
  5929. if res.Body != nil {
  5930. res.Body.Close()
  5931. }
  5932. return nil, &googleapi.Error{
  5933. Code: res.StatusCode,
  5934. Header: res.Header,
  5935. }
  5936. }
  5937. if err != nil {
  5938. return nil, err
  5939. }
  5940. defer googleapi.CloseBody(res)
  5941. if err := googleapi.CheckResponse(res); err != nil {
  5942. return nil, err
  5943. }
  5944. ret := &ListLogsResponse{
  5945. ServerResponse: googleapi.ServerResponse{
  5946. Header: res.Header,
  5947. HTTPStatusCode: res.StatusCode,
  5948. },
  5949. }
  5950. target := &ret
  5951. if err := gensupport.DecodeResponse(target, res); err != nil {
  5952. return nil, err
  5953. }
  5954. return ret, nil
  5955. // {
  5956. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  5957. // "flatPath": "v2/folders/{foldersId}/logs",
  5958. // "httpMethod": "GET",
  5959. // "id": "logging.folders.logs.list",
  5960. // "parameterOrder": [
  5961. // "parent"
  5962. // ],
  5963. // "parameters": {
  5964. // "pageSize": {
  5965. // "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.",
  5966. // "format": "int32",
  5967. // "location": "query",
  5968. // "type": "integer"
  5969. // },
  5970. // "pageToken": {
  5971. // "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.",
  5972. // "location": "query",
  5973. // "type": "string"
  5974. // },
  5975. // "parent": {
  5976. // "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",
  5977. // "location": "path",
  5978. // "pattern": "^folders/[^/]+$",
  5979. // "required": true,
  5980. // "type": "string"
  5981. // }
  5982. // },
  5983. // "path": "v2/{+parent}/logs",
  5984. // "response": {
  5985. // "$ref": "ListLogsResponse"
  5986. // },
  5987. // "scopes": [
  5988. // "https://www.googleapis.com/auth/cloud-platform",
  5989. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5990. // "https://www.googleapis.com/auth/logging.admin",
  5991. // "https://www.googleapis.com/auth/logging.read"
  5992. // ]
  5993. // }
  5994. }
  5995. // Pages invokes f for each page of results.
  5996. // A non-nil error returned from f will halt the iteration.
  5997. // The provided context supersedes any context provided to the Context method.
  5998. func (c *FoldersLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  5999. c.ctx_ = ctx
  6000. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6001. for {
  6002. x, err := c.Do()
  6003. if err != nil {
  6004. return err
  6005. }
  6006. if err := f(x); err != nil {
  6007. return err
  6008. }
  6009. if x.NextPageToken == "" {
  6010. return nil
  6011. }
  6012. c.PageToken(x.NextPageToken)
  6013. }
  6014. }
  6015. // method id "logging.folders.sinks.create":
  6016. type FoldersSinksCreateCall struct {
  6017. s *Service
  6018. parent string
  6019. logsink *LogSink
  6020. urlParams_ gensupport.URLParams
  6021. ctx_ context.Context
  6022. header_ http.Header
  6023. }
  6024. // Create: Creates a sink that exports specified log entries to a
  6025. // destination. The export of newly-ingested log entries begins
  6026. // immediately, unless the sink's writer_identity is not permitted to
  6027. // write to the destination. A sink can export log entries only from the
  6028. // resource owning the sink.
  6029. func (r *FoldersSinksService) Create(parent string, logsink *LogSink) *FoldersSinksCreateCall {
  6030. c := &FoldersSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6031. c.parent = parent
  6032. c.logsink = logsink
  6033. return c
  6034. }
  6035. // UniqueWriterIdentity sets the optional parameter
  6036. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  6037. // as writer_identity in the new sink. If this value is omitted or set
  6038. // to false, and if the sink's parent is a project, then the value
  6039. // returned as writer_identity is the same group or service account used
  6040. // by Logging before the addition of writer identities to this API. The
  6041. // sink's destination must be in the same project as the sink itself.If
  6042. // this field is set to true, or if the sink is owned by a non-project
  6043. // resource such as an organization, then the value of writer_identity
  6044. // will be a unique service account used only for exports from the new
  6045. // sink. For more information, see writer_identity in LogSink.
  6046. func (c *FoldersSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *FoldersSinksCreateCall {
  6047. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  6048. return c
  6049. }
  6050. // Fields allows partial responses to be retrieved. See
  6051. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6052. // for more information.
  6053. func (c *FoldersSinksCreateCall) Fields(s ...googleapi.Field) *FoldersSinksCreateCall {
  6054. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6055. return c
  6056. }
  6057. // Context sets the context to be used in this call's Do method. Any
  6058. // pending HTTP request will be aborted if the provided context is
  6059. // canceled.
  6060. func (c *FoldersSinksCreateCall) Context(ctx context.Context) *FoldersSinksCreateCall {
  6061. c.ctx_ = ctx
  6062. return c
  6063. }
  6064. // Header returns an http.Header that can be modified by the caller to
  6065. // add HTTP headers to the request.
  6066. func (c *FoldersSinksCreateCall) Header() http.Header {
  6067. if c.header_ == nil {
  6068. c.header_ = make(http.Header)
  6069. }
  6070. return c.header_
  6071. }
  6072. func (c *FoldersSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  6073. reqHeaders := make(http.Header)
  6074. for k, v := range c.header_ {
  6075. reqHeaders[k] = v
  6076. }
  6077. reqHeaders.Set("User-Agent", c.s.userAgent())
  6078. var body io.Reader = nil
  6079. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  6080. if err != nil {
  6081. return nil, err
  6082. }
  6083. reqHeaders.Set("Content-Type", "application/json")
  6084. c.urlParams_.Set("alt", alt)
  6085. c.urlParams_.Set("prettyPrint", "false")
  6086. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  6087. urls += "?" + c.urlParams_.Encode()
  6088. req, err := http.NewRequest("POST", urls, body)
  6089. if err != nil {
  6090. return nil, err
  6091. }
  6092. req.Header = reqHeaders
  6093. googleapi.Expand(req.URL, map[string]string{
  6094. "parent": c.parent,
  6095. })
  6096. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6097. }
  6098. // Do executes the "logging.folders.sinks.create" call.
  6099. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  6100. // code is an error. Response headers are in either
  6101. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  6102. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6103. // check whether the returned error was because http.StatusNotModified
  6104. // was returned.
  6105. func (c *FoldersSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  6106. gensupport.SetOptions(c.urlParams_, opts...)
  6107. res, err := c.doRequest("json")
  6108. if res != nil && res.StatusCode == http.StatusNotModified {
  6109. if res.Body != nil {
  6110. res.Body.Close()
  6111. }
  6112. return nil, &googleapi.Error{
  6113. Code: res.StatusCode,
  6114. Header: res.Header,
  6115. }
  6116. }
  6117. if err != nil {
  6118. return nil, err
  6119. }
  6120. defer googleapi.CloseBody(res)
  6121. if err := googleapi.CheckResponse(res); err != nil {
  6122. return nil, err
  6123. }
  6124. ret := &LogSink{
  6125. ServerResponse: googleapi.ServerResponse{
  6126. Header: res.Header,
  6127. HTTPStatusCode: res.StatusCode,
  6128. },
  6129. }
  6130. target := &ret
  6131. if err := gensupport.DecodeResponse(target, res); err != nil {
  6132. return nil, err
  6133. }
  6134. return ret, nil
  6135. // {
  6136. // "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.",
  6137. // "flatPath": "v2/folders/{foldersId}/sinks",
  6138. // "httpMethod": "POST",
  6139. // "id": "logging.folders.sinks.create",
  6140. // "parameterOrder": [
  6141. // "parent"
  6142. // ],
  6143. // "parameters": {
  6144. // "parent": {
  6145. // "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\".",
  6146. // "location": "path",
  6147. // "pattern": "^folders/[^/]+$",
  6148. // "required": true,
  6149. // "type": "string"
  6150. // },
  6151. // "uniqueWriterIdentity": {
  6152. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  6153. // "location": "query",
  6154. // "type": "boolean"
  6155. // }
  6156. // },
  6157. // "path": "v2/{+parent}/sinks",
  6158. // "request": {
  6159. // "$ref": "LogSink"
  6160. // },
  6161. // "response": {
  6162. // "$ref": "LogSink"
  6163. // },
  6164. // "scopes": [
  6165. // "https://www.googleapis.com/auth/cloud-platform",
  6166. // "https://www.googleapis.com/auth/logging.admin"
  6167. // ]
  6168. // }
  6169. }
  6170. // method id "logging.folders.sinks.delete":
  6171. type FoldersSinksDeleteCall struct {
  6172. s *Service
  6173. sinkNameid string
  6174. urlParams_ gensupport.URLParams
  6175. ctx_ context.Context
  6176. header_ http.Header
  6177. }
  6178. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  6179. // then that service account is also deleted.
  6180. func (r *FoldersSinksService) Delete(sinkNameid string) *FoldersSinksDeleteCall {
  6181. c := &FoldersSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6182. c.sinkNameid = sinkNameid
  6183. return c
  6184. }
  6185. // Fields allows partial responses to be retrieved. See
  6186. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6187. // for more information.
  6188. func (c *FoldersSinksDeleteCall) Fields(s ...googleapi.Field) *FoldersSinksDeleteCall {
  6189. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6190. return c
  6191. }
  6192. // Context sets the context to be used in this call's Do method. Any
  6193. // pending HTTP request will be aborted if the provided context is
  6194. // canceled.
  6195. func (c *FoldersSinksDeleteCall) Context(ctx context.Context) *FoldersSinksDeleteCall {
  6196. c.ctx_ = ctx
  6197. return c
  6198. }
  6199. // Header returns an http.Header that can be modified by the caller to
  6200. // add HTTP headers to the request.
  6201. func (c *FoldersSinksDeleteCall) Header() http.Header {
  6202. if c.header_ == nil {
  6203. c.header_ = make(http.Header)
  6204. }
  6205. return c.header_
  6206. }
  6207. func (c *FoldersSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  6208. reqHeaders := make(http.Header)
  6209. for k, v := range c.header_ {
  6210. reqHeaders[k] = v
  6211. }
  6212. reqHeaders.Set("User-Agent", c.s.userAgent())
  6213. var body io.Reader = nil
  6214. c.urlParams_.Set("alt", alt)
  6215. c.urlParams_.Set("prettyPrint", "false")
  6216. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  6217. urls += "?" + c.urlParams_.Encode()
  6218. req, err := http.NewRequest("DELETE", urls, body)
  6219. if err != nil {
  6220. return nil, err
  6221. }
  6222. req.Header = reqHeaders
  6223. googleapi.Expand(req.URL, map[string]string{
  6224. "sinkName": c.sinkNameid,
  6225. })
  6226. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6227. }
  6228. // Do executes the "logging.folders.sinks.delete" call.
  6229. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6230. // code is an error. Response headers are in either
  6231. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6232. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6233. // check whether the returned error was because http.StatusNotModified
  6234. // was returned.
  6235. func (c *FoldersSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6236. gensupport.SetOptions(c.urlParams_, opts...)
  6237. res, err := c.doRequest("json")
  6238. if res != nil && res.StatusCode == http.StatusNotModified {
  6239. if res.Body != nil {
  6240. res.Body.Close()
  6241. }
  6242. return nil, &googleapi.Error{
  6243. Code: res.StatusCode,
  6244. Header: res.Header,
  6245. }
  6246. }
  6247. if err != nil {
  6248. return nil, err
  6249. }
  6250. defer googleapi.CloseBody(res)
  6251. if err := googleapi.CheckResponse(res); err != nil {
  6252. return nil, err
  6253. }
  6254. ret := &Empty{
  6255. ServerResponse: googleapi.ServerResponse{
  6256. Header: res.Header,
  6257. HTTPStatusCode: res.StatusCode,
  6258. },
  6259. }
  6260. target := &ret
  6261. if err := gensupport.DecodeResponse(target, res); err != nil {
  6262. return nil, err
  6263. }
  6264. return ret, nil
  6265. // {
  6266. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  6267. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6268. // "httpMethod": "DELETE",
  6269. // "id": "logging.folders.sinks.delete",
  6270. // "parameterOrder": [
  6271. // "sinkName"
  6272. // ],
  6273. // "parameters": {
  6274. // "sinkName": {
  6275. // "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\".",
  6276. // "location": "path",
  6277. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6278. // "required": true,
  6279. // "type": "string"
  6280. // }
  6281. // },
  6282. // "path": "v2/{+sinkName}",
  6283. // "response": {
  6284. // "$ref": "Empty"
  6285. // },
  6286. // "scopes": [
  6287. // "https://www.googleapis.com/auth/cloud-platform",
  6288. // "https://www.googleapis.com/auth/logging.admin"
  6289. // ]
  6290. // }
  6291. }
  6292. // method id "logging.folders.sinks.get":
  6293. type FoldersSinksGetCall struct {
  6294. s *Service
  6295. sinkName string
  6296. urlParams_ gensupport.URLParams
  6297. ifNoneMatch_ string
  6298. ctx_ context.Context
  6299. header_ http.Header
  6300. }
  6301. // Get: Gets a sink.
  6302. func (r *FoldersSinksService) Get(sinkName string) *FoldersSinksGetCall {
  6303. c := &FoldersSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6304. c.sinkName = sinkName
  6305. return c
  6306. }
  6307. // Fields allows partial responses to be retrieved. See
  6308. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6309. // for more information.
  6310. func (c *FoldersSinksGetCall) Fields(s ...googleapi.Field) *FoldersSinksGetCall {
  6311. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6312. return c
  6313. }
  6314. // IfNoneMatch sets the optional parameter which makes the operation
  6315. // fail if the object's ETag matches the given value. This is useful for
  6316. // getting updates only after the object has changed since the last
  6317. // request. Use googleapi.IsNotModified to check whether the response
  6318. // error from Do is the result of In-None-Match.
  6319. func (c *FoldersSinksGetCall) IfNoneMatch(entityTag string) *FoldersSinksGetCall {
  6320. c.ifNoneMatch_ = entityTag
  6321. return c
  6322. }
  6323. // Context sets the context to be used in this call's Do method. Any
  6324. // pending HTTP request will be aborted if the provided context is
  6325. // canceled.
  6326. func (c *FoldersSinksGetCall) Context(ctx context.Context) *FoldersSinksGetCall {
  6327. c.ctx_ = ctx
  6328. return c
  6329. }
  6330. // Header returns an http.Header that can be modified by the caller to
  6331. // add HTTP headers to the request.
  6332. func (c *FoldersSinksGetCall) Header() http.Header {
  6333. if c.header_ == nil {
  6334. c.header_ = make(http.Header)
  6335. }
  6336. return c.header_
  6337. }
  6338. func (c *FoldersSinksGetCall) doRequest(alt string) (*http.Response, error) {
  6339. reqHeaders := make(http.Header)
  6340. for k, v := range c.header_ {
  6341. reqHeaders[k] = v
  6342. }
  6343. reqHeaders.Set("User-Agent", c.s.userAgent())
  6344. if c.ifNoneMatch_ != "" {
  6345. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6346. }
  6347. var body io.Reader = nil
  6348. c.urlParams_.Set("alt", alt)
  6349. c.urlParams_.Set("prettyPrint", "false")
  6350. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  6351. urls += "?" + c.urlParams_.Encode()
  6352. req, err := http.NewRequest("GET", urls, body)
  6353. if err != nil {
  6354. return nil, err
  6355. }
  6356. req.Header = reqHeaders
  6357. googleapi.Expand(req.URL, map[string]string{
  6358. "sinkName": c.sinkName,
  6359. })
  6360. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6361. }
  6362. // Do executes the "logging.folders.sinks.get" call.
  6363. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  6364. // code is an error. Response headers are in either
  6365. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  6366. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6367. // check whether the returned error was because http.StatusNotModified
  6368. // was returned.
  6369. func (c *FoldersSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  6370. gensupport.SetOptions(c.urlParams_, opts...)
  6371. res, err := c.doRequest("json")
  6372. if res != nil && res.StatusCode == http.StatusNotModified {
  6373. if res.Body != nil {
  6374. res.Body.Close()
  6375. }
  6376. return nil, &googleapi.Error{
  6377. Code: res.StatusCode,
  6378. Header: res.Header,
  6379. }
  6380. }
  6381. if err != nil {
  6382. return nil, err
  6383. }
  6384. defer googleapi.CloseBody(res)
  6385. if err := googleapi.CheckResponse(res); err != nil {
  6386. return nil, err
  6387. }
  6388. ret := &LogSink{
  6389. ServerResponse: googleapi.ServerResponse{
  6390. Header: res.Header,
  6391. HTTPStatusCode: res.StatusCode,
  6392. },
  6393. }
  6394. target := &ret
  6395. if err := gensupport.DecodeResponse(target, res); err != nil {
  6396. return nil, err
  6397. }
  6398. return ret, nil
  6399. // {
  6400. // "description": "Gets a sink.",
  6401. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6402. // "httpMethod": "GET",
  6403. // "id": "logging.folders.sinks.get",
  6404. // "parameterOrder": [
  6405. // "sinkName"
  6406. // ],
  6407. // "parameters": {
  6408. // "sinkName": {
  6409. // "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\".",
  6410. // "location": "path",
  6411. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6412. // "required": true,
  6413. // "type": "string"
  6414. // }
  6415. // },
  6416. // "path": "v2/{+sinkName}",
  6417. // "response": {
  6418. // "$ref": "LogSink"
  6419. // },
  6420. // "scopes": [
  6421. // "https://www.googleapis.com/auth/cloud-platform",
  6422. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  6423. // "https://www.googleapis.com/auth/logging.admin",
  6424. // "https://www.googleapis.com/auth/logging.read"
  6425. // ]
  6426. // }
  6427. }
  6428. // method id "logging.folders.sinks.list":
  6429. type FoldersSinksListCall struct {
  6430. s *Service
  6431. parent string
  6432. urlParams_ gensupport.URLParams
  6433. ifNoneMatch_ string
  6434. ctx_ context.Context
  6435. header_ http.Header
  6436. }
  6437. // List: Lists sinks.
  6438. func (r *FoldersSinksService) List(parent string) *FoldersSinksListCall {
  6439. c := &FoldersSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6440. c.parent = parent
  6441. return c
  6442. }
  6443. // PageSize sets the optional parameter "pageSize": The maximum number
  6444. // of results to return from this request. Non-positive values are
  6445. // ignored. The presence of nextPageToken in the response indicates that
  6446. // more results might be available.
  6447. func (c *FoldersSinksListCall) PageSize(pageSize int64) *FoldersSinksListCall {
  6448. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6449. return c
  6450. }
  6451. // PageToken sets the optional parameter "pageToken": If present, then
  6452. // retrieve the next batch of results from the preceding call to this
  6453. // method. pageToken must be the value of nextPageToken from the
  6454. // previous response. The values of other method parameters should be
  6455. // identical to those in the previous call.
  6456. func (c *FoldersSinksListCall) PageToken(pageToken string) *FoldersSinksListCall {
  6457. c.urlParams_.Set("pageToken", pageToken)
  6458. return c
  6459. }
  6460. // Fields allows partial responses to be retrieved. See
  6461. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6462. // for more information.
  6463. func (c *FoldersSinksListCall) Fields(s ...googleapi.Field) *FoldersSinksListCall {
  6464. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6465. return c
  6466. }
  6467. // IfNoneMatch sets the optional parameter which makes the operation
  6468. // fail if the object's ETag matches the given value. This is useful for
  6469. // getting updates only after the object has changed since the last
  6470. // request. Use googleapi.IsNotModified to check whether the response
  6471. // error from Do is the result of In-None-Match.
  6472. func (c *FoldersSinksListCall) IfNoneMatch(entityTag string) *FoldersSinksListCall {
  6473. c.ifNoneMatch_ = entityTag
  6474. return c
  6475. }
  6476. // Context sets the context to be used in this call's Do method. Any
  6477. // pending HTTP request will be aborted if the provided context is
  6478. // canceled.
  6479. func (c *FoldersSinksListCall) Context(ctx context.Context) *FoldersSinksListCall {
  6480. c.ctx_ = ctx
  6481. return c
  6482. }
  6483. // Header returns an http.Header that can be modified by the caller to
  6484. // add HTTP headers to the request.
  6485. func (c *FoldersSinksListCall) Header() http.Header {
  6486. if c.header_ == nil {
  6487. c.header_ = make(http.Header)
  6488. }
  6489. return c.header_
  6490. }
  6491. func (c *FoldersSinksListCall) doRequest(alt string) (*http.Response, error) {
  6492. reqHeaders := make(http.Header)
  6493. for k, v := range c.header_ {
  6494. reqHeaders[k] = v
  6495. }
  6496. reqHeaders.Set("User-Agent", c.s.userAgent())
  6497. if c.ifNoneMatch_ != "" {
  6498. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6499. }
  6500. var body io.Reader = nil
  6501. c.urlParams_.Set("alt", alt)
  6502. c.urlParams_.Set("prettyPrint", "false")
  6503. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  6504. urls += "?" + c.urlParams_.Encode()
  6505. req, err := http.NewRequest("GET", urls, body)
  6506. if err != nil {
  6507. return nil, err
  6508. }
  6509. req.Header = reqHeaders
  6510. googleapi.Expand(req.URL, map[string]string{
  6511. "parent": c.parent,
  6512. })
  6513. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6514. }
  6515. // Do executes the "logging.folders.sinks.list" call.
  6516. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  6517. // non-2xx status code is an error. Response headers are in either
  6518. // *ListSinksResponse.ServerResponse.Header or (if a response was
  6519. // returned at all) in error.(*googleapi.Error).Header. Use
  6520. // googleapi.IsNotModified to check whether the returned error was
  6521. // because http.StatusNotModified was returned.
  6522. func (c *FoldersSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  6523. gensupport.SetOptions(c.urlParams_, opts...)
  6524. res, err := c.doRequest("json")
  6525. if res != nil && res.StatusCode == http.StatusNotModified {
  6526. if res.Body != nil {
  6527. res.Body.Close()
  6528. }
  6529. return nil, &googleapi.Error{
  6530. Code: res.StatusCode,
  6531. Header: res.Header,
  6532. }
  6533. }
  6534. if err != nil {
  6535. return nil, err
  6536. }
  6537. defer googleapi.CloseBody(res)
  6538. if err := googleapi.CheckResponse(res); err != nil {
  6539. return nil, err
  6540. }
  6541. ret := &ListSinksResponse{
  6542. ServerResponse: googleapi.ServerResponse{
  6543. Header: res.Header,
  6544. HTTPStatusCode: res.StatusCode,
  6545. },
  6546. }
  6547. target := &ret
  6548. if err := gensupport.DecodeResponse(target, res); err != nil {
  6549. return nil, err
  6550. }
  6551. return ret, nil
  6552. // {
  6553. // "description": "Lists sinks.",
  6554. // "flatPath": "v2/folders/{foldersId}/sinks",
  6555. // "httpMethod": "GET",
  6556. // "id": "logging.folders.sinks.list",
  6557. // "parameterOrder": [
  6558. // "parent"
  6559. // ],
  6560. // "parameters": {
  6561. // "pageSize": {
  6562. // "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.",
  6563. // "format": "int32",
  6564. // "location": "query",
  6565. // "type": "integer"
  6566. // },
  6567. // "pageToken": {
  6568. // "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.",
  6569. // "location": "query",
  6570. // "type": "string"
  6571. // },
  6572. // "parent": {
  6573. // "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",
  6574. // "location": "path",
  6575. // "pattern": "^folders/[^/]+$",
  6576. // "required": true,
  6577. // "type": "string"
  6578. // }
  6579. // },
  6580. // "path": "v2/{+parent}/sinks",
  6581. // "response": {
  6582. // "$ref": "ListSinksResponse"
  6583. // },
  6584. // "scopes": [
  6585. // "https://www.googleapis.com/auth/cloud-platform",
  6586. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  6587. // "https://www.googleapis.com/auth/logging.admin",
  6588. // "https://www.googleapis.com/auth/logging.read"
  6589. // ]
  6590. // }
  6591. }
  6592. // Pages invokes f for each page of results.
  6593. // A non-nil error returned from f will halt the iteration.
  6594. // The provided context supersedes any context provided to the Context method.
  6595. func (c *FoldersSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  6596. c.ctx_ = ctx
  6597. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6598. for {
  6599. x, err := c.Do()
  6600. if err != nil {
  6601. return err
  6602. }
  6603. if err := f(x); err != nil {
  6604. return err
  6605. }
  6606. if x.NextPageToken == "" {
  6607. return nil
  6608. }
  6609. c.PageToken(x.NextPageToken)
  6610. }
  6611. }
  6612. // method id "logging.folders.sinks.patch":
  6613. type FoldersSinksPatchCall struct {
  6614. s *Service
  6615. sinkNameid string
  6616. logsink *LogSink
  6617. urlParams_ gensupport.URLParams
  6618. ctx_ context.Context
  6619. header_ http.Header
  6620. }
  6621. // Patch: Updates a sink. This method replaces the following fields in
  6622. // the existing sink with values from the new sink: destination, and
  6623. // filter.The updated sink might also have a new writer_identity; see
  6624. // the unique_writer_identity field.
  6625. func (r *FoldersSinksService) Patch(sinkNameid string, logsink *LogSink) *FoldersSinksPatchCall {
  6626. c := &FoldersSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6627. c.sinkNameid = sinkNameid
  6628. c.logsink = logsink
  6629. return c
  6630. }
  6631. // UniqueWriterIdentity sets the optional parameter
  6632. // "uniqueWriterIdentity": See sinks.create for a description of this
  6633. // field. When updating a sink, the effect of this field on the value of
  6634. // writer_identity in the updated sink depends on both the old and new
  6635. // values of this field:
  6636. // If the old and new values of this field are both false or both true,
  6637. // then there is no change to the sink's writer_identity.
  6638. // If the old value is false and the new value is true, then
  6639. // writer_identity is changed to a unique service account.
  6640. // It is an error if the old value is true and the new value is set to
  6641. // false or defaulted to false.
  6642. func (c *FoldersSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *FoldersSinksPatchCall {
  6643. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  6644. return c
  6645. }
  6646. // UpdateMask sets the optional parameter "updateMask": Field mask that
  6647. // specifies the fields in sink that need an update. A sink field will
  6648. // be overwritten if, and only if, it is in the update mask. name and
  6649. // output only fields cannot be updated.An empty updateMask is
  6650. // temporarily treated as using the following mask for backwards
  6651. // compatibility purposes: destination,filter,includeChildren At some
  6652. // point in the future, behavior will be removed and specifying an empty
  6653. // updateMask will be an error.For a detailed FieldMask definition, see
  6654. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  6655. // updateMask=filter.
  6656. func (c *FoldersSinksPatchCall) UpdateMask(updateMask string) *FoldersSinksPatchCall {
  6657. c.urlParams_.Set("updateMask", updateMask)
  6658. return c
  6659. }
  6660. // Fields allows partial responses to be retrieved. See
  6661. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6662. // for more information.
  6663. func (c *FoldersSinksPatchCall) Fields(s ...googleapi.Field) *FoldersSinksPatchCall {
  6664. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6665. return c
  6666. }
  6667. // Context sets the context to be used in this call's Do method. Any
  6668. // pending HTTP request will be aborted if the provided context is
  6669. // canceled.
  6670. func (c *FoldersSinksPatchCall) Context(ctx context.Context) *FoldersSinksPatchCall {
  6671. c.ctx_ = ctx
  6672. return c
  6673. }
  6674. // Header returns an http.Header that can be modified by the caller to
  6675. // add HTTP headers to the request.
  6676. func (c *FoldersSinksPatchCall) Header() http.Header {
  6677. if c.header_ == nil {
  6678. c.header_ = make(http.Header)
  6679. }
  6680. return c.header_
  6681. }
  6682. func (c *FoldersSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  6683. reqHeaders := make(http.Header)
  6684. for k, v := range c.header_ {
  6685. reqHeaders[k] = v
  6686. }
  6687. reqHeaders.Set("User-Agent", c.s.userAgent())
  6688. var body io.Reader = nil
  6689. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  6690. if err != nil {
  6691. return nil, err
  6692. }
  6693. reqHeaders.Set("Content-Type", "application/json")
  6694. c.urlParams_.Set("alt", alt)
  6695. c.urlParams_.Set("prettyPrint", "false")
  6696. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  6697. urls += "?" + c.urlParams_.Encode()
  6698. req, err := http.NewRequest("PATCH", urls, body)
  6699. if err != nil {
  6700. return nil, err
  6701. }
  6702. req.Header = reqHeaders
  6703. googleapi.Expand(req.URL, map[string]string{
  6704. "sinkName": c.sinkNameid,
  6705. })
  6706. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6707. }
  6708. // Do executes the "logging.folders.sinks.patch" call.
  6709. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  6710. // code is an error. Response headers are in either
  6711. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  6712. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6713. // check whether the returned error was because http.StatusNotModified
  6714. // was returned.
  6715. func (c *FoldersSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  6716. gensupport.SetOptions(c.urlParams_, opts...)
  6717. res, err := c.doRequest("json")
  6718. if res != nil && res.StatusCode == http.StatusNotModified {
  6719. if res.Body != nil {
  6720. res.Body.Close()
  6721. }
  6722. return nil, &googleapi.Error{
  6723. Code: res.StatusCode,
  6724. Header: res.Header,
  6725. }
  6726. }
  6727. if err != nil {
  6728. return nil, err
  6729. }
  6730. defer googleapi.CloseBody(res)
  6731. if err := googleapi.CheckResponse(res); err != nil {
  6732. return nil, err
  6733. }
  6734. ret := &LogSink{
  6735. ServerResponse: googleapi.ServerResponse{
  6736. Header: res.Header,
  6737. HTTPStatusCode: res.StatusCode,
  6738. },
  6739. }
  6740. target := &ret
  6741. if err := gensupport.DecodeResponse(target, res); err != nil {
  6742. return nil, err
  6743. }
  6744. return ret, nil
  6745. // {
  6746. // "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.",
  6747. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6748. // "httpMethod": "PATCH",
  6749. // "id": "logging.folders.sinks.patch",
  6750. // "parameterOrder": [
  6751. // "sinkName"
  6752. // ],
  6753. // "parameters": {
  6754. // "sinkName": {
  6755. // "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\".",
  6756. // "location": "path",
  6757. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6758. // "required": true,
  6759. // "type": "string"
  6760. // },
  6761. // "uniqueWriterIdentity": {
  6762. // "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.",
  6763. // "location": "query",
  6764. // "type": "boolean"
  6765. // },
  6766. // "updateMask": {
  6767. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  6768. // "format": "google-fieldmask",
  6769. // "location": "query",
  6770. // "type": "string"
  6771. // }
  6772. // },
  6773. // "path": "v2/{+sinkName}",
  6774. // "request": {
  6775. // "$ref": "LogSink"
  6776. // },
  6777. // "response": {
  6778. // "$ref": "LogSink"
  6779. // },
  6780. // "scopes": [
  6781. // "https://www.googleapis.com/auth/cloud-platform",
  6782. // "https://www.googleapis.com/auth/logging.admin"
  6783. // ]
  6784. // }
  6785. }
  6786. // method id "logging.folders.sinks.update":
  6787. type FoldersSinksUpdateCall struct {
  6788. s *Service
  6789. sinkNameid string
  6790. logsink *LogSink
  6791. urlParams_ gensupport.URLParams
  6792. ctx_ context.Context
  6793. header_ http.Header
  6794. }
  6795. // Update: Updates a sink. This method replaces the following fields in
  6796. // the existing sink with values from the new sink: destination, and
  6797. // filter.The updated sink might also have a new writer_identity; see
  6798. // the unique_writer_identity field.
  6799. func (r *FoldersSinksService) Update(sinkNameid string, logsink *LogSink) *FoldersSinksUpdateCall {
  6800. c := &FoldersSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6801. c.sinkNameid = sinkNameid
  6802. c.logsink = logsink
  6803. return c
  6804. }
  6805. // UniqueWriterIdentity sets the optional parameter
  6806. // "uniqueWriterIdentity": See sinks.create for a description of this
  6807. // field. When updating a sink, the effect of this field on the value of
  6808. // writer_identity in the updated sink depends on both the old and new
  6809. // values of this field:
  6810. // If the old and new values of this field are both false or both true,
  6811. // then there is no change to the sink's writer_identity.
  6812. // If the old value is false and the new value is true, then
  6813. // writer_identity is changed to a unique service account.
  6814. // It is an error if the old value is true and the new value is set to
  6815. // false or defaulted to false.
  6816. func (c *FoldersSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *FoldersSinksUpdateCall {
  6817. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  6818. return c
  6819. }
  6820. // UpdateMask sets the optional parameter "updateMask": Field mask that
  6821. // specifies the fields in sink that need an update. A sink field will
  6822. // be overwritten if, and only if, it is in the update mask. name and
  6823. // output only fields cannot be updated.An empty updateMask is
  6824. // temporarily treated as using the following mask for backwards
  6825. // compatibility purposes: destination,filter,includeChildren At some
  6826. // point in the future, behavior will be removed and specifying an empty
  6827. // updateMask will be an error.For a detailed FieldMask definition, see
  6828. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  6829. // updateMask=filter.
  6830. func (c *FoldersSinksUpdateCall) UpdateMask(updateMask string) *FoldersSinksUpdateCall {
  6831. c.urlParams_.Set("updateMask", updateMask)
  6832. return c
  6833. }
  6834. // Fields allows partial responses to be retrieved. See
  6835. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6836. // for more information.
  6837. func (c *FoldersSinksUpdateCall) Fields(s ...googleapi.Field) *FoldersSinksUpdateCall {
  6838. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6839. return c
  6840. }
  6841. // Context sets the context to be used in this call's Do method. Any
  6842. // pending HTTP request will be aborted if the provided context is
  6843. // canceled.
  6844. func (c *FoldersSinksUpdateCall) Context(ctx context.Context) *FoldersSinksUpdateCall {
  6845. c.ctx_ = ctx
  6846. return c
  6847. }
  6848. // Header returns an http.Header that can be modified by the caller to
  6849. // add HTTP headers to the request.
  6850. func (c *FoldersSinksUpdateCall) Header() http.Header {
  6851. if c.header_ == nil {
  6852. c.header_ = make(http.Header)
  6853. }
  6854. return c.header_
  6855. }
  6856. func (c *FoldersSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  6857. reqHeaders := make(http.Header)
  6858. for k, v := range c.header_ {
  6859. reqHeaders[k] = v
  6860. }
  6861. reqHeaders.Set("User-Agent", c.s.userAgent())
  6862. var body io.Reader = nil
  6863. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  6864. if err != nil {
  6865. return nil, err
  6866. }
  6867. reqHeaders.Set("Content-Type", "application/json")
  6868. c.urlParams_.Set("alt", alt)
  6869. c.urlParams_.Set("prettyPrint", "false")
  6870. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  6871. urls += "?" + c.urlParams_.Encode()
  6872. req, err := http.NewRequest("PUT", urls, body)
  6873. if err != nil {
  6874. return nil, err
  6875. }
  6876. req.Header = reqHeaders
  6877. googleapi.Expand(req.URL, map[string]string{
  6878. "sinkName": c.sinkNameid,
  6879. })
  6880. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6881. }
  6882. // Do executes the "logging.folders.sinks.update" call.
  6883. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  6884. // code is an error. Response headers are in either
  6885. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  6886. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6887. // check whether the returned error was because http.StatusNotModified
  6888. // was returned.
  6889. func (c *FoldersSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  6890. gensupport.SetOptions(c.urlParams_, opts...)
  6891. res, err := c.doRequest("json")
  6892. if res != nil && res.StatusCode == http.StatusNotModified {
  6893. if res.Body != nil {
  6894. res.Body.Close()
  6895. }
  6896. return nil, &googleapi.Error{
  6897. Code: res.StatusCode,
  6898. Header: res.Header,
  6899. }
  6900. }
  6901. if err != nil {
  6902. return nil, err
  6903. }
  6904. defer googleapi.CloseBody(res)
  6905. if err := googleapi.CheckResponse(res); err != nil {
  6906. return nil, err
  6907. }
  6908. ret := &LogSink{
  6909. ServerResponse: googleapi.ServerResponse{
  6910. Header: res.Header,
  6911. HTTPStatusCode: res.StatusCode,
  6912. },
  6913. }
  6914. target := &ret
  6915. if err := gensupport.DecodeResponse(target, res); err != nil {
  6916. return nil, err
  6917. }
  6918. return ret, nil
  6919. // {
  6920. // "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.",
  6921. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6922. // "httpMethod": "PUT",
  6923. // "id": "logging.folders.sinks.update",
  6924. // "parameterOrder": [
  6925. // "sinkName"
  6926. // ],
  6927. // "parameters": {
  6928. // "sinkName": {
  6929. // "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\".",
  6930. // "location": "path",
  6931. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6932. // "required": true,
  6933. // "type": "string"
  6934. // },
  6935. // "uniqueWriterIdentity": {
  6936. // "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.",
  6937. // "location": "query",
  6938. // "type": "boolean"
  6939. // },
  6940. // "updateMask": {
  6941. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  6942. // "format": "google-fieldmask",
  6943. // "location": "query",
  6944. // "type": "string"
  6945. // }
  6946. // },
  6947. // "path": "v2/{+sinkName}",
  6948. // "request": {
  6949. // "$ref": "LogSink"
  6950. // },
  6951. // "response": {
  6952. // "$ref": "LogSink"
  6953. // },
  6954. // "scopes": [
  6955. // "https://www.googleapis.com/auth/cloud-platform",
  6956. // "https://www.googleapis.com/auth/logging.admin"
  6957. // ]
  6958. // }
  6959. }
  6960. // method id "logging.logs.delete":
  6961. type LogsDeleteCall struct {
  6962. s *Service
  6963. logName string
  6964. urlParams_ gensupport.URLParams
  6965. ctx_ context.Context
  6966. header_ http.Header
  6967. }
  6968. // Delete: Deletes all the log entries in a log. The log reappears if it
  6969. // receives new entries. Log entries written shortly before the delete
  6970. // operation might not be deleted.
  6971. func (r *LogsService) Delete(logName string) *LogsDeleteCall {
  6972. c := &LogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6973. c.logName = logName
  6974. return c
  6975. }
  6976. // Fields allows partial responses to be retrieved. See
  6977. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6978. // for more information.
  6979. func (c *LogsDeleteCall) Fields(s ...googleapi.Field) *LogsDeleteCall {
  6980. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6981. return c
  6982. }
  6983. // Context sets the context to be used in this call's Do method. Any
  6984. // pending HTTP request will be aborted if the provided context is
  6985. // canceled.
  6986. func (c *LogsDeleteCall) Context(ctx context.Context) *LogsDeleteCall {
  6987. c.ctx_ = ctx
  6988. return c
  6989. }
  6990. // Header returns an http.Header that can be modified by the caller to
  6991. // add HTTP headers to the request.
  6992. func (c *LogsDeleteCall) Header() http.Header {
  6993. if c.header_ == nil {
  6994. c.header_ = make(http.Header)
  6995. }
  6996. return c.header_
  6997. }
  6998. func (c *LogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6999. reqHeaders := make(http.Header)
  7000. for k, v := range c.header_ {
  7001. reqHeaders[k] = v
  7002. }
  7003. reqHeaders.Set("User-Agent", c.s.userAgent())
  7004. var body io.Reader = nil
  7005. c.urlParams_.Set("alt", alt)
  7006. c.urlParams_.Set("prettyPrint", "false")
  7007. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  7008. urls += "?" + c.urlParams_.Encode()
  7009. req, err := http.NewRequest("DELETE", urls, body)
  7010. if err != nil {
  7011. return nil, err
  7012. }
  7013. req.Header = reqHeaders
  7014. googleapi.Expand(req.URL, map[string]string{
  7015. "logName": c.logName,
  7016. })
  7017. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7018. }
  7019. // Do executes the "logging.logs.delete" call.
  7020. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7021. // code is an error. Response headers are in either
  7022. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7023. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7024. // check whether the returned error was because http.StatusNotModified
  7025. // was returned.
  7026. func (c *LogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7027. gensupport.SetOptions(c.urlParams_, opts...)
  7028. res, err := c.doRequest("json")
  7029. if res != nil && res.StatusCode == http.StatusNotModified {
  7030. if res.Body != nil {
  7031. res.Body.Close()
  7032. }
  7033. return nil, &googleapi.Error{
  7034. Code: res.StatusCode,
  7035. Header: res.Header,
  7036. }
  7037. }
  7038. if err != nil {
  7039. return nil, err
  7040. }
  7041. defer googleapi.CloseBody(res)
  7042. if err := googleapi.CheckResponse(res); err != nil {
  7043. return nil, err
  7044. }
  7045. ret := &Empty{
  7046. ServerResponse: googleapi.ServerResponse{
  7047. Header: res.Header,
  7048. HTTPStatusCode: res.StatusCode,
  7049. },
  7050. }
  7051. target := &ret
  7052. if err := gensupport.DecodeResponse(target, res); err != nil {
  7053. return nil, err
  7054. }
  7055. return ret, nil
  7056. // {
  7057. // "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.",
  7058. // "flatPath": "v2/{v2Id}/{v2Id1}/logs/{logsId}",
  7059. // "httpMethod": "DELETE",
  7060. // "id": "logging.logs.delete",
  7061. // "parameterOrder": [
  7062. // "logName"
  7063. // ],
  7064. // "parameters": {
  7065. // "logName": {
  7066. // "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.",
  7067. // "location": "path",
  7068. // "pattern": "^[^/]+/[^/]+/logs/[^/]+$",
  7069. // "required": true,
  7070. // "type": "string"
  7071. // }
  7072. // },
  7073. // "path": "v2/{+logName}",
  7074. // "response": {
  7075. // "$ref": "Empty"
  7076. // },
  7077. // "scopes": [
  7078. // "https://www.googleapis.com/auth/cloud-platform",
  7079. // "https://www.googleapis.com/auth/logging.admin"
  7080. // ]
  7081. // }
  7082. }
  7083. // method id "logging.logs.list":
  7084. type LogsListCall struct {
  7085. s *Service
  7086. parent string
  7087. urlParams_ gensupport.URLParams
  7088. ifNoneMatch_ string
  7089. ctx_ context.Context
  7090. header_ http.Header
  7091. }
  7092. // List: Lists the logs in projects, organizations, folders, or billing
  7093. // accounts. Only logs that have entries are listed.
  7094. func (r *LogsService) List(parent string) *LogsListCall {
  7095. c := &LogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7096. c.parent = parent
  7097. return c
  7098. }
  7099. // PageSize sets the optional parameter "pageSize": The maximum number
  7100. // of results to return from this request. Non-positive values are
  7101. // ignored. The presence of nextPageToken in the response indicates that
  7102. // more results might be available.
  7103. func (c *LogsListCall) PageSize(pageSize int64) *LogsListCall {
  7104. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7105. return c
  7106. }
  7107. // PageToken sets the optional parameter "pageToken": If present, then
  7108. // retrieve the next batch of results from the preceding call to this
  7109. // method. pageToken must be the value of nextPageToken from the
  7110. // previous response. The values of other method parameters should be
  7111. // identical to those in the previous call.
  7112. func (c *LogsListCall) PageToken(pageToken string) *LogsListCall {
  7113. c.urlParams_.Set("pageToken", pageToken)
  7114. return c
  7115. }
  7116. // Fields allows partial responses to be retrieved. See
  7117. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7118. // for more information.
  7119. func (c *LogsListCall) Fields(s ...googleapi.Field) *LogsListCall {
  7120. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7121. return c
  7122. }
  7123. // IfNoneMatch sets the optional parameter which makes the operation
  7124. // fail if the object's ETag matches the given value. This is useful for
  7125. // getting updates only after the object has changed since the last
  7126. // request. Use googleapi.IsNotModified to check whether the response
  7127. // error from Do is the result of In-None-Match.
  7128. func (c *LogsListCall) IfNoneMatch(entityTag string) *LogsListCall {
  7129. c.ifNoneMatch_ = entityTag
  7130. return c
  7131. }
  7132. // Context sets the context to be used in this call's Do method. Any
  7133. // pending HTTP request will be aborted if the provided context is
  7134. // canceled.
  7135. func (c *LogsListCall) Context(ctx context.Context) *LogsListCall {
  7136. c.ctx_ = ctx
  7137. return c
  7138. }
  7139. // Header returns an http.Header that can be modified by the caller to
  7140. // add HTTP headers to the request.
  7141. func (c *LogsListCall) Header() http.Header {
  7142. if c.header_ == nil {
  7143. c.header_ = make(http.Header)
  7144. }
  7145. return c.header_
  7146. }
  7147. func (c *LogsListCall) doRequest(alt string) (*http.Response, error) {
  7148. reqHeaders := make(http.Header)
  7149. for k, v := range c.header_ {
  7150. reqHeaders[k] = v
  7151. }
  7152. reqHeaders.Set("User-Agent", c.s.userAgent())
  7153. if c.ifNoneMatch_ != "" {
  7154. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7155. }
  7156. var body io.Reader = nil
  7157. c.urlParams_.Set("alt", alt)
  7158. c.urlParams_.Set("prettyPrint", "false")
  7159. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  7160. urls += "?" + c.urlParams_.Encode()
  7161. req, err := http.NewRequest("GET", urls, body)
  7162. if err != nil {
  7163. return nil, err
  7164. }
  7165. req.Header = reqHeaders
  7166. googleapi.Expand(req.URL, map[string]string{
  7167. "parent": c.parent,
  7168. })
  7169. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7170. }
  7171. // Do executes the "logging.logs.list" call.
  7172. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  7173. // non-2xx status code is an error. Response headers are in either
  7174. // *ListLogsResponse.ServerResponse.Header or (if a response was
  7175. // returned at all) in error.(*googleapi.Error).Header. Use
  7176. // googleapi.IsNotModified to check whether the returned error was
  7177. // because http.StatusNotModified was returned.
  7178. func (c *LogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  7179. gensupport.SetOptions(c.urlParams_, opts...)
  7180. res, err := c.doRequest("json")
  7181. if res != nil && res.StatusCode == http.StatusNotModified {
  7182. if res.Body != nil {
  7183. res.Body.Close()
  7184. }
  7185. return nil, &googleapi.Error{
  7186. Code: res.StatusCode,
  7187. Header: res.Header,
  7188. }
  7189. }
  7190. if err != nil {
  7191. return nil, err
  7192. }
  7193. defer googleapi.CloseBody(res)
  7194. if err := googleapi.CheckResponse(res); err != nil {
  7195. return nil, err
  7196. }
  7197. ret := &ListLogsResponse{
  7198. ServerResponse: googleapi.ServerResponse{
  7199. Header: res.Header,
  7200. HTTPStatusCode: res.StatusCode,
  7201. },
  7202. }
  7203. target := &ret
  7204. if err := gensupport.DecodeResponse(target, res); err != nil {
  7205. return nil, err
  7206. }
  7207. return ret, nil
  7208. // {
  7209. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  7210. // "flatPath": "v2/{v2Id}/{v2Id1}/logs",
  7211. // "httpMethod": "GET",
  7212. // "id": "logging.logs.list",
  7213. // "parameterOrder": [
  7214. // "parent"
  7215. // ],
  7216. // "parameters": {
  7217. // "pageSize": {
  7218. // "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.",
  7219. // "format": "int32",
  7220. // "location": "query",
  7221. // "type": "integer"
  7222. // },
  7223. // "pageToken": {
  7224. // "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.",
  7225. // "location": "query",
  7226. // "type": "string"
  7227. // },
  7228. // "parent": {
  7229. // "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",
  7230. // "location": "path",
  7231. // "pattern": "^[^/]+/[^/]+$",
  7232. // "required": true,
  7233. // "type": "string"
  7234. // }
  7235. // },
  7236. // "path": "v2/{+parent}/logs",
  7237. // "response": {
  7238. // "$ref": "ListLogsResponse"
  7239. // },
  7240. // "scopes": [
  7241. // "https://www.googleapis.com/auth/cloud-platform",
  7242. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7243. // "https://www.googleapis.com/auth/logging.admin",
  7244. // "https://www.googleapis.com/auth/logging.read"
  7245. // ]
  7246. // }
  7247. }
  7248. // Pages invokes f for each page of results.
  7249. // A non-nil error returned from f will halt the iteration.
  7250. // The provided context supersedes any context provided to the Context method.
  7251. func (c *LogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  7252. c.ctx_ = ctx
  7253. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7254. for {
  7255. x, err := c.Do()
  7256. if err != nil {
  7257. return err
  7258. }
  7259. if err := f(x); err != nil {
  7260. return err
  7261. }
  7262. if x.NextPageToken == "" {
  7263. return nil
  7264. }
  7265. c.PageToken(x.NextPageToken)
  7266. }
  7267. }
  7268. // method id "logging.monitoredResourceDescriptors.list":
  7269. type MonitoredResourceDescriptorsListCall struct {
  7270. s *Service
  7271. urlParams_ gensupport.URLParams
  7272. ifNoneMatch_ string
  7273. ctx_ context.Context
  7274. header_ http.Header
  7275. }
  7276. // List: Lists the descriptors for monitored resource types used by
  7277. // Logging.
  7278. func (r *MonitoredResourceDescriptorsService) List() *MonitoredResourceDescriptorsListCall {
  7279. c := &MonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7280. return c
  7281. }
  7282. // PageSize sets the optional parameter "pageSize": The maximum number
  7283. // of results to return from this request. Non-positive values are
  7284. // ignored. The presence of nextPageToken in the response indicates that
  7285. // more results might be available.
  7286. func (c *MonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *MonitoredResourceDescriptorsListCall {
  7287. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7288. return c
  7289. }
  7290. // PageToken sets the optional parameter "pageToken": If present, then
  7291. // retrieve the next batch of results from the preceding call to this
  7292. // method. pageToken must be the value of nextPageToken from the
  7293. // previous response. The values of other method parameters should be
  7294. // identical to those in the previous call.
  7295. func (c *MonitoredResourceDescriptorsListCall) PageToken(pageToken string) *MonitoredResourceDescriptorsListCall {
  7296. c.urlParams_.Set("pageToken", pageToken)
  7297. return c
  7298. }
  7299. // Fields allows partial responses to be retrieved. See
  7300. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7301. // for more information.
  7302. func (c *MonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *MonitoredResourceDescriptorsListCall {
  7303. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7304. return c
  7305. }
  7306. // IfNoneMatch sets the optional parameter which makes the operation
  7307. // fail if the object's ETag matches the given value. This is useful for
  7308. // getting updates only after the object has changed since the last
  7309. // request. Use googleapi.IsNotModified to check whether the response
  7310. // error from Do is the result of In-None-Match.
  7311. func (c *MonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *MonitoredResourceDescriptorsListCall {
  7312. c.ifNoneMatch_ = entityTag
  7313. return c
  7314. }
  7315. // Context sets the context to be used in this call's Do method. Any
  7316. // pending HTTP request will be aborted if the provided context is
  7317. // canceled.
  7318. func (c *MonitoredResourceDescriptorsListCall) Context(ctx context.Context) *MonitoredResourceDescriptorsListCall {
  7319. c.ctx_ = ctx
  7320. return c
  7321. }
  7322. // Header returns an http.Header that can be modified by the caller to
  7323. // add HTTP headers to the request.
  7324. func (c *MonitoredResourceDescriptorsListCall) Header() http.Header {
  7325. if c.header_ == nil {
  7326. c.header_ = make(http.Header)
  7327. }
  7328. return c.header_
  7329. }
  7330. func (c *MonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  7331. reqHeaders := make(http.Header)
  7332. for k, v := range c.header_ {
  7333. reqHeaders[k] = v
  7334. }
  7335. reqHeaders.Set("User-Agent", c.s.userAgent())
  7336. if c.ifNoneMatch_ != "" {
  7337. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7338. }
  7339. var body io.Reader = nil
  7340. c.urlParams_.Set("alt", alt)
  7341. c.urlParams_.Set("prettyPrint", "false")
  7342. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/monitoredResourceDescriptors")
  7343. urls += "?" + c.urlParams_.Encode()
  7344. req, err := http.NewRequest("GET", urls, body)
  7345. if err != nil {
  7346. return nil, err
  7347. }
  7348. req.Header = reqHeaders
  7349. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7350. }
  7351. // Do executes the "logging.monitoredResourceDescriptors.list" call.
  7352. // Exactly one of *ListMonitoredResourceDescriptorsResponse or error
  7353. // will be non-nil. Any non-2xx status code is an error. Response
  7354. // headers are in either
  7355. // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or
  7356. // (if a response was returned at all) in
  7357. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7358. // whether the returned error was because http.StatusNotModified was
  7359. // returned.
  7360. func (c *MonitoredResourceDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
  7361. gensupport.SetOptions(c.urlParams_, opts...)
  7362. res, err := c.doRequest("json")
  7363. if res != nil && res.StatusCode == http.StatusNotModified {
  7364. if res.Body != nil {
  7365. res.Body.Close()
  7366. }
  7367. return nil, &googleapi.Error{
  7368. Code: res.StatusCode,
  7369. Header: res.Header,
  7370. }
  7371. }
  7372. if err != nil {
  7373. return nil, err
  7374. }
  7375. defer googleapi.CloseBody(res)
  7376. if err := googleapi.CheckResponse(res); err != nil {
  7377. return nil, err
  7378. }
  7379. ret := &ListMonitoredResourceDescriptorsResponse{
  7380. ServerResponse: googleapi.ServerResponse{
  7381. Header: res.Header,
  7382. HTTPStatusCode: res.StatusCode,
  7383. },
  7384. }
  7385. target := &ret
  7386. if err := gensupport.DecodeResponse(target, res); err != nil {
  7387. return nil, err
  7388. }
  7389. return ret, nil
  7390. // {
  7391. // "description": "Lists the descriptors for monitored resource types used by Logging.",
  7392. // "flatPath": "v2/monitoredResourceDescriptors",
  7393. // "httpMethod": "GET",
  7394. // "id": "logging.monitoredResourceDescriptors.list",
  7395. // "parameterOrder": [],
  7396. // "parameters": {
  7397. // "pageSize": {
  7398. // "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.",
  7399. // "format": "int32",
  7400. // "location": "query",
  7401. // "type": "integer"
  7402. // },
  7403. // "pageToken": {
  7404. // "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.",
  7405. // "location": "query",
  7406. // "type": "string"
  7407. // }
  7408. // },
  7409. // "path": "v2/monitoredResourceDescriptors",
  7410. // "response": {
  7411. // "$ref": "ListMonitoredResourceDescriptorsResponse"
  7412. // },
  7413. // "scopes": [
  7414. // "https://www.googleapis.com/auth/cloud-platform",
  7415. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7416. // "https://www.googleapis.com/auth/logging.admin",
  7417. // "https://www.googleapis.com/auth/logging.read"
  7418. // ]
  7419. // }
  7420. }
  7421. // Pages invokes f for each page of results.
  7422. // A non-nil error returned from f will halt the iteration.
  7423. // The provided context supersedes any context provided to the Context method.
  7424. func (c *MonitoredResourceDescriptorsListCall) Pages(ctx context.Context, f func(*ListMonitoredResourceDescriptorsResponse) error) error {
  7425. c.ctx_ = ctx
  7426. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7427. for {
  7428. x, err := c.Do()
  7429. if err != nil {
  7430. return err
  7431. }
  7432. if err := f(x); err != nil {
  7433. return err
  7434. }
  7435. if x.NextPageToken == "" {
  7436. return nil
  7437. }
  7438. c.PageToken(x.NextPageToken)
  7439. }
  7440. }
  7441. // method id "logging.organizations.exclusions.create":
  7442. type OrganizationsExclusionsCreateCall struct {
  7443. s *Service
  7444. parent string
  7445. logexclusion *LogExclusion
  7446. urlParams_ gensupport.URLParams
  7447. ctx_ context.Context
  7448. header_ http.Header
  7449. }
  7450. // Create: Creates a new exclusion in a specified parent resource. Only
  7451. // log entries belonging to that resource can be excluded. You can have
  7452. // up to 10 exclusions in a resource.
  7453. func (r *OrganizationsExclusionsService) Create(parent string, logexclusion *LogExclusion) *OrganizationsExclusionsCreateCall {
  7454. c := &OrganizationsExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7455. c.parent = parent
  7456. c.logexclusion = logexclusion
  7457. return c
  7458. }
  7459. // Fields allows partial responses to be retrieved. See
  7460. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7461. // for more information.
  7462. func (c *OrganizationsExclusionsCreateCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsCreateCall {
  7463. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7464. return c
  7465. }
  7466. // Context sets the context to be used in this call's Do method. Any
  7467. // pending HTTP request will be aborted if the provided context is
  7468. // canceled.
  7469. func (c *OrganizationsExclusionsCreateCall) Context(ctx context.Context) *OrganizationsExclusionsCreateCall {
  7470. c.ctx_ = ctx
  7471. return c
  7472. }
  7473. // Header returns an http.Header that can be modified by the caller to
  7474. // add HTTP headers to the request.
  7475. func (c *OrganizationsExclusionsCreateCall) Header() http.Header {
  7476. if c.header_ == nil {
  7477. c.header_ = make(http.Header)
  7478. }
  7479. return c.header_
  7480. }
  7481. func (c *OrganizationsExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  7482. reqHeaders := make(http.Header)
  7483. for k, v := range c.header_ {
  7484. reqHeaders[k] = v
  7485. }
  7486. reqHeaders.Set("User-Agent", c.s.userAgent())
  7487. var body io.Reader = nil
  7488. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  7489. if err != nil {
  7490. return nil, err
  7491. }
  7492. reqHeaders.Set("Content-Type", "application/json")
  7493. c.urlParams_.Set("alt", alt)
  7494. c.urlParams_.Set("prettyPrint", "false")
  7495. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  7496. urls += "?" + c.urlParams_.Encode()
  7497. req, err := http.NewRequest("POST", urls, body)
  7498. if err != nil {
  7499. return nil, err
  7500. }
  7501. req.Header = reqHeaders
  7502. googleapi.Expand(req.URL, map[string]string{
  7503. "parent": c.parent,
  7504. })
  7505. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7506. }
  7507. // Do executes the "logging.organizations.exclusions.create" call.
  7508. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  7509. // status code is an error. Response headers are in either
  7510. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  7511. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7512. // to check whether the returned error was because
  7513. // http.StatusNotModified was returned.
  7514. func (c *OrganizationsExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  7515. gensupport.SetOptions(c.urlParams_, opts...)
  7516. res, err := c.doRequest("json")
  7517. if res != nil && res.StatusCode == http.StatusNotModified {
  7518. if res.Body != nil {
  7519. res.Body.Close()
  7520. }
  7521. return nil, &googleapi.Error{
  7522. Code: res.StatusCode,
  7523. Header: res.Header,
  7524. }
  7525. }
  7526. if err != nil {
  7527. return nil, err
  7528. }
  7529. defer googleapi.CloseBody(res)
  7530. if err := googleapi.CheckResponse(res); err != nil {
  7531. return nil, err
  7532. }
  7533. ret := &LogExclusion{
  7534. ServerResponse: googleapi.ServerResponse{
  7535. Header: res.Header,
  7536. HTTPStatusCode: res.StatusCode,
  7537. },
  7538. }
  7539. target := &ret
  7540. if err := gensupport.DecodeResponse(target, res); err != nil {
  7541. return nil, err
  7542. }
  7543. return ret, nil
  7544. // {
  7545. // "description": "Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.",
  7546. // "flatPath": "v2/organizations/{organizationsId}/exclusions",
  7547. // "httpMethod": "POST",
  7548. // "id": "logging.organizations.exclusions.create",
  7549. // "parameterOrder": [
  7550. // "parent"
  7551. // ],
  7552. // "parameters": {
  7553. // "parent": {
  7554. // "description": "Required. The parent resource in which to create the exclusion:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
  7555. // "location": "path",
  7556. // "pattern": "^organizations/[^/]+$",
  7557. // "required": true,
  7558. // "type": "string"
  7559. // }
  7560. // },
  7561. // "path": "v2/{+parent}/exclusions",
  7562. // "request": {
  7563. // "$ref": "LogExclusion"
  7564. // },
  7565. // "response": {
  7566. // "$ref": "LogExclusion"
  7567. // },
  7568. // "scopes": [
  7569. // "https://www.googleapis.com/auth/cloud-platform",
  7570. // "https://www.googleapis.com/auth/logging.admin"
  7571. // ]
  7572. // }
  7573. }
  7574. // method id "logging.organizations.exclusions.delete":
  7575. type OrganizationsExclusionsDeleteCall struct {
  7576. s *Service
  7577. name string
  7578. urlParams_ gensupport.URLParams
  7579. ctx_ context.Context
  7580. header_ http.Header
  7581. }
  7582. // Delete: Deletes an exclusion.
  7583. func (r *OrganizationsExclusionsService) Delete(name string) *OrganizationsExclusionsDeleteCall {
  7584. c := &OrganizationsExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7585. c.name = name
  7586. return c
  7587. }
  7588. // Fields allows partial responses to be retrieved. See
  7589. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7590. // for more information.
  7591. func (c *OrganizationsExclusionsDeleteCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsDeleteCall {
  7592. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7593. return c
  7594. }
  7595. // Context sets the context to be used in this call's Do method. Any
  7596. // pending HTTP request will be aborted if the provided context is
  7597. // canceled.
  7598. func (c *OrganizationsExclusionsDeleteCall) Context(ctx context.Context) *OrganizationsExclusionsDeleteCall {
  7599. c.ctx_ = ctx
  7600. return c
  7601. }
  7602. // Header returns an http.Header that can be modified by the caller to
  7603. // add HTTP headers to the request.
  7604. func (c *OrganizationsExclusionsDeleteCall) Header() http.Header {
  7605. if c.header_ == nil {
  7606. c.header_ = make(http.Header)
  7607. }
  7608. return c.header_
  7609. }
  7610. func (c *OrganizationsExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7611. reqHeaders := make(http.Header)
  7612. for k, v := range c.header_ {
  7613. reqHeaders[k] = v
  7614. }
  7615. reqHeaders.Set("User-Agent", c.s.userAgent())
  7616. var body io.Reader = nil
  7617. c.urlParams_.Set("alt", alt)
  7618. c.urlParams_.Set("prettyPrint", "false")
  7619. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  7620. urls += "?" + c.urlParams_.Encode()
  7621. req, err := http.NewRequest("DELETE", urls, body)
  7622. if err != nil {
  7623. return nil, err
  7624. }
  7625. req.Header = reqHeaders
  7626. googleapi.Expand(req.URL, map[string]string{
  7627. "name": c.name,
  7628. })
  7629. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7630. }
  7631. // Do executes the "logging.organizations.exclusions.delete" call.
  7632. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7633. // code is an error. Response headers are in either
  7634. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7635. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7636. // check whether the returned error was because http.StatusNotModified
  7637. // was returned.
  7638. func (c *OrganizationsExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7639. gensupport.SetOptions(c.urlParams_, opts...)
  7640. res, err := c.doRequest("json")
  7641. if res != nil && res.StatusCode == http.StatusNotModified {
  7642. if res.Body != nil {
  7643. res.Body.Close()
  7644. }
  7645. return nil, &googleapi.Error{
  7646. Code: res.StatusCode,
  7647. Header: res.Header,
  7648. }
  7649. }
  7650. if err != nil {
  7651. return nil, err
  7652. }
  7653. defer googleapi.CloseBody(res)
  7654. if err := googleapi.CheckResponse(res); err != nil {
  7655. return nil, err
  7656. }
  7657. ret := &Empty{
  7658. ServerResponse: googleapi.ServerResponse{
  7659. Header: res.Header,
  7660. HTTPStatusCode: res.StatusCode,
  7661. },
  7662. }
  7663. target := &ret
  7664. if err := gensupport.DecodeResponse(target, res); err != nil {
  7665. return nil, err
  7666. }
  7667. return ret, nil
  7668. // {
  7669. // "description": "Deletes an exclusion.",
  7670. // "flatPath": "v2/organizations/{organizationsId}/exclusions/{exclusionsId}",
  7671. // "httpMethod": "DELETE",
  7672. // "id": "logging.organizations.exclusions.delete",
  7673. // "parameterOrder": [
  7674. // "name"
  7675. // ],
  7676. // "parameters": {
  7677. // "name": {
  7678. // "description": "Required. The resource name of an existing exclusion to delete:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  7679. // "location": "path",
  7680. // "pattern": "^organizations/[^/]+/exclusions/[^/]+$",
  7681. // "required": true,
  7682. // "type": "string"
  7683. // }
  7684. // },
  7685. // "path": "v2/{+name}",
  7686. // "response": {
  7687. // "$ref": "Empty"
  7688. // },
  7689. // "scopes": [
  7690. // "https://www.googleapis.com/auth/cloud-platform",
  7691. // "https://www.googleapis.com/auth/logging.admin"
  7692. // ]
  7693. // }
  7694. }
  7695. // method id "logging.organizations.exclusions.get":
  7696. type OrganizationsExclusionsGetCall struct {
  7697. s *Service
  7698. name string
  7699. urlParams_ gensupport.URLParams
  7700. ifNoneMatch_ string
  7701. ctx_ context.Context
  7702. header_ http.Header
  7703. }
  7704. // Get: Gets the description of an exclusion.
  7705. func (r *OrganizationsExclusionsService) Get(name string) *OrganizationsExclusionsGetCall {
  7706. c := &OrganizationsExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7707. c.name = name
  7708. return c
  7709. }
  7710. // Fields allows partial responses to be retrieved. See
  7711. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7712. // for more information.
  7713. func (c *OrganizationsExclusionsGetCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsGetCall {
  7714. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7715. return c
  7716. }
  7717. // IfNoneMatch sets the optional parameter which makes the operation
  7718. // fail if the object's ETag matches the given value. This is useful for
  7719. // getting updates only after the object has changed since the last
  7720. // request. Use googleapi.IsNotModified to check whether the response
  7721. // error from Do is the result of In-None-Match.
  7722. func (c *OrganizationsExclusionsGetCall) IfNoneMatch(entityTag string) *OrganizationsExclusionsGetCall {
  7723. c.ifNoneMatch_ = entityTag
  7724. return c
  7725. }
  7726. // Context sets the context to be used in this call's Do method. Any
  7727. // pending HTTP request will be aborted if the provided context is
  7728. // canceled.
  7729. func (c *OrganizationsExclusionsGetCall) Context(ctx context.Context) *OrganizationsExclusionsGetCall {
  7730. c.ctx_ = ctx
  7731. return c
  7732. }
  7733. // Header returns an http.Header that can be modified by the caller to
  7734. // add HTTP headers to the request.
  7735. func (c *OrganizationsExclusionsGetCall) Header() http.Header {
  7736. if c.header_ == nil {
  7737. c.header_ = make(http.Header)
  7738. }
  7739. return c.header_
  7740. }
  7741. func (c *OrganizationsExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  7742. reqHeaders := make(http.Header)
  7743. for k, v := range c.header_ {
  7744. reqHeaders[k] = v
  7745. }
  7746. reqHeaders.Set("User-Agent", c.s.userAgent())
  7747. if c.ifNoneMatch_ != "" {
  7748. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7749. }
  7750. var body io.Reader = nil
  7751. c.urlParams_.Set("alt", alt)
  7752. c.urlParams_.Set("prettyPrint", "false")
  7753. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  7754. urls += "?" + c.urlParams_.Encode()
  7755. req, err := http.NewRequest("GET", urls, body)
  7756. if err != nil {
  7757. return nil, err
  7758. }
  7759. req.Header = reqHeaders
  7760. googleapi.Expand(req.URL, map[string]string{
  7761. "name": c.name,
  7762. })
  7763. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7764. }
  7765. // Do executes the "logging.organizations.exclusions.get" call.
  7766. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  7767. // status code is an error. Response headers are in either
  7768. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  7769. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7770. // to check whether the returned error was because
  7771. // http.StatusNotModified was returned.
  7772. func (c *OrganizationsExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  7773. gensupport.SetOptions(c.urlParams_, opts...)
  7774. res, err := c.doRequest("json")
  7775. if res != nil && res.StatusCode == http.StatusNotModified {
  7776. if res.Body != nil {
  7777. res.Body.Close()
  7778. }
  7779. return nil, &googleapi.Error{
  7780. Code: res.StatusCode,
  7781. Header: res.Header,
  7782. }
  7783. }
  7784. if err != nil {
  7785. return nil, err
  7786. }
  7787. defer googleapi.CloseBody(res)
  7788. if err := googleapi.CheckResponse(res); err != nil {
  7789. return nil, err
  7790. }
  7791. ret := &LogExclusion{
  7792. ServerResponse: googleapi.ServerResponse{
  7793. Header: res.Header,
  7794. HTTPStatusCode: res.StatusCode,
  7795. },
  7796. }
  7797. target := &ret
  7798. if err := gensupport.DecodeResponse(target, res); err != nil {
  7799. return nil, err
  7800. }
  7801. return ret, nil
  7802. // {
  7803. // "description": "Gets the description of an exclusion.",
  7804. // "flatPath": "v2/organizations/{organizationsId}/exclusions/{exclusionsId}",
  7805. // "httpMethod": "GET",
  7806. // "id": "logging.organizations.exclusions.get",
  7807. // "parameterOrder": [
  7808. // "name"
  7809. // ],
  7810. // "parameters": {
  7811. // "name": {
  7812. // "description": "Required. The resource name of an existing exclusion:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  7813. // "location": "path",
  7814. // "pattern": "^organizations/[^/]+/exclusions/[^/]+$",
  7815. // "required": true,
  7816. // "type": "string"
  7817. // }
  7818. // },
  7819. // "path": "v2/{+name}",
  7820. // "response": {
  7821. // "$ref": "LogExclusion"
  7822. // },
  7823. // "scopes": [
  7824. // "https://www.googleapis.com/auth/cloud-platform",
  7825. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7826. // "https://www.googleapis.com/auth/logging.admin",
  7827. // "https://www.googleapis.com/auth/logging.read"
  7828. // ]
  7829. // }
  7830. }
  7831. // method id "logging.organizations.exclusions.list":
  7832. type OrganizationsExclusionsListCall struct {
  7833. s *Service
  7834. parent string
  7835. urlParams_ gensupport.URLParams
  7836. ifNoneMatch_ string
  7837. ctx_ context.Context
  7838. header_ http.Header
  7839. }
  7840. // List: Lists all the exclusions in a parent resource.
  7841. func (r *OrganizationsExclusionsService) List(parent string) *OrganizationsExclusionsListCall {
  7842. c := &OrganizationsExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7843. c.parent = parent
  7844. return c
  7845. }
  7846. // PageSize sets the optional parameter "pageSize": The maximum number
  7847. // of results to return from this request. Non-positive values are
  7848. // ignored. The presence of nextPageToken in the response indicates that
  7849. // more results might be available.
  7850. func (c *OrganizationsExclusionsListCall) PageSize(pageSize int64) *OrganizationsExclusionsListCall {
  7851. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7852. return c
  7853. }
  7854. // PageToken sets the optional parameter "pageToken": If present, then
  7855. // retrieve the next batch of results from the preceding call to this
  7856. // method. pageToken must be the value of nextPageToken from the
  7857. // previous response. The values of other method parameters should be
  7858. // identical to those in the previous call.
  7859. func (c *OrganizationsExclusionsListCall) PageToken(pageToken string) *OrganizationsExclusionsListCall {
  7860. c.urlParams_.Set("pageToken", pageToken)
  7861. return c
  7862. }
  7863. // Fields allows partial responses to be retrieved. See
  7864. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7865. // for more information.
  7866. func (c *OrganizationsExclusionsListCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsListCall {
  7867. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7868. return c
  7869. }
  7870. // IfNoneMatch sets the optional parameter which makes the operation
  7871. // fail if the object's ETag matches the given value. This is useful for
  7872. // getting updates only after the object has changed since the last
  7873. // request. Use googleapi.IsNotModified to check whether the response
  7874. // error from Do is the result of In-None-Match.
  7875. func (c *OrganizationsExclusionsListCall) IfNoneMatch(entityTag string) *OrganizationsExclusionsListCall {
  7876. c.ifNoneMatch_ = entityTag
  7877. return c
  7878. }
  7879. // Context sets the context to be used in this call's Do method. Any
  7880. // pending HTTP request will be aborted if the provided context is
  7881. // canceled.
  7882. func (c *OrganizationsExclusionsListCall) Context(ctx context.Context) *OrganizationsExclusionsListCall {
  7883. c.ctx_ = ctx
  7884. return c
  7885. }
  7886. // Header returns an http.Header that can be modified by the caller to
  7887. // add HTTP headers to the request.
  7888. func (c *OrganizationsExclusionsListCall) Header() http.Header {
  7889. if c.header_ == nil {
  7890. c.header_ = make(http.Header)
  7891. }
  7892. return c.header_
  7893. }
  7894. func (c *OrganizationsExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  7895. reqHeaders := make(http.Header)
  7896. for k, v := range c.header_ {
  7897. reqHeaders[k] = v
  7898. }
  7899. reqHeaders.Set("User-Agent", c.s.userAgent())
  7900. if c.ifNoneMatch_ != "" {
  7901. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7902. }
  7903. var body io.Reader = nil
  7904. c.urlParams_.Set("alt", alt)
  7905. c.urlParams_.Set("prettyPrint", "false")
  7906. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  7907. urls += "?" + c.urlParams_.Encode()
  7908. req, err := http.NewRequest("GET", urls, body)
  7909. if err != nil {
  7910. return nil, err
  7911. }
  7912. req.Header = reqHeaders
  7913. googleapi.Expand(req.URL, map[string]string{
  7914. "parent": c.parent,
  7915. })
  7916. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7917. }
  7918. // Do executes the "logging.organizations.exclusions.list" call.
  7919. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  7920. // non-2xx status code is an error. Response headers are in either
  7921. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  7922. // returned at all) in error.(*googleapi.Error).Header. Use
  7923. // googleapi.IsNotModified to check whether the returned error was
  7924. // because http.StatusNotModified was returned.
  7925. func (c *OrganizationsExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  7926. gensupport.SetOptions(c.urlParams_, opts...)
  7927. res, err := c.doRequest("json")
  7928. if res != nil && res.StatusCode == http.StatusNotModified {
  7929. if res.Body != nil {
  7930. res.Body.Close()
  7931. }
  7932. return nil, &googleapi.Error{
  7933. Code: res.StatusCode,
  7934. Header: res.Header,
  7935. }
  7936. }
  7937. if err != nil {
  7938. return nil, err
  7939. }
  7940. defer googleapi.CloseBody(res)
  7941. if err := googleapi.CheckResponse(res); err != nil {
  7942. return nil, err
  7943. }
  7944. ret := &ListExclusionsResponse{
  7945. ServerResponse: googleapi.ServerResponse{
  7946. Header: res.Header,
  7947. HTTPStatusCode: res.StatusCode,
  7948. },
  7949. }
  7950. target := &ret
  7951. if err := gensupport.DecodeResponse(target, res); err != nil {
  7952. return nil, err
  7953. }
  7954. return ret, nil
  7955. // {
  7956. // "description": "Lists all the exclusions in a parent resource.",
  7957. // "flatPath": "v2/organizations/{organizationsId}/exclusions",
  7958. // "httpMethod": "GET",
  7959. // "id": "logging.organizations.exclusions.list",
  7960. // "parameterOrder": [
  7961. // "parent"
  7962. // ],
  7963. // "parameters": {
  7964. // "pageSize": {
  7965. // "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.",
  7966. // "format": "int32",
  7967. // "location": "query",
  7968. // "type": "integer"
  7969. // },
  7970. // "pageToken": {
  7971. // "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.",
  7972. // "location": "query",
  7973. // "type": "string"
  7974. // },
  7975. // "parent": {
  7976. // "description": "Required. The parent resource whose exclusions are to be listed.\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\n",
  7977. // "location": "path",
  7978. // "pattern": "^organizations/[^/]+$",
  7979. // "required": true,
  7980. // "type": "string"
  7981. // }
  7982. // },
  7983. // "path": "v2/{+parent}/exclusions",
  7984. // "response": {
  7985. // "$ref": "ListExclusionsResponse"
  7986. // },
  7987. // "scopes": [
  7988. // "https://www.googleapis.com/auth/cloud-platform",
  7989. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7990. // "https://www.googleapis.com/auth/logging.admin",
  7991. // "https://www.googleapis.com/auth/logging.read"
  7992. // ]
  7993. // }
  7994. }
  7995. // Pages invokes f for each page of results.
  7996. // A non-nil error returned from f will halt the iteration.
  7997. // The provided context supersedes any context provided to the Context method.
  7998. func (c *OrganizationsExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  7999. c.ctx_ = ctx
  8000. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8001. for {
  8002. x, err := c.Do()
  8003. if err != nil {
  8004. return err
  8005. }
  8006. if err := f(x); err != nil {
  8007. return err
  8008. }
  8009. if x.NextPageToken == "" {
  8010. return nil
  8011. }
  8012. c.PageToken(x.NextPageToken)
  8013. }
  8014. }
  8015. // method id "logging.organizations.exclusions.patch":
  8016. type OrganizationsExclusionsPatchCall struct {
  8017. s *Service
  8018. name string
  8019. logexclusion *LogExclusion
  8020. urlParams_ gensupport.URLParams
  8021. ctx_ context.Context
  8022. header_ http.Header
  8023. }
  8024. // Patch: Changes one or more properties of an existing exclusion.
  8025. func (r *OrganizationsExclusionsService) Patch(name string, logexclusion *LogExclusion) *OrganizationsExclusionsPatchCall {
  8026. c := &OrganizationsExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8027. c.name = name
  8028. c.logexclusion = logexclusion
  8029. return c
  8030. }
  8031. // UpdateMask sets the optional parameter "updateMask": Required. A
  8032. // nonempty list of fields to change in the existing exclusion. New
  8033. // values for the fields are taken from the corresponding fields in the
  8034. // LogExclusion included in this request. Fields not mentioned in
  8035. // update_mask are not changed and are ignored in the request.For
  8036. // example, to change the filter and description of an exclusion,
  8037. // specify an update_mask of "filter,description".
  8038. func (c *OrganizationsExclusionsPatchCall) UpdateMask(updateMask string) *OrganizationsExclusionsPatchCall {
  8039. c.urlParams_.Set("updateMask", updateMask)
  8040. return c
  8041. }
  8042. // Fields allows partial responses to be retrieved. See
  8043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8044. // for more information.
  8045. func (c *OrganizationsExclusionsPatchCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsPatchCall {
  8046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8047. return c
  8048. }
  8049. // Context sets the context to be used in this call's Do method. Any
  8050. // pending HTTP request will be aborted if the provided context is
  8051. // canceled.
  8052. func (c *OrganizationsExclusionsPatchCall) Context(ctx context.Context) *OrganizationsExclusionsPatchCall {
  8053. c.ctx_ = ctx
  8054. return c
  8055. }
  8056. // Header returns an http.Header that can be modified by the caller to
  8057. // add HTTP headers to the request.
  8058. func (c *OrganizationsExclusionsPatchCall) Header() http.Header {
  8059. if c.header_ == nil {
  8060. c.header_ = make(http.Header)
  8061. }
  8062. return c.header_
  8063. }
  8064. func (c *OrganizationsExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  8065. reqHeaders := make(http.Header)
  8066. for k, v := range c.header_ {
  8067. reqHeaders[k] = v
  8068. }
  8069. reqHeaders.Set("User-Agent", c.s.userAgent())
  8070. var body io.Reader = nil
  8071. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  8072. if err != nil {
  8073. return nil, err
  8074. }
  8075. reqHeaders.Set("Content-Type", "application/json")
  8076. c.urlParams_.Set("alt", alt)
  8077. c.urlParams_.Set("prettyPrint", "false")
  8078. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  8079. urls += "?" + c.urlParams_.Encode()
  8080. req, err := http.NewRequest("PATCH", urls, body)
  8081. if err != nil {
  8082. return nil, err
  8083. }
  8084. req.Header = reqHeaders
  8085. googleapi.Expand(req.URL, map[string]string{
  8086. "name": c.name,
  8087. })
  8088. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8089. }
  8090. // Do executes the "logging.organizations.exclusions.patch" call.
  8091. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  8092. // status code is an error. Response headers are in either
  8093. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  8094. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8095. // to check whether the returned error was because
  8096. // http.StatusNotModified was returned.
  8097. func (c *OrganizationsExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  8098. gensupport.SetOptions(c.urlParams_, opts...)
  8099. res, err := c.doRequest("json")
  8100. if res != nil && res.StatusCode == http.StatusNotModified {
  8101. if res.Body != nil {
  8102. res.Body.Close()
  8103. }
  8104. return nil, &googleapi.Error{
  8105. Code: res.StatusCode,
  8106. Header: res.Header,
  8107. }
  8108. }
  8109. if err != nil {
  8110. return nil, err
  8111. }
  8112. defer googleapi.CloseBody(res)
  8113. if err := googleapi.CheckResponse(res); err != nil {
  8114. return nil, err
  8115. }
  8116. ret := &LogExclusion{
  8117. ServerResponse: googleapi.ServerResponse{
  8118. Header: res.Header,
  8119. HTTPStatusCode: res.StatusCode,
  8120. },
  8121. }
  8122. target := &ret
  8123. if err := gensupport.DecodeResponse(target, res); err != nil {
  8124. return nil, err
  8125. }
  8126. return ret, nil
  8127. // {
  8128. // "description": "Changes one or more properties of an existing exclusion.",
  8129. // "flatPath": "v2/organizations/{organizationsId}/exclusions/{exclusionsId}",
  8130. // "httpMethod": "PATCH",
  8131. // "id": "logging.organizations.exclusions.patch",
  8132. // "parameterOrder": [
  8133. // "name"
  8134. // ],
  8135. // "parameters": {
  8136. // "name": {
  8137. // "description": "Required. The resource name of the exclusion to update:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  8138. // "location": "path",
  8139. // "pattern": "^organizations/[^/]+/exclusions/[^/]+$",
  8140. // "required": true,
  8141. // "type": "string"
  8142. // },
  8143. // "updateMask": {
  8144. // "description": "Required. A nonempty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the LogExclusion included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.For example, to change the filter and description of an exclusion, specify an update_mask of \"filter,description\".",
  8145. // "format": "google-fieldmask",
  8146. // "location": "query",
  8147. // "type": "string"
  8148. // }
  8149. // },
  8150. // "path": "v2/{+name}",
  8151. // "request": {
  8152. // "$ref": "LogExclusion"
  8153. // },
  8154. // "response": {
  8155. // "$ref": "LogExclusion"
  8156. // },
  8157. // "scopes": [
  8158. // "https://www.googleapis.com/auth/cloud-platform",
  8159. // "https://www.googleapis.com/auth/logging.admin"
  8160. // ]
  8161. // }
  8162. }
  8163. // method id "logging.organizations.logs.delete":
  8164. type OrganizationsLogsDeleteCall struct {
  8165. s *Service
  8166. logName string
  8167. urlParams_ gensupport.URLParams
  8168. ctx_ context.Context
  8169. header_ http.Header
  8170. }
  8171. // Delete: Deletes all the log entries in a log. The log reappears if it
  8172. // receives new entries. Log entries written shortly before the delete
  8173. // operation might not be deleted.
  8174. func (r *OrganizationsLogsService) Delete(logName string) *OrganizationsLogsDeleteCall {
  8175. c := &OrganizationsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8176. c.logName = logName
  8177. return c
  8178. }
  8179. // Fields allows partial responses to be retrieved. See
  8180. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8181. // for more information.
  8182. func (c *OrganizationsLogsDeleteCall) Fields(s ...googleapi.Field) *OrganizationsLogsDeleteCall {
  8183. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8184. return c
  8185. }
  8186. // Context sets the context to be used in this call's Do method. Any
  8187. // pending HTTP request will be aborted if the provided context is
  8188. // canceled.
  8189. func (c *OrganizationsLogsDeleteCall) Context(ctx context.Context) *OrganizationsLogsDeleteCall {
  8190. c.ctx_ = ctx
  8191. return c
  8192. }
  8193. // Header returns an http.Header that can be modified by the caller to
  8194. // add HTTP headers to the request.
  8195. func (c *OrganizationsLogsDeleteCall) Header() http.Header {
  8196. if c.header_ == nil {
  8197. c.header_ = make(http.Header)
  8198. }
  8199. return c.header_
  8200. }
  8201. func (c *OrganizationsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8202. reqHeaders := make(http.Header)
  8203. for k, v := range c.header_ {
  8204. reqHeaders[k] = v
  8205. }
  8206. reqHeaders.Set("User-Agent", c.s.userAgent())
  8207. var body io.Reader = nil
  8208. c.urlParams_.Set("alt", alt)
  8209. c.urlParams_.Set("prettyPrint", "false")
  8210. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  8211. urls += "?" + c.urlParams_.Encode()
  8212. req, err := http.NewRequest("DELETE", urls, body)
  8213. if err != nil {
  8214. return nil, err
  8215. }
  8216. req.Header = reqHeaders
  8217. googleapi.Expand(req.URL, map[string]string{
  8218. "logName": c.logName,
  8219. })
  8220. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8221. }
  8222. // Do executes the "logging.organizations.logs.delete" call.
  8223. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8224. // code is an error. Response headers are in either
  8225. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8226. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8227. // check whether the returned error was because http.StatusNotModified
  8228. // was returned.
  8229. func (c *OrganizationsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8230. gensupport.SetOptions(c.urlParams_, opts...)
  8231. res, err := c.doRequest("json")
  8232. if res != nil && res.StatusCode == http.StatusNotModified {
  8233. if res.Body != nil {
  8234. res.Body.Close()
  8235. }
  8236. return nil, &googleapi.Error{
  8237. Code: res.StatusCode,
  8238. Header: res.Header,
  8239. }
  8240. }
  8241. if err != nil {
  8242. return nil, err
  8243. }
  8244. defer googleapi.CloseBody(res)
  8245. if err := googleapi.CheckResponse(res); err != nil {
  8246. return nil, err
  8247. }
  8248. ret := &Empty{
  8249. ServerResponse: googleapi.ServerResponse{
  8250. Header: res.Header,
  8251. HTTPStatusCode: res.StatusCode,
  8252. },
  8253. }
  8254. target := &ret
  8255. if err := gensupport.DecodeResponse(target, res); err != nil {
  8256. return nil, err
  8257. }
  8258. return ret, nil
  8259. // {
  8260. // "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.",
  8261. // "flatPath": "v2/organizations/{organizationsId}/logs/{logsId}",
  8262. // "httpMethod": "DELETE",
  8263. // "id": "logging.organizations.logs.delete",
  8264. // "parameterOrder": [
  8265. // "logName"
  8266. // ],
  8267. // "parameters": {
  8268. // "logName": {
  8269. // "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.",
  8270. // "location": "path",
  8271. // "pattern": "^organizations/[^/]+/logs/[^/]+$",
  8272. // "required": true,
  8273. // "type": "string"
  8274. // }
  8275. // },
  8276. // "path": "v2/{+logName}",
  8277. // "response": {
  8278. // "$ref": "Empty"
  8279. // },
  8280. // "scopes": [
  8281. // "https://www.googleapis.com/auth/cloud-platform",
  8282. // "https://www.googleapis.com/auth/logging.admin"
  8283. // ]
  8284. // }
  8285. }
  8286. // method id "logging.organizations.logs.list":
  8287. type OrganizationsLogsListCall struct {
  8288. s *Service
  8289. parent string
  8290. urlParams_ gensupport.URLParams
  8291. ifNoneMatch_ string
  8292. ctx_ context.Context
  8293. header_ http.Header
  8294. }
  8295. // List: Lists the logs in projects, organizations, folders, or billing
  8296. // accounts. Only logs that have entries are listed.
  8297. func (r *OrganizationsLogsService) List(parent string) *OrganizationsLogsListCall {
  8298. c := &OrganizationsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8299. c.parent = parent
  8300. return c
  8301. }
  8302. // PageSize sets the optional parameter "pageSize": The maximum number
  8303. // of results to return from this request. Non-positive values are
  8304. // ignored. The presence of nextPageToken in the response indicates that
  8305. // more results might be available.
  8306. func (c *OrganizationsLogsListCall) PageSize(pageSize int64) *OrganizationsLogsListCall {
  8307. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8308. return c
  8309. }
  8310. // PageToken sets the optional parameter "pageToken": If present, then
  8311. // retrieve the next batch of results from the preceding call to this
  8312. // method. pageToken must be the value of nextPageToken from the
  8313. // previous response. The values of other method parameters should be
  8314. // identical to those in the previous call.
  8315. func (c *OrganizationsLogsListCall) PageToken(pageToken string) *OrganizationsLogsListCall {
  8316. c.urlParams_.Set("pageToken", pageToken)
  8317. return c
  8318. }
  8319. // Fields allows partial responses to be retrieved. See
  8320. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8321. // for more information.
  8322. func (c *OrganizationsLogsListCall) Fields(s ...googleapi.Field) *OrganizationsLogsListCall {
  8323. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8324. return c
  8325. }
  8326. // IfNoneMatch sets the optional parameter which makes the operation
  8327. // fail if the object's ETag matches the given value. This is useful for
  8328. // getting updates only after the object has changed since the last
  8329. // request. Use googleapi.IsNotModified to check whether the response
  8330. // error from Do is the result of In-None-Match.
  8331. func (c *OrganizationsLogsListCall) IfNoneMatch(entityTag string) *OrganizationsLogsListCall {
  8332. c.ifNoneMatch_ = entityTag
  8333. return c
  8334. }
  8335. // Context sets the context to be used in this call's Do method. Any
  8336. // pending HTTP request will be aborted if the provided context is
  8337. // canceled.
  8338. func (c *OrganizationsLogsListCall) Context(ctx context.Context) *OrganizationsLogsListCall {
  8339. c.ctx_ = ctx
  8340. return c
  8341. }
  8342. // Header returns an http.Header that can be modified by the caller to
  8343. // add HTTP headers to the request.
  8344. func (c *OrganizationsLogsListCall) Header() http.Header {
  8345. if c.header_ == nil {
  8346. c.header_ = make(http.Header)
  8347. }
  8348. return c.header_
  8349. }
  8350. func (c *OrganizationsLogsListCall) doRequest(alt string) (*http.Response, error) {
  8351. reqHeaders := make(http.Header)
  8352. for k, v := range c.header_ {
  8353. reqHeaders[k] = v
  8354. }
  8355. reqHeaders.Set("User-Agent", c.s.userAgent())
  8356. if c.ifNoneMatch_ != "" {
  8357. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8358. }
  8359. var body io.Reader = nil
  8360. c.urlParams_.Set("alt", alt)
  8361. c.urlParams_.Set("prettyPrint", "false")
  8362. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  8363. urls += "?" + c.urlParams_.Encode()
  8364. req, err := http.NewRequest("GET", urls, body)
  8365. if err != nil {
  8366. return nil, err
  8367. }
  8368. req.Header = reqHeaders
  8369. googleapi.Expand(req.URL, map[string]string{
  8370. "parent": c.parent,
  8371. })
  8372. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8373. }
  8374. // Do executes the "logging.organizations.logs.list" call.
  8375. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  8376. // non-2xx status code is an error. Response headers are in either
  8377. // *ListLogsResponse.ServerResponse.Header or (if a response was
  8378. // returned at all) in error.(*googleapi.Error).Header. Use
  8379. // googleapi.IsNotModified to check whether the returned error was
  8380. // because http.StatusNotModified was returned.
  8381. func (c *OrganizationsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  8382. gensupport.SetOptions(c.urlParams_, opts...)
  8383. res, err := c.doRequest("json")
  8384. if res != nil && res.StatusCode == http.StatusNotModified {
  8385. if res.Body != nil {
  8386. res.Body.Close()
  8387. }
  8388. return nil, &googleapi.Error{
  8389. Code: res.StatusCode,
  8390. Header: res.Header,
  8391. }
  8392. }
  8393. if err != nil {
  8394. return nil, err
  8395. }
  8396. defer googleapi.CloseBody(res)
  8397. if err := googleapi.CheckResponse(res); err != nil {
  8398. return nil, err
  8399. }
  8400. ret := &ListLogsResponse{
  8401. ServerResponse: googleapi.ServerResponse{
  8402. Header: res.Header,
  8403. HTTPStatusCode: res.StatusCode,
  8404. },
  8405. }
  8406. target := &ret
  8407. if err := gensupport.DecodeResponse(target, res); err != nil {
  8408. return nil, err
  8409. }
  8410. return ret, nil
  8411. // {
  8412. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  8413. // "flatPath": "v2/organizations/{organizationsId}/logs",
  8414. // "httpMethod": "GET",
  8415. // "id": "logging.organizations.logs.list",
  8416. // "parameterOrder": [
  8417. // "parent"
  8418. // ],
  8419. // "parameters": {
  8420. // "pageSize": {
  8421. // "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.",
  8422. // "format": "int32",
  8423. // "location": "query",
  8424. // "type": "integer"
  8425. // },
  8426. // "pageToken": {
  8427. // "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.",
  8428. // "location": "query",
  8429. // "type": "string"
  8430. // },
  8431. // "parent": {
  8432. // "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",
  8433. // "location": "path",
  8434. // "pattern": "^organizations/[^/]+$",
  8435. // "required": true,
  8436. // "type": "string"
  8437. // }
  8438. // },
  8439. // "path": "v2/{+parent}/logs",
  8440. // "response": {
  8441. // "$ref": "ListLogsResponse"
  8442. // },
  8443. // "scopes": [
  8444. // "https://www.googleapis.com/auth/cloud-platform",
  8445. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8446. // "https://www.googleapis.com/auth/logging.admin",
  8447. // "https://www.googleapis.com/auth/logging.read"
  8448. // ]
  8449. // }
  8450. }
  8451. // Pages invokes f for each page of results.
  8452. // A non-nil error returned from f will halt the iteration.
  8453. // The provided context supersedes any context provided to the Context method.
  8454. func (c *OrganizationsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  8455. c.ctx_ = ctx
  8456. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8457. for {
  8458. x, err := c.Do()
  8459. if err != nil {
  8460. return err
  8461. }
  8462. if err := f(x); err != nil {
  8463. return err
  8464. }
  8465. if x.NextPageToken == "" {
  8466. return nil
  8467. }
  8468. c.PageToken(x.NextPageToken)
  8469. }
  8470. }
  8471. // method id "logging.organizations.sinks.create":
  8472. type OrganizationsSinksCreateCall struct {
  8473. s *Service
  8474. parent string
  8475. logsink *LogSink
  8476. urlParams_ gensupport.URLParams
  8477. ctx_ context.Context
  8478. header_ http.Header
  8479. }
  8480. // Create: Creates a sink that exports specified log entries to a
  8481. // destination. The export of newly-ingested log entries begins
  8482. // immediately, unless the sink's writer_identity is not permitted to
  8483. // write to the destination. A sink can export log entries only from the
  8484. // resource owning the sink.
  8485. func (r *OrganizationsSinksService) Create(parent string, logsink *LogSink) *OrganizationsSinksCreateCall {
  8486. c := &OrganizationsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8487. c.parent = parent
  8488. c.logsink = logsink
  8489. return c
  8490. }
  8491. // UniqueWriterIdentity sets the optional parameter
  8492. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  8493. // as writer_identity in the new sink. If this value is omitted or set
  8494. // to false, and if the sink's parent is a project, then the value
  8495. // returned as writer_identity is the same group or service account used
  8496. // by Logging before the addition of writer identities to this API. The
  8497. // sink's destination must be in the same project as the sink itself.If
  8498. // this field is set to true, or if the sink is owned by a non-project
  8499. // resource such as an organization, then the value of writer_identity
  8500. // will be a unique service account used only for exports from the new
  8501. // sink. For more information, see writer_identity in LogSink.
  8502. func (c *OrganizationsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *OrganizationsSinksCreateCall {
  8503. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  8504. return c
  8505. }
  8506. // Fields allows partial responses to be retrieved. See
  8507. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8508. // for more information.
  8509. func (c *OrganizationsSinksCreateCall) Fields(s ...googleapi.Field) *OrganizationsSinksCreateCall {
  8510. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8511. return c
  8512. }
  8513. // Context sets the context to be used in this call's Do method. Any
  8514. // pending HTTP request will be aborted if the provided context is
  8515. // canceled.
  8516. func (c *OrganizationsSinksCreateCall) Context(ctx context.Context) *OrganizationsSinksCreateCall {
  8517. c.ctx_ = ctx
  8518. return c
  8519. }
  8520. // Header returns an http.Header that can be modified by the caller to
  8521. // add HTTP headers to the request.
  8522. func (c *OrganizationsSinksCreateCall) Header() http.Header {
  8523. if c.header_ == nil {
  8524. c.header_ = make(http.Header)
  8525. }
  8526. return c.header_
  8527. }
  8528. func (c *OrganizationsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  8529. reqHeaders := make(http.Header)
  8530. for k, v := range c.header_ {
  8531. reqHeaders[k] = v
  8532. }
  8533. reqHeaders.Set("User-Agent", c.s.userAgent())
  8534. var body io.Reader = nil
  8535. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  8536. if err != nil {
  8537. return nil, err
  8538. }
  8539. reqHeaders.Set("Content-Type", "application/json")
  8540. c.urlParams_.Set("alt", alt)
  8541. c.urlParams_.Set("prettyPrint", "false")
  8542. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  8543. urls += "?" + c.urlParams_.Encode()
  8544. req, err := http.NewRequest("POST", urls, body)
  8545. if err != nil {
  8546. return nil, err
  8547. }
  8548. req.Header = reqHeaders
  8549. googleapi.Expand(req.URL, map[string]string{
  8550. "parent": c.parent,
  8551. })
  8552. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8553. }
  8554. // Do executes the "logging.organizations.sinks.create" call.
  8555. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  8556. // code is an error. Response headers are in either
  8557. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  8558. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8559. // check whether the returned error was because http.StatusNotModified
  8560. // was returned.
  8561. func (c *OrganizationsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  8562. gensupport.SetOptions(c.urlParams_, opts...)
  8563. res, err := c.doRequest("json")
  8564. if res != nil && res.StatusCode == http.StatusNotModified {
  8565. if res.Body != nil {
  8566. res.Body.Close()
  8567. }
  8568. return nil, &googleapi.Error{
  8569. Code: res.StatusCode,
  8570. Header: res.Header,
  8571. }
  8572. }
  8573. if err != nil {
  8574. return nil, err
  8575. }
  8576. defer googleapi.CloseBody(res)
  8577. if err := googleapi.CheckResponse(res); err != nil {
  8578. return nil, err
  8579. }
  8580. ret := &LogSink{
  8581. ServerResponse: googleapi.ServerResponse{
  8582. Header: res.Header,
  8583. HTTPStatusCode: res.StatusCode,
  8584. },
  8585. }
  8586. target := &ret
  8587. if err := gensupport.DecodeResponse(target, res); err != nil {
  8588. return nil, err
  8589. }
  8590. return ret, nil
  8591. // {
  8592. // "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.",
  8593. // "flatPath": "v2/organizations/{organizationsId}/sinks",
  8594. // "httpMethod": "POST",
  8595. // "id": "logging.organizations.sinks.create",
  8596. // "parameterOrder": [
  8597. // "parent"
  8598. // ],
  8599. // "parameters": {
  8600. // "parent": {
  8601. // "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\".",
  8602. // "location": "path",
  8603. // "pattern": "^organizations/[^/]+$",
  8604. // "required": true,
  8605. // "type": "string"
  8606. // },
  8607. // "uniqueWriterIdentity": {
  8608. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  8609. // "location": "query",
  8610. // "type": "boolean"
  8611. // }
  8612. // },
  8613. // "path": "v2/{+parent}/sinks",
  8614. // "request": {
  8615. // "$ref": "LogSink"
  8616. // },
  8617. // "response": {
  8618. // "$ref": "LogSink"
  8619. // },
  8620. // "scopes": [
  8621. // "https://www.googleapis.com/auth/cloud-platform",
  8622. // "https://www.googleapis.com/auth/logging.admin"
  8623. // ]
  8624. // }
  8625. }
  8626. // method id "logging.organizations.sinks.delete":
  8627. type OrganizationsSinksDeleteCall struct {
  8628. s *Service
  8629. sinkNameid string
  8630. urlParams_ gensupport.URLParams
  8631. ctx_ context.Context
  8632. header_ http.Header
  8633. }
  8634. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  8635. // then that service account is also deleted.
  8636. func (r *OrganizationsSinksService) Delete(sinkNameid string) *OrganizationsSinksDeleteCall {
  8637. c := &OrganizationsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8638. c.sinkNameid = sinkNameid
  8639. return c
  8640. }
  8641. // Fields allows partial responses to be retrieved. See
  8642. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8643. // for more information.
  8644. func (c *OrganizationsSinksDeleteCall) Fields(s ...googleapi.Field) *OrganizationsSinksDeleteCall {
  8645. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8646. return c
  8647. }
  8648. // Context sets the context to be used in this call's Do method. Any
  8649. // pending HTTP request will be aborted if the provided context is
  8650. // canceled.
  8651. func (c *OrganizationsSinksDeleteCall) Context(ctx context.Context) *OrganizationsSinksDeleteCall {
  8652. c.ctx_ = ctx
  8653. return c
  8654. }
  8655. // Header returns an http.Header that can be modified by the caller to
  8656. // add HTTP headers to the request.
  8657. func (c *OrganizationsSinksDeleteCall) Header() http.Header {
  8658. if c.header_ == nil {
  8659. c.header_ = make(http.Header)
  8660. }
  8661. return c.header_
  8662. }
  8663. func (c *OrganizationsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  8664. reqHeaders := make(http.Header)
  8665. for k, v := range c.header_ {
  8666. reqHeaders[k] = v
  8667. }
  8668. reqHeaders.Set("User-Agent", c.s.userAgent())
  8669. var body io.Reader = nil
  8670. c.urlParams_.Set("alt", alt)
  8671. c.urlParams_.Set("prettyPrint", "false")
  8672. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  8673. urls += "?" + c.urlParams_.Encode()
  8674. req, err := http.NewRequest("DELETE", urls, body)
  8675. if err != nil {
  8676. return nil, err
  8677. }
  8678. req.Header = reqHeaders
  8679. googleapi.Expand(req.URL, map[string]string{
  8680. "sinkName": c.sinkNameid,
  8681. })
  8682. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8683. }
  8684. // Do executes the "logging.organizations.sinks.delete" call.
  8685. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8686. // code is an error. Response headers are in either
  8687. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8688. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8689. // check whether the returned error was because http.StatusNotModified
  8690. // was returned.
  8691. func (c *OrganizationsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8692. gensupport.SetOptions(c.urlParams_, opts...)
  8693. res, err := c.doRequest("json")
  8694. if res != nil && res.StatusCode == http.StatusNotModified {
  8695. if res.Body != nil {
  8696. res.Body.Close()
  8697. }
  8698. return nil, &googleapi.Error{
  8699. Code: res.StatusCode,
  8700. Header: res.Header,
  8701. }
  8702. }
  8703. if err != nil {
  8704. return nil, err
  8705. }
  8706. defer googleapi.CloseBody(res)
  8707. if err := googleapi.CheckResponse(res); err != nil {
  8708. return nil, err
  8709. }
  8710. ret := &Empty{
  8711. ServerResponse: googleapi.ServerResponse{
  8712. Header: res.Header,
  8713. HTTPStatusCode: res.StatusCode,
  8714. },
  8715. }
  8716. target := &ret
  8717. if err := gensupport.DecodeResponse(target, res); err != nil {
  8718. return nil, err
  8719. }
  8720. return ret, nil
  8721. // {
  8722. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  8723. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  8724. // "httpMethod": "DELETE",
  8725. // "id": "logging.organizations.sinks.delete",
  8726. // "parameterOrder": [
  8727. // "sinkName"
  8728. // ],
  8729. // "parameters": {
  8730. // "sinkName": {
  8731. // "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\".",
  8732. // "location": "path",
  8733. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  8734. // "required": true,
  8735. // "type": "string"
  8736. // }
  8737. // },
  8738. // "path": "v2/{+sinkName}",
  8739. // "response": {
  8740. // "$ref": "Empty"
  8741. // },
  8742. // "scopes": [
  8743. // "https://www.googleapis.com/auth/cloud-platform",
  8744. // "https://www.googleapis.com/auth/logging.admin"
  8745. // ]
  8746. // }
  8747. }
  8748. // method id "logging.organizations.sinks.get":
  8749. type OrganizationsSinksGetCall struct {
  8750. s *Service
  8751. sinkName string
  8752. urlParams_ gensupport.URLParams
  8753. ifNoneMatch_ string
  8754. ctx_ context.Context
  8755. header_ http.Header
  8756. }
  8757. // Get: Gets a sink.
  8758. func (r *OrganizationsSinksService) Get(sinkName string) *OrganizationsSinksGetCall {
  8759. c := &OrganizationsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8760. c.sinkName = sinkName
  8761. return c
  8762. }
  8763. // Fields allows partial responses to be retrieved. See
  8764. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8765. // for more information.
  8766. func (c *OrganizationsSinksGetCall) Fields(s ...googleapi.Field) *OrganizationsSinksGetCall {
  8767. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8768. return c
  8769. }
  8770. // IfNoneMatch sets the optional parameter which makes the operation
  8771. // fail if the object's ETag matches the given value. This is useful for
  8772. // getting updates only after the object has changed since the last
  8773. // request. Use googleapi.IsNotModified to check whether the response
  8774. // error from Do is the result of In-None-Match.
  8775. func (c *OrganizationsSinksGetCall) IfNoneMatch(entityTag string) *OrganizationsSinksGetCall {
  8776. c.ifNoneMatch_ = entityTag
  8777. return c
  8778. }
  8779. // Context sets the context to be used in this call's Do method. Any
  8780. // pending HTTP request will be aborted if the provided context is
  8781. // canceled.
  8782. func (c *OrganizationsSinksGetCall) Context(ctx context.Context) *OrganizationsSinksGetCall {
  8783. c.ctx_ = ctx
  8784. return c
  8785. }
  8786. // Header returns an http.Header that can be modified by the caller to
  8787. // add HTTP headers to the request.
  8788. func (c *OrganizationsSinksGetCall) Header() http.Header {
  8789. if c.header_ == nil {
  8790. c.header_ = make(http.Header)
  8791. }
  8792. return c.header_
  8793. }
  8794. func (c *OrganizationsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  8795. reqHeaders := make(http.Header)
  8796. for k, v := range c.header_ {
  8797. reqHeaders[k] = v
  8798. }
  8799. reqHeaders.Set("User-Agent", c.s.userAgent())
  8800. if c.ifNoneMatch_ != "" {
  8801. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8802. }
  8803. var body io.Reader = nil
  8804. c.urlParams_.Set("alt", alt)
  8805. c.urlParams_.Set("prettyPrint", "false")
  8806. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  8807. urls += "?" + c.urlParams_.Encode()
  8808. req, err := http.NewRequest("GET", urls, body)
  8809. if err != nil {
  8810. return nil, err
  8811. }
  8812. req.Header = reqHeaders
  8813. googleapi.Expand(req.URL, map[string]string{
  8814. "sinkName": c.sinkName,
  8815. })
  8816. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8817. }
  8818. // Do executes the "logging.organizations.sinks.get" call.
  8819. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  8820. // code is an error. Response headers are in either
  8821. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  8822. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8823. // check whether the returned error was because http.StatusNotModified
  8824. // was returned.
  8825. func (c *OrganizationsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  8826. gensupport.SetOptions(c.urlParams_, opts...)
  8827. res, err := c.doRequest("json")
  8828. if res != nil && res.StatusCode == http.StatusNotModified {
  8829. if res.Body != nil {
  8830. res.Body.Close()
  8831. }
  8832. return nil, &googleapi.Error{
  8833. Code: res.StatusCode,
  8834. Header: res.Header,
  8835. }
  8836. }
  8837. if err != nil {
  8838. return nil, err
  8839. }
  8840. defer googleapi.CloseBody(res)
  8841. if err := googleapi.CheckResponse(res); err != nil {
  8842. return nil, err
  8843. }
  8844. ret := &LogSink{
  8845. ServerResponse: googleapi.ServerResponse{
  8846. Header: res.Header,
  8847. HTTPStatusCode: res.StatusCode,
  8848. },
  8849. }
  8850. target := &ret
  8851. if err := gensupport.DecodeResponse(target, res); err != nil {
  8852. return nil, err
  8853. }
  8854. return ret, nil
  8855. // {
  8856. // "description": "Gets a sink.",
  8857. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  8858. // "httpMethod": "GET",
  8859. // "id": "logging.organizations.sinks.get",
  8860. // "parameterOrder": [
  8861. // "sinkName"
  8862. // ],
  8863. // "parameters": {
  8864. // "sinkName": {
  8865. // "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\".",
  8866. // "location": "path",
  8867. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  8868. // "required": true,
  8869. // "type": "string"
  8870. // }
  8871. // },
  8872. // "path": "v2/{+sinkName}",
  8873. // "response": {
  8874. // "$ref": "LogSink"
  8875. // },
  8876. // "scopes": [
  8877. // "https://www.googleapis.com/auth/cloud-platform",
  8878. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8879. // "https://www.googleapis.com/auth/logging.admin",
  8880. // "https://www.googleapis.com/auth/logging.read"
  8881. // ]
  8882. // }
  8883. }
  8884. // method id "logging.organizations.sinks.list":
  8885. type OrganizationsSinksListCall struct {
  8886. s *Service
  8887. parent string
  8888. urlParams_ gensupport.URLParams
  8889. ifNoneMatch_ string
  8890. ctx_ context.Context
  8891. header_ http.Header
  8892. }
  8893. // List: Lists sinks.
  8894. func (r *OrganizationsSinksService) List(parent string) *OrganizationsSinksListCall {
  8895. c := &OrganizationsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8896. c.parent = parent
  8897. return c
  8898. }
  8899. // PageSize sets the optional parameter "pageSize": The maximum number
  8900. // of results to return from this request. Non-positive values are
  8901. // ignored. The presence of nextPageToken in the response indicates that
  8902. // more results might be available.
  8903. func (c *OrganizationsSinksListCall) PageSize(pageSize int64) *OrganizationsSinksListCall {
  8904. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8905. return c
  8906. }
  8907. // PageToken sets the optional parameter "pageToken": If present, then
  8908. // retrieve the next batch of results from the preceding call to this
  8909. // method. pageToken must be the value of nextPageToken from the
  8910. // previous response. The values of other method parameters should be
  8911. // identical to those in the previous call.
  8912. func (c *OrganizationsSinksListCall) PageToken(pageToken string) *OrganizationsSinksListCall {
  8913. c.urlParams_.Set("pageToken", pageToken)
  8914. return c
  8915. }
  8916. // Fields allows partial responses to be retrieved. See
  8917. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8918. // for more information.
  8919. func (c *OrganizationsSinksListCall) Fields(s ...googleapi.Field) *OrganizationsSinksListCall {
  8920. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8921. return c
  8922. }
  8923. // IfNoneMatch sets the optional parameter which makes the operation
  8924. // fail if the object's ETag matches the given value. This is useful for
  8925. // getting updates only after the object has changed since the last
  8926. // request. Use googleapi.IsNotModified to check whether the response
  8927. // error from Do is the result of In-None-Match.
  8928. func (c *OrganizationsSinksListCall) IfNoneMatch(entityTag string) *OrganizationsSinksListCall {
  8929. c.ifNoneMatch_ = entityTag
  8930. return c
  8931. }
  8932. // Context sets the context to be used in this call's Do method. Any
  8933. // pending HTTP request will be aborted if the provided context is
  8934. // canceled.
  8935. func (c *OrganizationsSinksListCall) Context(ctx context.Context) *OrganizationsSinksListCall {
  8936. c.ctx_ = ctx
  8937. return c
  8938. }
  8939. // Header returns an http.Header that can be modified by the caller to
  8940. // add HTTP headers to the request.
  8941. func (c *OrganizationsSinksListCall) Header() http.Header {
  8942. if c.header_ == nil {
  8943. c.header_ = make(http.Header)
  8944. }
  8945. return c.header_
  8946. }
  8947. func (c *OrganizationsSinksListCall) doRequest(alt string) (*http.Response, error) {
  8948. reqHeaders := make(http.Header)
  8949. for k, v := range c.header_ {
  8950. reqHeaders[k] = v
  8951. }
  8952. reqHeaders.Set("User-Agent", c.s.userAgent())
  8953. if c.ifNoneMatch_ != "" {
  8954. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8955. }
  8956. var body io.Reader = nil
  8957. c.urlParams_.Set("alt", alt)
  8958. c.urlParams_.Set("prettyPrint", "false")
  8959. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  8960. urls += "?" + c.urlParams_.Encode()
  8961. req, err := http.NewRequest("GET", urls, body)
  8962. if err != nil {
  8963. return nil, err
  8964. }
  8965. req.Header = reqHeaders
  8966. googleapi.Expand(req.URL, map[string]string{
  8967. "parent": c.parent,
  8968. })
  8969. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8970. }
  8971. // Do executes the "logging.organizations.sinks.list" call.
  8972. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  8973. // non-2xx status code is an error. Response headers are in either
  8974. // *ListSinksResponse.ServerResponse.Header or (if a response was
  8975. // returned at all) in error.(*googleapi.Error).Header. Use
  8976. // googleapi.IsNotModified to check whether the returned error was
  8977. // because http.StatusNotModified was returned.
  8978. func (c *OrganizationsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  8979. gensupport.SetOptions(c.urlParams_, opts...)
  8980. res, err := c.doRequest("json")
  8981. if res != nil && res.StatusCode == http.StatusNotModified {
  8982. if res.Body != nil {
  8983. res.Body.Close()
  8984. }
  8985. return nil, &googleapi.Error{
  8986. Code: res.StatusCode,
  8987. Header: res.Header,
  8988. }
  8989. }
  8990. if err != nil {
  8991. return nil, err
  8992. }
  8993. defer googleapi.CloseBody(res)
  8994. if err := googleapi.CheckResponse(res); err != nil {
  8995. return nil, err
  8996. }
  8997. ret := &ListSinksResponse{
  8998. ServerResponse: googleapi.ServerResponse{
  8999. Header: res.Header,
  9000. HTTPStatusCode: res.StatusCode,
  9001. },
  9002. }
  9003. target := &ret
  9004. if err := gensupport.DecodeResponse(target, res); err != nil {
  9005. return nil, err
  9006. }
  9007. return ret, nil
  9008. // {
  9009. // "description": "Lists sinks.",
  9010. // "flatPath": "v2/organizations/{organizationsId}/sinks",
  9011. // "httpMethod": "GET",
  9012. // "id": "logging.organizations.sinks.list",
  9013. // "parameterOrder": [
  9014. // "parent"
  9015. // ],
  9016. // "parameters": {
  9017. // "pageSize": {
  9018. // "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.",
  9019. // "format": "int32",
  9020. // "location": "query",
  9021. // "type": "integer"
  9022. // },
  9023. // "pageToken": {
  9024. // "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.",
  9025. // "location": "query",
  9026. // "type": "string"
  9027. // },
  9028. // "parent": {
  9029. // "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",
  9030. // "location": "path",
  9031. // "pattern": "^organizations/[^/]+$",
  9032. // "required": true,
  9033. // "type": "string"
  9034. // }
  9035. // },
  9036. // "path": "v2/{+parent}/sinks",
  9037. // "response": {
  9038. // "$ref": "ListSinksResponse"
  9039. // },
  9040. // "scopes": [
  9041. // "https://www.googleapis.com/auth/cloud-platform",
  9042. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9043. // "https://www.googleapis.com/auth/logging.admin",
  9044. // "https://www.googleapis.com/auth/logging.read"
  9045. // ]
  9046. // }
  9047. }
  9048. // Pages invokes f for each page of results.
  9049. // A non-nil error returned from f will halt the iteration.
  9050. // The provided context supersedes any context provided to the Context method.
  9051. func (c *OrganizationsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  9052. c.ctx_ = ctx
  9053. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9054. for {
  9055. x, err := c.Do()
  9056. if err != nil {
  9057. return err
  9058. }
  9059. if err := f(x); err != nil {
  9060. return err
  9061. }
  9062. if x.NextPageToken == "" {
  9063. return nil
  9064. }
  9065. c.PageToken(x.NextPageToken)
  9066. }
  9067. }
  9068. // method id "logging.organizations.sinks.patch":
  9069. type OrganizationsSinksPatchCall struct {
  9070. s *Service
  9071. sinkNameid string
  9072. logsink *LogSink
  9073. urlParams_ gensupport.URLParams
  9074. ctx_ context.Context
  9075. header_ http.Header
  9076. }
  9077. // Patch: Updates a sink. This method replaces the following fields in
  9078. // the existing sink with values from the new sink: destination, and
  9079. // filter.The updated sink might also have a new writer_identity; see
  9080. // the unique_writer_identity field.
  9081. func (r *OrganizationsSinksService) Patch(sinkNameid string, logsink *LogSink) *OrganizationsSinksPatchCall {
  9082. c := &OrganizationsSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9083. c.sinkNameid = sinkNameid
  9084. c.logsink = logsink
  9085. return c
  9086. }
  9087. // UniqueWriterIdentity sets the optional parameter
  9088. // "uniqueWriterIdentity": See sinks.create for a description of this
  9089. // field. When updating a sink, the effect of this field on the value of
  9090. // writer_identity in the updated sink depends on both the old and new
  9091. // values of this field:
  9092. // If the old and new values of this field are both false or both true,
  9093. // then there is no change to the sink's writer_identity.
  9094. // If the old value is false and the new value is true, then
  9095. // writer_identity is changed to a unique service account.
  9096. // It is an error if the old value is true and the new value is set to
  9097. // false or defaulted to false.
  9098. func (c *OrganizationsSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *OrganizationsSinksPatchCall {
  9099. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  9100. return c
  9101. }
  9102. // UpdateMask sets the optional parameter "updateMask": Field mask that
  9103. // specifies the fields in sink that need an update. A sink field will
  9104. // be overwritten if, and only if, it is in the update mask. name and
  9105. // output only fields cannot be updated.An empty updateMask is
  9106. // temporarily treated as using the following mask for backwards
  9107. // compatibility purposes: destination,filter,includeChildren At some
  9108. // point in the future, behavior will be removed and specifying an empty
  9109. // updateMask will be an error.For a detailed FieldMask definition, see
  9110. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  9111. // updateMask=filter.
  9112. func (c *OrganizationsSinksPatchCall) UpdateMask(updateMask string) *OrganizationsSinksPatchCall {
  9113. c.urlParams_.Set("updateMask", updateMask)
  9114. return c
  9115. }
  9116. // Fields allows partial responses to be retrieved. See
  9117. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9118. // for more information.
  9119. func (c *OrganizationsSinksPatchCall) Fields(s ...googleapi.Field) *OrganizationsSinksPatchCall {
  9120. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9121. return c
  9122. }
  9123. // Context sets the context to be used in this call's Do method. Any
  9124. // pending HTTP request will be aborted if the provided context is
  9125. // canceled.
  9126. func (c *OrganizationsSinksPatchCall) Context(ctx context.Context) *OrganizationsSinksPatchCall {
  9127. c.ctx_ = ctx
  9128. return c
  9129. }
  9130. // Header returns an http.Header that can be modified by the caller to
  9131. // add HTTP headers to the request.
  9132. func (c *OrganizationsSinksPatchCall) Header() http.Header {
  9133. if c.header_ == nil {
  9134. c.header_ = make(http.Header)
  9135. }
  9136. return c.header_
  9137. }
  9138. func (c *OrganizationsSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  9139. reqHeaders := make(http.Header)
  9140. for k, v := range c.header_ {
  9141. reqHeaders[k] = v
  9142. }
  9143. reqHeaders.Set("User-Agent", c.s.userAgent())
  9144. var body io.Reader = nil
  9145. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  9146. if err != nil {
  9147. return nil, err
  9148. }
  9149. reqHeaders.Set("Content-Type", "application/json")
  9150. c.urlParams_.Set("alt", alt)
  9151. c.urlParams_.Set("prettyPrint", "false")
  9152. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  9153. urls += "?" + c.urlParams_.Encode()
  9154. req, err := http.NewRequest("PATCH", urls, body)
  9155. if err != nil {
  9156. return nil, err
  9157. }
  9158. req.Header = reqHeaders
  9159. googleapi.Expand(req.URL, map[string]string{
  9160. "sinkName": c.sinkNameid,
  9161. })
  9162. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9163. }
  9164. // Do executes the "logging.organizations.sinks.patch" call.
  9165. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  9166. // code is an error. Response headers are in either
  9167. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  9168. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9169. // check whether the returned error was because http.StatusNotModified
  9170. // was returned.
  9171. func (c *OrganizationsSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  9172. gensupport.SetOptions(c.urlParams_, opts...)
  9173. res, err := c.doRequest("json")
  9174. if res != nil && res.StatusCode == http.StatusNotModified {
  9175. if res.Body != nil {
  9176. res.Body.Close()
  9177. }
  9178. return nil, &googleapi.Error{
  9179. Code: res.StatusCode,
  9180. Header: res.Header,
  9181. }
  9182. }
  9183. if err != nil {
  9184. return nil, err
  9185. }
  9186. defer googleapi.CloseBody(res)
  9187. if err := googleapi.CheckResponse(res); err != nil {
  9188. return nil, err
  9189. }
  9190. ret := &LogSink{
  9191. ServerResponse: googleapi.ServerResponse{
  9192. Header: res.Header,
  9193. HTTPStatusCode: res.StatusCode,
  9194. },
  9195. }
  9196. target := &ret
  9197. if err := gensupport.DecodeResponse(target, res); err != nil {
  9198. return nil, err
  9199. }
  9200. return ret, nil
  9201. // {
  9202. // "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.",
  9203. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  9204. // "httpMethod": "PATCH",
  9205. // "id": "logging.organizations.sinks.patch",
  9206. // "parameterOrder": [
  9207. // "sinkName"
  9208. // ],
  9209. // "parameters": {
  9210. // "sinkName": {
  9211. // "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\".",
  9212. // "location": "path",
  9213. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  9214. // "required": true,
  9215. // "type": "string"
  9216. // },
  9217. // "uniqueWriterIdentity": {
  9218. // "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.",
  9219. // "location": "query",
  9220. // "type": "boolean"
  9221. // },
  9222. // "updateMask": {
  9223. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  9224. // "format": "google-fieldmask",
  9225. // "location": "query",
  9226. // "type": "string"
  9227. // }
  9228. // },
  9229. // "path": "v2/{+sinkName}",
  9230. // "request": {
  9231. // "$ref": "LogSink"
  9232. // },
  9233. // "response": {
  9234. // "$ref": "LogSink"
  9235. // },
  9236. // "scopes": [
  9237. // "https://www.googleapis.com/auth/cloud-platform",
  9238. // "https://www.googleapis.com/auth/logging.admin"
  9239. // ]
  9240. // }
  9241. }
  9242. // method id "logging.organizations.sinks.update":
  9243. type OrganizationsSinksUpdateCall struct {
  9244. s *Service
  9245. sinkNameid string
  9246. logsink *LogSink
  9247. urlParams_ gensupport.URLParams
  9248. ctx_ context.Context
  9249. header_ http.Header
  9250. }
  9251. // Update: Updates a sink. This method replaces the following fields in
  9252. // the existing sink with values from the new sink: destination, and
  9253. // filter.The updated sink might also have a new writer_identity; see
  9254. // the unique_writer_identity field.
  9255. func (r *OrganizationsSinksService) Update(sinkNameid string, logsink *LogSink) *OrganizationsSinksUpdateCall {
  9256. c := &OrganizationsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9257. c.sinkNameid = sinkNameid
  9258. c.logsink = logsink
  9259. return c
  9260. }
  9261. // UniqueWriterIdentity sets the optional parameter
  9262. // "uniqueWriterIdentity": See sinks.create for a description of this
  9263. // field. When updating a sink, the effect of this field on the value of
  9264. // writer_identity in the updated sink depends on both the old and new
  9265. // values of this field:
  9266. // If the old and new values of this field are both false or both true,
  9267. // then there is no change to the sink's writer_identity.
  9268. // If the old value is false and the new value is true, then
  9269. // writer_identity is changed to a unique service account.
  9270. // It is an error if the old value is true and the new value is set to
  9271. // false or defaulted to false.
  9272. func (c *OrganizationsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *OrganizationsSinksUpdateCall {
  9273. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  9274. return c
  9275. }
  9276. // UpdateMask sets the optional parameter "updateMask": Field mask that
  9277. // specifies the fields in sink that need an update. A sink field will
  9278. // be overwritten if, and only if, it is in the update mask. name and
  9279. // output only fields cannot be updated.An empty updateMask is
  9280. // temporarily treated as using the following mask for backwards
  9281. // compatibility purposes: destination,filter,includeChildren At some
  9282. // point in the future, behavior will be removed and specifying an empty
  9283. // updateMask will be an error.For a detailed FieldMask definition, see
  9284. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  9285. // updateMask=filter.
  9286. func (c *OrganizationsSinksUpdateCall) UpdateMask(updateMask string) *OrganizationsSinksUpdateCall {
  9287. c.urlParams_.Set("updateMask", updateMask)
  9288. return c
  9289. }
  9290. // Fields allows partial responses to be retrieved. See
  9291. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9292. // for more information.
  9293. func (c *OrganizationsSinksUpdateCall) Fields(s ...googleapi.Field) *OrganizationsSinksUpdateCall {
  9294. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9295. return c
  9296. }
  9297. // Context sets the context to be used in this call's Do method. Any
  9298. // pending HTTP request will be aborted if the provided context is
  9299. // canceled.
  9300. func (c *OrganizationsSinksUpdateCall) Context(ctx context.Context) *OrganizationsSinksUpdateCall {
  9301. c.ctx_ = ctx
  9302. return c
  9303. }
  9304. // Header returns an http.Header that can be modified by the caller to
  9305. // add HTTP headers to the request.
  9306. func (c *OrganizationsSinksUpdateCall) Header() http.Header {
  9307. if c.header_ == nil {
  9308. c.header_ = make(http.Header)
  9309. }
  9310. return c.header_
  9311. }
  9312. func (c *OrganizationsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  9313. reqHeaders := make(http.Header)
  9314. for k, v := range c.header_ {
  9315. reqHeaders[k] = v
  9316. }
  9317. reqHeaders.Set("User-Agent", c.s.userAgent())
  9318. var body io.Reader = nil
  9319. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  9320. if err != nil {
  9321. return nil, err
  9322. }
  9323. reqHeaders.Set("Content-Type", "application/json")
  9324. c.urlParams_.Set("alt", alt)
  9325. c.urlParams_.Set("prettyPrint", "false")
  9326. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  9327. urls += "?" + c.urlParams_.Encode()
  9328. req, err := http.NewRequest("PUT", urls, body)
  9329. if err != nil {
  9330. return nil, err
  9331. }
  9332. req.Header = reqHeaders
  9333. googleapi.Expand(req.URL, map[string]string{
  9334. "sinkName": c.sinkNameid,
  9335. })
  9336. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9337. }
  9338. // Do executes the "logging.organizations.sinks.update" call.
  9339. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  9340. // code is an error. Response headers are in either
  9341. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  9342. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9343. // check whether the returned error was because http.StatusNotModified
  9344. // was returned.
  9345. func (c *OrganizationsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  9346. gensupport.SetOptions(c.urlParams_, opts...)
  9347. res, err := c.doRequest("json")
  9348. if res != nil && res.StatusCode == http.StatusNotModified {
  9349. if res.Body != nil {
  9350. res.Body.Close()
  9351. }
  9352. return nil, &googleapi.Error{
  9353. Code: res.StatusCode,
  9354. Header: res.Header,
  9355. }
  9356. }
  9357. if err != nil {
  9358. return nil, err
  9359. }
  9360. defer googleapi.CloseBody(res)
  9361. if err := googleapi.CheckResponse(res); err != nil {
  9362. return nil, err
  9363. }
  9364. ret := &LogSink{
  9365. ServerResponse: googleapi.ServerResponse{
  9366. Header: res.Header,
  9367. HTTPStatusCode: res.StatusCode,
  9368. },
  9369. }
  9370. target := &ret
  9371. if err := gensupport.DecodeResponse(target, res); err != nil {
  9372. return nil, err
  9373. }
  9374. return ret, nil
  9375. // {
  9376. // "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.",
  9377. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  9378. // "httpMethod": "PUT",
  9379. // "id": "logging.organizations.sinks.update",
  9380. // "parameterOrder": [
  9381. // "sinkName"
  9382. // ],
  9383. // "parameters": {
  9384. // "sinkName": {
  9385. // "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\".",
  9386. // "location": "path",
  9387. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  9388. // "required": true,
  9389. // "type": "string"
  9390. // },
  9391. // "uniqueWriterIdentity": {
  9392. // "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.",
  9393. // "location": "query",
  9394. // "type": "boolean"
  9395. // },
  9396. // "updateMask": {
  9397. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  9398. // "format": "google-fieldmask",
  9399. // "location": "query",
  9400. // "type": "string"
  9401. // }
  9402. // },
  9403. // "path": "v2/{+sinkName}",
  9404. // "request": {
  9405. // "$ref": "LogSink"
  9406. // },
  9407. // "response": {
  9408. // "$ref": "LogSink"
  9409. // },
  9410. // "scopes": [
  9411. // "https://www.googleapis.com/auth/cloud-platform",
  9412. // "https://www.googleapis.com/auth/logging.admin"
  9413. // ]
  9414. // }
  9415. }
  9416. // method id "logging.projects.exclusions.create":
  9417. type ProjectsExclusionsCreateCall struct {
  9418. s *Service
  9419. parent string
  9420. logexclusion *LogExclusion
  9421. urlParams_ gensupport.URLParams
  9422. ctx_ context.Context
  9423. header_ http.Header
  9424. }
  9425. // Create: Creates a new exclusion in a specified parent resource. Only
  9426. // log entries belonging to that resource can be excluded. You can have
  9427. // up to 10 exclusions in a resource.
  9428. func (r *ProjectsExclusionsService) Create(parent string, logexclusion *LogExclusion) *ProjectsExclusionsCreateCall {
  9429. c := &ProjectsExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9430. c.parent = parent
  9431. c.logexclusion = logexclusion
  9432. return c
  9433. }
  9434. // Fields allows partial responses to be retrieved. See
  9435. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9436. // for more information.
  9437. func (c *ProjectsExclusionsCreateCall) Fields(s ...googleapi.Field) *ProjectsExclusionsCreateCall {
  9438. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9439. return c
  9440. }
  9441. // Context sets the context to be used in this call's Do method. Any
  9442. // pending HTTP request will be aborted if the provided context is
  9443. // canceled.
  9444. func (c *ProjectsExclusionsCreateCall) Context(ctx context.Context) *ProjectsExclusionsCreateCall {
  9445. c.ctx_ = ctx
  9446. return c
  9447. }
  9448. // Header returns an http.Header that can be modified by the caller to
  9449. // add HTTP headers to the request.
  9450. func (c *ProjectsExclusionsCreateCall) Header() http.Header {
  9451. if c.header_ == nil {
  9452. c.header_ = make(http.Header)
  9453. }
  9454. return c.header_
  9455. }
  9456. func (c *ProjectsExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  9457. reqHeaders := make(http.Header)
  9458. for k, v := range c.header_ {
  9459. reqHeaders[k] = v
  9460. }
  9461. reqHeaders.Set("User-Agent", c.s.userAgent())
  9462. var body io.Reader = nil
  9463. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  9464. if err != nil {
  9465. return nil, err
  9466. }
  9467. reqHeaders.Set("Content-Type", "application/json")
  9468. c.urlParams_.Set("alt", alt)
  9469. c.urlParams_.Set("prettyPrint", "false")
  9470. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  9471. urls += "?" + c.urlParams_.Encode()
  9472. req, err := http.NewRequest("POST", urls, body)
  9473. if err != nil {
  9474. return nil, err
  9475. }
  9476. req.Header = reqHeaders
  9477. googleapi.Expand(req.URL, map[string]string{
  9478. "parent": c.parent,
  9479. })
  9480. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9481. }
  9482. // Do executes the "logging.projects.exclusions.create" call.
  9483. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  9484. // status code is an error. Response headers are in either
  9485. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  9486. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9487. // to check whether the returned error was because
  9488. // http.StatusNotModified was returned.
  9489. func (c *ProjectsExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  9490. gensupport.SetOptions(c.urlParams_, opts...)
  9491. res, err := c.doRequest("json")
  9492. if res != nil && res.StatusCode == http.StatusNotModified {
  9493. if res.Body != nil {
  9494. res.Body.Close()
  9495. }
  9496. return nil, &googleapi.Error{
  9497. Code: res.StatusCode,
  9498. Header: res.Header,
  9499. }
  9500. }
  9501. if err != nil {
  9502. return nil, err
  9503. }
  9504. defer googleapi.CloseBody(res)
  9505. if err := googleapi.CheckResponse(res); err != nil {
  9506. return nil, err
  9507. }
  9508. ret := &LogExclusion{
  9509. ServerResponse: googleapi.ServerResponse{
  9510. Header: res.Header,
  9511. HTTPStatusCode: res.StatusCode,
  9512. },
  9513. }
  9514. target := &ret
  9515. if err := gensupport.DecodeResponse(target, res); err != nil {
  9516. return nil, err
  9517. }
  9518. return ret, nil
  9519. // {
  9520. // "description": "Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.",
  9521. // "flatPath": "v2/projects/{projectsId}/exclusions",
  9522. // "httpMethod": "POST",
  9523. // "id": "logging.projects.exclusions.create",
  9524. // "parameterOrder": [
  9525. // "parent"
  9526. // ],
  9527. // "parameters": {
  9528. // "parent": {
  9529. // "description": "Required. The parent resource in which to create the exclusion:\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\nExamples: \"projects/my-logging-project\", \"organizations/123456789\".",
  9530. // "location": "path",
  9531. // "pattern": "^projects/[^/]+$",
  9532. // "required": true,
  9533. // "type": "string"
  9534. // }
  9535. // },
  9536. // "path": "v2/{+parent}/exclusions",
  9537. // "request": {
  9538. // "$ref": "LogExclusion"
  9539. // },
  9540. // "response": {
  9541. // "$ref": "LogExclusion"
  9542. // },
  9543. // "scopes": [
  9544. // "https://www.googleapis.com/auth/cloud-platform",
  9545. // "https://www.googleapis.com/auth/logging.admin"
  9546. // ]
  9547. // }
  9548. }
  9549. // method id "logging.projects.exclusions.delete":
  9550. type ProjectsExclusionsDeleteCall struct {
  9551. s *Service
  9552. name string
  9553. urlParams_ gensupport.URLParams
  9554. ctx_ context.Context
  9555. header_ http.Header
  9556. }
  9557. // Delete: Deletes an exclusion.
  9558. func (r *ProjectsExclusionsService) Delete(name string) *ProjectsExclusionsDeleteCall {
  9559. c := &ProjectsExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9560. c.name = name
  9561. return c
  9562. }
  9563. // Fields allows partial responses to be retrieved. See
  9564. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9565. // for more information.
  9566. func (c *ProjectsExclusionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsExclusionsDeleteCall {
  9567. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9568. return c
  9569. }
  9570. // Context sets the context to be used in this call's Do method. Any
  9571. // pending HTTP request will be aborted if the provided context is
  9572. // canceled.
  9573. func (c *ProjectsExclusionsDeleteCall) Context(ctx context.Context) *ProjectsExclusionsDeleteCall {
  9574. c.ctx_ = ctx
  9575. return c
  9576. }
  9577. // Header returns an http.Header that can be modified by the caller to
  9578. // add HTTP headers to the request.
  9579. func (c *ProjectsExclusionsDeleteCall) Header() http.Header {
  9580. if c.header_ == nil {
  9581. c.header_ = make(http.Header)
  9582. }
  9583. return c.header_
  9584. }
  9585. func (c *ProjectsExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9586. reqHeaders := make(http.Header)
  9587. for k, v := range c.header_ {
  9588. reqHeaders[k] = v
  9589. }
  9590. reqHeaders.Set("User-Agent", c.s.userAgent())
  9591. var body io.Reader = nil
  9592. c.urlParams_.Set("alt", alt)
  9593. c.urlParams_.Set("prettyPrint", "false")
  9594. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  9595. urls += "?" + c.urlParams_.Encode()
  9596. req, err := http.NewRequest("DELETE", urls, body)
  9597. if err != nil {
  9598. return nil, err
  9599. }
  9600. req.Header = reqHeaders
  9601. googleapi.Expand(req.URL, map[string]string{
  9602. "name": c.name,
  9603. })
  9604. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9605. }
  9606. // Do executes the "logging.projects.exclusions.delete" call.
  9607. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9608. // code is an error. Response headers are in either
  9609. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9610. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9611. // check whether the returned error was because http.StatusNotModified
  9612. // was returned.
  9613. func (c *ProjectsExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9614. gensupport.SetOptions(c.urlParams_, opts...)
  9615. res, err := c.doRequest("json")
  9616. if res != nil && res.StatusCode == http.StatusNotModified {
  9617. if res.Body != nil {
  9618. res.Body.Close()
  9619. }
  9620. return nil, &googleapi.Error{
  9621. Code: res.StatusCode,
  9622. Header: res.Header,
  9623. }
  9624. }
  9625. if err != nil {
  9626. return nil, err
  9627. }
  9628. defer googleapi.CloseBody(res)
  9629. if err := googleapi.CheckResponse(res); err != nil {
  9630. return nil, err
  9631. }
  9632. ret := &Empty{
  9633. ServerResponse: googleapi.ServerResponse{
  9634. Header: res.Header,
  9635. HTTPStatusCode: res.StatusCode,
  9636. },
  9637. }
  9638. target := &ret
  9639. if err := gensupport.DecodeResponse(target, res); err != nil {
  9640. return nil, err
  9641. }
  9642. return ret, nil
  9643. // {
  9644. // "description": "Deletes an exclusion.",
  9645. // "flatPath": "v2/projects/{projectsId}/exclusions/{exclusionsId}",
  9646. // "httpMethod": "DELETE",
  9647. // "id": "logging.projects.exclusions.delete",
  9648. // "parameterOrder": [
  9649. // "name"
  9650. // ],
  9651. // "parameters": {
  9652. // "name": {
  9653. // "description": "Required. The resource name of an existing exclusion to delete:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  9654. // "location": "path",
  9655. // "pattern": "^projects/[^/]+/exclusions/[^/]+$",
  9656. // "required": true,
  9657. // "type": "string"
  9658. // }
  9659. // },
  9660. // "path": "v2/{+name}",
  9661. // "response": {
  9662. // "$ref": "Empty"
  9663. // },
  9664. // "scopes": [
  9665. // "https://www.googleapis.com/auth/cloud-platform",
  9666. // "https://www.googleapis.com/auth/logging.admin"
  9667. // ]
  9668. // }
  9669. }
  9670. // method id "logging.projects.exclusions.get":
  9671. type ProjectsExclusionsGetCall struct {
  9672. s *Service
  9673. name string
  9674. urlParams_ gensupport.URLParams
  9675. ifNoneMatch_ string
  9676. ctx_ context.Context
  9677. header_ http.Header
  9678. }
  9679. // Get: Gets the description of an exclusion.
  9680. func (r *ProjectsExclusionsService) Get(name string) *ProjectsExclusionsGetCall {
  9681. c := &ProjectsExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9682. c.name = name
  9683. return c
  9684. }
  9685. // Fields allows partial responses to be retrieved. See
  9686. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9687. // for more information.
  9688. func (c *ProjectsExclusionsGetCall) Fields(s ...googleapi.Field) *ProjectsExclusionsGetCall {
  9689. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9690. return c
  9691. }
  9692. // IfNoneMatch sets the optional parameter which makes the operation
  9693. // fail if the object's ETag matches the given value. This is useful for
  9694. // getting updates only after the object has changed since the last
  9695. // request. Use googleapi.IsNotModified to check whether the response
  9696. // error from Do is the result of In-None-Match.
  9697. func (c *ProjectsExclusionsGetCall) IfNoneMatch(entityTag string) *ProjectsExclusionsGetCall {
  9698. c.ifNoneMatch_ = entityTag
  9699. return c
  9700. }
  9701. // Context sets the context to be used in this call's Do method. Any
  9702. // pending HTTP request will be aborted if the provided context is
  9703. // canceled.
  9704. func (c *ProjectsExclusionsGetCall) Context(ctx context.Context) *ProjectsExclusionsGetCall {
  9705. c.ctx_ = ctx
  9706. return c
  9707. }
  9708. // Header returns an http.Header that can be modified by the caller to
  9709. // add HTTP headers to the request.
  9710. func (c *ProjectsExclusionsGetCall) Header() http.Header {
  9711. if c.header_ == nil {
  9712. c.header_ = make(http.Header)
  9713. }
  9714. return c.header_
  9715. }
  9716. func (c *ProjectsExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  9717. reqHeaders := make(http.Header)
  9718. for k, v := range c.header_ {
  9719. reqHeaders[k] = v
  9720. }
  9721. reqHeaders.Set("User-Agent", c.s.userAgent())
  9722. if c.ifNoneMatch_ != "" {
  9723. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9724. }
  9725. var body io.Reader = nil
  9726. c.urlParams_.Set("alt", alt)
  9727. c.urlParams_.Set("prettyPrint", "false")
  9728. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  9729. urls += "?" + c.urlParams_.Encode()
  9730. req, err := http.NewRequest("GET", urls, body)
  9731. if err != nil {
  9732. return nil, err
  9733. }
  9734. req.Header = reqHeaders
  9735. googleapi.Expand(req.URL, map[string]string{
  9736. "name": c.name,
  9737. })
  9738. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9739. }
  9740. // Do executes the "logging.projects.exclusions.get" call.
  9741. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  9742. // status code is an error. Response headers are in either
  9743. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  9744. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9745. // to check whether the returned error was because
  9746. // http.StatusNotModified was returned.
  9747. func (c *ProjectsExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  9748. gensupport.SetOptions(c.urlParams_, opts...)
  9749. res, err := c.doRequest("json")
  9750. if res != nil && res.StatusCode == http.StatusNotModified {
  9751. if res.Body != nil {
  9752. res.Body.Close()
  9753. }
  9754. return nil, &googleapi.Error{
  9755. Code: res.StatusCode,
  9756. Header: res.Header,
  9757. }
  9758. }
  9759. if err != nil {
  9760. return nil, err
  9761. }
  9762. defer googleapi.CloseBody(res)
  9763. if err := googleapi.CheckResponse(res); err != nil {
  9764. return nil, err
  9765. }
  9766. ret := &LogExclusion{
  9767. ServerResponse: googleapi.ServerResponse{
  9768. Header: res.Header,
  9769. HTTPStatusCode: res.StatusCode,
  9770. },
  9771. }
  9772. target := &ret
  9773. if err := gensupport.DecodeResponse(target, res); err != nil {
  9774. return nil, err
  9775. }
  9776. return ret, nil
  9777. // {
  9778. // "description": "Gets the description of an exclusion.",
  9779. // "flatPath": "v2/projects/{projectsId}/exclusions/{exclusionsId}",
  9780. // "httpMethod": "GET",
  9781. // "id": "logging.projects.exclusions.get",
  9782. // "parameterOrder": [
  9783. // "name"
  9784. // ],
  9785. // "parameters": {
  9786. // "name": {
  9787. // "description": "Required. The resource name of an existing exclusion:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  9788. // "location": "path",
  9789. // "pattern": "^projects/[^/]+/exclusions/[^/]+$",
  9790. // "required": true,
  9791. // "type": "string"
  9792. // }
  9793. // },
  9794. // "path": "v2/{+name}",
  9795. // "response": {
  9796. // "$ref": "LogExclusion"
  9797. // },
  9798. // "scopes": [
  9799. // "https://www.googleapis.com/auth/cloud-platform",
  9800. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9801. // "https://www.googleapis.com/auth/logging.admin",
  9802. // "https://www.googleapis.com/auth/logging.read"
  9803. // ]
  9804. // }
  9805. }
  9806. // method id "logging.projects.exclusions.list":
  9807. type ProjectsExclusionsListCall struct {
  9808. s *Service
  9809. parent string
  9810. urlParams_ gensupport.URLParams
  9811. ifNoneMatch_ string
  9812. ctx_ context.Context
  9813. header_ http.Header
  9814. }
  9815. // List: Lists all the exclusions in a parent resource.
  9816. func (r *ProjectsExclusionsService) List(parent string) *ProjectsExclusionsListCall {
  9817. c := &ProjectsExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9818. c.parent = parent
  9819. return c
  9820. }
  9821. // PageSize sets the optional parameter "pageSize": The maximum number
  9822. // of results to return from this request. Non-positive values are
  9823. // ignored. The presence of nextPageToken in the response indicates that
  9824. // more results might be available.
  9825. func (c *ProjectsExclusionsListCall) PageSize(pageSize int64) *ProjectsExclusionsListCall {
  9826. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  9827. return c
  9828. }
  9829. // PageToken sets the optional parameter "pageToken": If present, then
  9830. // retrieve the next batch of results from the preceding call to this
  9831. // method. pageToken must be the value of nextPageToken from the
  9832. // previous response. The values of other method parameters should be
  9833. // identical to those in the previous call.
  9834. func (c *ProjectsExclusionsListCall) PageToken(pageToken string) *ProjectsExclusionsListCall {
  9835. c.urlParams_.Set("pageToken", pageToken)
  9836. return c
  9837. }
  9838. // Fields allows partial responses to be retrieved. See
  9839. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9840. // for more information.
  9841. func (c *ProjectsExclusionsListCall) Fields(s ...googleapi.Field) *ProjectsExclusionsListCall {
  9842. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9843. return c
  9844. }
  9845. // IfNoneMatch sets the optional parameter which makes the operation
  9846. // fail if the object's ETag matches the given value. This is useful for
  9847. // getting updates only after the object has changed since the last
  9848. // request. Use googleapi.IsNotModified to check whether the response
  9849. // error from Do is the result of In-None-Match.
  9850. func (c *ProjectsExclusionsListCall) IfNoneMatch(entityTag string) *ProjectsExclusionsListCall {
  9851. c.ifNoneMatch_ = entityTag
  9852. return c
  9853. }
  9854. // Context sets the context to be used in this call's Do method. Any
  9855. // pending HTTP request will be aborted if the provided context is
  9856. // canceled.
  9857. func (c *ProjectsExclusionsListCall) Context(ctx context.Context) *ProjectsExclusionsListCall {
  9858. c.ctx_ = ctx
  9859. return c
  9860. }
  9861. // Header returns an http.Header that can be modified by the caller to
  9862. // add HTTP headers to the request.
  9863. func (c *ProjectsExclusionsListCall) Header() http.Header {
  9864. if c.header_ == nil {
  9865. c.header_ = make(http.Header)
  9866. }
  9867. return c.header_
  9868. }
  9869. func (c *ProjectsExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  9870. reqHeaders := make(http.Header)
  9871. for k, v := range c.header_ {
  9872. reqHeaders[k] = v
  9873. }
  9874. reqHeaders.Set("User-Agent", c.s.userAgent())
  9875. if c.ifNoneMatch_ != "" {
  9876. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9877. }
  9878. var body io.Reader = nil
  9879. c.urlParams_.Set("alt", alt)
  9880. c.urlParams_.Set("prettyPrint", "false")
  9881. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  9882. urls += "?" + c.urlParams_.Encode()
  9883. req, err := http.NewRequest("GET", urls, body)
  9884. if err != nil {
  9885. return nil, err
  9886. }
  9887. req.Header = reqHeaders
  9888. googleapi.Expand(req.URL, map[string]string{
  9889. "parent": c.parent,
  9890. })
  9891. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9892. }
  9893. // Do executes the "logging.projects.exclusions.list" call.
  9894. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  9895. // non-2xx status code is an error. Response headers are in either
  9896. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  9897. // returned at all) in error.(*googleapi.Error).Header. Use
  9898. // googleapi.IsNotModified to check whether the returned error was
  9899. // because http.StatusNotModified was returned.
  9900. func (c *ProjectsExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  9901. gensupport.SetOptions(c.urlParams_, opts...)
  9902. res, err := c.doRequest("json")
  9903. if res != nil && res.StatusCode == http.StatusNotModified {
  9904. if res.Body != nil {
  9905. res.Body.Close()
  9906. }
  9907. return nil, &googleapi.Error{
  9908. Code: res.StatusCode,
  9909. Header: res.Header,
  9910. }
  9911. }
  9912. if err != nil {
  9913. return nil, err
  9914. }
  9915. defer googleapi.CloseBody(res)
  9916. if err := googleapi.CheckResponse(res); err != nil {
  9917. return nil, err
  9918. }
  9919. ret := &ListExclusionsResponse{
  9920. ServerResponse: googleapi.ServerResponse{
  9921. Header: res.Header,
  9922. HTTPStatusCode: res.StatusCode,
  9923. },
  9924. }
  9925. target := &ret
  9926. if err := gensupport.DecodeResponse(target, res); err != nil {
  9927. return nil, err
  9928. }
  9929. return ret, nil
  9930. // {
  9931. // "description": "Lists all the exclusions in a parent resource.",
  9932. // "flatPath": "v2/projects/{projectsId}/exclusions",
  9933. // "httpMethod": "GET",
  9934. // "id": "logging.projects.exclusions.list",
  9935. // "parameterOrder": [
  9936. // "parent"
  9937. // ],
  9938. // "parameters": {
  9939. // "pageSize": {
  9940. // "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.",
  9941. // "format": "int32",
  9942. // "location": "query",
  9943. // "type": "integer"
  9944. // },
  9945. // "pageToken": {
  9946. // "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.",
  9947. // "location": "query",
  9948. // "type": "string"
  9949. // },
  9950. // "parent": {
  9951. // "description": "Required. The parent resource whose exclusions are to be listed.\n\"projects/[PROJECT_ID]\"\n\"organizations/[ORGANIZATION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]\"\n\"folders/[FOLDER_ID]\"\n",
  9952. // "location": "path",
  9953. // "pattern": "^projects/[^/]+$",
  9954. // "required": true,
  9955. // "type": "string"
  9956. // }
  9957. // },
  9958. // "path": "v2/{+parent}/exclusions",
  9959. // "response": {
  9960. // "$ref": "ListExclusionsResponse"
  9961. // },
  9962. // "scopes": [
  9963. // "https://www.googleapis.com/auth/cloud-platform",
  9964. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9965. // "https://www.googleapis.com/auth/logging.admin",
  9966. // "https://www.googleapis.com/auth/logging.read"
  9967. // ]
  9968. // }
  9969. }
  9970. // Pages invokes f for each page of results.
  9971. // A non-nil error returned from f will halt the iteration.
  9972. // The provided context supersedes any context provided to the Context method.
  9973. func (c *ProjectsExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  9974. c.ctx_ = ctx
  9975. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9976. for {
  9977. x, err := c.Do()
  9978. if err != nil {
  9979. return err
  9980. }
  9981. if err := f(x); err != nil {
  9982. return err
  9983. }
  9984. if x.NextPageToken == "" {
  9985. return nil
  9986. }
  9987. c.PageToken(x.NextPageToken)
  9988. }
  9989. }
  9990. // method id "logging.projects.exclusions.patch":
  9991. type ProjectsExclusionsPatchCall struct {
  9992. s *Service
  9993. name string
  9994. logexclusion *LogExclusion
  9995. urlParams_ gensupport.URLParams
  9996. ctx_ context.Context
  9997. header_ http.Header
  9998. }
  9999. // Patch: Changes one or more properties of an existing exclusion.
  10000. func (r *ProjectsExclusionsService) Patch(name string, logexclusion *LogExclusion) *ProjectsExclusionsPatchCall {
  10001. c := &ProjectsExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10002. c.name = name
  10003. c.logexclusion = logexclusion
  10004. return c
  10005. }
  10006. // UpdateMask sets the optional parameter "updateMask": Required. A
  10007. // nonempty list of fields to change in the existing exclusion. New
  10008. // values for the fields are taken from the corresponding fields in the
  10009. // LogExclusion included in this request. Fields not mentioned in
  10010. // update_mask are not changed and are ignored in the request.For
  10011. // example, to change the filter and description of an exclusion,
  10012. // specify an update_mask of "filter,description".
  10013. func (c *ProjectsExclusionsPatchCall) UpdateMask(updateMask string) *ProjectsExclusionsPatchCall {
  10014. c.urlParams_.Set("updateMask", updateMask)
  10015. return c
  10016. }
  10017. // Fields allows partial responses to be retrieved. See
  10018. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10019. // for more information.
  10020. func (c *ProjectsExclusionsPatchCall) Fields(s ...googleapi.Field) *ProjectsExclusionsPatchCall {
  10021. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10022. return c
  10023. }
  10024. // Context sets the context to be used in this call's Do method. Any
  10025. // pending HTTP request will be aborted if the provided context is
  10026. // canceled.
  10027. func (c *ProjectsExclusionsPatchCall) Context(ctx context.Context) *ProjectsExclusionsPatchCall {
  10028. c.ctx_ = ctx
  10029. return c
  10030. }
  10031. // Header returns an http.Header that can be modified by the caller to
  10032. // add HTTP headers to the request.
  10033. func (c *ProjectsExclusionsPatchCall) Header() http.Header {
  10034. if c.header_ == nil {
  10035. c.header_ = make(http.Header)
  10036. }
  10037. return c.header_
  10038. }
  10039. func (c *ProjectsExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  10040. reqHeaders := make(http.Header)
  10041. for k, v := range c.header_ {
  10042. reqHeaders[k] = v
  10043. }
  10044. reqHeaders.Set("User-Agent", c.s.userAgent())
  10045. var body io.Reader = nil
  10046. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  10047. if err != nil {
  10048. return nil, err
  10049. }
  10050. reqHeaders.Set("Content-Type", "application/json")
  10051. c.urlParams_.Set("alt", alt)
  10052. c.urlParams_.Set("prettyPrint", "false")
  10053. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  10054. urls += "?" + c.urlParams_.Encode()
  10055. req, err := http.NewRequest("PATCH", urls, body)
  10056. if err != nil {
  10057. return nil, err
  10058. }
  10059. req.Header = reqHeaders
  10060. googleapi.Expand(req.URL, map[string]string{
  10061. "name": c.name,
  10062. })
  10063. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10064. }
  10065. // Do executes the "logging.projects.exclusions.patch" call.
  10066. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  10067. // status code is an error. Response headers are in either
  10068. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  10069. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10070. // to check whether the returned error was because
  10071. // http.StatusNotModified was returned.
  10072. func (c *ProjectsExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  10073. gensupport.SetOptions(c.urlParams_, opts...)
  10074. res, err := c.doRequest("json")
  10075. if res != nil && res.StatusCode == http.StatusNotModified {
  10076. if res.Body != nil {
  10077. res.Body.Close()
  10078. }
  10079. return nil, &googleapi.Error{
  10080. Code: res.StatusCode,
  10081. Header: res.Header,
  10082. }
  10083. }
  10084. if err != nil {
  10085. return nil, err
  10086. }
  10087. defer googleapi.CloseBody(res)
  10088. if err := googleapi.CheckResponse(res); err != nil {
  10089. return nil, err
  10090. }
  10091. ret := &LogExclusion{
  10092. ServerResponse: googleapi.ServerResponse{
  10093. Header: res.Header,
  10094. HTTPStatusCode: res.StatusCode,
  10095. },
  10096. }
  10097. target := &ret
  10098. if err := gensupport.DecodeResponse(target, res); err != nil {
  10099. return nil, err
  10100. }
  10101. return ret, nil
  10102. // {
  10103. // "description": "Changes one or more properties of an existing exclusion.",
  10104. // "flatPath": "v2/projects/{projectsId}/exclusions/{exclusionsId}",
  10105. // "httpMethod": "PATCH",
  10106. // "id": "logging.projects.exclusions.patch",
  10107. // "parameterOrder": [
  10108. // "name"
  10109. // ],
  10110. // "parameters": {
  10111. // "name": {
  10112. // "description": "Required. The resource name of the exclusion to update:\n\"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]\"\n\"organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]\"\n\"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]\"\n\"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]\"\nExample: \"projects/my-project-id/exclusions/my-exclusion-id\".",
  10113. // "location": "path",
  10114. // "pattern": "^projects/[^/]+/exclusions/[^/]+$",
  10115. // "required": true,
  10116. // "type": "string"
  10117. // },
  10118. // "updateMask": {
  10119. // "description": "Required. A nonempty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the LogExclusion included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.For example, to change the filter and description of an exclusion, specify an update_mask of \"filter,description\".",
  10120. // "format": "google-fieldmask",
  10121. // "location": "query",
  10122. // "type": "string"
  10123. // }
  10124. // },
  10125. // "path": "v2/{+name}",
  10126. // "request": {
  10127. // "$ref": "LogExclusion"
  10128. // },
  10129. // "response": {
  10130. // "$ref": "LogExclusion"
  10131. // },
  10132. // "scopes": [
  10133. // "https://www.googleapis.com/auth/cloud-platform",
  10134. // "https://www.googleapis.com/auth/logging.admin"
  10135. // ]
  10136. // }
  10137. }
  10138. // method id "logging.projects.logs.delete":
  10139. type ProjectsLogsDeleteCall struct {
  10140. s *Service
  10141. logName string
  10142. urlParams_ gensupport.URLParams
  10143. ctx_ context.Context
  10144. header_ http.Header
  10145. }
  10146. // Delete: Deletes all the log entries in a log. The log reappears if it
  10147. // receives new entries. Log entries written shortly before the delete
  10148. // operation might not be deleted.
  10149. func (r *ProjectsLogsService) Delete(logName string) *ProjectsLogsDeleteCall {
  10150. c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10151. c.logName = logName
  10152. return c
  10153. }
  10154. // Fields allows partial responses to be retrieved. See
  10155. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10156. // for more information.
  10157. func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall {
  10158. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10159. return c
  10160. }
  10161. // Context sets the context to be used in this call's Do method. Any
  10162. // pending HTTP request will be aborted if the provided context is
  10163. // canceled.
  10164. func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall {
  10165. c.ctx_ = ctx
  10166. return c
  10167. }
  10168. // Header returns an http.Header that can be modified by the caller to
  10169. // add HTTP headers to the request.
  10170. func (c *ProjectsLogsDeleteCall) Header() http.Header {
  10171. if c.header_ == nil {
  10172. c.header_ = make(http.Header)
  10173. }
  10174. return c.header_
  10175. }
  10176. func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  10177. reqHeaders := make(http.Header)
  10178. for k, v := range c.header_ {
  10179. reqHeaders[k] = v
  10180. }
  10181. reqHeaders.Set("User-Agent", c.s.userAgent())
  10182. var body io.Reader = nil
  10183. c.urlParams_.Set("alt", alt)
  10184. c.urlParams_.Set("prettyPrint", "false")
  10185. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  10186. urls += "?" + c.urlParams_.Encode()
  10187. req, err := http.NewRequest("DELETE", urls, body)
  10188. if err != nil {
  10189. return nil, err
  10190. }
  10191. req.Header = reqHeaders
  10192. googleapi.Expand(req.URL, map[string]string{
  10193. "logName": c.logName,
  10194. })
  10195. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10196. }
  10197. // Do executes the "logging.projects.logs.delete" call.
  10198. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  10199. // code is an error. Response headers are in either
  10200. // *Empty.ServerResponse.Header or (if a response was returned at all)
  10201. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10202. // check whether the returned error was because http.StatusNotModified
  10203. // was returned.
  10204. func (c *ProjectsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  10205. gensupport.SetOptions(c.urlParams_, opts...)
  10206. res, err := c.doRequest("json")
  10207. if res != nil && res.StatusCode == http.StatusNotModified {
  10208. if res.Body != nil {
  10209. res.Body.Close()
  10210. }
  10211. return nil, &googleapi.Error{
  10212. Code: res.StatusCode,
  10213. Header: res.Header,
  10214. }
  10215. }
  10216. if err != nil {
  10217. return nil, err
  10218. }
  10219. defer googleapi.CloseBody(res)
  10220. if err := googleapi.CheckResponse(res); err != nil {
  10221. return nil, err
  10222. }
  10223. ret := &Empty{
  10224. ServerResponse: googleapi.ServerResponse{
  10225. Header: res.Header,
  10226. HTTPStatusCode: res.StatusCode,
  10227. },
  10228. }
  10229. target := &ret
  10230. if err := gensupport.DecodeResponse(target, res); err != nil {
  10231. return nil, err
  10232. }
  10233. return ret, nil
  10234. // {
  10235. // "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.",
  10236. // "flatPath": "v2/projects/{projectsId}/logs/{logsId}",
  10237. // "httpMethod": "DELETE",
  10238. // "id": "logging.projects.logs.delete",
  10239. // "parameterOrder": [
  10240. // "logName"
  10241. // ],
  10242. // "parameters": {
  10243. // "logName": {
  10244. // "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.",
  10245. // "location": "path",
  10246. // "pattern": "^projects/[^/]+/logs/[^/]+$",
  10247. // "required": true,
  10248. // "type": "string"
  10249. // }
  10250. // },
  10251. // "path": "v2/{+logName}",
  10252. // "response": {
  10253. // "$ref": "Empty"
  10254. // },
  10255. // "scopes": [
  10256. // "https://www.googleapis.com/auth/cloud-platform",
  10257. // "https://www.googleapis.com/auth/logging.admin"
  10258. // ]
  10259. // }
  10260. }
  10261. // method id "logging.projects.logs.list":
  10262. type ProjectsLogsListCall struct {
  10263. s *Service
  10264. parent string
  10265. urlParams_ gensupport.URLParams
  10266. ifNoneMatch_ string
  10267. ctx_ context.Context
  10268. header_ http.Header
  10269. }
  10270. // List: Lists the logs in projects, organizations, folders, or billing
  10271. // accounts. Only logs that have entries are listed.
  10272. func (r *ProjectsLogsService) List(parent string) *ProjectsLogsListCall {
  10273. c := &ProjectsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10274. c.parent = parent
  10275. return c
  10276. }
  10277. // PageSize sets the optional parameter "pageSize": The maximum number
  10278. // of results to return from this request. Non-positive values are
  10279. // ignored. The presence of nextPageToken in the response indicates that
  10280. // more results might be available.
  10281. func (c *ProjectsLogsListCall) PageSize(pageSize int64) *ProjectsLogsListCall {
  10282. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  10283. return c
  10284. }
  10285. // PageToken sets the optional parameter "pageToken": If present, then
  10286. // retrieve the next batch of results from the preceding call to this
  10287. // method. pageToken must be the value of nextPageToken from the
  10288. // previous response. The values of other method parameters should be
  10289. // identical to those in the previous call.
  10290. func (c *ProjectsLogsListCall) PageToken(pageToken string) *ProjectsLogsListCall {
  10291. c.urlParams_.Set("pageToken", pageToken)
  10292. return c
  10293. }
  10294. // Fields allows partial responses to be retrieved. See
  10295. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10296. // for more information.
  10297. func (c *ProjectsLogsListCall) Fields(s ...googleapi.Field) *ProjectsLogsListCall {
  10298. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10299. return c
  10300. }
  10301. // IfNoneMatch sets the optional parameter which makes the operation
  10302. // fail if the object's ETag matches the given value. This is useful for
  10303. // getting updates only after the object has changed since the last
  10304. // request. Use googleapi.IsNotModified to check whether the response
  10305. // error from Do is the result of In-None-Match.
  10306. func (c *ProjectsLogsListCall) IfNoneMatch(entityTag string) *ProjectsLogsListCall {
  10307. c.ifNoneMatch_ = entityTag
  10308. return c
  10309. }
  10310. // Context sets the context to be used in this call's Do method. Any
  10311. // pending HTTP request will be aborted if the provided context is
  10312. // canceled.
  10313. func (c *ProjectsLogsListCall) Context(ctx context.Context) *ProjectsLogsListCall {
  10314. c.ctx_ = ctx
  10315. return c
  10316. }
  10317. // Header returns an http.Header that can be modified by the caller to
  10318. // add HTTP headers to the request.
  10319. func (c *ProjectsLogsListCall) Header() http.Header {
  10320. if c.header_ == nil {
  10321. c.header_ = make(http.Header)
  10322. }
  10323. return c.header_
  10324. }
  10325. func (c *ProjectsLogsListCall) doRequest(alt string) (*http.Response, error) {
  10326. reqHeaders := make(http.Header)
  10327. for k, v := range c.header_ {
  10328. reqHeaders[k] = v
  10329. }
  10330. reqHeaders.Set("User-Agent", c.s.userAgent())
  10331. if c.ifNoneMatch_ != "" {
  10332. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10333. }
  10334. var body io.Reader = nil
  10335. c.urlParams_.Set("alt", alt)
  10336. c.urlParams_.Set("prettyPrint", "false")
  10337. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  10338. urls += "?" + c.urlParams_.Encode()
  10339. req, err := http.NewRequest("GET", urls, body)
  10340. if err != nil {
  10341. return nil, err
  10342. }
  10343. req.Header = reqHeaders
  10344. googleapi.Expand(req.URL, map[string]string{
  10345. "parent": c.parent,
  10346. })
  10347. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10348. }
  10349. // Do executes the "logging.projects.logs.list" call.
  10350. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  10351. // non-2xx status code is an error. Response headers are in either
  10352. // *ListLogsResponse.ServerResponse.Header or (if a response was
  10353. // returned at all) in error.(*googleapi.Error).Header. Use
  10354. // googleapi.IsNotModified to check whether the returned error was
  10355. // because http.StatusNotModified was returned.
  10356. func (c *ProjectsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  10357. gensupport.SetOptions(c.urlParams_, opts...)
  10358. res, err := c.doRequest("json")
  10359. if res != nil && res.StatusCode == http.StatusNotModified {
  10360. if res.Body != nil {
  10361. res.Body.Close()
  10362. }
  10363. return nil, &googleapi.Error{
  10364. Code: res.StatusCode,
  10365. Header: res.Header,
  10366. }
  10367. }
  10368. if err != nil {
  10369. return nil, err
  10370. }
  10371. defer googleapi.CloseBody(res)
  10372. if err := googleapi.CheckResponse(res); err != nil {
  10373. return nil, err
  10374. }
  10375. ret := &ListLogsResponse{
  10376. ServerResponse: googleapi.ServerResponse{
  10377. Header: res.Header,
  10378. HTTPStatusCode: res.StatusCode,
  10379. },
  10380. }
  10381. target := &ret
  10382. if err := gensupport.DecodeResponse(target, res); err != nil {
  10383. return nil, err
  10384. }
  10385. return ret, nil
  10386. // {
  10387. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  10388. // "flatPath": "v2/projects/{projectsId}/logs",
  10389. // "httpMethod": "GET",
  10390. // "id": "logging.projects.logs.list",
  10391. // "parameterOrder": [
  10392. // "parent"
  10393. // ],
  10394. // "parameters": {
  10395. // "pageSize": {
  10396. // "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.",
  10397. // "format": "int32",
  10398. // "location": "query",
  10399. // "type": "integer"
  10400. // },
  10401. // "pageToken": {
  10402. // "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.",
  10403. // "location": "query",
  10404. // "type": "string"
  10405. // },
  10406. // "parent": {
  10407. // "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",
  10408. // "location": "path",
  10409. // "pattern": "^projects/[^/]+$",
  10410. // "required": true,
  10411. // "type": "string"
  10412. // }
  10413. // },
  10414. // "path": "v2/{+parent}/logs",
  10415. // "response": {
  10416. // "$ref": "ListLogsResponse"
  10417. // },
  10418. // "scopes": [
  10419. // "https://www.googleapis.com/auth/cloud-platform",
  10420. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10421. // "https://www.googleapis.com/auth/logging.admin",
  10422. // "https://www.googleapis.com/auth/logging.read"
  10423. // ]
  10424. // }
  10425. }
  10426. // Pages invokes f for each page of results.
  10427. // A non-nil error returned from f will halt the iteration.
  10428. // The provided context supersedes any context provided to the Context method.
  10429. func (c *ProjectsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  10430. c.ctx_ = ctx
  10431. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  10432. for {
  10433. x, err := c.Do()
  10434. if err != nil {
  10435. return err
  10436. }
  10437. if err := f(x); err != nil {
  10438. return err
  10439. }
  10440. if x.NextPageToken == "" {
  10441. return nil
  10442. }
  10443. c.PageToken(x.NextPageToken)
  10444. }
  10445. }
  10446. // method id "logging.projects.metrics.create":
  10447. type ProjectsMetricsCreateCall struct {
  10448. s *Service
  10449. parent string
  10450. logmetric *LogMetric
  10451. urlParams_ gensupport.URLParams
  10452. ctx_ context.Context
  10453. header_ http.Header
  10454. }
  10455. // Create: Creates a logs-based metric.
  10456. func (r *ProjectsMetricsService) Create(parent string, logmetric *LogMetric) *ProjectsMetricsCreateCall {
  10457. c := &ProjectsMetricsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10458. c.parent = parent
  10459. c.logmetric = logmetric
  10460. return c
  10461. }
  10462. // Fields allows partial responses to be retrieved. See
  10463. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10464. // for more information.
  10465. func (c *ProjectsMetricsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricsCreateCall {
  10466. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10467. return c
  10468. }
  10469. // Context sets the context to be used in this call's Do method. Any
  10470. // pending HTTP request will be aborted if the provided context is
  10471. // canceled.
  10472. func (c *ProjectsMetricsCreateCall) Context(ctx context.Context) *ProjectsMetricsCreateCall {
  10473. c.ctx_ = ctx
  10474. return c
  10475. }
  10476. // Header returns an http.Header that can be modified by the caller to
  10477. // add HTTP headers to the request.
  10478. func (c *ProjectsMetricsCreateCall) Header() http.Header {
  10479. if c.header_ == nil {
  10480. c.header_ = make(http.Header)
  10481. }
  10482. return c.header_
  10483. }
  10484. func (c *ProjectsMetricsCreateCall) doRequest(alt string) (*http.Response, error) {
  10485. reqHeaders := make(http.Header)
  10486. for k, v := range c.header_ {
  10487. reqHeaders[k] = v
  10488. }
  10489. reqHeaders.Set("User-Agent", c.s.userAgent())
  10490. var body io.Reader = nil
  10491. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  10492. if err != nil {
  10493. return nil, err
  10494. }
  10495. reqHeaders.Set("Content-Type", "application/json")
  10496. c.urlParams_.Set("alt", alt)
  10497. c.urlParams_.Set("prettyPrint", "false")
  10498. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/metrics")
  10499. urls += "?" + c.urlParams_.Encode()
  10500. req, err := http.NewRequest("POST", urls, body)
  10501. if err != nil {
  10502. return nil, err
  10503. }
  10504. req.Header = reqHeaders
  10505. googleapi.Expand(req.URL, map[string]string{
  10506. "parent": c.parent,
  10507. })
  10508. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10509. }
  10510. // Do executes the "logging.projects.metrics.create" call.
  10511. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  10512. // status code is an error. Response headers are in either
  10513. // *LogMetric.ServerResponse.Header or (if a response was returned at
  10514. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10515. // to check whether the returned error was because
  10516. // http.StatusNotModified was returned.
  10517. func (c *ProjectsMetricsCreateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  10518. gensupport.SetOptions(c.urlParams_, opts...)
  10519. res, err := c.doRequest("json")
  10520. if res != nil && res.StatusCode == http.StatusNotModified {
  10521. if res.Body != nil {
  10522. res.Body.Close()
  10523. }
  10524. return nil, &googleapi.Error{
  10525. Code: res.StatusCode,
  10526. Header: res.Header,
  10527. }
  10528. }
  10529. if err != nil {
  10530. return nil, err
  10531. }
  10532. defer googleapi.CloseBody(res)
  10533. if err := googleapi.CheckResponse(res); err != nil {
  10534. return nil, err
  10535. }
  10536. ret := &LogMetric{
  10537. ServerResponse: googleapi.ServerResponse{
  10538. Header: res.Header,
  10539. HTTPStatusCode: res.StatusCode,
  10540. },
  10541. }
  10542. target := &ret
  10543. if err := gensupport.DecodeResponse(target, res); err != nil {
  10544. return nil, err
  10545. }
  10546. return ret, nil
  10547. // {
  10548. // "description": "Creates a logs-based metric.",
  10549. // "flatPath": "v2/projects/{projectsId}/metrics",
  10550. // "httpMethod": "POST",
  10551. // "id": "logging.projects.metrics.create",
  10552. // "parameterOrder": [
  10553. // "parent"
  10554. // ],
  10555. // "parameters": {
  10556. // "parent": {
  10557. // "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.",
  10558. // "location": "path",
  10559. // "pattern": "^projects/[^/]+$",
  10560. // "required": true,
  10561. // "type": "string"
  10562. // }
  10563. // },
  10564. // "path": "v2/{+parent}/metrics",
  10565. // "request": {
  10566. // "$ref": "LogMetric"
  10567. // },
  10568. // "response": {
  10569. // "$ref": "LogMetric"
  10570. // },
  10571. // "scopes": [
  10572. // "https://www.googleapis.com/auth/cloud-platform",
  10573. // "https://www.googleapis.com/auth/logging.admin",
  10574. // "https://www.googleapis.com/auth/logging.write"
  10575. // ]
  10576. // }
  10577. }
  10578. // method id "logging.projects.metrics.delete":
  10579. type ProjectsMetricsDeleteCall struct {
  10580. s *Service
  10581. metricName string
  10582. urlParams_ gensupport.URLParams
  10583. ctx_ context.Context
  10584. header_ http.Header
  10585. }
  10586. // Delete: Deletes a logs-based metric.
  10587. func (r *ProjectsMetricsService) Delete(metricName string) *ProjectsMetricsDeleteCall {
  10588. c := &ProjectsMetricsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10589. c.metricName = metricName
  10590. return c
  10591. }
  10592. // Fields allows partial responses to be retrieved. See
  10593. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10594. // for more information.
  10595. func (c *ProjectsMetricsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricsDeleteCall {
  10596. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10597. return c
  10598. }
  10599. // Context sets the context to be used in this call's Do method. Any
  10600. // pending HTTP request will be aborted if the provided context is
  10601. // canceled.
  10602. func (c *ProjectsMetricsDeleteCall) Context(ctx context.Context) *ProjectsMetricsDeleteCall {
  10603. c.ctx_ = ctx
  10604. return c
  10605. }
  10606. // Header returns an http.Header that can be modified by the caller to
  10607. // add HTTP headers to the request.
  10608. func (c *ProjectsMetricsDeleteCall) Header() http.Header {
  10609. if c.header_ == nil {
  10610. c.header_ = make(http.Header)
  10611. }
  10612. return c.header_
  10613. }
  10614. func (c *ProjectsMetricsDeleteCall) doRequest(alt string) (*http.Response, error) {
  10615. reqHeaders := make(http.Header)
  10616. for k, v := range c.header_ {
  10617. reqHeaders[k] = v
  10618. }
  10619. reqHeaders.Set("User-Agent", c.s.userAgent())
  10620. var body io.Reader = nil
  10621. c.urlParams_.Set("alt", alt)
  10622. c.urlParams_.Set("prettyPrint", "false")
  10623. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+metricName}")
  10624. urls += "?" + c.urlParams_.Encode()
  10625. req, err := http.NewRequest("DELETE", urls, body)
  10626. if err != nil {
  10627. return nil, err
  10628. }
  10629. req.Header = reqHeaders
  10630. googleapi.Expand(req.URL, map[string]string{
  10631. "metricName": c.metricName,
  10632. })
  10633. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10634. }
  10635. // Do executes the "logging.projects.metrics.delete" call.
  10636. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  10637. // code is an error. Response headers are in either
  10638. // *Empty.ServerResponse.Header or (if a response was returned at all)
  10639. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10640. // check whether the returned error was because http.StatusNotModified
  10641. // was returned.
  10642. func (c *ProjectsMetricsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  10643. gensupport.SetOptions(c.urlParams_, opts...)
  10644. res, err := c.doRequest("json")
  10645. if res != nil && res.StatusCode == http.StatusNotModified {
  10646. if res.Body != nil {
  10647. res.Body.Close()
  10648. }
  10649. return nil, &googleapi.Error{
  10650. Code: res.StatusCode,
  10651. Header: res.Header,
  10652. }
  10653. }
  10654. if err != nil {
  10655. return nil, err
  10656. }
  10657. defer googleapi.CloseBody(res)
  10658. if err := googleapi.CheckResponse(res); err != nil {
  10659. return nil, err
  10660. }
  10661. ret := &Empty{
  10662. ServerResponse: googleapi.ServerResponse{
  10663. Header: res.Header,
  10664. HTTPStatusCode: res.StatusCode,
  10665. },
  10666. }
  10667. target := &ret
  10668. if err := gensupport.DecodeResponse(target, res); err != nil {
  10669. return nil, err
  10670. }
  10671. return ret, nil
  10672. // {
  10673. // "description": "Deletes a logs-based metric.",
  10674. // "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
  10675. // "httpMethod": "DELETE",
  10676. // "id": "logging.projects.metrics.delete",
  10677. // "parameterOrder": [
  10678. // "metricName"
  10679. // ],
  10680. // "parameters": {
  10681. // "metricName": {
  10682. // "description": "The resource name of the metric to delete:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  10683. // "location": "path",
  10684. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  10685. // "required": true,
  10686. // "type": "string"
  10687. // }
  10688. // },
  10689. // "path": "v2/{+metricName}",
  10690. // "response": {
  10691. // "$ref": "Empty"
  10692. // },
  10693. // "scopes": [
  10694. // "https://www.googleapis.com/auth/cloud-platform",
  10695. // "https://www.googleapis.com/auth/logging.admin",
  10696. // "https://www.googleapis.com/auth/logging.write"
  10697. // ]
  10698. // }
  10699. }
  10700. // method id "logging.projects.metrics.get":
  10701. type ProjectsMetricsGetCall struct {
  10702. s *Service
  10703. metricName string
  10704. urlParams_ gensupport.URLParams
  10705. ifNoneMatch_ string
  10706. ctx_ context.Context
  10707. header_ http.Header
  10708. }
  10709. // Get: Gets a logs-based metric.
  10710. func (r *ProjectsMetricsService) Get(metricName string) *ProjectsMetricsGetCall {
  10711. c := &ProjectsMetricsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10712. c.metricName = metricName
  10713. return c
  10714. }
  10715. // Fields allows partial responses to be retrieved. See
  10716. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10717. // for more information.
  10718. func (c *ProjectsMetricsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricsGetCall {
  10719. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10720. return c
  10721. }
  10722. // IfNoneMatch sets the optional parameter which makes the operation
  10723. // fail if the object's ETag matches the given value. This is useful for
  10724. // getting updates only after the object has changed since the last
  10725. // request. Use googleapi.IsNotModified to check whether the response
  10726. // error from Do is the result of In-None-Match.
  10727. func (c *ProjectsMetricsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricsGetCall {
  10728. c.ifNoneMatch_ = entityTag
  10729. return c
  10730. }
  10731. // Context sets the context to be used in this call's Do method. Any
  10732. // pending HTTP request will be aborted if the provided context is
  10733. // canceled.
  10734. func (c *ProjectsMetricsGetCall) Context(ctx context.Context) *ProjectsMetricsGetCall {
  10735. c.ctx_ = ctx
  10736. return c
  10737. }
  10738. // Header returns an http.Header that can be modified by the caller to
  10739. // add HTTP headers to the request.
  10740. func (c *ProjectsMetricsGetCall) Header() http.Header {
  10741. if c.header_ == nil {
  10742. c.header_ = make(http.Header)
  10743. }
  10744. return c.header_
  10745. }
  10746. func (c *ProjectsMetricsGetCall) doRequest(alt string) (*http.Response, error) {
  10747. reqHeaders := make(http.Header)
  10748. for k, v := range c.header_ {
  10749. reqHeaders[k] = v
  10750. }
  10751. reqHeaders.Set("User-Agent", c.s.userAgent())
  10752. if c.ifNoneMatch_ != "" {
  10753. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10754. }
  10755. var body io.Reader = nil
  10756. c.urlParams_.Set("alt", alt)
  10757. c.urlParams_.Set("prettyPrint", "false")
  10758. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+metricName}")
  10759. urls += "?" + c.urlParams_.Encode()
  10760. req, err := http.NewRequest("GET", urls, body)
  10761. if err != nil {
  10762. return nil, err
  10763. }
  10764. req.Header = reqHeaders
  10765. googleapi.Expand(req.URL, map[string]string{
  10766. "metricName": c.metricName,
  10767. })
  10768. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10769. }
  10770. // Do executes the "logging.projects.metrics.get" call.
  10771. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  10772. // status code is an error. Response headers are in either
  10773. // *LogMetric.ServerResponse.Header or (if a response was returned at
  10774. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10775. // to check whether the returned error was because
  10776. // http.StatusNotModified was returned.
  10777. func (c *ProjectsMetricsGetCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  10778. gensupport.SetOptions(c.urlParams_, opts...)
  10779. res, err := c.doRequest("json")
  10780. if res != nil && res.StatusCode == http.StatusNotModified {
  10781. if res.Body != nil {
  10782. res.Body.Close()
  10783. }
  10784. return nil, &googleapi.Error{
  10785. Code: res.StatusCode,
  10786. Header: res.Header,
  10787. }
  10788. }
  10789. if err != nil {
  10790. return nil, err
  10791. }
  10792. defer googleapi.CloseBody(res)
  10793. if err := googleapi.CheckResponse(res); err != nil {
  10794. return nil, err
  10795. }
  10796. ret := &LogMetric{
  10797. ServerResponse: googleapi.ServerResponse{
  10798. Header: res.Header,
  10799. HTTPStatusCode: res.StatusCode,
  10800. },
  10801. }
  10802. target := &ret
  10803. if err := gensupport.DecodeResponse(target, res); err != nil {
  10804. return nil, err
  10805. }
  10806. return ret, nil
  10807. // {
  10808. // "description": "Gets a logs-based metric.",
  10809. // "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
  10810. // "httpMethod": "GET",
  10811. // "id": "logging.projects.metrics.get",
  10812. // "parameterOrder": [
  10813. // "metricName"
  10814. // ],
  10815. // "parameters": {
  10816. // "metricName": {
  10817. // "description": "The resource name of the desired metric:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  10818. // "location": "path",
  10819. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  10820. // "required": true,
  10821. // "type": "string"
  10822. // }
  10823. // },
  10824. // "path": "v2/{+metricName}",
  10825. // "response": {
  10826. // "$ref": "LogMetric"
  10827. // },
  10828. // "scopes": [
  10829. // "https://www.googleapis.com/auth/cloud-platform",
  10830. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10831. // "https://www.googleapis.com/auth/logging.admin",
  10832. // "https://www.googleapis.com/auth/logging.read"
  10833. // ]
  10834. // }
  10835. }
  10836. // method id "logging.projects.metrics.list":
  10837. type ProjectsMetricsListCall struct {
  10838. s *Service
  10839. parent string
  10840. urlParams_ gensupport.URLParams
  10841. ifNoneMatch_ string
  10842. ctx_ context.Context
  10843. header_ http.Header
  10844. }
  10845. // List: Lists logs-based metrics.
  10846. func (r *ProjectsMetricsService) List(parent string) *ProjectsMetricsListCall {
  10847. c := &ProjectsMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10848. c.parent = parent
  10849. return c
  10850. }
  10851. // PageSize sets the optional parameter "pageSize": The maximum number
  10852. // of results to return from this request. Non-positive values are
  10853. // ignored. The presence of nextPageToken in the response indicates that
  10854. // more results might be available.
  10855. func (c *ProjectsMetricsListCall) PageSize(pageSize int64) *ProjectsMetricsListCall {
  10856. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  10857. return c
  10858. }
  10859. // PageToken sets the optional parameter "pageToken": If present, then
  10860. // retrieve the next batch of results from the preceding call to this
  10861. // method. pageToken must be the value of nextPageToken from the
  10862. // previous response. The values of other method parameters should be
  10863. // identical to those in the previous call.
  10864. func (c *ProjectsMetricsListCall) PageToken(pageToken string) *ProjectsMetricsListCall {
  10865. c.urlParams_.Set("pageToken", pageToken)
  10866. return c
  10867. }
  10868. // Fields allows partial responses to be retrieved. See
  10869. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10870. // for more information.
  10871. func (c *ProjectsMetricsListCall) Fields(s ...googleapi.Field) *ProjectsMetricsListCall {
  10872. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10873. return c
  10874. }
  10875. // IfNoneMatch sets the optional parameter which makes the operation
  10876. // fail if the object's ETag matches the given value. This is useful for
  10877. // getting updates only after the object has changed since the last
  10878. // request. Use googleapi.IsNotModified to check whether the response
  10879. // error from Do is the result of In-None-Match.
  10880. func (c *ProjectsMetricsListCall) IfNoneMatch(entityTag string) *ProjectsMetricsListCall {
  10881. c.ifNoneMatch_ = entityTag
  10882. return c
  10883. }
  10884. // Context sets the context to be used in this call's Do method. Any
  10885. // pending HTTP request will be aborted if the provided context is
  10886. // canceled.
  10887. func (c *ProjectsMetricsListCall) Context(ctx context.Context) *ProjectsMetricsListCall {
  10888. c.ctx_ = ctx
  10889. return c
  10890. }
  10891. // Header returns an http.Header that can be modified by the caller to
  10892. // add HTTP headers to the request.
  10893. func (c *ProjectsMetricsListCall) Header() http.Header {
  10894. if c.header_ == nil {
  10895. c.header_ = make(http.Header)
  10896. }
  10897. return c.header_
  10898. }
  10899. func (c *ProjectsMetricsListCall) doRequest(alt string) (*http.Response, error) {
  10900. reqHeaders := make(http.Header)
  10901. for k, v := range c.header_ {
  10902. reqHeaders[k] = v
  10903. }
  10904. reqHeaders.Set("User-Agent", c.s.userAgent())
  10905. if c.ifNoneMatch_ != "" {
  10906. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10907. }
  10908. var body io.Reader = nil
  10909. c.urlParams_.Set("alt", alt)
  10910. c.urlParams_.Set("prettyPrint", "false")
  10911. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/metrics")
  10912. urls += "?" + c.urlParams_.Encode()
  10913. req, err := http.NewRequest("GET", urls, body)
  10914. if err != nil {
  10915. return nil, err
  10916. }
  10917. req.Header = reqHeaders
  10918. googleapi.Expand(req.URL, map[string]string{
  10919. "parent": c.parent,
  10920. })
  10921. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10922. }
  10923. // Do executes the "logging.projects.metrics.list" call.
  10924. // Exactly one of *ListLogMetricsResponse or error will be non-nil. Any
  10925. // non-2xx status code is an error. Response headers are in either
  10926. // *ListLogMetricsResponse.ServerResponse.Header or (if a response was
  10927. // returned at all) in error.(*googleapi.Error).Header. Use
  10928. // googleapi.IsNotModified to check whether the returned error was
  10929. // because http.StatusNotModified was returned.
  10930. func (c *ProjectsMetricsListCall) Do(opts ...googleapi.CallOption) (*ListLogMetricsResponse, error) {
  10931. gensupport.SetOptions(c.urlParams_, opts...)
  10932. res, err := c.doRequest("json")
  10933. if res != nil && res.StatusCode == http.StatusNotModified {
  10934. if res.Body != nil {
  10935. res.Body.Close()
  10936. }
  10937. return nil, &googleapi.Error{
  10938. Code: res.StatusCode,
  10939. Header: res.Header,
  10940. }
  10941. }
  10942. if err != nil {
  10943. return nil, err
  10944. }
  10945. defer googleapi.CloseBody(res)
  10946. if err := googleapi.CheckResponse(res); err != nil {
  10947. return nil, err
  10948. }
  10949. ret := &ListLogMetricsResponse{
  10950. ServerResponse: googleapi.ServerResponse{
  10951. Header: res.Header,
  10952. HTTPStatusCode: res.StatusCode,
  10953. },
  10954. }
  10955. target := &ret
  10956. if err := gensupport.DecodeResponse(target, res); err != nil {
  10957. return nil, err
  10958. }
  10959. return ret, nil
  10960. // {
  10961. // "description": "Lists logs-based metrics.",
  10962. // "flatPath": "v2/projects/{projectsId}/metrics",
  10963. // "httpMethod": "GET",
  10964. // "id": "logging.projects.metrics.list",
  10965. // "parameterOrder": [
  10966. // "parent"
  10967. // ],
  10968. // "parameters": {
  10969. // "pageSize": {
  10970. // "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.",
  10971. // "format": "int32",
  10972. // "location": "query",
  10973. // "type": "integer"
  10974. // },
  10975. // "pageToken": {
  10976. // "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.",
  10977. // "location": "query",
  10978. // "type": "string"
  10979. // },
  10980. // "parent": {
  10981. // "description": "Required. The name of the project containing the metrics:\n\"projects/[PROJECT_ID]\"\n",
  10982. // "location": "path",
  10983. // "pattern": "^projects/[^/]+$",
  10984. // "required": true,
  10985. // "type": "string"
  10986. // }
  10987. // },
  10988. // "path": "v2/{+parent}/metrics",
  10989. // "response": {
  10990. // "$ref": "ListLogMetricsResponse"
  10991. // },
  10992. // "scopes": [
  10993. // "https://www.googleapis.com/auth/cloud-platform",
  10994. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10995. // "https://www.googleapis.com/auth/logging.admin",
  10996. // "https://www.googleapis.com/auth/logging.read"
  10997. // ]
  10998. // }
  10999. }
  11000. // Pages invokes f for each page of results.
  11001. // A non-nil error returned from f will halt the iteration.
  11002. // The provided context supersedes any context provided to the Context method.
  11003. func (c *ProjectsMetricsListCall) Pages(ctx context.Context, f func(*ListLogMetricsResponse) error) error {
  11004. c.ctx_ = ctx
  11005. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11006. for {
  11007. x, err := c.Do()
  11008. if err != nil {
  11009. return err
  11010. }
  11011. if err := f(x); err != nil {
  11012. return err
  11013. }
  11014. if x.NextPageToken == "" {
  11015. return nil
  11016. }
  11017. c.PageToken(x.NextPageToken)
  11018. }
  11019. }
  11020. // method id "logging.projects.metrics.update":
  11021. type ProjectsMetricsUpdateCall struct {
  11022. s *Service
  11023. metricName string
  11024. logmetric *LogMetric
  11025. urlParams_ gensupport.URLParams
  11026. ctx_ context.Context
  11027. header_ http.Header
  11028. }
  11029. // Update: Creates or updates a logs-based metric.
  11030. func (r *ProjectsMetricsService) Update(metricName string, logmetric *LogMetric) *ProjectsMetricsUpdateCall {
  11031. c := &ProjectsMetricsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11032. c.metricName = metricName
  11033. c.logmetric = logmetric
  11034. return c
  11035. }
  11036. // Fields allows partial responses to be retrieved. See
  11037. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11038. // for more information.
  11039. func (c *ProjectsMetricsUpdateCall) Fields(s ...googleapi.Field) *ProjectsMetricsUpdateCall {
  11040. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11041. return c
  11042. }
  11043. // Context sets the context to be used in this call's Do method. Any
  11044. // pending HTTP request will be aborted if the provided context is
  11045. // canceled.
  11046. func (c *ProjectsMetricsUpdateCall) Context(ctx context.Context) *ProjectsMetricsUpdateCall {
  11047. c.ctx_ = ctx
  11048. return c
  11049. }
  11050. // Header returns an http.Header that can be modified by the caller to
  11051. // add HTTP headers to the request.
  11052. func (c *ProjectsMetricsUpdateCall) Header() http.Header {
  11053. if c.header_ == nil {
  11054. c.header_ = make(http.Header)
  11055. }
  11056. return c.header_
  11057. }
  11058. func (c *ProjectsMetricsUpdateCall) doRequest(alt string) (*http.Response, error) {
  11059. reqHeaders := make(http.Header)
  11060. for k, v := range c.header_ {
  11061. reqHeaders[k] = v
  11062. }
  11063. reqHeaders.Set("User-Agent", c.s.userAgent())
  11064. var body io.Reader = nil
  11065. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  11066. if err != nil {
  11067. return nil, err
  11068. }
  11069. reqHeaders.Set("Content-Type", "application/json")
  11070. c.urlParams_.Set("alt", alt)
  11071. c.urlParams_.Set("prettyPrint", "false")
  11072. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+metricName}")
  11073. urls += "?" + c.urlParams_.Encode()
  11074. req, err := http.NewRequest("PUT", urls, body)
  11075. if err != nil {
  11076. return nil, err
  11077. }
  11078. req.Header = reqHeaders
  11079. googleapi.Expand(req.URL, map[string]string{
  11080. "metricName": c.metricName,
  11081. })
  11082. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11083. }
  11084. // Do executes the "logging.projects.metrics.update" call.
  11085. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  11086. // status code is an error. Response headers are in either
  11087. // *LogMetric.ServerResponse.Header or (if a response was returned at
  11088. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11089. // to check whether the returned error was because
  11090. // http.StatusNotModified was returned.
  11091. func (c *ProjectsMetricsUpdateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  11092. gensupport.SetOptions(c.urlParams_, opts...)
  11093. res, err := c.doRequest("json")
  11094. if res != nil && res.StatusCode == http.StatusNotModified {
  11095. if res.Body != nil {
  11096. res.Body.Close()
  11097. }
  11098. return nil, &googleapi.Error{
  11099. Code: res.StatusCode,
  11100. Header: res.Header,
  11101. }
  11102. }
  11103. if err != nil {
  11104. return nil, err
  11105. }
  11106. defer googleapi.CloseBody(res)
  11107. if err := googleapi.CheckResponse(res); err != nil {
  11108. return nil, err
  11109. }
  11110. ret := &LogMetric{
  11111. ServerResponse: googleapi.ServerResponse{
  11112. Header: res.Header,
  11113. HTTPStatusCode: res.StatusCode,
  11114. },
  11115. }
  11116. target := &ret
  11117. if err := gensupport.DecodeResponse(target, res); err != nil {
  11118. return nil, err
  11119. }
  11120. return ret, nil
  11121. // {
  11122. // "description": "Creates or updates a logs-based metric.",
  11123. // "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
  11124. // "httpMethod": "PUT",
  11125. // "id": "logging.projects.metrics.update",
  11126. // "parameterOrder": [
  11127. // "metricName"
  11128. // ],
  11129. // "parameters": {
  11130. // "metricName": {
  11131. // "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.",
  11132. // "location": "path",
  11133. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  11134. // "required": true,
  11135. // "type": "string"
  11136. // }
  11137. // },
  11138. // "path": "v2/{+metricName}",
  11139. // "request": {
  11140. // "$ref": "LogMetric"
  11141. // },
  11142. // "response": {
  11143. // "$ref": "LogMetric"
  11144. // },
  11145. // "scopes": [
  11146. // "https://www.googleapis.com/auth/cloud-platform",
  11147. // "https://www.googleapis.com/auth/logging.admin",
  11148. // "https://www.googleapis.com/auth/logging.write"
  11149. // ]
  11150. // }
  11151. }
  11152. // method id "logging.projects.sinks.create":
  11153. type ProjectsSinksCreateCall struct {
  11154. s *Service
  11155. parent string
  11156. logsink *LogSink
  11157. urlParams_ gensupport.URLParams
  11158. ctx_ context.Context
  11159. header_ http.Header
  11160. }
  11161. // Create: Creates a sink that exports specified log entries to a
  11162. // destination. The export of newly-ingested log entries begins
  11163. // immediately, unless the sink's writer_identity is not permitted to
  11164. // write to the destination. A sink can export log entries only from the
  11165. // resource owning the sink.
  11166. func (r *ProjectsSinksService) Create(parent string, logsink *LogSink) *ProjectsSinksCreateCall {
  11167. c := &ProjectsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11168. c.parent = parent
  11169. c.logsink = logsink
  11170. return c
  11171. }
  11172. // UniqueWriterIdentity sets the optional parameter
  11173. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  11174. // as writer_identity in the new sink. If this value is omitted or set
  11175. // to false, and if the sink's parent is a project, then the value
  11176. // returned as writer_identity is the same group or service account used
  11177. // by Logging before the addition of writer identities to this API. The
  11178. // sink's destination must be in the same project as the sink itself.If
  11179. // this field is set to true, or if the sink is owned by a non-project
  11180. // resource such as an organization, then the value of writer_identity
  11181. // will be a unique service account used only for exports from the new
  11182. // sink. For more information, see writer_identity in LogSink.
  11183. func (c *ProjectsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksCreateCall {
  11184. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  11185. return c
  11186. }
  11187. // Fields allows partial responses to be retrieved. See
  11188. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11189. // for more information.
  11190. func (c *ProjectsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsSinksCreateCall {
  11191. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11192. return c
  11193. }
  11194. // Context sets the context to be used in this call's Do method. Any
  11195. // pending HTTP request will be aborted if the provided context is
  11196. // canceled.
  11197. func (c *ProjectsSinksCreateCall) Context(ctx context.Context) *ProjectsSinksCreateCall {
  11198. c.ctx_ = ctx
  11199. return c
  11200. }
  11201. // Header returns an http.Header that can be modified by the caller to
  11202. // add HTTP headers to the request.
  11203. func (c *ProjectsSinksCreateCall) Header() http.Header {
  11204. if c.header_ == nil {
  11205. c.header_ = make(http.Header)
  11206. }
  11207. return c.header_
  11208. }
  11209. func (c *ProjectsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  11210. reqHeaders := make(http.Header)
  11211. for k, v := range c.header_ {
  11212. reqHeaders[k] = v
  11213. }
  11214. reqHeaders.Set("User-Agent", c.s.userAgent())
  11215. var body io.Reader = nil
  11216. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  11217. if err != nil {
  11218. return nil, err
  11219. }
  11220. reqHeaders.Set("Content-Type", "application/json")
  11221. c.urlParams_.Set("alt", alt)
  11222. c.urlParams_.Set("prettyPrint", "false")
  11223. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  11224. urls += "?" + c.urlParams_.Encode()
  11225. req, err := http.NewRequest("POST", urls, body)
  11226. if err != nil {
  11227. return nil, err
  11228. }
  11229. req.Header = reqHeaders
  11230. googleapi.Expand(req.URL, map[string]string{
  11231. "parent": c.parent,
  11232. })
  11233. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11234. }
  11235. // Do executes the "logging.projects.sinks.create" call.
  11236. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  11237. // code is an error. Response headers are in either
  11238. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  11239. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11240. // check whether the returned error was because http.StatusNotModified
  11241. // was returned.
  11242. func (c *ProjectsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  11243. gensupport.SetOptions(c.urlParams_, opts...)
  11244. res, err := c.doRequest("json")
  11245. if res != nil && res.StatusCode == http.StatusNotModified {
  11246. if res.Body != nil {
  11247. res.Body.Close()
  11248. }
  11249. return nil, &googleapi.Error{
  11250. Code: res.StatusCode,
  11251. Header: res.Header,
  11252. }
  11253. }
  11254. if err != nil {
  11255. return nil, err
  11256. }
  11257. defer googleapi.CloseBody(res)
  11258. if err := googleapi.CheckResponse(res); err != nil {
  11259. return nil, err
  11260. }
  11261. ret := &LogSink{
  11262. ServerResponse: googleapi.ServerResponse{
  11263. Header: res.Header,
  11264. HTTPStatusCode: res.StatusCode,
  11265. },
  11266. }
  11267. target := &ret
  11268. if err := gensupport.DecodeResponse(target, res); err != nil {
  11269. return nil, err
  11270. }
  11271. return ret, nil
  11272. // {
  11273. // "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.",
  11274. // "flatPath": "v2/projects/{projectsId}/sinks",
  11275. // "httpMethod": "POST",
  11276. // "id": "logging.projects.sinks.create",
  11277. // "parameterOrder": [
  11278. // "parent"
  11279. // ],
  11280. // "parameters": {
  11281. // "parent": {
  11282. // "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\".",
  11283. // "location": "path",
  11284. // "pattern": "^projects/[^/]+$",
  11285. // "required": true,
  11286. // "type": "string"
  11287. // },
  11288. // "uniqueWriterIdentity": {
  11289. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  11290. // "location": "query",
  11291. // "type": "boolean"
  11292. // }
  11293. // },
  11294. // "path": "v2/{+parent}/sinks",
  11295. // "request": {
  11296. // "$ref": "LogSink"
  11297. // },
  11298. // "response": {
  11299. // "$ref": "LogSink"
  11300. // },
  11301. // "scopes": [
  11302. // "https://www.googleapis.com/auth/cloud-platform",
  11303. // "https://www.googleapis.com/auth/logging.admin"
  11304. // ]
  11305. // }
  11306. }
  11307. // method id "logging.projects.sinks.delete":
  11308. type ProjectsSinksDeleteCall struct {
  11309. s *Service
  11310. sinkNameid string
  11311. urlParams_ gensupport.URLParams
  11312. ctx_ context.Context
  11313. header_ http.Header
  11314. }
  11315. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  11316. // then that service account is also deleted.
  11317. func (r *ProjectsSinksService) Delete(sinkNameid string) *ProjectsSinksDeleteCall {
  11318. c := &ProjectsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11319. c.sinkNameid = sinkNameid
  11320. return c
  11321. }
  11322. // Fields allows partial responses to be retrieved. See
  11323. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11324. // for more information.
  11325. func (c *ProjectsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsSinksDeleteCall {
  11326. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11327. return c
  11328. }
  11329. // Context sets the context to be used in this call's Do method. Any
  11330. // pending HTTP request will be aborted if the provided context is
  11331. // canceled.
  11332. func (c *ProjectsSinksDeleteCall) Context(ctx context.Context) *ProjectsSinksDeleteCall {
  11333. c.ctx_ = ctx
  11334. return c
  11335. }
  11336. // Header returns an http.Header that can be modified by the caller to
  11337. // add HTTP headers to the request.
  11338. func (c *ProjectsSinksDeleteCall) Header() http.Header {
  11339. if c.header_ == nil {
  11340. c.header_ = make(http.Header)
  11341. }
  11342. return c.header_
  11343. }
  11344. func (c *ProjectsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  11345. reqHeaders := make(http.Header)
  11346. for k, v := range c.header_ {
  11347. reqHeaders[k] = v
  11348. }
  11349. reqHeaders.Set("User-Agent", c.s.userAgent())
  11350. var body io.Reader = nil
  11351. c.urlParams_.Set("alt", alt)
  11352. c.urlParams_.Set("prettyPrint", "false")
  11353. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  11354. urls += "?" + c.urlParams_.Encode()
  11355. req, err := http.NewRequest("DELETE", urls, body)
  11356. if err != nil {
  11357. return nil, err
  11358. }
  11359. req.Header = reqHeaders
  11360. googleapi.Expand(req.URL, map[string]string{
  11361. "sinkName": c.sinkNameid,
  11362. })
  11363. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11364. }
  11365. // Do executes the "logging.projects.sinks.delete" call.
  11366. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  11367. // code is an error. Response headers are in either
  11368. // *Empty.ServerResponse.Header or (if a response was returned at all)
  11369. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11370. // check whether the returned error was because http.StatusNotModified
  11371. // was returned.
  11372. func (c *ProjectsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  11373. gensupport.SetOptions(c.urlParams_, opts...)
  11374. res, err := c.doRequest("json")
  11375. if res != nil && res.StatusCode == http.StatusNotModified {
  11376. if res.Body != nil {
  11377. res.Body.Close()
  11378. }
  11379. return nil, &googleapi.Error{
  11380. Code: res.StatusCode,
  11381. Header: res.Header,
  11382. }
  11383. }
  11384. if err != nil {
  11385. return nil, err
  11386. }
  11387. defer googleapi.CloseBody(res)
  11388. if err := googleapi.CheckResponse(res); err != nil {
  11389. return nil, err
  11390. }
  11391. ret := &Empty{
  11392. ServerResponse: googleapi.ServerResponse{
  11393. Header: res.Header,
  11394. HTTPStatusCode: res.StatusCode,
  11395. },
  11396. }
  11397. target := &ret
  11398. if err := gensupport.DecodeResponse(target, res); err != nil {
  11399. return nil, err
  11400. }
  11401. return ret, nil
  11402. // {
  11403. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  11404. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  11405. // "httpMethod": "DELETE",
  11406. // "id": "logging.projects.sinks.delete",
  11407. // "parameterOrder": [
  11408. // "sinkName"
  11409. // ],
  11410. // "parameters": {
  11411. // "sinkName": {
  11412. // "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\".",
  11413. // "location": "path",
  11414. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  11415. // "required": true,
  11416. // "type": "string"
  11417. // }
  11418. // },
  11419. // "path": "v2/{+sinkName}",
  11420. // "response": {
  11421. // "$ref": "Empty"
  11422. // },
  11423. // "scopes": [
  11424. // "https://www.googleapis.com/auth/cloud-platform",
  11425. // "https://www.googleapis.com/auth/logging.admin"
  11426. // ]
  11427. // }
  11428. }
  11429. // method id "logging.projects.sinks.get":
  11430. type ProjectsSinksGetCall struct {
  11431. s *Service
  11432. sinkName string
  11433. urlParams_ gensupport.URLParams
  11434. ifNoneMatch_ string
  11435. ctx_ context.Context
  11436. header_ http.Header
  11437. }
  11438. // Get: Gets a sink.
  11439. func (r *ProjectsSinksService) Get(sinkName string) *ProjectsSinksGetCall {
  11440. c := &ProjectsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11441. c.sinkName = sinkName
  11442. return c
  11443. }
  11444. // Fields allows partial responses to be retrieved. See
  11445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11446. // for more information.
  11447. func (c *ProjectsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsSinksGetCall {
  11448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11449. return c
  11450. }
  11451. // IfNoneMatch sets the optional parameter which makes the operation
  11452. // fail if the object's ETag matches the given value. This is useful for
  11453. // getting updates only after the object has changed since the last
  11454. // request. Use googleapi.IsNotModified to check whether the response
  11455. // error from Do is the result of In-None-Match.
  11456. func (c *ProjectsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsSinksGetCall {
  11457. c.ifNoneMatch_ = entityTag
  11458. return c
  11459. }
  11460. // Context sets the context to be used in this call's Do method. Any
  11461. // pending HTTP request will be aborted if the provided context is
  11462. // canceled.
  11463. func (c *ProjectsSinksGetCall) Context(ctx context.Context) *ProjectsSinksGetCall {
  11464. c.ctx_ = ctx
  11465. return c
  11466. }
  11467. // Header returns an http.Header that can be modified by the caller to
  11468. // add HTTP headers to the request.
  11469. func (c *ProjectsSinksGetCall) Header() http.Header {
  11470. if c.header_ == nil {
  11471. c.header_ = make(http.Header)
  11472. }
  11473. return c.header_
  11474. }
  11475. func (c *ProjectsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  11476. reqHeaders := make(http.Header)
  11477. for k, v := range c.header_ {
  11478. reqHeaders[k] = v
  11479. }
  11480. reqHeaders.Set("User-Agent", c.s.userAgent())
  11481. if c.ifNoneMatch_ != "" {
  11482. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11483. }
  11484. var body io.Reader = nil
  11485. c.urlParams_.Set("alt", alt)
  11486. c.urlParams_.Set("prettyPrint", "false")
  11487. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  11488. urls += "?" + c.urlParams_.Encode()
  11489. req, err := http.NewRequest("GET", urls, body)
  11490. if err != nil {
  11491. return nil, err
  11492. }
  11493. req.Header = reqHeaders
  11494. googleapi.Expand(req.URL, map[string]string{
  11495. "sinkName": c.sinkName,
  11496. })
  11497. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11498. }
  11499. // Do executes the "logging.projects.sinks.get" call.
  11500. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  11501. // code is an error. Response headers are in either
  11502. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  11503. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11504. // check whether the returned error was because http.StatusNotModified
  11505. // was returned.
  11506. func (c *ProjectsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  11507. gensupport.SetOptions(c.urlParams_, opts...)
  11508. res, err := c.doRequest("json")
  11509. if res != nil && res.StatusCode == http.StatusNotModified {
  11510. if res.Body != nil {
  11511. res.Body.Close()
  11512. }
  11513. return nil, &googleapi.Error{
  11514. Code: res.StatusCode,
  11515. Header: res.Header,
  11516. }
  11517. }
  11518. if err != nil {
  11519. return nil, err
  11520. }
  11521. defer googleapi.CloseBody(res)
  11522. if err := googleapi.CheckResponse(res); err != nil {
  11523. return nil, err
  11524. }
  11525. ret := &LogSink{
  11526. ServerResponse: googleapi.ServerResponse{
  11527. Header: res.Header,
  11528. HTTPStatusCode: res.StatusCode,
  11529. },
  11530. }
  11531. target := &ret
  11532. if err := gensupport.DecodeResponse(target, res); err != nil {
  11533. return nil, err
  11534. }
  11535. return ret, nil
  11536. // {
  11537. // "description": "Gets a sink.",
  11538. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  11539. // "httpMethod": "GET",
  11540. // "id": "logging.projects.sinks.get",
  11541. // "parameterOrder": [
  11542. // "sinkName"
  11543. // ],
  11544. // "parameters": {
  11545. // "sinkName": {
  11546. // "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\".",
  11547. // "location": "path",
  11548. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  11549. // "required": true,
  11550. // "type": "string"
  11551. // }
  11552. // },
  11553. // "path": "v2/{+sinkName}",
  11554. // "response": {
  11555. // "$ref": "LogSink"
  11556. // },
  11557. // "scopes": [
  11558. // "https://www.googleapis.com/auth/cloud-platform",
  11559. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  11560. // "https://www.googleapis.com/auth/logging.admin",
  11561. // "https://www.googleapis.com/auth/logging.read"
  11562. // ]
  11563. // }
  11564. }
  11565. // method id "logging.projects.sinks.list":
  11566. type ProjectsSinksListCall struct {
  11567. s *Service
  11568. parent string
  11569. urlParams_ gensupport.URLParams
  11570. ifNoneMatch_ string
  11571. ctx_ context.Context
  11572. header_ http.Header
  11573. }
  11574. // List: Lists sinks.
  11575. func (r *ProjectsSinksService) List(parent string) *ProjectsSinksListCall {
  11576. c := &ProjectsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11577. c.parent = parent
  11578. return c
  11579. }
  11580. // PageSize sets the optional parameter "pageSize": The maximum number
  11581. // of results to return from this request. Non-positive values are
  11582. // ignored. The presence of nextPageToken in the response indicates that
  11583. // more results might be available.
  11584. func (c *ProjectsSinksListCall) PageSize(pageSize int64) *ProjectsSinksListCall {
  11585. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  11586. return c
  11587. }
  11588. // PageToken sets the optional parameter "pageToken": If present, then
  11589. // retrieve the next batch of results from the preceding call to this
  11590. // method. pageToken must be the value of nextPageToken from the
  11591. // previous response. The values of other method parameters should be
  11592. // identical to those in the previous call.
  11593. func (c *ProjectsSinksListCall) PageToken(pageToken string) *ProjectsSinksListCall {
  11594. c.urlParams_.Set("pageToken", pageToken)
  11595. return c
  11596. }
  11597. // Fields allows partial responses to be retrieved. See
  11598. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11599. // for more information.
  11600. func (c *ProjectsSinksListCall) Fields(s ...googleapi.Field) *ProjectsSinksListCall {
  11601. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11602. return c
  11603. }
  11604. // IfNoneMatch sets the optional parameter which makes the operation
  11605. // fail if the object's ETag matches the given value. This is useful for
  11606. // getting updates only after the object has changed since the last
  11607. // request. Use googleapi.IsNotModified to check whether the response
  11608. // error from Do is the result of In-None-Match.
  11609. func (c *ProjectsSinksListCall) IfNoneMatch(entityTag string) *ProjectsSinksListCall {
  11610. c.ifNoneMatch_ = entityTag
  11611. return c
  11612. }
  11613. // Context sets the context to be used in this call's Do method. Any
  11614. // pending HTTP request will be aborted if the provided context is
  11615. // canceled.
  11616. func (c *ProjectsSinksListCall) Context(ctx context.Context) *ProjectsSinksListCall {
  11617. c.ctx_ = ctx
  11618. return c
  11619. }
  11620. // Header returns an http.Header that can be modified by the caller to
  11621. // add HTTP headers to the request.
  11622. func (c *ProjectsSinksListCall) Header() http.Header {
  11623. if c.header_ == nil {
  11624. c.header_ = make(http.Header)
  11625. }
  11626. return c.header_
  11627. }
  11628. func (c *ProjectsSinksListCall) doRequest(alt string) (*http.Response, error) {
  11629. reqHeaders := make(http.Header)
  11630. for k, v := range c.header_ {
  11631. reqHeaders[k] = v
  11632. }
  11633. reqHeaders.Set("User-Agent", c.s.userAgent())
  11634. if c.ifNoneMatch_ != "" {
  11635. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11636. }
  11637. var body io.Reader = nil
  11638. c.urlParams_.Set("alt", alt)
  11639. c.urlParams_.Set("prettyPrint", "false")
  11640. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  11641. urls += "?" + c.urlParams_.Encode()
  11642. req, err := http.NewRequest("GET", urls, body)
  11643. if err != nil {
  11644. return nil, err
  11645. }
  11646. req.Header = reqHeaders
  11647. googleapi.Expand(req.URL, map[string]string{
  11648. "parent": c.parent,
  11649. })
  11650. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11651. }
  11652. // Do executes the "logging.projects.sinks.list" call.
  11653. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  11654. // non-2xx status code is an error. Response headers are in either
  11655. // *ListSinksResponse.ServerResponse.Header or (if a response was
  11656. // returned at all) in error.(*googleapi.Error).Header. Use
  11657. // googleapi.IsNotModified to check whether the returned error was
  11658. // because http.StatusNotModified was returned.
  11659. func (c *ProjectsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  11660. gensupport.SetOptions(c.urlParams_, opts...)
  11661. res, err := c.doRequest("json")
  11662. if res != nil && res.StatusCode == http.StatusNotModified {
  11663. if res.Body != nil {
  11664. res.Body.Close()
  11665. }
  11666. return nil, &googleapi.Error{
  11667. Code: res.StatusCode,
  11668. Header: res.Header,
  11669. }
  11670. }
  11671. if err != nil {
  11672. return nil, err
  11673. }
  11674. defer googleapi.CloseBody(res)
  11675. if err := googleapi.CheckResponse(res); err != nil {
  11676. return nil, err
  11677. }
  11678. ret := &ListSinksResponse{
  11679. ServerResponse: googleapi.ServerResponse{
  11680. Header: res.Header,
  11681. HTTPStatusCode: res.StatusCode,
  11682. },
  11683. }
  11684. target := &ret
  11685. if err := gensupport.DecodeResponse(target, res); err != nil {
  11686. return nil, err
  11687. }
  11688. return ret, nil
  11689. // {
  11690. // "description": "Lists sinks.",
  11691. // "flatPath": "v2/projects/{projectsId}/sinks",
  11692. // "httpMethod": "GET",
  11693. // "id": "logging.projects.sinks.list",
  11694. // "parameterOrder": [
  11695. // "parent"
  11696. // ],
  11697. // "parameters": {
  11698. // "pageSize": {
  11699. // "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.",
  11700. // "format": "int32",
  11701. // "location": "query",
  11702. // "type": "integer"
  11703. // },
  11704. // "pageToken": {
  11705. // "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.",
  11706. // "location": "query",
  11707. // "type": "string"
  11708. // },
  11709. // "parent": {
  11710. // "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",
  11711. // "location": "path",
  11712. // "pattern": "^projects/[^/]+$",
  11713. // "required": true,
  11714. // "type": "string"
  11715. // }
  11716. // },
  11717. // "path": "v2/{+parent}/sinks",
  11718. // "response": {
  11719. // "$ref": "ListSinksResponse"
  11720. // },
  11721. // "scopes": [
  11722. // "https://www.googleapis.com/auth/cloud-platform",
  11723. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  11724. // "https://www.googleapis.com/auth/logging.admin",
  11725. // "https://www.googleapis.com/auth/logging.read"
  11726. // ]
  11727. // }
  11728. }
  11729. // Pages invokes f for each page of results.
  11730. // A non-nil error returned from f will halt the iteration.
  11731. // The provided context supersedes any context provided to the Context method.
  11732. func (c *ProjectsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  11733. c.ctx_ = ctx
  11734. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11735. for {
  11736. x, err := c.Do()
  11737. if err != nil {
  11738. return err
  11739. }
  11740. if err := f(x); err != nil {
  11741. return err
  11742. }
  11743. if x.NextPageToken == "" {
  11744. return nil
  11745. }
  11746. c.PageToken(x.NextPageToken)
  11747. }
  11748. }
  11749. // method id "logging.projects.sinks.patch":
  11750. type ProjectsSinksPatchCall struct {
  11751. s *Service
  11752. sinkNameid string
  11753. logsink *LogSink
  11754. urlParams_ gensupport.URLParams
  11755. ctx_ context.Context
  11756. header_ http.Header
  11757. }
  11758. // Patch: Updates a sink. This method replaces the following fields in
  11759. // the existing sink with values from the new sink: destination, and
  11760. // filter.The updated sink might also have a new writer_identity; see
  11761. // the unique_writer_identity field.
  11762. func (r *ProjectsSinksService) Patch(sinkNameid string, logsink *LogSink) *ProjectsSinksPatchCall {
  11763. c := &ProjectsSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11764. c.sinkNameid = sinkNameid
  11765. c.logsink = logsink
  11766. return c
  11767. }
  11768. // UniqueWriterIdentity sets the optional parameter
  11769. // "uniqueWriterIdentity": See sinks.create for a description of this
  11770. // field. When updating a sink, the effect of this field on the value of
  11771. // writer_identity in the updated sink depends on both the old and new
  11772. // values of this field:
  11773. // If the old and new values of this field are both false or both true,
  11774. // then there is no change to the sink's writer_identity.
  11775. // If the old value is false and the new value is true, then
  11776. // writer_identity is changed to a unique service account.
  11777. // It is an error if the old value is true and the new value is set to
  11778. // false or defaulted to false.
  11779. func (c *ProjectsSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksPatchCall {
  11780. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  11781. return c
  11782. }
  11783. // UpdateMask sets the optional parameter "updateMask": Field mask that
  11784. // specifies the fields in sink that need an update. A sink field will
  11785. // be overwritten if, and only if, it is in the update mask. name and
  11786. // output only fields cannot be updated.An empty updateMask is
  11787. // temporarily treated as using the following mask for backwards
  11788. // compatibility purposes: destination,filter,includeChildren At some
  11789. // point in the future, behavior will be removed and specifying an empty
  11790. // updateMask will be an error.For a detailed FieldMask definition, see
  11791. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  11792. // updateMask=filter.
  11793. func (c *ProjectsSinksPatchCall) UpdateMask(updateMask string) *ProjectsSinksPatchCall {
  11794. c.urlParams_.Set("updateMask", updateMask)
  11795. return c
  11796. }
  11797. // Fields allows partial responses to be retrieved. See
  11798. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11799. // for more information.
  11800. func (c *ProjectsSinksPatchCall) Fields(s ...googleapi.Field) *ProjectsSinksPatchCall {
  11801. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11802. return c
  11803. }
  11804. // Context sets the context to be used in this call's Do method. Any
  11805. // pending HTTP request will be aborted if the provided context is
  11806. // canceled.
  11807. func (c *ProjectsSinksPatchCall) Context(ctx context.Context) *ProjectsSinksPatchCall {
  11808. c.ctx_ = ctx
  11809. return c
  11810. }
  11811. // Header returns an http.Header that can be modified by the caller to
  11812. // add HTTP headers to the request.
  11813. func (c *ProjectsSinksPatchCall) Header() http.Header {
  11814. if c.header_ == nil {
  11815. c.header_ = make(http.Header)
  11816. }
  11817. return c.header_
  11818. }
  11819. func (c *ProjectsSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  11820. reqHeaders := make(http.Header)
  11821. for k, v := range c.header_ {
  11822. reqHeaders[k] = v
  11823. }
  11824. reqHeaders.Set("User-Agent", c.s.userAgent())
  11825. var body io.Reader = nil
  11826. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  11827. if err != nil {
  11828. return nil, err
  11829. }
  11830. reqHeaders.Set("Content-Type", "application/json")
  11831. c.urlParams_.Set("alt", alt)
  11832. c.urlParams_.Set("prettyPrint", "false")
  11833. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  11834. urls += "?" + c.urlParams_.Encode()
  11835. req, err := http.NewRequest("PATCH", urls, body)
  11836. if err != nil {
  11837. return nil, err
  11838. }
  11839. req.Header = reqHeaders
  11840. googleapi.Expand(req.URL, map[string]string{
  11841. "sinkName": c.sinkNameid,
  11842. })
  11843. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11844. }
  11845. // Do executes the "logging.projects.sinks.patch" call.
  11846. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  11847. // code is an error. Response headers are in either
  11848. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  11849. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11850. // check whether the returned error was because http.StatusNotModified
  11851. // was returned.
  11852. func (c *ProjectsSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  11853. gensupport.SetOptions(c.urlParams_, opts...)
  11854. res, err := c.doRequest("json")
  11855. if res != nil && res.StatusCode == http.StatusNotModified {
  11856. if res.Body != nil {
  11857. res.Body.Close()
  11858. }
  11859. return nil, &googleapi.Error{
  11860. Code: res.StatusCode,
  11861. Header: res.Header,
  11862. }
  11863. }
  11864. if err != nil {
  11865. return nil, err
  11866. }
  11867. defer googleapi.CloseBody(res)
  11868. if err := googleapi.CheckResponse(res); err != nil {
  11869. return nil, err
  11870. }
  11871. ret := &LogSink{
  11872. ServerResponse: googleapi.ServerResponse{
  11873. Header: res.Header,
  11874. HTTPStatusCode: res.StatusCode,
  11875. },
  11876. }
  11877. target := &ret
  11878. if err := gensupport.DecodeResponse(target, res); err != nil {
  11879. return nil, err
  11880. }
  11881. return ret, nil
  11882. // {
  11883. // "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.",
  11884. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  11885. // "httpMethod": "PATCH",
  11886. // "id": "logging.projects.sinks.patch",
  11887. // "parameterOrder": [
  11888. // "sinkName"
  11889. // ],
  11890. // "parameters": {
  11891. // "sinkName": {
  11892. // "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\".",
  11893. // "location": "path",
  11894. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  11895. // "required": true,
  11896. // "type": "string"
  11897. // },
  11898. // "uniqueWriterIdentity": {
  11899. // "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.",
  11900. // "location": "query",
  11901. // "type": "boolean"
  11902. // },
  11903. // "updateMask": {
  11904. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  11905. // "format": "google-fieldmask",
  11906. // "location": "query",
  11907. // "type": "string"
  11908. // }
  11909. // },
  11910. // "path": "v2/{+sinkName}",
  11911. // "request": {
  11912. // "$ref": "LogSink"
  11913. // },
  11914. // "response": {
  11915. // "$ref": "LogSink"
  11916. // },
  11917. // "scopes": [
  11918. // "https://www.googleapis.com/auth/cloud-platform",
  11919. // "https://www.googleapis.com/auth/logging.admin"
  11920. // ]
  11921. // }
  11922. }
  11923. // method id "logging.projects.sinks.update":
  11924. type ProjectsSinksUpdateCall struct {
  11925. s *Service
  11926. sinkNameid string
  11927. logsink *LogSink
  11928. urlParams_ gensupport.URLParams
  11929. ctx_ context.Context
  11930. header_ http.Header
  11931. }
  11932. // Update: Updates a sink. This method replaces the following fields in
  11933. // the existing sink with values from the new sink: destination, and
  11934. // filter.The updated sink might also have a new writer_identity; see
  11935. // the unique_writer_identity field.
  11936. func (r *ProjectsSinksService) Update(sinkNameid string, logsink *LogSink) *ProjectsSinksUpdateCall {
  11937. c := &ProjectsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11938. c.sinkNameid = sinkNameid
  11939. c.logsink = logsink
  11940. return c
  11941. }
  11942. // UniqueWriterIdentity sets the optional parameter
  11943. // "uniqueWriterIdentity": See sinks.create for a description of this
  11944. // field. When updating a sink, the effect of this field on the value of
  11945. // writer_identity in the updated sink depends on both the old and new
  11946. // values of this field:
  11947. // If the old and new values of this field are both false or both true,
  11948. // then there is no change to the sink's writer_identity.
  11949. // If the old value is false and the new value is true, then
  11950. // writer_identity is changed to a unique service account.
  11951. // It is an error if the old value is true and the new value is set to
  11952. // false or defaulted to false.
  11953. func (c *ProjectsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksUpdateCall {
  11954. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  11955. return c
  11956. }
  11957. // UpdateMask sets the optional parameter "updateMask": Field mask that
  11958. // specifies the fields in sink that need an update. A sink field will
  11959. // be overwritten if, and only if, it is in the update mask. name and
  11960. // output only fields cannot be updated.An empty updateMask is
  11961. // temporarily treated as using the following mask for backwards
  11962. // compatibility purposes: destination,filter,includeChildren At some
  11963. // point in the future, behavior will be removed and specifying an empty
  11964. // updateMask will be an error.For a detailed FieldMask definition, see
  11965. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  11966. // updateMask=filter.
  11967. func (c *ProjectsSinksUpdateCall) UpdateMask(updateMask string) *ProjectsSinksUpdateCall {
  11968. c.urlParams_.Set("updateMask", updateMask)
  11969. return c
  11970. }
  11971. // Fields allows partial responses to be retrieved. See
  11972. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11973. // for more information.
  11974. func (c *ProjectsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsSinksUpdateCall {
  11975. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11976. return c
  11977. }
  11978. // Context sets the context to be used in this call's Do method. Any
  11979. // pending HTTP request will be aborted if the provided context is
  11980. // canceled.
  11981. func (c *ProjectsSinksUpdateCall) Context(ctx context.Context) *ProjectsSinksUpdateCall {
  11982. c.ctx_ = ctx
  11983. return c
  11984. }
  11985. // Header returns an http.Header that can be modified by the caller to
  11986. // add HTTP headers to the request.
  11987. func (c *ProjectsSinksUpdateCall) Header() http.Header {
  11988. if c.header_ == nil {
  11989. c.header_ = make(http.Header)
  11990. }
  11991. return c.header_
  11992. }
  11993. func (c *ProjectsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  11994. reqHeaders := make(http.Header)
  11995. for k, v := range c.header_ {
  11996. reqHeaders[k] = v
  11997. }
  11998. reqHeaders.Set("User-Agent", c.s.userAgent())
  11999. var body io.Reader = nil
  12000. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  12001. if err != nil {
  12002. return nil, err
  12003. }
  12004. reqHeaders.Set("Content-Type", "application/json")
  12005. c.urlParams_.Set("alt", alt)
  12006. c.urlParams_.Set("prettyPrint", "false")
  12007. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  12008. urls += "?" + c.urlParams_.Encode()
  12009. req, err := http.NewRequest("PUT", urls, body)
  12010. if err != nil {
  12011. return nil, err
  12012. }
  12013. req.Header = reqHeaders
  12014. googleapi.Expand(req.URL, map[string]string{
  12015. "sinkName": c.sinkNameid,
  12016. })
  12017. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12018. }
  12019. // Do executes the "logging.projects.sinks.update" call.
  12020. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  12021. // code is an error. Response headers are in either
  12022. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  12023. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12024. // check whether the returned error was because http.StatusNotModified
  12025. // was returned.
  12026. func (c *ProjectsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  12027. gensupport.SetOptions(c.urlParams_, opts...)
  12028. res, err := c.doRequest("json")
  12029. if res != nil && res.StatusCode == http.StatusNotModified {
  12030. if res.Body != nil {
  12031. res.Body.Close()
  12032. }
  12033. return nil, &googleapi.Error{
  12034. Code: res.StatusCode,
  12035. Header: res.Header,
  12036. }
  12037. }
  12038. if err != nil {
  12039. return nil, err
  12040. }
  12041. defer googleapi.CloseBody(res)
  12042. if err := googleapi.CheckResponse(res); err != nil {
  12043. return nil, err
  12044. }
  12045. ret := &LogSink{
  12046. ServerResponse: googleapi.ServerResponse{
  12047. Header: res.Header,
  12048. HTTPStatusCode: res.StatusCode,
  12049. },
  12050. }
  12051. target := &ret
  12052. if err := gensupport.DecodeResponse(target, res); err != nil {
  12053. return nil, err
  12054. }
  12055. return ret, nil
  12056. // {
  12057. // "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.",
  12058. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  12059. // "httpMethod": "PUT",
  12060. // "id": "logging.projects.sinks.update",
  12061. // "parameterOrder": [
  12062. // "sinkName"
  12063. // ],
  12064. // "parameters": {
  12065. // "sinkName": {
  12066. // "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\".",
  12067. // "location": "path",
  12068. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  12069. // "required": true,
  12070. // "type": "string"
  12071. // },
  12072. // "uniqueWriterIdentity": {
  12073. // "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.",
  12074. // "location": "query",
  12075. // "type": "boolean"
  12076. // },
  12077. // "updateMask": {
  12078. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  12079. // "format": "google-fieldmask",
  12080. // "location": "query",
  12081. // "type": "string"
  12082. // }
  12083. // },
  12084. // "path": "v2/{+sinkName}",
  12085. // "request": {
  12086. // "$ref": "LogSink"
  12087. // },
  12088. // "response": {
  12089. // "$ref": "LogSink"
  12090. // },
  12091. // "scopes": [
  12092. // "https://www.googleapis.com/auth/cloud-platform",
  12093. // "https://www.googleapis.com/auth/logging.admin"
  12094. // ]
  12095. // }
  12096. }
  12097. // method id "logging.sinks.create":
  12098. type SinksCreateCall struct {
  12099. s *Service
  12100. parent string
  12101. logsink *LogSink
  12102. urlParams_ gensupport.URLParams
  12103. ctx_ context.Context
  12104. header_ http.Header
  12105. }
  12106. // Create: Creates a sink that exports specified log entries to a
  12107. // destination. The export of newly-ingested log entries begins
  12108. // immediately, unless the sink's writer_identity is not permitted to
  12109. // write to the destination. A sink can export log entries only from the
  12110. // resource owning the sink.
  12111. func (r *SinksService) Create(parent string, logsink *LogSink) *SinksCreateCall {
  12112. c := &SinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12113. c.parent = parent
  12114. c.logsink = logsink
  12115. return c
  12116. }
  12117. // UniqueWriterIdentity sets the optional parameter
  12118. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  12119. // as writer_identity in the new sink. If this value is omitted or set
  12120. // to false, and if the sink's parent is a project, then the value
  12121. // returned as writer_identity is the same group or service account used
  12122. // by Logging before the addition of writer identities to this API. The
  12123. // sink's destination must be in the same project as the sink itself.If
  12124. // this field is set to true, or if the sink is owned by a non-project
  12125. // resource such as an organization, then the value of writer_identity
  12126. // will be a unique service account used only for exports from the new
  12127. // sink. For more information, see writer_identity in LogSink.
  12128. func (c *SinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *SinksCreateCall {
  12129. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  12130. return c
  12131. }
  12132. // Fields allows partial responses to be retrieved. See
  12133. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12134. // for more information.
  12135. func (c *SinksCreateCall) Fields(s ...googleapi.Field) *SinksCreateCall {
  12136. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12137. return c
  12138. }
  12139. // Context sets the context to be used in this call's Do method. Any
  12140. // pending HTTP request will be aborted if the provided context is
  12141. // canceled.
  12142. func (c *SinksCreateCall) Context(ctx context.Context) *SinksCreateCall {
  12143. c.ctx_ = ctx
  12144. return c
  12145. }
  12146. // Header returns an http.Header that can be modified by the caller to
  12147. // add HTTP headers to the request.
  12148. func (c *SinksCreateCall) Header() http.Header {
  12149. if c.header_ == nil {
  12150. c.header_ = make(http.Header)
  12151. }
  12152. return c.header_
  12153. }
  12154. func (c *SinksCreateCall) doRequest(alt string) (*http.Response, error) {
  12155. reqHeaders := make(http.Header)
  12156. for k, v := range c.header_ {
  12157. reqHeaders[k] = v
  12158. }
  12159. reqHeaders.Set("User-Agent", c.s.userAgent())
  12160. var body io.Reader = nil
  12161. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  12162. if err != nil {
  12163. return nil, err
  12164. }
  12165. reqHeaders.Set("Content-Type", "application/json")
  12166. c.urlParams_.Set("alt", alt)
  12167. c.urlParams_.Set("prettyPrint", "false")
  12168. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  12169. urls += "?" + c.urlParams_.Encode()
  12170. req, err := http.NewRequest("POST", urls, body)
  12171. if err != nil {
  12172. return nil, err
  12173. }
  12174. req.Header = reqHeaders
  12175. googleapi.Expand(req.URL, map[string]string{
  12176. "parent": c.parent,
  12177. })
  12178. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12179. }
  12180. // Do executes the "logging.sinks.create" call.
  12181. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  12182. // code is an error. Response headers are in either
  12183. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  12184. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12185. // check whether the returned error was because http.StatusNotModified
  12186. // was returned.
  12187. func (c *SinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  12188. gensupport.SetOptions(c.urlParams_, opts...)
  12189. res, err := c.doRequest("json")
  12190. if res != nil && res.StatusCode == http.StatusNotModified {
  12191. if res.Body != nil {
  12192. res.Body.Close()
  12193. }
  12194. return nil, &googleapi.Error{
  12195. Code: res.StatusCode,
  12196. Header: res.Header,
  12197. }
  12198. }
  12199. if err != nil {
  12200. return nil, err
  12201. }
  12202. defer googleapi.CloseBody(res)
  12203. if err := googleapi.CheckResponse(res); err != nil {
  12204. return nil, err
  12205. }
  12206. ret := &LogSink{
  12207. ServerResponse: googleapi.ServerResponse{
  12208. Header: res.Header,
  12209. HTTPStatusCode: res.StatusCode,
  12210. },
  12211. }
  12212. target := &ret
  12213. if err := gensupport.DecodeResponse(target, res); err != nil {
  12214. return nil, err
  12215. }
  12216. return ret, nil
  12217. // {
  12218. // "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.",
  12219. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks",
  12220. // "httpMethod": "POST",
  12221. // "id": "logging.sinks.create",
  12222. // "parameterOrder": [
  12223. // "parent"
  12224. // ],
  12225. // "parameters": {
  12226. // "parent": {
  12227. // "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\".",
  12228. // "location": "path",
  12229. // "pattern": "^[^/]+/[^/]+$",
  12230. // "required": true,
  12231. // "type": "string"
  12232. // },
  12233. // "uniqueWriterIdentity": {
  12234. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  12235. // "location": "query",
  12236. // "type": "boolean"
  12237. // }
  12238. // },
  12239. // "path": "v2/{+parent}/sinks",
  12240. // "request": {
  12241. // "$ref": "LogSink"
  12242. // },
  12243. // "response": {
  12244. // "$ref": "LogSink"
  12245. // },
  12246. // "scopes": [
  12247. // "https://www.googleapis.com/auth/cloud-platform",
  12248. // "https://www.googleapis.com/auth/logging.admin"
  12249. // ]
  12250. // }
  12251. }
  12252. // method id "logging.sinks.delete":
  12253. type SinksDeleteCall struct {
  12254. s *Service
  12255. sinkNameid string
  12256. urlParams_ gensupport.URLParams
  12257. ctx_ context.Context
  12258. header_ http.Header
  12259. }
  12260. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  12261. // then that service account is also deleted.
  12262. func (r *SinksService) Delete(sinkNameid string) *SinksDeleteCall {
  12263. c := &SinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12264. c.sinkNameid = sinkNameid
  12265. return c
  12266. }
  12267. // Fields allows partial responses to be retrieved. See
  12268. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12269. // for more information.
  12270. func (c *SinksDeleteCall) Fields(s ...googleapi.Field) *SinksDeleteCall {
  12271. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12272. return c
  12273. }
  12274. // Context sets the context to be used in this call's Do method. Any
  12275. // pending HTTP request will be aborted if the provided context is
  12276. // canceled.
  12277. func (c *SinksDeleteCall) Context(ctx context.Context) *SinksDeleteCall {
  12278. c.ctx_ = ctx
  12279. return c
  12280. }
  12281. // Header returns an http.Header that can be modified by the caller to
  12282. // add HTTP headers to the request.
  12283. func (c *SinksDeleteCall) Header() http.Header {
  12284. if c.header_ == nil {
  12285. c.header_ = make(http.Header)
  12286. }
  12287. return c.header_
  12288. }
  12289. func (c *SinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  12290. reqHeaders := make(http.Header)
  12291. for k, v := range c.header_ {
  12292. reqHeaders[k] = v
  12293. }
  12294. reqHeaders.Set("User-Agent", c.s.userAgent())
  12295. var body io.Reader = nil
  12296. c.urlParams_.Set("alt", alt)
  12297. c.urlParams_.Set("prettyPrint", "false")
  12298. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  12299. urls += "?" + c.urlParams_.Encode()
  12300. req, err := http.NewRequest("DELETE", urls, body)
  12301. if err != nil {
  12302. return nil, err
  12303. }
  12304. req.Header = reqHeaders
  12305. googleapi.Expand(req.URL, map[string]string{
  12306. "sinkName": c.sinkNameid,
  12307. })
  12308. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12309. }
  12310. // Do executes the "logging.sinks.delete" call.
  12311. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  12312. // code is an error. Response headers are in either
  12313. // *Empty.ServerResponse.Header or (if a response was returned at all)
  12314. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12315. // check whether the returned error was because http.StatusNotModified
  12316. // was returned.
  12317. func (c *SinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  12318. gensupport.SetOptions(c.urlParams_, opts...)
  12319. res, err := c.doRequest("json")
  12320. if res != nil && res.StatusCode == http.StatusNotModified {
  12321. if res.Body != nil {
  12322. res.Body.Close()
  12323. }
  12324. return nil, &googleapi.Error{
  12325. Code: res.StatusCode,
  12326. Header: res.Header,
  12327. }
  12328. }
  12329. if err != nil {
  12330. return nil, err
  12331. }
  12332. defer googleapi.CloseBody(res)
  12333. if err := googleapi.CheckResponse(res); err != nil {
  12334. return nil, err
  12335. }
  12336. ret := &Empty{
  12337. ServerResponse: googleapi.ServerResponse{
  12338. Header: res.Header,
  12339. HTTPStatusCode: res.StatusCode,
  12340. },
  12341. }
  12342. target := &ret
  12343. if err := gensupport.DecodeResponse(target, res); err != nil {
  12344. return nil, err
  12345. }
  12346. return ret, nil
  12347. // {
  12348. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  12349. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks/{sinksId}",
  12350. // "httpMethod": "DELETE",
  12351. // "id": "logging.sinks.delete",
  12352. // "parameterOrder": [
  12353. // "sinkName"
  12354. // ],
  12355. // "parameters": {
  12356. // "sinkName": {
  12357. // "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\".",
  12358. // "location": "path",
  12359. // "pattern": "^[^/]+/[^/]+/sinks/[^/]+$",
  12360. // "required": true,
  12361. // "type": "string"
  12362. // }
  12363. // },
  12364. // "path": "v2/{+sinkName}",
  12365. // "response": {
  12366. // "$ref": "Empty"
  12367. // },
  12368. // "scopes": [
  12369. // "https://www.googleapis.com/auth/cloud-platform",
  12370. // "https://www.googleapis.com/auth/logging.admin"
  12371. // ]
  12372. // }
  12373. }
  12374. // method id "logging.sinks.get":
  12375. type SinksGetCall struct {
  12376. s *Service
  12377. sinkName string
  12378. urlParams_ gensupport.URLParams
  12379. ifNoneMatch_ string
  12380. ctx_ context.Context
  12381. header_ http.Header
  12382. }
  12383. // Get: Gets a sink.
  12384. func (r *SinksService) Get(sinkName string) *SinksGetCall {
  12385. c := &SinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12386. c.sinkName = sinkName
  12387. return c
  12388. }
  12389. // Fields allows partial responses to be retrieved. See
  12390. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12391. // for more information.
  12392. func (c *SinksGetCall) Fields(s ...googleapi.Field) *SinksGetCall {
  12393. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12394. return c
  12395. }
  12396. // IfNoneMatch sets the optional parameter which makes the operation
  12397. // fail if the object's ETag matches the given value. This is useful for
  12398. // getting updates only after the object has changed since the last
  12399. // request. Use googleapi.IsNotModified to check whether the response
  12400. // error from Do is the result of In-None-Match.
  12401. func (c *SinksGetCall) IfNoneMatch(entityTag string) *SinksGetCall {
  12402. c.ifNoneMatch_ = entityTag
  12403. return c
  12404. }
  12405. // Context sets the context to be used in this call's Do method. Any
  12406. // pending HTTP request will be aborted if the provided context is
  12407. // canceled.
  12408. func (c *SinksGetCall) Context(ctx context.Context) *SinksGetCall {
  12409. c.ctx_ = ctx
  12410. return c
  12411. }
  12412. // Header returns an http.Header that can be modified by the caller to
  12413. // add HTTP headers to the request.
  12414. func (c *SinksGetCall) Header() http.Header {
  12415. if c.header_ == nil {
  12416. c.header_ = make(http.Header)
  12417. }
  12418. return c.header_
  12419. }
  12420. func (c *SinksGetCall) doRequest(alt string) (*http.Response, error) {
  12421. reqHeaders := make(http.Header)
  12422. for k, v := range c.header_ {
  12423. reqHeaders[k] = v
  12424. }
  12425. reqHeaders.Set("User-Agent", c.s.userAgent())
  12426. if c.ifNoneMatch_ != "" {
  12427. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12428. }
  12429. var body io.Reader = nil
  12430. c.urlParams_.Set("alt", alt)
  12431. c.urlParams_.Set("prettyPrint", "false")
  12432. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  12433. urls += "?" + c.urlParams_.Encode()
  12434. req, err := http.NewRequest("GET", urls, body)
  12435. if err != nil {
  12436. return nil, err
  12437. }
  12438. req.Header = reqHeaders
  12439. googleapi.Expand(req.URL, map[string]string{
  12440. "sinkName": c.sinkName,
  12441. })
  12442. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12443. }
  12444. // Do executes the "logging.sinks.get" call.
  12445. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  12446. // code is an error. Response headers are in either
  12447. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  12448. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12449. // check whether the returned error was because http.StatusNotModified
  12450. // was returned.
  12451. func (c *SinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  12452. gensupport.SetOptions(c.urlParams_, opts...)
  12453. res, err := c.doRequest("json")
  12454. if res != nil && res.StatusCode == http.StatusNotModified {
  12455. if res.Body != nil {
  12456. res.Body.Close()
  12457. }
  12458. return nil, &googleapi.Error{
  12459. Code: res.StatusCode,
  12460. Header: res.Header,
  12461. }
  12462. }
  12463. if err != nil {
  12464. return nil, err
  12465. }
  12466. defer googleapi.CloseBody(res)
  12467. if err := googleapi.CheckResponse(res); err != nil {
  12468. return nil, err
  12469. }
  12470. ret := &LogSink{
  12471. ServerResponse: googleapi.ServerResponse{
  12472. Header: res.Header,
  12473. HTTPStatusCode: res.StatusCode,
  12474. },
  12475. }
  12476. target := &ret
  12477. if err := gensupport.DecodeResponse(target, res); err != nil {
  12478. return nil, err
  12479. }
  12480. return ret, nil
  12481. // {
  12482. // "description": "Gets a sink.",
  12483. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks/{sinksId}",
  12484. // "httpMethod": "GET",
  12485. // "id": "logging.sinks.get",
  12486. // "parameterOrder": [
  12487. // "sinkName"
  12488. // ],
  12489. // "parameters": {
  12490. // "sinkName": {
  12491. // "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\".",
  12492. // "location": "path",
  12493. // "pattern": "^[^/]+/[^/]+/sinks/[^/]+$",
  12494. // "required": true,
  12495. // "type": "string"
  12496. // }
  12497. // },
  12498. // "path": "v2/{+sinkName}",
  12499. // "response": {
  12500. // "$ref": "LogSink"
  12501. // },
  12502. // "scopes": [
  12503. // "https://www.googleapis.com/auth/cloud-platform",
  12504. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  12505. // "https://www.googleapis.com/auth/logging.admin",
  12506. // "https://www.googleapis.com/auth/logging.read"
  12507. // ]
  12508. // }
  12509. }
  12510. // method id "logging.sinks.list":
  12511. type SinksListCall struct {
  12512. s *Service
  12513. parent string
  12514. urlParams_ gensupport.URLParams
  12515. ifNoneMatch_ string
  12516. ctx_ context.Context
  12517. header_ http.Header
  12518. }
  12519. // List: Lists sinks.
  12520. func (r *SinksService) List(parent string) *SinksListCall {
  12521. c := &SinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12522. c.parent = parent
  12523. return c
  12524. }
  12525. // PageSize sets the optional parameter "pageSize": The maximum number
  12526. // of results to return from this request. Non-positive values are
  12527. // ignored. The presence of nextPageToken in the response indicates that
  12528. // more results might be available.
  12529. func (c *SinksListCall) PageSize(pageSize int64) *SinksListCall {
  12530. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  12531. return c
  12532. }
  12533. // PageToken sets the optional parameter "pageToken": If present, then
  12534. // retrieve the next batch of results from the preceding call to this
  12535. // method. pageToken must be the value of nextPageToken from the
  12536. // previous response. The values of other method parameters should be
  12537. // identical to those in the previous call.
  12538. func (c *SinksListCall) PageToken(pageToken string) *SinksListCall {
  12539. c.urlParams_.Set("pageToken", pageToken)
  12540. return c
  12541. }
  12542. // Fields allows partial responses to be retrieved. See
  12543. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12544. // for more information.
  12545. func (c *SinksListCall) Fields(s ...googleapi.Field) *SinksListCall {
  12546. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12547. return c
  12548. }
  12549. // IfNoneMatch sets the optional parameter which makes the operation
  12550. // fail if the object's ETag matches the given value. This is useful for
  12551. // getting updates only after the object has changed since the last
  12552. // request. Use googleapi.IsNotModified to check whether the response
  12553. // error from Do is the result of In-None-Match.
  12554. func (c *SinksListCall) IfNoneMatch(entityTag string) *SinksListCall {
  12555. c.ifNoneMatch_ = entityTag
  12556. return c
  12557. }
  12558. // Context sets the context to be used in this call's Do method. Any
  12559. // pending HTTP request will be aborted if the provided context is
  12560. // canceled.
  12561. func (c *SinksListCall) Context(ctx context.Context) *SinksListCall {
  12562. c.ctx_ = ctx
  12563. return c
  12564. }
  12565. // Header returns an http.Header that can be modified by the caller to
  12566. // add HTTP headers to the request.
  12567. func (c *SinksListCall) Header() http.Header {
  12568. if c.header_ == nil {
  12569. c.header_ = make(http.Header)
  12570. }
  12571. return c.header_
  12572. }
  12573. func (c *SinksListCall) doRequest(alt string) (*http.Response, error) {
  12574. reqHeaders := make(http.Header)
  12575. for k, v := range c.header_ {
  12576. reqHeaders[k] = v
  12577. }
  12578. reqHeaders.Set("User-Agent", c.s.userAgent())
  12579. if c.ifNoneMatch_ != "" {
  12580. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12581. }
  12582. var body io.Reader = nil
  12583. c.urlParams_.Set("alt", alt)
  12584. c.urlParams_.Set("prettyPrint", "false")
  12585. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  12586. urls += "?" + c.urlParams_.Encode()
  12587. req, err := http.NewRequest("GET", urls, body)
  12588. if err != nil {
  12589. return nil, err
  12590. }
  12591. req.Header = reqHeaders
  12592. googleapi.Expand(req.URL, map[string]string{
  12593. "parent": c.parent,
  12594. })
  12595. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12596. }
  12597. // Do executes the "logging.sinks.list" call.
  12598. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  12599. // non-2xx status code is an error. Response headers are in either
  12600. // *ListSinksResponse.ServerResponse.Header or (if a response was
  12601. // returned at all) in error.(*googleapi.Error).Header. Use
  12602. // googleapi.IsNotModified to check whether the returned error was
  12603. // because http.StatusNotModified was returned.
  12604. func (c *SinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  12605. gensupport.SetOptions(c.urlParams_, opts...)
  12606. res, err := c.doRequest("json")
  12607. if res != nil && res.StatusCode == http.StatusNotModified {
  12608. if res.Body != nil {
  12609. res.Body.Close()
  12610. }
  12611. return nil, &googleapi.Error{
  12612. Code: res.StatusCode,
  12613. Header: res.Header,
  12614. }
  12615. }
  12616. if err != nil {
  12617. return nil, err
  12618. }
  12619. defer googleapi.CloseBody(res)
  12620. if err := googleapi.CheckResponse(res); err != nil {
  12621. return nil, err
  12622. }
  12623. ret := &ListSinksResponse{
  12624. ServerResponse: googleapi.ServerResponse{
  12625. Header: res.Header,
  12626. HTTPStatusCode: res.StatusCode,
  12627. },
  12628. }
  12629. target := &ret
  12630. if err := gensupport.DecodeResponse(target, res); err != nil {
  12631. return nil, err
  12632. }
  12633. return ret, nil
  12634. // {
  12635. // "description": "Lists sinks.",
  12636. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks",
  12637. // "httpMethod": "GET",
  12638. // "id": "logging.sinks.list",
  12639. // "parameterOrder": [
  12640. // "parent"
  12641. // ],
  12642. // "parameters": {
  12643. // "pageSize": {
  12644. // "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.",
  12645. // "format": "int32",
  12646. // "location": "query",
  12647. // "type": "integer"
  12648. // },
  12649. // "pageToken": {
  12650. // "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.",
  12651. // "location": "query",
  12652. // "type": "string"
  12653. // },
  12654. // "parent": {
  12655. // "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",
  12656. // "location": "path",
  12657. // "pattern": "^[^/]+/[^/]+$",
  12658. // "required": true,
  12659. // "type": "string"
  12660. // }
  12661. // },
  12662. // "path": "v2/{+parent}/sinks",
  12663. // "response": {
  12664. // "$ref": "ListSinksResponse"
  12665. // },
  12666. // "scopes": [
  12667. // "https://www.googleapis.com/auth/cloud-platform",
  12668. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  12669. // "https://www.googleapis.com/auth/logging.admin",
  12670. // "https://www.googleapis.com/auth/logging.read"
  12671. // ]
  12672. // }
  12673. }
  12674. // Pages invokes f for each page of results.
  12675. // A non-nil error returned from f will halt the iteration.
  12676. // The provided context supersedes any context provided to the Context method.
  12677. func (c *SinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  12678. c.ctx_ = ctx
  12679. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12680. for {
  12681. x, err := c.Do()
  12682. if err != nil {
  12683. return err
  12684. }
  12685. if err := f(x); err != nil {
  12686. return err
  12687. }
  12688. if x.NextPageToken == "" {
  12689. return nil
  12690. }
  12691. c.PageToken(x.NextPageToken)
  12692. }
  12693. }
  12694. // method id "logging.sinks.update":
  12695. type SinksUpdateCall struct {
  12696. s *Service
  12697. sinkNameid string
  12698. logsink *LogSink
  12699. urlParams_ gensupport.URLParams
  12700. ctx_ context.Context
  12701. header_ http.Header
  12702. }
  12703. // Update: Updates a sink. This method replaces the following fields in
  12704. // the existing sink with values from the new sink: destination, and
  12705. // filter.The updated sink might also have a new writer_identity; see
  12706. // the unique_writer_identity field.
  12707. func (r *SinksService) Update(sinkNameid string, logsink *LogSink) *SinksUpdateCall {
  12708. c := &SinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12709. c.sinkNameid = sinkNameid
  12710. c.logsink = logsink
  12711. return c
  12712. }
  12713. // UniqueWriterIdentity sets the optional parameter
  12714. // "uniqueWriterIdentity": See sinks.create for a description of this
  12715. // field. When updating a sink, the effect of this field on the value of
  12716. // writer_identity in the updated sink depends on both the old and new
  12717. // values of this field:
  12718. // If the old and new values of this field are both false or both true,
  12719. // then there is no change to the sink's writer_identity.
  12720. // If the old value is false and the new value is true, then
  12721. // writer_identity is changed to a unique service account.
  12722. // It is an error if the old value is true and the new value is set to
  12723. // false or defaulted to false.
  12724. func (c *SinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *SinksUpdateCall {
  12725. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  12726. return c
  12727. }
  12728. // UpdateMask sets the optional parameter "updateMask": Field mask that
  12729. // specifies the fields in sink that need an update. A sink field will
  12730. // be overwritten if, and only if, it is in the update mask. name and
  12731. // output only fields cannot be updated.An empty updateMask is
  12732. // temporarily treated as using the following mask for backwards
  12733. // compatibility purposes: destination,filter,includeChildren At some
  12734. // point in the future, behavior will be removed and specifying an empty
  12735. // updateMask will be an error.For a detailed FieldMask definition, see
  12736. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample:
  12737. // updateMask=filter.
  12738. func (c *SinksUpdateCall) UpdateMask(updateMask string) *SinksUpdateCall {
  12739. c.urlParams_.Set("updateMask", updateMask)
  12740. return c
  12741. }
  12742. // Fields allows partial responses to be retrieved. See
  12743. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12744. // for more information.
  12745. func (c *SinksUpdateCall) Fields(s ...googleapi.Field) *SinksUpdateCall {
  12746. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12747. return c
  12748. }
  12749. // Context sets the context to be used in this call's Do method. Any
  12750. // pending HTTP request will be aborted if the provided context is
  12751. // canceled.
  12752. func (c *SinksUpdateCall) Context(ctx context.Context) *SinksUpdateCall {
  12753. c.ctx_ = ctx
  12754. return c
  12755. }
  12756. // Header returns an http.Header that can be modified by the caller to
  12757. // add HTTP headers to the request.
  12758. func (c *SinksUpdateCall) Header() http.Header {
  12759. if c.header_ == nil {
  12760. c.header_ = make(http.Header)
  12761. }
  12762. return c.header_
  12763. }
  12764. func (c *SinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  12765. reqHeaders := make(http.Header)
  12766. for k, v := range c.header_ {
  12767. reqHeaders[k] = v
  12768. }
  12769. reqHeaders.Set("User-Agent", c.s.userAgent())
  12770. var body io.Reader = nil
  12771. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  12772. if err != nil {
  12773. return nil, err
  12774. }
  12775. reqHeaders.Set("Content-Type", "application/json")
  12776. c.urlParams_.Set("alt", alt)
  12777. c.urlParams_.Set("prettyPrint", "false")
  12778. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  12779. urls += "?" + c.urlParams_.Encode()
  12780. req, err := http.NewRequest("PUT", urls, body)
  12781. if err != nil {
  12782. return nil, err
  12783. }
  12784. req.Header = reqHeaders
  12785. googleapi.Expand(req.URL, map[string]string{
  12786. "sinkName": c.sinkNameid,
  12787. })
  12788. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12789. }
  12790. // Do executes the "logging.sinks.update" call.
  12791. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  12792. // code is an error. Response headers are in either
  12793. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  12794. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12795. // check whether the returned error was because http.StatusNotModified
  12796. // was returned.
  12797. func (c *SinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  12798. gensupport.SetOptions(c.urlParams_, opts...)
  12799. res, err := c.doRequest("json")
  12800. if res != nil && res.StatusCode == http.StatusNotModified {
  12801. if res.Body != nil {
  12802. res.Body.Close()
  12803. }
  12804. return nil, &googleapi.Error{
  12805. Code: res.StatusCode,
  12806. Header: res.Header,
  12807. }
  12808. }
  12809. if err != nil {
  12810. return nil, err
  12811. }
  12812. defer googleapi.CloseBody(res)
  12813. if err := googleapi.CheckResponse(res); err != nil {
  12814. return nil, err
  12815. }
  12816. ret := &LogSink{
  12817. ServerResponse: googleapi.ServerResponse{
  12818. Header: res.Header,
  12819. HTTPStatusCode: res.StatusCode,
  12820. },
  12821. }
  12822. target := &ret
  12823. if err := gensupport.DecodeResponse(target, res); err != nil {
  12824. return nil, err
  12825. }
  12826. return ret, nil
  12827. // {
  12828. // "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.",
  12829. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks/{sinksId}",
  12830. // "httpMethod": "PUT",
  12831. // "id": "logging.sinks.update",
  12832. // "parameterOrder": [
  12833. // "sinkName"
  12834. // ],
  12835. // "parameters": {
  12836. // "sinkName": {
  12837. // "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\".",
  12838. // "location": "path",
  12839. // "pattern": "^[^/]+/[^/]+/sinks/[^/]+$",
  12840. // "required": true,
  12841. // "type": "string"
  12842. // },
  12843. // "uniqueWriterIdentity": {
  12844. // "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.",
  12845. // "location": "query",
  12846. // "type": "boolean"
  12847. // },
  12848. // "updateMask": {
  12849. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskExample: updateMask=filter.",
  12850. // "format": "google-fieldmask",
  12851. // "location": "query",
  12852. // "type": "string"
  12853. // }
  12854. // },
  12855. // "path": "v2/{+sinkName}",
  12856. // "request": {
  12857. // "$ref": "LogSink"
  12858. // },
  12859. // "response": {
  12860. // "$ref": "LogSink"
  12861. // },
  12862. // "scopes": [
  12863. // "https://www.googleapis.com/auth/cloud-platform",
  12864. // "https://www.googleapis.com/auth/logging.admin"
  12865. // ]
  12866. // }
  12867. }