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

13516 lines
492 KiB

  1. // Package logging provides access to the Stackdriver Logging API.
  2. //
  3. // See https://cloud.google.com/logging/docs/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/logging/v2"
  8. // ...
  9. // loggingService, err := logging.New(oauthHttpClient)
  10. package logging // import "google.golang.org/api/logging/v2"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "logging:v2"
  41. const apiName = "logging"
  42. const apiVersion = "v2"
  43. const basePath = "https://logging.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // View your data across Google Cloud Platform services
  49. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  50. // Administrate log data for your projects
  51. LoggingAdminScope = "https://www.googleapis.com/auth/logging.admin"
  52. // View log data for your projects
  53. LoggingReadScope = "https://www.googleapis.com/auth/logging.read"
  54. // Submit log data for your projects
  55. LoggingWriteScope = "https://www.googleapis.com/auth/logging.write"
  56. )
  57. func New(client *http.Client) (*Service, error) {
  58. if client == nil {
  59. return nil, errors.New("client is nil")
  60. }
  61. s := &Service{client: client, BasePath: basePath}
  62. s.BillingAccounts = NewBillingAccountsService(s)
  63. s.Entries = NewEntriesService(s)
  64. s.Exclusions = NewExclusionsService(s)
  65. s.Folders = NewFoldersService(s)
  66. s.Logs = NewLogsService(s)
  67. s.MonitoredResourceDescriptors = NewMonitoredResourceDescriptorsService(s)
  68. s.Organizations = NewOrganizationsService(s)
  69. s.Projects = NewProjectsService(s)
  70. s.Sinks = NewSinksService(s)
  71. return s, nil
  72. }
  73. type Service struct {
  74. client *http.Client
  75. BasePath string // API endpoint base URL
  76. UserAgent string // optional additional User-Agent fragment
  77. BillingAccounts *BillingAccountsService
  78. Entries *EntriesService
  79. Exclusions *ExclusionsService
  80. Folders *FoldersService
  81. Logs *LogsService
  82. MonitoredResourceDescriptors *MonitoredResourceDescriptorsService
  83. Organizations *OrganizationsService
  84. Projects *ProjectsService
  85. Sinks *SinksService
  86. }
  87. func (s *Service) userAgent() string {
  88. if s.UserAgent == "" {
  89. return googleapi.UserAgent
  90. }
  91. return googleapi.UserAgent + " " + s.UserAgent
  92. }
  93. func NewBillingAccountsService(s *Service) *BillingAccountsService {
  94. rs := &BillingAccountsService{s: s}
  95. rs.Exclusions = NewBillingAccountsExclusionsService(s)
  96. rs.Logs = NewBillingAccountsLogsService(s)
  97. rs.Sinks = NewBillingAccountsSinksService(s)
  98. return rs
  99. }
  100. type BillingAccountsService struct {
  101. s *Service
  102. Exclusions *BillingAccountsExclusionsService
  103. Logs *BillingAccountsLogsService
  104. Sinks *BillingAccountsSinksService
  105. }
  106. func NewBillingAccountsExclusionsService(s *Service) *BillingAccountsExclusionsService {
  107. rs := &BillingAccountsExclusionsService{s: s}
  108. return rs
  109. }
  110. type BillingAccountsExclusionsService struct {
  111. s *Service
  112. }
  113. func NewBillingAccountsLogsService(s *Service) *BillingAccountsLogsService {
  114. rs := &BillingAccountsLogsService{s: s}
  115. return rs
  116. }
  117. type BillingAccountsLogsService struct {
  118. s *Service
  119. }
  120. func NewBillingAccountsSinksService(s *Service) *BillingAccountsSinksService {
  121. rs := &BillingAccountsSinksService{s: s}
  122. return rs
  123. }
  124. type BillingAccountsSinksService struct {
  125. s *Service
  126. }
  127. func NewEntriesService(s *Service) *EntriesService {
  128. rs := &EntriesService{s: s}
  129. return rs
  130. }
  131. type EntriesService struct {
  132. s *Service
  133. }
  134. func NewExclusionsService(s *Service) *ExclusionsService {
  135. rs := &ExclusionsService{s: s}
  136. return rs
  137. }
  138. type ExclusionsService struct {
  139. s *Service
  140. }
  141. func NewFoldersService(s *Service) *FoldersService {
  142. rs := &FoldersService{s: s}
  143. rs.Exclusions = NewFoldersExclusionsService(s)
  144. rs.Logs = NewFoldersLogsService(s)
  145. rs.Sinks = NewFoldersSinksService(s)
  146. return rs
  147. }
  148. type FoldersService struct {
  149. s *Service
  150. Exclusions *FoldersExclusionsService
  151. Logs *FoldersLogsService
  152. Sinks *FoldersSinksService
  153. }
  154. func NewFoldersExclusionsService(s *Service) *FoldersExclusionsService {
  155. rs := &FoldersExclusionsService{s: s}
  156. return rs
  157. }
  158. type FoldersExclusionsService struct {
  159. s *Service
  160. }
  161. func NewFoldersLogsService(s *Service) *FoldersLogsService {
  162. rs := &FoldersLogsService{s: s}
  163. return rs
  164. }
  165. type FoldersLogsService struct {
  166. s *Service
  167. }
  168. func NewFoldersSinksService(s *Service) *FoldersSinksService {
  169. rs := &FoldersSinksService{s: s}
  170. return rs
  171. }
  172. type FoldersSinksService struct {
  173. s *Service
  174. }
  175. func NewLogsService(s *Service) *LogsService {
  176. rs := &LogsService{s: s}
  177. return rs
  178. }
  179. type LogsService struct {
  180. s *Service
  181. }
  182. func NewMonitoredResourceDescriptorsService(s *Service) *MonitoredResourceDescriptorsService {
  183. rs := &MonitoredResourceDescriptorsService{s: s}
  184. return rs
  185. }
  186. type MonitoredResourceDescriptorsService struct {
  187. s *Service
  188. }
  189. func NewOrganizationsService(s *Service) *OrganizationsService {
  190. rs := &OrganizationsService{s: s}
  191. rs.Exclusions = NewOrganizationsExclusionsService(s)
  192. rs.Logs = NewOrganizationsLogsService(s)
  193. rs.Sinks = NewOrganizationsSinksService(s)
  194. return rs
  195. }
  196. type OrganizationsService struct {
  197. s *Service
  198. Exclusions *OrganizationsExclusionsService
  199. Logs *OrganizationsLogsService
  200. Sinks *OrganizationsSinksService
  201. }
  202. func NewOrganizationsExclusionsService(s *Service) *OrganizationsExclusionsService {
  203. rs := &OrganizationsExclusionsService{s: s}
  204. return rs
  205. }
  206. type OrganizationsExclusionsService struct {
  207. s *Service
  208. }
  209. func NewOrganizationsLogsService(s *Service) *OrganizationsLogsService {
  210. rs := &OrganizationsLogsService{s: s}
  211. return rs
  212. }
  213. type OrganizationsLogsService struct {
  214. s *Service
  215. }
  216. func NewOrganizationsSinksService(s *Service) *OrganizationsSinksService {
  217. rs := &OrganizationsSinksService{s: s}
  218. return rs
  219. }
  220. type OrganizationsSinksService struct {
  221. s *Service
  222. }
  223. func NewProjectsService(s *Service) *ProjectsService {
  224. rs := &ProjectsService{s: s}
  225. rs.Exclusions = NewProjectsExclusionsService(s)
  226. rs.Logs = NewProjectsLogsService(s)
  227. rs.Metrics = NewProjectsMetricsService(s)
  228. rs.Sinks = NewProjectsSinksService(s)
  229. return rs
  230. }
  231. type ProjectsService struct {
  232. s *Service
  233. Exclusions *ProjectsExclusionsService
  234. Logs *ProjectsLogsService
  235. Metrics *ProjectsMetricsService
  236. Sinks *ProjectsSinksService
  237. }
  238. func NewProjectsExclusionsService(s *Service) *ProjectsExclusionsService {
  239. rs := &ProjectsExclusionsService{s: s}
  240. return rs
  241. }
  242. type ProjectsExclusionsService struct {
  243. s *Service
  244. }
  245. func NewProjectsLogsService(s *Service) *ProjectsLogsService {
  246. rs := &ProjectsLogsService{s: s}
  247. return rs
  248. }
  249. type ProjectsLogsService struct {
  250. s *Service
  251. }
  252. func NewProjectsMetricsService(s *Service) *ProjectsMetricsService {
  253. rs := &ProjectsMetricsService{s: s}
  254. return rs
  255. }
  256. type ProjectsMetricsService struct {
  257. s *Service
  258. }
  259. func NewProjectsSinksService(s *Service) *ProjectsSinksService {
  260. rs := &ProjectsSinksService{s: s}
  261. return rs
  262. }
  263. type ProjectsSinksService struct {
  264. s *Service
  265. }
  266. func NewSinksService(s *Service) *SinksService {
  267. rs := &SinksService{s: s}
  268. return rs
  269. }
  270. type SinksService struct {
  271. s *Service
  272. }
  273. // BucketOptions: BucketOptions describes the bucket boundaries used to
  274. // create a histogram for the distribution. The buckets can be in a
  275. // linear sequence, an exponential sequence, or each bucket can be
  276. // specified explicitly. BucketOptions does not include the number of
  277. // values in each bucket.A bucket has an inclusive lower bound and
  278. // exclusive upper bound for the values that are counted for that
  279. // bucket. The upper bound of a bucket must be strictly greater than the
  280. // lower bound. The sequence of N buckets for a distribution consists of
  281. // an underflow bucket (number 0), zero or more finite buckets (number 1
  282. // through N - 2) and an overflow bucket (number N - 1). The buckets are
  283. // contiguous: the lower bound of bucket i (i > 0) is the same as the
  284. // upper bound of bucket i - 1. The buckets span the whole range of
  285. // finite values: lower bound of the underflow bucket is -infinity and
  286. // the upper bound of the overflow bucket is +infinity. The finite
  287. // buckets are so-called because both bounds are finite.
  288. type BucketOptions struct {
  289. // ExplicitBuckets: The explicit buckets.
  290. ExplicitBuckets *Explicit `json:"explicitBuckets,omitempty"`
  291. // ExponentialBuckets: The exponential buckets.
  292. ExponentialBuckets *Exponential `json:"exponentialBuckets,omitempty"`
  293. // LinearBuckets: The linear bucket.
  294. LinearBuckets *Linear `json:"linearBuckets,omitempty"`
  295. // ForceSendFields is a list of field names (e.g. "ExplicitBuckets") to
  296. // unconditionally include in API requests. By default, fields with
  297. // empty values are omitted from API requests. However, any non-pointer,
  298. // non-interface field appearing in ForceSendFields will be sent to the
  299. // server regardless of whether the field is empty or not. This may be
  300. // used to include empty fields in Patch requests.
  301. ForceSendFields []string `json:"-"`
  302. // NullFields is a list of field names (e.g. "ExplicitBuckets") to
  303. // include in API requests with the JSON null value. By default, fields
  304. // with empty values are omitted from API requests. However, any field
  305. // with an empty value appearing in NullFields will be sent to the
  306. // server as null. It is an error if a field in this list has a
  307. // non-empty value. This may be used to include null fields in Patch
  308. // requests.
  309. NullFields []string `json:"-"`
  310. }
  311. func (s *BucketOptions) MarshalJSON() ([]byte, error) {
  312. type NoMethod BucketOptions
  313. raw := NoMethod(*s)
  314. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  315. }
  316. // Empty: A generic empty message that you can re-use to avoid defining
  317. // duplicated empty messages in your APIs. A typical example is to use
  318. // it as the request or the response type of an API method. For
  319. // instance:
  320. // service Foo {
  321. // rpc Bar(google.protobuf.Empty) returns
  322. // (google.protobuf.Empty);
  323. // }
  324. // The JSON representation for Empty is empty JSON object {}.
  325. type Empty struct {
  326. // ServerResponse contains the HTTP response code and headers from the
  327. // server.
  328. googleapi.ServerResponse `json:"-"`
  329. }
  330. // Explicit: Specifies a set of buckets with arbitrary widths.There are
  331. // size(bounds) + 1 (= N) buckets. Bucket i has the following
  332. // boundaries:Upper bound (0 <= i < N-1): boundsi Lower bound (1 <= i <
  333. // N); boundsi - 1The bounds field must contain at least one element. If
  334. // bounds has only one element, then there are no finite buckets, and
  335. // that single element is the common boundary of the overflow and
  336. // underflow buckets.
  337. type Explicit struct {
  338. // Bounds: The values must be monotonically increasing.
  339. Bounds []float64 `json:"bounds,omitempty"`
  340. // ForceSendFields is a list of field names (e.g. "Bounds") to
  341. // unconditionally include in API requests. By default, fields with
  342. // empty values are omitted from API requests. However, any non-pointer,
  343. // non-interface field appearing in ForceSendFields will be sent to the
  344. // server regardless of whether the field is empty or not. This may be
  345. // used to include empty fields in Patch requests.
  346. ForceSendFields []string `json:"-"`
  347. // NullFields is a list of field names (e.g. "Bounds") to include in API
  348. // requests with the JSON null value. By default, fields with empty
  349. // values are omitted from API requests. However, any field with an
  350. // empty value appearing in NullFields will be sent to the server as
  351. // null. It is an error if a field in this list has a non-empty value.
  352. // This may be used to include null fields in Patch requests.
  353. NullFields []string `json:"-"`
  354. }
  355. func (s *Explicit) MarshalJSON() ([]byte, error) {
  356. type NoMethod Explicit
  357. raw := NoMethod(*s)
  358. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  359. }
  360. // Exponential: Specifies an exponential sequence of buckets that have a
  361. // width that is proportional to the value of the lower bound. Each
  362. // bucket represents a constant relative uncertainty on a specific value
  363. // in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket
  364. // i has the following boundaries:Upper bound (0 <= i < N-1): scale *
  365. // (growth_factor ^ i). Lower bound (1 <= i < N): scale *
  366. // (growth_factor ^ (i - 1)).
  367. type Exponential struct {
  368. // GrowthFactor: Must be greater than 1.
  369. GrowthFactor float64 `json:"growthFactor,omitempty"`
  370. // NumFiniteBuckets: Must be greater than 0.
  371. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  372. // Scale: Must be greater than 0.
  373. Scale float64 `json:"scale,omitempty"`
  374. // ForceSendFields is a list of field names (e.g. "GrowthFactor") to
  375. // unconditionally include in API requests. By default, fields with
  376. // empty values are omitted from API requests. However, any non-pointer,
  377. // non-interface field appearing in ForceSendFields will be sent to the
  378. // server regardless of whether the field is empty or not. This may be
  379. // used to include empty fields in Patch requests.
  380. ForceSendFields []string `json:"-"`
  381. // NullFields is a list of field names (e.g. "GrowthFactor") to include
  382. // in API requests with the JSON null value. By default, fields with
  383. // empty values are omitted from API requests. However, any field with
  384. // an empty value appearing in NullFields will be sent to the server as
  385. // null. It is an error if a field in this list has a non-empty value.
  386. // This may be used to include null fields in Patch requests.
  387. NullFields []string `json:"-"`
  388. }
  389. func (s *Exponential) MarshalJSON() ([]byte, error) {
  390. type NoMethod Exponential
  391. raw := NoMethod(*s)
  392. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  393. }
  394. func (s *Exponential) UnmarshalJSON(data []byte) error {
  395. type NoMethod Exponential
  396. var s1 struct {
  397. GrowthFactor gensupport.JSONFloat64 `json:"growthFactor"`
  398. Scale gensupport.JSONFloat64 `json:"scale"`
  399. *NoMethod
  400. }
  401. s1.NoMethod = (*NoMethod)(s)
  402. if err := json.Unmarshal(data, &s1); err != nil {
  403. return err
  404. }
  405. s.GrowthFactor = float64(s1.GrowthFactor)
  406. s.Scale = float64(s1.Scale)
  407. return nil
  408. }
  409. // HttpRequest: A common proto for logging HTTP requests. Only contains
  410. // semantics defined by the HTTP specification. Product-specific logging
  411. // information MUST be defined in a separate message.
  412. type HttpRequest struct {
  413. // CacheFillBytes: The number of HTTP response bytes inserted into
  414. // cache. Set only when a cache fill was attempted.
  415. CacheFillBytes int64 `json:"cacheFillBytes,omitempty,string"`
  416. // CacheHit: Whether or not an entity was served from cache (with or
  417. // without validation).
  418. CacheHit bool `json:"cacheHit,omitempty"`
  419. // CacheLookup: Whether or not a cache lookup was attempted.
  420. CacheLookup bool `json:"cacheLookup,omitempty"`
  421. // CacheValidatedWithOriginServer: Whether or not the response was
  422. // validated with the origin server before being served from cache. This
  423. // field is only meaningful if cache_hit is True.
  424. CacheValidatedWithOriginServer bool `json:"cacheValidatedWithOriginServer,omitempty"`
  425. // Latency: The request processing latency on the server, from the time
  426. // the request was received until the response was sent.
  427. Latency string `json:"latency,omitempty"`
  428. // Protocol: Protocol used for the request. Examples: "HTTP/1.1",
  429. // "HTTP/2", "websocket"
  430. Protocol string `json:"protocol,omitempty"`
  431. // Referer: The referer URL of the request, as defined in HTTP/1.1
  432. // Header Field Definitions
  433. // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
  434. Referer string `json:"referer,omitempty"`
  435. // RemoteIp: The IP address (IPv4 or IPv6) of the client that issued the
  436. // HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
  437. RemoteIp string `json:"remoteIp,omitempty"`
  438. // RequestMethod: The request method. Examples: "GET", "HEAD", "PUT",
  439. // "POST".
  440. RequestMethod string `json:"requestMethod,omitempty"`
  441. // RequestSize: The size of the HTTP request message in bytes, including
  442. // the request headers and the request body.
  443. RequestSize int64 `json:"requestSize,omitempty,string"`
  444. // RequestUrl: The scheme (http, https), the host name, the path and the
  445. // query portion of the URL that was requested. Example:
  446. // "http://example.com/some/info?color=red".
  447. RequestUrl string `json:"requestUrl,omitempty"`
  448. // ResponseSize: The size of the HTTP response message sent back to the
  449. // client, in bytes, including the response headers and the response
  450. // body.
  451. ResponseSize int64 `json:"responseSize,omitempty,string"`
  452. // ServerIp: The IP address (IPv4 or IPv6) of the origin server that the
  453. // request was sent to.
  454. ServerIp string `json:"serverIp,omitempty"`
  455. // Status: The response code indicating the status of response.
  456. // Examples: 200, 404.
  457. Status int64 `json:"status,omitempty"`
  458. // UserAgent: The user agent sent by the client. Example: "Mozilla/4.0
  459. // (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".
  460. UserAgent string `json:"userAgent,omitempty"`
  461. // ForceSendFields is a list of field names (e.g. "CacheFillBytes") to
  462. // unconditionally include in API requests. By default, fields with
  463. // empty values are omitted from API requests. However, any non-pointer,
  464. // non-interface field appearing in ForceSendFields will be sent to the
  465. // server regardless of whether the field is empty or not. This may be
  466. // used to include empty fields in Patch requests.
  467. ForceSendFields []string `json:"-"`
  468. // NullFields is a list of field names (e.g. "CacheFillBytes") to
  469. // include in API requests with the JSON null value. By default, fields
  470. // with empty values are omitted from API requests. However, any field
  471. // with an empty value appearing in NullFields will be sent to the
  472. // server as null. It is an error if a field in this list has a
  473. // non-empty value. This may be used to include null fields in Patch
  474. // requests.
  475. NullFields []string `json:"-"`
  476. }
  477. func (s *HttpRequest) MarshalJSON() ([]byte, error) {
  478. type NoMethod HttpRequest
  479. raw := NoMethod(*s)
  480. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  481. }
  482. // LabelDescriptor: A description of a label.
  483. type LabelDescriptor struct {
  484. // Description: A human-readable description for the label.
  485. Description string `json:"description,omitempty"`
  486. // Key: The label key.
  487. Key string `json:"key,omitempty"`
  488. // ValueType: The type of data that can be assigned to the label.
  489. //
  490. // Possible values:
  491. // "STRING" - A variable-length string. This is the default.
  492. // "BOOL" - Boolean; true or false.
  493. // "INT64" - A 64-bit signed integer.
  494. ValueType string `json:"valueType,omitempty"`
  495. // ForceSendFields is a list of field names (e.g. "Description") to
  496. // unconditionally include in API requests. By default, fields with
  497. // empty values are omitted from API requests. However, any non-pointer,
  498. // non-interface field appearing in ForceSendFields will be sent to the
  499. // server regardless of whether the field is empty or not. This may be
  500. // used to include empty fields in Patch requests.
  501. ForceSendFields []string `json:"-"`
  502. // NullFields is a list of field names (e.g. "Description") to include
  503. // in API requests with the JSON null value. By default, fields with
  504. // empty values are omitted from API requests. However, any field with
  505. // an empty value appearing in NullFields will be sent to the server as
  506. // null. It is an error if a field in this list has a non-empty value.
  507. // This may be used to include null fields in Patch requests.
  508. NullFields []string `json:"-"`
  509. }
  510. func (s *LabelDescriptor) MarshalJSON() ([]byte, error) {
  511. type NoMethod LabelDescriptor
  512. raw := NoMethod(*s)
  513. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  514. }
  515. // Linear: Specifies a linear sequence of buckets that all have the same
  516. // width (except overflow and underflow). Each bucket represents a
  517. // constant absolute uncertainty on the specific value in the
  518. // bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has
  519. // the following boundaries:Upper bound (0 <= i < N-1): offset + (width
  520. // * i). Lower bound (1 <= i < N): offset + (width * (i - 1)).
  521. type Linear struct {
  522. // NumFiniteBuckets: Must be greater than 0.
  523. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  524. // Offset: Lower bound of the first bucket.
  525. Offset float64 `json:"offset,omitempty"`
  526. // Width: Must be greater than 0.
  527. Width float64 `json:"width,omitempty"`
  528. // ForceSendFields is a list of field names (e.g. "NumFiniteBuckets") to
  529. // unconditionally include in API requests. By default, fields with
  530. // empty values are omitted from API requests. However, any non-pointer,
  531. // non-interface field appearing in ForceSendFields will be sent to the
  532. // server regardless of whether the field is empty or not. This may be
  533. // used to include empty fields in Patch requests.
  534. ForceSendFields []string `json:"-"`
  535. // NullFields is a list of field names (e.g. "NumFiniteBuckets") to
  536. // include in API requests with the JSON null value. By default, fields
  537. // with empty values are omitted from API requests. However, any field
  538. // with an empty value appearing in NullFields will be sent to the
  539. // server as null. It is an error if a field in this list has a
  540. // non-empty value. This may be used to include null fields in Patch
  541. // requests.
  542. NullFields []string `json:"-"`
  543. }
  544. func (s *Linear) MarshalJSON() ([]byte, error) {
  545. type NoMethod Linear
  546. raw := NoMethod(*s)
  547. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  548. }
  549. func (s *Linear) UnmarshalJSON(data []byte) error {
  550. type NoMethod Linear
  551. var s1 struct {
  552. Offset gensupport.JSONFloat64 `json:"offset"`
  553. Width gensupport.JSONFloat64 `json:"width"`
  554. *NoMethod
  555. }
  556. s1.NoMethod = (*NoMethod)(s)
  557. if err := json.Unmarshal(data, &s1); err != nil {
  558. return err
  559. }
  560. s.Offset = float64(s1.Offset)
  561. s.Width = float64(s1.Width)
  562. return nil
  563. }
  564. // ListExclusionsResponse: Result returned from ListExclusions.
  565. type ListExclusionsResponse struct {
  566. // Exclusions: A list of exclusions.
  567. Exclusions []*LogExclusion `json:"exclusions,omitempty"`
  568. // NextPageToken: If there might be more results than appear in this
  569. // response, then nextPageToken is included. To get the next set of
  570. // results, call the same method again using the value of nextPageToken
  571. // as pageToken.
  572. NextPageToken string `json:"nextPageToken,omitempty"`
  573. // ServerResponse contains the HTTP response code and headers from the
  574. // server.
  575. googleapi.ServerResponse `json:"-"`
  576. // ForceSendFields is a list of field names (e.g. "Exclusions") to
  577. // unconditionally include in API requests. By default, fields with
  578. // empty values are omitted from API requests. However, any non-pointer,
  579. // non-interface field appearing in ForceSendFields will be sent to the
  580. // server regardless of whether the field is empty or not. This may be
  581. // used to include empty fields in Patch requests.
  582. ForceSendFields []string `json:"-"`
  583. // NullFields is a list of field names (e.g. "Exclusions") to include in
  584. // API requests with the JSON null value. By default, fields with empty
  585. // values are omitted from API requests. However, any field with an
  586. // empty value appearing in NullFields will be sent to the server as
  587. // null. It is an error if a field in this list has a non-empty value.
  588. // This may be used to include null fields in Patch requests.
  589. NullFields []string `json:"-"`
  590. }
  591. func (s *ListExclusionsResponse) MarshalJSON() ([]byte, error) {
  592. type NoMethod ListExclusionsResponse
  593. raw := NoMethod(*s)
  594. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  595. }
  596. // ListLogEntriesRequest: The parameters to ListLogEntries.
  597. type ListLogEntriesRequest struct {
  598. // Filter: Optional. A filter that chooses which log entries to return.
  599. // See Advanced Logs Filters. Only log entries that match the filter are
  600. // returned. An empty filter matches all log entries in the resources
  601. // listed in resource_names. Referencing a parent resource that is not
  602. // listed in resource_names will cause the filter to return no results.
  603. // The maximum length of the filter is 20000 characters.
  604. Filter string `json:"filter,omitempty"`
  605. // OrderBy: Optional. How the results should be sorted. Presently, the
  606. // only permitted values are "timestamp asc" (default) and "timestamp
  607. // desc". The first option returns entries in order of increasing values
  608. // of LogEntry.timestamp (oldest first), and the second option returns
  609. // entries in order of decreasing timestamps (newest first). Entries
  610. // with equal timestamps are returned in order of their insert_id
  611. // values.
  612. OrderBy string `json:"orderBy,omitempty"`
  613. // PageSize: Optional. The maximum number of results to return from this
  614. // request. Non-positive values are ignored. The presence of
  615. // next_page_token in the response indicates that more results might be
  616. // available.
  617. PageSize int64 `json:"pageSize,omitempty"`
  618. // PageToken: Optional. If present, then retrieve the next batch of
  619. // results from the preceding call to this method. page_token must be
  620. // the value of next_page_token from the previous response. The values
  621. // of other method parameters should be identical to those in the
  622. // previous call.
  623. PageToken string `json:"pageToken,omitempty"`
  624. // ProjectIds: Deprecated. Use resource_names instead. One or more
  625. // project identifiers or project numbers from which to retrieve log
  626. // entries. Example: "my-project-1A". If present, these project
  627. // identifiers are converted to resource name format and added to the
  628. // list of resources in resource_names.
  629. ProjectIds []string `json:"projectIds,omitempty"`
  630. // ResourceNames: Required. Names of one or more parent resources from
  631. // which to retrieve log
  632. // entries:
  633. // "projects/[PROJECT_ID]"
  634. // "organizations/[ORGANIZATION_ID]"
  635. // "bi
  636. // llingAccounts/[BILLING_ACCOUNT_ID]"
  637. // "folders/[FOLDER_ID]"
  638. // Projects listed in the project_ids field are added to this list.
  639. ResourceNames []string `json:"resourceNames,omitempty"`
  640. // ForceSendFields is a list of field names (e.g. "Filter") to
  641. // unconditionally include in API requests. By default, fields with
  642. // empty values are omitted from API requests. However, any non-pointer,
  643. // non-interface field appearing in ForceSendFields will be sent to the
  644. // server regardless of whether the field is empty or not. This may be
  645. // used to include empty fields in Patch requests.
  646. ForceSendFields []string `json:"-"`
  647. // NullFields is a list of field names (e.g. "Filter") to include in API
  648. // requests with the JSON null value. By default, fields with empty
  649. // values are omitted from API requests. However, any field with an
  650. // empty value appearing in NullFields will be sent to the server as
  651. // null. It is an error if a field in this list has a non-empty value.
  652. // This may be used to include null fields in Patch requests.
  653. NullFields []string `json:"-"`
  654. }
  655. func (s *ListLogEntriesRequest) MarshalJSON() ([]byte, error) {
  656. type NoMethod ListLogEntriesRequest
  657. raw := NoMethod(*s)
  658. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  659. }
  660. // ListLogEntriesResponse: Result returned from ListLogEntries.
  661. type ListLogEntriesResponse struct {
  662. // Entries: A list of log entries. If entries is empty, nextPageToken
  663. // may still be returned, indicating that more entries may exist. See
  664. // nextPageToken for more information.
  665. Entries []*LogEntry `json:"entries,omitempty"`
  666. // NextPageToken: If there might be more results than those appearing in
  667. // this response, then nextPageToken is included. To get the next set of
  668. // results, call this method again using the value of nextPageToken as
  669. // pageToken.If a value for next_page_token appears and the entries
  670. // field is empty, it means that the search found no log entries so far
  671. // but it did not have time to search all the possible log entries.
  672. // Retry the method with this value for page_token to continue the
  673. // search. Alternatively, consider speeding up the search by changing
  674. // your filter to specify a single log name or resource type, or to
  675. // narrow the time range of the search.
  676. NextPageToken string `json:"nextPageToken,omitempty"`
  677. // ServerResponse contains the HTTP response code and headers from the
  678. // server.
  679. googleapi.ServerResponse `json:"-"`
  680. // ForceSendFields is a list of field names (e.g. "Entries") to
  681. // unconditionally include in API requests. By default, fields with
  682. // empty values are omitted from API requests. However, any non-pointer,
  683. // non-interface field appearing in ForceSendFields will be sent to the
  684. // server regardless of whether the field is empty or not. This may be
  685. // used to include empty fields in Patch requests.
  686. ForceSendFields []string `json:"-"`
  687. // NullFields is a list of field names (e.g. "Entries") to include in
  688. // API requests with the JSON null value. By default, fields with empty
  689. // values are omitted from API requests. However, any field with an
  690. // empty value appearing in NullFields will be sent to the server as
  691. // null. It is an error if a field in this list has a non-empty value.
  692. // This may be used to include null fields in Patch requests.
  693. NullFields []string `json:"-"`
  694. }
  695. func (s *ListLogEntriesResponse) MarshalJSON() ([]byte, error) {
  696. type NoMethod ListLogEntriesResponse
  697. raw := NoMethod(*s)
  698. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  699. }
  700. // ListLogMetricsResponse: Result returned from ListLogMetrics.
  701. type ListLogMetricsResponse struct {
  702. // Metrics: A list of logs-based metrics.
  703. Metrics []*LogMetric `json:"metrics,omitempty"`
  704. // NextPageToken: If there might be more results than appear in this
  705. // response, then nextPageToken is included. To get the next set of
  706. // results, call this method again using the value of nextPageToken as
  707. // pageToken.
  708. NextPageToken string `json:"nextPageToken,omitempty"`
  709. // ServerResponse contains the HTTP response code and headers from the
  710. // server.
  711. googleapi.ServerResponse `json:"-"`
  712. // ForceSendFields is a list of field names (e.g. "Metrics") to
  713. // unconditionally include in API requests. By default, fields with
  714. // empty values are omitted from API requests. However, any non-pointer,
  715. // non-interface field appearing in ForceSendFields will be sent to the
  716. // server regardless of whether the field is empty or not. This may be
  717. // used to include empty fields in Patch requests.
  718. ForceSendFields []string `json:"-"`
  719. // NullFields is a list of field names (e.g. "Metrics") to include in
  720. // API requests with the JSON null value. By default, fields with empty
  721. // values are omitted from API requests. However, any field with an
  722. // empty value appearing in NullFields will be sent to the server as
  723. // null. It is an error if a field in this list has a non-empty value.
  724. // This may be used to include null fields in Patch requests.
  725. NullFields []string `json:"-"`
  726. }
  727. func (s *ListLogMetricsResponse) MarshalJSON() ([]byte, error) {
  728. type NoMethod ListLogMetricsResponse
  729. raw := NoMethod(*s)
  730. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  731. }
  732. // ListLogsResponse: Result returned from ListLogs.
  733. type ListLogsResponse struct {
  734. // LogNames: A list of log names. For example,
  735. // "projects/my-project/syslog" or
  736. // "organizations/123/cloudresourcemanager.googleapis.com%2Factivity".
  737. LogNames []string `json:"logNames,omitempty"`
  738. // NextPageToken: If there might be more results than those appearing in
  739. // this response, then nextPageToken is included. To get the next set of
  740. // results, call this method again using the value of nextPageToken as
  741. // pageToken.
  742. NextPageToken string `json:"nextPageToken,omitempty"`
  743. // ServerResponse contains the HTTP response code and headers from the
  744. // server.
  745. googleapi.ServerResponse `json:"-"`
  746. // ForceSendFields is a list of field names (e.g. "LogNames") to
  747. // unconditionally include in API requests. By default, fields with
  748. // empty values are omitted from API requests. However, any non-pointer,
  749. // non-interface field appearing in ForceSendFields will be sent to the
  750. // server regardless of whether the field is empty or not. This may be
  751. // used to include empty fields in Patch requests.
  752. ForceSendFields []string `json:"-"`
  753. // NullFields is a list of field names (e.g. "LogNames") to include in
  754. // API requests with the JSON null value. By default, fields with empty
  755. // values are omitted from API requests. However, any field with an
  756. // empty value appearing in NullFields will be sent to the server as
  757. // null. It is an error if a field in this list has a non-empty value.
  758. // This may be used to include null fields in Patch requests.
  759. NullFields []string `json:"-"`
  760. }
  761. func (s *ListLogsResponse) MarshalJSON() ([]byte, error) {
  762. type NoMethod ListLogsResponse
  763. raw := NoMethod(*s)
  764. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  765. }
  766. // ListMonitoredResourceDescriptorsResponse: Result returned from
  767. // ListMonitoredResourceDescriptors.
  768. type ListMonitoredResourceDescriptorsResponse struct {
  769. // NextPageToken: If there might be more results than those appearing in
  770. // this response, then nextPageToken is included. To get the next set of
  771. // results, call this method again using the value of nextPageToken as
  772. // pageToken.
  773. NextPageToken string `json:"nextPageToken,omitempty"`
  774. // ResourceDescriptors: A list of resource descriptors.
  775. ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"`
  776. // ServerResponse contains the HTTP response code and headers from the
  777. // server.
  778. googleapi.ServerResponse `json:"-"`
  779. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  780. // unconditionally include in API requests. By default, fields with
  781. // empty values are omitted from API requests. However, any non-pointer,
  782. // non-interface field appearing in ForceSendFields will be sent to the
  783. // server regardless of whether the field is empty or not. This may be
  784. // used to include empty fields in Patch requests.
  785. ForceSendFields []string `json:"-"`
  786. // NullFields is a list of field names (e.g. "NextPageToken") to include
  787. // in API requests with the JSON null value. By default, fields with
  788. // empty values are omitted from API requests. However, any field with
  789. // an empty value appearing in NullFields will be sent to the server as
  790. // null. It is an error if a field in this list has a non-empty value.
  791. // This may be used to include null fields in Patch requests.
  792. NullFields []string `json:"-"`
  793. }
  794. func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) {
  795. type NoMethod ListMonitoredResourceDescriptorsResponse
  796. raw := NoMethod(*s)
  797. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  798. }
  799. // ListSinksResponse: Result returned from ListSinks.
  800. type ListSinksResponse struct {
  801. // NextPageToken: If there might be more results than appear in this
  802. // response, then nextPageToken is included. To get the next set of
  803. // results, call the same method again using the value of nextPageToken
  804. // as pageToken.
  805. NextPageToken string `json:"nextPageToken,omitempty"`
  806. // Sinks: A list of sinks.
  807. Sinks []*LogSink `json:"sinks,omitempty"`
  808. // ServerResponse contains the HTTP response code and headers from the
  809. // server.
  810. googleapi.ServerResponse `json:"-"`
  811. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  812. // unconditionally include in API requests. By default, fields with
  813. // empty values are omitted from API requests. However, any non-pointer,
  814. // non-interface field appearing in ForceSendFields will be sent to the
  815. // server regardless of whether the field is empty or not. This may be
  816. // used to include empty fields in Patch requests.
  817. ForceSendFields []string `json:"-"`
  818. // NullFields is a list of field names (e.g. "NextPageToken") to include
  819. // in API requests with the JSON null value. By default, fields with
  820. // empty values are omitted from API requests. However, any field with
  821. // an empty value appearing in NullFields will be sent to the server as
  822. // null. It is an error if a field in this list has a non-empty value.
  823. // This may be used to include null fields in Patch requests.
  824. NullFields []string `json:"-"`
  825. }
  826. func (s *ListSinksResponse) MarshalJSON() ([]byte, error) {
  827. type NoMethod ListSinksResponse
  828. raw := NoMethod(*s)
  829. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  830. }
  831. // LogEntry: An individual entry in a log.
  832. type LogEntry struct {
  833. // HttpRequest: Optional. Information about the HTTP request associated
  834. // with this log entry, if applicable.
  835. HttpRequest *HttpRequest `json:"httpRequest,omitempty"`
  836. // InsertId: Optional. A unique identifier for the log entry. If you
  837. // provide a value, then Stackdriver Logging considers other log entries
  838. // in the same project, with the same timestamp, and with the same
  839. // insert_id to be duplicates which can be removed. If omitted in new
  840. // log entries, then Stackdriver Logging assigns its own unique
  841. // identifier. The insert_id is also used to order log entries that have
  842. // the same timestamp value.
  843. InsertId string `json:"insertId,omitempty"`
  844. // JsonPayload: The log entry payload, represented as a structure that
  845. // is expressed as a JSON object.
  846. JsonPayload googleapi.RawMessage `json:"jsonPayload,omitempty"`
  847. // Labels: Optional. A set of user-defined (key, value) data that
  848. // provides additional information about the log entry.
  849. Labels map[string]string `json:"labels,omitempty"`
  850. // LogName: Required. The resource name of the log to which this log
  851. // entry
  852. // belongs:
  853. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  854. // "organizations/[ORGANIZ
  855. // ATION_ID]/logs/[LOG_ID]"
  856. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[L
  857. // OG_ID]"
  858. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  859. // A project number may optionally be used in place of PROJECT_ID. The
  860. // project number is translated to its corresponding PROJECT_ID
  861. // internally and the log_name field will contain PROJECT_ID in queries
  862. // and exports.[LOG_ID] must be URL-encoded within log_name. Example:
  863. // "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Fa
  864. // ctivity". [LOG_ID] must be less than 512 characters long and can only
  865. // include the following characters: upper and lower case alphanumeric
  866. // characters, forward-slash, underscore, hyphen, and period.For
  867. // backward compatibility, if log_name begins with a forward-slash, such
  868. // as /projects/..., then the log entry is ingested as usual but the
  869. // forward-slash is removed. Listing the log entry will not show the
  870. // leading slash and filtering for a log name with a leading slash will
  871. // never return any results.
  872. LogName string `json:"logName,omitempty"`
  873. // Metadata: Output only. Additional metadata about the monitored
  874. // resource. Only k8s_container, k8s_pod, and k8s_node
  875. // MonitoredResources have this field populated.
  876. Metadata *MonitoredResourceMetadata `json:"metadata,omitempty"`
  877. // Operation: Optional. Information about an operation associated with
  878. // the log entry, if applicable.
  879. Operation *LogEntryOperation `json:"operation,omitempty"`
  880. // ProtoPayload: The log entry payload, represented as a protocol
  881. // buffer. Some Google Cloud Platform services use this field for their
  882. // log entry payloads.
  883. ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"`
  884. // ReceiveTimestamp: Output only. The time the log entry was received by
  885. // Stackdriver Logging.
  886. ReceiveTimestamp string `json:"receiveTimestamp,omitempty"`
  887. // Resource: Required. The primary monitored resource associated with
  888. // this log entry. Example: a log entry that reports a database error
  889. // would be associated with the monitored resource designating the
  890. // particular database that reported the error.
  891. Resource *MonitoredResource `json:"resource,omitempty"`
  892. // Severity: Optional. The severity of the log entry. The default value
  893. // is LogSeverity.DEFAULT.
  894. //
  895. // Possible values:
  896. // "DEFAULT" - (0) The log entry has no assigned severity level.
  897. // "DEBUG" - (100) Debug or trace information.
  898. // "INFO" - (200) Routine information, such as ongoing status or
  899. // performance.
  900. // "NOTICE" - (300) Normal but significant events, such as start up,
  901. // shut down, or a configuration change.
  902. // "WARNING" - (400) Warning events might cause problems.
  903. // "ERROR" - (500) Error events are likely to cause problems.
  904. // "CRITICAL" - (600) Critical events cause more severe problems or
  905. // outages.
  906. // "ALERT" - (700) A person must take an action immediately.
  907. // "EMERGENCY" - (800) One or more systems are unusable.
  908. Severity string `json:"severity,omitempty"`
  909. // SourceLocation: Optional. Source code location information associated
  910. // with the log entry, if any.
  911. SourceLocation *LogEntrySourceLocation `json:"sourceLocation,omitempty"`
  912. // SpanId: Optional. The span ID within the trace associated with the
  913. // log entry. For Stackdriver Trace spans, this is the same format that
  914. // the Stackdriver Trace API v2 uses: a 16-character hexadecimal
  915. // encoding of an 8-byte array, such as <code>"000000000000004a"</code>.
  916. SpanId string `json:"spanId,omitempty"`
  917. // TextPayload: The log entry payload, represented as a Unicode string
  918. // (UTF-8).
  919. TextPayload string `json:"textPayload,omitempty"`
  920. // Timestamp: Optional. The time the event described by the log entry
  921. // occurred. This time is used to compute the log entry's age and to
  922. // enforce the logs retention period. If this field is omitted in a new
  923. // log entry, then Stackdriver Logging assigns it the current time.
  924. // Timestamps have nanosecond accuracy, but trailing zeros in the
  925. // fractional seconds might be omitted when the timestamp is
  926. // displayed.Incoming log entries should have timestamps that are no
  927. // more than the logs retention period in the past, and no more than 24
  928. // hours in the future. Log entries outside those time boundaries will
  929. // not be available when calling entries.list, but those log entries can
  930. // still be exported with LogSinks.
  931. Timestamp string `json:"timestamp,omitempty"`
  932. // Trace: Optional. Resource name of the trace associated with the log
  933. // entry, if any. If it contains a relative resource name, the name is
  934. // assumed to be relative to //tracing.googleapis.com. Example:
  935. // projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824
  936. Trace string `json:"trace,omitempty"`
  937. // ForceSendFields is a list of field names (e.g. "HttpRequest") to
  938. // unconditionally include in API requests. By default, fields with
  939. // empty values are omitted from API requests. However, any non-pointer,
  940. // non-interface field appearing in ForceSendFields will be sent to the
  941. // server regardless of whether the field is empty or not. This may be
  942. // used to include empty fields in Patch requests.
  943. ForceSendFields []string `json:"-"`
  944. // NullFields is a list of field names (e.g. "HttpRequest") to include
  945. // in API requests with the JSON null value. By default, fields with
  946. // empty values are omitted from API requests. However, any field with
  947. // an empty value appearing in NullFields will be sent to the server as
  948. // null. It is an error if a field in this list has a non-empty value.
  949. // This may be used to include null fields in Patch requests.
  950. NullFields []string `json:"-"`
  951. }
  952. func (s *LogEntry) MarshalJSON() ([]byte, error) {
  953. type NoMethod LogEntry
  954. raw := NoMethod(*s)
  955. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  956. }
  957. // LogEntryOperation: Additional information about a potentially
  958. // long-running operation with which a log entry is associated.
  959. type LogEntryOperation struct {
  960. // First: Optional. Set this to True if this is the first log entry in
  961. // the operation.
  962. First bool `json:"first,omitempty"`
  963. // Id: Optional. An arbitrary operation identifier. Log entries with the
  964. // same identifier are assumed to be part of the same operation.
  965. Id string `json:"id,omitempty"`
  966. // Last: Optional. Set this to True if this is the last log entry in the
  967. // operation.
  968. Last bool `json:"last,omitempty"`
  969. // Producer: Optional. An arbitrary producer identifier. The combination
  970. // of id and producer must be globally unique. Examples for producer:
  971. // "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication".
  972. Producer string `json:"producer,omitempty"`
  973. // ForceSendFields is a list of field names (e.g. "First") to
  974. // unconditionally include in API requests. By default, fields with
  975. // empty values are omitted from API requests. However, any non-pointer,
  976. // non-interface field appearing in ForceSendFields will be sent to the
  977. // server regardless of whether the field is empty or not. This may be
  978. // used to include empty fields in Patch requests.
  979. ForceSendFields []string `json:"-"`
  980. // NullFields is a list of field names (e.g. "First") to include in API
  981. // requests with the JSON null value. By default, fields with empty
  982. // values are omitted from API requests. However, any field with an
  983. // empty value appearing in NullFields will be sent to the server as
  984. // null. It is an error if a field in this list has a non-empty value.
  985. // This may be used to include null fields in Patch requests.
  986. NullFields []string `json:"-"`
  987. }
  988. func (s *LogEntryOperation) MarshalJSON() ([]byte, error) {
  989. type NoMethod LogEntryOperation
  990. raw := NoMethod(*s)
  991. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  992. }
  993. // LogEntrySourceLocation: Additional information about the source code
  994. // location that produced the log entry.
  995. type LogEntrySourceLocation struct {
  996. // File: Optional. Source file name. Depending on the runtime
  997. // environment, this might be a simple name or a fully-qualified name.
  998. File string `json:"file,omitempty"`
  999. // Function: Optional. Human-readable name of the function or method
  1000. // being invoked, with optional context such as the class or package
  1001. // name. This information may be used in contexts such as the logs
  1002. // viewer, where a file and line number are less meaningful. The format
  1003. // can vary by language. For example: qual.if.ied.Class.method (Java),
  1004. // dir/package.func (Go), function (Python).
  1005. Function string `json:"function,omitempty"`
  1006. // Line: Optional. Line within the source file. 1-based; 0 indicates no
  1007. // line number available.
  1008. Line int64 `json:"line,omitempty,string"`
  1009. // ForceSendFields is a list of field names (e.g. "File") to
  1010. // unconditionally include in API requests. By default, fields with
  1011. // empty values are omitted from API requests. However, any non-pointer,
  1012. // non-interface field appearing in ForceSendFields will be sent to the
  1013. // server regardless of whether the field is empty or not. This may be
  1014. // used to include empty fields in Patch requests.
  1015. ForceSendFields []string `json:"-"`
  1016. // NullFields is a list of field names (e.g. "File") to include in API
  1017. // requests with the JSON null value. By default, fields with empty
  1018. // values are omitted from API requests. However, any field with an
  1019. // empty value appearing in NullFields will be sent to the server as
  1020. // null. It is an error if a field in this list has a non-empty value.
  1021. // This may be used to include null fields in Patch requests.
  1022. NullFields []string `json:"-"`
  1023. }
  1024. func (s *LogEntrySourceLocation) MarshalJSON() ([]byte, error) {
  1025. type NoMethod LogEntrySourceLocation
  1026. raw := NoMethod(*s)
  1027. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1028. }
  1029. // LogExclusion: Specifies a set of log entries that are not to be
  1030. // stored in Stackdriver Logging. If your project receives a large
  1031. // volume of logs, you might be able to use exclusions to reduce your
  1032. // chargeable logs. Exclusions are processed after log sinks, so you can
  1033. // export log entries before they are excluded. Audit log entries and
  1034. // log entries from Amazon Web Services are never excluded.
  1035. type LogExclusion struct {
  1036. // Description: Optional. A description of this exclusion.
  1037. Description string `json:"description,omitempty"`
  1038. // Disabled: Optional. If set to True, then this exclusion is disabled
  1039. // and it does not exclude any log entries. You can use exclusions.patch
  1040. // to change the value of this field.
  1041. Disabled bool `json:"disabled,omitempty"`
  1042. // Filter: Required. An advanced logs filter that matches the log
  1043. // entries to be excluded. By using the sample function, you can exclude
  1044. // less than 100% of the matching log entries. For example, the
  1045. // following filter matches 99% of low-severity log entries from load
  1046. // balancers:"resource.type=http_load_balancer severity<ERROR
  1047. // sample(insertId, 0.99)"
  1048. Filter string `json:"filter,omitempty"`
  1049. // Name: Required. A client-assigned identifier, such as
  1050. // "load-balancer-exclusion". Identifiers are limited to 100 characters
  1051. // and can include only letters, digits, underscores, hyphens, and
  1052. // periods.
  1053. Name string `json:"name,omitempty"`
  1054. // ServerResponse contains the HTTP response code and headers from the
  1055. // server.
  1056. googleapi.ServerResponse `json:"-"`
  1057. // ForceSendFields is a list of field names (e.g. "Description") to
  1058. // unconditionally include in API requests. By default, fields with
  1059. // empty values are omitted from API requests. However, any non-pointer,
  1060. // non-interface field appearing in ForceSendFields will be sent to the
  1061. // server regardless of whether the field is empty or not. This may be
  1062. // used to include empty fields in Patch requests.
  1063. ForceSendFields []string `json:"-"`
  1064. // NullFields is a list of field names (e.g. "Description") to include
  1065. // in API requests with the JSON null value. By default, fields with
  1066. // empty values are omitted from API requests. However, any field with
  1067. // an empty value appearing in NullFields will be sent to the server as
  1068. // null. It is an error if a field in this list has a non-empty value.
  1069. // This may be used to include null fields in Patch requests.
  1070. NullFields []string `json:"-"`
  1071. }
  1072. func (s *LogExclusion) MarshalJSON() ([]byte, error) {
  1073. type NoMethod LogExclusion
  1074. raw := NoMethod(*s)
  1075. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1076. }
  1077. // LogLine: Application log line emitted while processing a request.
  1078. type LogLine struct {
  1079. // LogMessage: App-provided log message.
  1080. LogMessage string `json:"logMessage,omitempty"`
  1081. // Severity: Severity of this log entry.
  1082. //
  1083. // Possible values:
  1084. // "DEFAULT" - (0) The log entry has no assigned severity level.
  1085. // "DEBUG" - (100) Debug or trace information.
  1086. // "INFO" - (200) Routine information, such as ongoing status or
  1087. // performance.
  1088. // "NOTICE" - (300) Normal but significant events, such as start up,
  1089. // shut down, or a configuration change.
  1090. // "WARNING" - (400) Warning events might cause problems.
  1091. // "ERROR" - (500) Error events are likely to cause problems.
  1092. // "CRITICAL" - (600) Critical events cause more severe problems or
  1093. // outages.
  1094. // "ALERT" - (700) A person must take an action immediately.
  1095. // "EMERGENCY" - (800) One or more systems are unusable.
  1096. Severity string `json:"severity,omitempty"`
  1097. // SourceLocation: Where in the source code this log message was
  1098. // written.
  1099. SourceLocation *SourceLocation `json:"sourceLocation,omitempty"`
  1100. // Time: Approximate time when this log entry was made.
  1101. Time string `json:"time,omitempty"`
  1102. // ForceSendFields is a list of field names (e.g. "LogMessage") to
  1103. // unconditionally include in API requests. By default, fields with
  1104. // empty values are omitted from API requests. However, any non-pointer,
  1105. // non-interface field appearing in ForceSendFields will be sent to the
  1106. // server regardless of whether the field is empty or not. This may be
  1107. // used to include empty fields in Patch requests.
  1108. ForceSendFields []string `json:"-"`
  1109. // NullFields is a list of field names (e.g. "LogMessage") to include in
  1110. // API requests with the JSON null value. By default, fields with empty
  1111. // values are omitted from API requests. However, any field with an
  1112. // empty value appearing in NullFields will be sent to the server as
  1113. // null. It is an error if a field in this list has a non-empty value.
  1114. // This may be used to include null fields in Patch requests.
  1115. NullFields []string `json:"-"`
  1116. }
  1117. func (s *LogLine) MarshalJSON() ([]byte, error) {
  1118. type NoMethod LogLine
  1119. raw := NoMethod(*s)
  1120. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1121. }
  1122. // LogMetric: Describes a logs-based metric. The value of the metric is
  1123. // the number of log entries that match a logs filter in a given time
  1124. // interval.Logs-based metric can also be used to extract values from
  1125. // logs and create a a distribution of the values. The distribution
  1126. // records the statistics of the extracted values along with an optional
  1127. // histogram of the values as specified by the bucket options.
  1128. type LogMetric struct {
  1129. // BucketOptions: Optional. The bucket_options are required when the
  1130. // logs-based metric is using a DISTRIBUTION value type and it describes
  1131. // the bucket boundaries used to create a histogram of the extracted
  1132. // values.
  1133. BucketOptions *BucketOptions `json:"bucketOptions,omitempty"`
  1134. // Description: Optional. A description of this metric, which is used in
  1135. // documentation.
  1136. Description string `json:"description,omitempty"`
  1137. // Filter: Required. An advanced logs filter which is used to match log
  1138. // entries. Example:
  1139. // "resource.type=gae_app AND severity>=ERROR"
  1140. // The maximum length of the filter is 20000 characters.
  1141. Filter string `json:"filter,omitempty"`
  1142. // LabelExtractors: Optional. A map from a label key string to an
  1143. // extractor expression which is used to extract data from a log entry
  1144. // field and assign as the label value. Each label key specified in the
  1145. // LabelDescriptor must have an associated extractor expression in this
  1146. // map. The syntax of the extractor expression is the same as for the
  1147. // value_extractor field.The extracted value is converted to the type
  1148. // defined in the label descriptor. If the either the extraction or the
  1149. // type conversion fails, the label will have a default value. The
  1150. // default value for a string label is an empty string, for an integer
  1151. // label its 0, and for a boolean label its false.Note that there are
  1152. // upper bounds on the maximum number of labels and the number of active
  1153. // time series that are allowed in a project.
  1154. LabelExtractors map[string]string `json:"labelExtractors,omitempty"`
  1155. // MetricDescriptor: Optional. The metric descriptor associated with the
  1156. // logs-based metric. If unspecified, it uses a default metric
  1157. // descriptor with a DELTA metric kind, INT64 value type, with no labels
  1158. // and a unit of "1". Such a metric counts the number of log entries
  1159. // matching the filter expression.The name, type, and description fields
  1160. // in the metric_descriptor are output only, and is constructed using
  1161. // the name and description field in the LogMetric.To create a
  1162. // logs-based metric that records a distribution of log values, a DELTA
  1163. // metric kind with a DISTRIBUTION value type must be used along with a
  1164. // value_extractor expression in the LogMetric.Each label in the metric
  1165. // descriptor must have a matching label name as the key and an
  1166. // extractor expression as the value in the label_extractors map.The
  1167. // metric_kind and value_type fields in the metric_descriptor cannot be
  1168. // updated once initially configured. New labels can be added in the
  1169. // metric_descriptor, but existing labels cannot be modified except for
  1170. // their description.
  1171. MetricDescriptor *MetricDescriptor `json:"metricDescriptor,omitempty"`
  1172. // Name: Required. The client-assigned metric identifier. Examples:
  1173. // "error_count", "nginx/requests".Metric identifiers are limited to 100
  1174. // characters and can include only the following characters: A-Z, a-z,
  1175. // 0-9, and the special characters _-.,+!*',()%/. The forward-slash
  1176. // character (/) denotes a hierarchy of name pieces, and it cannot be
  1177. // the first character of the name.The metric identifier in this field
  1178. // must not be URL-encoded
  1179. // (https://en.wikipedia.org/wiki/Percent-encoding). However, when the
  1180. // metric identifier appears as the [METRIC_ID] part of a metric_name
  1181. // API parameter, then the metric identifier must be URL-encoded.
  1182. // Example: "projects/my-project/metrics/nginx%2Frequests".
  1183. Name string `json:"name,omitempty"`
  1184. // ValueExtractor: Optional. A value_extractor is required when using a
  1185. // distribution logs-based metric to extract the values to record from a
  1186. // log entry. Two functions are supported for value extraction:
  1187. // EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are: 1.
  1188. // field: The name of the log entry field from which the value is to be
  1189. // extracted. 2. regex: A regular expression using the Google RE2
  1190. // syntax (https://github.com/google/re2/wiki/Syntax) with a single
  1191. // capture group to extract data from the specified log entry field.
  1192. // The value of the field is converted to a string before applying the
  1193. // regex. It is an error to specify a regex that does not include
  1194. // exactly one capture group.The result of the extraction must be
  1195. // convertible to a double type, as the distribution always records
  1196. // double values. If either the extraction or the conversion to double
  1197. // fails, then those values are not recorded in the
  1198. // distribution.Example: REGEXP_EXTRACT(jsonPayload.request,
  1199. // ".*quantity=(\d+).*")
  1200. ValueExtractor string `json:"valueExtractor,omitempty"`
  1201. // Version: Deprecated. The API version that created or updated this
  1202. // metric. The v2 format is used by default and cannot be changed.
  1203. //
  1204. // Possible values:
  1205. // "V2" - Stackdriver Logging API v2.
  1206. // "V1" - Stackdriver Logging API v1.
  1207. Version string `json:"version,omitempty"`
  1208. // ServerResponse contains the HTTP response code and headers from the
  1209. // server.
  1210. googleapi.ServerResponse `json:"-"`
  1211. // ForceSendFields is a list of field names (e.g. "BucketOptions") to
  1212. // unconditionally include in API requests. By default, fields with
  1213. // empty values are omitted from API requests. However, any non-pointer,
  1214. // non-interface field appearing in ForceSendFields will be sent to the
  1215. // server regardless of whether the field is empty or not. This may be
  1216. // used to include empty fields in Patch requests.
  1217. ForceSendFields []string `json:"-"`
  1218. // NullFields is a list of field names (e.g. "BucketOptions") to include
  1219. // in API requests with the JSON null value. By default, fields with
  1220. // empty values are omitted from API requests. However, any field with
  1221. // an empty value appearing in NullFields will be sent to the server as
  1222. // null. It is an error if a field in this list has a non-empty value.
  1223. // This may be used to include null fields in Patch requests.
  1224. NullFields []string `json:"-"`
  1225. }
  1226. func (s *LogMetric) MarshalJSON() ([]byte, error) {
  1227. type NoMethod LogMetric
  1228. raw := NoMethod(*s)
  1229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1230. }
  1231. // LogSink: Describes a sink used to export log entries to one of the
  1232. // following destinations in any project: a Cloud Storage bucket, a
  1233. // BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter controls
  1234. // which log entries are exported. The sink must be created within a
  1235. // project, organization, billing account, or folder.
  1236. type LogSink struct {
  1237. // Destination: Required. The export
  1238. // destination:
  1239. // "storage.googleapis.com/[GCS_BUCKET]"
  1240. // "bigquery.googleapi
  1241. // s.com/projects/[PROJECT_ID]/datasets/[DATASET]"
  1242. // "pubsub.googleapis.com
  1243. // /projects/[PROJECT_ID]/topics/[TOPIC_ID]"
  1244. // The sink's writer_identity, set when the sink is created, must have
  1245. // permission to write to the destination or else the log entries are
  1246. // not exported. For more information, see Exporting Logs With Sinks.
  1247. Destination string `json:"destination,omitempty"`
  1248. // EndTime: Deprecated. This field is ignored when creating or updating
  1249. // sinks.
  1250. EndTime string `json:"endTime,omitempty"`
  1251. // Filter: Optional. An advanced logs filter. The only exported log
  1252. // entries are those that are in the resource owning the sink and that
  1253. // match the filter. For
  1254. // example:
  1255. // logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR
  1256. //
  1257. Filter string `json:"filter,omitempty"`
  1258. // IncludeChildren: Optional. This field applies only to sinks owned by
  1259. // organizations and folders. If the field is false, the default, only
  1260. // the logs owned by the sink's parent resource are available for
  1261. // export. If the field is true, then logs from all the projects,
  1262. // folders, and billing accounts contained in the sink's parent resource
  1263. // are also available for export. Whether a particular log entry from
  1264. // the children is exported depends on the sink's filter expression. For
  1265. // example, if this field is true, then the filter
  1266. // resource.type=gce_instance would export all Compute Engine VM
  1267. // instance log entries from all projects in the sink's parent. To only
  1268. // export entries from certain child projects, filter on the project
  1269. // part of the log name:
  1270. // logName:("projects/test-project1/" OR "projects/test-project2/")
  1271. // AND
  1272. // resource.type=gce_instance
  1273. //
  1274. IncludeChildren bool `json:"includeChildren,omitempty"`
  1275. // Name: Required. The client-assigned sink identifier, unique within
  1276. // the project. Example: "my-syslog-errors-to-pubsub". Sink identifiers
  1277. // are limited to 100 characters and can include only the following
  1278. // characters: upper and lower-case alphanumeric characters,
  1279. // underscores, hyphens, and periods.
  1280. Name string `json:"name,omitempty"`
  1281. // OutputVersionFormat: Deprecated. The log entry format to use for this
  1282. // sink's exported log entries. The v2 format is used by default and
  1283. // cannot be changed.
  1284. //
  1285. // Possible values:
  1286. // "VERSION_FORMAT_UNSPECIFIED" - An unspecified format version that
  1287. // will default to V2.
  1288. // "V2" - LogEntry version 2 format.
  1289. // "V1" - LogEntry version 1 format.
  1290. OutputVersionFormat string `json:"outputVersionFormat,omitempty"`
  1291. // StartTime: Deprecated. This field is ignored when creating or
  1292. // updating sinks.
  1293. StartTime string `json:"startTime,omitempty"`
  1294. // WriterIdentity: Output only. An IAM identity&mdash;a service account
  1295. // or group&mdash;under which Stackdriver Logging writes the exported
  1296. // log entries to the sink's destination. This field is set by
  1297. // sinks.create and sinks.update, based on the setting of
  1298. // unique_writer_identity in those methods.Until you grant this identity
  1299. // write-access to the destination, log entry exports from this sink
  1300. // will fail. For more information, see Granting access for a resource.
  1301. // Consult the destination service's documentation to determine the
  1302. // appropriate IAM roles to assign to the identity.
  1303. WriterIdentity string `json:"writerIdentity,omitempty"`
  1304. // ServerResponse contains the HTTP response code and headers from the
  1305. // server.
  1306. googleapi.ServerResponse `json:"-"`
  1307. // ForceSendFields is a list of field names (e.g. "Destination") to
  1308. // unconditionally include in API requests. By default, fields with
  1309. // empty values are omitted from API requests. However, any non-pointer,
  1310. // non-interface field appearing in ForceSendFields will be sent to the
  1311. // server regardless of whether the field is empty or not. This may be
  1312. // used to include empty fields in Patch requests.
  1313. ForceSendFields []string `json:"-"`
  1314. // NullFields is a list of field names (e.g. "Destination") to include
  1315. // in API requests with the JSON null value. By default, fields with
  1316. // empty values are omitted from API requests. However, any field with
  1317. // an empty value appearing in NullFields will be sent to the server as
  1318. // null. It is an error if a field in this list has a non-empty value.
  1319. // This may be used to include null fields in Patch requests.
  1320. NullFields []string `json:"-"`
  1321. }
  1322. func (s *LogSink) MarshalJSON() ([]byte, error) {
  1323. type NoMethod LogSink
  1324. raw := NoMethod(*s)
  1325. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1326. }
  1327. // MetricDescriptor: Defines a metric type and its schema. Once a metric
  1328. // descriptor is created, deleting or altering it stops data collection
  1329. // and makes the metric type's existing data unusable.
  1330. type MetricDescriptor struct {
  1331. // Description: A detailed description of the metric, which can be used
  1332. // in documentation.
  1333. Description string `json:"description,omitempty"`
  1334. // DisplayName: A concise name for the metric, which can be displayed in
  1335. // user interfaces. Use sentence case without an ending period, for
  1336. // example "Request count". This field is optional but it is recommended
  1337. // to be set for any metrics associated with user-visible concepts, such
  1338. // as Quota.
  1339. DisplayName string `json:"displayName,omitempty"`
  1340. // Labels: The set of labels that can be used to describe a specific
  1341. // instance of this metric type. For example, the
  1342. // appengine.googleapis.com/http/server/response_latencies metric type
  1343. // has a label for the HTTP response code, response_code, so you can
  1344. // look at latencies for successful responses or just for responses that
  1345. // failed.
  1346. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1347. // MetricKind: Whether the metric records instantaneous values, changes
  1348. // to a value, etc. Some combinations of metric_kind and value_type
  1349. // might not be supported.
  1350. //
  1351. // Possible values:
  1352. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  1353. // "GAUGE" - An instantaneous measurement of a value.
  1354. // "DELTA" - The change in a value during a time interval.
  1355. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  1356. // measurements in a time series should have the same start time and
  1357. // increasing end times, until an event resets the cumulative value to
  1358. // zero and sets a new start time for the following points.
  1359. MetricKind string `json:"metricKind,omitempty"`
  1360. // Name: The resource name of the metric descriptor.
  1361. Name string `json:"name,omitempty"`
  1362. // Type: The metric type, including its DNS name prefix. The type is not
  1363. // URL-encoded. All user-defined custom metric types have the DNS name
  1364. // custom.googleapis.com. Metric types should use a natural hierarchical
  1365. // grouping. For
  1366. // example:
  1367. // "custom.googleapis.com/invoice/paid/amount"
  1368. // "appengine.google
  1369. // apis.com/http/server/response_latencies"
  1370. //
  1371. Type string `json:"type,omitempty"`
  1372. // Unit: The unit in which the metric value is reported. It is only
  1373. // applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The
  1374. // supported units are a subset of The Unified Code for Units of Measure
  1375. // (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
  1376. // bit bit
  1377. // By byte
  1378. // s second
  1379. // min minute
  1380. // h hour
  1381. // d dayPrefixes (PREFIX)
  1382. // k kilo (10**3)
  1383. // M mega (10**6)
  1384. // G giga (10**9)
  1385. // T tera (10**12)
  1386. // P peta (10**15)
  1387. // E exa (10**18)
  1388. // Z zetta (10**21)
  1389. // Y yotta (10**24)
  1390. // m milli (10**-3)
  1391. // u micro (10**-6)
  1392. // n nano (10**-9)
  1393. // p pico (10**-12)
  1394. // f femto (10**-15)
  1395. // a atto (10**-18)
  1396. // z zepto (10**-21)
  1397. // y yocto (10**-24)
  1398. // Ki kibi (2**10)
  1399. // Mi mebi (2**20)
  1400. // Gi gibi (2**30)
  1401. // Ti tebi (2**40)GrammarThe grammar also includes these connectors:
  1402. // / division (as an infix operator, e.g. 1/s).
  1403. // . multiplication (as an infix operator, e.g. GBy.d)The grammar for a
  1404. // unit is as follows:
  1405. // Expression = Component { "." Component } { "/" Component }
  1406. // ;
  1407. //
  1408. // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
  1409. // | Annotation
  1410. // | "1"
  1411. // ;
  1412. //
  1413. // Annotation = "{" NAME "}" ;
  1414. // Notes:
  1415. // Annotation is just a comment if it follows a UNIT and is equivalent
  1416. // to 1 if it is used alone. For examples, {requests}/s == 1/s,
  1417. // By{transmitted}/s == By/s.
  1418. // NAME is a sequence of non-blank printable ASCII characters not
  1419. // containing '{' or '}'.
  1420. // 1 represents dimensionless value 1, such as in 1/s.
  1421. // % represents dimensionless value 1/100, and annotates values giving
  1422. // a percentage.
  1423. Unit string `json:"unit,omitempty"`
  1424. // ValueType: Whether the measurement is an integer, a floating-point
  1425. // number, etc. Some combinations of metric_kind and value_type might
  1426. // not be supported.
  1427. //
  1428. // Possible values:
  1429. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  1430. // "BOOL" - The value is a boolean. This value type can be used only
  1431. // if the metric kind is GAUGE.
  1432. // "INT64" - The value is a signed 64-bit integer.
  1433. // "DOUBLE" - The value is a double precision floating point number.
  1434. // "STRING" - The value is a text string. This value type can be used
  1435. // only if the metric kind is GAUGE.
  1436. // "DISTRIBUTION" - The value is a Distribution.
  1437. // "MONEY" - The value is money.
  1438. ValueType string `json:"valueType,omitempty"`
  1439. // ForceSendFields is a list of field names (e.g. "Description") to
  1440. // unconditionally include in API requests. By default, fields with
  1441. // empty values are omitted from API requests. However, any non-pointer,
  1442. // non-interface field appearing in ForceSendFields will be sent to the
  1443. // server regardless of whether the field is empty or not. This may be
  1444. // used to include empty fields in Patch requests.
  1445. ForceSendFields []string `json:"-"`
  1446. // NullFields is a list of field names (e.g. "Description") to include
  1447. // in API requests with the JSON null value. By default, fields with
  1448. // empty values are omitted from API requests. However, any field with
  1449. // an empty value appearing in NullFields will be sent to the server as
  1450. // null. It is an error if a field in this list has a non-empty value.
  1451. // This may be used to include null fields in Patch requests.
  1452. NullFields []string `json:"-"`
  1453. }
  1454. func (s *MetricDescriptor) MarshalJSON() ([]byte, error) {
  1455. type NoMethod MetricDescriptor
  1456. raw := NoMethod(*s)
  1457. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1458. }
  1459. // MonitoredResource: An object representing a resource that can be used
  1460. // for monitoring, logging, billing, or other purposes. Examples include
  1461. // virtual machine instances, databases, and storage devices such as
  1462. // disks. The type field identifies a MonitoredResourceDescriptor object
  1463. // that describes the resource's schema. Information in the labels field
  1464. // identifies the actual resource and its attributes according to the
  1465. // schema. For example, a particular Compute Engine VM instance could be
  1466. // represented by the following object, because the
  1467. // MonitoredResourceDescriptor for "gce_instance" has labels
  1468. // "instance_id" and "zone":
  1469. // { "type": "gce_instance",
  1470. // "labels": { "instance_id": "12345678901234",
  1471. // "zone": "us-central1-a" }}
  1472. //
  1473. type MonitoredResource struct {
  1474. // Labels: Required. Values for all of the labels listed in the
  1475. // associated monitored resource descriptor. For example, Compute Engine
  1476. // VM instances use the labels "project_id", "instance_id", and "zone".
  1477. Labels map[string]string `json:"labels,omitempty"`
  1478. // Type: Required. The monitored resource type. This field must match
  1479. // the type field of a MonitoredResourceDescriptor object. For example,
  1480. // the type of a Compute Engine VM instance is gce_instance.
  1481. Type string `json:"type,omitempty"`
  1482. // ForceSendFields is a list of field names (e.g. "Labels") to
  1483. // unconditionally include in API requests. By default, fields with
  1484. // empty values are omitted from API requests. However, any non-pointer,
  1485. // non-interface field appearing in ForceSendFields will be sent to the
  1486. // server regardless of whether the field is empty or not. This may be
  1487. // used to include empty fields in Patch requests.
  1488. ForceSendFields []string `json:"-"`
  1489. // NullFields is a list of field names (e.g. "Labels") to include in API
  1490. // requests with the JSON null value. By default, fields with empty
  1491. // values are omitted from API requests. However, any field with an
  1492. // empty value appearing in NullFields will be sent to the server as
  1493. // null. It is an error if a field in this list has a non-empty value.
  1494. // This may be used to include null fields in Patch requests.
  1495. NullFields []string `json:"-"`
  1496. }
  1497. func (s *MonitoredResource) MarshalJSON() ([]byte, error) {
  1498. type NoMethod MonitoredResource
  1499. raw := NoMethod(*s)
  1500. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1501. }
  1502. // MonitoredResourceDescriptor: An object that describes the schema of a
  1503. // MonitoredResource object using a type name and a set of labels. For
  1504. // example, the monitored resource descriptor for Google Compute Engine
  1505. // VM instances has a type of "gce_instance" and specifies the use of
  1506. // the labels "instance_id" and "zone" to identify particular VM
  1507. // instances.Different APIs can support different monitored resource
  1508. // types. APIs generally provide a list method that returns the
  1509. // monitored resource descriptors used by the API.
  1510. type MonitoredResourceDescriptor struct {
  1511. // Description: Optional. A detailed description of the monitored
  1512. // resource type that might be used in documentation.
  1513. Description string `json:"description,omitempty"`
  1514. // DisplayName: Optional. A concise name for the monitored resource type
  1515. // that might be displayed in user interfaces. It should be a Title
  1516. // Cased Noun Phrase, without any article or other determiners. For
  1517. // example, "Google Cloud SQL Database".
  1518. DisplayName string `json:"displayName,omitempty"`
  1519. // Labels: Required. A set of labels used to describe instances of this
  1520. // monitored resource type. For example, an individual Google Cloud SQL
  1521. // database is identified by values for the labels "database_id" and
  1522. // "zone".
  1523. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1524. // Name: Optional. The resource name of the monitored resource
  1525. // descriptor:
  1526. // "projects/{project_id}/monitoredResourceDescriptors/{type}" where
  1527. // {type} is the value of the type field in this object and {project_id}
  1528. // is a project ID that provides API-specific context for accessing the
  1529. // type. APIs that do not use project information can use the resource
  1530. // name format "monitoredResourceDescriptors/{type}".
  1531. Name string `json:"name,omitempty"`
  1532. // Type: Required. The monitored resource type. For example, the type
  1533. // "cloudsql_database" represents databases in Google Cloud SQL. The
  1534. // maximum length of this value is 256 characters.
  1535. Type string `json:"type,omitempty"`
  1536. // ForceSendFields is a list of field names (e.g. "Description") to
  1537. // unconditionally include in API requests. By default, fields with
  1538. // empty values are omitted from API requests. However, any non-pointer,
  1539. // non-interface field appearing in ForceSendFields will be sent to the
  1540. // server regardless of whether the field is empty or not. This may be
  1541. // used to include empty fields in Patch requests.
  1542. ForceSendFields []string `json:"-"`
  1543. // NullFields is a list of field names (e.g. "Description") to include
  1544. // in API requests with the JSON null value. By default, fields with
  1545. // empty values are omitted from API requests. However, any field with
  1546. // an empty value appearing in NullFields will be sent to the server as
  1547. // null. It is an error if a field in this list has a non-empty value.
  1548. // This may be used to include null fields in Patch requests.
  1549. NullFields []string `json:"-"`
  1550. }
  1551. func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) {
  1552. type NoMethod MonitoredResourceDescriptor
  1553. raw := NoMethod(*s)
  1554. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1555. }
  1556. // MonitoredResourceMetadata: Auxiliary metadata for a MonitoredResource
  1557. // object. MonitoredResource objects contain the minimum set of
  1558. // information to uniquely identify a monitored resource instance. There
  1559. // is some other useful auxiliary metadata. Google Stackdriver
  1560. // Monitoring & Logging uses an ingestion pipeline to extract metadata
  1561. // for cloud resources of all types , and stores the metadata in this
  1562. // message.
  1563. type MonitoredResourceMetadata struct {
  1564. // SystemLabels: Output only. Values for predefined system metadata
  1565. // labels. System labels are a kind of metadata extracted by Google
  1566. // Stackdriver. Stackdriver determines what system labels are useful and
  1567. // how to obtain their values. Some examples: "machine_image", "vpc",
  1568. // "subnet_id", "security_group", "name", etc. System label values can
  1569. // be only strings, Boolean values, or a list of strings. For example:
  1570. // { "name": "my-test-instance",
  1571. // "security_group": ["a", "b", "c"],
  1572. // "spot_instance": false }
  1573. //
  1574. SystemLabels googleapi.RawMessage `json:"systemLabels,omitempty"`
  1575. // UserLabels: Output only. A map of user-defined metadata labels.
  1576. UserLabels map[string]string `json:"userLabels,omitempty"`
  1577. // ForceSendFields is a list of field names (e.g. "SystemLabels") to
  1578. // unconditionally include in API requests. By default, fields with
  1579. // empty values are omitted from API requests. However, any non-pointer,
  1580. // non-interface field appearing in ForceSendFields will be sent to the
  1581. // server regardless of whether the field is empty or not. This may be
  1582. // used to include empty fields in Patch requests.
  1583. ForceSendFields []string `json:"-"`
  1584. // NullFields is a list of field names (e.g. "SystemLabels") to include
  1585. // in API requests with the JSON null value. By default, fields with
  1586. // empty values are omitted from API requests. However, any field with
  1587. // an empty value appearing in NullFields will be sent to the server as
  1588. // null. It is an error if a field in this list has a non-empty value.
  1589. // This may be used to include null fields in Patch requests.
  1590. NullFields []string `json:"-"`
  1591. }
  1592. func (s *MonitoredResourceMetadata) MarshalJSON() ([]byte, error) {
  1593. type NoMethod MonitoredResourceMetadata
  1594. raw := NoMethod(*s)
  1595. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1596. }
  1597. // RequestLog: Complete log information about a single HTTP request to
  1598. // an App Engine application.
  1599. type RequestLog struct {
  1600. // AppEngineRelease: App Engine release version.
  1601. AppEngineRelease string `json:"appEngineRelease,omitempty"`
  1602. // AppId: Application that handled this request.
  1603. AppId string `json:"appId,omitempty"`
  1604. // Cost: An indication of the relative cost of serving this request.
  1605. Cost float64 `json:"cost,omitempty"`
  1606. // EndTime: Time when the request finished.
  1607. EndTime string `json:"endTime,omitempty"`
  1608. // Finished: Whether this request is finished or active.
  1609. Finished bool `json:"finished,omitempty"`
  1610. // First: Whether this is the first RequestLog entry for this request.
  1611. // If an active request has several RequestLog entries written to
  1612. // Stackdriver Logging, then this field will be set for one of them.
  1613. First bool `json:"first,omitempty"`
  1614. // Host: Internet host and port number of the resource being requested.
  1615. Host string `json:"host,omitempty"`
  1616. // HttpVersion: HTTP version of request. Example: "HTTP/1.1".
  1617. HttpVersion string `json:"httpVersion,omitempty"`
  1618. // InstanceId: An identifier for the instance that handled the request.
  1619. InstanceId string `json:"instanceId,omitempty"`
  1620. // InstanceIndex: If the instance processing this request belongs to a
  1621. // manually scaled module, then this is the 0-based index of the
  1622. // instance. Otherwise, this value is -1.
  1623. InstanceIndex int64 `json:"instanceIndex,omitempty"`
  1624. // Ip: Origin IP address.
  1625. Ip string `json:"ip,omitempty"`
  1626. // Latency: Latency of the request.
  1627. Latency string `json:"latency,omitempty"`
  1628. // Line: A list of log lines emitted by the application while serving
  1629. // this request.
  1630. Line []*LogLine `json:"line,omitempty"`
  1631. // MegaCycles: Number of CPU megacycles used to process request.
  1632. MegaCycles int64 `json:"megaCycles,omitempty,string"`
  1633. // Method: Request method. Example: "GET", "HEAD", "PUT", "POST",
  1634. // "DELETE".
  1635. Method string `json:"method,omitempty"`
  1636. // ModuleId: Module of the application that handled this request.
  1637. ModuleId string `json:"moduleId,omitempty"`
  1638. // Nickname: The logged-in user who made the request.Most likely, this
  1639. // is the part of the user's email before the @ sign. The field value is
  1640. // the same for different requests from the same user, but different
  1641. // users can have similar names. This information is also available to
  1642. // the application via the App Engine Users API.This field will be
  1643. // populated starting with App Engine 1.9.21.
  1644. Nickname string `json:"nickname,omitempty"`
  1645. // PendingTime: Time this request spent in the pending request queue.
  1646. PendingTime string `json:"pendingTime,omitempty"`
  1647. // Referrer: Referrer URL of request.
  1648. Referrer string `json:"referrer,omitempty"`
  1649. // RequestId: Globally unique identifier for a request, which is based
  1650. // on the request start time. Request IDs for requests which started
  1651. // later will compare greater as strings than those for requests which
  1652. // started earlier.
  1653. RequestId string `json:"requestId,omitempty"`
  1654. // Resource: Contains the path and query portion of the URL that was
  1655. // requested. For example, if the URL was
  1656. // "http://example.com/app?name=val", the resource would be
  1657. // "/app?name=val". The fragment identifier, which is identified by the
  1658. // # character, is not included.
  1659. Resource string `json:"resource,omitempty"`
  1660. // ResponseSize: Size in bytes sent back to client by request.
  1661. ResponseSize int64 `json:"responseSize,omitempty,string"`
  1662. // SourceReference: Source code for the application that handled this
  1663. // request. There can be more than one source reference per deployed
  1664. // application if source code is distributed among multiple
  1665. // repositories.
  1666. SourceReference []*SourceReference `json:"sourceReference,omitempty"`
  1667. // StartTime: Time when the request started.
  1668. StartTime string `json:"startTime,omitempty"`
  1669. // Status: HTTP response status code. Example: 200, 404.
  1670. Status int64 `json:"status,omitempty"`
  1671. // TaskName: Task name of the request, in the case of an offline
  1672. // request.
  1673. TaskName string `json:"taskName,omitempty"`
  1674. // TaskQueueName: Queue name of the request, in the case of an offline
  1675. // request.
  1676. TaskQueueName string `json:"taskQueueName,omitempty"`
  1677. // TraceId: Stackdriver Trace identifier for this request.
  1678. TraceId string `json:"traceId,omitempty"`
  1679. // UrlMapEntry: File or class that handled the request.
  1680. UrlMapEntry string `json:"urlMapEntry,omitempty"`
  1681. // UserAgent: User agent that made the request.
  1682. UserAgent string `json:"userAgent,omitempty"`
  1683. // VersionId: Version of the application that handled this request.
  1684. VersionId string `json:"versionId,omitempty"`
  1685. // WasLoadingRequest: Whether this was a loading request for the
  1686. // instance.
  1687. WasLoadingRequest bool `json:"wasLoadingRequest,omitempty"`
  1688. // ForceSendFields is a list of field names (e.g. "AppEngineRelease") to
  1689. // unconditionally include in API requests. By default, fields with
  1690. // empty values are omitted from API requests. However, any non-pointer,
  1691. // non-interface field appearing in ForceSendFields will be sent to the
  1692. // server regardless of whether the field is empty or not. This may be
  1693. // used to include empty fields in Patch requests.
  1694. ForceSendFields []string `json:"-"`
  1695. // NullFields is a list of field names (e.g. "AppEngineRelease") to
  1696. // include in API requests with the JSON null value. By default, fields
  1697. // with empty values are omitted from API requests. However, any field
  1698. // with an empty value appearing in NullFields will be sent to the
  1699. // server as null. It is an error if a field in this list has a
  1700. // non-empty value. This may be used to include null fields in Patch
  1701. // requests.
  1702. NullFields []string `json:"-"`
  1703. }
  1704. func (s *RequestLog) MarshalJSON() ([]byte, error) {
  1705. type NoMethod RequestLog
  1706. raw := NoMethod(*s)
  1707. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1708. }
  1709. func (s *RequestLog) UnmarshalJSON(data []byte) error {
  1710. type NoMethod RequestLog
  1711. var s1 struct {
  1712. Cost gensupport.JSONFloat64 `json:"cost"`
  1713. *NoMethod
  1714. }
  1715. s1.NoMethod = (*NoMethod)(s)
  1716. if err := json.Unmarshal(data, &s1); err != nil {
  1717. return err
  1718. }
  1719. s.Cost = float64(s1.Cost)
  1720. return nil
  1721. }
  1722. // SourceLocation: Specifies a location in a source code file.
  1723. type SourceLocation struct {
  1724. // File: Source file name. Depending on the runtime environment, this
  1725. // might be a simple name or a fully-qualified name.
  1726. File string `json:"file,omitempty"`
  1727. // FunctionName: Human-readable name of the function or method being
  1728. // invoked, with optional context such as the class or package name.
  1729. // This information is used in contexts such as the logs viewer, where a
  1730. // file and line number are less meaningful. The format can vary by
  1731. // language. For example: qual.if.ied.Class.method (Java),
  1732. // dir/package.func (Go), function (Python).
  1733. FunctionName string `json:"functionName,omitempty"`
  1734. // Line: Line within the source file.
  1735. Line int64 `json:"line,omitempty,string"`
  1736. // ForceSendFields is a list of field names (e.g. "File") to
  1737. // unconditionally include in API requests. By default, fields with
  1738. // empty values are omitted from API requests. However, any non-pointer,
  1739. // non-interface field appearing in ForceSendFields will be sent to the
  1740. // server regardless of whether the field is empty or not. This may be
  1741. // used to include empty fields in Patch requests.
  1742. ForceSendFields []string `json:"-"`
  1743. // NullFields is a list of field names (e.g. "File") to include in API
  1744. // requests with the JSON null value. By default, fields with empty
  1745. // values are omitted from API requests. However, any field with an
  1746. // empty value appearing in NullFields will be sent to the server as
  1747. // null. It is an error if a field in this list has a non-empty value.
  1748. // This may be used to include null fields in Patch requests.
  1749. NullFields []string `json:"-"`
  1750. }
  1751. func (s *SourceLocation) MarshalJSON() ([]byte, error) {
  1752. type NoMethod SourceLocation
  1753. raw := NoMethod(*s)
  1754. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1755. }
  1756. // SourceReference: A reference to a particular snapshot of the source
  1757. // tree used to build and deploy an application.
  1758. type SourceReference struct {
  1759. // Repository: Optional. A URI string identifying the repository.
  1760. // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git"
  1761. Repository string `json:"repository,omitempty"`
  1762. // RevisionId: The canonical and persistent identifier of the deployed
  1763. // revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
  1764. RevisionId string `json:"revisionId,omitempty"`
  1765. // ForceSendFields is a list of field names (e.g. "Repository") to
  1766. // unconditionally include in API requests. By default, fields with
  1767. // empty values are omitted from API requests. However, any non-pointer,
  1768. // non-interface field appearing in ForceSendFields will be sent to the
  1769. // server regardless of whether the field is empty or not. This may be
  1770. // used to include empty fields in Patch requests.
  1771. ForceSendFields []string `json:"-"`
  1772. // NullFields is a list of field names (e.g. "Repository") to include in
  1773. // API requests with the JSON null value. By default, fields with empty
  1774. // values are omitted from API requests. However, any field with an
  1775. // empty value appearing in NullFields will be sent to the server as
  1776. // null. It is an error if a field in this list has a non-empty value.
  1777. // This may be used to include null fields in Patch requests.
  1778. NullFields []string `json:"-"`
  1779. }
  1780. func (s *SourceReference) MarshalJSON() ([]byte, error) {
  1781. type NoMethod SourceReference
  1782. raw := NoMethod(*s)
  1783. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1784. }
  1785. // WriteLogEntriesRequest: The parameters to WriteLogEntries.
  1786. type WriteLogEntriesRequest struct {
  1787. // DryRun: Optional. If true, the request should expect normal response,
  1788. // but the entries won't be persisted nor exported. Useful for checking
  1789. // whether the logging API endpoints are working properly before sending
  1790. // valuable data.
  1791. DryRun bool `json:"dryRun,omitempty"`
  1792. // Entries: Required. The log entries to send to Stackdriver Logging.
  1793. // The order of log entries in this list does not matter. Values
  1794. // supplied in this method's log_name, resource, and labels fields are
  1795. // copied into those log entries in this list that do not include values
  1796. // for their corresponding fields. For more information, see the
  1797. // LogEntry type.If the timestamp or insert_id fields are missing in log
  1798. // entries, then this method supplies the current time or a unique
  1799. // identifier, respectively. The supplied values are chosen so that,
  1800. // among the log entries that did not supply their own values, the
  1801. // entries earlier in the list will sort before the entries later in the
  1802. // list. See the entries.list method.Log entries with timestamps that
  1803. // are more than the logs retention period in the past or more than 24
  1804. // hours in the future will not be available when calling entries.list.
  1805. // However, those log entries can still be exported with LogSinks.To
  1806. // improve throughput and to avoid exceeding the quota limit for calls
  1807. // to entries.write, you should try to include several log entries in
  1808. // this list, rather than calling this method for each individual log
  1809. // entry.
  1810. Entries []*LogEntry `json:"entries,omitempty"`
  1811. // Labels: Optional. Default labels that are added to the labels field
  1812. // of all log entries in entries. If a log entry already has a label
  1813. // with the same key as a label in this parameter, then the log entry's
  1814. // label is not changed. See LogEntry.
  1815. Labels map[string]string `json:"labels,omitempty"`
  1816. // LogName: Optional. A default log resource name that is assigned to
  1817. // all log entries in entries that do not specify a value for
  1818. // log_name:
  1819. // "projects/[PROJECT_ID]/logs/[LOG_ID]"
  1820. // "organizations/[ORGANI
  1821. // ZATION_ID]/logs/[LOG_ID]"
  1822. // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[
  1823. // LOG_ID]"
  1824. // "folders/[FOLDER_ID]/logs/[LOG_ID]"
  1825. // [LOG_ID] must be URL-encoded. For example,
  1826. // "projects/my-project-id/logs/syslog" or
  1827. // "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Fa
  1828. // ctivity". For more information about log names, see LogEntry.
  1829. LogName string `json:"logName,omitempty"`
  1830. // PartialSuccess: Optional. Whether valid entries should be written
  1831. // even if some other entries fail due to INVALID_ARGUMENT or
  1832. // PERMISSION_DENIED errors. If any entry is not written, then the
  1833. // response status is the error associated with one of the failed
  1834. // entries and the response includes error details keyed by the entries'
  1835. // zero-based index in the entries.write method.
  1836. PartialSuccess bool `json:"partialSuccess,omitempty"`
  1837. // Resource: Optional. A default monitored resource object that is
  1838. // assigned to all log entries in entries that do not specify a value
  1839. // for resource. Example:
  1840. // { "type": "gce_instance",
  1841. // "labels": {
  1842. // "zone": "us-central1-a", "instance_id": "00000000000000000000"
  1843. // }}
  1844. // See LogEntry.
  1845. Resource *MonitoredResource `json:"resource,omitempty"`
  1846. // ForceSendFields is a list of field names (e.g. "DryRun") to
  1847. // unconditionally include in API requests. By default, fields with
  1848. // empty values are omitted from API requests. However, any non-pointer,
  1849. // non-interface field appearing in ForceSendFields will be sent to the
  1850. // server regardless of whether the field is empty or not. This may be
  1851. // used to include empty fields in Patch requests.
  1852. ForceSendFields []string `json:"-"`
  1853. // NullFields is a list of field names (e.g. "DryRun") to include in API
  1854. // requests with the JSON null value. By default, fields with empty
  1855. // values are omitted from API requests. However, any field with an
  1856. // empty value appearing in NullFields will be sent to the server as
  1857. // null. It is an error if a field in this list has a non-empty value.
  1858. // This may be used to include null fields in Patch requests.
  1859. NullFields []string `json:"-"`
  1860. }
  1861. func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
  1862. type NoMethod WriteLogEntriesRequest
  1863. raw := NoMethod(*s)
  1864. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1865. }
  1866. // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
  1867. type WriteLogEntriesResponse struct {
  1868. // ServerResponse contains the HTTP response code and headers from the
  1869. // server.
  1870. googleapi.ServerResponse `json:"-"`
  1871. }
  1872. // method id "logging.billingAccounts.exclusions.create":
  1873. type BillingAccountsExclusionsCreateCall struct {
  1874. s *Service
  1875. parent string
  1876. logexclusion *LogExclusion
  1877. urlParams_ gensupport.URLParams
  1878. ctx_ context.Context
  1879. header_ http.Header
  1880. }
  1881. // Create: Creates a new exclusion in a specified parent resource. Only
  1882. // log entries belonging to that resource can be excluded. You can have
  1883. // up to 10 exclusions in a resource.
  1884. func (r *BillingAccountsExclusionsService) Create(parent string, logexclusion *LogExclusion) *BillingAccountsExclusionsCreateCall {
  1885. c := &BillingAccountsExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1886. c.parent = parent
  1887. c.logexclusion = logexclusion
  1888. return c
  1889. }
  1890. // Fields allows partial responses to be retrieved. See
  1891. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1892. // for more information.
  1893. func (c *BillingAccountsExclusionsCreateCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsCreateCall {
  1894. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1895. return c
  1896. }
  1897. // Context sets the context to be used in this call's Do method. Any
  1898. // pending HTTP request will be aborted if the provided context is
  1899. // canceled.
  1900. func (c *BillingAccountsExclusionsCreateCall) Context(ctx context.Context) *BillingAccountsExclusionsCreateCall {
  1901. c.ctx_ = ctx
  1902. return c
  1903. }
  1904. // Header returns an http.Header that can be modified by the caller to
  1905. // add HTTP headers to the request.
  1906. func (c *BillingAccountsExclusionsCreateCall) Header() http.Header {
  1907. if c.header_ == nil {
  1908. c.header_ = make(http.Header)
  1909. }
  1910. return c.header_
  1911. }
  1912. func (c *BillingAccountsExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  1913. reqHeaders := make(http.Header)
  1914. for k, v := range c.header_ {
  1915. reqHeaders[k] = v
  1916. }
  1917. reqHeaders.Set("User-Agent", c.s.userAgent())
  1918. var body io.Reader = nil
  1919. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  1920. if err != nil {
  1921. return nil, err
  1922. }
  1923. reqHeaders.Set("Content-Type", "application/json")
  1924. c.urlParams_.Set("alt", alt)
  1925. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  1926. urls += "?" + c.urlParams_.Encode()
  1927. req, _ := http.NewRequest("POST", urls, body)
  1928. req.Header = reqHeaders
  1929. googleapi.Expand(req.URL, map[string]string{
  1930. "parent": c.parent,
  1931. })
  1932. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1933. }
  1934. // Do executes the "logging.billingAccounts.exclusions.create" call.
  1935. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  1936. // status code is an error. Response headers are in either
  1937. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  1938. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1939. // to check whether the returned error was because
  1940. // http.StatusNotModified was returned.
  1941. func (c *BillingAccountsExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  1942. gensupport.SetOptions(c.urlParams_, opts...)
  1943. res, err := c.doRequest("json")
  1944. if res != nil && res.StatusCode == http.StatusNotModified {
  1945. if res.Body != nil {
  1946. res.Body.Close()
  1947. }
  1948. return nil, &googleapi.Error{
  1949. Code: res.StatusCode,
  1950. Header: res.Header,
  1951. }
  1952. }
  1953. if err != nil {
  1954. return nil, err
  1955. }
  1956. defer googleapi.CloseBody(res)
  1957. if err := googleapi.CheckResponse(res); err != nil {
  1958. return nil, err
  1959. }
  1960. ret := &LogExclusion{
  1961. ServerResponse: googleapi.ServerResponse{
  1962. Header: res.Header,
  1963. HTTPStatusCode: res.StatusCode,
  1964. },
  1965. }
  1966. target := &ret
  1967. if err := gensupport.DecodeResponse(target, res); err != nil {
  1968. return nil, err
  1969. }
  1970. return ret, nil
  1971. // {
  1972. // "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.",
  1973. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions",
  1974. // "httpMethod": "POST",
  1975. // "id": "logging.billingAccounts.exclusions.create",
  1976. // "parameterOrder": [
  1977. // "parent"
  1978. // ],
  1979. // "parameters": {
  1980. // "parent": {
  1981. // "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\".",
  1982. // "location": "path",
  1983. // "pattern": "^billingAccounts/[^/]+$",
  1984. // "required": true,
  1985. // "type": "string"
  1986. // }
  1987. // },
  1988. // "path": "v2/{+parent}/exclusions",
  1989. // "request": {
  1990. // "$ref": "LogExclusion"
  1991. // },
  1992. // "response": {
  1993. // "$ref": "LogExclusion"
  1994. // },
  1995. // "scopes": [
  1996. // "https://www.googleapis.com/auth/cloud-platform",
  1997. // "https://www.googleapis.com/auth/logging.admin"
  1998. // ]
  1999. // }
  2000. }
  2001. // method id "logging.billingAccounts.exclusions.delete":
  2002. type BillingAccountsExclusionsDeleteCall struct {
  2003. s *Service
  2004. name string
  2005. urlParams_ gensupport.URLParams
  2006. ctx_ context.Context
  2007. header_ http.Header
  2008. }
  2009. // Delete: Deletes an exclusion.
  2010. func (r *BillingAccountsExclusionsService) Delete(name string) *BillingAccountsExclusionsDeleteCall {
  2011. c := &BillingAccountsExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2012. c.name = name
  2013. return c
  2014. }
  2015. // Fields allows partial responses to be retrieved. See
  2016. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2017. // for more information.
  2018. func (c *BillingAccountsExclusionsDeleteCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsDeleteCall {
  2019. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2020. return c
  2021. }
  2022. // Context sets the context to be used in this call's Do method. Any
  2023. // pending HTTP request will be aborted if the provided context is
  2024. // canceled.
  2025. func (c *BillingAccountsExclusionsDeleteCall) Context(ctx context.Context) *BillingAccountsExclusionsDeleteCall {
  2026. c.ctx_ = ctx
  2027. return c
  2028. }
  2029. // Header returns an http.Header that can be modified by the caller to
  2030. // add HTTP headers to the request.
  2031. func (c *BillingAccountsExclusionsDeleteCall) Header() http.Header {
  2032. if c.header_ == nil {
  2033. c.header_ = make(http.Header)
  2034. }
  2035. return c.header_
  2036. }
  2037. func (c *BillingAccountsExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2038. reqHeaders := make(http.Header)
  2039. for k, v := range c.header_ {
  2040. reqHeaders[k] = v
  2041. }
  2042. reqHeaders.Set("User-Agent", c.s.userAgent())
  2043. var body io.Reader = nil
  2044. c.urlParams_.Set("alt", alt)
  2045. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2046. urls += "?" + c.urlParams_.Encode()
  2047. req, _ := http.NewRequest("DELETE", urls, body)
  2048. req.Header = reqHeaders
  2049. googleapi.Expand(req.URL, map[string]string{
  2050. "name": c.name,
  2051. })
  2052. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2053. }
  2054. // Do executes the "logging.billingAccounts.exclusions.delete" call.
  2055. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2056. // code is an error. Response headers are in either
  2057. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2058. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2059. // check whether the returned error was because http.StatusNotModified
  2060. // was returned.
  2061. func (c *BillingAccountsExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2062. gensupport.SetOptions(c.urlParams_, opts...)
  2063. res, err := c.doRequest("json")
  2064. if res != nil && res.StatusCode == http.StatusNotModified {
  2065. if res.Body != nil {
  2066. res.Body.Close()
  2067. }
  2068. return nil, &googleapi.Error{
  2069. Code: res.StatusCode,
  2070. Header: res.Header,
  2071. }
  2072. }
  2073. if err != nil {
  2074. return nil, err
  2075. }
  2076. defer googleapi.CloseBody(res)
  2077. if err := googleapi.CheckResponse(res); err != nil {
  2078. return nil, err
  2079. }
  2080. ret := &Empty{
  2081. ServerResponse: googleapi.ServerResponse{
  2082. Header: res.Header,
  2083. HTTPStatusCode: res.StatusCode,
  2084. },
  2085. }
  2086. target := &ret
  2087. if err := gensupport.DecodeResponse(target, res); err != nil {
  2088. return nil, err
  2089. }
  2090. return ret, nil
  2091. // {
  2092. // "description": "Deletes an exclusion.",
  2093. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions/{exclusionsId}",
  2094. // "httpMethod": "DELETE",
  2095. // "id": "logging.billingAccounts.exclusions.delete",
  2096. // "parameterOrder": [
  2097. // "name"
  2098. // ],
  2099. // "parameters": {
  2100. // "name": {
  2101. // "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\".",
  2102. // "location": "path",
  2103. // "pattern": "^billingAccounts/[^/]+/exclusions/[^/]+$",
  2104. // "required": true,
  2105. // "type": "string"
  2106. // }
  2107. // },
  2108. // "path": "v2/{+name}",
  2109. // "response": {
  2110. // "$ref": "Empty"
  2111. // },
  2112. // "scopes": [
  2113. // "https://www.googleapis.com/auth/cloud-platform",
  2114. // "https://www.googleapis.com/auth/logging.admin"
  2115. // ]
  2116. // }
  2117. }
  2118. // method id "logging.billingAccounts.exclusions.get":
  2119. type BillingAccountsExclusionsGetCall struct {
  2120. s *Service
  2121. name string
  2122. urlParams_ gensupport.URLParams
  2123. ifNoneMatch_ string
  2124. ctx_ context.Context
  2125. header_ http.Header
  2126. }
  2127. // Get: Gets the description of an exclusion.
  2128. func (r *BillingAccountsExclusionsService) Get(name string) *BillingAccountsExclusionsGetCall {
  2129. c := &BillingAccountsExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2130. c.name = name
  2131. return c
  2132. }
  2133. // Fields allows partial responses to be retrieved. See
  2134. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2135. // for more information.
  2136. func (c *BillingAccountsExclusionsGetCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsGetCall {
  2137. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2138. return c
  2139. }
  2140. // IfNoneMatch sets the optional parameter which makes the operation
  2141. // fail if the object's ETag matches the given value. This is useful for
  2142. // getting updates only after the object has changed since the last
  2143. // request. Use googleapi.IsNotModified to check whether the response
  2144. // error from Do is the result of In-None-Match.
  2145. func (c *BillingAccountsExclusionsGetCall) IfNoneMatch(entityTag string) *BillingAccountsExclusionsGetCall {
  2146. c.ifNoneMatch_ = entityTag
  2147. return c
  2148. }
  2149. // Context sets the context to be used in this call's Do method. Any
  2150. // pending HTTP request will be aborted if the provided context is
  2151. // canceled.
  2152. func (c *BillingAccountsExclusionsGetCall) Context(ctx context.Context) *BillingAccountsExclusionsGetCall {
  2153. c.ctx_ = ctx
  2154. return c
  2155. }
  2156. // Header returns an http.Header that can be modified by the caller to
  2157. // add HTTP headers to the request.
  2158. func (c *BillingAccountsExclusionsGetCall) Header() http.Header {
  2159. if c.header_ == nil {
  2160. c.header_ = make(http.Header)
  2161. }
  2162. return c.header_
  2163. }
  2164. func (c *BillingAccountsExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  2165. reqHeaders := make(http.Header)
  2166. for k, v := range c.header_ {
  2167. reqHeaders[k] = v
  2168. }
  2169. reqHeaders.Set("User-Agent", c.s.userAgent())
  2170. if c.ifNoneMatch_ != "" {
  2171. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2172. }
  2173. var body io.Reader = nil
  2174. c.urlParams_.Set("alt", alt)
  2175. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2176. urls += "?" + c.urlParams_.Encode()
  2177. req, _ := http.NewRequest("GET", urls, body)
  2178. req.Header = reqHeaders
  2179. googleapi.Expand(req.URL, map[string]string{
  2180. "name": c.name,
  2181. })
  2182. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2183. }
  2184. // Do executes the "logging.billingAccounts.exclusions.get" call.
  2185. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  2186. // status code is an error. Response headers are in either
  2187. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  2188. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2189. // to check whether the returned error was because
  2190. // http.StatusNotModified was returned.
  2191. func (c *BillingAccountsExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  2192. gensupport.SetOptions(c.urlParams_, opts...)
  2193. res, err := c.doRequest("json")
  2194. if res != nil && res.StatusCode == http.StatusNotModified {
  2195. if res.Body != nil {
  2196. res.Body.Close()
  2197. }
  2198. return nil, &googleapi.Error{
  2199. Code: res.StatusCode,
  2200. Header: res.Header,
  2201. }
  2202. }
  2203. if err != nil {
  2204. return nil, err
  2205. }
  2206. defer googleapi.CloseBody(res)
  2207. if err := googleapi.CheckResponse(res); err != nil {
  2208. return nil, err
  2209. }
  2210. ret := &LogExclusion{
  2211. ServerResponse: googleapi.ServerResponse{
  2212. Header: res.Header,
  2213. HTTPStatusCode: res.StatusCode,
  2214. },
  2215. }
  2216. target := &ret
  2217. if err := gensupport.DecodeResponse(target, res); err != nil {
  2218. return nil, err
  2219. }
  2220. return ret, nil
  2221. // {
  2222. // "description": "Gets the description of an exclusion.",
  2223. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions/{exclusionsId}",
  2224. // "httpMethod": "GET",
  2225. // "id": "logging.billingAccounts.exclusions.get",
  2226. // "parameterOrder": [
  2227. // "name"
  2228. // ],
  2229. // "parameters": {
  2230. // "name": {
  2231. // "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\".",
  2232. // "location": "path",
  2233. // "pattern": "^billingAccounts/[^/]+/exclusions/[^/]+$",
  2234. // "required": true,
  2235. // "type": "string"
  2236. // }
  2237. // },
  2238. // "path": "v2/{+name}",
  2239. // "response": {
  2240. // "$ref": "LogExclusion"
  2241. // },
  2242. // "scopes": [
  2243. // "https://www.googleapis.com/auth/cloud-platform",
  2244. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2245. // "https://www.googleapis.com/auth/logging.admin",
  2246. // "https://www.googleapis.com/auth/logging.read"
  2247. // ]
  2248. // }
  2249. }
  2250. // method id "logging.billingAccounts.exclusions.list":
  2251. type BillingAccountsExclusionsListCall struct {
  2252. s *Service
  2253. parent string
  2254. urlParams_ gensupport.URLParams
  2255. ifNoneMatch_ string
  2256. ctx_ context.Context
  2257. header_ http.Header
  2258. }
  2259. // List: Lists all the exclusions in a parent resource.
  2260. func (r *BillingAccountsExclusionsService) List(parent string) *BillingAccountsExclusionsListCall {
  2261. c := &BillingAccountsExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2262. c.parent = parent
  2263. return c
  2264. }
  2265. // PageSize sets the optional parameter "pageSize": The maximum number
  2266. // of results to return from this request. Non-positive values are
  2267. // ignored. The presence of nextPageToken in the response indicates that
  2268. // more results might be available.
  2269. func (c *BillingAccountsExclusionsListCall) PageSize(pageSize int64) *BillingAccountsExclusionsListCall {
  2270. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2271. return c
  2272. }
  2273. // PageToken sets the optional parameter "pageToken": If present, then
  2274. // retrieve the next batch of results from the preceding call to this
  2275. // method. pageToken must be the value of nextPageToken from the
  2276. // previous response. The values of other method parameters should be
  2277. // identical to those in the previous call.
  2278. func (c *BillingAccountsExclusionsListCall) PageToken(pageToken string) *BillingAccountsExclusionsListCall {
  2279. c.urlParams_.Set("pageToken", pageToken)
  2280. return c
  2281. }
  2282. // Fields allows partial responses to be retrieved. See
  2283. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2284. // for more information.
  2285. func (c *BillingAccountsExclusionsListCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsListCall {
  2286. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2287. return c
  2288. }
  2289. // IfNoneMatch sets the optional parameter which makes the operation
  2290. // fail if the object's ETag matches the given value. This is useful for
  2291. // getting updates only after the object has changed since the last
  2292. // request. Use googleapi.IsNotModified to check whether the response
  2293. // error from Do is the result of In-None-Match.
  2294. func (c *BillingAccountsExclusionsListCall) IfNoneMatch(entityTag string) *BillingAccountsExclusionsListCall {
  2295. c.ifNoneMatch_ = entityTag
  2296. return c
  2297. }
  2298. // Context sets the context to be used in this call's Do method. Any
  2299. // pending HTTP request will be aborted if the provided context is
  2300. // canceled.
  2301. func (c *BillingAccountsExclusionsListCall) Context(ctx context.Context) *BillingAccountsExclusionsListCall {
  2302. c.ctx_ = ctx
  2303. return c
  2304. }
  2305. // Header returns an http.Header that can be modified by the caller to
  2306. // add HTTP headers to the request.
  2307. func (c *BillingAccountsExclusionsListCall) Header() http.Header {
  2308. if c.header_ == nil {
  2309. c.header_ = make(http.Header)
  2310. }
  2311. return c.header_
  2312. }
  2313. func (c *BillingAccountsExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  2314. reqHeaders := make(http.Header)
  2315. for k, v := range c.header_ {
  2316. reqHeaders[k] = v
  2317. }
  2318. reqHeaders.Set("User-Agent", c.s.userAgent())
  2319. if c.ifNoneMatch_ != "" {
  2320. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2321. }
  2322. var body io.Reader = nil
  2323. c.urlParams_.Set("alt", alt)
  2324. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  2325. urls += "?" + c.urlParams_.Encode()
  2326. req, _ := http.NewRequest("GET", urls, body)
  2327. req.Header = reqHeaders
  2328. googleapi.Expand(req.URL, map[string]string{
  2329. "parent": c.parent,
  2330. })
  2331. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2332. }
  2333. // Do executes the "logging.billingAccounts.exclusions.list" call.
  2334. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  2335. // non-2xx status code is an error. Response headers are in either
  2336. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  2337. // returned at all) in error.(*googleapi.Error).Header. Use
  2338. // googleapi.IsNotModified to check whether the returned error was
  2339. // because http.StatusNotModified was returned.
  2340. func (c *BillingAccountsExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  2341. gensupport.SetOptions(c.urlParams_, opts...)
  2342. res, err := c.doRequest("json")
  2343. if res != nil && res.StatusCode == http.StatusNotModified {
  2344. if res.Body != nil {
  2345. res.Body.Close()
  2346. }
  2347. return nil, &googleapi.Error{
  2348. Code: res.StatusCode,
  2349. Header: res.Header,
  2350. }
  2351. }
  2352. if err != nil {
  2353. return nil, err
  2354. }
  2355. defer googleapi.CloseBody(res)
  2356. if err := googleapi.CheckResponse(res); err != nil {
  2357. return nil, err
  2358. }
  2359. ret := &ListExclusionsResponse{
  2360. ServerResponse: googleapi.ServerResponse{
  2361. Header: res.Header,
  2362. HTTPStatusCode: res.StatusCode,
  2363. },
  2364. }
  2365. target := &ret
  2366. if err := gensupport.DecodeResponse(target, res); err != nil {
  2367. return nil, err
  2368. }
  2369. return ret, nil
  2370. // {
  2371. // "description": "Lists all the exclusions in a parent resource.",
  2372. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions",
  2373. // "httpMethod": "GET",
  2374. // "id": "logging.billingAccounts.exclusions.list",
  2375. // "parameterOrder": [
  2376. // "parent"
  2377. // ],
  2378. // "parameters": {
  2379. // "pageSize": {
  2380. // "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.",
  2381. // "format": "int32",
  2382. // "location": "query",
  2383. // "type": "integer"
  2384. // },
  2385. // "pageToken": {
  2386. // "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.",
  2387. // "location": "query",
  2388. // "type": "string"
  2389. // },
  2390. // "parent": {
  2391. // "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",
  2392. // "location": "path",
  2393. // "pattern": "^billingAccounts/[^/]+$",
  2394. // "required": true,
  2395. // "type": "string"
  2396. // }
  2397. // },
  2398. // "path": "v2/{+parent}/exclusions",
  2399. // "response": {
  2400. // "$ref": "ListExclusionsResponse"
  2401. // },
  2402. // "scopes": [
  2403. // "https://www.googleapis.com/auth/cloud-platform",
  2404. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2405. // "https://www.googleapis.com/auth/logging.admin",
  2406. // "https://www.googleapis.com/auth/logging.read"
  2407. // ]
  2408. // }
  2409. }
  2410. // Pages invokes f for each page of results.
  2411. // A non-nil error returned from f will halt the iteration.
  2412. // The provided context supersedes any context provided to the Context method.
  2413. func (c *BillingAccountsExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  2414. c.ctx_ = ctx
  2415. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2416. for {
  2417. x, err := c.Do()
  2418. if err != nil {
  2419. return err
  2420. }
  2421. if err := f(x); err != nil {
  2422. return err
  2423. }
  2424. if x.NextPageToken == "" {
  2425. return nil
  2426. }
  2427. c.PageToken(x.NextPageToken)
  2428. }
  2429. }
  2430. // method id "logging.billingAccounts.exclusions.patch":
  2431. type BillingAccountsExclusionsPatchCall struct {
  2432. s *Service
  2433. name string
  2434. logexclusion *LogExclusion
  2435. urlParams_ gensupport.URLParams
  2436. ctx_ context.Context
  2437. header_ http.Header
  2438. }
  2439. // Patch: Changes one or more properties of an existing exclusion.
  2440. func (r *BillingAccountsExclusionsService) Patch(name string, logexclusion *LogExclusion) *BillingAccountsExclusionsPatchCall {
  2441. c := &BillingAccountsExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2442. c.name = name
  2443. c.logexclusion = logexclusion
  2444. return c
  2445. }
  2446. // UpdateMask sets the optional parameter "updateMask": Required. A
  2447. // nonempty list of fields to change in the existing exclusion. New
  2448. // values for the fields are taken from the corresponding fields in the
  2449. // LogExclusion included in this request. Fields not mentioned in
  2450. // update_mask are not changed and are ignored in the request.For
  2451. // example, to change the filter and description of an exclusion,
  2452. // specify an update_mask of "filter,description".
  2453. func (c *BillingAccountsExclusionsPatchCall) UpdateMask(updateMask string) *BillingAccountsExclusionsPatchCall {
  2454. c.urlParams_.Set("updateMask", updateMask)
  2455. return c
  2456. }
  2457. // Fields allows partial responses to be retrieved. See
  2458. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2459. // for more information.
  2460. func (c *BillingAccountsExclusionsPatchCall) Fields(s ...googleapi.Field) *BillingAccountsExclusionsPatchCall {
  2461. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  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 *BillingAccountsExclusionsPatchCall) Context(ctx context.Context) *BillingAccountsExclusionsPatchCall {
  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 *BillingAccountsExclusionsPatchCall) Header() http.Header {
  2474. if c.header_ == nil {
  2475. c.header_ = make(http.Header)
  2476. }
  2477. return c.header_
  2478. }
  2479. func (c *BillingAccountsExclusionsPatchCall) 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. var body io.Reader = nil
  2486. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  2487. if err != nil {
  2488. return nil, err
  2489. }
  2490. reqHeaders.Set("Content-Type", "application/json")
  2491. c.urlParams_.Set("alt", alt)
  2492. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2493. urls += "?" + c.urlParams_.Encode()
  2494. req, _ := http.NewRequest("PATCH", urls, body)
  2495. req.Header = reqHeaders
  2496. googleapi.Expand(req.URL, map[string]string{
  2497. "name": c.name,
  2498. })
  2499. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2500. }
  2501. // Do executes the "logging.billingAccounts.exclusions.patch" call.
  2502. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  2503. // status code is an error. Response headers are in either
  2504. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  2505. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2506. // to check whether the returned error was because
  2507. // http.StatusNotModified was returned.
  2508. func (c *BillingAccountsExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  2509. gensupport.SetOptions(c.urlParams_, opts...)
  2510. res, err := c.doRequest("json")
  2511. if res != nil && res.StatusCode == http.StatusNotModified {
  2512. if res.Body != nil {
  2513. res.Body.Close()
  2514. }
  2515. return nil, &googleapi.Error{
  2516. Code: res.StatusCode,
  2517. Header: res.Header,
  2518. }
  2519. }
  2520. if err != nil {
  2521. return nil, err
  2522. }
  2523. defer googleapi.CloseBody(res)
  2524. if err := googleapi.CheckResponse(res); err != nil {
  2525. return nil, err
  2526. }
  2527. ret := &LogExclusion{
  2528. ServerResponse: googleapi.ServerResponse{
  2529. Header: res.Header,
  2530. HTTPStatusCode: res.StatusCode,
  2531. },
  2532. }
  2533. target := &ret
  2534. if err := gensupport.DecodeResponse(target, res); err != nil {
  2535. return nil, err
  2536. }
  2537. return ret, nil
  2538. // {
  2539. // "description": "Changes one or more properties of an existing exclusion.",
  2540. // "flatPath": "v2/billingAccounts/{billingAccountsId}/exclusions/{exclusionsId}",
  2541. // "httpMethod": "PATCH",
  2542. // "id": "logging.billingAccounts.exclusions.patch",
  2543. // "parameterOrder": [
  2544. // "name"
  2545. // ],
  2546. // "parameters": {
  2547. // "name": {
  2548. // "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\".",
  2549. // "location": "path",
  2550. // "pattern": "^billingAccounts/[^/]+/exclusions/[^/]+$",
  2551. // "required": true,
  2552. // "type": "string"
  2553. // },
  2554. // "updateMask": {
  2555. // "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\".",
  2556. // "format": "google-fieldmask",
  2557. // "location": "query",
  2558. // "type": "string"
  2559. // }
  2560. // },
  2561. // "path": "v2/{+name}",
  2562. // "request": {
  2563. // "$ref": "LogExclusion"
  2564. // },
  2565. // "response": {
  2566. // "$ref": "LogExclusion"
  2567. // },
  2568. // "scopes": [
  2569. // "https://www.googleapis.com/auth/cloud-platform",
  2570. // "https://www.googleapis.com/auth/logging.admin"
  2571. // ]
  2572. // }
  2573. }
  2574. // method id "logging.billingAccounts.logs.delete":
  2575. type BillingAccountsLogsDeleteCall struct {
  2576. s *Service
  2577. logName string
  2578. urlParams_ gensupport.URLParams
  2579. ctx_ context.Context
  2580. header_ http.Header
  2581. }
  2582. // Delete: Deletes all the log entries in a log. The log reappears if it
  2583. // receives new entries. Log entries written shortly before the delete
  2584. // operation might not be deleted.
  2585. func (r *BillingAccountsLogsService) Delete(logName string) *BillingAccountsLogsDeleteCall {
  2586. c := &BillingAccountsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2587. c.logName = logName
  2588. return c
  2589. }
  2590. // Fields allows partial responses to be retrieved. See
  2591. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2592. // for more information.
  2593. func (c *BillingAccountsLogsDeleteCall) Fields(s ...googleapi.Field) *BillingAccountsLogsDeleteCall {
  2594. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2595. return c
  2596. }
  2597. // Context sets the context to be used in this call's Do method. Any
  2598. // pending HTTP request will be aborted if the provided context is
  2599. // canceled.
  2600. func (c *BillingAccountsLogsDeleteCall) Context(ctx context.Context) *BillingAccountsLogsDeleteCall {
  2601. c.ctx_ = ctx
  2602. return c
  2603. }
  2604. // Header returns an http.Header that can be modified by the caller to
  2605. // add HTTP headers to the request.
  2606. func (c *BillingAccountsLogsDeleteCall) Header() http.Header {
  2607. if c.header_ == nil {
  2608. c.header_ = make(http.Header)
  2609. }
  2610. return c.header_
  2611. }
  2612. func (c *BillingAccountsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2613. reqHeaders := make(http.Header)
  2614. for k, v := range c.header_ {
  2615. reqHeaders[k] = v
  2616. }
  2617. reqHeaders.Set("User-Agent", c.s.userAgent())
  2618. var body io.Reader = nil
  2619. c.urlParams_.Set("alt", alt)
  2620. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  2621. urls += "?" + c.urlParams_.Encode()
  2622. req, _ := http.NewRequest("DELETE", urls, body)
  2623. req.Header = reqHeaders
  2624. googleapi.Expand(req.URL, map[string]string{
  2625. "logName": c.logName,
  2626. })
  2627. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2628. }
  2629. // Do executes the "logging.billingAccounts.logs.delete" call.
  2630. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2631. // code is an error. Response headers are in either
  2632. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2633. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2634. // check whether the returned error was because http.StatusNotModified
  2635. // was returned.
  2636. func (c *BillingAccountsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2637. gensupport.SetOptions(c.urlParams_, opts...)
  2638. res, err := c.doRequest("json")
  2639. if res != nil && res.StatusCode == http.StatusNotModified {
  2640. if res.Body != nil {
  2641. res.Body.Close()
  2642. }
  2643. return nil, &googleapi.Error{
  2644. Code: res.StatusCode,
  2645. Header: res.Header,
  2646. }
  2647. }
  2648. if err != nil {
  2649. return nil, err
  2650. }
  2651. defer googleapi.CloseBody(res)
  2652. if err := googleapi.CheckResponse(res); err != nil {
  2653. return nil, err
  2654. }
  2655. ret := &Empty{
  2656. ServerResponse: googleapi.ServerResponse{
  2657. Header: res.Header,
  2658. HTTPStatusCode: res.StatusCode,
  2659. },
  2660. }
  2661. target := &ret
  2662. if err := gensupport.DecodeResponse(target, res); err != nil {
  2663. return nil, err
  2664. }
  2665. return ret, nil
  2666. // {
  2667. // "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.",
  2668. // "flatPath": "v2/billingAccounts/{billingAccountsId}/logs/{logsId}",
  2669. // "httpMethod": "DELETE",
  2670. // "id": "logging.billingAccounts.logs.delete",
  2671. // "parameterOrder": [
  2672. // "logName"
  2673. // ],
  2674. // "parameters": {
  2675. // "logName": {
  2676. // "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.",
  2677. // "location": "path",
  2678. // "pattern": "^billingAccounts/[^/]+/logs/[^/]+$",
  2679. // "required": true,
  2680. // "type": "string"
  2681. // }
  2682. // },
  2683. // "path": "v2/{+logName}",
  2684. // "response": {
  2685. // "$ref": "Empty"
  2686. // },
  2687. // "scopes": [
  2688. // "https://www.googleapis.com/auth/cloud-platform",
  2689. // "https://www.googleapis.com/auth/logging.admin"
  2690. // ]
  2691. // }
  2692. }
  2693. // method id "logging.billingAccounts.logs.list":
  2694. type BillingAccountsLogsListCall struct {
  2695. s *Service
  2696. parent string
  2697. urlParams_ gensupport.URLParams
  2698. ifNoneMatch_ string
  2699. ctx_ context.Context
  2700. header_ http.Header
  2701. }
  2702. // List: Lists the logs in projects, organizations, folders, or billing
  2703. // accounts. Only logs that have entries are listed.
  2704. func (r *BillingAccountsLogsService) List(parent string) *BillingAccountsLogsListCall {
  2705. c := &BillingAccountsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2706. c.parent = parent
  2707. return c
  2708. }
  2709. // PageSize sets the optional parameter "pageSize": The maximum number
  2710. // of results to return from this request. Non-positive values are
  2711. // ignored. The presence of nextPageToken in the response indicates that
  2712. // more results might be available.
  2713. func (c *BillingAccountsLogsListCall) PageSize(pageSize int64) *BillingAccountsLogsListCall {
  2714. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2715. return c
  2716. }
  2717. // PageToken sets the optional parameter "pageToken": If present, then
  2718. // retrieve the next batch of results from the preceding call to this
  2719. // method. pageToken must be the value of nextPageToken from the
  2720. // previous response. The values of other method parameters should be
  2721. // identical to those in the previous call.
  2722. func (c *BillingAccountsLogsListCall) PageToken(pageToken string) *BillingAccountsLogsListCall {
  2723. c.urlParams_.Set("pageToken", pageToken)
  2724. return c
  2725. }
  2726. // Fields allows partial responses to be retrieved. See
  2727. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2728. // for more information.
  2729. func (c *BillingAccountsLogsListCall) Fields(s ...googleapi.Field) *BillingAccountsLogsListCall {
  2730. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2731. return c
  2732. }
  2733. // IfNoneMatch sets the optional parameter which makes the operation
  2734. // fail if the object's ETag matches the given value. This is useful for
  2735. // getting updates only after the object has changed since the last
  2736. // request. Use googleapi.IsNotModified to check whether the response
  2737. // error from Do is the result of In-None-Match.
  2738. func (c *BillingAccountsLogsListCall) IfNoneMatch(entityTag string) *BillingAccountsLogsListCall {
  2739. c.ifNoneMatch_ = entityTag
  2740. return c
  2741. }
  2742. // Context sets the context to be used in this call's Do method. Any
  2743. // pending HTTP request will be aborted if the provided context is
  2744. // canceled.
  2745. func (c *BillingAccountsLogsListCall) Context(ctx context.Context) *BillingAccountsLogsListCall {
  2746. c.ctx_ = ctx
  2747. return c
  2748. }
  2749. // Header returns an http.Header that can be modified by the caller to
  2750. // add HTTP headers to the request.
  2751. func (c *BillingAccountsLogsListCall) Header() http.Header {
  2752. if c.header_ == nil {
  2753. c.header_ = make(http.Header)
  2754. }
  2755. return c.header_
  2756. }
  2757. func (c *BillingAccountsLogsListCall) doRequest(alt string) (*http.Response, error) {
  2758. reqHeaders := make(http.Header)
  2759. for k, v := range c.header_ {
  2760. reqHeaders[k] = v
  2761. }
  2762. reqHeaders.Set("User-Agent", c.s.userAgent())
  2763. if c.ifNoneMatch_ != "" {
  2764. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2765. }
  2766. var body io.Reader = nil
  2767. c.urlParams_.Set("alt", alt)
  2768. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  2769. urls += "?" + c.urlParams_.Encode()
  2770. req, _ := http.NewRequest("GET", urls, body)
  2771. req.Header = reqHeaders
  2772. googleapi.Expand(req.URL, map[string]string{
  2773. "parent": c.parent,
  2774. })
  2775. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2776. }
  2777. // Do executes the "logging.billingAccounts.logs.list" call.
  2778. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  2779. // non-2xx status code is an error. Response headers are in either
  2780. // *ListLogsResponse.ServerResponse.Header or (if a response was
  2781. // returned at all) in error.(*googleapi.Error).Header. Use
  2782. // googleapi.IsNotModified to check whether the returned error was
  2783. // because http.StatusNotModified was returned.
  2784. func (c *BillingAccountsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  2785. gensupport.SetOptions(c.urlParams_, opts...)
  2786. res, err := c.doRequest("json")
  2787. if res != nil && res.StatusCode == http.StatusNotModified {
  2788. if res.Body != nil {
  2789. res.Body.Close()
  2790. }
  2791. return nil, &googleapi.Error{
  2792. Code: res.StatusCode,
  2793. Header: res.Header,
  2794. }
  2795. }
  2796. if err != nil {
  2797. return nil, err
  2798. }
  2799. defer googleapi.CloseBody(res)
  2800. if err := googleapi.CheckResponse(res); err != nil {
  2801. return nil, err
  2802. }
  2803. ret := &ListLogsResponse{
  2804. ServerResponse: googleapi.ServerResponse{
  2805. Header: res.Header,
  2806. HTTPStatusCode: res.StatusCode,
  2807. },
  2808. }
  2809. target := &ret
  2810. if err := gensupport.DecodeResponse(target, res); err != nil {
  2811. return nil, err
  2812. }
  2813. return ret, nil
  2814. // {
  2815. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  2816. // "flatPath": "v2/billingAccounts/{billingAccountsId}/logs",
  2817. // "httpMethod": "GET",
  2818. // "id": "logging.billingAccounts.logs.list",
  2819. // "parameterOrder": [
  2820. // "parent"
  2821. // ],
  2822. // "parameters": {
  2823. // "pageSize": {
  2824. // "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.",
  2825. // "format": "int32",
  2826. // "location": "query",
  2827. // "type": "integer"
  2828. // },
  2829. // "pageToken": {
  2830. // "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.",
  2831. // "location": "query",
  2832. // "type": "string"
  2833. // },
  2834. // "parent": {
  2835. // "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",
  2836. // "location": "path",
  2837. // "pattern": "^billingAccounts/[^/]+$",
  2838. // "required": true,
  2839. // "type": "string"
  2840. // }
  2841. // },
  2842. // "path": "v2/{+parent}/logs",
  2843. // "response": {
  2844. // "$ref": "ListLogsResponse"
  2845. // },
  2846. // "scopes": [
  2847. // "https://www.googleapis.com/auth/cloud-platform",
  2848. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  2849. // "https://www.googleapis.com/auth/logging.admin",
  2850. // "https://www.googleapis.com/auth/logging.read"
  2851. // ]
  2852. // }
  2853. }
  2854. // Pages invokes f for each page of results.
  2855. // A non-nil error returned from f will halt the iteration.
  2856. // The provided context supersedes any context provided to the Context method.
  2857. func (c *BillingAccountsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  2858. c.ctx_ = ctx
  2859. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2860. for {
  2861. x, err := c.Do()
  2862. if err != nil {
  2863. return err
  2864. }
  2865. if err := f(x); err != nil {
  2866. return err
  2867. }
  2868. if x.NextPageToken == "" {
  2869. return nil
  2870. }
  2871. c.PageToken(x.NextPageToken)
  2872. }
  2873. }
  2874. // method id "logging.billingAccounts.sinks.create":
  2875. type BillingAccountsSinksCreateCall struct {
  2876. s *Service
  2877. parent string
  2878. logsink *LogSink
  2879. urlParams_ gensupport.URLParams
  2880. ctx_ context.Context
  2881. header_ http.Header
  2882. }
  2883. // Create: Creates a sink that exports specified log entries to a
  2884. // destination. The export of newly-ingested log entries begins
  2885. // immediately, unless the sink's writer_identity is not permitted to
  2886. // write to the destination. A sink can export log entries only from the
  2887. // resource owning the sink.
  2888. func (r *BillingAccountsSinksService) Create(parent string, logsink *LogSink) *BillingAccountsSinksCreateCall {
  2889. c := &BillingAccountsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2890. c.parent = parent
  2891. c.logsink = logsink
  2892. return c
  2893. }
  2894. // UniqueWriterIdentity sets the optional parameter
  2895. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  2896. // as writer_identity in the new sink. If this value is omitted or set
  2897. // to false, and if the sink's parent is a project, then the value
  2898. // returned as writer_identity is the same group or service account used
  2899. // by Stackdriver Logging before the addition of writer identities to
  2900. // this API. The sink's destination must be in the same project as the
  2901. // sink itself.If this field is set to true, or if the sink is owned by
  2902. // a non-project resource such as an organization, then the value of
  2903. // writer_identity will be a unique service account used only for
  2904. // exports from the new sink. For more information, see writer_identity
  2905. // in LogSink.
  2906. func (c *BillingAccountsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *BillingAccountsSinksCreateCall {
  2907. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  2908. return c
  2909. }
  2910. // Fields allows partial responses to be retrieved. See
  2911. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2912. // for more information.
  2913. func (c *BillingAccountsSinksCreateCall) Fields(s ...googleapi.Field) *BillingAccountsSinksCreateCall {
  2914. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2915. return c
  2916. }
  2917. // Context sets the context to be used in this call's Do method. Any
  2918. // pending HTTP request will be aborted if the provided context is
  2919. // canceled.
  2920. func (c *BillingAccountsSinksCreateCall) Context(ctx context.Context) *BillingAccountsSinksCreateCall {
  2921. c.ctx_ = ctx
  2922. return c
  2923. }
  2924. // Header returns an http.Header that can be modified by the caller to
  2925. // add HTTP headers to the request.
  2926. func (c *BillingAccountsSinksCreateCall) Header() http.Header {
  2927. if c.header_ == nil {
  2928. c.header_ = make(http.Header)
  2929. }
  2930. return c.header_
  2931. }
  2932. func (c *BillingAccountsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  2933. reqHeaders := make(http.Header)
  2934. for k, v := range c.header_ {
  2935. reqHeaders[k] = v
  2936. }
  2937. reqHeaders.Set("User-Agent", c.s.userAgent())
  2938. var body io.Reader = nil
  2939. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  2940. if err != nil {
  2941. return nil, err
  2942. }
  2943. reqHeaders.Set("Content-Type", "application/json")
  2944. c.urlParams_.Set("alt", alt)
  2945. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  2946. urls += "?" + c.urlParams_.Encode()
  2947. req, _ := http.NewRequest("POST", urls, body)
  2948. req.Header = reqHeaders
  2949. googleapi.Expand(req.URL, map[string]string{
  2950. "parent": c.parent,
  2951. })
  2952. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2953. }
  2954. // Do executes the "logging.billingAccounts.sinks.create" call.
  2955. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2956. // code is an error. Response headers are in either
  2957. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2958. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2959. // check whether the returned error was because http.StatusNotModified
  2960. // was returned.
  2961. func (c *BillingAccountsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2962. gensupport.SetOptions(c.urlParams_, opts...)
  2963. res, err := c.doRequest("json")
  2964. if res != nil && res.StatusCode == http.StatusNotModified {
  2965. if res.Body != nil {
  2966. res.Body.Close()
  2967. }
  2968. return nil, &googleapi.Error{
  2969. Code: res.StatusCode,
  2970. Header: res.Header,
  2971. }
  2972. }
  2973. if err != nil {
  2974. return nil, err
  2975. }
  2976. defer googleapi.CloseBody(res)
  2977. if err := googleapi.CheckResponse(res); err != nil {
  2978. return nil, err
  2979. }
  2980. ret := &LogSink{
  2981. ServerResponse: googleapi.ServerResponse{
  2982. Header: res.Header,
  2983. HTTPStatusCode: res.StatusCode,
  2984. },
  2985. }
  2986. target := &ret
  2987. if err := gensupport.DecodeResponse(target, res); err != nil {
  2988. return nil, err
  2989. }
  2990. return ret, nil
  2991. // {
  2992. // "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.",
  2993. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks",
  2994. // "httpMethod": "POST",
  2995. // "id": "logging.billingAccounts.sinks.create",
  2996. // "parameterOrder": [
  2997. // "parent"
  2998. // ],
  2999. // "parameters": {
  3000. // "parent": {
  3001. // "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\".",
  3002. // "location": "path",
  3003. // "pattern": "^billingAccounts/[^/]+$",
  3004. // "required": true,
  3005. // "type": "string"
  3006. // },
  3007. // "uniqueWriterIdentity": {
  3008. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Stackdriver Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  3009. // "location": "query",
  3010. // "type": "boolean"
  3011. // }
  3012. // },
  3013. // "path": "v2/{+parent}/sinks",
  3014. // "request": {
  3015. // "$ref": "LogSink"
  3016. // },
  3017. // "response": {
  3018. // "$ref": "LogSink"
  3019. // },
  3020. // "scopes": [
  3021. // "https://www.googleapis.com/auth/cloud-platform",
  3022. // "https://www.googleapis.com/auth/logging.admin"
  3023. // ]
  3024. // }
  3025. }
  3026. // method id "logging.billingAccounts.sinks.delete":
  3027. type BillingAccountsSinksDeleteCall struct {
  3028. s *Service
  3029. sinkNameid string
  3030. urlParams_ gensupport.URLParams
  3031. ctx_ context.Context
  3032. header_ http.Header
  3033. }
  3034. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  3035. // then that service account is also deleted.
  3036. func (r *BillingAccountsSinksService) Delete(sinkNameid string) *BillingAccountsSinksDeleteCall {
  3037. c := &BillingAccountsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3038. c.sinkNameid = sinkNameid
  3039. return c
  3040. }
  3041. // Fields allows partial responses to be retrieved. See
  3042. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3043. // for more information.
  3044. func (c *BillingAccountsSinksDeleteCall) Fields(s ...googleapi.Field) *BillingAccountsSinksDeleteCall {
  3045. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3046. return c
  3047. }
  3048. // Context sets the context to be used in this call's Do method. Any
  3049. // pending HTTP request will be aborted if the provided context is
  3050. // canceled.
  3051. func (c *BillingAccountsSinksDeleteCall) Context(ctx context.Context) *BillingAccountsSinksDeleteCall {
  3052. c.ctx_ = ctx
  3053. return c
  3054. }
  3055. // Header returns an http.Header that can be modified by the caller to
  3056. // add HTTP headers to the request.
  3057. func (c *BillingAccountsSinksDeleteCall) Header() http.Header {
  3058. if c.header_ == nil {
  3059. c.header_ = make(http.Header)
  3060. }
  3061. return c.header_
  3062. }
  3063. func (c *BillingAccountsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  3064. reqHeaders := make(http.Header)
  3065. for k, v := range c.header_ {
  3066. reqHeaders[k] = v
  3067. }
  3068. reqHeaders.Set("User-Agent", c.s.userAgent())
  3069. var body io.Reader = nil
  3070. c.urlParams_.Set("alt", alt)
  3071. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3072. urls += "?" + c.urlParams_.Encode()
  3073. req, _ := http.NewRequest("DELETE", urls, body)
  3074. req.Header = reqHeaders
  3075. googleapi.Expand(req.URL, map[string]string{
  3076. "sinkName": c.sinkNameid,
  3077. })
  3078. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3079. }
  3080. // Do executes the "logging.billingAccounts.sinks.delete" call.
  3081. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3082. // code is an error. Response headers are in either
  3083. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3084. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3085. // check whether the returned error was because http.StatusNotModified
  3086. // was returned.
  3087. func (c *BillingAccountsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3088. gensupport.SetOptions(c.urlParams_, opts...)
  3089. res, err := c.doRequest("json")
  3090. if res != nil && res.StatusCode == http.StatusNotModified {
  3091. if res.Body != nil {
  3092. res.Body.Close()
  3093. }
  3094. return nil, &googleapi.Error{
  3095. Code: res.StatusCode,
  3096. Header: res.Header,
  3097. }
  3098. }
  3099. if err != nil {
  3100. return nil, err
  3101. }
  3102. defer googleapi.CloseBody(res)
  3103. if err := googleapi.CheckResponse(res); err != nil {
  3104. return nil, err
  3105. }
  3106. ret := &Empty{
  3107. ServerResponse: googleapi.ServerResponse{
  3108. Header: res.Header,
  3109. HTTPStatusCode: res.StatusCode,
  3110. },
  3111. }
  3112. target := &ret
  3113. if err := gensupport.DecodeResponse(target, res); err != nil {
  3114. return nil, err
  3115. }
  3116. return ret, nil
  3117. // {
  3118. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  3119. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3120. // "httpMethod": "DELETE",
  3121. // "id": "logging.billingAccounts.sinks.delete",
  3122. // "parameterOrder": [
  3123. // "sinkName"
  3124. // ],
  3125. // "parameters": {
  3126. // "sinkName": {
  3127. // "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\".",
  3128. // "location": "path",
  3129. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3130. // "required": true,
  3131. // "type": "string"
  3132. // }
  3133. // },
  3134. // "path": "v2/{+sinkName}",
  3135. // "response": {
  3136. // "$ref": "Empty"
  3137. // },
  3138. // "scopes": [
  3139. // "https://www.googleapis.com/auth/cloud-platform",
  3140. // "https://www.googleapis.com/auth/logging.admin"
  3141. // ]
  3142. // }
  3143. }
  3144. // method id "logging.billingAccounts.sinks.get":
  3145. type BillingAccountsSinksGetCall struct {
  3146. s *Service
  3147. sinkName string
  3148. urlParams_ gensupport.URLParams
  3149. ifNoneMatch_ string
  3150. ctx_ context.Context
  3151. header_ http.Header
  3152. }
  3153. // Get: Gets a sink.
  3154. func (r *BillingAccountsSinksService) Get(sinkName string) *BillingAccountsSinksGetCall {
  3155. c := &BillingAccountsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3156. c.sinkName = sinkName
  3157. return c
  3158. }
  3159. // Fields allows partial responses to be retrieved. See
  3160. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3161. // for more information.
  3162. func (c *BillingAccountsSinksGetCall) Fields(s ...googleapi.Field) *BillingAccountsSinksGetCall {
  3163. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3164. return c
  3165. }
  3166. // IfNoneMatch sets the optional parameter which makes the operation
  3167. // fail if the object's ETag matches the given value. This is useful for
  3168. // getting updates only after the object has changed since the last
  3169. // request. Use googleapi.IsNotModified to check whether the response
  3170. // error from Do is the result of In-None-Match.
  3171. func (c *BillingAccountsSinksGetCall) IfNoneMatch(entityTag string) *BillingAccountsSinksGetCall {
  3172. c.ifNoneMatch_ = entityTag
  3173. return c
  3174. }
  3175. // Context sets the context to be used in this call's Do method. Any
  3176. // pending HTTP request will be aborted if the provided context is
  3177. // canceled.
  3178. func (c *BillingAccountsSinksGetCall) Context(ctx context.Context) *BillingAccountsSinksGetCall {
  3179. c.ctx_ = ctx
  3180. return c
  3181. }
  3182. // Header returns an http.Header that can be modified by the caller to
  3183. // add HTTP headers to the request.
  3184. func (c *BillingAccountsSinksGetCall) Header() http.Header {
  3185. if c.header_ == nil {
  3186. c.header_ = make(http.Header)
  3187. }
  3188. return c.header_
  3189. }
  3190. func (c *BillingAccountsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  3191. reqHeaders := make(http.Header)
  3192. for k, v := range c.header_ {
  3193. reqHeaders[k] = v
  3194. }
  3195. reqHeaders.Set("User-Agent", c.s.userAgent())
  3196. if c.ifNoneMatch_ != "" {
  3197. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3198. }
  3199. var body io.Reader = nil
  3200. c.urlParams_.Set("alt", alt)
  3201. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3202. urls += "?" + c.urlParams_.Encode()
  3203. req, _ := http.NewRequest("GET", urls, body)
  3204. req.Header = reqHeaders
  3205. googleapi.Expand(req.URL, map[string]string{
  3206. "sinkName": c.sinkName,
  3207. })
  3208. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3209. }
  3210. // Do executes the "logging.billingAccounts.sinks.get" call.
  3211. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3212. // code is an error. Response headers are in either
  3213. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3214. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3215. // check whether the returned error was because http.StatusNotModified
  3216. // was returned.
  3217. func (c *BillingAccountsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3218. gensupport.SetOptions(c.urlParams_, opts...)
  3219. res, err := c.doRequest("json")
  3220. if res != nil && res.StatusCode == http.StatusNotModified {
  3221. if res.Body != nil {
  3222. res.Body.Close()
  3223. }
  3224. return nil, &googleapi.Error{
  3225. Code: res.StatusCode,
  3226. Header: res.Header,
  3227. }
  3228. }
  3229. if err != nil {
  3230. return nil, err
  3231. }
  3232. defer googleapi.CloseBody(res)
  3233. if err := googleapi.CheckResponse(res); err != nil {
  3234. return nil, err
  3235. }
  3236. ret := &LogSink{
  3237. ServerResponse: googleapi.ServerResponse{
  3238. Header: res.Header,
  3239. HTTPStatusCode: res.StatusCode,
  3240. },
  3241. }
  3242. target := &ret
  3243. if err := gensupport.DecodeResponse(target, res); err != nil {
  3244. return nil, err
  3245. }
  3246. return ret, nil
  3247. // {
  3248. // "description": "Gets a sink.",
  3249. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3250. // "httpMethod": "GET",
  3251. // "id": "logging.billingAccounts.sinks.get",
  3252. // "parameterOrder": [
  3253. // "sinkName"
  3254. // ],
  3255. // "parameters": {
  3256. // "sinkName": {
  3257. // "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\".",
  3258. // "location": "path",
  3259. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3260. // "required": true,
  3261. // "type": "string"
  3262. // }
  3263. // },
  3264. // "path": "v2/{+sinkName}",
  3265. // "response": {
  3266. // "$ref": "LogSink"
  3267. // },
  3268. // "scopes": [
  3269. // "https://www.googleapis.com/auth/cloud-platform",
  3270. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3271. // "https://www.googleapis.com/auth/logging.admin",
  3272. // "https://www.googleapis.com/auth/logging.read"
  3273. // ]
  3274. // }
  3275. }
  3276. // method id "logging.billingAccounts.sinks.list":
  3277. type BillingAccountsSinksListCall struct {
  3278. s *Service
  3279. parent string
  3280. urlParams_ gensupport.URLParams
  3281. ifNoneMatch_ string
  3282. ctx_ context.Context
  3283. header_ http.Header
  3284. }
  3285. // List: Lists sinks.
  3286. func (r *BillingAccountsSinksService) List(parent string) *BillingAccountsSinksListCall {
  3287. c := &BillingAccountsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3288. c.parent = parent
  3289. return c
  3290. }
  3291. // PageSize sets the optional parameter "pageSize": The maximum number
  3292. // of results to return from this request. Non-positive values are
  3293. // ignored. The presence of nextPageToken in the response indicates that
  3294. // more results might be available.
  3295. func (c *BillingAccountsSinksListCall) PageSize(pageSize int64) *BillingAccountsSinksListCall {
  3296. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3297. return c
  3298. }
  3299. // PageToken sets the optional parameter "pageToken": If present, then
  3300. // retrieve the next batch of results from the preceding call to this
  3301. // method. pageToken must be the value of nextPageToken from the
  3302. // previous response. The values of other method parameters should be
  3303. // identical to those in the previous call.
  3304. func (c *BillingAccountsSinksListCall) PageToken(pageToken string) *BillingAccountsSinksListCall {
  3305. c.urlParams_.Set("pageToken", pageToken)
  3306. return c
  3307. }
  3308. // Fields allows partial responses to be retrieved. See
  3309. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3310. // for more information.
  3311. func (c *BillingAccountsSinksListCall) Fields(s ...googleapi.Field) *BillingAccountsSinksListCall {
  3312. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3313. return c
  3314. }
  3315. // IfNoneMatch sets the optional parameter which makes the operation
  3316. // fail if the object's ETag matches the given value. This is useful for
  3317. // getting updates only after the object has changed since the last
  3318. // request. Use googleapi.IsNotModified to check whether the response
  3319. // error from Do is the result of In-None-Match.
  3320. func (c *BillingAccountsSinksListCall) IfNoneMatch(entityTag string) *BillingAccountsSinksListCall {
  3321. c.ifNoneMatch_ = entityTag
  3322. return c
  3323. }
  3324. // Context sets the context to be used in this call's Do method. Any
  3325. // pending HTTP request will be aborted if the provided context is
  3326. // canceled.
  3327. func (c *BillingAccountsSinksListCall) Context(ctx context.Context) *BillingAccountsSinksListCall {
  3328. c.ctx_ = ctx
  3329. return c
  3330. }
  3331. // Header returns an http.Header that can be modified by the caller to
  3332. // add HTTP headers to the request.
  3333. func (c *BillingAccountsSinksListCall) Header() http.Header {
  3334. if c.header_ == nil {
  3335. c.header_ = make(http.Header)
  3336. }
  3337. return c.header_
  3338. }
  3339. func (c *BillingAccountsSinksListCall) doRequest(alt string) (*http.Response, error) {
  3340. reqHeaders := make(http.Header)
  3341. for k, v := range c.header_ {
  3342. reqHeaders[k] = v
  3343. }
  3344. reqHeaders.Set("User-Agent", c.s.userAgent())
  3345. if c.ifNoneMatch_ != "" {
  3346. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3347. }
  3348. var body io.Reader = nil
  3349. c.urlParams_.Set("alt", alt)
  3350. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  3351. urls += "?" + c.urlParams_.Encode()
  3352. req, _ := http.NewRequest("GET", urls, body)
  3353. req.Header = reqHeaders
  3354. googleapi.Expand(req.URL, map[string]string{
  3355. "parent": c.parent,
  3356. })
  3357. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3358. }
  3359. // Do executes the "logging.billingAccounts.sinks.list" call.
  3360. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  3361. // non-2xx status code is an error. Response headers are in either
  3362. // *ListSinksResponse.ServerResponse.Header or (if a response was
  3363. // returned at all) in error.(*googleapi.Error).Header. Use
  3364. // googleapi.IsNotModified to check whether the returned error was
  3365. // because http.StatusNotModified was returned.
  3366. func (c *BillingAccountsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  3367. gensupport.SetOptions(c.urlParams_, opts...)
  3368. res, err := c.doRequest("json")
  3369. if res != nil && res.StatusCode == http.StatusNotModified {
  3370. if res.Body != nil {
  3371. res.Body.Close()
  3372. }
  3373. return nil, &googleapi.Error{
  3374. Code: res.StatusCode,
  3375. Header: res.Header,
  3376. }
  3377. }
  3378. if err != nil {
  3379. return nil, err
  3380. }
  3381. defer googleapi.CloseBody(res)
  3382. if err := googleapi.CheckResponse(res); err != nil {
  3383. return nil, err
  3384. }
  3385. ret := &ListSinksResponse{
  3386. ServerResponse: googleapi.ServerResponse{
  3387. Header: res.Header,
  3388. HTTPStatusCode: res.StatusCode,
  3389. },
  3390. }
  3391. target := &ret
  3392. if err := gensupport.DecodeResponse(target, res); err != nil {
  3393. return nil, err
  3394. }
  3395. return ret, nil
  3396. // {
  3397. // "description": "Lists sinks.",
  3398. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks",
  3399. // "httpMethod": "GET",
  3400. // "id": "logging.billingAccounts.sinks.list",
  3401. // "parameterOrder": [
  3402. // "parent"
  3403. // ],
  3404. // "parameters": {
  3405. // "pageSize": {
  3406. // "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.",
  3407. // "format": "int32",
  3408. // "location": "query",
  3409. // "type": "integer"
  3410. // },
  3411. // "pageToken": {
  3412. // "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.",
  3413. // "location": "query",
  3414. // "type": "string"
  3415. // },
  3416. // "parent": {
  3417. // "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",
  3418. // "location": "path",
  3419. // "pattern": "^billingAccounts/[^/]+$",
  3420. // "required": true,
  3421. // "type": "string"
  3422. // }
  3423. // },
  3424. // "path": "v2/{+parent}/sinks",
  3425. // "response": {
  3426. // "$ref": "ListSinksResponse"
  3427. // },
  3428. // "scopes": [
  3429. // "https://www.googleapis.com/auth/cloud-platform",
  3430. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3431. // "https://www.googleapis.com/auth/logging.admin",
  3432. // "https://www.googleapis.com/auth/logging.read"
  3433. // ]
  3434. // }
  3435. }
  3436. // Pages invokes f for each page of results.
  3437. // A non-nil error returned from f will halt the iteration.
  3438. // The provided context supersedes any context provided to the Context method.
  3439. func (c *BillingAccountsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  3440. c.ctx_ = ctx
  3441. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3442. for {
  3443. x, err := c.Do()
  3444. if err != nil {
  3445. return err
  3446. }
  3447. if err := f(x); err != nil {
  3448. return err
  3449. }
  3450. if x.NextPageToken == "" {
  3451. return nil
  3452. }
  3453. c.PageToken(x.NextPageToken)
  3454. }
  3455. }
  3456. // method id "logging.billingAccounts.sinks.patch":
  3457. type BillingAccountsSinksPatchCall struct {
  3458. s *Service
  3459. sinkNameid string
  3460. logsink *LogSink
  3461. urlParams_ gensupport.URLParams
  3462. ctx_ context.Context
  3463. header_ http.Header
  3464. }
  3465. // Patch: Updates a sink. This method replaces the following fields in
  3466. // the existing sink with values from the new sink: destination, and
  3467. // filter. The updated sink might also have a new writer_identity; see
  3468. // the unique_writer_identity field.
  3469. func (r *BillingAccountsSinksService) Patch(sinkNameid string, logsink *LogSink) *BillingAccountsSinksPatchCall {
  3470. c := &BillingAccountsSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3471. c.sinkNameid = sinkNameid
  3472. c.logsink = logsink
  3473. return c
  3474. }
  3475. // UniqueWriterIdentity sets the optional parameter
  3476. // "uniqueWriterIdentity": See sinks.create for a description of this
  3477. // field. When updating a sink, the effect of this field on the value of
  3478. // writer_identity in the updated sink depends on both the old and new
  3479. // values of this field:
  3480. // If the old and new values of this field are both false or both true,
  3481. // then there is no change to the sink's writer_identity.
  3482. // If the old value is false and the new value is true, then
  3483. // writer_identity is changed to a unique service account.
  3484. // It is an error if the old value is true and the new value is set to
  3485. // false or defaulted to false.
  3486. func (c *BillingAccountsSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *BillingAccountsSinksPatchCall {
  3487. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  3488. return c
  3489. }
  3490. // UpdateMask sets the optional parameter "updateMask": Field mask that
  3491. // specifies the fields in sink that need an update. A sink field will
  3492. // be overwritten if, and only if, it is in the update mask. name and
  3493. // output only fields cannot be updated.An empty updateMask is
  3494. // temporarily treated as using the following mask for backwards
  3495. // compatibility purposes: destination,filter,includeChildren At some
  3496. // point in the future, behavior will be removed and specifying an empty
  3497. // updateMask will be an error.For a detailed FieldMask definition, see
  3498. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  3499. // updateMask=filter.
  3500. func (c *BillingAccountsSinksPatchCall) UpdateMask(updateMask string) *BillingAccountsSinksPatchCall {
  3501. c.urlParams_.Set("updateMask", updateMask)
  3502. return c
  3503. }
  3504. // Fields allows partial responses to be retrieved. See
  3505. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3506. // for more information.
  3507. func (c *BillingAccountsSinksPatchCall) Fields(s ...googleapi.Field) *BillingAccountsSinksPatchCall {
  3508. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3509. return c
  3510. }
  3511. // Context sets the context to be used in this call's Do method. Any
  3512. // pending HTTP request will be aborted if the provided context is
  3513. // canceled.
  3514. func (c *BillingAccountsSinksPatchCall) Context(ctx context.Context) *BillingAccountsSinksPatchCall {
  3515. c.ctx_ = ctx
  3516. return c
  3517. }
  3518. // Header returns an http.Header that can be modified by the caller to
  3519. // add HTTP headers to the request.
  3520. func (c *BillingAccountsSinksPatchCall) Header() http.Header {
  3521. if c.header_ == nil {
  3522. c.header_ = make(http.Header)
  3523. }
  3524. return c.header_
  3525. }
  3526. func (c *BillingAccountsSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  3527. reqHeaders := make(http.Header)
  3528. for k, v := range c.header_ {
  3529. reqHeaders[k] = v
  3530. }
  3531. reqHeaders.Set("User-Agent", c.s.userAgent())
  3532. var body io.Reader = nil
  3533. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3534. if err != nil {
  3535. return nil, err
  3536. }
  3537. reqHeaders.Set("Content-Type", "application/json")
  3538. c.urlParams_.Set("alt", alt)
  3539. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3540. urls += "?" + c.urlParams_.Encode()
  3541. req, _ := http.NewRequest("PATCH", urls, body)
  3542. req.Header = reqHeaders
  3543. googleapi.Expand(req.URL, map[string]string{
  3544. "sinkName": c.sinkNameid,
  3545. })
  3546. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3547. }
  3548. // Do executes the "logging.billingAccounts.sinks.patch" call.
  3549. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3550. // code is an error. Response headers are in either
  3551. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3552. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3553. // check whether the returned error was because http.StatusNotModified
  3554. // was returned.
  3555. func (c *BillingAccountsSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3556. gensupport.SetOptions(c.urlParams_, opts...)
  3557. res, err := c.doRequest("json")
  3558. if res != nil && res.StatusCode == http.StatusNotModified {
  3559. if res.Body != nil {
  3560. res.Body.Close()
  3561. }
  3562. return nil, &googleapi.Error{
  3563. Code: res.StatusCode,
  3564. Header: res.Header,
  3565. }
  3566. }
  3567. if err != nil {
  3568. return nil, err
  3569. }
  3570. defer googleapi.CloseBody(res)
  3571. if err := googleapi.CheckResponse(res); err != nil {
  3572. return nil, err
  3573. }
  3574. ret := &LogSink{
  3575. ServerResponse: googleapi.ServerResponse{
  3576. Header: res.Header,
  3577. HTTPStatusCode: res.StatusCode,
  3578. },
  3579. }
  3580. target := &ret
  3581. if err := gensupport.DecodeResponse(target, res); err != nil {
  3582. return nil, err
  3583. }
  3584. return ret, nil
  3585. // {
  3586. // "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.",
  3587. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3588. // "httpMethod": "PATCH",
  3589. // "id": "logging.billingAccounts.sinks.patch",
  3590. // "parameterOrder": [
  3591. // "sinkName"
  3592. // ],
  3593. // "parameters": {
  3594. // "sinkName": {
  3595. // "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\".",
  3596. // "location": "path",
  3597. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3598. // "required": true,
  3599. // "type": "string"
  3600. // },
  3601. // "uniqueWriterIdentity": {
  3602. // "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.",
  3603. // "location": "query",
  3604. // "type": "boolean"
  3605. // },
  3606. // "updateMask": {
  3607. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  3608. // "format": "google-fieldmask",
  3609. // "location": "query",
  3610. // "type": "string"
  3611. // }
  3612. // },
  3613. // "path": "v2/{+sinkName}",
  3614. // "request": {
  3615. // "$ref": "LogSink"
  3616. // },
  3617. // "response": {
  3618. // "$ref": "LogSink"
  3619. // },
  3620. // "scopes": [
  3621. // "https://www.googleapis.com/auth/cloud-platform",
  3622. // "https://www.googleapis.com/auth/logging.admin"
  3623. // ]
  3624. // }
  3625. }
  3626. // method id "logging.billingAccounts.sinks.update":
  3627. type BillingAccountsSinksUpdateCall struct {
  3628. s *Service
  3629. sinkNameid string
  3630. logsink *LogSink
  3631. urlParams_ gensupport.URLParams
  3632. ctx_ context.Context
  3633. header_ http.Header
  3634. }
  3635. // Update: Updates a sink. This method replaces the following fields in
  3636. // the existing sink with values from the new sink: destination, and
  3637. // filter. The updated sink might also have a new writer_identity; see
  3638. // the unique_writer_identity field.
  3639. func (r *BillingAccountsSinksService) Update(sinkNameid string, logsink *LogSink) *BillingAccountsSinksUpdateCall {
  3640. c := &BillingAccountsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3641. c.sinkNameid = sinkNameid
  3642. c.logsink = logsink
  3643. return c
  3644. }
  3645. // UniqueWriterIdentity sets the optional parameter
  3646. // "uniqueWriterIdentity": See sinks.create for a description of this
  3647. // field. When updating a sink, the effect of this field on the value of
  3648. // writer_identity in the updated sink depends on both the old and new
  3649. // values of this field:
  3650. // If the old and new values of this field are both false or both true,
  3651. // then there is no change to the sink's writer_identity.
  3652. // If the old value is false and the new value is true, then
  3653. // writer_identity is changed to a unique service account.
  3654. // It is an error if the old value is true and the new value is set to
  3655. // false or defaulted to false.
  3656. func (c *BillingAccountsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *BillingAccountsSinksUpdateCall {
  3657. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  3658. return c
  3659. }
  3660. // UpdateMask sets the optional parameter "updateMask": Field mask that
  3661. // specifies the fields in sink that need an update. A sink field will
  3662. // be overwritten if, and only if, it is in the update mask. name and
  3663. // output only fields cannot be updated.An empty updateMask is
  3664. // temporarily treated as using the following mask for backwards
  3665. // compatibility purposes: destination,filter,includeChildren At some
  3666. // point in the future, behavior will be removed and specifying an empty
  3667. // updateMask will be an error.For a detailed FieldMask definition, see
  3668. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  3669. // updateMask=filter.
  3670. func (c *BillingAccountsSinksUpdateCall) UpdateMask(updateMask string) *BillingAccountsSinksUpdateCall {
  3671. c.urlParams_.Set("updateMask", updateMask)
  3672. return c
  3673. }
  3674. // Fields allows partial responses to be retrieved. See
  3675. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3676. // for more information.
  3677. func (c *BillingAccountsSinksUpdateCall) Fields(s ...googleapi.Field) *BillingAccountsSinksUpdateCall {
  3678. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3679. return c
  3680. }
  3681. // Context sets the context to be used in this call's Do method. Any
  3682. // pending HTTP request will be aborted if the provided context is
  3683. // canceled.
  3684. func (c *BillingAccountsSinksUpdateCall) Context(ctx context.Context) *BillingAccountsSinksUpdateCall {
  3685. c.ctx_ = ctx
  3686. return c
  3687. }
  3688. // Header returns an http.Header that can be modified by the caller to
  3689. // add HTTP headers to the request.
  3690. func (c *BillingAccountsSinksUpdateCall) Header() http.Header {
  3691. if c.header_ == nil {
  3692. c.header_ = make(http.Header)
  3693. }
  3694. return c.header_
  3695. }
  3696. func (c *BillingAccountsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  3697. reqHeaders := make(http.Header)
  3698. for k, v := range c.header_ {
  3699. reqHeaders[k] = v
  3700. }
  3701. reqHeaders.Set("User-Agent", c.s.userAgent())
  3702. var body io.Reader = nil
  3703. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  3704. if err != nil {
  3705. return nil, err
  3706. }
  3707. reqHeaders.Set("Content-Type", "application/json")
  3708. c.urlParams_.Set("alt", alt)
  3709. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  3710. urls += "?" + c.urlParams_.Encode()
  3711. req, _ := http.NewRequest("PUT", urls, body)
  3712. req.Header = reqHeaders
  3713. googleapi.Expand(req.URL, map[string]string{
  3714. "sinkName": c.sinkNameid,
  3715. })
  3716. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3717. }
  3718. // Do executes the "logging.billingAccounts.sinks.update" call.
  3719. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  3720. // code is an error. Response headers are in either
  3721. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  3722. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3723. // check whether the returned error was because http.StatusNotModified
  3724. // was returned.
  3725. func (c *BillingAccountsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  3726. gensupport.SetOptions(c.urlParams_, opts...)
  3727. res, err := c.doRequest("json")
  3728. if res != nil && res.StatusCode == http.StatusNotModified {
  3729. if res.Body != nil {
  3730. res.Body.Close()
  3731. }
  3732. return nil, &googleapi.Error{
  3733. Code: res.StatusCode,
  3734. Header: res.Header,
  3735. }
  3736. }
  3737. if err != nil {
  3738. return nil, err
  3739. }
  3740. defer googleapi.CloseBody(res)
  3741. if err := googleapi.CheckResponse(res); err != nil {
  3742. return nil, err
  3743. }
  3744. ret := &LogSink{
  3745. ServerResponse: googleapi.ServerResponse{
  3746. Header: res.Header,
  3747. HTTPStatusCode: res.StatusCode,
  3748. },
  3749. }
  3750. target := &ret
  3751. if err := gensupport.DecodeResponse(target, res); err != nil {
  3752. return nil, err
  3753. }
  3754. return ret, nil
  3755. // {
  3756. // "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.",
  3757. // "flatPath": "v2/billingAccounts/{billingAccountsId}/sinks/{sinksId}",
  3758. // "httpMethod": "PUT",
  3759. // "id": "logging.billingAccounts.sinks.update",
  3760. // "parameterOrder": [
  3761. // "sinkName"
  3762. // ],
  3763. // "parameters": {
  3764. // "sinkName": {
  3765. // "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\".",
  3766. // "location": "path",
  3767. // "pattern": "^billingAccounts/[^/]+/sinks/[^/]+$",
  3768. // "required": true,
  3769. // "type": "string"
  3770. // },
  3771. // "uniqueWriterIdentity": {
  3772. // "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.",
  3773. // "location": "query",
  3774. // "type": "boolean"
  3775. // },
  3776. // "updateMask": {
  3777. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  3778. // "format": "google-fieldmask",
  3779. // "location": "query",
  3780. // "type": "string"
  3781. // }
  3782. // },
  3783. // "path": "v2/{+sinkName}",
  3784. // "request": {
  3785. // "$ref": "LogSink"
  3786. // },
  3787. // "response": {
  3788. // "$ref": "LogSink"
  3789. // },
  3790. // "scopes": [
  3791. // "https://www.googleapis.com/auth/cloud-platform",
  3792. // "https://www.googleapis.com/auth/logging.admin"
  3793. // ]
  3794. // }
  3795. }
  3796. // method id "logging.entries.list":
  3797. type EntriesListCall struct {
  3798. s *Service
  3799. listlogentriesrequest *ListLogEntriesRequest
  3800. urlParams_ gensupport.URLParams
  3801. ctx_ context.Context
  3802. header_ http.Header
  3803. }
  3804. // List: Lists log entries. Use this method to retrieve log entries from
  3805. // Stackdriver Logging. For ways to export log entries, see Exporting
  3806. // Logs.
  3807. func (r *EntriesService) List(listlogentriesrequest *ListLogEntriesRequest) *EntriesListCall {
  3808. c := &EntriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3809. c.listlogentriesrequest = listlogentriesrequest
  3810. return c
  3811. }
  3812. // Fields allows partial responses to be retrieved. See
  3813. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3814. // for more information.
  3815. func (c *EntriesListCall) Fields(s ...googleapi.Field) *EntriesListCall {
  3816. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3817. return c
  3818. }
  3819. // Context sets the context to be used in this call's Do method. Any
  3820. // pending HTTP request will be aborted if the provided context is
  3821. // canceled.
  3822. func (c *EntriesListCall) Context(ctx context.Context) *EntriesListCall {
  3823. c.ctx_ = ctx
  3824. return c
  3825. }
  3826. // Header returns an http.Header that can be modified by the caller to
  3827. // add HTTP headers to the request.
  3828. func (c *EntriesListCall) Header() http.Header {
  3829. if c.header_ == nil {
  3830. c.header_ = make(http.Header)
  3831. }
  3832. return c.header_
  3833. }
  3834. func (c *EntriesListCall) doRequest(alt string) (*http.Response, error) {
  3835. reqHeaders := make(http.Header)
  3836. for k, v := range c.header_ {
  3837. reqHeaders[k] = v
  3838. }
  3839. reqHeaders.Set("User-Agent", c.s.userAgent())
  3840. var body io.Reader = nil
  3841. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listlogentriesrequest)
  3842. if err != nil {
  3843. return nil, err
  3844. }
  3845. reqHeaders.Set("Content-Type", "application/json")
  3846. c.urlParams_.Set("alt", alt)
  3847. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/entries:list")
  3848. urls += "?" + c.urlParams_.Encode()
  3849. req, _ := http.NewRequest("POST", urls, body)
  3850. req.Header = reqHeaders
  3851. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3852. }
  3853. // Do executes the "logging.entries.list" call.
  3854. // Exactly one of *ListLogEntriesResponse or error will be non-nil. Any
  3855. // non-2xx status code is an error. Response headers are in either
  3856. // *ListLogEntriesResponse.ServerResponse.Header or (if a response was
  3857. // returned at all) in error.(*googleapi.Error).Header. Use
  3858. // googleapi.IsNotModified to check whether the returned error was
  3859. // because http.StatusNotModified was returned.
  3860. func (c *EntriesListCall) Do(opts ...googleapi.CallOption) (*ListLogEntriesResponse, error) {
  3861. gensupport.SetOptions(c.urlParams_, opts...)
  3862. res, err := c.doRequest("json")
  3863. if res != nil && res.StatusCode == http.StatusNotModified {
  3864. if res.Body != nil {
  3865. res.Body.Close()
  3866. }
  3867. return nil, &googleapi.Error{
  3868. Code: res.StatusCode,
  3869. Header: res.Header,
  3870. }
  3871. }
  3872. if err != nil {
  3873. return nil, err
  3874. }
  3875. defer googleapi.CloseBody(res)
  3876. if err := googleapi.CheckResponse(res); err != nil {
  3877. return nil, err
  3878. }
  3879. ret := &ListLogEntriesResponse{
  3880. ServerResponse: googleapi.ServerResponse{
  3881. Header: res.Header,
  3882. HTTPStatusCode: res.StatusCode,
  3883. },
  3884. }
  3885. target := &ret
  3886. if err := gensupport.DecodeResponse(target, res); err != nil {
  3887. return nil, err
  3888. }
  3889. return ret, nil
  3890. // {
  3891. // "description": "Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs.",
  3892. // "flatPath": "v2/entries:list",
  3893. // "httpMethod": "POST",
  3894. // "id": "logging.entries.list",
  3895. // "parameterOrder": [],
  3896. // "parameters": {},
  3897. // "path": "v2/entries:list",
  3898. // "request": {
  3899. // "$ref": "ListLogEntriesRequest"
  3900. // },
  3901. // "response": {
  3902. // "$ref": "ListLogEntriesResponse"
  3903. // },
  3904. // "scopes": [
  3905. // "https://www.googleapis.com/auth/cloud-platform",
  3906. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  3907. // "https://www.googleapis.com/auth/logging.admin",
  3908. // "https://www.googleapis.com/auth/logging.read"
  3909. // ]
  3910. // }
  3911. }
  3912. // Pages invokes f for each page of results.
  3913. // A non-nil error returned from f will halt the iteration.
  3914. // The provided context supersedes any context provided to the Context method.
  3915. func (c *EntriesListCall) Pages(ctx context.Context, f func(*ListLogEntriesResponse) error) error {
  3916. c.ctx_ = ctx
  3917. defer func(pt string) { c.listlogentriesrequest.PageToken = pt }(c.listlogentriesrequest.PageToken) // reset paging to original point
  3918. for {
  3919. x, err := c.Do()
  3920. if err != nil {
  3921. return err
  3922. }
  3923. if err := f(x); err != nil {
  3924. return err
  3925. }
  3926. if x.NextPageToken == "" {
  3927. return nil
  3928. }
  3929. c.listlogentriesrequest.PageToken = x.NextPageToken
  3930. }
  3931. }
  3932. // method id "logging.entries.write":
  3933. type EntriesWriteCall struct {
  3934. s *Service
  3935. writelogentriesrequest *WriteLogEntriesRequest
  3936. urlParams_ gensupport.URLParams
  3937. ctx_ context.Context
  3938. header_ http.Header
  3939. }
  3940. // Write: Writes log entries to Stackdriver Logging. This API method is
  3941. // the only way to send log entries to Stackdriver Logging. This method
  3942. // is used, directly or indirectly, by the Stackdriver Logging agent
  3943. // (fluentd) and all logging libraries configured to use Stackdriver
  3944. // Logging. A single request may contain log entries for a maximum of
  3945. // 1000 different resources (projects, organizations, billing accounts
  3946. // or folders)
  3947. func (r *EntriesService) Write(writelogentriesrequest *WriteLogEntriesRequest) *EntriesWriteCall {
  3948. c := &EntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3949. c.writelogentriesrequest = writelogentriesrequest
  3950. return c
  3951. }
  3952. // Fields allows partial responses to be retrieved. See
  3953. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3954. // for more information.
  3955. func (c *EntriesWriteCall) Fields(s ...googleapi.Field) *EntriesWriteCall {
  3956. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3957. return c
  3958. }
  3959. // Context sets the context to be used in this call's Do method. Any
  3960. // pending HTTP request will be aborted if the provided context is
  3961. // canceled.
  3962. func (c *EntriesWriteCall) Context(ctx context.Context) *EntriesWriteCall {
  3963. c.ctx_ = ctx
  3964. return c
  3965. }
  3966. // Header returns an http.Header that can be modified by the caller to
  3967. // add HTTP headers to the request.
  3968. func (c *EntriesWriteCall) Header() http.Header {
  3969. if c.header_ == nil {
  3970. c.header_ = make(http.Header)
  3971. }
  3972. return c.header_
  3973. }
  3974. func (c *EntriesWriteCall) doRequest(alt string) (*http.Response, error) {
  3975. reqHeaders := make(http.Header)
  3976. for k, v := range c.header_ {
  3977. reqHeaders[k] = v
  3978. }
  3979. reqHeaders.Set("User-Agent", c.s.userAgent())
  3980. var body io.Reader = nil
  3981. body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
  3982. if err != nil {
  3983. return nil, err
  3984. }
  3985. reqHeaders.Set("Content-Type", "application/json")
  3986. c.urlParams_.Set("alt", alt)
  3987. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/entries:write")
  3988. urls += "?" + c.urlParams_.Encode()
  3989. req, _ := http.NewRequest("POST", urls, body)
  3990. req.Header = reqHeaders
  3991. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3992. }
  3993. // Do executes the "logging.entries.write" call.
  3994. // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any
  3995. // non-2xx status code is an error. Response headers are in either
  3996. // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
  3997. // returned at all) in error.(*googleapi.Error).Header. Use
  3998. // googleapi.IsNotModified to check whether the returned error was
  3999. // because http.StatusNotModified was returned.
  4000. func (c *EntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
  4001. gensupport.SetOptions(c.urlParams_, opts...)
  4002. res, err := c.doRequest("json")
  4003. if res != nil && res.StatusCode == http.StatusNotModified {
  4004. if res.Body != nil {
  4005. res.Body.Close()
  4006. }
  4007. return nil, &googleapi.Error{
  4008. Code: res.StatusCode,
  4009. Header: res.Header,
  4010. }
  4011. }
  4012. if err != nil {
  4013. return nil, err
  4014. }
  4015. defer googleapi.CloseBody(res)
  4016. if err := googleapi.CheckResponse(res); err != nil {
  4017. return nil, err
  4018. }
  4019. ret := &WriteLogEntriesResponse{
  4020. ServerResponse: googleapi.ServerResponse{
  4021. Header: res.Header,
  4022. HTTPStatusCode: res.StatusCode,
  4023. },
  4024. }
  4025. target := &ret
  4026. if err := gensupport.DecodeResponse(target, res); err != nil {
  4027. return nil, err
  4028. }
  4029. return ret, nil
  4030. // {
  4031. // "description": "Writes log entries to Stackdriver Logging. This API method is the only way to send log entries to Stackdriver Logging. This method is used, directly or indirectly, by the Stackdriver Logging agent (fluentd) and all logging libraries configured to use Stackdriver Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)",
  4032. // "flatPath": "v2/entries:write",
  4033. // "httpMethod": "POST",
  4034. // "id": "logging.entries.write",
  4035. // "parameterOrder": [],
  4036. // "parameters": {},
  4037. // "path": "v2/entries:write",
  4038. // "request": {
  4039. // "$ref": "WriteLogEntriesRequest"
  4040. // },
  4041. // "response": {
  4042. // "$ref": "WriteLogEntriesResponse"
  4043. // },
  4044. // "scopes": [
  4045. // "https://www.googleapis.com/auth/cloud-platform",
  4046. // "https://www.googleapis.com/auth/logging.admin",
  4047. // "https://www.googleapis.com/auth/logging.write"
  4048. // ]
  4049. // }
  4050. }
  4051. // method id "logging.exclusions.create":
  4052. type ExclusionsCreateCall struct {
  4053. s *Service
  4054. parent string
  4055. logexclusion *LogExclusion
  4056. urlParams_ gensupport.URLParams
  4057. ctx_ context.Context
  4058. header_ http.Header
  4059. }
  4060. // Create: Creates a new exclusion in a specified parent resource. Only
  4061. // log entries belonging to that resource can be excluded. You can have
  4062. // up to 10 exclusions in a resource.
  4063. func (r *ExclusionsService) Create(parent string, logexclusion *LogExclusion) *ExclusionsCreateCall {
  4064. c := &ExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4065. c.parent = parent
  4066. c.logexclusion = logexclusion
  4067. return c
  4068. }
  4069. // Fields allows partial responses to be retrieved. See
  4070. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4071. // for more information.
  4072. func (c *ExclusionsCreateCall) Fields(s ...googleapi.Field) *ExclusionsCreateCall {
  4073. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4074. return c
  4075. }
  4076. // Context sets the context to be used in this call's Do method. Any
  4077. // pending HTTP request will be aborted if the provided context is
  4078. // canceled.
  4079. func (c *ExclusionsCreateCall) Context(ctx context.Context) *ExclusionsCreateCall {
  4080. c.ctx_ = ctx
  4081. return c
  4082. }
  4083. // Header returns an http.Header that can be modified by the caller to
  4084. // add HTTP headers to the request.
  4085. func (c *ExclusionsCreateCall) Header() http.Header {
  4086. if c.header_ == nil {
  4087. c.header_ = make(http.Header)
  4088. }
  4089. return c.header_
  4090. }
  4091. func (c *ExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  4092. reqHeaders := make(http.Header)
  4093. for k, v := range c.header_ {
  4094. reqHeaders[k] = v
  4095. }
  4096. reqHeaders.Set("User-Agent", c.s.userAgent())
  4097. var body io.Reader = nil
  4098. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  4099. if err != nil {
  4100. return nil, err
  4101. }
  4102. reqHeaders.Set("Content-Type", "application/json")
  4103. c.urlParams_.Set("alt", alt)
  4104. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  4105. urls += "?" + c.urlParams_.Encode()
  4106. req, _ := http.NewRequest("POST", urls, body)
  4107. req.Header = reqHeaders
  4108. googleapi.Expand(req.URL, map[string]string{
  4109. "parent": c.parent,
  4110. })
  4111. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4112. }
  4113. // Do executes the "logging.exclusions.create" call.
  4114. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  4115. // status code is an error. Response headers are in either
  4116. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  4117. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4118. // to check whether the returned error was because
  4119. // http.StatusNotModified was returned.
  4120. func (c *ExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  4121. gensupport.SetOptions(c.urlParams_, opts...)
  4122. res, err := c.doRequest("json")
  4123. if res != nil && res.StatusCode == http.StatusNotModified {
  4124. if res.Body != nil {
  4125. res.Body.Close()
  4126. }
  4127. return nil, &googleapi.Error{
  4128. Code: res.StatusCode,
  4129. Header: res.Header,
  4130. }
  4131. }
  4132. if err != nil {
  4133. return nil, err
  4134. }
  4135. defer googleapi.CloseBody(res)
  4136. if err := googleapi.CheckResponse(res); err != nil {
  4137. return nil, err
  4138. }
  4139. ret := &LogExclusion{
  4140. ServerResponse: googleapi.ServerResponse{
  4141. Header: res.Header,
  4142. HTTPStatusCode: res.StatusCode,
  4143. },
  4144. }
  4145. target := &ret
  4146. if err := gensupport.DecodeResponse(target, res); err != nil {
  4147. return nil, err
  4148. }
  4149. return ret, nil
  4150. // {
  4151. // "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.",
  4152. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions",
  4153. // "httpMethod": "POST",
  4154. // "id": "logging.exclusions.create",
  4155. // "parameterOrder": [
  4156. // "parent"
  4157. // ],
  4158. // "parameters": {
  4159. // "parent": {
  4160. // "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\".",
  4161. // "location": "path",
  4162. // "pattern": "^[^/]+/[^/]+$",
  4163. // "required": true,
  4164. // "type": "string"
  4165. // }
  4166. // },
  4167. // "path": "v2/{+parent}/exclusions",
  4168. // "request": {
  4169. // "$ref": "LogExclusion"
  4170. // },
  4171. // "response": {
  4172. // "$ref": "LogExclusion"
  4173. // },
  4174. // "scopes": [
  4175. // "https://www.googleapis.com/auth/cloud-platform",
  4176. // "https://www.googleapis.com/auth/logging.admin"
  4177. // ]
  4178. // }
  4179. }
  4180. // method id "logging.exclusions.delete":
  4181. type ExclusionsDeleteCall struct {
  4182. s *Service
  4183. name string
  4184. urlParams_ gensupport.URLParams
  4185. ctx_ context.Context
  4186. header_ http.Header
  4187. }
  4188. // Delete: Deletes an exclusion.
  4189. func (r *ExclusionsService) Delete(name string) *ExclusionsDeleteCall {
  4190. c := &ExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4191. c.name = name
  4192. return c
  4193. }
  4194. // Fields allows partial responses to be retrieved. See
  4195. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4196. // for more information.
  4197. func (c *ExclusionsDeleteCall) Fields(s ...googleapi.Field) *ExclusionsDeleteCall {
  4198. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4199. return c
  4200. }
  4201. // Context sets the context to be used in this call's Do method. Any
  4202. // pending HTTP request will be aborted if the provided context is
  4203. // canceled.
  4204. func (c *ExclusionsDeleteCall) Context(ctx context.Context) *ExclusionsDeleteCall {
  4205. c.ctx_ = ctx
  4206. return c
  4207. }
  4208. // Header returns an http.Header that can be modified by the caller to
  4209. // add HTTP headers to the request.
  4210. func (c *ExclusionsDeleteCall) Header() http.Header {
  4211. if c.header_ == nil {
  4212. c.header_ = make(http.Header)
  4213. }
  4214. return c.header_
  4215. }
  4216. func (c *ExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4217. reqHeaders := make(http.Header)
  4218. for k, v := range c.header_ {
  4219. reqHeaders[k] = v
  4220. }
  4221. reqHeaders.Set("User-Agent", c.s.userAgent())
  4222. var body io.Reader = nil
  4223. c.urlParams_.Set("alt", alt)
  4224. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  4225. urls += "?" + c.urlParams_.Encode()
  4226. req, _ := http.NewRequest("DELETE", urls, body)
  4227. req.Header = reqHeaders
  4228. googleapi.Expand(req.URL, map[string]string{
  4229. "name": c.name,
  4230. })
  4231. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4232. }
  4233. // Do executes the "logging.exclusions.delete" call.
  4234. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4235. // code is an error. Response headers are in either
  4236. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4237. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4238. // check whether the returned error was because http.StatusNotModified
  4239. // was returned.
  4240. func (c *ExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4241. gensupport.SetOptions(c.urlParams_, opts...)
  4242. res, err := c.doRequest("json")
  4243. if res != nil && res.StatusCode == http.StatusNotModified {
  4244. if res.Body != nil {
  4245. res.Body.Close()
  4246. }
  4247. return nil, &googleapi.Error{
  4248. Code: res.StatusCode,
  4249. Header: res.Header,
  4250. }
  4251. }
  4252. if err != nil {
  4253. return nil, err
  4254. }
  4255. defer googleapi.CloseBody(res)
  4256. if err := googleapi.CheckResponse(res); err != nil {
  4257. return nil, err
  4258. }
  4259. ret := &Empty{
  4260. ServerResponse: googleapi.ServerResponse{
  4261. Header: res.Header,
  4262. HTTPStatusCode: res.StatusCode,
  4263. },
  4264. }
  4265. target := &ret
  4266. if err := gensupport.DecodeResponse(target, res); err != nil {
  4267. return nil, err
  4268. }
  4269. return ret, nil
  4270. // {
  4271. // "description": "Deletes an exclusion.",
  4272. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions/{exclusionsId}",
  4273. // "httpMethod": "DELETE",
  4274. // "id": "logging.exclusions.delete",
  4275. // "parameterOrder": [
  4276. // "name"
  4277. // ],
  4278. // "parameters": {
  4279. // "name": {
  4280. // "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\".",
  4281. // "location": "path",
  4282. // "pattern": "^[^/]+/[^/]+/exclusions/[^/]+$",
  4283. // "required": true,
  4284. // "type": "string"
  4285. // }
  4286. // },
  4287. // "path": "v2/{+name}",
  4288. // "response": {
  4289. // "$ref": "Empty"
  4290. // },
  4291. // "scopes": [
  4292. // "https://www.googleapis.com/auth/cloud-platform",
  4293. // "https://www.googleapis.com/auth/logging.admin"
  4294. // ]
  4295. // }
  4296. }
  4297. // method id "logging.exclusions.get":
  4298. type ExclusionsGetCall struct {
  4299. s *Service
  4300. name string
  4301. urlParams_ gensupport.URLParams
  4302. ifNoneMatch_ string
  4303. ctx_ context.Context
  4304. header_ http.Header
  4305. }
  4306. // Get: Gets the description of an exclusion.
  4307. func (r *ExclusionsService) Get(name string) *ExclusionsGetCall {
  4308. c := &ExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4309. c.name = name
  4310. return c
  4311. }
  4312. // Fields allows partial responses to be retrieved. See
  4313. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4314. // for more information.
  4315. func (c *ExclusionsGetCall) Fields(s ...googleapi.Field) *ExclusionsGetCall {
  4316. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4317. return c
  4318. }
  4319. // IfNoneMatch sets the optional parameter which makes the operation
  4320. // fail if the object's ETag matches the given value. This is useful for
  4321. // getting updates only after the object has changed since the last
  4322. // request. Use googleapi.IsNotModified to check whether the response
  4323. // error from Do is the result of In-None-Match.
  4324. func (c *ExclusionsGetCall) IfNoneMatch(entityTag string) *ExclusionsGetCall {
  4325. c.ifNoneMatch_ = entityTag
  4326. return c
  4327. }
  4328. // Context sets the context to be used in this call's Do method. Any
  4329. // pending HTTP request will be aborted if the provided context is
  4330. // canceled.
  4331. func (c *ExclusionsGetCall) Context(ctx context.Context) *ExclusionsGetCall {
  4332. c.ctx_ = ctx
  4333. return c
  4334. }
  4335. // Header returns an http.Header that can be modified by the caller to
  4336. // add HTTP headers to the request.
  4337. func (c *ExclusionsGetCall) Header() http.Header {
  4338. if c.header_ == nil {
  4339. c.header_ = make(http.Header)
  4340. }
  4341. return c.header_
  4342. }
  4343. func (c *ExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  4344. reqHeaders := make(http.Header)
  4345. for k, v := range c.header_ {
  4346. reqHeaders[k] = v
  4347. }
  4348. reqHeaders.Set("User-Agent", c.s.userAgent())
  4349. if c.ifNoneMatch_ != "" {
  4350. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4351. }
  4352. var body io.Reader = nil
  4353. c.urlParams_.Set("alt", alt)
  4354. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  4355. urls += "?" + c.urlParams_.Encode()
  4356. req, _ := http.NewRequest("GET", urls, body)
  4357. req.Header = reqHeaders
  4358. googleapi.Expand(req.URL, map[string]string{
  4359. "name": c.name,
  4360. })
  4361. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4362. }
  4363. // Do executes the "logging.exclusions.get" call.
  4364. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  4365. // status code is an error. Response headers are in either
  4366. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  4367. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4368. // to check whether the returned error was because
  4369. // http.StatusNotModified was returned.
  4370. func (c *ExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  4371. gensupport.SetOptions(c.urlParams_, opts...)
  4372. res, err := c.doRequest("json")
  4373. if res != nil && res.StatusCode == http.StatusNotModified {
  4374. if res.Body != nil {
  4375. res.Body.Close()
  4376. }
  4377. return nil, &googleapi.Error{
  4378. Code: res.StatusCode,
  4379. Header: res.Header,
  4380. }
  4381. }
  4382. if err != nil {
  4383. return nil, err
  4384. }
  4385. defer googleapi.CloseBody(res)
  4386. if err := googleapi.CheckResponse(res); err != nil {
  4387. return nil, err
  4388. }
  4389. ret := &LogExclusion{
  4390. ServerResponse: googleapi.ServerResponse{
  4391. Header: res.Header,
  4392. HTTPStatusCode: res.StatusCode,
  4393. },
  4394. }
  4395. target := &ret
  4396. if err := gensupport.DecodeResponse(target, res); err != nil {
  4397. return nil, err
  4398. }
  4399. return ret, nil
  4400. // {
  4401. // "description": "Gets the description of an exclusion.",
  4402. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions/{exclusionsId}",
  4403. // "httpMethod": "GET",
  4404. // "id": "logging.exclusions.get",
  4405. // "parameterOrder": [
  4406. // "name"
  4407. // ],
  4408. // "parameters": {
  4409. // "name": {
  4410. // "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\".",
  4411. // "location": "path",
  4412. // "pattern": "^[^/]+/[^/]+/exclusions/[^/]+$",
  4413. // "required": true,
  4414. // "type": "string"
  4415. // }
  4416. // },
  4417. // "path": "v2/{+name}",
  4418. // "response": {
  4419. // "$ref": "LogExclusion"
  4420. // },
  4421. // "scopes": [
  4422. // "https://www.googleapis.com/auth/cloud-platform",
  4423. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4424. // "https://www.googleapis.com/auth/logging.admin",
  4425. // "https://www.googleapis.com/auth/logging.read"
  4426. // ]
  4427. // }
  4428. }
  4429. // method id "logging.exclusions.list":
  4430. type ExclusionsListCall struct {
  4431. s *Service
  4432. parent string
  4433. urlParams_ gensupport.URLParams
  4434. ifNoneMatch_ string
  4435. ctx_ context.Context
  4436. header_ http.Header
  4437. }
  4438. // List: Lists all the exclusions in a parent resource.
  4439. func (r *ExclusionsService) List(parent string) *ExclusionsListCall {
  4440. c := &ExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4441. c.parent = parent
  4442. return c
  4443. }
  4444. // PageSize sets the optional parameter "pageSize": The maximum number
  4445. // of results to return from this request. Non-positive values are
  4446. // ignored. The presence of nextPageToken in the response indicates that
  4447. // more results might be available.
  4448. func (c *ExclusionsListCall) PageSize(pageSize int64) *ExclusionsListCall {
  4449. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4450. return c
  4451. }
  4452. // PageToken sets the optional parameter "pageToken": If present, then
  4453. // retrieve the next batch of results from the preceding call to this
  4454. // method. pageToken must be the value of nextPageToken from the
  4455. // previous response. The values of other method parameters should be
  4456. // identical to those in the previous call.
  4457. func (c *ExclusionsListCall) PageToken(pageToken string) *ExclusionsListCall {
  4458. c.urlParams_.Set("pageToken", pageToken)
  4459. return c
  4460. }
  4461. // Fields allows partial responses to be retrieved. See
  4462. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4463. // for more information.
  4464. func (c *ExclusionsListCall) Fields(s ...googleapi.Field) *ExclusionsListCall {
  4465. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4466. return c
  4467. }
  4468. // IfNoneMatch sets the optional parameter which makes the operation
  4469. // fail if the object's ETag matches the given value. This is useful for
  4470. // getting updates only after the object has changed since the last
  4471. // request. Use googleapi.IsNotModified to check whether the response
  4472. // error from Do is the result of In-None-Match.
  4473. func (c *ExclusionsListCall) IfNoneMatch(entityTag string) *ExclusionsListCall {
  4474. c.ifNoneMatch_ = entityTag
  4475. return c
  4476. }
  4477. // Context sets the context to be used in this call's Do method. Any
  4478. // pending HTTP request will be aborted if the provided context is
  4479. // canceled.
  4480. func (c *ExclusionsListCall) Context(ctx context.Context) *ExclusionsListCall {
  4481. c.ctx_ = ctx
  4482. return c
  4483. }
  4484. // Header returns an http.Header that can be modified by the caller to
  4485. // add HTTP headers to the request.
  4486. func (c *ExclusionsListCall) Header() http.Header {
  4487. if c.header_ == nil {
  4488. c.header_ = make(http.Header)
  4489. }
  4490. return c.header_
  4491. }
  4492. func (c *ExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  4493. reqHeaders := make(http.Header)
  4494. for k, v := range c.header_ {
  4495. reqHeaders[k] = v
  4496. }
  4497. reqHeaders.Set("User-Agent", c.s.userAgent())
  4498. if c.ifNoneMatch_ != "" {
  4499. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4500. }
  4501. var body io.Reader = nil
  4502. c.urlParams_.Set("alt", alt)
  4503. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  4504. urls += "?" + c.urlParams_.Encode()
  4505. req, _ := http.NewRequest("GET", urls, body)
  4506. req.Header = reqHeaders
  4507. googleapi.Expand(req.URL, map[string]string{
  4508. "parent": c.parent,
  4509. })
  4510. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4511. }
  4512. // Do executes the "logging.exclusions.list" call.
  4513. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  4514. // non-2xx status code is an error. Response headers are in either
  4515. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  4516. // returned at all) in error.(*googleapi.Error).Header. Use
  4517. // googleapi.IsNotModified to check whether the returned error was
  4518. // because http.StatusNotModified was returned.
  4519. func (c *ExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  4520. gensupport.SetOptions(c.urlParams_, opts...)
  4521. res, err := c.doRequest("json")
  4522. if res != nil && res.StatusCode == http.StatusNotModified {
  4523. if res.Body != nil {
  4524. res.Body.Close()
  4525. }
  4526. return nil, &googleapi.Error{
  4527. Code: res.StatusCode,
  4528. Header: res.Header,
  4529. }
  4530. }
  4531. if err != nil {
  4532. return nil, err
  4533. }
  4534. defer googleapi.CloseBody(res)
  4535. if err := googleapi.CheckResponse(res); err != nil {
  4536. return nil, err
  4537. }
  4538. ret := &ListExclusionsResponse{
  4539. ServerResponse: googleapi.ServerResponse{
  4540. Header: res.Header,
  4541. HTTPStatusCode: res.StatusCode,
  4542. },
  4543. }
  4544. target := &ret
  4545. if err := gensupport.DecodeResponse(target, res); err != nil {
  4546. return nil, err
  4547. }
  4548. return ret, nil
  4549. // {
  4550. // "description": "Lists all the exclusions in a parent resource.",
  4551. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions",
  4552. // "httpMethod": "GET",
  4553. // "id": "logging.exclusions.list",
  4554. // "parameterOrder": [
  4555. // "parent"
  4556. // ],
  4557. // "parameters": {
  4558. // "pageSize": {
  4559. // "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.",
  4560. // "format": "int32",
  4561. // "location": "query",
  4562. // "type": "integer"
  4563. // },
  4564. // "pageToken": {
  4565. // "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.",
  4566. // "location": "query",
  4567. // "type": "string"
  4568. // },
  4569. // "parent": {
  4570. // "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",
  4571. // "location": "path",
  4572. // "pattern": "^[^/]+/[^/]+$",
  4573. // "required": true,
  4574. // "type": "string"
  4575. // }
  4576. // },
  4577. // "path": "v2/{+parent}/exclusions",
  4578. // "response": {
  4579. // "$ref": "ListExclusionsResponse"
  4580. // },
  4581. // "scopes": [
  4582. // "https://www.googleapis.com/auth/cloud-platform",
  4583. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  4584. // "https://www.googleapis.com/auth/logging.admin",
  4585. // "https://www.googleapis.com/auth/logging.read"
  4586. // ]
  4587. // }
  4588. }
  4589. // Pages invokes f for each page of results.
  4590. // A non-nil error returned from f will halt the iteration.
  4591. // The provided context supersedes any context provided to the Context method.
  4592. func (c *ExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  4593. c.ctx_ = ctx
  4594. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4595. for {
  4596. x, err := c.Do()
  4597. if err != nil {
  4598. return err
  4599. }
  4600. if err := f(x); err != nil {
  4601. return err
  4602. }
  4603. if x.NextPageToken == "" {
  4604. return nil
  4605. }
  4606. c.PageToken(x.NextPageToken)
  4607. }
  4608. }
  4609. // method id "logging.exclusions.patch":
  4610. type ExclusionsPatchCall struct {
  4611. s *Service
  4612. name string
  4613. logexclusion *LogExclusion
  4614. urlParams_ gensupport.URLParams
  4615. ctx_ context.Context
  4616. header_ http.Header
  4617. }
  4618. // Patch: Changes one or more properties of an existing exclusion.
  4619. func (r *ExclusionsService) Patch(name string, logexclusion *LogExclusion) *ExclusionsPatchCall {
  4620. c := &ExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4621. c.name = name
  4622. c.logexclusion = logexclusion
  4623. return c
  4624. }
  4625. // UpdateMask sets the optional parameter "updateMask": Required. A
  4626. // nonempty list of fields to change in the existing exclusion. New
  4627. // values for the fields are taken from the corresponding fields in the
  4628. // LogExclusion included in this request. Fields not mentioned in
  4629. // update_mask are not changed and are ignored in the request.For
  4630. // example, to change the filter and description of an exclusion,
  4631. // specify an update_mask of "filter,description".
  4632. func (c *ExclusionsPatchCall) UpdateMask(updateMask string) *ExclusionsPatchCall {
  4633. c.urlParams_.Set("updateMask", updateMask)
  4634. return c
  4635. }
  4636. // Fields allows partial responses to be retrieved. See
  4637. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4638. // for more information.
  4639. func (c *ExclusionsPatchCall) Fields(s ...googleapi.Field) *ExclusionsPatchCall {
  4640. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4641. return c
  4642. }
  4643. // Context sets the context to be used in this call's Do method. Any
  4644. // pending HTTP request will be aborted if the provided context is
  4645. // canceled.
  4646. func (c *ExclusionsPatchCall) Context(ctx context.Context) *ExclusionsPatchCall {
  4647. c.ctx_ = ctx
  4648. return c
  4649. }
  4650. // Header returns an http.Header that can be modified by the caller to
  4651. // add HTTP headers to the request.
  4652. func (c *ExclusionsPatchCall) Header() http.Header {
  4653. if c.header_ == nil {
  4654. c.header_ = make(http.Header)
  4655. }
  4656. return c.header_
  4657. }
  4658. func (c *ExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  4659. reqHeaders := make(http.Header)
  4660. for k, v := range c.header_ {
  4661. reqHeaders[k] = v
  4662. }
  4663. reqHeaders.Set("User-Agent", c.s.userAgent())
  4664. var body io.Reader = nil
  4665. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  4666. if err != nil {
  4667. return nil, err
  4668. }
  4669. reqHeaders.Set("Content-Type", "application/json")
  4670. c.urlParams_.Set("alt", alt)
  4671. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  4672. urls += "?" + c.urlParams_.Encode()
  4673. req, _ := http.NewRequest("PATCH", urls, body)
  4674. req.Header = reqHeaders
  4675. googleapi.Expand(req.URL, map[string]string{
  4676. "name": c.name,
  4677. })
  4678. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4679. }
  4680. // Do executes the "logging.exclusions.patch" call.
  4681. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  4682. // status code is an error. Response headers are in either
  4683. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  4684. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4685. // to check whether the returned error was because
  4686. // http.StatusNotModified was returned.
  4687. func (c *ExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  4688. gensupport.SetOptions(c.urlParams_, opts...)
  4689. res, err := c.doRequest("json")
  4690. if res != nil && res.StatusCode == http.StatusNotModified {
  4691. if res.Body != nil {
  4692. res.Body.Close()
  4693. }
  4694. return nil, &googleapi.Error{
  4695. Code: res.StatusCode,
  4696. Header: res.Header,
  4697. }
  4698. }
  4699. if err != nil {
  4700. return nil, err
  4701. }
  4702. defer googleapi.CloseBody(res)
  4703. if err := googleapi.CheckResponse(res); err != nil {
  4704. return nil, err
  4705. }
  4706. ret := &LogExclusion{
  4707. ServerResponse: googleapi.ServerResponse{
  4708. Header: res.Header,
  4709. HTTPStatusCode: res.StatusCode,
  4710. },
  4711. }
  4712. target := &ret
  4713. if err := gensupport.DecodeResponse(target, res); err != nil {
  4714. return nil, err
  4715. }
  4716. return ret, nil
  4717. // {
  4718. // "description": "Changes one or more properties of an existing exclusion.",
  4719. // "flatPath": "v2/{v2Id}/{v2Id1}/exclusions/{exclusionsId}",
  4720. // "httpMethod": "PATCH",
  4721. // "id": "logging.exclusions.patch",
  4722. // "parameterOrder": [
  4723. // "name"
  4724. // ],
  4725. // "parameters": {
  4726. // "name": {
  4727. // "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\".",
  4728. // "location": "path",
  4729. // "pattern": "^[^/]+/[^/]+/exclusions/[^/]+$",
  4730. // "required": true,
  4731. // "type": "string"
  4732. // },
  4733. // "updateMask": {
  4734. // "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\".",
  4735. // "format": "google-fieldmask",
  4736. // "location": "query",
  4737. // "type": "string"
  4738. // }
  4739. // },
  4740. // "path": "v2/{+name}",
  4741. // "request": {
  4742. // "$ref": "LogExclusion"
  4743. // },
  4744. // "response": {
  4745. // "$ref": "LogExclusion"
  4746. // },
  4747. // "scopes": [
  4748. // "https://www.googleapis.com/auth/cloud-platform",
  4749. // "https://www.googleapis.com/auth/logging.admin"
  4750. // ]
  4751. // }
  4752. }
  4753. // method id "logging.folders.exclusions.create":
  4754. type FoldersExclusionsCreateCall struct {
  4755. s *Service
  4756. parent string
  4757. logexclusion *LogExclusion
  4758. urlParams_ gensupport.URLParams
  4759. ctx_ context.Context
  4760. header_ http.Header
  4761. }
  4762. // Create: Creates a new exclusion in a specified parent resource. Only
  4763. // log entries belonging to that resource can be excluded. You can have
  4764. // up to 10 exclusions in a resource.
  4765. func (r *FoldersExclusionsService) Create(parent string, logexclusion *LogExclusion) *FoldersExclusionsCreateCall {
  4766. c := &FoldersExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4767. c.parent = parent
  4768. c.logexclusion = logexclusion
  4769. return c
  4770. }
  4771. // Fields allows partial responses to be retrieved. See
  4772. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4773. // for more information.
  4774. func (c *FoldersExclusionsCreateCall) Fields(s ...googleapi.Field) *FoldersExclusionsCreateCall {
  4775. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4776. return c
  4777. }
  4778. // Context sets the context to be used in this call's Do method. Any
  4779. // pending HTTP request will be aborted if the provided context is
  4780. // canceled.
  4781. func (c *FoldersExclusionsCreateCall) Context(ctx context.Context) *FoldersExclusionsCreateCall {
  4782. c.ctx_ = ctx
  4783. return c
  4784. }
  4785. // Header returns an http.Header that can be modified by the caller to
  4786. // add HTTP headers to the request.
  4787. func (c *FoldersExclusionsCreateCall) Header() http.Header {
  4788. if c.header_ == nil {
  4789. c.header_ = make(http.Header)
  4790. }
  4791. return c.header_
  4792. }
  4793. func (c *FoldersExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  4794. reqHeaders := make(http.Header)
  4795. for k, v := range c.header_ {
  4796. reqHeaders[k] = v
  4797. }
  4798. reqHeaders.Set("User-Agent", c.s.userAgent())
  4799. var body io.Reader = nil
  4800. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  4801. if err != nil {
  4802. return nil, err
  4803. }
  4804. reqHeaders.Set("Content-Type", "application/json")
  4805. c.urlParams_.Set("alt", alt)
  4806. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  4807. urls += "?" + c.urlParams_.Encode()
  4808. req, _ := http.NewRequest("POST", urls, body)
  4809. req.Header = reqHeaders
  4810. googleapi.Expand(req.URL, map[string]string{
  4811. "parent": c.parent,
  4812. })
  4813. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4814. }
  4815. // Do executes the "logging.folders.exclusions.create" call.
  4816. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  4817. // status code is an error. Response headers are in either
  4818. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  4819. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4820. // to check whether the returned error was because
  4821. // http.StatusNotModified was returned.
  4822. func (c *FoldersExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  4823. gensupport.SetOptions(c.urlParams_, opts...)
  4824. res, err := c.doRequest("json")
  4825. if res != nil && res.StatusCode == http.StatusNotModified {
  4826. if res.Body != nil {
  4827. res.Body.Close()
  4828. }
  4829. return nil, &googleapi.Error{
  4830. Code: res.StatusCode,
  4831. Header: res.Header,
  4832. }
  4833. }
  4834. if err != nil {
  4835. return nil, err
  4836. }
  4837. defer googleapi.CloseBody(res)
  4838. if err := googleapi.CheckResponse(res); err != nil {
  4839. return nil, err
  4840. }
  4841. ret := &LogExclusion{
  4842. ServerResponse: googleapi.ServerResponse{
  4843. Header: res.Header,
  4844. HTTPStatusCode: res.StatusCode,
  4845. },
  4846. }
  4847. target := &ret
  4848. if err := gensupport.DecodeResponse(target, res); err != nil {
  4849. return nil, err
  4850. }
  4851. return ret, nil
  4852. // {
  4853. // "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.",
  4854. // "flatPath": "v2/folders/{foldersId}/exclusions",
  4855. // "httpMethod": "POST",
  4856. // "id": "logging.folders.exclusions.create",
  4857. // "parameterOrder": [
  4858. // "parent"
  4859. // ],
  4860. // "parameters": {
  4861. // "parent": {
  4862. // "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\".",
  4863. // "location": "path",
  4864. // "pattern": "^folders/[^/]+$",
  4865. // "required": true,
  4866. // "type": "string"
  4867. // }
  4868. // },
  4869. // "path": "v2/{+parent}/exclusions",
  4870. // "request": {
  4871. // "$ref": "LogExclusion"
  4872. // },
  4873. // "response": {
  4874. // "$ref": "LogExclusion"
  4875. // },
  4876. // "scopes": [
  4877. // "https://www.googleapis.com/auth/cloud-platform",
  4878. // "https://www.googleapis.com/auth/logging.admin"
  4879. // ]
  4880. // }
  4881. }
  4882. // method id "logging.folders.exclusions.delete":
  4883. type FoldersExclusionsDeleteCall struct {
  4884. s *Service
  4885. name string
  4886. urlParams_ gensupport.URLParams
  4887. ctx_ context.Context
  4888. header_ http.Header
  4889. }
  4890. // Delete: Deletes an exclusion.
  4891. func (r *FoldersExclusionsService) Delete(name string) *FoldersExclusionsDeleteCall {
  4892. c := &FoldersExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4893. c.name = name
  4894. return c
  4895. }
  4896. // Fields allows partial responses to be retrieved. See
  4897. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4898. // for more information.
  4899. func (c *FoldersExclusionsDeleteCall) Fields(s ...googleapi.Field) *FoldersExclusionsDeleteCall {
  4900. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4901. return c
  4902. }
  4903. // Context sets the context to be used in this call's Do method. Any
  4904. // pending HTTP request will be aborted if the provided context is
  4905. // canceled.
  4906. func (c *FoldersExclusionsDeleteCall) Context(ctx context.Context) *FoldersExclusionsDeleteCall {
  4907. c.ctx_ = ctx
  4908. return c
  4909. }
  4910. // Header returns an http.Header that can be modified by the caller to
  4911. // add HTTP headers to the request.
  4912. func (c *FoldersExclusionsDeleteCall) Header() http.Header {
  4913. if c.header_ == nil {
  4914. c.header_ = make(http.Header)
  4915. }
  4916. return c.header_
  4917. }
  4918. func (c *FoldersExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4919. reqHeaders := make(http.Header)
  4920. for k, v := range c.header_ {
  4921. reqHeaders[k] = v
  4922. }
  4923. reqHeaders.Set("User-Agent", c.s.userAgent())
  4924. var body io.Reader = nil
  4925. c.urlParams_.Set("alt", alt)
  4926. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  4927. urls += "?" + c.urlParams_.Encode()
  4928. req, _ := http.NewRequest("DELETE", urls, body)
  4929. req.Header = reqHeaders
  4930. googleapi.Expand(req.URL, map[string]string{
  4931. "name": c.name,
  4932. })
  4933. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4934. }
  4935. // Do executes the "logging.folders.exclusions.delete" call.
  4936. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4937. // code is an error. Response headers are in either
  4938. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4939. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4940. // check whether the returned error was because http.StatusNotModified
  4941. // was returned.
  4942. func (c *FoldersExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4943. gensupport.SetOptions(c.urlParams_, opts...)
  4944. res, err := c.doRequest("json")
  4945. if res != nil && res.StatusCode == http.StatusNotModified {
  4946. if res.Body != nil {
  4947. res.Body.Close()
  4948. }
  4949. return nil, &googleapi.Error{
  4950. Code: res.StatusCode,
  4951. Header: res.Header,
  4952. }
  4953. }
  4954. if err != nil {
  4955. return nil, err
  4956. }
  4957. defer googleapi.CloseBody(res)
  4958. if err := googleapi.CheckResponse(res); err != nil {
  4959. return nil, err
  4960. }
  4961. ret := &Empty{
  4962. ServerResponse: googleapi.ServerResponse{
  4963. Header: res.Header,
  4964. HTTPStatusCode: res.StatusCode,
  4965. },
  4966. }
  4967. target := &ret
  4968. if err := gensupport.DecodeResponse(target, res); err != nil {
  4969. return nil, err
  4970. }
  4971. return ret, nil
  4972. // {
  4973. // "description": "Deletes an exclusion.",
  4974. // "flatPath": "v2/folders/{foldersId}/exclusions/{exclusionsId}",
  4975. // "httpMethod": "DELETE",
  4976. // "id": "logging.folders.exclusions.delete",
  4977. // "parameterOrder": [
  4978. // "name"
  4979. // ],
  4980. // "parameters": {
  4981. // "name": {
  4982. // "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\".",
  4983. // "location": "path",
  4984. // "pattern": "^folders/[^/]+/exclusions/[^/]+$",
  4985. // "required": true,
  4986. // "type": "string"
  4987. // }
  4988. // },
  4989. // "path": "v2/{+name}",
  4990. // "response": {
  4991. // "$ref": "Empty"
  4992. // },
  4993. // "scopes": [
  4994. // "https://www.googleapis.com/auth/cloud-platform",
  4995. // "https://www.googleapis.com/auth/logging.admin"
  4996. // ]
  4997. // }
  4998. }
  4999. // method id "logging.folders.exclusions.get":
  5000. type FoldersExclusionsGetCall struct {
  5001. s *Service
  5002. name string
  5003. urlParams_ gensupport.URLParams
  5004. ifNoneMatch_ string
  5005. ctx_ context.Context
  5006. header_ http.Header
  5007. }
  5008. // Get: Gets the description of an exclusion.
  5009. func (r *FoldersExclusionsService) Get(name string) *FoldersExclusionsGetCall {
  5010. c := &FoldersExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5011. c.name = name
  5012. return c
  5013. }
  5014. // Fields allows partial responses to be retrieved. See
  5015. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5016. // for more information.
  5017. func (c *FoldersExclusionsGetCall) Fields(s ...googleapi.Field) *FoldersExclusionsGetCall {
  5018. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5019. return c
  5020. }
  5021. // IfNoneMatch sets the optional parameter which makes the operation
  5022. // fail if the object's ETag matches the given value. This is useful for
  5023. // getting updates only after the object has changed since the last
  5024. // request. Use googleapi.IsNotModified to check whether the response
  5025. // error from Do is the result of In-None-Match.
  5026. func (c *FoldersExclusionsGetCall) IfNoneMatch(entityTag string) *FoldersExclusionsGetCall {
  5027. c.ifNoneMatch_ = entityTag
  5028. return c
  5029. }
  5030. // Context sets the context to be used in this call's Do method. Any
  5031. // pending HTTP request will be aborted if the provided context is
  5032. // canceled.
  5033. func (c *FoldersExclusionsGetCall) Context(ctx context.Context) *FoldersExclusionsGetCall {
  5034. c.ctx_ = ctx
  5035. return c
  5036. }
  5037. // Header returns an http.Header that can be modified by the caller to
  5038. // add HTTP headers to the request.
  5039. func (c *FoldersExclusionsGetCall) Header() http.Header {
  5040. if c.header_ == nil {
  5041. c.header_ = make(http.Header)
  5042. }
  5043. return c.header_
  5044. }
  5045. func (c *FoldersExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  5046. reqHeaders := make(http.Header)
  5047. for k, v := range c.header_ {
  5048. reqHeaders[k] = v
  5049. }
  5050. reqHeaders.Set("User-Agent", c.s.userAgent())
  5051. if c.ifNoneMatch_ != "" {
  5052. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5053. }
  5054. var body io.Reader = nil
  5055. c.urlParams_.Set("alt", alt)
  5056. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  5057. urls += "?" + c.urlParams_.Encode()
  5058. req, _ := http.NewRequest("GET", urls, body)
  5059. req.Header = reqHeaders
  5060. googleapi.Expand(req.URL, map[string]string{
  5061. "name": c.name,
  5062. })
  5063. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5064. }
  5065. // Do executes the "logging.folders.exclusions.get" call.
  5066. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  5067. // status code is an error. Response headers are in either
  5068. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  5069. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5070. // to check whether the returned error was because
  5071. // http.StatusNotModified was returned.
  5072. func (c *FoldersExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  5073. gensupport.SetOptions(c.urlParams_, opts...)
  5074. res, err := c.doRequest("json")
  5075. if res != nil && res.StatusCode == http.StatusNotModified {
  5076. if res.Body != nil {
  5077. res.Body.Close()
  5078. }
  5079. return nil, &googleapi.Error{
  5080. Code: res.StatusCode,
  5081. Header: res.Header,
  5082. }
  5083. }
  5084. if err != nil {
  5085. return nil, err
  5086. }
  5087. defer googleapi.CloseBody(res)
  5088. if err := googleapi.CheckResponse(res); err != nil {
  5089. return nil, err
  5090. }
  5091. ret := &LogExclusion{
  5092. ServerResponse: googleapi.ServerResponse{
  5093. Header: res.Header,
  5094. HTTPStatusCode: res.StatusCode,
  5095. },
  5096. }
  5097. target := &ret
  5098. if err := gensupport.DecodeResponse(target, res); err != nil {
  5099. return nil, err
  5100. }
  5101. return ret, nil
  5102. // {
  5103. // "description": "Gets the description of an exclusion.",
  5104. // "flatPath": "v2/folders/{foldersId}/exclusions/{exclusionsId}",
  5105. // "httpMethod": "GET",
  5106. // "id": "logging.folders.exclusions.get",
  5107. // "parameterOrder": [
  5108. // "name"
  5109. // ],
  5110. // "parameters": {
  5111. // "name": {
  5112. // "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\".",
  5113. // "location": "path",
  5114. // "pattern": "^folders/[^/]+/exclusions/[^/]+$",
  5115. // "required": true,
  5116. // "type": "string"
  5117. // }
  5118. // },
  5119. // "path": "v2/{+name}",
  5120. // "response": {
  5121. // "$ref": "LogExclusion"
  5122. // },
  5123. // "scopes": [
  5124. // "https://www.googleapis.com/auth/cloud-platform",
  5125. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5126. // "https://www.googleapis.com/auth/logging.admin",
  5127. // "https://www.googleapis.com/auth/logging.read"
  5128. // ]
  5129. // }
  5130. }
  5131. // method id "logging.folders.exclusions.list":
  5132. type FoldersExclusionsListCall struct {
  5133. s *Service
  5134. parent string
  5135. urlParams_ gensupport.URLParams
  5136. ifNoneMatch_ string
  5137. ctx_ context.Context
  5138. header_ http.Header
  5139. }
  5140. // List: Lists all the exclusions in a parent resource.
  5141. func (r *FoldersExclusionsService) List(parent string) *FoldersExclusionsListCall {
  5142. c := &FoldersExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5143. c.parent = parent
  5144. return c
  5145. }
  5146. // PageSize sets the optional parameter "pageSize": The maximum number
  5147. // of results to return from this request. Non-positive values are
  5148. // ignored. The presence of nextPageToken in the response indicates that
  5149. // more results might be available.
  5150. func (c *FoldersExclusionsListCall) PageSize(pageSize int64) *FoldersExclusionsListCall {
  5151. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5152. return c
  5153. }
  5154. // PageToken sets the optional parameter "pageToken": If present, then
  5155. // retrieve the next batch of results from the preceding call to this
  5156. // method. pageToken must be the value of nextPageToken from the
  5157. // previous response. The values of other method parameters should be
  5158. // identical to those in the previous call.
  5159. func (c *FoldersExclusionsListCall) PageToken(pageToken string) *FoldersExclusionsListCall {
  5160. c.urlParams_.Set("pageToken", pageToken)
  5161. return c
  5162. }
  5163. // Fields allows partial responses to be retrieved. See
  5164. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5165. // for more information.
  5166. func (c *FoldersExclusionsListCall) Fields(s ...googleapi.Field) *FoldersExclusionsListCall {
  5167. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5168. return c
  5169. }
  5170. // IfNoneMatch sets the optional parameter which makes the operation
  5171. // fail if the object's ETag matches the given value. This is useful for
  5172. // getting updates only after the object has changed since the last
  5173. // request. Use googleapi.IsNotModified to check whether the response
  5174. // error from Do is the result of In-None-Match.
  5175. func (c *FoldersExclusionsListCall) IfNoneMatch(entityTag string) *FoldersExclusionsListCall {
  5176. c.ifNoneMatch_ = entityTag
  5177. return c
  5178. }
  5179. // Context sets the context to be used in this call's Do method. Any
  5180. // pending HTTP request will be aborted if the provided context is
  5181. // canceled.
  5182. func (c *FoldersExclusionsListCall) Context(ctx context.Context) *FoldersExclusionsListCall {
  5183. c.ctx_ = ctx
  5184. return c
  5185. }
  5186. // Header returns an http.Header that can be modified by the caller to
  5187. // add HTTP headers to the request.
  5188. func (c *FoldersExclusionsListCall) Header() http.Header {
  5189. if c.header_ == nil {
  5190. c.header_ = make(http.Header)
  5191. }
  5192. return c.header_
  5193. }
  5194. func (c *FoldersExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  5195. reqHeaders := make(http.Header)
  5196. for k, v := range c.header_ {
  5197. reqHeaders[k] = v
  5198. }
  5199. reqHeaders.Set("User-Agent", c.s.userAgent())
  5200. if c.ifNoneMatch_ != "" {
  5201. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5202. }
  5203. var body io.Reader = nil
  5204. c.urlParams_.Set("alt", alt)
  5205. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  5206. urls += "?" + c.urlParams_.Encode()
  5207. req, _ := http.NewRequest("GET", urls, body)
  5208. req.Header = reqHeaders
  5209. googleapi.Expand(req.URL, map[string]string{
  5210. "parent": c.parent,
  5211. })
  5212. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5213. }
  5214. // Do executes the "logging.folders.exclusions.list" call.
  5215. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  5216. // non-2xx status code is an error. Response headers are in either
  5217. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  5218. // returned at all) in error.(*googleapi.Error).Header. Use
  5219. // googleapi.IsNotModified to check whether the returned error was
  5220. // because http.StatusNotModified was returned.
  5221. func (c *FoldersExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  5222. gensupport.SetOptions(c.urlParams_, opts...)
  5223. res, err := c.doRequest("json")
  5224. if res != nil && res.StatusCode == http.StatusNotModified {
  5225. if res.Body != nil {
  5226. res.Body.Close()
  5227. }
  5228. return nil, &googleapi.Error{
  5229. Code: res.StatusCode,
  5230. Header: res.Header,
  5231. }
  5232. }
  5233. if err != nil {
  5234. return nil, err
  5235. }
  5236. defer googleapi.CloseBody(res)
  5237. if err := googleapi.CheckResponse(res); err != nil {
  5238. return nil, err
  5239. }
  5240. ret := &ListExclusionsResponse{
  5241. ServerResponse: googleapi.ServerResponse{
  5242. Header: res.Header,
  5243. HTTPStatusCode: res.StatusCode,
  5244. },
  5245. }
  5246. target := &ret
  5247. if err := gensupport.DecodeResponse(target, res); err != nil {
  5248. return nil, err
  5249. }
  5250. return ret, nil
  5251. // {
  5252. // "description": "Lists all the exclusions in a parent resource.",
  5253. // "flatPath": "v2/folders/{foldersId}/exclusions",
  5254. // "httpMethod": "GET",
  5255. // "id": "logging.folders.exclusions.list",
  5256. // "parameterOrder": [
  5257. // "parent"
  5258. // ],
  5259. // "parameters": {
  5260. // "pageSize": {
  5261. // "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.",
  5262. // "format": "int32",
  5263. // "location": "query",
  5264. // "type": "integer"
  5265. // },
  5266. // "pageToken": {
  5267. // "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.",
  5268. // "location": "query",
  5269. // "type": "string"
  5270. // },
  5271. // "parent": {
  5272. // "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",
  5273. // "location": "path",
  5274. // "pattern": "^folders/[^/]+$",
  5275. // "required": true,
  5276. // "type": "string"
  5277. // }
  5278. // },
  5279. // "path": "v2/{+parent}/exclusions",
  5280. // "response": {
  5281. // "$ref": "ListExclusionsResponse"
  5282. // },
  5283. // "scopes": [
  5284. // "https://www.googleapis.com/auth/cloud-platform",
  5285. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5286. // "https://www.googleapis.com/auth/logging.admin",
  5287. // "https://www.googleapis.com/auth/logging.read"
  5288. // ]
  5289. // }
  5290. }
  5291. // Pages invokes f for each page of results.
  5292. // A non-nil error returned from f will halt the iteration.
  5293. // The provided context supersedes any context provided to the Context method.
  5294. func (c *FoldersExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  5295. c.ctx_ = ctx
  5296. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5297. for {
  5298. x, err := c.Do()
  5299. if err != nil {
  5300. return err
  5301. }
  5302. if err := f(x); err != nil {
  5303. return err
  5304. }
  5305. if x.NextPageToken == "" {
  5306. return nil
  5307. }
  5308. c.PageToken(x.NextPageToken)
  5309. }
  5310. }
  5311. // method id "logging.folders.exclusions.patch":
  5312. type FoldersExclusionsPatchCall struct {
  5313. s *Service
  5314. name string
  5315. logexclusion *LogExclusion
  5316. urlParams_ gensupport.URLParams
  5317. ctx_ context.Context
  5318. header_ http.Header
  5319. }
  5320. // Patch: Changes one or more properties of an existing exclusion.
  5321. func (r *FoldersExclusionsService) Patch(name string, logexclusion *LogExclusion) *FoldersExclusionsPatchCall {
  5322. c := &FoldersExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5323. c.name = name
  5324. c.logexclusion = logexclusion
  5325. return c
  5326. }
  5327. // UpdateMask sets the optional parameter "updateMask": Required. A
  5328. // nonempty list of fields to change in the existing exclusion. New
  5329. // values for the fields are taken from the corresponding fields in the
  5330. // LogExclusion included in this request. Fields not mentioned in
  5331. // update_mask are not changed and are ignored in the request.For
  5332. // example, to change the filter and description of an exclusion,
  5333. // specify an update_mask of "filter,description".
  5334. func (c *FoldersExclusionsPatchCall) UpdateMask(updateMask string) *FoldersExclusionsPatchCall {
  5335. c.urlParams_.Set("updateMask", updateMask)
  5336. return c
  5337. }
  5338. // Fields allows partial responses to be retrieved. See
  5339. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5340. // for more information.
  5341. func (c *FoldersExclusionsPatchCall) Fields(s ...googleapi.Field) *FoldersExclusionsPatchCall {
  5342. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5343. return c
  5344. }
  5345. // Context sets the context to be used in this call's Do method. Any
  5346. // pending HTTP request will be aborted if the provided context is
  5347. // canceled.
  5348. func (c *FoldersExclusionsPatchCall) Context(ctx context.Context) *FoldersExclusionsPatchCall {
  5349. c.ctx_ = ctx
  5350. return c
  5351. }
  5352. // Header returns an http.Header that can be modified by the caller to
  5353. // add HTTP headers to the request.
  5354. func (c *FoldersExclusionsPatchCall) Header() http.Header {
  5355. if c.header_ == nil {
  5356. c.header_ = make(http.Header)
  5357. }
  5358. return c.header_
  5359. }
  5360. func (c *FoldersExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  5361. reqHeaders := make(http.Header)
  5362. for k, v := range c.header_ {
  5363. reqHeaders[k] = v
  5364. }
  5365. reqHeaders.Set("User-Agent", c.s.userAgent())
  5366. var body io.Reader = nil
  5367. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  5368. if err != nil {
  5369. return nil, err
  5370. }
  5371. reqHeaders.Set("Content-Type", "application/json")
  5372. c.urlParams_.Set("alt", alt)
  5373. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  5374. urls += "?" + c.urlParams_.Encode()
  5375. req, _ := http.NewRequest("PATCH", urls, body)
  5376. req.Header = reqHeaders
  5377. googleapi.Expand(req.URL, map[string]string{
  5378. "name": c.name,
  5379. })
  5380. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5381. }
  5382. // Do executes the "logging.folders.exclusions.patch" call.
  5383. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  5384. // status code is an error. Response headers are in either
  5385. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  5386. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5387. // to check whether the returned error was because
  5388. // http.StatusNotModified was returned.
  5389. func (c *FoldersExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  5390. gensupport.SetOptions(c.urlParams_, opts...)
  5391. res, err := c.doRequest("json")
  5392. if res != nil && res.StatusCode == http.StatusNotModified {
  5393. if res.Body != nil {
  5394. res.Body.Close()
  5395. }
  5396. return nil, &googleapi.Error{
  5397. Code: res.StatusCode,
  5398. Header: res.Header,
  5399. }
  5400. }
  5401. if err != nil {
  5402. return nil, err
  5403. }
  5404. defer googleapi.CloseBody(res)
  5405. if err := googleapi.CheckResponse(res); err != nil {
  5406. return nil, err
  5407. }
  5408. ret := &LogExclusion{
  5409. ServerResponse: googleapi.ServerResponse{
  5410. Header: res.Header,
  5411. HTTPStatusCode: res.StatusCode,
  5412. },
  5413. }
  5414. target := &ret
  5415. if err := gensupport.DecodeResponse(target, res); err != nil {
  5416. return nil, err
  5417. }
  5418. return ret, nil
  5419. // {
  5420. // "description": "Changes one or more properties of an existing exclusion.",
  5421. // "flatPath": "v2/folders/{foldersId}/exclusions/{exclusionsId}",
  5422. // "httpMethod": "PATCH",
  5423. // "id": "logging.folders.exclusions.patch",
  5424. // "parameterOrder": [
  5425. // "name"
  5426. // ],
  5427. // "parameters": {
  5428. // "name": {
  5429. // "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\".",
  5430. // "location": "path",
  5431. // "pattern": "^folders/[^/]+/exclusions/[^/]+$",
  5432. // "required": true,
  5433. // "type": "string"
  5434. // },
  5435. // "updateMask": {
  5436. // "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\".",
  5437. // "format": "google-fieldmask",
  5438. // "location": "query",
  5439. // "type": "string"
  5440. // }
  5441. // },
  5442. // "path": "v2/{+name}",
  5443. // "request": {
  5444. // "$ref": "LogExclusion"
  5445. // },
  5446. // "response": {
  5447. // "$ref": "LogExclusion"
  5448. // },
  5449. // "scopes": [
  5450. // "https://www.googleapis.com/auth/cloud-platform",
  5451. // "https://www.googleapis.com/auth/logging.admin"
  5452. // ]
  5453. // }
  5454. }
  5455. // method id "logging.folders.logs.delete":
  5456. type FoldersLogsDeleteCall struct {
  5457. s *Service
  5458. logName string
  5459. urlParams_ gensupport.URLParams
  5460. ctx_ context.Context
  5461. header_ http.Header
  5462. }
  5463. // Delete: Deletes all the log entries in a log. The log reappears if it
  5464. // receives new entries. Log entries written shortly before the delete
  5465. // operation might not be deleted.
  5466. func (r *FoldersLogsService) Delete(logName string) *FoldersLogsDeleteCall {
  5467. c := &FoldersLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5468. c.logName = logName
  5469. return c
  5470. }
  5471. // Fields allows partial responses to be retrieved. See
  5472. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5473. // for more information.
  5474. func (c *FoldersLogsDeleteCall) Fields(s ...googleapi.Field) *FoldersLogsDeleteCall {
  5475. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5476. return c
  5477. }
  5478. // Context sets the context to be used in this call's Do method. Any
  5479. // pending HTTP request will be aborted if the provided context is
  5480. // canceled.
  5481. func (c *FoldersLogsDeleteCall) Context(ctx context.Context) *FoldersLogsDeleteCall {
  5482. c.ctx_ = ctx
  5483. return c
  5484. }
  5485. // Header returns an http.Header that can be modified by the caller to
  5486. // add HTTP headers to the request.
  5487. func (c *FoldersLogsDeleteCall) Header() http.Header {
  5488. if c.header_ == nil {
  5489. c.header_ = make(http.Header)
  5490. }
  5491. return c.header_
  5492. }
  5493. func (c *FoldersLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5494. reqHeaders := make(http.Header)
  5495. for k, v := range c.header_ {
  5496. reqHeaders[k] = v
  5497. }
  5498. reqHeaders.Set("User-Agent", c.s.userAgent())
  5499. var body io.Reader = nil
  5500. c.urlParams_.Set("alt", alt)
  5501. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  5502. urls += "?" + c.urlParams_.Encode()
  5503. req, _ := http.NewRequest("DELETE", urls, body)
  5504. req.Header = reqHeaders
  5505. googleapi.Expand(req.URL, map[string]string{
  5506. "logName": c.logName,
  5507. })
  5508. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5509. }
  5510. // Do executes the "logging.folders.logs.delete" call.
  5511. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5512. // code is an error. Response headers are in either
  5513. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5514. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5515. // check whether the returned error was because http.StatusNotModified
  5516. // was returned.
  5517. func (c *FoldersLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5518. gensupport.SetOptions(c.urlParams_, opts...)
  5519. res, err := c.doRequest("json")
  5520. if res != nil && res.StatusCode == http.StatusNotModified {
  5521. if res.Body != nil {
  5522. res.Body.Close()
  5523. }
  5524. return nil, &googleapi.Error{
  5525. Code: res.StatusCode,
  5526. Header: res.Header,
  5527. }
  5528. }
  5529. if err != nil {
  5530. return nil, err
  5531. }
  5532. defer googleapi.CloseBody(res)
  5533. if err := googleapi.CheckResponse(res); err != nil {
  5534. return nil, err
  5535. }
  5536. ret := &Empty{
  5537. ServerResponse: googleapi.ServerResponse{
  5538. Header: res.Header,
  5539. HTTPStatusCode: res.StatusCode,
  5540. },
  5541. }
  5542. target := &ret
  5543. if err := gensupport.DecodeResponse(target, res); err != nil {
  5544. return nil, err
  5545. }
  5546. return ret, nil
  5547. // {
  5548. // "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.",
  5549. // "flatPath": "v2/folders/{foldersId}/logs/{logsId}",
  5550. // "httpMethod": "DELETE",
  5551. // "id": "logging.folders.logs.delete",
  5552. // "parameterOrder": [
  5553. // "logName"
  5554. // ],
  5555. // "parameters": {
  5556. // "logName": {
  5557. // "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.",
  5558. // "location": "path",
  5559. // "pattern": "^folders/[^/]+/logs/[^/]+$",
  5560. // "required": true,
  5561. // "type": "string"
  5562. // }
  5563. // },
  5564. // "path": "v2/{+logName}",
  5565. // "response": {
  5566. // "$ref": "Empty"
  5567. // },
  5568. // "scopes": [
  5569. // "https://www.googleapis.com/auth/cloud-platform",
  5570. // "https://www.googleapis.com/auth/logging.admin"
  5571. // ]
  5572. // }
  5573. }
  5574. // method id "logging.folders.logs.list":
  5575. type FoldersLogsListCall struct {
  5576. s *Service
  5577. parent string
  5578. urlParams_ gensupport.URLParams
  5579. ifNoneMatch_ string
  5580. ctx_ context.Context
  5581. header_ http.Header
  5582. }
  5583. // List: Lists the logs in projects, organizations, folders, or billing
  5584. // accounts. Only logs that have entries are listed.
  5585. func (r *FoldersLogsService) List(parent string) *FoldersLogsListCall {
  5586. c := &FoldersLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5587. c.parent = parent
  5588. return c
  5589. }
  5590. // PageSize sets the optional parameter "pageSize": The maximum number
  5591. // of results to return from this request. Non-positive values are
  5592. // ignored. The presence of nextPageToken in the response indicates that
  5593. // more results might be available.
  5594. func (c *FoldersLogsListCall) PageSize(pageSize int64) *FoldersLogsListCall {
  5595. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5596. return c
  5597. }
  5598. // PageToken sets the optional parameter "pageToken": If present, then
  5599. // retrieve the next batch of results from the preceding call to this
  5600. // method. pageToken must be the value of nextPageToken from the
  5601. // previous response. The values of other method parameters should be
  5602. // identical to those in the previous call.
  5603. func (c *FoldersLogsListCall) PageToken(pageToken string) *FoldersLogsListCall {
  5604. c.urlParams_.Set("pageToken", pageToken)
  5605. return c
  5606. }
  5607. // Fields allows partial responses to be retrieved. See
  5608. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5609. // for more information.
  5610. func (c *FoldersLogsListCall) Fields(s ...googleapi.Field) *FoldersLogsListCall {
  5611. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5612. return c
  5613. }
  5614. // IfNoneMatch sets the optional parameter which makes the operation
  5615. // fail if the object's ETag matches the given value. This is useful for
  5616. // getting updates only after the object has changed since the last
  5617. // request. Use googleapi.IsNotModified to check whether the response
  5618. // error from Do is the result of In-None-Match.
  5619. func (c *FoldersLogsListCall) IfNoneMatch(entityTag string) *FoldersLogsListCall {
  5620. c.ifNoneMatch_ = entityTag
  5621. return c
  5622. }
  5623. // Context sets the context to be used in this call's Do method. Any
  5624. // pending HTTP request will be aborted if the provided context is
  5625. // canceled.
  5626. func (c *FoldersLogsListCall) Context(ctx context.Context) *FoldersLogsListCall {
  5627. c.ctx_ = ctx
  5628. return c
  5629. }
  5630. // Header returns an http.Header that can be modified by the caller to
  5631. // add HTTP headers to the request.
  5632. func (c *FoldersLogsListCall) Header() http.Header {
  5633. if c.header_ == nil {
  5634. c.header_ = make(http.Header)
  5635. }
  5636. return c.header_
  5637. }
  5638. func (c *FoldersLogsListCall) doRequest(alt string) (*http.Response, error) {
  5639. reqHeaders := make(http.Header)
  5640. for k, v := range c.header_ {
  5641. reqHeaders[k] = v
  5642. }
  5643. reqHeaders.Set("User-Agent", c.s.userAgent())
  5644. if c.ifNoneMatch_ != "" {
  5645. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5646. }
  5647. var body io.Reader = nil
  5648. c.urlParams_.Set("alt", alt)
  5649. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  5650. urls += "?" + c.urlParams_.Encode()
  5651. req, _ := http.NewRequest("GET", urls, body)
  5652. req.Header = reqHeaders
  5653. googleapi.Expand(req.URL, map[string]string{
  5654. "parent": c.parent,
  5655. })
  5656. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5657. }
  5658. // Do executes the "logging.folders.logs.list" call.
  5659. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  5660. // non-2xx status code is an error. Response headers are in either
  5661. // *ListLogsResponse.ServerResponse.Header or (if a response was
  5662. // returned at all) in error.(*googleapi.Error).Header. Use
  5663. // googleapi.IsNotModified to check whether the returned error was
  5664. // because http.StatusNotModified was returned.
  5665. func (c *FoldersLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  5666. gensupport.SetOptions(c.urlParams_, opts...)
  5667. res, err := c.doRequest("json")
  5668. if res != nil && res.StatusCode == http.StatusNotModified {
  5669. if res.Body != nil {
  5670. res.Body.Close()
  5671. }
  5672. return nil, &googleapi.Error{
  5673. Code: res.StatusCode,
  5674. Header: res.Header,
  5675. }
  5676. }
  5677. if err != nil {
  5678. return nil, err
  5679. }
  5680. defer googleapi.CloseBody(res)
  5681. if err := googleapi.CheckResponse(res); err != nil {
  5682. return nil, err
  5683. }
  5684. ret := &ListLogsResponse{
  5685. ServerResponse: googleapi.ServerResponse{
  5686. Header: res.Header,
  5687. HTTPStatusCode: res.StatusCode,
  5688. },
  5689. }
  5690. target := &ret
  5691. if err := gensupport.DecodeResponse(target, res); err != nil {
  5692. return nil, err
  5693. }
  5694. return ret, nil
  5695. // {
  5696. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  5697. // "flatPath": "v2/folders/{foldersId}/logs",
  5698. // "httpMethod": "GET",
  5699. // "id": "logging.folders.logs.list",
  5700. // "parameterOrder": [
  5701. // "parent"
  5702. // ],
  5703. // "parameters": {
  5704. // "pageSize": {
  5705. // "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.",
  5706. // "format": "int32",
  5707. // "location": "query",
  5708. // "type": "integer"
  5709. // },
  5710. // "pageToken": {
  5711. // "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.",
  5712. // "location": "query",
  5713. // "type": "string"
  5714. // },
  5715. // "parent": {
  5716. // "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",
  5717. // "location": "path",
  5718. // "pattern": "^folders/[^/]+$",
  5719. // "required": true,
  5720. // "type": "string"
  5721. // }
  5722. // },
  5723. // "path": "v2/{+parent}/logs",
  5724. // "response": {
  5725. // "$ref": "ListLogsResponse"
  5726. // },
  5727. // "scopes": [
  5728. // "https://www.googleapis.com/auth/cloud-platform",
  5729. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  5730. // "https://www.googleapis.com/auth/logging.admin",
  5731. // "https://www.googleapis.com/auth/logging.read"
  5732. // ]
  5733. // }
  5734. }
  5735. // Pages invokes f for each page of results.
  5736. // A non-nil error returned from f will halt the iteration.
  5737. // The provided context supersedes any context provided to the Context method.
  5738. func (c *FoldersLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  5739. c.ctx_ = ctx
  5740. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5741. for {
  5742. x, err := c.Do()
  5743. if err != nil {
  5744. return err
  5745. }
  5746. if err := f(x); err != nil {
  5747. return err
  5748. }
  5749. if x.NextPageToken == "" {
  5750. return nil
  5751. }
  5752. c.PageToken(x.NextPageToken)
  5753. }
  5754. }
  5755. // method id "logging.folders.sinks.create":
  5756. type FoldersSinksCreateCall struct {
  5757. s *Service
  5758. parent string
  5759. logsink *LogSink
  5760. urlParams_ gensupport.URLParams
  5761. ctx_ context.Context
  5762. header_ http.Header
  5763. }
  5764. // Create: Creates a sink that exports specified log entries to a
  5765. // destination. The export of newly-ingested log entries begins
  5766. // immediately, unless the sink's writer_identity is not permitted to
  5767. // write to the destination. A sink can export log entries only from the
  5768. // resource owning the sink.
  5769. func (r *FoldersSinksService) Create(parent string, logsink *LogSink) *FoldersSinksCreateCall {
  5770. c := &FoldersSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5771. c.parent = parent
  5772. c.logsink = logsink
  5773. return c
  5774. }
  5775. // UniqueWriterIdentity sets the optional parameter
  5776. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  5777. // as writer_identity in the new sink. If this value is omitted or set
  5778. // to false, and if the sink's parent is a project, then the value
  5779. // returned as writer_identity is the same group or service account used
  5780. // by Stackdriver Logging before the addition of writer identities to
  5781. // this API. The sink's destination must be in the same project as the
  5782. // sink itself.If this field is set to true, or if the sink is owned by
  5783. // a non-project resource such as an organization, then the value of
  5784. // writer_identity will be a unique service account used only for
  5785. // exports from the new sink. For more information, see writer_identity
  5786. // in LogSink.
  5787. func (c *FoldersSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *FoldersSinksCreateCall {
  5788. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  5789. return c
  5790. }
  5791. // Fields allows partial responses to be retrieved. See
  5792. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5793. // for more information.
  5794. func (c *FoldersSinksCreateCall) Fields(s ...googleapi.Field) *FoldersSinksCreateCall {
  5795. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5796. return c
  5797. }
  5798. // Context sets the context to be used in this call's Do method. Any
  5799. // pending HTTP request will be aborted if the provided context is
  5800. // canceled.
  5801. func (c *FoldersSinksCreateCall) Context(ctx context.Context) *FoldersSinksCreateCall {
  5802. c.ctx_ = ctx
  5803. return c
  5804. }
  5805. // Header returns an http.Header that can be modified by the caller to
  5806. // add HTTP headers to the request.
  5807. func (c *FoldersSinksCreateCall) Header() http.Header {
  5808. if c.header_ == nil {
  5809. c.header_ = make(http.Header)
  5810. }
  5811. return c.header_
  5812. }
  5813. func (c *FoldersSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  5814. reqHeaders := make(http.Header)
  5815. for k, v := range c.header_ {
  5816. reqHeaders[k] = v
  5817. }
  5818. reqHeaders.Set("User-Agent", c.s.userAgent())
  5819. var body io.Reader = nil
  5820. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  5821. if err != nil {
  5822. return nil, err
  5823. }
  5824. reqHeaders.Set("Content-Type", "application/json")
  5825. c.urlParams_.Set("alt", alt)
  5826. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  5827. urls += "?" + c.urlParams_.Encode()
  5828. req, _ := http.NewRequest("POST", urls, body)
  5829. req.Header = reqHeaders
  5830. googleapi.Expand(req.URL, map[string]string{
  5831. "parent": c.parent,
  5832. })
  5833. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5834. }
  5835. // Do executes the "logging.folders.sinks.create" call.
  5836. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  5837. // code is an error. Response headers are in either
  5838. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  5839. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5840. // check whether the returned error was because http.StatusNotModified
  5841. // was returned.
  5842. func (c *FoldersSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  5843. gensupport.SetOptions(c.urlParams_, opts...)
  5844. res, err := c.doRequest("json")
  5845. if res != nil && res.StatusCode == http.StatusNotModified {
  5846. if res.Body != nil {
  5847. res.Body.Close()
  5848. }
  5849. return nil, &googleapi.Error{
  5850. Code: res.StatusCode,
  5851. Header: res.Header,
  5852. }
  5853. }
  5854. if err != nil {
  5855. return nil, err
  5856. }
  5857. defer googleapi.CloseBody(res)
  5858. if err := googleapi.CheckResponse(res); err != nil {
  5859. return nil, err
  5860. }
  5861. ret := &LogSink{
  5862. ServerResponse: googleapi.ServerResponse{
  5863. Header: res.Header,
  5864. HTTPStatusCode: res.StatusCode,
  5865. },
  5866. }
  5867. target := &ret
  5868. if err := gensupport.DecodeResponse(target, res); err != nil {
  5869. return nil, err
  5870. }
  5871. return ret, nil
  5872. // {
  5873. // "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.",
  5874. // "flatPath": "v2/folders/{foldersId}/sinks",
  5875. // "httpMethod": "POST",
  5876. // "id": "logging.folders.sinks.create",
  5877. // "parameterOrder": [
  5878. // "parent"
  5879. // ],
  5880. // "parameters": {
  5881. // "parent": {
  5882. // "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\".",
  5883. // "location": "path",
  5884. // "pattern": "^folders/[^/]+$",
  5885. // "required": true,
  5886. // "type": "string"
  5887. // },
  5888. // "uniqueWriterIdentity": {
  5889. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Stackdriver Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  5890. // "location": "query",
  5891. // "type": "boolean"
  5892. // }
  5893. // },
  5894. // "path": "v2/{+parent}/sinks",
  5895. // "request": {
  5896. // "$ref": "LogSink"
  5897. // },
  5898. // "response": {
  5899. // "$ref": "LogSink"
  5900. // },
  5901. // "scopes": [
  5902. // "https://www.googleapis.com/auth/cloud-platform",
  5903. // "https://www.googleapis.com/auth/logging.admin"
  5904. // ]
  5905. // }
  5906. }
  5907. // method id "logging.folders.sinks.delete":
  5908. type FoldersSinksDeleteCall struct {
  5909. s *Service
  5910. sinkNameid string
  5911. urlParams_ gensupport.URLParams
  5912. ctx_ context.Context
  5913. header_ http.Header
  5914. }
  5915. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  5916. // then that service account is also deleted.
  5917. func (r *FoldersSinksService) Delete(sinkNameid string) *FoldersSinksDeleteCall {
  5918. c := &FoldersSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5919. c.sinkNameid = sinkNameid
  5920. return c
  5921. }
  5922. // Fields allows partial responses to be retrieved. See
  5923. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5924. // for more information.
  5925. func (c *FoldersSinksDeleteCall) Fields(s ...googleapi.Field) *FoldersSinksDeleteCall {
  5926. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5927. return c
  5928. }
  5929. // Context sets the context to be used in this call's Do method. Any
  5930. // pending HTTP request will be aborted if the provided context is
  5931. // canceled.
  5932. func (c *FoldersSinksDeleteCall) Context(ctx context.Context) *FoldersSinksDeleteCall {
  5933. c.ctx_ = ctx
  5934. return c
  5935. }
  5936. // Header returns an http.Header that can be modified by the caller to
  5937. // add HTTP headers to the request.
  5938. func (c *FoldersSinksDeleteCall) Header() http.Header {
  5939. if c.header_ == nil {
  5940. c.header_ = make(http.Header)
  5941. }
  5942. return c.header_
  5943. }
  5944. func (c *FoldersSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  5945. reqHeaders := make(http.Header)
  5946. for k, v := range c.header_ {
  5947. reqHeaders[k] = v
  5948. }
  5949. reqHeaders.Set("User-Agent", c.s.userAgent())
  5950. var body io.Reader = nil
  5951. c.urlParams_.Set("alt", alt)
  5952. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  5953. urls += "?" + c.urlParams_.Encode()
  5954. req, _ := http.NewRequest("DELETE", urls, body)
  5955. req.Header = reqHeaders
  5956. googleapi.Expand(req.URL, map[string]string{
  5957. "sinkName": c.sinkNameid,
  5958. })
  5959. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5960. }
  5961. // Do executes the "logging.folders.sinks.delete" call.
  5962. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5963. // code is an error. Response headers are in either
  5964. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5965. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5966. // check whether the returned error was because http.StatusNotModified
  5967. // was returned.
  5968. func (c *FoldersSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5969. gensupport.SetOptions(c.urlParams_, opts...)
  5970. res, err := c.doRequest("json")
  5971. if res != nil && res.StatusCode == http.StatusNotModified {
  5972. if res.Body != nil {
  5973. res.Body.Close()
  5974. }
  5975. return nil, &googleapi.Error{
  5976. Code: res.StatusCode,
  5977. Header: res.Header,
  5978. }
  5979. }
  5980. if err != nil {
  5981. return nil, err
  5982. }
  5983. defer googleapi.CloseBody(res)
  5984. if err := googleapi.CheckResponse(res); err != nil {
  5985. return nil, err
  5986. }
  5987. ret := &Empty{
  5988. ServerResponse: googleapi.ServerResponse{
  5989. Header: res.Header,
  5990. HTTPStatusCode: res.StatusCode,
  5991. },
  5992. }
  5993. target := &ret
  5994. if err := gensupport.DecodeResponse(target, res); err != nil {
  5995. return nil, err
  5996. }
  5997. return ret, nil
  5998. // {
  5999. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  6000. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6001. // "httpMethod": "DELETE",
  6002. // "id": "logging.folders.sinks.delete",
  6003. // "parameterOrder": [
  6004. // "sinkName"
  6005. // ],
  6006. // "parameters": {
  6007. // "sinkName": {
  6008. // "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\".",
  6009. // "location": "path",
  6010. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6011. // "required": true,
  6012. // "type": "string"
  6013. // }
  6014. // },
  6015. // "path": "v2/{+sinkName}",
  6016. // "response": {
  6017. // "$ref": "Empty"
  6018. // },
  6019. // "scopes": [
  6020. // "https://www.googleapis.com/auth/cloud-platform",
  6021. // "https://www.googleapis.com/auth/logging.admin"
  6022. // ]
  6023. // }
  6024. }
  6025. // method id "logging.folders.sinks.get":
  6026. type FoldersSinksGetCall struct {
  6027. s *Service
  6028. sinkName string
  6029. urlParams_ gensupport.URLParams
  6030. ifNoneMatch_ string
  6031. ctx_ context.Context
  6032. header_ http.Header
  6033. }
  6034. // Get: Gets a sink.
  6035. func (r *FoldersSinksService) Get(sinkName string) *FoldersSinksGetCall {
  6036. c := &FoldersSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6037. c.sinkName = sinkName
  6038. return c
  6039. }
  6040. // Fields allows partial responses to be retrieved. See
  6041. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6042. // for more information.
  6043. func (c *FoldersSinksGetCall) Fields(s ...googleapi.Field) *FoldersSinksGetCall {
  6044. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6045. return c
  6046. }
  6047. // IfNoneMatch sets the optional parameter which makes the operation
  6048. // fail if the object's ETag matches the given value. This is useful for
  6049. // getting updates only after the object has changed since the last
  6050. // request. Use googleapi.IsNotModified to check whether the response
  6051. // error from Do is the result of In-None-Match.
  6052. func (c *FoldersSinksGetCall) IfNoneMatch(entityTag string) *FoldersSinksGetCall {
  6053. c.ifNoneMatch_ = entityTag
  6054. return c
  6055. }
  6056. // Context sets the context to be used in this call's Do method. Any
  6057. // pending HTTP request will be aborted if the provided context is
  6058. // canceled.
  6059. func (c *FoldersSinksGetCall) Context(ctx context.Context) *FoldersSinksGetCall {
  6060. c.ctx_ = ctx
  6061. return c
  6062. }
  6063. // Header returns an http.Header that can be modified by the caller to
  6064. // add HTTP headers to the request.
  6065. func (c *FoldersSinksGetCall) Header() http.Header {
  6066. if c.header_ == nil {
  6067. c.header_ = make(http.Header)
  6068. }
  6069. return c.header_
  6070. }
  6071. func (c *FoldersSinksGetCall) doRequest(alt string) (*http.Response, error) {
  6072. reqHeaders := make(http.Header)
  6073. for k, v := range c.header_ {
  6074. reqHeaders[k] = v
  6075. }
  6076. reqHeaders.Set("User-Agent", c.s.userAgent())
  6077. if c.ifNoneMatch_ != "" {
  6078. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6079. }
  6080. var body io.Reader = nil
  6081. c.urlParams_.Set("alt", alt)
  6082. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  6083. urls += "?" + c.urlParams_.Encode()
  6084. req, _ := http.NewRequest("GET", urls, body)
  6085. req.Header = reqHeaders
  6086. googleapi.Expand(req.URL, map[string]string{
  6087. "sinkName": c.sinkName,
  6088. })
  6089. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6090. }
  6091. // Do executes the "logging.folders.sinks.get" call.
  6092. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  6093. // code is an error. Response headers are in either
  6094. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  6095. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6096. // check whether the returned error was because http.StatusNotModified
  6097. // was returned.
  6098. func (c *FoldersSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  6099. gensupport.SetOptions(c.urlParams_, opts...)
  6100. res, err := c.doRequest("json")
  6101. if res != nil && res.StatusCode == http.StatusNotModified {
  6102. if res.Body != nil {
  6103. res.Body.Close()
  6104. }
  6105. return nil, &googleapi.Error{
  6106. Code: res.StatusCode,
  6107. Header: res.Header,
  6108. }
  6109. }
  6110. if err != nil {
  6111. return nil, err
  6112. }
  6113. defer googleapi.CloseBody(res)
  6114. if err := googleapi.CheckResponse(res); err != nil {
  6115. return nil, err
  6116. }
  6117. ret := &LogSink{
  6118. ServerResponse: googleapi.ServerResponse{
  6119. Header: res.Header,
  6120. HTTPStatusCode: res.StatusCode,
  6121. },
  6122. }
  6123. target := &ret
  6124. if err := gensupport.DecodeResponse(target, res); err != nil {
  6125. return nil, err
  6126. }
  6127. return ret, nil
  6128. // {
  6129. // "description": "Gets a sink.",
  6130. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6131. // "httpMethod": "GET",
  6132. // "id": "logging.folders.sinks.get",
  6133. // "parameterOrder": [
  6134. // "sinkName"
  6135. // ],
  6136. // "parameters": {
  6137. // "sinkName": {
  6138. // "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\".",
  6139. // "location": "path",
  6140. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6141. // "required": true,
  6142. // "type": "string"
  6143. // }
  6144. // },
  6145. // "path": "v2/{+sinkName}",
  6146. // "response": {
  6147. // "$ref": "LogSink"
  6148. // },
  6149. // "scopes": [
  6150. // "https://www.googleapis.com/auth/cloud-platform",
  6151. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  6152. // "https://www.googleapis.com/auth/logging.admin",
  6153. // "https://www.googleapis.com/auth/logging.read"
  6154. // ]
  6155. // }
  6156. }
  6157. // method id "logging.folders.sinks.list":
  6158. type FoldersSinksListCall struct {
  6159. s *Service
  6160. parent string
  6161. urlParams_ gensupport.URLParams
  6162. ifNoneMatch_ string
  6163. ctx_ context.Context
  6164. header_ http.Header
  6165. }
  6166. // List: Lists sinks.
  6167. func (r *FoldersSinksService) List(parent string) *FoldersSinksListCall {
  6168. c := &FoldersSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6169. c.parent = parent
  6170. return c
  6171. }
  6172. // PageSize sets the optional parameter "pageSize": The maximum number
  6173. // of results to return from this request. Non-positive values are
  6174. // ignored. The presence of nextPageToken in the response indicates that
  6175. // more results might be available.
  6176. func (c *FoldersSinksListCall) PageSize(pageSize int64) *FoldersSinksListCall {
  6177. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6178. return c
  6179. }
  6180. // PageToken sets the optional parameter "pageToken": If present, then
  6181. // retrieve the next batch of results from the preceding call to this
  6182. // method. pageToken must be the value of nextPageToken from the
  6183. // previous response. The values of other method parameters should be
  6184. // identical to those in the previous call.
  6185. func (c *FoldersSinksListCall) PageToken(pageToken string) *FoldersSinksListCall {
  6186. c.urlParams_.Set("pageToken", pageToken)
  6187. return c
  6188. }
  6189. // Fields allows partial responses to be retrieved. See
  6190. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6191. // for more information.
  6192. func (c *FoldersSinksListCall) Fields(s ...googleapi.Field) *FoldersSinksListCall {
  6193. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6194. return c
  6195. }
  6196. // IfNoneMatch sets the optional parameter which makes the operation
  6197. // fail if the object's ETag matches the given value. This is useful for
  6198. // getting updates only after the object has changed since the last
  6199. // request. Use googleapi.IsNotModified to check whether the response
  6200. // error from Do is the result of In-None-Match.
  6201. func (c *FoldersSinksListCall) IfNoneMatch(entityTag string) *FoldersSinksListCall {
  6202. c.ifNoneMatch_ = entityTag
  6203. return c
  6204. }
  6205. // Context sets the context to be used in this call's Do method. Any
  6206. // pending HTTP request will be aborted if the provided context is
  6207. // canceled.
  6208. func (c *FoldersSinksListCall) Context(ctx context.Context) *FoldersSinksListCall {
  6209. c.ctx_ = ctx
  6210. return c
  6211. }
  6212. // Header returns an http.Header that can be modified by the caller to
  6213. // add HTTP headers to the request.
  6214. func (c *FoldersSinksListCall) Header() http.Header {
  6215. if c.header_ == nil {
  6216. c.header_ = make(http.Header)
  6217. }
  6218. return c.header_
  6219. }
  6220. func (c *FoldersSinksListCall) doRequest(alt string) (*http.Response, error) {
  6221. reqHeaders := make(http.Header)
  6222. for k, v := range c.header_ {
  6223. reqHeaders[k] = v
  6224. }
  6225. reqHeaders.Set("User-Agent", c.s.userAgent())
  6226. if c.ifNoneMatch_ != "" {
  6227. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6228. }
  6229. var body io.Reader = nil
  6230. c.urlParams_.Set("alt", alt)
  6231. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  6232. urls += "?" + c.urlParams_.Encode()
  6233. req, _ := http.NewRequest("GET", urls, body)
  6234. req.Header = reqHeaders
  6235. googleapi.Expand(req.URL, map[string]string{
  6236. "parent": c.parent,
  6237. })
  6238. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6239. }
  6240. // Do executes the "logging.folders.sinks.list" call.
  6241. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  6242. // non-2xx status code is an error. Response headers are in either
  6243. // *ListSinksResponse.ServerResponse.Header or (if a response was
  6244. // returned at all) in error.(*googleapi.Error).Header. Use
  6245. // googleapi.IsNotModified to check whether the returned error was
  6246. // because http.StatusNotModified was returned.
  6247. func (c *FoldersSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  6248. gensupport.SetOptions(c.urlParams_, opts...)
  6249. res, err := c.doRequest("json")
  6250. if res != nil && res.StatusCode == http.StatusNotModified {
  6251. if res.Body != nil {
  6252. res.Body.Close()
  6253. }
  6254. return nil, &googleapi.Error{
  6255. Code: res.StatusCode,
  6256. Header: res.Header,
  6257. }
  6258. }
  6259. if err != nil {
  6260. return nil, err
  6261. }
  6262. defer googleapi.CloseBody(res)
  6263. if err := googleapi.CheckResponse(res); err != nil {
  6264. return nil, err
  6265. }
  6266. ret := &ListSinksResponse{
  6267. ServerResponse: googleapi.ServerResponse{
  6268. Header: res.Header,
  6269. HTTPStatusCode: res.StatusCode,
  6270. },
  6271. }
  6272. target := &ret
  6273. if err := gensupport.DecodeResponse(target, res); err != nil {
  6274. return nil, err
  6275. }
  6276. return ret, nil
  6277. // {
  6278. // "description": "Lists sinks.",
  6279. // "flatPath": "v2/folders/{foldersId}/sinks",
  6280. // "httpMethod": "GET",
  6281. // "id": "logging.folders.sinks.list",
  6282. // "parameterOrder": [
  6283. // "parent"
  6284. // ],
  6285. // "parameters": {
  6286. // "pageSize": {
  6287. // "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.",
  6288. // "format": "int32",
  6289. // "location": "query",
  6290. // "type": "integer"
  6291. // },
  6292. // "pageToken": {
  6293. // "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.",
  6294. // "location": "query",
  6295. // "type": "string"
  6296. // },
  6297. // "parent": {
  6298. // "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",
  6299. // "location": "path",
  6300. // "pattern": "^folders/[^/]+$",
  6301. // "required": true,
  6302. // "type": "string"
  6303. // }
  6304. // },
  6305. // "path": "v2/{+parent}/sinks",
  6306. // "response": {
  6307. // "$ref": "ListSinksResponse"
  6308. // },
  6309. // "scopes": [
  6310. // "https://www.googleapis.com/auth/cloud-platform",
  6311. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  6312. // "https://www.googleapis.com/auth/logging.admin",
  6313. // "https://www.googleapis.com/auth/logging.read"
  6314. // ]
  6315. // }
  6316. }
  6317. // Pages invokes f for each page of results.
  6318. // A non-nil error returned from f will halt the iteration.
  6319. // The provided context supersedes any context provided to the Context method.
  6320. func (c *FoldersSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  6321. c.ctx_ = ctx
  6322. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6323. for {
  6324. x, err := c.Do()
  6325. if err != nil {
  6326. return err
  6327. }
  6328. if err := f(x); err != nil {
  6329. return err
  6330. }
  6331. if x.NextPageToken == "" {
  6332. return nil
  6333. }
  6334. c.PageToken(x.NextPageToken)
  6335. }
  6336. }
  6337. // method id "logging.folders.sinks.patch":
  6338. type FoldersSinksPatchCall struct {
  6339. s *Service
  6340. sinkNameid string
  6341. logsink *LogSink
  6342. urlParams_ gensupport.URLParams
  6343. ctx_ context.Context
  6344. header_ http.Header
  6345. }
  6346. // Patch: Updates a sink. This method replaces the following fields in
  6347. // the existing sink with values from the new sink: destination, and
  6348. // filter. The updated sink might also have a new writer_identity; see
  6349. // the unique_writer_identity field.
  6350. func (r *FoldersSinksService) Patch(sinkNameid string, logsink *LogSink) *FoldersSinksPatchCall {
  6351. c := &FoldersSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6352. c.sinkNameid = sinkNameid
  6353. c.logsink = logsink
  6354. return c
  6355. }
  6356. // UniqueWriterIdentity sets the optional parameter
  6357. // "uniqueWriterIdentity": See sinks.create for a description of this
  6358. // field. When updating a sink, the effect of this field on the value of
  6359. // writer_identity in the updated sink depends on both the old and new
  6360. // values of this field:
  6361. // If the old and new values of this field are both false or both true,
  6362. // then there is no change to the sink's writer_identity.
  6363. // If the old value is false and the new value is true, then
  6364. // writer_identity is changed to a unique service account.
  6365. // It is an error if the old value is true and the new value is set to
  6366. // false or defaulted to false.
  6367. func (c *FoldersSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *FoldersSinksPatchCall {
  6368. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  6369. return c
  6370. }
  6371. // UpdateMask sets the optional parameter "updateMask": Field mask that
  6372. // specifies the fields in sink that need an update. A sink field will
  6373. // be overwritten if, and only if, it is in the update mask. name and
  6374. // output only fields cannot be updated.An empty updateMask is
  6375. // temporarily treated as using the following mask for backwards
  6376. // compatibility purposes: destination,filter,includeChildren At some
  6377. // point in the future, behavior will be removed and specifying an empty
  6378. // updateMask will be an error.For a detailed FieldMask definition, see
  6379. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  6380. // updateMask=filter.
  6381. func (c *FoldersSinksPatchCall) UpdateMask(updateMask string) *FoldersSinksPatchCall {
  6382. c.urlParams_.Set("updateMask", updateMask)
  6383. return c
  6384. }
  6385. // Fields allows partial responses to be retrieved. See
  6386. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6387. // for more information.
  6388. func (c *FoldersSinksPatchCall) Fields(s ...googleapi.Field) *FoldersSinksPatchCall {
  6389. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6390. return c
  6391. }
  6392. // Context sets the context to be used in this call's Do method. Any
  6393. // pending HTTP request will be aborted if the provided context is
  6394. // canceled.
  6395. func (c *FoldersSinksPatchCall) Context(ctx context.Context) *FoldersSinksPatchCall {
  6396. c.ctx_ = ctx
  6397. return c
  6398. }
  6399. // Header returns an http.Header that can be modified by the caller to
  6400. // add HTTP headers to the request.
  6401. func (c *FoldersSinksPatchCall) Header() http.Header {
  6402. if c.header_ == nil {
  6403. c.header_ = make(http.Header)
  6404. }
  6405. return c.header_
  6406. }
  6407. func (c *FoldersSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  6408. reqHeaders := make(http.Header)
  6409. for k, v := range c.header_ {
  6410. reqHeaders[k] = v
  6411. }
  6412. reqHeaders.Set("User-Agent", c.s.userAgent())
  6413. var body io.Reader = nil
  6414. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  6415. if err != nil {
  6416. return nil, err
  6417. }
  6418. reqHeaders.Set("Content-Type", "application/json")
  6419. c.urlParams_.Set("alt", alt)
  6420. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  6421. urls += "?" + c.urlParams_.Encode()
  6422. req, _ := http.NewRequest("PATCH", urls, body)
  6423. req.Header = reqHeaders
  6424. googleapi.Expand(req.URL, map[string]string{
  6425. "sinkName": c.sinkNameid,
  6426. })
  6427. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6428. }
  6429. // Do executes the "logging.folders.sinks.patch" call.
  6430. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  6431. // code is an error. Response headers are in either
  6432. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  6433. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6434. // check whether the returned error was because http.StatusNotModified
  6435. // was returned.
  6436. func (c *FoldersSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  6437. gensupport.SetOptions(c.urlParams_, opts...)
  6438. res, err := c.doRequest("json")
  6439. if res != nil && res.StatusCode == http.StatusNotModified {
  6440. if res.Body != nil {
  6441. res.Body.Close()
  6442. }
  6443. return nil, &googleapi.Error{
  6444. Code: res.StatusCode,
  6445. Header: res.Header,
  6446. }
  6447. }
  6448. if err != nil {
  6449. return nil, err
  6450. }
  6451. defer googleapi.CloseBody(res)
  6452. if err := googleapi.CheckResponse(res); err != nil {
  6453. return nil, err
  6454. }
  6455. ret := &LogSink{
  6456. ServerResponse: googleapi.ServerResponse{
  6457. Header: res.Header,
  6458. HTTPStatusCode: res.StatusCode,
  6459. },
  6460. }
  6461. target := &ret
  6462. if err := gensupport.DecodeResponse(target, res); err != nil {
  6463. return nil, err
  6464. }
  6465. return ret, nil
  6466. // {
  6467. // "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.",
  6468. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6469. // "httpMethod": "PATCH",
  6470. // "id": "logging.folders.sinks.patch",
  6471. // "parameterOrder": [
  6472. // "sinkName"
  6473. // ],
  6474. // "parameters": {
  6475. // "sinkName": {
  6476. // "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\".",
  6477. // "location": "path",
  6478. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6479. // "required": true,
  6480. // "type": "string"
  6481. // },
  6482. // "uniqueWriterIdentity": {
  6483. // "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.",
  6484. // "location": "query",
  6485. // "type": "boolean"
  6486. // },
  6487. // "updateMask": {
  6488. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  6489. // "format": "google-fieldmask",
  6490. // "location": "query",
  6491. // "type": "string"
  6492. // }
  6493. // },
  6494. // "path": "v2/{+sinkName}",
  6495. // "request": {
  6496. // "$ref": "LogSink"
  6497. // },
  6498. // "response": {
  6499. // "$ref": "LogSink"
  6500. // },
  6501. // "scopes": [
  6502. // "https://www.googleapis.com/auth/cloud-platform",
  6503. // "https://www.googleapis.com/auth/logging.admin"
  6504. // ]
  6505. // }
  6506. }
  6507. // method id "logging.folders.sinks.update":
  6508. type FoldersSinksUpdateCall struct {
  6509. s *Service
  6510. sinkNameid string
  6511. logsink *LogSink
  6512. urlParams_ gensupport.URLParams
  6513. ctx_ context.Context
  6514. header_ http.Header
  6515. }
  6516. // Update: Updates a sink. This method replaces the following fields in
  6517. // the existing sink with values from the new sink: destination, and
  6518. // filter. The updated sink might also have a new writer_identity; see
  6519. // the unique_writer_identity field.
  6520. func (r *FoldersSinksService) Update(sinkNameid string, logsink *LogSink) *FoldersSinksUpdateCall {
  6521. c := &FoldersSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6522. c.sinkNameid = sinkNameid
  6523. c.logsink = logsink
  6524. return c
  6525. }
  6526. // UniqueWriterIdentity sets the optional parameter
  6527. // "uniqueWriterIdentity": See sinks.create for a description of this
  6528. // field. When updating a sink, the effect of this field on the value of
  6529. // writer_identity in the updated sink depends on both the old and new
  6530. // values of this field:
  6531. // If the old and new values of this field are both false or both true,
  6532. // then there is no change to the sink's writer_identity.
  6533. // If the old value is false and the new value is true, then
  6534. // writer_identity is changed to a unique service account.
  6535. // It is an error if the old value is true and the new value is set to
  6536. // false or defaulted to false.
  6537. func (c *FoldersSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *FoldersSinksUpdateCall {
  6538. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  6539. return c
  6540. }
  6541. // UpdateMask sets the optional parameter "updateMask": Field mask that
  6542. // specifies the fields in sink that need an update. A sink field will
  6543. // be overwritten if, and only if, it is in the update mask. name and
  6544. // output only fields cannot be updated.An empty updateMask is
  6545. // temporarily treated as using the following mask for backwards
  6546. // compatibility purposes: destination,filter,includeChildren At some
  6547. // point in the future, behavior will be removed and specifying an empty
  6548. // updateMask will be an error.For a detailed FieldMask definition, see
  6549. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  6550. // updateMask=filter.
  6551. func (c *FoldersSinksUpdateCall) UpdateMask(updateMask string) *FoldersSinksUpdateCall {
  6552. c.urlParams_.Set("updateMask", updateMask)
  6553. return c
  6554. }
  6555. // Fields allows partial responses to be retrieved. See
  6556. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6557. // for more information.
  6558. func (c *FoldersSinksUpdateCall) Fields(s ...googleapi.Field) *FoldersSinksUpdateCall {
  6559. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6560. return c
  6561. }
  6562. // Context sets the context to be used in this call's Do method. Any
  6563. // pending HTTP request will be aborted if the provided context is
  6564. // canceled.
  6565. func (c *FoldersSinksUpdateCall) Context(ctx context.Context) *FoldersSinksUpdateCall {
  6566. c.ctx_ = ctx
  6567. return c
  6568. }
  6569. // Header returns an http.Header that can be modified by the caller to
  6570. // add HTTP headers to the request.
  6571. func (c *FoldersSinksUpdateCall) Header() http.Header {
  6572. if c.header_ == nil {
  6573. c.header_ = make(http.Header)
  6574. }
  6575. return c.header_
  6576. }
  6577. func (c *FoldersSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  6578. reqHeaders := make(http.Header)
  6579. for k, v := range c.header_ {
  6580. reqHeaders[k] = v
  6581. }
  6582. reqHeaders.Set("User-Agent", c.s.userAgent())
  6583. var body io.Reader = nil
  6584. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  6585. if err != nil {
  6586. return nil, err
  6587. }
  6588. reqHeaders.Set("Content-Type", "application/json")
  6589. c.urlParams_.Set("alt", alt)
  6590. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  6591. urls += "?" + c.urlParams_.Encode()
  6592. req, _ := http.NewRequest("PUT", urls, body)
  6593. req.Header = reqHeaders
  6594. googleapi.Expand(req.URL, map[string]string{
  6595. "sinkName": c.sinkNameid,
  6596. })
  6597. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6598. }
  6599. // Do executes the "logging.folders.sinks.update" call.
  6600. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  6601. // code is an error. Response headers are in either
  6602. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  6603. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6604. // check whether the returned error was because http.StatusNotModified
  6605. // was returned.
  6606. func (c *FoldersSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  6607. gensupport.SetOptions(c.urlParams_, opts...)
  6608. res, err := c.doRequest("json")
  6609. if res != nil && res.StatusCode == http.StatusNotModified {
  6610. if res.Body != nil {
  6611. res.Body.Close()
  6612. }
  6613. return nil, &googleapi.Error{
  6614. Code: res.StatusCode,
  6615. Header: res.Header,
  6616. }
  6617. }
  6618. if err != nil {
  6619. return nil, err
  6620. }
  6621. defer googleapi.CloseBody(res)
  6622. if err := googleapi.CheckResponse(res); err != nil {
  6623. return nil, err
  6624. }
  6625. ret := &LogSink{
  6626. ServerResponse: googleapi.ServerResponse{
  6627. Header: res.Header,
  6628. HTTPStatusCode: res.StatusCode,
  6629. },
  6630. }
  6631. target := &ret
  6632. if err := gensupport.DecodeResponse(target, res); err != nil {
  6633. return nil, err
  6634. }
  6635. return ret, nil
  6636. // {
  6637. // "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.",
  6638. // "flatPath": "v2/folders/{foldersId}/sinks/{sinksId}",
  6639. // "httpMethod": "PUT",
  6640. // "id": "logging.folders.sinks.update",
  6641. // "parameterOrder": [
  6642. // "sinkName"
  6643. // ],
  6644. // "parameters": {
  6645. // "sinkName": {
  6646. // "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\".",
  6647. // "location": "path",
  6648. // "pattern": "^folders/[^/]+/sinks/[^/]+$",
  6649. // "required": true,
  6650. // "type": "string"
  6651. // },
  6652. // "uniqueWriterIdentity": {
  6653. // "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.",
  6654. // "location": "query",
  6655. // "type": "boolean"
  6656. // },
  6657. // "updateMask": {
  6658. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  6659. // "format": "google-fieldmask",
  6660. // "location": "query",
  6661. // "type": "string"
  6662. // }
  6663. // },
  6664. // "path": "v2/{+sinkName}",
  6665. // "request": {
  6666. // "$ref": "LogSink"
  6667. // },
  6668. // "response": {
  6669. // "$ref": "LogSink"
  6670. // },
  6671. // "scopes": [
  6672. // "https://www.googleapis.com/auth/cloud-platform",
  6673. // "https://www.googleapis.com/auth/logging.admin"
  6674. // ]
  6675. // }
  6676. }
  6677. // method id "logging.logs.delete":
  6678. type LogsDeleteCall struct {
  6679. s *Service
  6680. logName string
  6681. urlParams_ gensupport.URLParams
  6682. ctx_ context.Context
  6683. header_ http.Header
  6684. }
  6685. // Delete: Deletes all the log entries in a log. The log reappears if it
  6686. // receives new entries. Log entries written shortly before the delete
  6687. // operation might not be deleted.
  6688. func (r *LogsService) Delete(logName string) *LogsDeleteCall {
  6689. c := &LogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6690. c.logName = logName
  6691. return c
  6692. }
  6693. // Fields allows partial responses to be retrieved. See
  6694. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6695. // for more information.
  6696. func (c *LogsDeleteCall) Fields(s ...googleapi.Field) *LogsDeleteCall {
  6697. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6698. return c
  6699. }
  6700. // Context sets the context to be used in this call's Do method. Any
  6701. // pending HTTP request will be aborted if the provided context is
  6702. // canceled.
  6703. func (c *LogsDeleteCall) Context(ctx context.Context) *LogsDeleteCall {
  6704. c.ctx_ = ctx
  6705. return c
  6706. }
  6707. // Header returns an http.Header that can be modified by the caller to
  6708. // add HTTP headers to the request.
  6709. func (c *LogsDeleteCall) Header() http.Header {
  6710. if c.header_ == nil {
  6711. c.header_ = make(http.Header)
  6712. }
  6713. return c.header_
  6714. }
  6715. func (c *LogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6716. reqHeaders := make(http.Header)
  6717. for k, v := range c.header_ {
  6718. reqHeaders[k] = v
  6719. }
  6720. reqHeaders.Set("User-Agent", c.s.userAgent())
  6721. var body io.Reader = nil
  6722. c.urlParams_.Set("alt", alt)
  6723. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  6724. urls += "?" + c.urlParams_.Encode()
  6725. req, _ := http.NewRequest("DELETE", urls, body)
  6726. req.Header = reqHeaders
  6727. googleapi.Expand(req.URL, map[string]string{
  6728. "logName": c.logName,
  6729. })
  6730. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6731. }
  6732. // Do executes the "logging.logs.delete" call.
  6733. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6734. // code is an error. Response headers are in either
  6735. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6736. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6737. // check whether the returned error was because http.StatusNotModified
  6738. // was returned.
  6739. func (c *LogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6740. gensupport.SetOptions(c.urlParams_, opts...)
  6741. res, err := c.doRequest("json")
  6742. if res != nil && res.StatusCode == http.StatusNotModified {
  6743. if res.Body != nil {
  6744. res.Body.Close()
  6745. }
  6746. return nil, &googleapi.Error{
  6747. Code: res.StatusCode,
  6748. Header: res.Header,
  6749. }
  6750. }
  6751. if err != nil {
  6752. return nil, err
  6753. }
  6754. defer googleapi.CloseBody(res)
  6755. if err := googleapi.CheckResponse(res); err != nil {
  6756. return nil, err
  6757. }
  6758. ret := &Empty{
  6759. ServerResponse: googleapi.ServerResponse{
  6760. Header: res.Header,
  6761. HTTPStatusCode: res.StatusCode,
  6762. },
  6763. }
  6764. target := &ret
  6765. if err := gensupport.DecodeResponse(target, res); err != nil {
  6766. return nil, err
  6767. }
  6768. return ret, nil
  6769. // {
  6770. // "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.",
  6771. // "flatPath": "v2/{v2Id}/{v2Id1}/logs/{logsId}",
  6772. // "httpMethod": "DELETE",
  6773. // "id": "logging.logs.delete",
  6774. // "parameterOrder": [
  6775. // "logName"
  6776. // ],
  6777. // "parameters": {
  6778. // "logName": {
  6779. // "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.",
  6780. // "location": "path",
  6781. // "pattern": "^[^/]+/[^/]+/logs/[^/]+$",
  6782. // "required": true,
  6783. // "type": "string"
  6784. // }
  6785. // },
  6786. // "path": "v2/{+logName}",
  6787. // "response": {
  6788. // "$ref": "Empty"
  6789. // },
  6790. // "scopes": [
  6791. // "https://www.googleapis.com/auth/cloud-platform",
  6792. // "https://www.googleapis.com/auth/logging.admin"
  6793. // ]
  6794. // }
  6795. }
  6796. // method id "logging.logs.list":
  6797. type LogsListCall struct {
  6798. s *Service
  6799. parent string
  6800. urlParams_ gensupport.URLParams
  6801. ifNoneMatch_ string
  6802. ctx_ context.Context
  6803. header_ http.Header
  6804. }
  6805. // List: Lists the logs in projects, organizations, folders, or billing
  6806. // accounts. Only logs that have entries are listed.
  6807. func (r *LogsService) List(parent string) *LogsListCall {
  6808. c := &LogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6809. c.parent = parent
  6810. return c
  6811. }
  6812. // PageSize sets the optional parameter "pageSize": The maximum number
  6813. // of results to return from this request. Non-positive values are
  6814. // ignored. The presence of nextPageToken in the response indicates that
  6815. // more results might be available.
  6816. func (c *LogsListCall) PageSize(pageSize int64) *LogsListCall {
  6817. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6818. return c
  6819. }
  6820. // PageToken sets the optional parameter "pageToken": If present, then
  6821. // retrieve the next batch of results from the preceding call to this
  6822. // method. pageToken must be the value of nextPageToken from the
  6823. // previous response. The values of other method parameters should be
  6824. // identical to those in the previous call.
  6825. func (c *LogsListCall) PageToken(pageToken string) *LogsListCall {
  6826. c.urlParams_.Set("pageToken", pageToken)
  6827. return c
  6828. }
  6829. // Fields allows partial responses to be retrieved. See
  6830. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6831. // for more information.
  6832. func (c *LogsListCall) Fields(s ...googleapi.Field) *LogsListCall {
  6833. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6834. return c
  6835. }
  6836. // IfNoneMatch sets the optional parameter which makes the operation
  6837. // fail if the object's ETag matches the given value. This is useful for
  6838. // getting updates only after the object has changed since the last
  6839. // request. Use googleapi.IsNotModified to check whether the response
  6840. // error from Do is the result of In-None-Match.
  6841. func (c *LogsListCall) IfNoneMatch(entityTag string) *LogsListCall {
  6842. c.ifNoneMatch_ = entityTag
  6843. return c
  6844. }
  6845. // Context sets the context to be used in this call's Do method. Any
  6846. // pending HTTP request will be aborted if the provided context is
  6847. // canceled.
  6848. func (c *LogsListCall) Context(ctx context.Context) *LogsListCall {
  6849. c.ctx_ = ctx
  6850. return c
  6851. }
  6852. // Header returns an http.Header that can be modified by the caller to
  6853. // add HTTP headers to the request.
  6854. func (c *LogsListCall) Header() http.Header {
  6855. if c.header_ == nil {
  6856. c.header_ = make(http.Header)
  6857. }
  6858. return c.header_
  6859. }
  6860. func (c *LogsListCall) doRequest(alt string) (*http.Response, error) {
  6861. reqHeaders := make(http.Header)
  6862. for k, v := range c.header_ {
  6863. reqHeaders[k] = v
  6864. }
  6865. reqHeaders.Set("User-Agent", c.s.userAgent())
  6866. if c.ifNoneMatch_ != "" {
  6867. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6868. }
  6869. var body io.Reader = nil
  6870. c.urlParams_.Set("alt", alt)
  6871. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  6872. urls += "?" + c.urlParams_.Encode()
  6873. req, _ := http.NewRequest("GET", urls, body)
  6874. req.Header = reqHeaders
  6875. googleapi.Expand(req.URL, map[string]string{
  6876. "parent": c.parent,
  6877. })
  6878. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6879. }
  6880. // Do executes the "logging.logs.list" call.
  6881. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  6882. // non-2xx status code is an error. Response headers are in either
  6883. // *ListLogsResponse.ServerResponse.Header or (if a response was
  6884. // returned at all) in error.(*googleapi.Error).Header. Use
  6885. // googleapi.IsNotModified to check whether the returned error was
  6886. // because http.StatusNotModified was returned.
  6887. func (c *LogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  6888. gensupport.SetOptions(c.urlParams_, opts...)
  6889. res, err := c.doRequest("json")
  6890. if res != nil && res.StatusCode == http.StatusNotModified {
  6891. if res.Body != nil {
  6892. res.Body.Close()
  6893. }
  6894. return nil, &googleapi.Error{
  6895. Code: res.StatusCode,
  6896. Header: res.Header,
  6897. }
  6898. }
  6899. if err != nil {
  6900. return nil, err
  6901. }
  6902. defer googleapi.CloseBody(res)
  6903. if err := googleapi.CheckResponse(res); err != nil {
  6904. return nil, err
  6905. }
  6906. ret := &ListLogsResponse{
  6907. ServerResponse: googleapi.ServerResponse{
  6908. Header: res.Header,
  6909. HTTPStatusCode: res.StatusCode,
  6910. },
  6911. }
  6912. target := &ret
  6913. if err := gensupport.DecodeResponse(target, res); err != nil {
  6914. return nil, err
  6915. }
  6916. return ret, nil
  6917. // {
  6918. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  6919. // "flatPath": "v2/{v2Id}/{v2Id1}/logs",
  6920. // "httpMethod": "GET",
  6921. // "id": "logging.logs.list",
  6922. // "parameterOrder": [
  6923. // "parent"
  6924. // ],
  6925. // "parameters": {
  6926. // "pageSize": {
  6927. // "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.",
  6928. // "format": "int32",
  6929. // "location": "query",
  6930. // "type": "integer"
  6931. // },
  6932. // "pageToken": {
  6933. // "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.",
  6934. // "location": "query",
  6935. // "type": "string"
  6936. // },
  6937. // "parent": {
  6938. // "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",
  6939. // "location": "path",
  6940. // "pattern": "^[^/]+/[^/]+$",
  6941. // "required": true,
  6942. // "type": "string"
  6943. // }
  6944. // },
  6945. // "path": "v2/{+parent}/logs",
  6946. // "response": {
  6947. // "$ref": "ListLogsResponse"
  6948. // },
  6949. // "scopes": [
  6950. // "https://www.googleapis.com/auth/cloud-platform",
  6951. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  6952. // "https://www.googleapis.com/auth/logging.admin",
  6953. // "https://www.googleapis.com/auth/logging.read"
  6954. // ]
  6955. // }
  6956. }
  6957. // Pages invokes f for each page of results.
  6958. // A non-nil error returned from f will halt the iteration.
  6959. // The provided context supersedes any context provided to the Context method.
  6960. func (c *LogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  6961. c.ctx_ = ctx
  6962. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6963. for {
  6964. x, err := c.Do()
  6965. if err != nil {
  6966. return err
  6967. }
  6968. if err := f(x); err != nil {
  6969. return err
  6970. }
  6971. if x.NextPageToken == "" {
  6972. return nil
  6973. }
  6974. c.PageToken(x.NextPageToken)
  6975. }
  6976. }
  6977. // method id "logging.monitoredResourceDescriptors.list":
  6978. type MonitoredResourceDescriptorsListCall struct {
  6979. s *Service
  6980. urlParams_ gensupport.URLParams
  6981. ifNoneMatch_ string
  6982. ctx_ context.Context
  6983. header_ http.Header
  6984. }
  6985. // List: Lists the descriptors for monitored resource types used by
  6986. // Stackdriver Logging.
  6987. func (r *MonitoredResourceDescriptorsService) List() *MonitoredResourceDescriptorsListCall {
  6988. c := &MonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6989. return c
  6990. }
  6991. // PageSize sets the optional parameter "pageSize": The maximum number
  6992. // of results to return from this request. Non-positive values are
  6993. // ignored. The presence of nextPageToken in the response indicates that
  6994. // more results might be available.
  6995. func (c *MonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *MonitoredResourceDescriptorsListCall {
  6996. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6997. return c
  6998. }
  6999. // PageToken sets the optional parameter "pageToken": If present, then
  7000. // retrieve the next batch of results from the preceding call to this
  7001. // method. pageToken must be the value of nextPageToken from the
  7002. // previous response. The values of other method parameters should be
  7003. // identical to those in the previous call.
  7004. func (c *MonitoredResourceDescriptorsListCall) PageToken(pageToken string) *MonitoredResourceDescriptorsListCall {
  7005. c.urlParams_.Set("pageToken", pageToken)
  7006. return c
  7007. }
  7008. // Fields allows partial responses to be retrieved. See
  7009. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7010. // for more information.
  7011. func (c *MonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *MonitoredResourceDescriptorsListCall {
  7012. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7013. return c
  7014. }
  7015. // IfNoneMatch sets the optional parameter which makes the operation
  7016. // fail if the object's ETag matches the given value. This is useful for
  7017. // getting updates only after the object has changed since the last
  7018. // request. Use googleapi.IsNotModified to check whether the response
  7019. // error from Do is the result of In-None-Match.
  7020. func (c *MonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *MonitoredResourceDescriptorsListCall {
  7021. c.ifNoneMatch_ = entityTag
  7022. return c
  7023. }
  7024. // Context sets the context to be used in this call's Do method. Any
  7025. // pending HTTP request will be aborted if the provided context is
  7026. // canceled.
  7027. func (c *MonitoredResourceDescriptorsListCall) Context(ctx context.Context) *MonitoredResourceDescriptorsListCall {
  7028. c.ctx_ = ctx
  7029. return c
  7030. }
  7031. // Header returns an http.Header that can be modified by the caller to
  7032. // add HTTP headers to the request.
  7033. func (c *MonitoredResourceDescriptorsListCall) Header() http.Header {
  7034. if c.header_ == nil {
  7035. c.header_ = make(http.Header)
  7036. }
  7037. return c.header_
  7038. }
  7039. func (c *MonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  7040. reqHeaders := make(http.Header)
  7041. for k, v := range c.header_ {
  7042. reqHeaders[k] = v
  7043. }
  7044. reqHeaders.Set("User-Agent", c.s.userAgent())
  7045. if c.ifNoneMatch_ != "" {
  7046. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7047. }
  7048. var body io.Reader = nil
  7049. c.urlParams_.Set("alt", alt)
  7050. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/monitoredResourceDescriptors")
  7051. urls += "?" + c.urlParams_.Encode()
  7052. req, _ := http.NewRequest("GET", urls, body)
  7053. req.Header = reqHeaders
  7054. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7055. }
  7056. // Do executes the "logging.monitoredResourceDescriptors.list" call.
  7057. // Exactly one of *ListMonitoredResourceDescriptorsResponse or error
  7058. // will be non-nil. Any non-2xx status code is an error. Response
  7059. // headers are in either
  7060. // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or
  7061. // (if a response was returned at all) in
  7062. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7063. // whether the returned error was because http.StatusNotModified was
  7064. // returned.
  7065. func (c *MonitoredResourceDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
  7066. gensupport.SetOptions(c.urlParams_, opts...)
  7067. res, err := c.doRequest("json")
  7068. if res != nil && res.StatusCode == http.StatusNotModified {
  7069. if res.Body != nil {
  7070. res.Body.Close()
  7071. }
  7072. return nil, &googleapi.Error{
  7073. Code: res.StatusCode,
  7074. Header: res.Header,
  7075. }
  7076. }
  7077. if err != nil {
  7078. return nil, err
  7079. }
  7080. defer googleapi.CloseBody(res)
  7081. if err := googleapi.CheckResponse(res); err != nil {
  7082. return nil, err
  7083. }
  7084. ret := &ListMonitoredResourceDescriptorsResponse{
  7085. ServerResponse: googleapi.ServerResponse{
  7086. Header: res.Header,
  7087. HTTPStatusCode: res.StatusCode,
  7088. },
  7089. }
  7090. target := &ret
  7091. if err := gensupport.DecodeResponse(target, res); err != nil {
  7092. return nil, err
  7093. }
  7094. return ret, nil
  7095. // {
  7096. // "description": "Lists the descriptors for monitored resource types used by Stackdriver Logging.",
  7097. // "flatPath": "v2/monitoredResourceDescriptors",
  7098. // "httpMethod": "GET",
  7099. // "id": "logging.monitoredResourceDescriptors.list",
  7100. // "parameterOrder": [],
  7101. // "parameters": {
  7102. // "pageSize": {
  7103. // "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.",
  7104. // "format": "int32",
  7105. // "location": "query",
  7106. // "type": "integer"
  7107. // },
  7108. // "pageToken": {
  7109. // "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.",
  7110. // "location": "query",
  7111. // "type": "string"
  7112. // }
  7113. // },
  7114. // "path": "v2/monitoredResourceDescriptors",
  7115. // "response": {
  7116. // "$ref": "ListMonitoredResourceDescriptorsResponse"
  7117. // },
  7118. // "scopes": [
  7119. // "https://www.googleapis.com/auth/cloud-platform",
  7120. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7121. // "https://www.googleapis.com/auth/logging.admin",
  7122. // "https://www.googleapis.com/auth/logging.read"
  7123. // ]
  7124. // }
  7125. }
  7126. // Pages invokes f for each page of results.
  7127. // A non-nil error returned from f will halt the iteration.
  7128. // The provided context supersedes any context provided to the Context method.
  7129. func (c *MonitoredResourceDescriptorsListCall) Pages(ctx context.Context, f func(*ListMonitoredResourceDescriptorsResponse) error) error {
  7130. c.ctx_ = ctx
  7131. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7132. for {
  7133. x, err := c.Do()
  7134. if err != nil {
  7135. return err
  7136. }
  7137. if err := f(x); err != nil {
  7138. return err
  7139. }
  7140. if x.NextPageToken == "" {
  7141. return nil
  7142. }
  7143. c.PageToken(x.NextPageToken)
  7144. }
  7145. }
  7146. // method id "logging.organizations.exclusions.create":
  7147. type OrganizationsExclusionsCreateCall struct {
  7148. s *Service
  7149. parent string
  7150. logexclusion *LogExclusion
  7151. urlParams_ gensupport.URLParams
  7152. ctx_ context.Context
  7153. header_ http.Header
  7154. }
  7155. // Create: Creates a new exclusion in a specified parent resource. Only
  7156. // log entries belonging to that resource can be excluded. You can have
  7157. // up to 10 exclusions in a resource.
  7158. func (r *OrganizationsExclusionsService) Create(parent string, logexclusion *LogExclusion) *OrganizationsExclusionsCreateCall {
  7159. c := &OrganizationsExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7160. c.parent = parent
  7161. c.logexclusion = logexclusion
  7162. return c
  7163. }
  7164. // Fields allows partial responses to be retrieved. See
  7165. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7166. // for more information.
  7167. func (c *OrganizationsExclusionsCreateCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsCreateCall {
  7168. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7169. return c
  7170. }
  7171. // Context sets the context to be used in this call's Do method. Any
  7172. // pending HTTP request will be aborted if the provided context is
  7173. // canceled.
  7174. func (c *OrganizationsExclusionsCreateCall) Context(ctx context.Context) *OrganizationsExclusionsCreateCall {
  7175. c.ctx_ = ctx
  7176. return c
  7177. }
  7178. // Header returns an http.Header that can be modified by the caller to
  7179. // add HTTP headers to the request.
  7180. func (c *OrganizationsExclusionsCreateCall) Header() http.Header {
  7181. if c.header_ == nil {
  7182. c.header_ = make(http.Header)
  7183. }
  7184. return c.header_
  7185. }
  7186. func (c *OrganizationsExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  7187. reqHeaders := make(http.Header)
  7188. for k, v := range c.header_ {
  7189. reqHeaders[k] = v
  7190. }
  7191. reqHeaders.Set("User-Agent", c.s.userAgent())
  7192. var body io.Reader = nil
  7193. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  7194. if err != nil {
  7195. return nil, err
  7196. }
  7197. reqHeaders.Set("Content-Type", "application/json")
  7198. c.urlParams_.Set("alt", alt)
  7199. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  7200. urls += "?" + c.urlParams_.Encode()
  7201. req, _ := http.NewRequest("POST", urls, body)
  7202. req.Header = reqHeaders
  7203. googleapi.Expand(req.URL, map[string]string{
  7204. "parent": c.parent,
  7205. })
  7206. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7207. }
  7208. // Do executes the "logging.organizations.exclusions.create" call.
  7209. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  7210. // status code is an error. Response headers are in either
  7211. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  7212. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7213. // to check whether the returned error was because
  7214. // http.StatusNotModified was returned.
  7215. func (c *OrganizationsExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  7216. gensupport.SetOptions(c.urlParams_, opts...)
  7217. res, err := c.doRequest("json")
  7218. if res != nil && res.StatusCode == http.StatusNotModified {
  7219. if res.Body != nil {
  7220. res.Body.Close()
  7221. }
  7222. return nil, &googleapi.Error{
  7223. Code: res.StatusCode,
  7224. Header: res.Header,
  7225. }
  7226. }
  7227. if err != nil {
  7228. return nil, err
  7229. }
  7230. defer googleapi.CloseBody(res)
  7231. if err := googleapi.CheckResponse(res); err != nil {
  7232. return nil, err
  7233. }
  7234. ret := &LogExclusion{
  7235. ServerResponse: googleapi.ServerResponse{
  7236. Header: res.Header,
  7237. HTTPStatusCode: res.StatusCode,
  7238. },
  7239. }
  7240. target := &ret
  7241. if err := gensupport.DecodeResponse(target, res); err != nil {
  7242. return nil, err
  7243. }
  7244. return ret, nil
  7245. // {
  7246. // "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.",
  7247. // "flatPath": "v2/organizations/{organizationsId}/exclusions",
  7248. // "httpMethod": "POST",
  7249. // "id": "logging.organizations.exclusions.create",
  7250. // "parameterOrder": [
  7251. // "parent"
  7252. // ],
  7253. // "parameters": {
  7254. // "parent": {
  7255. // "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\".",
  7256. // "location": "path",
  7257. // "pattern": "^organizations/[^/]+$",
  7258. // "required": true,
  7259. // "type": "string"
  7260. // }
  7261. // },
  7262. // "path": "v2/{+parent}/exclusions",
  7263. // "request": {
  7264. // "$ref": "LogExclusion"
  7265. // },
  7266. // "response": {
  7267. // "$ref": "LogExclusion"
  7268. // },
  7269. // "scopes": [
  7270. // "https://www.googleapis.com/auth/cloud-platform",
  7271. // "https://www.googleapis.com/auth/logging.admin"
  7272. // ]
  7273. // }
  7274. }
  7275. // method id "logging.organizations.exclusions.delete":
  7276. type OrganizationsExclusionsDeleteCall struct {
  7277. s *Service
  7278. name string
  7279. urlParams_ gensupport.URLParams
  7280. ctx_ context.Context
  7281. header_ http.Header
  7282. }
  7283. // Delete: Deletes an exclusion.
  7284. func (r *OrganizationsExclusionsService) Delete(name string) *OrganizationsExclusionsDeleteCall {
  7285. c := &OrganizationsExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7286. c.name = name
  7287. return c
  7288. }
  7289. // Fields allows partial responses to be retrieved. See
  7290. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7291. // for more information.
  7292. func (c *OrganizationsExclusionsDeleteCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsDeleteCall {
  7293. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7294. return c
  7295. }
  7296. // Context sets the context to be used in this call's Do method. Any
  7297. // pending HTTP request will be aborted if the provided context is
  7298. // canceled.
  7299. func (c *OrganizationsExclusionsDeleteCall) Context(ctx context.Context) *OrganizationsExclusionsDeleteCall {
  7300. c.ctx_ = ctx
  7301. return c
  7302. }
  7303. // Header returns an http.Header that can be modified by the caller to
  7304. // add HTTP headers to the request.
  7305. func (c *OrganizationsExclusionsDeleteCall) Header() http.Header {
  7306. if c.header_ == nil {
  7307. c.header_ = make(http.Header)
  7308. }
  7309. return c.header_
  7310. }
  7311. func (c *OrganizationsExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7312. reqHeaders := make(http.Header)
  7313. for k, v := range c.header_ {
  7314. reqHeaders[k] = v
  7315. }
  7316. reqHeaders.Set("User-Agent", c.s.userAgent())
  7317. var body io.Reader = nil
  7318. c.urlParams_.Set("alt", alt)
  7319. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  7320. urls += "?" + c.urlParams_.Encode()
  7321. req, _ := http.NewRequest("DELETE", urls, body)
  7322. req.Header = reqHeaders
  7323. googleapi.Expand(req.URL, map[string]string{
  7324. "name": c.name,
  7325. })
  7326. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7327. }
  7328. // Do executes the "logging.organizations.exclusions.delete" call.
  7329. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7330. // code is an error. Response headers are in either
  7331. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7332. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7333. // check whether the returned error was because http.StatusNotModified
  7334. // was returned.
  7335. func (c *OrganizationsExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7336. gensupport.SetOptions(c.urlParams_, opts...)
  7337. res, err := c.doRequest("json")
  7338. if res != nil && res.StatusCode == http.StatusNotModified {
  7339. if res.Body != nil {
  7340. res.Body.Close()
  7341. }
  7342. return nil, &googleapi.Error{
  7343. Code: res.StatusCode,
  7344. Header: res.Header,
  7345. }
  7346. }
  7347. if err != nil {
  7348. return nil, err
  7349. }
  7350. defer googleapi.CloseBody(res)
  7351. if err := googleapi.CheckResponse(res); err != nil {
  7352. return nil, err
  7353. }
  7354. ret := &Empty{
  7355. ServerResponse: googleapi.ServerResponse{
  7356. Header: res.Header,
  7357. HTTPStatusCode: res.StatusCode,
  7358. },
  7359. }
  7360. target := &ret
  7361. if err := gensupport.DecodeResponse(target, res); err != nil {
  7362. return nil, err
  7363. }
  7364. return ret, nil
  7365. // {
  7366. // "description": "Deletes an exclusion.",
  7367. // "flatPath": "v2/organizations/{organizationsId}/exclusions/{exclusionsId}",
  7368. // "httpMethod": "DELETE",
  7369. // "id": "logging.organizations.exclusions.delete",
  7370. // "parameterOrder": [
  7371. // "name"
  7372. // ],
  7373. // "parameters": {
  7374. // "name": {
  7375. // "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\".",
  7376. // "location": "path",
  7377. // "pattern": "^organizations/[^/]+/exclusions/[^/]+$",
  7378. // "required": true,
  7379. // "type": "string"
  7380. // }
  7381. // },
  7382. // "path": "v2/{+name}",
  7383. // "response": {
  7384. // "$ref": "Empty"
  7385. // },
  7386. // "scopes": [
  7387. // "https://www.googleapis.com/auth/cloud-platform",
  7388. // "https://www.googleapis.com/auth/logging.admin"
  7389. // ]
  7390. // }
  7391. }
  7392. // method id "logging.organizations.exclusions.get":
  7393. type OrganizationsExclusionsGetCall struct {
  7394. s *Service
  7395. name string
  7396. urlParams_ gensupport.URLParams
  7397. ifNoneMatch_ string
  7398. ctx_ context.Context
  7399. header_ http.Header
  7400. }
  7401. // Get: Gets the description of an exclusion.
  7402. func (r *OrganizationsExclusionsService) Get(name string) *OrganizationsExclusionsGetCall {
  7403. c := &OrganizationsExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7404. c.name = name
  7405. return c
  7406. }
  7407. // Fields allows partial responses to be retrieved. See
  7408. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7409. // for more information.
  7410. func (c *OrganizationsExclusionsGetCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsGetCall {
  7411. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7412. return c
  7413. }
  7414. // IfNoneMatch sets the optional parameter which makes the operation
  7415. // fail if the object's ETag matches the given value. This is useful for
  7416. // getting updates only after the object has changed since the last
  7417. // request. Use googleapi.IsNotModified to check whether the response
  7418. // error from Do is the result of In-None-Match.
  7419. func (c *OrganizationsExclusionsGetCall) IfNoneMatch(entityTag string) *OrganizationsExclusionsGetCall {
  7420. c.ifNoneMatch_ = entityTag
  7421. return c
  7422. }
  7423. // Context sets the context to be used in this call's Do method. Any
  7424. // pending HTTP request will be aborted if the provided context is
  7425. // canceled.
  7426. func (c *OrganizationsExclusionsGetCall) Context(ctx context.Context) *OrganizationsExclusionsGetCall {
  7427. c.ctx_ = ctx
  7428. return c
  7429. }
  7430. // Header returns an http.Header that can be modified by the caller to
  7431. // add HTTP headers to the request.
  7432. func (c *OrganizationsExclusionsGetCall) Header() http.Header {
  7433. if c.header_ == nil {
  7434. c.header_ = make(http.Header)
  7435. }
  7436. return c.header_
  7437. }
  7438. func (c *OrganizationsExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  7439. reqHeaders := make(http.Header)
  7440. for k, v := range c.header_ {
  7441. reqHeaders[k] = v
  7442. }
  7443. reqHeaders.Set("User-Agent", c.s.userAgent())
  7444. if c.ifNoneMatch_ != "" {
  7445. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7446. }
  7447. var body io.Reader = nil
  7448. c.urlParams_.Set("alt", alt)
  7449. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  7450. urls += "?" + c.urlParams_.Encode()
  7451. req, _ := http.NewRequest("GET", urls, body)
  7452. req.Header = reqHeaders
  7453. googleapi.Expand(req.URL, map[string]string{
  7454. "name": c.name,
  7455. })
  7456. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7457. }
  7458. // Do executes the "logging.organizations.exclusions.get" call.
  7459. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  7460. // status code is an error. Response headers are in either
  7461. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  7462. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7463. // to check whether the returned error was because
  7464. // http.StatusNotModified was returned.
  7465. func (c *OrganizationsExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  7466. gensupport.SetOptions(c.urlParams_, opts...)
  7467. res, err := c.doRequest("json")
  7468. if res != nil && res.StatusCode == http.StatusNotModified {
  7469. if res.Body != nil {
  7470. res.Body.Close()
  7471. }
  7472. return nil, &googleapi.Error{
  7473. Code: res.StatusCode,
  7474. Header: res.Header,
  7475. }
  7476. }
  7477. if err != nil {
  7478. return nil, err
  7479. }
  7480. defer googleapi.CloseBody(res)
  7481. if err := googleapi.CheckResponse(res); err != nil {
  7482. return nil, err
  7483. }
  7484. ret := &LogExclusion{
  7485. ServerResponse: googleapi.ServerResponse{
  7486. Header: res.Header,
  7487. HTTPStatusCode: res.StatusCode,
  7488. },
  7489. }
  7490. target := &ret
  7491. if err := gensupport.DecodeResponse(target, res); err != nil {
  7492. return nil, err
  7493. }
  7494. return ret, nil
  7495. // {
  7496. // "description": "Gets the description of an exclusion.",
  7497. // "flatPath": "v2/organizations/{organizationsId}/exclusions/{exclusionsId}",
  7498. // "httpMethod": "GET",
  7499. // "id": "logging.organizations.exclusions.get",
  7500. // "parameterOrder": [
  7501. // "name"
  7502. // ],
  7503. // "parameters": {
  7504. // "name": {
  7505. // "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\".",
  7506. // "location": "path",
  7507. // "pattern": "^organizations/[^/]+/exclusions/[^/]+$",
  7508. // "required": true,
  7509. // "type": "string"
  7510. // }
  7511. // },
  7512. // "path": "v2/{+name}",
  7513. // "response": {
  7514. // "$ref": "LogExclusion"
  7515. // },
  7516. // "scopes": [
  7517. // "https://www.googleapis.com/auth/cloud-platform",
  7518. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7519. // "https://www.googleapis.com/auth/logging.admin",
  7520. // "https://www.googleapis.com/auth/logging.read"
  7521. // ]
  7522. // }
  7523. }
  7524. // method id "logging.organizations.exclusions.list":
  7525. type OrganizationsExclusionsListCall struct {
  7526. s *Service
  7527. parent string
  7528. urlParams_ gensupport.URLParams
  7529. ifNoneMatch_ string
  7530. ctx_ context.Context
  7531. header_ http.Header
  7532. }
  7533. // List: Lists all the exclusions in a parent resource.
  7534. func (r *OrganizationsExclusionsService) List(parent string) *OrganizationsExclusionsListCall {
  7535. c := &OrganizationsExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7536. c.parent = parent
  7537. return c
  7538. }
  7539. // PageSize sets the optional parameter "pageSize": The maximum number
  7540. // of results to return from this request. Non-positive values are
  7541. // ignored. The presence of nextPageToken in the response indicates that
  7542. // more results might be available.
  7543. func (c *OrganizationsExclusionsListCall) PageSize(pageSize int64) *OrganizationsExclusionsListCall {
  7544. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7545. return c
  7546. }
  7547. // PageToken sets the optional parameter "pageToken": If present, then
  7548. // retrieve the next batch of results from the preceding call to this
  7549. // method. pageToken must be the value of nextPageToken from the
  7550. // previous response. The values of other method parameters should be
  7551. // identical to those in the previous call.
  7552. func (c *OrganizationsExclusionsListCall) PageToken(pageToken string) *OrganizationsExclusionsListCall {
  7553. c.urlParams_.Set("pageToken", pageToken)
  7554. return c
  7555. }
  7556. // Fields allows partial responses to be retrieved. See
  7557. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7558. // for more information.
  7559. func (c *OrganizationsExclusionsListCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsListCall {
  7560. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7561. return c
  7562. }
  7563. // IfNoneMatch sets the optional parameter which makes the operation
  7564. // fail if the object's ETag matches the given value. This is useful for
  7565. // getting updates only after the object has changed since the last
  7566. // request. Use googleapi.IsNotModified to check whether the response
  7567. // error from Do is the result of In-None-Match.
  7568. func (c *OrganizationsExclusionsListCall) IfNoneMatch(entityTag string) *OrganizationsExclusionsListCall {
  7569. c.ifNoneMatch_ = entityTag
  7570. return c
  7571. }
  7572. // Context sets the context to be used in this call's Do method. Any
  7573. // pending HTTP request will be aborted if the provided context is
  7574. // canceled.
  7575. func (c *OrganizationsExclusionsListCall) Context(ctx context.Context) *OrganizationsExclusionsListCall {
  7576. c.ctx_ = ctx
  7577. return c
  7578. }
  7579. // Header returns an http.Header that can be modified by the caller to
  7580. // add HTTP headers to the request.
  7581. func (c *OrganizationsExclusionsListCall) Header() http.Header {
  7582. if c.header_ == nil {
  7583. c.header_ = make(http.Header)
  7584. }
  7585. return c.header_
  7586. }
  7587. func (c *OrganizationsExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  7588. reqHeaders := make(http.Header)
  7589. for k, v := range c.header_ {
  7590. reqHeaders[k] = v
  7591. }
  7592. reqHeaders.Set("User-Agent", c.s.userAgent())
  7593. if c.ifNoneMatch_ != "" {
  7594. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7595. }
  7596. var body io.Reader = nil
  7597. c.urlParams_.Set("alt", alt)
  7598. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  7599. urls += "?" + c.urlParams_.Encode()
  7600. req, _ := http.NewRequest("GET", urls, body)
  7601. req.Header = reqHeaders
  7602. googleapi.Expand(req.URL, map[string]string{
  7603. "parent": c.parent,
  7604. })
  7605. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7606. }
  7607. // Do executes the "logging.organizations.exclusions.list" call.
  7608. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  7609. // non-2xx status code is an error. Response headers are in either
  7610. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  7611. // returned at all) in error.(*googleapi.Error).Header. Use
  7612. // googleapi.IsNotModified to check whether the returned error was
  7613. // because http.StatusNotModified was returned.
  7614. func (c *OrganizationsExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  7615. gensupport.SetOptions(c.urlParams_, opts...)
  7616. res, err := c.doRequest("json")
  7617. if res != nil && res.StatusCode == http.StatusNotModified {
  7618. if res.Body != nil {
  7619. res.Body.Close()
  7620. }
  7621. return nil, &googleapi.Error{
  7622. Code: res.StatusCode,
  7623. Header: res.Header,
  7624. }
  7625. }
  7626. if err != nil {
  7627. return nil, err
  7628. }
  7629. defer googleapi.CloseBody(res)
  7630. if err := googleapi.CheckResponse(res); err != nil {
  7631. return nil, err
  7632. }
  7633. ret := &ListExclusionsResponse{
  7634. ServerResponse: googleapi.ServerResponse{
  7635. Header: res.Header,
  7636. HTTPStatusCode: res.StatusCode,
  7637. },
  7638. }
  7639. target := &ret
  7640. if err := gensupport.DecodeResponse(target, res); err != nil {
  7641. return nil, err
  7642. }
  7643. return ret, nil
  7644. // {
  7645. // "description": "Lists all the exclusions in a parent resource.",
  7646. // "flatPath": "v2/organizations/{organizationsId}/exclusions",
  7647. // "httpMethod": "GET",
  7648. // "id": "logging.organizations.exclusions.list",
  7649. // "parameterOrder": [
  7650. // "parent"
  7651. // ],
  7652. // "parameters": {
  7653. // "pageSize": {
  7654. // "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.",
  7655. // "format": "int32",
  7656. // "location": "query",
  7657. // "type": "integer"
  7658. // },
  7659. // "pageToken": {
  7660. // "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.",
  7661. // "location": "query",
  7662. // "type": "string"
  7663. // },
  7664. // "parent": {
  7665. // "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",
  7666. // "location": "path",
  7667. // "pattern": "^organizations/[^/]+$",
  7668. // "required": true,
  7669. // "type": "string"
  7670. // }
  7671. // },
  7672. // "path": "v2/{+parent}/exclusions",
  7673. // "response": {
  7674. // "$ref": "ListExclusionsResponse"
  7675. // },
  7676. // "scopes": [
  7677. // "https://www.googleapis.com/auth/cloud-platform",
  7678. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  7679. // "https://www.googleapis.com/auth/logging.admin",
  7680. // "https://www.googleapis.com/auth/logging.read"
  7681. // ]
  7682. // }
  7683. }
  7684. // Pages invokes f for each page of results.
  7685. // A non-nil error returned from f will halt the iteration.
  7686. // The provided context supersedes any context provided to the Context method.
  7687. func (c *OrganizationsExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  7688. c.ctx_ = ctx
  7689. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7690. for {
  7691. x, err := c.Do()
  7692. if err != nil {
  7693. return err
  7694. }
  7695. if err := f(x); err != nil {
  7696. return err
  7697. }
  7698. if x.NextPageToken == "" {
  7699. return nil
  7700. }
  7701. c.PageToken(x.NextPageToken)
  7702. }
  7703. }
  7704. // method id "logging.organizations.exclusions.patch":
  7705. type OrganizationsExclusionsPatchCall struct {
  7706. s *Service
  7707. name string
  7708. logexclusion *LogExclusion
  7709. urlParams_ gensupport.URLParams
  7710. ctx_ context.Context
  7711. header_ http.Header
  7712. }
  7713. // Patch: Changes one or more properties of an existing exclusion.
  7714. func (r *OrganizationsExclusionsService) Patch(name string, logexclusion *LogExclusion) *OrganizationsExclusionsPatchCall {
  7715. c := &OrganizationsExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7716. c.name = name
  7717. c.logexclusion = logexclusion
  7718. return c
  7719. }
  7720. // UpdateMask sets the optional parameter "updateMask": Required. A
  7721. // nonempty list of fields to change in the existing exclusion. New
  7722. // values for the fields are taken from the corresponding fields in the
  7723. // LogExclusion included in this request. Fields not mentioned in
  7724. // update_mask are not changed and are ignored in the request.For
  7725. // example, to change the filter and description of an exclusion,
  7726. // specify an update_mask of "filter,description".
  7727. func (c *OrganizationsExclusionsPatchCall) UpdateMask(updateMask string) *OrganizationsExclusionsPatchCall {
  7728. c.urlParams_.Set("updateMask", updateMask)
  7729. return c
  7730. }
  7731. // Fields allows partial responses to be retrieved. See
  7732. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7733. // for more information.
  7734. func (c *OrganizationsExclusionsPatchCall) Fields(s ...googleapi.Field) *OrganizationsExclusionsPatchCall {
  7735. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7736. return c
  7737. }
  7738. // Context sets the context to be used in this call's Do method. Any
  7739. // pending HTTP request will be aborted if the provided context is
  7740. // canceled.
  7741. func (c *OrganizationsExclusionsPatchCall) Context(ctx context.Context) *OrganizationsExclusionsPatchCall {
  7742. c.ctx_ = ctx
  7743. return c
  7744. }
  7745. // Header returns an http.Header that can be modified by the caller to
  7746. // add HTTP headers to the request.
  7747. func (c *OrganizationsExclusionsPatchCall) Header() http.Header {
  7748. if c.header_ == nil {
  7749. c.header_ = make(http.Header)
  7750. }
  7751. return c.header_
  7752. }
  7753. func (c *OrganizationsExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  7754. reqHeaders := make(http.Header)
  7755. for k, v := range c.header_ {
  7756. reqHeaders[k] = v
  7757. }
  7758. reqHeaders.Set("User-Agent", c.s.userAgent())
  7759. var body io.Reader = nil
  7760. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  7761. if err != nil {
  7762. return nil, err
  7763. }
  7764. reqHeaders.Set("Content-Type", "application/json")
  7765. c.urlParams_.Set("alt", alt)
  7766. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  7767. urls += "?" + c.urlParams_.Encode()
  7768. req, _ := http.NewRequest("PATCH", urls, body)
  7769. req.Header = reqHeaders
  7770. googleapi.Expand(req.URL, map[string]string{
  7771. "name": c.name,
  7772. })
  7773. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7774. }
  7775. // Do executes the "logging.organizations.exclusions.patch" call.
  7776. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  7777. // status code is an error. Response headers are in either
  7778. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  7779. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7780. // to check whether the returned error was because
  7781. // http.StatusNotModified was returned.
  7782. func (c *OrganizationsExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  7783. gensupport.SetOptions(c.urlParams_, opts...)
  7784. res, err := c.doRequest("json")
  7785. if res != nil && res.StatusCode == http.StatusNotModified {
  7786. if res.Body != nil {
  7787. res.Body.Close()
  7788. }
  7789. return nil, &googleapi.Error{
  7790. Code: res.StatusCode,
  7791. Header: res.Header,
  7792. }
  7793. }
  7794. if err != nil {
  7795. return nil, err
  7796. }
  7797. defer googleapi.CloseBody(res)
  7798. if err := googleapi.CheckResponse(res); err != nil {
  7799. return nil, err
  7800. }
  7801. ret := &LogExclusion{
  7802. ServerResponse: googleapi.ServerResponse{
  7803. Header: res.Header,
  7804. HTTPStatusCode: res.StatusCode,
  7805. },
  7806. }
  7807. target := &ret
  7808. if err := gensupport.DecodeResponse(target, res); err != nil {
  7809. return nil, err
  7810. }
  7811. return ret, nil
  7812. // {
  7813. // "description": "Changes one or more properties of an existing exclusion.",
  7814. // "flatPath": "v2/organizations/{organizationsId}/exclusions/{exclusionsId}",
  7815. // "httpMethod": "PATCH",
  7816. // "id": "logging.organizations.exclusions.patch",
  7817. // "parameterOrder": [
  7818. // "name"
  7819. // ],
  7820. // "parameters": {
  7821. // "name": {
  7822. // "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\".",
  7823. // "location": "path",
  7824. // "pattern": "^organizations/[^/]+/exclusions/[^/]+$",
  7825. // "required": true,
  7826. // "type": "string"
  7827. // },
  7828. // "updateMask": {
  7829. // "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\".",
  7830. // "format": "google-fieldmask",
  7831. // "location": "query",
  7832. // "type": "string"
  7833. // }
  7834. // },
  7835. // "path": "v2/{+name}",
  7836. // "request": {
  7837. // "$ref": "LogExclusion"
  7838. // },
  7839. // "response": {
  7840. // "$ref": "LogExclusion"
  7841. // },
  7842. // "scopes": [
  7843. // "https://www.googleapis.com/auth/cloud-platform",
  7844. // "https://www.googleapis.com/auth/logging.admin"
  7845. // ]
  7846. // }
  7847. }
  7848. // method id "logging.organizations.logs.delete":
  7849. type OrganizationsLogsDeleteCall struct {
  7850. s *Service
  7851. logName string
  7852. urlParams_ gensupport.URLParams
  7853. ctx_ context.Context
  7854. header_ http.Header
  7855. }
  7856. // Delete: Deletes all the log entries in a log. The log reappears if it
  7857. // receives new entries. Log entries written shortly before the delete
  7858. // operation might not be deleted.
  7859. func (r *OrganizationsLogsService) Delete(logName string) *OrganizationsLogsDeleteCall {
  7860. c := &OrganizationsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7861. c.logName = logName
  7862. return c
  7863. }
  7864. // Fields allows partial responses to be retrieved. See
  7865. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7866. // for more information.
  7867. func (c *OrganizationsLogsDeleteCall) Fields(s ...googleapi.Field) *OrganizationsLogsDeleteCall {
  7868. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7869. return c
  7870. }
  7871. // Context sets the context to be used in this call's Do method. Any
  7872. // pending HTTP request will be aborted if the provided context is
  7873. // canceled.
  7874. func (c *OrganizationsLogsDeleteCall) Context(ctx context.Context) *OrganizationsLogsDeleteCall {
  7875. c.ctx_ = ctx
  7876. return c
  7877. }
  7878. // Header returns an http.Header that can be modified by the caller to
  7879. // add HTTP headers to the request.
  7880. func (c *OrganizationsLogsDeleteCall) Header() http.Header {
  7881. if c.header_ == nil {
  7882. c.header_ = make(http.Header)
  7883. }
  7884. return c.header_
  7885. }
  7886. func (c *OrganizationsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7887. reqHeaders := make(http.Header)
  7888. for k, v := range c.header_ {
  7889. reqHeaders[k] = v
  7890. }
  7891. reqHeaders.Set("User-Agent", c.s.userAgent())
  7892. var body io.Reader = nil
  7893. c.urlParams_.Set("alt", alt)
  7894. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  7895. urls += "?" + c.urlParams_.Encode()
  7896. req, _ := http.NewRequest("DELETE", urls, body)
  7897. req.Header = reqHeaders
  7898. googleapi.Expand(req.URL, map[string]string{
  7899. "logName": c.logName,
  7900. })
  7901. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7902. }
  7903. // Do executes the "logging.organizations.logs.delete" call.
  7904. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7905. // code is an error. Response headers are in either
  7906. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7907. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7908. // check whether the returned error was because http.StatusNotModified
  7909. // was returned.
  7910. func (c *OrganizationsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7911. gensupport.SetOptions(c.urlParams_, opts...)
  7912. res, err := c.doRequest("json")
  7913. if res != nil && res.StatusCode == http.StatusNotModified {
  7914. if res.Body != nil {
  7915. res.Body.Close()
  7916. }
  7917. return nil, &googleapi.Error{
  7918. Code: res.StatusCode,
  7919. Header: res.Header,
  7920. }
  7921. }
  7922. if err != nil {
  7923. return nil, err
  7924. }
  7925. defer googleapi.CloseBody(res)
  7926. if err := googleapi.CheckResponse(res); err != nil {
  7927. return nil, err
  7928. }
  7929. ret := &Empty{
  7930. ServerResponse: googleapi.ServerResponse{
  7931. Header: res.Header,
  7932. HTTPStatusCode: res.StatusCode,
  7933. },
  7934. }
  7935. target := &ret
  7936. if err := gensupport.DecodeResponse(target, res); err != nil {
  7937. return nil, err
  7938. }
  7939. return ret, nil
  7940. // {
  7941. // "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.",
  7942. // "flatPath": "v2/organizations/{organizationsId}/logs/{logsId}",
  7943. // "httpMethod": "DELETE",
  7944. // "id": "logging.organizations.logs.delete",
  7945. // "parameterOrder": [
  7946. // "logName"
  7947. // ],
  7948. // "parameters": {
  7949. // "logName": {
  7950. // "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.",
  7951. // "location": "path",
  7952. // "pattern": "^organizations/[^/]+/logs/[^/]+$",
  7953. // "required": true,
  7954. // "type": "string"
  7955. // }
  7956. // },
  7957. // "path": "v2/{+logName}",
  7958. // "response": {
  7959. // "$ref": "Empty"
  7960. // },
  7961. // "scopes": [
  7962. // "https://www.googleapis.com/auth/cloud-platform",
  7963. // "https://www.googleapis.com/auth/logging.admin"
  7964. // ]
  7965. // }
  7966. }
  7967. // method id "logging.organizations.logs.list":
  7968. type OrganizationsLogsListCall struct {
  7969. s *Service
  7970. parent string
  7971. urlParams_ gensupport.URLParams
  7972. ifNoneMatch_ string
  7973. ctx_ context.Context
  7974. header_ http.Header
  7975. }
  7976. // List: Lists the logs in projects, organizations, folders, or billing
  7977. // accounts. Only logs that have entries are listed.
  7978. func (r *OrganizationsLogsService) List(parent string) *OrganizationsLogsListCall {
  7979. c := &OrganizationsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7980. c.parent = parent
  7981. return c
  7982. }
  7983. // PageSize sets the optional parameter "pageSize": The maximum number
  7984. // of results to return from this request. Non-positive values are
  7985. // ignored. The presence of nextPageToken in the response indicates that
  7986. // more results might be available.
  7987. func (c *OrganizationsLogsListCall) PageSize(pageSize int64) *OrganizationsLogsListCall {
  7988. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7989. return c
  7990. }
  7991. // PageToken sets the optional parameter "pageToken": If present, then
  7992. // retrieve the next batch of results from the preceding call to this
  7993. // method. pageToken must be the value of nextPageToken from the
  7994. // previous response. The values of other method parameters should be
  7995. // identical to those in the previous call.
  7996. func (c *OrganizationsLogsListCall) PageToken(pageToken string) *OrganizationsLogsListCall {
  7997. c.urlParams_.Set("pageToken", pageToken)
  7998. return c
  7999. }
  8000. // Fields allows partial responses to be retrieved. See
  8001. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8002. // for more information.
  8003. func (c *OrganizationsLogsListCall) Fields(s ...googleapi.Field) *OrganizationsLogsListCall {
  8004. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8005. return c
  8006. }
  8007. // IfNoneMatch sets the optional parameter which makes the operation
  8008. // fail if the object's ETag matches the given value. This is useful for
  8009. // getting updates only after the object has changed since the last
  8010. // request. Use googleapi.IsNotModified to check whether the response
  8011. // error from Do is the result of In-None-Match.
  8012. func (c *OrganizationsLogsListCall) IfNoneMatch(entityTag string) *OrganizationsLogsListCall {
  8013. c.ifNoneMatch_ = entityTag
  8014. return c
  8015. }
  8016. // Context sets the context to be used in this call's Do method. Any
  8017. // pending HTTP request will be aborted if the provided context is
  8018. // canceled.
  8019. func (c *OrganizationsLogsListCall) Context(ctx context.Context) *OrganizationsLogsListCall {
  8020. c.ctx_ = ctx
  8021. return c
  8022. }
  8023. // Header returns an http.Header that can be modified by the caller to
  8024. // add HTTP headers to the request.
  8025. func (c *OrganizationsLogsListCall) Header() http.Header {
  8026. if c.header_ == nil {
  8027. c.header_ = make(http.Header)
  8028. }
  8029. return c.header_
  8030. }
  8031. func (c *OrganizationsLogsListCall) doRequest(alt string) (*http.Response, error) {
  8032. reqHeaders := make(http.Header)
  8033. for k, v := range c.header_ {
  8034. reqHeaders[k] = v
  8035. }
  8036. reqHeaders.Set("User-Agent", c.s.userAgent())
  8037. if c.ifNoneMatch_ != "" {
  8038. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8039. }
  8040. var body io.Reader = nil
  8041. c.urlParams_.Set("alt", alt)
  8042. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  8043. urls += "?" + c.urlParams_.Encode()
  8044. req, _ := http.NewRequest("GET", urls, body)
  8045. req.Header = reqHeaders
  8046. googleapi.Expand(req.URL, map[string]string{
  8047. "parent": c.parent,
  8048. })
  8049. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8050. }
  8051. // Do executes the "logging.organizations.logs.list" call.
  8052. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  8053. // non-2xx status code is an error. Response headers are in either
  8054. // *ListLogsResponse.ServerResponse.Header or (if a response was
  8055. // returned at all) in error.(*googleapi.Error).Header. Use
  8056. // googleapi.IsNotModified to check whether the returned error was
  8057. // because http.StatusNotModified was returned.
  8058. func (c *OrganizationsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  8059. gensupport.SetOptions(c.urlParams_, opts...)
  8060. res, err := c.doRequest("json")
  8061. if res != nil && res.StatusCode == http.StatusNotModified {
  8062. if res.Body != nil {
  8063. res.Body.Close()
  8064. }
  8065. return nil, &googleapi.Error{
  8066. Code: res.StatusCode,
  8067. Header: res.Header,
  8068. }
  8069. }
  8070. if err != nil {
  8071. return nil, err
  8072. }
  8073. defer googleapi.CloseBody(res)
  8074. if err := googleapi.CheckResponse(res); err != nil {
  8075. return nil, err
  8076. }
  8077. ret := &ListLogsResponse{
  8078. ServerResponse: googleapi.ServerResponse{
  8079. Header: res.Header,
  8080. HTTPStatusCode: res.StatusCode,
  8081. },
  8082. }
  8083. target := &ret
  8084. if err := gensupport.DecodeResponse(target, res); err != nil {
  8085. return nil, err
  8086. }
  8087. return ret, nil
  8088. // {
  8089. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  8090. // "flatPath": "v2/organizations/{organizationsId}/logs",
  8091. // "httpMethod": "GET",
  8092. // "id": "logging.organizations.logs.list",
  8093. // "parameterOrder": [
  8094. // "parent"
  8095. // ],
  8096. // "parameters": {
  8097. // "pageSize": {
  8098. // "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.",
  8099. // "format": "int32",
  8100. // "location": "query",
  8101. // "type": "integer"
  8102. // },
  8103. // "pageToken": {
  8104. // "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.",
  8105. // "location": "query",
  8106. // "type": "string"
  8107. // },
  8108. // "parent": {
  8109. // "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",
  8110. // "location": "path",
  8111. // "pattern": "^organizations/[^/]+$",
  8112. // "required": true,
  8113. // "type": "string"
  8114. // }
  8115. // },
  8116. // "path": "v2/{+parent}/logs",
  8117. // "response": {
  8118. // "$ref": "ListLogsResponse"
  8119. // },
  8120. // "scopes": [
  8121. // "https://www.googleapis.com/auth/cloud-platform",
  8122. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8123. // "https://www.googleapis.com/auth/logging.admin",
  8124. // "https://www.googleapis.com/auth/logging.read"
  8125. // ]
  8126. // }
  8127. }
  8128. // Pages invokes f for each page of results.
  8129. // A non-nil error returned from f will halt the iteration.
  8130. // The provided context supersedes any context provided to the Context method.
  8131. func (c *OrganizationsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  8132. c.ctx_ = ctx
  8133. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8134. for {
  8135. x, err := c.Do()
  8136. if err != nil {
  8137. return err
  8138. }
  8139. if err := f(x); err != nil {
  8140. return err
  8141. }
  8142. if x.NextPageToken == "" {
  8143. return nil
  8144. }
  8145. c.PageToken(x.NextPageToken)
  8146. }
  8147. }
  8148. // method id "logging.organizations.sinks.create":
  8149. type OrganizationsSinksCreateCall struct {
  8150. s *Service
  8151. parent string
  8152. logsink *LogSink
  8153. urlParams_ gensupport.URLParams
  8154. ctx_ context.Context
  8155. header_ http.Header
  8156. }
  8157. // Create: Creates a sink that exports specified log entries to a
  8158. // destination. The export of newly-ingested log entries begins
  8159. // immediately, unless the sink's writer_identity is not permitted to
  8160. // write to the destination. A sink can export log entries only from the
  8161. // resource owning the sink.
  8162. func (r *OrganizationsSinksService) Create(parent string, logsink *LogSink) *OrganizationsSinksCreateCall {
  8163. c := &OrganizationsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8164. c.parent = parent
  8165. c.logsink = logsink
  8166. return c
  8167. }
  8168. // UniqueWriterIdentity sets the optional parameter
  8169. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  8170. // as writer_identity in the new sink. If this value is omitted or set
  8171. // to false, and if the sink's parent is a project, then the value
  8172. // returned as writer_identity is the same group or service account used
  8173. // by Stackdriver Logging before the addition of writer identities to
  8174. // this API. The sink's destination must be in the same project as the
  8175. // sink itself.If this field is set to true, or if the sink is owned by
  8176. // a non-project resource such as an organization, then the value of
  8177. // writer_identity will be a unique service account used only for
  8178. // exports from the new sink. For more information, see writer_identity
  8179. // in LogSink.
  8180. func (c *OrganizationsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *OrganizationsSinksCreateCall {
  8181. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  8182. return c
  8183. }
  8184. // Fields allows partial responses to be retrieved. See
  8185. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8186. // for more information.
  8187. func (c *OrganizationsSinksCreateCall) Fields(s ...googleapi.Field) *OrganizationsSinksCreateCall {
  8188. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8189. return c
  8190. }
  8191. // Context sets the context to be used in this call's Do method. Any
  8192. // pending HTTP request will be aborted if the provided context is
  8193. // canceled.
  8194. func (c *OrganizationsSinksCreateCall) Context(ctx context.Context) *OrganizationsSinksCreateCall {
  8195. c.ctx_ = ctx
  8196. return c
  8197. }
  8198. // Header returns an http.Header that can be modified by the caller to
  8199. // add HTTP headers to the request.
  8200. func (c *OrganizationsSinksCreateCall) Header() http.Header {
  8201. if c.header_ == nil {
  8202. c.header_ = make(http.Header)
  8203. }
  8204. return c.header_
  8205. }
  8206. func (c *OrganizationsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  8207. reqHeaders := make(http.Header)
  8208. for k, v := range c.header_ {
  8209. reqHeaders[k] = v
  8210. }
  8211. reqHeaders.Set("User-Agent", c.s.userAgent())
  8212. var body io.Reader = nil
  8213. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  8214. if err != nil {
  8215. return nil, err
  8216. }
  8217. reqHeaders.Set("Content-Type", "application/json")
  8218. c.urlParams_.Set("alt", alt)
  8219. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  8220. urls += "?" + c.urlParams_.Encode()
  8221. req, _ := http.NewRequest("POST", urls, body)
  8222. req.Header = reqHeaders
  8223. googleapi.Expand(req.URL, map[string]string{
  8224. "parent": c.parent,
  8225. })
  8226. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8227. }
  8228. // Do executes the "logging.organizations.sinks.create" call.
  8229. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  8230. // code is an error. Response headers are in either
  8231. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  8232. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8233. // check whether the returned error was because http.StatusNotModified
  8234. // was returned.
  8235. func (c *OrganizationsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  8236. gensupport.SetOptions(c.urlParams_, opts...)
  8237. res, err := c.doRequest("json")
  8238. if res != nil && res.StatusCode == http.StatusNotModified {
  8239. if res.Body != nil {
  8240. res.Body.Close()
  8241. }
  8242. return nil, &googleapi.Error{
  8243. Code: res.StatusCode,
  8244. Header: res.Header,
  8245. }
  8246. }
  8247. if err != nil {
  8248. return nil, err
  8249. }
  8250. defer googleapi.CloseBody(res)
  8251. if err := googleapi.CheckResponse(res); err != nil {
  8252. return nil, err
  8253. }
  8254. ret := &LogSink{
  8255. ServerResponse: googleapi.ServerResponse{
  8256. Header: res.Header,
  8257. HTTPStatusCode: res.StatusCode,
  8258. },
  8259. }
  8260. target := &ret
  8261. if err := gensupport.DecodeResponse(target, res); err != nil {
  8262. return nil, err
  8263. }
  8264. return ret, nil
  8265. // {
  8266. // "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.",
  8267. // "flatPath": "v2/organizations/{organizationsId}/sinks",
  8268. // "httpMethod": "POST",
  8269. // "id": "logging.organizations.sinks.create",
  8270. // "parameterOrder": [
  8271. // "parent"
  8272. // ],
  8273. // "parameters": {
  8274. // "parent": {
  8275. // "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\".",
  8276. // "location": "path",
  8277. // "pattern": "^organizations/[^/]+$",
  8278. // "required": true,
  8279. // "type": "string"
  8280. // },
  8281. // "uniqueWriterIdentity": {
  8282. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Stackdriver Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  8283. // "location": "query",
  8284. // "type": "boolean"
  8285. // }
  8286. // },
  8287. // "path": "v2/{+parent}/sinks",
  8288. // "request": {
  8289. // "$ref": "LogSink"
  8290. // },
  8291. // "response": {
  8292. // "$ref": "LogSink"
  8293. // },
  8294. // "scopes": [
  8295. // "https://www.googleapis.com/auth/cloud-platform",
  8296. // "https://www.googleapis.com/auth/logging.admin"
  8297. // ]
  8298. // }
  8299. }
  8300. // method id "logging.organizations.sinks.delete":
  8301. type OrganizationsSinksDeleteCall struct {
  8302. s *Service
  8303. sinkNameid string
  8304. urlParams_ gensupport.URLParams
  8305. ctx_ context.Context
  8306. header_ http.Header
  8307. }
  8308. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  8309. // then that service account is also deleted.
  8310. func (r *OrganizationsSinksService) Delete(sinkNameid string) *OrganizationsSinksDeleteCall {
  8311. c := &OrganizationsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8312. c.sinkNameid = sinkNameid
  8313. return c
  8314. }
  8315. // Fields allows partial responses to be retrieved. See
  8316. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8317. // for more information.
  8318. func (c *OrganizationsSinksDeleteCall) Fields(s ...googleapi.Field) *OrganizationsSinksDeleteCall {
  8319. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8320. return c
  8321. }
  8322. // Context sets the context to be used in this call's Do method. Any
  8323. // pending HTTP request will be aborted if the provided context is
  8324. // canceled.
  8325. func (c *OrganizationsSinksDeleteCall) Context(ctx context.Context) *OrganizationsSinksDeleteCall {
  8326. c.ctx_ = ctx
  8327. return c
  8328. }
  8329. // Header returns an http.Header that can be modified by the caller to
  8330. // add HTTP headers to the request.
  8331. func (c *OrganizationsSinksDeleteCall) Header() http.Header {
  8332. if c.header_ == nil {
  8333. c.header_ = make(http.Header)
  8334. }
  8335. return c.header_
  8336. }
  8337. func (c *OrganizationsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  8338. reqHeaders := make(http.Header)
  8339. for k, v := range c.header_ {
  8340. reqHeaders[k] = v
  8341. }
  8342. reqHeaders.Set("User-Agent", c.s.userAgent())
  8343. var body io.Reader = nil
  8344. c.urlParams_.Set("alt", alt)
  8345. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  8346. urls += "?" + c.urlParams_.Encode()
  8347. req, _ := http.NewRequest("DELETE", urls, body)
  8348. req.Header = reqHeaders
  8349. googleapi.Expand(req.URL, map[string]string{
  8350. "sinkName": c.sinkNameid,
  8351. })
  8352. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8353. }
  8354. // Do executes the "logging.organizations.sinks.delete" call.
  8355. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8356. // code is an error. Response headers are in either
  8357. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8358. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8359. // check whether the returned error was because http.StatusNotModified
  8360. // was returned.
  8361. func (c *OrganizationsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8362. gensupport.SetOptions(c.urlParams_, opts...)
  8363. res, err := c.doRequest("json")
  8364. if res != nil && res.StatusCode == http.StatusNotModified {
  8365. if res.Body != nil {
  8366. res.Body.Close()
  8367. }
  8368. return nil, &googleapi.Error{
  8369. Code: res.StatusCode,
  8370. Header: res.Header,
  8371. }
  8372. }
  8373. if err != nil {
  8374. return nil, err
  8375. }
  8376. defer googleapi.CloseBody(res)
  8377. if err := googleapi.CheckResponse(res); err != nil {
  8378. return nil, err
  8379. }
  8380. ret := &Empty{
  8381. ServerResponse: googleapi.ServerResponse{
  8382. Header: res.Header,
  8383. HTTPStatusCode: res.StatusCode,
  8384. },
  8385. }
  8386. target := &ret
  8387. if err := gensupport.DecodeResponse(target, res); err != nil {
  8388. return nil, err
  8389. }
  8390. return ret, nil
  8391. // {
  8392. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  8393. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  8394. // "httpMethod": "DELETE",
  8395. // "id": "logging.organizations.sinks.delete",
  8396. // "parameterOrder": [
  8397. // "sinkName"
  8398. // ],
  8399. // "parameters": {
  8400. // "sinkName": {
  8401. // "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\".",
  8402. // "location": "path",
  8403. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  8404. // "required": true,
  8405. // "type": "string"
  8406. // }
  8407. // },
  8408. // "path": "v2/{+sinkName}",
  8409. // "response": {
  8410. // "$ref": "Empty"
  8411. // },
  8412. // "scopes": [
  8413. // "https://www.googleapis.com/auth/cloud-platform",
  8414. // "https://www.googleapis.com/auth/logging.admin"
  8415. // ]
  8416. // }
  8417. }
  8418. // method id "logging.organizations.sinks.get":
  8419. type OrganizationsSinksGetCall struct {
  8420. s *Service
  8421. sinkName string
  8422. urlParams_ gensupport.URLParams
  8423. ifNoneMatch_ string
  8424. ctx_ context.Context
  8425. header_ http.Header
  8426. }
  8427. // Get: Gets a sink.
  8428. func (r *OrganizationsSinksService) Get(sinkName string) *OrganizationsSinksGetCall {
  8429. c := &OrganizationsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8430. c.sinkName = sinkName
  8431. return c
  8432. }
  8433. // Fields allows partial responses to be retrieved. See
  8434. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8435. // for more information.
  8436. func (c *OrganizationsSinksGetCall) Fields(s ...googleapi.Field) *OrganizationsSinksGetCall {
  8437. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8438. return c
  8439. }
  8440. // IfNoneMatch sets the optional parameter which makes the operation
  8441. // fail if the object's ETag matches the given value. This is useful for
  8442. // getting updates only after the object has changed since the last
  8443. // request. Use googleapi.IsNotModified to check whether the response
  8444. // error from Do is the result of In-None-Match.
  8445. func (c *OrganizationsSinksGetCall) IfNoneMatch(entityTag string) *OrganizationsSinksGetCall {
  8446. c.ifNoneMatch_ = entityTag
  8447. return c
  8448. }
  8449. // Context sets the context to be used in this call's Do method. Any
  8450. // pending HTTP request will be aborted if the provided context is
  8451. // canceled.
  8452. func (c *OrganizationsSinksGetCall) Context(ctx context.Context) *OrganizationsSinksGetCall {
  8453. c.ctx_ = ctx
  8454. return c
  8455. }
  8456. // Header returns an http.Header that can be modified by the caller to
  8457. // add HTTP headers to the request.
  8458. func (c *OrganizationsSinksGetCall) Header() http.Header {
  8459. if c.header_ == nil {
  8460. c.header_ = make(http.Header)
  8461. }
  8462. return c.header_
  8463. }
  8464. func (c *OrganizationsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  8465. reqHeaders := make(http.Header)
  8466. for k, v := range c.header_ {
  8467. reqHeaders[k] = v
  8468. }
  8469. reqHeaders.Set("User-Agent", c.s.userAgent())
  8470. if c.ifNoneMatch_ != "" {
  8471. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8472. }
  8473. var body io.Reader = nil
  8474. c.urlParams_.Set("alt", alt)
  8475. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  8476. urls += "?" + c.urlParams_.Encode()
  8477. req, _ := http.NewRequest("GET", urls, body)
  8478. req.Header = reqHeaders
  8479. googleapi.Expand(req.URL, map[string]string{
  8480. "sinkName": c.sinkName,
  8481. })
  8482. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8483. }
  8484. // Do executes the "logging.organizations.sinks.get" call.
  8485. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  8486. // code is an error. Response headers are in either
  8487. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  8488. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8489. // check whether the returned error was because http.StatusNotModified
  8490. // was returned.
  8491. func (c *OrganizationsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  8492. gensupport.SetOptions(c.urlParams_, opts...)
  8493. res, err := c.doRequest("json")
  8494. if res != nil && res.StatusCode == http.StatusNotModified {
  8495. if res.Body != nil {
  8496. res.Body.Close()
  8497. }
  8498. return nil, &googleapi.Error{
  8499. Code: res.StatusCode,
  8500. Header: res.Header,
  8501. }
  8502. }
  8503. if err != nil {
  8504. return nil, err
  8505. }
  8506. defer googleapi.CloseBody(res)
  8507. if err := googleapi.CheckResponse(res); err != nil {
  8508. return nil, err
  8509. }
  8510. ret := &LogSink{
  8511. ServerResponse: googleapi.ServerResponse{
  8512. Header: res.Header,
  8513. HTTPStatusCode: res.StatusCode,
  8514. },
  8515. }
  8516. target := &ret
  8517. if err := gensupport.DecodeResponse(target, res); err != nil {
  8518. return nil, err
  8519. }
  8520. return ret, nil
  8521. // {
  8522. // "description": "Gets a sink.",
  8523. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  8524. // "httpMethod": "GET",
  8525. // "id": "logging.organizations.sinks.get",
  8526. // "parameterOrder": [
  8527. // "sinkName"
  8528. // ],
  8529. // "parameters": {
  8530. // "sinkName": {
  8531. // "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\".",
  8532. // "location": "path",
  8533. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  8534. // "required": true,
  8535. // "type": "string"
  8536. // }
  8537. // },
  8538. // "path": "v2/{+sinkName}",
  8539. // "response": {
  8540. // "$ref": "LogSink"
  8541. // },
  8542. // "scopes": [
  8543. // "https://www.googleapis.com/auth/cloud-platform",
  8544. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8545. // "https://www.googleapis.com/auth/logging.admin",
  8546. // "https://www.googleapis.com/auth/logging.read"
  8547. // ]
  8548. // }
  8549. }
  8550. // method id "logging.organizations.sinks.list":
  8551. type OrganizationsSinksListCall struct {
  8552. s *Service
  8553. parent string
  8554. urlParams_ gensupport.URLParams
  8555. ifNoneMatch_ string
  8556. ctx_ context.Context
  8557. header_ http.Header
  8558. }
  8559. // List: Lists sinks.
  8560. func (r *OrganizationsSinksService) List(parent string) *OrganizationsSinksListCall {
  8561. c := &OrganizationsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8562. c.parent = parent
  8563. return c
  8564. }
  8565. // PageSize sets the optional parameter "pageSize": The maximum number
  8566. // of results to return from this request. Non-positive values are
  8567. // ignored. The presence of nextPageToken in the response indicates that
  8568. // more results might be available.
  8569. func (c *OrganizationsSinksListCall) PageSize(pageSize int64) *OrganizationsSinksListCall {
  8570. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8571. return c
  8572. }
  8573. // PageToken sets the optional parameter "pageToken": If present, then
  8574. // retrieve the next batch of results from the preceding call to this
  8575. // method. pageToken must be the value of nextPageToken from the
  8576. // previous response. The values of other method parameters should be
  8577. // identical to those in the previous call.
  8578. func (c *OrganizationsSinksListCall) PageToken(pageToken string) *OrganizationsSinksListCall {
  8579. c.urlParams_.Set("pageToken", pageToken)
  8580. return c
  8581. }
  8582. // Fields allows partial responses to be retrieved. See
  8583. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8584. // for more information.
  8585. func (c *OrganizationsSinksListCall) Fields(s ...googleapi.Field) *OrganizationsSinksListCall {
  8586. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8587. return c
  8588. }
  8589. // IfNoneMatch sets the optional parameter which makes the operation
  8590. // fail if the object's ETag matches the given value. This is useful for
  8591. // getting updates only after the object has changed since the last
  8592. // request. Use googleapi.IsNotModified to check whether the response
  8593. // error from Do is the result of In-None-Match.
  8594. func (c *OrganizationsSinksListCall) IfNoneMatch(entityTag string) *OrganizationsSinksListCall {
  8595. c.ifNoneMatch_ = entityTag
  8596. return c
  8597. }
  8598. // Context sets the context to be used in this call's Do method. Any
  8599. // pending HTTP request will be aborted if the provided context is
  8600. // canceled.
  8601. func (c *OrganizationsSinksListCall) Context(ctx context.Context) *OrganizationsSinksListCall {
  8602. c.ctx_ = ctx
  8603. return c
  8604. }
  8605. // Header returns an http.Header that can be modified by the caller to
  8606. // add HTTP headers to the request.
  8607. func (c *OrganizationsSinksListCall) Header() http.Header {
  8608. if c.header_ == nil {
  8609. c.header_ = make(http.Header)
  8610. }
  8611. return c.header_
  8612. }
  8613. func (c *OrganizationsSinksListCall) doRequest(alt string) (*http.Response, error) {
  8614. reqHeaders := make(http.Header)
  8615. for k, v := range c.header_ {
  8616. reqHeaders[k] = v
  8617. }
  8618. reqHeaders.Set("User-Agent", c.s.userAgent())
  8619. if c.ifNoneMatch_ != "" {
  8620. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8621. }
  8622. var body io.Reader = nil
  8623. c.urlParams_.Set("alt", alt)
  8624. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  8625. urls += "?" + c.urlParams_.Encode()
  8626. req, _ := http.NewRequest("GET", urls, body)
  8627. req.Header = reqHeaders
  8628. googleapi.Expand(req.URL, map[string]string{
  8629. "parent": c.parent,
  8630. })
  8631. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8632. }
  8633. // Do executes the "logging.organizations.sinks.list" call.
  8634. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  8635. // non-2xx status code is an error. Response headers are in either
  8636. // *ListSinksResponse.ServerResponse.Header or (if a response was
  8637. // returned at all) in error.(*googleapi.Error).Header. Use
  8638. // googleapi.IsNotModified to check whether the returned error was
  8639. // because http.StatusNotModified was returned.
  8640. func (c *OrganizationsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  8641. gensupport.SetOptions(c.urlParams_, opts...)
  8642. res, err := c.doRequest("json")
  8643. if res != nil && res.StatusCode == http.StatusNotModified {
  8644. if res.Body != nil {
  8645. res.Body.Close()
  8646. }
  8647. return nil, &googleapi.Error{
  8648. Code: res.StatusCode,
  8649. Header: res.Header,
  8650. }
  8651. }
  8652. if err != nil {
  8653. return nil, err
  8654. }
  8655. defer googleapi.CloseBody(res)
  8656. if err := googleapi.CheckResponse(res); err != nil {
  8657. return nil, err
  8658. }
  8659. ret := &ListSinksResponse{
  8660. ServerResponse: googleapi.ServerResponse{
  8661. Header: res.Header,
  8662. HTTPStatusCode: res.StatusCode,
  8663. },
  8664. }
  8665. target := &ret
  8666. if err := gensupport.DecodeResponse(target, res); err != nil {
  8667. return nil, err
  8668. }
  8669. return ret, nil
  8670. // {
  8671. // "description": "Lists sinks.",
  8672. // "flatPath": "v2/organizations/{organizationsId}/sinks",
  8673. // "httpMethod": "GET",
  8674. // "id": "logging.organizations.sinks.list",
  8675. // "parameterOrder": [
  8676. // "parent"
  8677. // ],
  8678. // "parameters": {
  8679. // "pageSize": {
  8680. // "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.",
  8681. // "format": "int32",
  8682. // "location": "query",
  8683. // "type": "integer"
  8684. // },
  8685. // "pageToken": {
  8686. // "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.",
  8687. // "location": "query",
  8688. // "type": "string"
  8689. // },
  8690. // "parent": {
  8691. // "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",
  8692. // "location": "path",
  8693. // "pattern": "^organizations/[^/]+$",
  8694. // "required": true,
  8695. // "type": "string"
  8696. // }
  8697. // },
  8698. // "path": "v2/{+parent}/sinks",
  8699. // "response": {
  8700. // "$ref": "ListSinksResponse"
  8701. // },
  8702. // "scopes": [
  8703. // "https://www.googleapis.com/auth/cloud-platform",
  8704. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  8705. // "https://www.googleapis.com/auth/logging.admin",
  8706. // "https://www.googleapis.com/auth/logging.read"
  8707. // ]
  8708. // }
  8709. }
  8710. // Pages invokes f for each page of results.
  8711. // A non-nil error returned from f will halt the iteration.
  8712. // The provided context supersedes any context provided to the Context method.
  8713. func (c *OrganizationsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  8714. c.ctx_ = ctx
  8715. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8716. for {
  8717. x, err := c.Do()
  8718. if err != nil {
  8719. return err
  8720. }
  8721. if err := f(x); err != nil {
  8722. return err
  8723. }
  8724. if x.NextPageToken == "" {
  8725. return nil
  8726. }
  8727. c.PageToken(x.NextPageToken)
  8728. }
  8729. }
  8730. // method id "logging.organizations.sinks.patch":
  8731. type OrganizationsSinksPatchCall struct {
  8732. s *Service
  8733. sinkNameid string
  8734. logsink *LogSink
  8735. urlParams_ gensupport.URLParams
  8736. ctx_ context.Context
  8737. header_ http.Header
  8738. }
  8739. // Patch: Updates a sink. This method replaces the following fields in
  8740. // the existing sink with values from the new sink: destination, and
  8741. // filter. The updated sink might also have a new writer_identity; see
  8742. // the unique_writer_identity field.
  8743. func (r *OrganizationsSinksService) Patch(sinkNameid string, logsink *LogSink) *OrganizationsSinksPatchCall {
  8744. c := &OrganizationsSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8745. c.sinkNameid = sinkNameid
  8746. c.logsink = logsink
  8747. return c
  8748. }
  8749. // UniqueWriterIdentity sets the optional parameter
  8750. // "uniqueWriterIdentity": See sinks.create for a description of this
  8751. // field. When updating a sink, the effect of this field on the value of
  8752. // writer_identity in the updated sink depends on both the old and new
  8753. // values of this field:
  8754. // If the old and new values of this field are both false or both true,
  8755. // then there is no change to the sink's writer_identity.
  8756. // If the old value is false and the new value is true, then
  8757. // writer_identity is changed to a unique service account.
  8758. // It is an error if the old value is true and the new value is set to
  8759. // false or defaulted to false.
  8760. func (c *OrganizationsSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *OrganizationsSinksPatchCall {
  8761. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  8762. return c
  8763. }
  8764. // UpdateMask sets the optional parameter "updateMask": Field mask that
  8765. // specifies the fields in sink that need an update. A sink field will
  8766. // be overwritten if, and only if, it is in the update mask. name and
  8767. // output only fields cannot be updated.An empty updateMask is
  8768. // temporarily treated as using the following mask for backwards
  8769. // compatibility purposes: destination,filter,includeChildren At some
  8770. // point in the future, behavior will be removed and specifying an empty
  8771. // updateMask will be an error.For a detailed FieldMask definition, see
  8772. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  8773. // updateMask=filter.
  8774. func (c *OrganizationsSinksPatchCall) UpdateMask(updateMask string) *OrganizationsSinksPatchCall {
  8775. c.urlParams_.Set("updateMask", updateMask)
  8776. return c
  8777. }
  8778. // Fields allows partial responses to be retrieved. See
  8779. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8780. // for more information.
  8781. func (c *OrganizationsSinksPatchCall) Fields(s ...googleapi.Field) *OrganizationsSinksPatchCall {
  8782. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8783. return c
  8784. }
  8785. // Context sets the context to be used in this call's Do method. Any
  8786. // pending HTTP request will be aborted if the provided context is
  8787. // canceled.
  8788. func (c *OrganizationsSinksPatchCall) Context(ctx context.Context) *OrganizationsSinksPatchCall {
  8789. c.ctx_ = ctx
  8790. return c
  8791. }
  8792. // Header returns an http.Header that can be modified by the caller to
  8793. // add HTTP headers to the request.
  8794. func (c *OrganizationsSinksPatchCall) Header() http.Header {
  8795. if c.header_ == nil {
  8796. c.header_ = make(http.Header)
  8797. }
  8798. return c.header_
  8799. }
  8800. func (c *OrganizationsSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  8801. reqHeaders := make(http.Header)
  8802. for k, v := range c.header_ {
  8803. reqHeaders[k] = v
  8804. }
  8805. reqHeaders.Set("User-Agent", c.s.userAgent())
  8806. var body io.Reader = nil
  8807. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  8808. if err != nil {
  8809. return nil, err
  8810. }
  8811. reqHeaders.Set("Content-Type", "application/json")
  8812. c.urlParams_.Set("alt", alt)
  8813. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  8814. urls += "?" + c.urlParams_.Encode()
  8815. req, _ := http.NewRequest("PATCH", urls, body)
  8816. req.Header = reqHeaders
  8817. googleapi.Expand(req.URL, map[string]string{
  8818. "sinkName": c.sinkNameid,
  8819. })
  8820. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8821. }
  8822. // Do executes the "logging.organizations.sinks.patch" call.
  8823. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  8824. // code is an error. Response headers are in either
  8825. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  8826. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8827. // check whether the returned error was because http.StatusNotModified
  8828. // was returned.
  8829. func (c *OrganizationsSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  8830. gensupport.SetOptions(c.urlParams_, opts...)
  8831. res, err := c.doRequest("json")
  8832. if res != nil && res.StatusCode == http.StatusNotModified {
  8833. if res.Body != nil {
  8834. res.Body.Close()
  8835. }
  8836. return nil, &googleapi.Error{
  8837. Code: res.StatusCode,
  8838. Header: res.Header,
  8839. }
  8840. }
  8841. if err != nil {
  8842. return nil, err
  8843. }
  8844. defer googleapi.CloseBody(res)
  8845. if err := googleapi.CheckResponse(res); err != nil {
  8846. return nil, err
  8847. }
  8848. ret := &LogSink{
  8849. ServerResponse: googleapi.ServerResponse{
  8850. Header: res.Header,
  8851. HTTPStatusCode: res.StatusCode,
  8852. },
  8853. }
  8854. target := &ret
  8855. if err := gensupport.DecodeResponse(target, res); err != nil {
  8856. return nil, err
  8857. }
  8858. return ret, nil
  8859. // {
  8860. // "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.",
  8861. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  8862. // "httpMethod": "PATCH",
  8863. // "id": "logging.organizations.sinks.patch",
  8864. // "parameterOrder": [
  8865. // "sinkName"
  8866. // ],
  8867. // "parameters": {
  8868. // "sinkName": {
  8869. // "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\".",
  8870. // "location": "path",
  8871. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  8872. // "required": true,
  8873. // "type": "string"
  8874. // },
  8875. // "uniqueWriterIdentity": {
  8876. // "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.",
  8877. // "location": "query",
  8878. // "type": "boolean"
  8879. // },
  8880. // "updateMask": {
  8881. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  8882. // "format": "google-fieldmask",
  8883. // "location": "query",
  8884. // "type": "string"
  8885. // }
  8886. // },
  8887. // "path": "v2/{+sinkName}",
  8888. // "request": {
  8889. // "$ref": "LogSink"
  8890. // },
  8891. // "response": {
  8892. // "$ref": "LogSink"
  8893. // },
  8894. // "scopes": [
  8895. // "https://www.googleapis.com/auth/cloud-platform",
  8896. // "https://www.googleapis.com/auth/logging.admin"
  8897. // ]
  8898. // }
  8899. }
  8900. // method id "logging.organizations.sinks.update":
  8901. type OrganizationsSinksUpdateCall struct {
  8902. s *Service
  8903. sinkNameid string
  8904. logsink *LogSink
  8905. urlParams_ gensupport.URLParams
  8906. ctx_ context.Context
  8907. header_ http.Header
  8908. }
  8909. // Update: Updates a sink. This method replaces the following fields in
  8910. // the existing sink with values from the new sink: destination, and
  8911. // filter. The updated sink might also have a new writer_identity; see
  8912. // the unique_writer_identity field.
  8913. func (r *OrganizationsSinksService) Update(sinkNameid string, logsink *LogSink) *OrganizationsSinksUpdateCall {
  8914. c := &OrganizationsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8915. c.sinkNameid = sinkNameid
  8916. c.logsink = logsink
  8917. return c
  8918. }
  8919. // UniqueWriterIdentity sets the optional parameter
  8920. // "uniqueWriterIdentity": See sinks.create for a description of this
  8921. // field. When updating a sink, the effect of this field on the value of
  8922. // writer_identity in the updated sink depends on both the old and new
  8923. // values of this field:
  8924. // If the old and new values of this field are both false or both true,
  8925. // then there is no change to the sink's writer_identity.
  8926. // If the old value is false and the new value is true, then
  8927. // writer_identity is changed to a unique service account.
  8928. // It is an error if the old value is true and the new value is set to
  8929. // false or defaulted to false.
  8930. func (c *OrganizationsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *OrganizationsSinksUpdateCall {
  8931. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  8932. return c
  8933. }
  8934. // UpdateMask sets the optional parameter "updateMask": Field mask that
  8935. // specifies the fields in sink that need an update. A sink field will
  8936. // be overwritten if, and only if, it is in the update mask. name and
  8937. // output only fields cannot be updated.An empty updateMask is
  8938. // temporarily treated as using the following mask for backwards
  8939. // compatibility purposes: destination,filter,includeChildren At some
  8940. // point in the future, behavior will be removed and specifying an empty
  8941. // updateMask will be an error.For a detailed FieldMask definition, see
  8942. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  8943. // updateMask=filter.
  8944. func (c *OrganizationsSinksUpdateCall) UpdateMask(updateMask string) *OrganizationsSinksUpdateCall {
  8945. c.urlParams_.Set("updateMask", updateMask)
  8946. return c
  8947. }
  8948. // Fields allows partial responses to be retrieved. See
  8949. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8950. // for more information.
  8951. func (c *OrganizationsSinksUpdateCall) Fields(s ...googleapi.Field) *OrganizationsSinksUpdateCall {
  8952. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8953. return c
  8954. }
  8955. // Context sets the context to be used in this call's Do method. Any
  8956. // pending HTTP request will be aborted if the provided context is
  8957. // canceled.
  8958. func (c *OrganizationsSinksUpdateCall) Context(ctx context.Context) *OrganizationsSinksUpdateCall {
  8959. c.ctx_ = ctx
  8960. return c
  8961. }
  8962. // Header returns an http.Header that can be modified by the caller to
  8963. // add HTTP headers to the request.
  8964. func (c *OrganizationsSinksUpdateCall) Header() http.Header {
  8965. if c.header_ == nil {
  8966. c.header_ = make(http.Header)
  8967. }
  8968. return c.header_
  8969. }
  8970. func (c *OrganizationsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  8971. reqHeaders := make(http.Header)
  8972. for k, v := range c.header_ {
  8973. reqHeaders[k] = v
  8974. }
  8975. reqHeaders.Set("User-Agent", c.s.userAgent())
  8976. var body io.Reader = nil
  8977. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  8978. if err != nil {
  8979. return nil, err
  8980. }
  8981. reqHeaders.Set("Content-Type", "application/json")
  8982. c.urlParams_.Set("alt", alt)
  8983. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  8984. urls += "?" + c.urlParams_.Encode()
  8985. req, _ := http.NewRequest("PUT", urls, body)
  8986. req.Header = reqHeaders
  8987. googleapi.Expand(req.URL, map[string]string{
  8988. "sinkName": c.sinkNameid,
  8989. })
  8990. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8991. }
  8992. // Do executes the "logging.organizations.sinks.update" call.
  8993. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  8994. // code is an error. Response headers are in either
  8995. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  8996. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8997. // check whether the returned error was because http.StatusNotModified
  8998. // was returned.
  8999. func (c *OrganizationsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  9000. gensupport.SetOptions(c.urlParams_, opts...)
  9001. res, err := c.doRequest("json")
  9002. if res != nil && res.StatusCode == http.StatusNotModified {
  9003. if res.Body != nil {
  9004. res.Body.Close()
  9005. }
  9006. return nil, &googleapi.Error{
  9007. Code: res.StatusCode,
  9008. Header: res.Header,
  9009. }
  9010. }
  9011. if err != nil {
  9012. return nil, err
  9013. }
  9014. defer googleapi.CloseBody(res)
  9015. if err := googleapi.CheckResponse(res); err != nil {
  9016. return nil, err
  9017. }
  9018. ret := &LogSink{
  9019. ServerResponse: googleapi.ServerResponse{
  9020. Header: res.Header,
  9021. HTTPStatusCode: res.StatusCode,
  9022. },
  9023. }
  9024. target := &ret
  9025. if err := gensupport.DecodeResponse(target, res); err != nil {
  9026. return nil, err
  9027. }
  9028. return ret, nil
  9029. // {
  9030. // "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.",
  9031. // "flatPath": "v2/organizations/{organizationsId}/sinks/{sinksId}",
  9032. // "httpMethod": "PUT",
  9033. // "id": "logging.organizations.sinks.update",
  9034. // "parameterOrder": [
  9035. // "sinkName"
  9036. // ],
  9037. // "parameters": {
  9038. // "sinkName": {
  9039. // "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\".",
  9040. // "location": "path",
  9041. // "pattern": "^organizations/[^/]+/sinks/[^/]+$",
  9042. // "required": true,
  9043. // "type": "string"
  9044. // },
  9045. // "uniqueWriterIdentity": {
  9046. // "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.",
  9047. // "location": "query",
  9048. // "type": "boolean"
  9049. // },
  9050. // "updateMask": {
  9051. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  9052. // "format": "google-fieldmask",
  9053. // "location": "query",
  9054. // "type": "string"
  9055. // }
  9056. // },
  9057. // "path": "v2/{+sinkName}",
  9058. // "request": {
  9059. // "$ref": "LogSink"
  9060. // },
  9061. // "response": {
  9062. // "$ref": "LogSink"
  9063. // },
  9064. // "scopes": [
  9065. // "https://www.googleapis.com/auth/cloud-platform",
  9066. // "https://www.googleapis.com/auth/logging.admin"
  9067. // ]
  9068. // }
  9069. }
  9070. // method id "logging.projects.exclusions.create":
  9071. type ProjectsExclusionsCreateCall struct {
  9072. s *Service
  9073. parent string
  9074. logexclusion *LogExclusion
  9075. urlParams_ gensupport.URLParams
  9076. ctx_ context.Context
  9077. header_ http.Header
  9078. }
  9079. // Create: Creates a new exclusion in a specified parent resource. Only
  9080. // log entries belonging to that resource can be excluded. You can have
  9081. // up to 10 exclusions in a resource.
  9082. func (r *ProjectsExclusionsService) Create(parent string, logexclusion *LogExclusion) *ProjectsExclusionsCreateCall {
  9083. c := &ProjectsExclusionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9084. c.parent = parent
  9085. c.logexclusion = logexclusion
  9086. return c
  9087. }
  9088. // Fields allows partial responses to be retrieved. See
  9089. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9090. // for more information.
  9091. func (c *ProjectsExclusionsCreateCall) Fields(s ...googleapi.Field) *ProjectsExclusionsCreateCall {
  9092. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9093. return c
  9094. }
  9095. // Context sets the context to be used in this call's Do method. Any
  9096. // pending HTTP request will be aborted if the provided context is
  9097. // canceled.
  9098. func (c *ProjectsExclusionsCreateCall) Context(ctx context.Context) *ProjectsExclusionsCreateCall {
  9099. c.ctx_ = ctx
  9100. return c
  9101. }
  9102. // Header returns an http.Header that can be modified by the caller to
  9103. // add HTTP headers to the request.
  9104. func (c *ProjectsExclusionsCreateCall) Header() http.Header {
  9105. if c.header_ == nil {
  9106. c.header_ = make(http.Header)
  9107. }
  9108. return c.header_
  9109. }
  9110. func (c *ProjectsExclusionsCreateCall) doRequest(alt string) (*http.Response, error) {
  9111. reqHeaders := make(http.Header)
  9112. for k, v := range c.header_ {
  9113. reqHeaders[k] = v
  9114. }
  9115. reqHeaders.Set("User-Agent", c.s.userAgent())
  9116. var body io.Reader = nil
  9117. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  9118. if err != nil {
  9119. return nil, err
  9120. }
  9121. reqHeaders.Set("Content-Type", "application/json")
  9122. c.urlParams_.Set("alt", alt)
  9123. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  9124. urls += "?" + c.urlParams_.Encode()
  9125. req, _ := http.NewRequest("POST", urls, body)
  9126. req.Header = reqHeaders
  9127. googleapi.Expand(req.URL, map[string]string{
  9128. "parent": c.parent,
  9129. })
  9130. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9131. }
  9132. // Do executes the "logging.projects.exclusions.create" call.
  9133. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  9134. // status code is an error. Response headers are in either
  9135. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  9136. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9137. // to check whether the returned error was because
  9138. // http.StatusNotModified was returned.
  9139. func (c *ProjectsExclusionsCreateCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  9140. gensupport.SetOptions(c.urlParams_, opts...)
  9141. res, err := c.doRequest("json")
  9142. if res != nil && res.StatusCode == http.StatusNotModified {
  9143. if res.Body != nil {
  9144. res.Body.Close()
  9145. }
  9146. return nil, &googleapi.Error{
  9147. Code: res.StatusCode,
  9148. Header: res.Header,
  9149. }
  9150. }
  9151. if err != nil {
  9152. return nil, err
  9153. }
  9154. defer googleapi.CloseBody(res)
  9155. if err := googleapi.CheckResponse(res); err != nil {
  9156. return nil, err
  9157. }
  9158. ret := &LogExclusion{
  9159. ServerResponse: googleapi.ServerResponse{
  9160. Header: res.Header,
  9161. HTTPStatusCode: res.StatusCode,
  9162. },
  9163. }
  9164. target := &ret
  9165. if err := gensupport.DecodeResponse(target, res); err != nil {
  9166. return nil, err
  9167. }
  9168. return ret, nil
  9169. // {
  9170. // "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.",
  9171. // "flatPath": "v2/projects/{projectsId}/exclusions",
  9172. // "httpMethod": "POST",
  9173. // "id": "logging.projects.exclusions.create",
  9174. // "parameterOrder": [
  9175. // "parent"
  9176. // ],
  9177. // "parameters": {
  9178. // "parent": {
  9179. // "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\".",
  9180. // "location": "path",
  9181. // "pattern": "^projects/[^/]+$",
  9182. // "required": true,
  9183. // "type": "string"
  9184. // }
  9185. // },
  9186. // "path": "v2/{+parent}/exclusions",
  9187. // "request": {
  9188. // "$ref": "LogExclusion"
  9189. // },
  9190. // "response": {
  9191. // "$ref": "LogExclusion"
  9192. // },
  9193. // "scopes": [
  9194. // "https://www.googleapis.com/auth/cloud-platform",
  9195. // "https://www.googleapis.com/auth/logging.admin"
  9196. // ]
  9197. // }
  9198. }
  9199. // method id "logging.projects.exclusions.delete":
  9200. type ProjectsExclusionsDeleteCall struct {
  9201. s *Service
  9202. name string
  9203. urlParams_ gensupport.URLParams
  9204. ctx_ context.Context
  9205. header_ http.Header
  9206. }
  9207. // Delete: Deletes an exclusion.
  9208. func (r *ProjectsExclusionsService) Delete(name string) *ProjectsExclusionsDeleteCall {
  9209. c := &ProjectsExclusionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9210. c.name = name
  9211. return c
  9212. }
  9213. // Fields allows partial responses to be retrieved. See
  9214. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9215. // for more information.
  9216. func (c *ProjectsExclusionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsExclusionsDeleteCall {
  9217. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9218. return c
  9219. }
  9220. // Context sets the context to be used in this call's Do method. Any
  9221. // pending HTTP request will be aborted if the provided context is
  9222. // canceled.
  9223. func (c *ProjectsExclusionsDeleteCall) Context(ctx context.Context) *ProjectsExclusionsDeleteCall {
  9224. c.ctx_ = ctx
  9225. return c
  9226. }
  9227. // Header returns an http.Header that can be modified by the caller to
  9228. // add HTTP headers to the request.
  9229. func (c *ProjectsExclusionsDeleteCall) Header() http.Header {
  9230. if c.header_ == nil {
  9231. c.header_ = make(http.Header)
  9232. }
  9233. return c.header_
  9234. }
  9235. func (c *ProjectsExclusionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9236. reqHeaders := make(http.Header)
  9237. for k, v := range c.header_ {
  9238. reqHeaders[k] = v
  9239. }
  9240. reqHeaders.Set("User-Agent", c.s.userAgent())
  9241. var body io.Reader = nil
  9242. c.urlParams_.Set("alt", alt)
  9243. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  9244. urls += "?" + c.urlParams_.Encode()
  9245. req, _ := http.NewRequest("DELETE", urls, body)
  9246. req.Header = reqHeaders
  9247. googleapi.Expand(req.URL, map[string]string{
  9248. "name": c.name,
  9249. })
  9250. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9251. }
  9252. // Do executes the "logging.projects.exclusions.delete" call.
  9253. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9254. // code is an error. Response headers are in either
  9255. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9256. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9257. // check whether the returned error was because http.StatusNotModified
  9258. // was returned.
  9259. func (c *ProjectsExclusionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9260. gensupport.SetOptions(c.urlParams_, opts...)
  9261. res, err := c.doRequest("json")
  9262. if res != nil && res.StatusCode == http.StatusNotModified {
  9263. if res.Body != nil {
  9264. res.Body.Close()
  9265. }
  9266. return nil, &googleapi.Error{
  9267. Code: res.StatusCode,
  9268. Header: res.Header,
  9269. }
  9270. }
  9271. if err != nil {
  9272. return nil, err
  9273. }
  9274. defer googleapi.CloseBody(res)
  9275. if err := googleapi.CheckResponse(res); err != nil {
  9276. return nil, err
  9277. }
  9278. ret := &Empty{
  9279. ServerResponse: googleapi.ServerResponse{
  9280. Header: res.Header,
  9281. HTTPStatusCode: res.StatusCode,
  9282. },
  9283. }
  9284. target := &ret
  9285. if err := gensupport.DecodeResponse(target, res); err != nil {
  9286. return nil, err
  9287. }
  9288. return ret, nil
  9289. // {
  9290. // "description": "Deletes an exclusion.",
  9291. // "flatPath": "v2/projects/{projectsId}/exclusions/{exclusionsId}",
  9292. // "httpMethod": "DELETE",
  9293. // "id": "logging.projects.exclusions.delete",
  9294. // "parameterOrder": [
  9295. // "name"
  9296. // ],
  9297. // "parameters": {
  9298. // "name": {
  9299. // "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\".",
  9300. // "location": "path",
  9301. // "pattern": "^projects/[^/]+/exclusions/[^/]+$",
  9302. // "required": true,
  9303. // "type": "string"
  9304. // }
  9305. // },
  9306. // "path": "v2/{+name}",
  9307. // "response": {
  9308. // "$ref": "Empty"
  9309. // },
  9310. // "scopes": [
  9311. // "https://www.googleapis.com/auth/cloud-platform",
  9312. // "https://www.googleapis.com/auth/logging.admin"
  9313. // ]
  9314. // }
  9315. }
  9316. // method id "logging.projects.exclusions.get":
  9317. type ProjectsExclusionsGetCall struct {
  9318. s *Service
  9319. name string
  9320. urlParams_ gensupport.URLParams
  9321. ifNoneMatch_ string
  9322. ctx_ context.Context
  9323. header_ http.Header
  9324. }
  9325. // Get: Gets the description of an exclusion.
  9326. func (r *ProjectsExclusionsService) Get(name string) *ProjectsExclusionsGetCall {
  9327. c := &ProjectsExclusionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9328. c.name = name
  9329. return c
  9330. }
  9331. // Fields allows partial responses to be retrieved. See
  9332. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9333. // for more information.
  9334. func (c *ProjectsExclusionsGetCall) Fields(s ...googleapi.Field) *ProjectsExclusionsGetCall {
  9335. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9336. return c
  9337. }
  9338. // IfNoneMatch sets the optional parameter which makes the operation
  9339. // fail if the object's ETag matches the given value. This is useful for
  9340. // getting updates only after the object has changed since the last
  9341. // request. Use googleapi.IsNotModified to check whether the response
  9342. // error from Do is the result of In-None-Match.
  9343. func (c *ProjectsExclusionsGetCall) IfNoneMatch(entityTag string) *ProjectsExclusionsGetCall {
  9344. c.ifNoneMatch_ = entityTag
  9345. return c
  9346. }
  9347. // Context sets the context to be used in this call's Do method. Any
  9348. // pending HTTP request will be aborted if the provided context is
  9349. // canceled.
  9350. func (c *ProjectsExclusionsGetCall) Context(ctx context.Context) *ProjectsExclusionsGetCall {
  9351. c.ctx_ = ctx
  9352. return c
  9353. }
  9354. // Header returns an http.Header that can be modified by the caller to
  9355. // add HTTP headers to the request.
  9356. func (c *ProjectsExclusionsGetCall) Header() http.Header {
  9357. if c.header_ == nil {
  9358. c.header_ = make(http.Header)
  9359. }
  9360. return c.header_
  9361. }
  9362. func (c *ProjectsExclusionsGetCall) doRequest(alt string) (*http.Response, error) {
  9363. reqHeaders := make(http.Header)
  9364. for k, v := range c.header_ {
  9365. reqHeaders[k] = v
  9366. }
  9367. reqHeaders.Set("User-Agent", c.s.userAgent())
  9368. if c.ifNoneMatch_ != "" {
  9369. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9370. }
  9371. var body io.Reader = nil
  9372. c.urlParams_.Set("alt", alt)
  9373. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  9374. urls += "?" + c.urlParams_.Encode()
  9375. req, _ := http.NewRequest("GET", urls, body)
  9376. req.Header = reqHeaders
  9377. googleapi.Expand(req.URL, map[string]string{
  9378. "name": c.name,
  9379. })
  9380. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9381. }
  9382. // Do executes the "logging.projects.exclusions.get" call.
  9383. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  9384. // status code is an error. Response headers are in either
  9385. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  9386. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9387. // to check whether the returned error was because
  9388. // http.StatusNotModified was returned.
  9389. func (c *ProjectsExclusionsGetCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  9390. gensupport.SetOptions(c.urlParams_, opts...)
  9391. res, err := c.doRequest("json")
  9392. if res != nil && res.StatusCode == http.StatusNotModified {
  9393. if res.Body != nil {
  9394. res.Body.Close()
  9395. }
  9396. return nil, &googleapi.Error{
  9397. Code: res.StatusCode,
  9398. Header: res.Header,
  9399. }
  9400. }
  9401. if err != nil {
  9402. return nil, err
  9403. }
  9404. defer googleapi.CloseBody(res)
  9405. if err := googleapi.CheckResponse(res); err != nil {
  9406. return nil, err
  9407. }
  9408. ret := &LogExclusion{
  9409. ServerResponse: googleapi.ServerResponse{
  9410. Header: res.Header,
  9411. HTTPStatusCode: res.StatusCode,
  9412. },
  9413. }
  9414. target := &ret
  9415. if err := gensupport.DecodeResponse(target, res); err != nil {
  9416. return nil, err
  9417. }
  9418. return ret, nil
  9419. // {
  9420. // "description": "Gets the description of an exclusion.",
  9421. // "flatPath": "v2/projects/{projectsId}/exclusions/{exclusionsId}",
  9422. // "httpMethod": "GET",
  9423. // "id": "logging.projects.exclusions.get",
  9424. // "parameterOrder": [
  9425. // "name"
  9426. // ],
  9427. // "parameters": {
  9428. // "name": {
  9429. // "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\".",
  9430. // "location": "path",
  9431. // "pattern": "^projects/[^/]+/exclusions/[^/]+$",
  9432. // "required": true,
  9433. // "type": "string"
  9434. // }
  9435. // },
  9436. // "path": "v2/{+name}",
  9437. // "response": {
  9438. // "$ref": "LogExclusion"
  9439. // },
  9440. // "scopes": [
  9441. // "https://www.googleapis.com/auth/cloud-platform",
  9442. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9443. // "https://www.googleapis.com/auth/logging.admin",
  9444. // "https://www.googleapis.com/auth/logging.read"
  9445. // ]
  9446. // }
  9447. }
  9448. // method id "logging.projects.exclusions.list":
  9449. type ProjectsExclusionsListCall struct {
  9450. s *Service
  9451. parent string
  9452. urlParams_ gensupport.URLParams
  9453. ifNoneMatch_ string
  9454. ctx_ context.Context
  9455. header_ http.Header
  9456. }
  9457. // List: Lists all the exclusions in a parent resource.
  9458. func (r *ProjectsExclusionsService) List(parent string) *ProjectsExclusionsListCall {
  9459. c := &ProjectsExclusionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9460. c.parent = parent
  9461. return c
  9462. }
  9463. // PageSize sets the optional parameter "pageSize": The maximum number
  9464. // of results to return from this request. Non-positive values are
  9465. // ignored. The presence of nextPageToken in the response indicates that
  9466. // more results might be available.
  9467. func (c *ProjectsExclusionsListCall) PageSize(pageSize int64) *ProjectsExclusionsListCall {
  9468. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  9469. return c
  9470. }
  9471. // PageToken sets the optional parameter "pageToken": If present, then
  9472. // retrieve the next batch of results from the preceding call to this
  9473. // method. pageToken must be the value of nextPageToken from the
  9474. // previous response. The values of other method parameters should be
  9475. // identical to those in the previous call.
  9476. func (c *ProjectsExclusionsListCall) PageToken(pageToken string) *ProjectsExclusionsListCall {
  9477. c.urlParams_.Set("pageToken", pageToken)
  9478. return c
  9479. }
  9480. // Fields allows partial responses to be retrieved. See
  9481. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9482. // for more information.
  9483. func (c *ProjectsExclusionsListCall) Fields(s ...googleapi.Field) *ProjectsExclusionsListCall {
  9484. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9485. return c
  9486. }
  9487. // IfNoneMatch sets the optional parameter which makes the operation
  9488. // fail if the object's ETag matches the given value. This is useful for
  9489. // getting updates only after the object has changed since the last
  9490. // request. Use googleapi.IsNotModified to check whether the response
  9491. // error from Do is the result of In-None-Match.
  9492. func (c *ProjectsExclusionsListCall) IfNoneMatch(entityTag string) *ProjectsExclusionsListCall {
  9493. c.ifNoneMatch_ = entityTag
  9494. return c
  9495. }
  9496. // Context sets the context to be used in this call's Do method. Any
  9497. // pending HTTP request will be aborted if the provided context is
  9498. // canceled.
  9499. func (c *ProjectsExclusionsListCall) Context(ctx context.Context) *ProjectsExclusionsListCall {
  9500. c.ctx_ = ctx
  9501. return c
  9502. }
  9503. // Header returns an http.Header that can be modified by the caller to
  9504. // add HTTP headers to the request.
  9505. func (c *ProjectsExclusionsListCall) Header() http.Header {
  9506. if c.header_ == nil {
  9507. c.header_ = make(http.Header)
  9508. }
  9509. return c.header_
  9510. }
  9511. func (c *ProjectsExclusionsListCall) doRequest(alt string) (*http.Response, error) {
  9512. reqHeaders := make(http.Header)
  9513. for k, v := range c.header_ {
  9514. reqHeaders[k] = v
  9515. }
  9516. reqHeaders.Set("User-Agent", c.s.userAgent())
  9517. if c.ifNoneMatch_ != "" {
  9518. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9519. }
  9520. var body io.Reader = nil
  9521. c.urlParams_.Set("alt", alt)
  9522. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/exclusions")
  9523. urls += "?" + c.urlParams_.Encode()
  9524. req, _ := http.NewRequest("GET", urls, body)
  9525. req.Header = reqHeaders
  9526. googleapi.Expand(req.URL, map[string]string{
  9527. "parent": c.parent,
  9528. })
  9529. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9530. }
  9531. // Do executes the "logging.projects.exclusions.list" call.
  9532. // Exactly one of *ListExclusionsResponse or error will be non-nil. Any
  9533. // non-2xx status code is an error. Response headers are in either
  9534. // *ListExclusionsResponse.ServerResponse.Header or (if a response was
  9535. // returned at all) in error.(*googleapi.Error).Header. Use
  9536. // googleapi.IsNotModified to check whether the returned error was
  9537. // because http.StatusNotModified was returned.
  9538. func (c *ProjectsExclusionsListCall) Do(opts ...googleapi.CallOption) (*ListExclusionsResponse, error) {
  9539. gensupport.SetOptions(c.urlParams_, opts...)
  9540. res, err := c.doRequest("json")
  9541. if res != nil && res.StatusCode == http.StatusNotModified {
  9542. if res.Body != nil {
  9543. res.Body.Close()
  9544. }
  9545. return nil, &googleapi.Error{
  9546. Code: res.StatusCode,
  9547. Header: res.Header,
  9548. }
  9549. }
  9550. if err != nil {
  9551. return nil, err
  9552. }
  9553. defer googleapi.CloseBody(res)
  9554. if err := googleapi.CheckResponse(res); err != nil {
  9555. return nil, err
  9556. }
  9557. ret := &ListExclusionsResponse{
  9558. ServerResponse: googleapi.ServerResponse{
  9559. Header: res.Header,
  9560. HTTPStatusCode: res.StatusCode,
  9561. },
  9562. }
  9563. target := &ret
  9564. if err := gensupport.DecodeResponse(target, res); err != nil {
  9565. return nil, err
  9566. }
  9567. return ret, nil
  9568. // {
  9569. // "description": "Lists all the exclusions in a parent resource.",
  9570. // "flatPath": "v2/projects/{projectsId}/exclusions",
  9571. // "httpMethod": "GET",
  9572. // "id": "logging.projects.exclusions.list",
  9573. // "parameterOrder": [
  9574. // "parent"
  9575. // ],
  9576. // "parameters": {
  9577. // "pageSize": {
  9578. // "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.",
  9579. // "format": "int32",
  9580. // "location": "query",
  9581. // "type": "integer"
  9582. // },
  9583. // "pageToken": {
  9584. // "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.",
  9585. // "location": "query",
  9586. // "type": "string"
  9587. // },
  9588. // "parent": {
  9589. // "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",
  9590. // "location": "path",
  9591. // "pattern": "^projects/[^/]+$",
  9592. // "required": true,
  9593. // "type": "string"
  9594. // }
  9595. // },
  9596. // "path": "v2/{+parent}/exclusions",
  9597. // "response": {
  9598. // "$ref": "ListExclusionsResponse"
  9599. // },
  9600. // "scopes": [
  9601. // "https://www.googleapis.com/auth/cloud-platform",
  9602. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  9603. // "https://www.googleapis.com/auth/logging.admin",
  9604. // "https://www.googleapis.com/auth/logging.read"
  9605. // ]
  9606. // }
  9607. }
  9608. // Pages invokes f for each page of results.
  9609. // A non-nil error returned from f will halt the iteration.
  9610. // The provided context supersedes any context provided to the Context method.
  9611. func (c *ProjectsExclusionsListCall) Pages(ctx context.Context, f func(*ListExclusionsResponse) error) error {
  9612. c.ctx_ = ctx
  9613. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9614. for {
  9615. x, err := c.Do()
  9616. if err != nil {
  9617. return err
  9618. }
  9619. if err := f(x); err != nil {
  9620. return err
  9621. }
  9622. if x.NextPageToken == "" {
  9623. return nil
  9624. }
  9625. c.PageToken(x.NextPageToken)
  9626. }
  9627. }
  9628. // method id "logging.projects.exclusions.patch":
  9629. type ProjectsExclusionsPatchCall struct {
  9630. s *Service
  9631. name string
  9632. logexclusion *LogExclusion
  9633. urlParams_ gensupport.URLParams
  9634. ctx_ context.Context
  9635. header_ http.Header
  9636. }
  9637. // Patch: Changes one or more properties of an existing exclusion.
  9638. func (r *ProjectsExclusionsService) Patch(name string, logexclusion *LogExclusion) *ProjectsExclusionsPatchCall {
  9639. c := &ProjectsExclusionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9640. c.name = name
  9641. c.logexclusion = logexclusion
  9642. return c
  9643. }
  9644. // UpdateMask sets the optional parameter "updateMask": Required. A
  9645. // nonempty list of fields to change in the existing exclusion. New
  9646. // values for the fields are taken from the corresponding fields in the
  9647. // LogExclusion included in this request. Fields not mentioned in
  9648. // update_mask are not changed and are ignored in the request.For
  9649. // example, to change the filter and description of an exclusion,
  9650. // specify an update_mask of "filter,description".
  9651. func (c *ProjectsExclusionsPatchCall) UpdateMask(updateMask string) *ProjectsExclusionsPatchCall {
  9652. c.urlParams_.Set("updateMask", updateMask)
  9653. return c
  9654. }
  9655. // Fields allows partial responses to be retrieved. See
  9656. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9657. // for more information.
  9658. func (c *ProjectsExclusionsPatchCall) Fields(s ...googleapi.Field) *ProjectsExclusionsPatchCall {
  9659. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9660. return c
  9661. }
  9662. // Context sets the context to be used in this call's Do method. Any
  9663. // pending HTTP request will be aborted if the provided context is
  9664. // canceled.
  9665. func (c *ProjectsExclusionsPatchCall) Context(ctx context.Context) *ProjectsExclusionsPatchCall {
  9666. c.ctx_ = ctx
  9667. return c
  9668. }
  9669. // Header returns an http.Header that can be modified by the caller to
  9670. // add HTTP headers to the request.
  9671. func (c *ProjectsExclusionsPatchCall) Header() http.Header {
  9672. if c.header_ == nil {
  9673. c.header_ = make(http.Header)
  9674. }
  9675. return c.header_
  9676. }
  9677. func (c *ProjectsExclusionsPatchCall) doRequest(alt string) (*http.Response, error) {
  9678. reqHeaders := make(http.Header)
  9679. for k, v := range c.header_ {
  9680. reqHeaders[k] = v
  9681. }
  9682. reqHeaders.Set("User-Agent", c.s.userAgent())
  9683. var body io.Reader = nil
  9684. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logexclusion)
  9685. if err != nil {
  9686. return nil, err
  9687. }
  9688. reqHeaders.Set("Content-Type", "application/json")
  9689. c.urlParams_.Set("alt", alt)
  9690. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  9691. urls += "?" + c.urlParams_.Encode()
  9692. req, _ := http.NewRequest("PATCH", urls, body)
  9693. req.Header = reqHeaders
  9694. googleapi.Expand(req.URL, map[string]string{
  9695. "name": c.name,
  9696. })
  9697. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9698. }
  9699. // Do executes the "logging.projects.exclusions.patch" call.
  9700. // Exactly one of *LogExclusion or error will be non-nil. Any non-2xx
  9701. // status code is an error. Response headers are in either
  9702. // *LogExclusion.ServerResponse.Header or (if a response was returned at
  9703. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9704. // to check whether the returned error was because
  9705. // http.StatusNotModified was returned.
  9706. func (c *ProjectsExclusionsPatchCall) Do(opts ...googleapi.CallOption) (*LogExclusion, error) {
  9707. gensupport.SetOptions(c.urlParams_, opts...)
  9708. res, err := c.doRequest("json")
  9709. if res != nil && res.StatusCode == http.StatusNotModified {
  9710. if res.Body != nil {
  9711. res.Body.Close()
  9712. }
  9713. return nil, &googleapi.Error{
  9714. Code: res.StatusCode,
  9715. Header: res.Header,
  9716. }
  9717. }
  9718. if err != nil {
  9719. return nil, err
  9720. }
  9721. defer googleapi.CloseBody(res)
  9722. if err := googleapi.CheckResponse(res); err != nil {
  9723. return nil, err
  9724. }
  9725. ret := &LogExclusion{
  9726. ServerResponse: googleapi.ServerResponse{
  9727. Header: res.Header,
  9728. HTTPStatusCode: res.StatusCode,
  9729. },
  9730. }
  9731. target := &ret
  9732. if err := gensupport.DecodeResponse(target, res); err != nil {
  9733. return nil, err
  9734. }
  9735. return ret, nil
  9736. // {
  9737. // "description": "Changes one or more properties of an existing exclusion.",
  9738. // "flatPath": "v2/projects/{projectsId}/exclusions/{exclusionsId}",
  9739. // "httpMethod": "PATCH",
  9740. // "id": "logging.projects.exclusions.patch",
  9741. // "parameterOrder": [
  9742. // "name"
  9743. // ],
  9744. // "parameters": {
  9745. // "name": {
  9746. // "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\".",
  9747. // "location": "path",
  9748. // "pattern": "^projects/[^/]+/exclusions/[^/]+$",
  9749. // "required": true,
  9750. // "type": "string"
  9751. // },
  9752. // "updateMask": {
  9753. // "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\".",
  9754. // "format": "google-fieldmask",
  9755. // "location": "query",
  9756. // "type": "string"
  9757. // }
  9758. // },
  9759. // "path": "v2/{+name}",
  9760. // "request": {
  9761. // "$ref": "LogExclusion"
  9762. // },
  9763. // "response": {
  9764. // "$ref": "LogExclusion"
  9765. // },
  9766. // "scopes": [
  9767. // "https://www.googleapis.com/auth/cloud-platform",
  9768. // "https://www.googleapis.com/auth/logging.admin"
  9769. // ]
  9770. // }
  9771. }
  9772. // method id "logging.projects.logs.delete":
  9773. type ProjectsLogsDeleteCall struct {
  9774. s *Service
  9775. logName string
  9776. urlParams_ gensupport.URLParams
  9777. ctx_ context.Context
  9778. header_ http.Header
  9779. }
  9780. // Delete: Deletes all the log entries in a log. The log reappears if it
  9781. // receives new entries. Log entries written shortly before the delete
  9782. // operation might not be deleted.
  9783. func (r *ProjectsLogsService) Delete(logName string) *ProjectsLogsDeleteCall {
  9784. c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9785. c.logName = logName
  9786. return c
  9787. }
  9788. // Fields allows partial responses to be retrieved. See
  9789. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9790. // for more information.
  9791. func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall {
  9792. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9793. return c
  9794. }
  9795. // Context sets the context to be used in this call's Do method. Any
  9796. // pending HTTP request will be aborted if the provided context is
  9797. // canceled.
  9798. func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall {
  9799. c.ctx_ = ctx
  9800. return c
  9801. }
  9802. // Header returns an http.Header that can be modified by the caller to
  9803. // add HTTP headers to the request.
  9804. func (c *ProjectsLogsDeleteCall) Header() http.Header {
  9805. if c.header_ == nil {
  9806. c.header_ = make(http.Header)
  9807. }
  9808. return c.header_
  9809. }
  9810. func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9811. reqHeaders := make(http.Header)
  9812. for k, v := range c.header_ {
  9813. reqHeaders[k] = v
  9814. }
  9815. reqHeaders.Set("User-Agent", c.s.userAgent())
  9816. var body io.Reader = nil
  9817. c.urlParams_.Set("alt", alt)
  9818. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+logName}")
  9819. urls += "?" + c.urlParams_.Encode()
  9820. req, _ := http.NewRequest("DELETE", urls, body)
  9821. req.Header = reqHeaders
  9822. googleapi.Expand(req.URL, map[string]string{
  9823. "logName": c.logName,
  9824. })
  9825. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9826. }
  9827. // Do executes the "logging.projects.logs.delete" call.
  9828. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9829. // code is an error. Response headers are in either
  9830. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9831. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9832. // check whether the returned error was because http.StatusNotModified
  9833. // was returned.
  9834. func (c *ProjectsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9835. gensupport.SetOptions(c.urlParams_, opts...)
  9836. res, err := c.doRequest("json")
  9837. if res != nil && res.StatusCode == http.StatusNotModified {
  9838. if res.Body != nil {
  9839. res.Body.Close()
  9840. }
  9841. return nil, &googleapi.Error{
  9842. Code: res.StatusCode,
  9843. Header: res.Header,
  9844. }
  9845. }
  9846. if err != nil {
  9847. return nil, err
  9848. }
  9849. defer googleapi.CloseBody(res)
  9850. if err := googleapi.CheckResponse(res); err != nil {
  9851. return nil, err
  9852. }
  9853. ret := &Empty{
  9854. ServerResponse: googleapi.ServerResponse{
  9855. Header: res.Header,
  9856. HTTPStatusCode: res.StatusCode,
  9857. },
  9858. }
  9859. target := &ret
  9860. if err := gensupport.DecodeResponse(target, res); err != nil {
  9861. return nil, err
  9862. }
  9863. return ret, nil
  9864. // {
  9865. // "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.",
  9866. // "flatPath": "v2/projects/{projectsId}/logs/{logsId}",
  9867. // "httpMethod": "DELETE",
  9868. // "id": "logging.projects.logs.delete",
  9869. // "parameterOrder": [
  9870. // "logName"
  9871. // ],
  9872. // "parameters": {
  9873. // "logName": {
  9874. // "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.",
  9875. // "location": "path",
  9876. // "pattern": "^projects/[^/]+/logs/[^/]+$",
  9877. // "required": true,
  9878. // "type": "string"
  9879. // }
  9880. // },
  9881. // "path": "v2/{+logName}",
  9882. // "response": {
  9883. // "$ref": "Empty"
  9884. // },
  9885. // "scopes": [
  9886. // "https://www.googleapis.com/auth/cloud-platform",
  9887. // "https://www.googleapis.com/auth/logging.admin"
  9888. // ]
  9889. // }
  9890. }
  9891. // method id "logging.projects.logs.list":
  9892. type ProjectsLogsListCall struct {
  9893. s *Service
  9894. parent string
  9895. urlParams_ gensupport.URLParams
  9896. ifNoneMatch_ string
  9897. ctx_ context.Context
  9898. header_ http.Header
  9899. }
  9900. // List: Lists the logs in projects, organizations, folders, or billing
  9901. // accounts. Only logs that have entries are listed.
  9902. func (r *ProjectsLogsService) List(parent string) *ProjectsLogsListCall {
  9903. c := &ProjectsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9904. c.parent = parent
  9905. return c
  9906. }
  9907. // PageSize sets the optional parameter "pageSize": The maximum number
  9908. // of results to return from this request. Non-positive values are
  9909. // ignored. The presence of nextPageToken in the response indicates that
  9910. // more results might be available.
  9911. func (c *ProjectsLogsListCall) PageSize(pageSize int64) *ProjectsLogsListCall {
  9912. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  9913. return c
  9914. }
  9915. // PageToken sets the optional parameter "pageToken": If present, then
  9916. // retrieve the next batch of results from the preceding call to this
  9917. // method. pageToken must be the value of nextPageToken from the
  9918. // previous response. The values of other method parameters should be
  9919. // identical to those in the previous call.
  9920. func (c *ProjectsLogsListCall) PageToken(pageToken string) *ProjectsLogsListCall {
  9921. c.urlParams_.Set("pageToken", pageToken)
  9922. return c
  9923. }
  9924. // Fields allows partial responses to be retrieved. See
  9925. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9926. // for more information.
  9927. func (c *ProjectsLogsListCall) Fields(s ...googleapi.Field) *ProjectsLogsListCall {
  9928. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9929. return c
  9930. }
  9931. // IfNoneMatch sets the optional parameter which makes the operation
  9932. // fail if the object's ETag matches the given value. This is useful for
  9933. // getting updates only after the object has changed since the last
  9934. // request. Use googleapi.IsNotModified to check whether the response
  9935. // error from Do is the result of In-None-Match.
  9936. func (c *ProjectsLogsListCall) IfNoneMatch(entityTag string) *ProjectsLogsListCall {
  9937. c.ifNoneMatch_ = entityTag
  9938. return c
  9939. }
  9940. // Context sets the context to be used in this call's Do method. Any
  9941. // pending HTTP request will be aborted if the provided context is
  9942. // canceled.
  9943. func (c *ProjectsLogsListCall) Context(ctx context.Context) *ProjectsLogsListCall {
  9944. c.ctx_ = ctx
  9945. return c
  9946. }
  9947. // Header returns an http.Header that can be modified by the caller to
  9948. // add HTTP headers to the request.
  9949. func (c *ProjectsLogsListCall) Header() http.Header {
  9950. if c.header_ == nil {
  9951. c.header_ = make(http.Header)
  9952. }
  9953. return c.header_
  9954. }
  9955. func (c *ProjectsLogsListCall) doRequest(alt string) (*http.Response, error) {
  9956. reqHeaders := make(http.Header)
  9957. for k, v := range c.header_ {
  9958. reqHeaders[k] = v
  9959. }
  9960. reqHeaders.Set("User-Agent", c.s.userAgent())
  9961. if c.ifNoneMatch_ != "" {
  9962. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9963. }
  9964. var body io.Reader = nil
  9965. c.urlParams_.Set("alt", alt)
  9966. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/logs")
  9967. urls += "?" + c.urlParams_.Encode()
  9968. req, _ := http.NewRequest("GET", urls, body)
  9969. req.Header = reqHeaders
  9970. googleapi.Expand(req.URL, map[string]string{
  9971. "parent": c.parent,
  9972. })
  9973. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9974. }
  9975. // Do executes the "logging.projects.logs.list" call.
  9976. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  9977. // non-2xx status code is an error. Response headers are in either
  9978. // *ListLogsResponse.ServerResponse.Header or (if a response was
  9979. // returned at all) in error.(*googleapi.Error).Header. Use
  9980. // googleapi.IsNotModified to check whether the returned error was
  9981. // because http.StatusNotModified was returned.
  9982. func (c *ProjectsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  9983. gensupport.SetOptions(c.urlParams_, opts...)
  9984. res, err := c.doRequest("json")
  9985. if res != nil && res.StatusCode == http.StatusNotModified {
  9986. if res.Body != nil {
  9987. res.Body.Close()
  9988. }
  9989. return nil, &googleapi.Error{
  9990. Code: res.StatusCode,
  9991. Header: res.Header,
  9992. }
  9993. }
  9994. if err != nil {
  9995. return nil, err
  9996. }
  9997. defer googleapi.CloseBody(res)
  9998. if err := googleapi.CheckResponse(res); err != nil {
  9999. return nil, err
  10000. }
  10001. ret := &ListLogsResponse{
  10002. ServerResponse: googleapi.ServerResponse{
  10003. Header: res.Header,
  10004. HTTPStatusCode: res.StatusCode,
  10005. },
  10006. }
  10007. target := &ret
  10008. if err := gensupport.DecodeResponse(target, res); err != nil {
  10009. return nil, err
  10010. }
  10011. return ret, nil
  10012. // {
  10013. // "description": "Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.",
  10014. // "flatPath": "v2/projects/{projectsId}/logs",
  10015. // "httpMethod": "GET",
  10016. // "id": "logging.projects.logs.list",
  10017. // "parameterOrder": [
  10018. // "parent"
  10019. // ],
  10020. // "parameters": {
  10021. // "pageSize": {
  10022. // "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.",
  10023. // "format": "int32",
  10024. // "location": "query",
  10025. // "type": "integer"
  10026. // },
  10027. // "pageToken": {
  10028. // "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.",
  10029. // "location": "query",
  10030. // "type": "string"
  10031. // },
  10032. // "parent": {
  10033. // "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",
  10034. // "location": "path",
  10035. // "pattern": "^projects/[^/]+$",
  10036. // "required": true,
  10037. // "type": "string"
  10038. // }
  10039. // },
  10040. // "path": "v2/{+parent}/logs",
  10041. // "response": {
  10042. // "$ref": "ListLogsResponse"
  10043. // },
  10044. // "scopes": [
  10045. // "https://www.googleapis.com/auth/cloud-platform",
  10046. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10047. // "https://www.googleapis.com/auth/logging.admin",
  10048. // "https://www.googleapis.com/auth/logging.read"
  10049. // ]
  10050. // }
  10051. }
  10052. // Pages invokes f for each page of results.
  10053. // A non-nil error returned from f will halt the iteration.
  10054. // The provided context supersedes any context provided to the Context method.
  10055. func (c *ProjectsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  10056. c.ctx_ = ctx
  10057. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  10058. for {
  10059. x, err := c.Do()
  10060. if err != nil {
  10061. return err
  10062. }
  10063. if err := f(x); err != nil {
  10064. return err
  10065. }
  10066. if x.NextPageToken == "" {
  10067. return nil
  10068. }
  10069. c.PageToken(x.NextPageToken)
  10070. }
  10071. }
  10072. // method id "logging.projects.metrics.create":
  10073. type ProjectsMetricsCreateCall struct {
  10074. s *Service
  10075. parent string
  10076. logmetric *LogMetric
  10077. urlParams_ gensupport.URLParams
  10078. ctx_ context.Context
  10079. header_ http.Header
  10080. }
  10081. // Create: Creates a logs-based metric.
  10082. func (r *ProjectsMetricsService) Create(parent string, logmetric *LogMetric) *ProjectsMetricsCreateCall {
  10083. c := &ProjectsMetricsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10084. c.parent = parent
  10085. c.logmetric = logmetric
  10086. return c
  10087. }
  10088. // Fields allows partial responses to be retrieved. See
  10089. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10090. // for more information.
  10091. func (c *ProjectsMetricsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricsCreateCall {
  10092. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10093. return c
  10094. }
  10095. // Context sets the context to be used in this call's Do method. Any
  10096. // pending HTTP request will be aborted if the provided context is
  10097. // canceled.
  10098. func (c *ProjectsMetricsCreateCall) Context(ctx context.Context) *ProjectsMetricsCreateCall {
  10099. c.ctx_ = ctx
  10100. return c
  10101. }
  10102. // Header returns an http.Header that can be modified by the caller to
  10103. // add HTTP headers to the request.
  10104. func (c *ProjectsMetricsCreateCall) Header() http.Header {
  10105. if c.header_ == nil {
  10106. c.header_ = make(http.Header)
  10107. }
  10108. return c.header_
  10109. }
  10110. func (c *ProjectsMetricsCreateCall) doRequest(alt string) (*http.Response, error) {
  10111. reqHeaders := make(http.Header)
  10112. for k, v := range c.header_ {
  10113. reqHeaders[k] = v
  10114. }
  10115. reqHeaders.Set("User-Agent", c.s.userAgent())
  10116. var body io.Reader = nil
  10117. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  10118. if err != nil {
  10119. return nil, err
  10120. }
  10121. reqHeaders.Set("Content-Type", "application/json")
  10122. c.urlParams_.Set("alt", alt)
  10123. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/metrics")
  10124. urls += "?" + c.urlParams_.Encode()
  10125. req, _ := http.NewRequest("POST", urls, body)
  10126. req.Header = reqHeaders
  10127. googleapi.Expand(req.URL, map[string]string{
  10128. "parent": c.parent,
  10129. })
  10130. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10131. }
  10132. // Do executes the "logging.projects.metrics.create" call.
  10133. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  10134. // status code is an error. Response headers are in either
  10135. // *LogMetric.ServerResponse.Header or (if a response was returned at
  10136. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10137. // to check whether the returned error was because
  10138. // http.StatusNotModified was returned.
  10139. func (c *ProjectsMetricsCreateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  10140. gensupport.SetOptions(c.urlParams_, opts...)
  10141. res, err := c.doRequest("json")
  10142. if res != nil && res.StatusCode == http.StatusNotModified {
  10143. if res.Body != nil {
  10144. res.Body.Close()
  10145. }
  10146. return nil, &googleapi.Error{
  10147. Code: res.StatusCode,
  10148. Header: res.Header,
  10149. }
  10150. }
  10151. if err != nil {
  10152. return nil, err
  10153. }
  10154. defer googleapi.CloseBody(res)
  10155. if err := googleapi.CheckResponse(res); err != nil {
  10156. return nil, err
  10157. }
  10158. ret := &LogMetric{
  10159. ServerResponse: googleapi.ServerResponse{
  10160. Header: res.Header,
  10161. HTTPStatusCode: res.StatusCode,
  10162. },
  10163. }
  10164. target := &ret
  10165. if err := gensupport.DecodeResponse(target, res); err != nil {
  10166. return nil, err
  10167. }
  10168. return ret, nil
  10169. // {
  10170. // "description": "Creates a logs-based metric.",
  10171. // "flatPath": "v2/projects/{projectsId}/metrics",
  10172. // "httpMethod": "POST",
  10173. // "id": "logging.projects.metrics.create",
  10174. // "parameterOrder": [
  10175. // "parent"
  10176. // ],
  10177. // "parameters": {
  10178. // "parent": {
  10179. // "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.",
  10180. // "location": "path",
  10181. // "pattern": "^projects/[^/]+$",
  10182. // "required": true,
  10183. // "type": "string"
  10184. // }
  10185. // },
  10186. // "path": "v2/{+parent}/metrics",
  10187. // "request": {
  10188. // "$ref": "LogMetric"
  10189. // },
  10190. // "response": {
  10191. // "$ref": "LogMetric"
  10192. // },
  10193. // "scopes": [
  10194. // "https://www.googleapis.com/auth/cloud-platform",
  10195. // "https://www.googleapis.com/auth/logging.admin",
  10196. // "https://www.googleapis.com/auth/logging.write"
  10197. // ]
  10198. // }
  10199. }
  10200. // method id "logging.projects.metrics.delete":
  10201. type ProjectsMetricsDeleteCall struct {
  10202. s *Service
  10203. metricName string
  10204. urlParams_ gensupport.URLParams
  10205. ctx_ context.Context
  10206. header_ http.Header
  10207. }
  10208. // Delete: Deletes a logs-based metric.
  10209. func (r *ProjectsMetricsService) Delete(metricName string) *ProjectsMetricsDeleteCall {
  10210. c := &ProjectsMetricsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10211. c.metricName = metricName
  10212. return c
  10213. }
  10214. // Fields allows partial responses to be retrieved. See
  10215. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10216. // for more information.
  10217. func (c *ProjectsMetricsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricsDeleteCall {
  10218. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10219. return c
  10220. }
  10221. // Context sets the context to be used in this call's Do method. Any
  10222. // pending HTTP request will be aborted if the provided context is
  10223. // canceled.
  10224. func (c *ProjectsMetricsDeleteCall) Context(ctx context.Context) *ProjectsMetricsDeleteCall {
  10225. c.ctx_ = ctx
  10226. return c
  10227. }
  10228. // Header returns an http.Header that can be modified by the caller to
  10229. // add HTTP headers to the request.
  10230. func (c *ProjectsMetricsDeleteCall) Header() http.Header {
  10231. if c.header_ == nil {
  10232. c.header_ = make(http.Header)
  10233. }
  10234. return c.header_
  10235. }
  10236. func (c *ProjectsMetricsDeleteCall) doRequest(alt string) (*http.Response, error) {
  10237. reqHeaders := make(http.Header)
  10238. for k, v := range c.header_ {
  10239. reqHeaders[k] = v
  10240. }
  10241. reqHeaders.Set("User-Agent", c.s.userAgent())
  10242. var body io.Reader = nil
  10243. c.urlParams_.Set("alt", alt)
  10244. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+metricName}")
  10245. urls += "?" + c.urlParams_.Encode()
  10246. req, _ := http.NewRequest("DELETE", urls, body)
  10247. req.Header = reqHeaders
  10248. googleapi.Expand(req.URL, map[string]string{
  10249. "metricName": c.metricName,
  10250. })
  10251. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10252. }
  10253. // Do executes the "logging.projects.metrics.delete" call.
  10254. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  10255. // code is an error. Response headers are in either
  10256. // *Empty.ServerResponse.Header or (if a response was returned at all)
  10257. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10258. // check whether the returned error was because http.StatusNotModified
  10259. // was returned.
  10260. func (c *ProjectsMetricsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  10261. gensupport.SetOptions(c.urlParams_, opts...)
  10262. res, err := c.doRequest("json")
  10263. if res != nil && res.StatusCode == http.StatusNotModified {
  10264. if res.Body != nil {
  10265. res.Body.Close()
  10266. }
  10267. return nil, &googleapi.Error{
  10268. Code: res.StatusCode,
  10269. Header: res.Header,
  10270. }
  10271. }
  10272. if err != nil {
  10273. return nil, err
  10274. }
  10275. defer googleapi.CloseBody(res)
  10276. if err := googleapi.CheckResponse(res); err != nil {
  10277. return nil, err
  10278. }
  10279. ret := &Empty{
  10280. ServerResponse: googleapi.ServerResponse{
  10281. Header: res.Header,
  10282. HTTPStatusCode: res.StatusCode,
  10283. },
  10284. }
  10285. target := &ret
  10286. if err := gensupport.DecodeResponse(target, res); err != nil {
  10287. return nil, err
  10288. }
  10289. return ret, nil
  10290. // {
  10291. // "description": "Deletes a logs-based metric.",
  10292. // "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
  10293. // "httpMethod": "DELETE",
  10294. // "id": "logging.projects.metrics.delete",
  10295. // "parameterOrder": [
  10296. // "metricName"
  10297. // ],
  10298. // "parameters": {
  10299. // "metricName": {
  10300. // "description": "The resource name of the metric to delete:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  10301. // "location": "path",
  10302. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  10303. // "required": true,
  10304. // "type": "string"
  10305. // }
  10306. // },
  10307. // "path": "v2/{+metricName}",
  10308. // "response": {
  10309. // "$ref": "Empty"
  10310. // },
  10311. // "scopes": [
  10312. // "https://www.googleapis.com/auth/cloud-platform",
  10313. // "https://www.googleapis.com/auth/logging.admin",
  10314. // "https://www.googleapis.com/auth/logging.write"
  10315. // ]
  10316. // }
  10317. }
  10318. // method id "logging.projects.metrics.get":
  10319. type ProjectsMetricsGetCall struct {
  10320. s *Service
  10321. metricName string
  10322. urlParams_ gensupport.URLParams
  10323. ifNoneMatch_ string
  10324. ctx_ context.Context
  10325. header_ http.Header
  10326. }
  10327. // Get: Gets a logs-based metric.
  10328. func (r *ProjectsMetricsService) Get(metricName string) *ProjectsMetricsGetCall {
  10329. c := &ProjectsMetricsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10330. c.metricName = metricName
  10331. return c
  10332. }
  10333. // Fields allows partial responses to be retrieved. See
  10334. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10335. // for more information.
  10336. func (c *ProjectsMetricsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricsGetCall {
  10337. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10338. return c
  10339. }
  10340. // IfNoneMatch sets the optional parameter which makes the operation
  10341. // fail if the object's ETag matches the given value. This is useful for
  10342. // getting updates only after the object has changed since the last
  10343. // request. Use googleapi.IsNotModified to check whether the response
  10344. // error from Do is the result of In-None-Match.
  10345. func (c *ProjectsMetricsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricsGetCall {
  10346. c.ifNoneMatch_ = entityTag
  10347. return c
  10348. }
  10349. // Context sets the context to be used in this call's Do method. Any
  10350. // pending HTTP request will be aborted if the provided context is
  10351. // canceled.
  10352. func (c *ProjectsMetricsGetCall) Context(ctx context.Context) *ProjectsMetricsGetCall {
  10353. c.ctx_ = ctx
  10354. return c
  10355. }
  10356. // Header returns an http.Header that can be modified by the caller to
  10357. // add HTTP headers to the request.
  10358. func (c *ProjectsMetricsGetCall) Header() http.Header {
  10359. if c.header_ == nil {
  10360. c.header_ = make(http.Header)
  10361. }
  10362. return c.header_
  10363. }
  10364. func (c *ProjectsMetricsGetCall) doRequest(alt string) (*http.Response, error) {
  10365. reqHeaders := make(http.Header)
  10366. for k, v := range c.header_ {
  10367. reqHeaders[k] = v
  10368. }
  10369. reqHeaders.Set("User-Agent", c.s.userAgent())
  10370. if c.ifNoneMatch_ != "" {
  10371. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10372. }
  10373. var body io.Reader = nil
  10374. c.urlParams_.Set("alt", alt)
  10375. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+metricName}")
  10376. urls += "?" + c.urlParams_.Encode()
  10377. req, _ := http.NewRequest("GET", urls, body)
  10378. req.Header = reqHeaders
  10379. googleapi.Expand(req.URL, map[string]string{
  10380. "metricName": c.metricName,
  10381. })
  10382. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10383. }
  10384. // Do executes the "logging.projects.metrics.get" call.
  10385. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  10386. // status code is an error. Response headers are in either
  10387. // *LogMetric.ServerResponse.Header or (if a response was returned at
  10388. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10389. // to check whether the returned error was because
  10390. // http.StatusNotModified was returned.
  10391. func (c *ProjectsMetricsGetCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  10392. gensupport.SetOptions(c.urlParams_, opts...)
  10393. res, err := c.doRequest("json")
  10394. if res != nil && res.StatusCode == http.StatusNotModified {
  10395. if res.Body != nil {
  10396. res.Body.Close()
  10397. }
  10398. return nil, &googleapi.Error{
  10399. Code: res.StatusCode,
  10400. Header: res.Header,
  10401. }
  10402. }
  10403. if err != nil {
  10404. return nil, err
  10405. }
  10406. defer googleapi.CloseBody(res)
  10407. if err := googleapi.CheckResponse(res); err != nil {
  10408. return nil, err
  10409. }
  10410. ret := &LogMetric{
  10411. ServerResponse: googleapi.ServerResponse{
  10412. Header: res.Header,
  10413. HTTPStatusCode: res.StatusCode,
  10414. },
  10415. }
  10416. target := &ret
  10417. if err := gensupport.DecodeResponse(target, res); err != nil {
  10418. return nil, err
  10419. }
  10420. return ret, nil
  10421. // {
  10422. // "description": "Gets a logs-based metric.",
  10423. // "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
  10424. // "httpMethod": "GET",
  10425. // "id": "logging.projects.metrics.get",
  10426. // "parameterOrder": [
  10427. // "metricName"
  10428. // ],
  10429. // "parameters": {
  10430. // "metricName": {
  10431. // "description": "The resource name of the desired metric:\n\"projects/[PROJECT_ID]/metrics/[METRIC_ID]\"\n",
  10432. // "location": "path",
  10433. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  10434. // "required": true,
  10435. // "type": "string"
  10436. // }
  10437. // },
  10438. // "path": "v2/{+metricName}",
  10439. // "response": {
  10440. // "$ref": "LogMetric"
  10441. // },
  10442. // "scopes": [
  10443. // "https://www.googleapis.com/auth/cloud-platform",
  10444. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10445. // "https://www.googleapis.com/auth/logging.admin",
  10446. // "https://www.googleapis.com/auth/logging.read"
  10447. // ]
  10448. // }
  10449. }
  10450. // method id "logging.projects.metrics.list":
  10451. type ProjectsMetricsListCall struct {
  10452. s *Service
  10453. parent string
  10454. urlParams_ gensupport.URLParams
  10455. ifNoneMatch_ string
  10456. ctx_ context.Context
  10457. header_ http.Header
  10458. }
  10459. // List: Lists logs-based metrics.
  10460. func (r *ProjectsMetricsService) List(parent string) *ProjectsMetricsListCall {
  10461. c := &ProjectsMetricsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10462. c.parent = parent
  10463. return c
  10464. }
  10465. // PageSize sets the optional parameter "pageSize": The maximum number
  10466. // of results to return from this request. Non-positive values are
  10467. // ignored. The presence of nextPageToken in the response indicates that
  10468. // more results might be available.
  10469. func (c *ProjectsMetricsListCall) PageSize(pageSize int64) *ProjectsMetricsListCall {
  10470. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  10471. return c
  10472. }
  10473. // PageToken sets the optional parameter "pageToken": If present, then
  10474. // retrieve the next batch of results from the preceding call to this
  10475. // method. pageToken must be the value of nextPageToken from the
  10476. // previous response. The values of other method parameters should be
  10477. // identical to those in the previous call.
  10478. func (c *ProjectsMetricsListCall) PageToken(pageToken string) *ProjectsMetricsListCall {
  10479. c.urlParams_.Set("pageToken", pageToken)
  10480. return c
  10481. }
  10482. // Fields allows partial responses to be retrieved. See
  10483. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10484. // for more information.
  10485. func (c *ProjectsMetricsListCall) Fields(s ...googleapi.Field) *ProjectsMetricsListCall {
  10486. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10487. return c
  10488. }
  10489. // IfNoneMatch sets the optional parameter which makes the operation
  10490. // fail if the object's ETag matches the given value. This is useful for
  10491. // getting updates only after the object has changed since the last
  10492. // request. Use googleapi.IsNotModified to check whether the response
  10493. // error from Do is the result of In-None-Match.
  10494. func (c *ProjectsMetricsListCall) IfNoneMatch(entityTag string) *ProjectsMetricsListCall {
  10495. c.ifNoneMatch_ = entityTag
  10496. return c
  10497. }
  10498. // Context sets the context to be used in this call's Do method. Any
  10499. // pending HTTP request will be aborted if the provided context is
  10500. // canceled.
  10501. func (c *ProjectsMetricsListCall) Context(ctx context.Context) *ProjectsMetricsListCall {
  10502. c.ctx_ = ctx
  10503. return c
  10504. }
  10505. // Header returns an http.Header that can be modified by the caller to
  10506. // add HTTP headers to the request.
  10507. func (c *ProjectsMetricsListCall) Header() http.Header {
  10508. if c.header_ == nil {
  10509. c.header_ = make(http.Header)
  10510. }
  10511. return c.header_
  10512. }
  10513. func (c *ProjectsMetricsListCall) doRequest(alt string) (*http.Response, error) {
  10514. reqHeaders := make(http.Header)
  10515. for k, v := range c.header_ {
  10516. reqHeaders[k] = v
  10517. }
  10518. reqHeaders.Set("User-Agent", c.s.userAgent())
  10519. if c.ifNoneMatch_ != "" {
  10520. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10521. }
  10522. var body io.Reader = nil
  10523. c.urlParams_.Set("alt", alt)
  10524. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/metrics")
  10525. urls += "?" + c.urlParams_.Encode()
  10526. req, _ := http.NewRequest("GET", urls, body)
  10527. req.Header = reqHeaders
  10528. googleapi.Expand(req.URL, map[string]string{
  10529. "parent": c.parent,
  10530. })
  10531. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10532. }
  10533. // Do executes the "logging.projects.metrics.list" call.
  10534. // Exactly one of *ListLogMetricsResponse or error will be non-nil. Any
  10535. // non-2xx status code is an error. Response headers are in either
  10536. // *ListLogMetricsResponse.ServerResponse.Header or (if a response was
  10537. // returned at all) in error.(*googleapi.Error).Header. Use
  10538. // googleapi.IsNotModified to check whether the returned error was
  10539. // because http.StatusNotModified was returned.
  10540. func (c *ProjectsMetricsListCall) Do(opts ...googleapi.CallOption) (*ListLogMetricsResponse, error) {
  10541. gensupport.SetOptions(c.urlParams_, opts...)
  10542. res, err := c.doRequest("json")
  10543. if res != nil && res.StatusCode == http.StatusNotModified {
  10544. if res.Body != nil {
  10545. res.Body.Close()
  10546. }
  10547. return nil, &googleapi.Error{
  10548. Code: res.StatusCode,
  10549. Header: res.Header,
  10550. }
  10551. }
  10552. if err != nil {
  10553. return nil, err
  10554. }
  10555. defer googleapi.CloseBody(res)
  10556. if err := googleapi.CheckResponse(res); err != nil {
  10557. return nil, err
  10558. }
  10559. ret := &ListLogMetricsResponse{
  10560. ServerResponse: googleapi.ServerResponse{
  10561. Header: res.Header,
  10562. HTTPStatusCode: res.StatusCode,
  10563. },
  10564. }
  10565. target := &ret
  10566. if err := gensupport.DecodeResponse(target, res); err != nil {
  10567. return nil, err
  10568. }
  10569. return ret, nil
  10570. // {
  10571. // "description": "Lists logs-based metrics.",
  10572. // "flatPath": "v2/projects/{projectsId}/metrics",
  10573. // "httpMethod": "GET",
  10574. // "id": "logging.projects.metrics.list",
  10575. // "parameterOrder": [
  10576. // "parent"
  10577. // ],
  10578. // "parameters": {
  10579. // "pageSize": {
  10580. // "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.",
  10581. // "format": "int32",
  10582. // "location": "query",
  10583. // "type": "integer"
  10584. // },
  10585. // "pageToken": {
  10586. // "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.",
  10587. // "location": "query",
  10588. // "type": "string"
  10589. // },
  10590. // "parent": {
  10591. // "description": "Required. The name of the project containing the metrics:\n\"projects/[PROJECT_ID]\"\n",
  10592. // "location": "path",
  10593. // "pattern": "^projects/[^/]+$",
  10594. // "required": true,
  10595. // "type": "string"
  10596. // }
  10597. // },
  10598. // "path": "v2/{+parent}/metrics",
  10599. // "response": {
  10600. // "$ref": "ListLogMetricsResponse"
  10601. // },
  10602. // "scopes": [
  10603. // "https://www.googleapis.com/auth/cloud-platform",
  10604. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  10605. // "https://www.googleapis.com/auth/logging.admin",
  10606. // "https://www.googleapis.com/auth/logging.read"
  10607. // ]
  10608. // }
  10609. }
  10610. // Pages invokes f for each page of results.
  10611. // A non-nil error returned from f will halt the iteration.
  10612. // The provided context supersedes any context provided to the Context method.
  10613. func (c *ProjectsMetricsListCall) Pages(ctx context.Context, f func(*ListLogMetricsResponse) error) error {
  10614. c.ctx_ = ctx
  10615. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  10616. for {
  10617. x, err := c.Do()
  10618. if err != nil {
  10619. return err
  10620. }
  10621. if err := f(x); err != nil {
  10622. return err
  10623. }
  10624. if x.NextPageToken == "" {
  10625. return nil
  10626. }
  10627. c.PageToken(x.NextPageToken)
  10628. }
  10629. }
  10630. // method id "logging.projects.metrics.update":
  10631. type ProjectsMetricsUpdateCall struct {
  10632. s *Service
  10633. metricName string
  10634. logmetric *LogMetric
  10635. urlParams_ gensupport.URLParams
  10636. ctx_ context.Context
  10637. header_ http.Header
  10638. }
  10639. // Update: Creates or updates a logs-based metric.
  10640. func (r *ProjectsMetricsService) Update(metricName string, logmetric *LogMetric) *ProjectsMetricsUpdateCall {
  10641. c := &ProjectsMetricsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10642. c.metricName = metricName
  10643. c.logmetric = logmetric
  10644. return c
  10645. }
  10646. // Fields allows partial responses to be retrieved. See
  10647. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10648. // for more information.
  10649. func (c *ProjectsMetricsUpdateCall) Fields(s ...googleapi.Field) *ProjectsMetricsUpdateCall {
  10650. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10651. return c
  10652. }
  10653. // Context sets the context to be used in this call's Do method. Any
  10654. // pending HTTP request will be aborted if the provided context is
  10655. // canceled.
  10656. func (c *ProjectsMetricsUpdateCall) Context(ctx context.Context) *ProjectsMetricsUpdateCall {
  10657. c.ctx_ = ctx
  10658. return c
  10659. }
  10660. // Header returns an http.Header that can be modified by the caller to
  10661. // add HTTP headers to the request.
  10662. func (c *ProjectsMetricsUpdateCall) Header() http.Header {
  10663. if c.header_ == nil {
  10664. c.header_ = make(http.Header)
  10665. }
  10666. return c.header_
  10667. }
  10668. func (c *ProjectsMetricsUpdateCall) doRequest(alt string) (*http.Response, error) {
  10669. reqHeaders := make(http.Header)
  10670. for k, v := range c.header_ {
  10671. reqHeaders[k] = v
  10672. }
  10673. reqHeaders.Set("User-Agent", c.s.userAgent())
  10674. var body io.Reader = nil
  10675. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logmetric)
  10676. if err != nil {
  10677. return nil, err
  10678. }
  10679. reqHeaders.Set("Content-Type", "application/json")
  10680. c.urlParams_.Set("alt", alt)
  10681. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+metricName}")
  10682. urls += "?" + c.urlParams_.Encode()
  10683. req, _ := http.NewRequest("PUT", urls, body)
  10684. req.Header = reqHeaders
  10685. googleapi.Expand(req.URL, map[string]string{
  10686. "metricName": c.metricName,
  10687. })
  10688. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10689. }
  10690. // Do executes the "logging.projects.metrics.update" call.
  10691. // Exactly one of *LogMetric or error will be non-nil. Any non-2xx
  10692. // status code is an error. Response headers are in either
  10693. // *LogMetric.ServerResponse.Header or (if a response was returned at
  10694. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10695. // to check whether the returned error was because
  10696. // http.StatusNotModified was returned.
  10697. func (c *ProjectsMetricsUpdateCall) Do(opts ...googleapi.CallOption) (*LogMetric, error) {
  10698. gensupport.SetOptions(c.urlParams_, opts...)
  10699. res, err := c.doRequest("json")
  10700. if res != nil && res.StatusCode == http.StatusNotModified {
  10701. if res.Body != nil {
  10702. res.Body.Close()
  10703. }
  10704. return nil, &googleapi.Error{
  10705. Code: res.StatusCode,
  10706. Header: res.Header,
  10707. }
  10708. }
  10709. if err != nil {
  10710. return nil, err
  10711. }
  10712. defer googleapi.CloseBody(res)
  10713. if err := googleapi.CheckResponse(res); err != nil {
  10714. return nil, err
  10715. }
  10716. ret := &LogMetric{
  10717. ServerResponse: googleapi.ServerResponse{
  10718. Header: res.Header,
  10719. HTTPStatusCode: res.StatusCode,
  10720. },
  10721. }
  10722. target := &ret
  10723. if err := gensupport.DecodeResponse(target, res); err != nil {
  10724. return nil, err
  10725. }
  10726. return ret, nil
  10727. // {
  10728. // "description": "Creates or updates a logs-based metric.",
  10729. // "flatPath": "v2/projects/{projectsId}/metrics/{metricsId}",
  10730. // "httpMethod": "PUT",
  10731. // "id": "logging.projects.metrics.update",
  10732. // "parameterOrder": [
  10733. // "metricName"
  10734. // ],
  10735. // "parameters": {
  10736. // "metricName": {
  10737. // "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.",
  10738. // "location": "path",
  10739. // "pattern": "^projects/[^/]+/metrics/[^/]+$",
  10740. // "required": true,
  10741. // "type": "string"
  10742. // }
  10743. // },
  10744. // "path": "v2/{+metricName}",
  10745. // "request": {
  10746. // "$ref": "LogMetric"
  10747. // },
  10748. // "response": {
  10749. // "$ref": "LogMetric"
  10750. // },
  10751. // "scopes": [
  10752. // "https://www.googleapis.com/auth/cloud-platform",
  10753. // "https://www.googleapis.com/auth/logging.admin",
  10754. // "https://www.googleapis.com/auth/logging.write"
  10755. // ]
  10756. // }
  10757. }
  10758. // method id "logging.projects.sinks.create":
  10759. type ProjectsSinksCreateCall struct {
  10760. s *Service
  10761. parent string
  10762. logsink *LogSink
  10763. urlParams_ gensupport.URLParams
  10764. ctx_ context.Context
  10765. header_ http.Header
  10766. }
  10767. // Create: Creates a sink that exports specified log entries to a
  10768. // destination. The export of newly-ingested log entries begins
  10769. // immediately, unless the sink's writer_identity is not permitted to
  10770. // write to the destination. A sink can export log entries only from the
  10771. // resource owning the sink.
  10772. func (r *ProjectsSinksService) Create(parent string, logsink *LogSink) *ProjectsSinksCreateCall {
  10773. c := &ProjectsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10774. c.parent = parent
  10775. c.logsink = logsink
  10776. return c
  10777. }
  10778. // UniqueWriterIdentity sets the optional parameter
  10779. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  10780. // as writer_identity in the new sink. If this value is omitted or set
  10781. // to false, and if the sink's parent is a project, then the value
  10782. // returned as writer_identity is the same group or service account used
  10783. // by Stackdriver Logging before the addition of writer identities to
  10784. // this API. The sink's destination must be in the same project as the
  10785. // sink itself.If this field is set to true, or if the sink is owned by
  10786. // a non-project resource such as an organization, then the value of
  10787. // writer_identity will be a unique service account used only for
  10788. // exports from the new sink. For more information, see writer_identity
  10789. // in LogSink.
  10790. func (c *ProjectsSinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksCreateCall {
  10791. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  10792. return c
  10793. }
  10794. // Fields allows partial responses to be retrieved. See
  10795. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10796. // for more information.
  10797. func (c *ProjectsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsSinksCreateCall {
  10798. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10799. return c
  10800. }
  10801. // Context sets the context to be used in this call's Do method. Any
  10802. // pending HTTP request will be aborted if the provided context is
  10803. // canceled.
  10804. func (c *ProjectsSinksCreateCall) Context(ctx context.Context) *ProjectsSinksCreateCall {
  10805. c.ctx_ = ctx
  10806. return c
  10807. }
  10808. // Header returns an http.Header that can be modified by the caller to
  10809. // add HTTP headers to the request.
  10810. func (c *ProjectsSinksCreateCall) Header() http.Header {
  10811. if c.header_ == nil {
  10812. c.header_ = make(http.Header)
  10813. }
  10814. return c.header_
  10815. }
  10816. func (c *ProjectsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  10817. reqHeaders := make(http.Header)
  10818. for k, v := range c.header_ {
  10819. reqHeaders[k] = v
  10820. }
  10821. reqHeaders.Set("User-Agent", c.s.userAgent())
  10822. var body io.Reader = nil
  10823. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  10824. if err != nil {
  10825. return nil, err
  10826. }
  10827. reqHeaders.Set("Content-Type", "application/json")
  10828. c.urlParams_.Set("alt", alt)
  10829. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  10830. urls += "?" + c.urlParams_.Encode()
  10831. req, _ := http.NewRequest("POST", urls, body)
  10832. req.Header = reqHeaders
  10833. googleapi.Expand(req.URL, map[string]string{
  10834. "parent": c.parent,
  10835. })
  10836. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10837. }
  10838. // Do executes the "logging.projects.sinks.create" call.
  10839. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  10840. // code is an error. Response headers are in either
  10841. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  10842. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10843. // check whether the returned error was because http.StatusNotModified
  10844. // was returned.
  10845. func (c *ProjectsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  10846. gensupport.SetOptions(c.urlParams_, opts...)
  10847. res, err := c.doRequest("json")
  10848. if res != nil && res.StatusCode == http.StatusNotModified {
  10849. if res.Body != nil {
  10850. res.Body.Close()
  10851. }
  10852. return nil, &googleapi.Error{
  10853. Code: res.StatusCode,
  10854. Header: res.Header,
  10855. }
  10856. }
  10857. if err != nil {
  10858. return nil, err
  10859. }
  10860. defer googleapi.CloseBody(res)
  10861. if err := googleapi.CheckResponse(res); err != nil {
  10862. return nil, err
  10863. }
  10864. ret := &LogSink{
  10865. ServerResponse: googleapi.ServerResponse{
  10866. Header: res.Header,
  10867. HTTPStatusCode: res.StatusCode,
  10868. },
  10869. }
  10870. target := &ret
  10871. if err := gensupport.DecodeResponse(target, res); err != nil {
  10872. return nil, err
  10873. }
  10874. return ret, nil
  10875. // {
  10876. // "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.",
  10877. // "flatPath": "v2/projects/{projectsId}/sinks",
  10878. // "httpMethod": "POST",
  10879. // "id": "logging.projects.sinks.create",
  10880. // "parameterOrder": [
  10881. // "parent"
  10882. // ],
  10883. // "parameters": {
  10884. // "parent": {
  10885. // "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\".",
  10886. // "location": "path",
  10887. // "pattern": "^projects/[^/]+$",
  10888. // "required": true,
  10889. // "type": "string"
  10890. // },
  10891. // "uniqueWriterIdentity": {
  10892. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Stackdriver Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  10893. // "location": "query",
  10894. // "type": "boolean"
  10895. // }
  10896. // },
  10897. // "path": "v2/{+parent}/sinks",
  10898. // "request": {
  10899. // "$ref": "LogSink"
  10900. // },
  10901. // "response": {
  10902. // "$ref": "LogSink"
  10903. // },
  10904. // "scopes": [
  10905. // "https://www.googleapis.com/auth/cloud-platform",
  10906. // "https://www.googleapis.com/auth/logging.admin"
  10907. // ]
  10908. // }
  10909. }
  10910. // method id "logging.projects.sinks.delete":
  10911. type ProjectsSinksDeleteCall struct {
  10912. s *Service
  10913. sinkNameid string
  10914. urlParams_ gensupport.URLParams
  10915. ctx_ context.Context
  10916. header_ http.Header
  10917. }
  10918. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  10919. // then that service account is also deleted.
  10920. func (r *ProjectsSinksService) Delete(sinkNameid string) *ProjectsSinksDeleteCall {
  10921. c := &ProjectsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10922. c.sinkNameid = sinkNameid
  10923. return c
  10924. }
  10925. // Fields allows partial responses to be retrieved. See
  10926. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10927. // for more information.
  10928. func (c *ProjectsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsSinksDeleteCall {
  10929. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10930. return c
  10931. }
  10932. // Context sets the context to be used in this call's Do method. Any
  10933. // pending HTTP request will be aborted if the provided context is
  10934. // canceled.
  10935. func (c *ProjectsSinksDeleteCall) Context(ctx context.Context) *ProjectsSinksDeleteCall {
  10936. c.ctx_ = ctx
  10937. return c
  10938. }
  10939. // Header returns an http.Header that can be modified by the caller to
  10940. // add HTTP headers to the request.
  10941. func (c *ProjectsSinksDeleteCall) Header() http.Header {
  10942. if c.header_ == nil {
  10943. c.header_ = make(http.Header)
  10944. }
  10945. return c.header_
  10946. }
  10947. func (c *ProjectsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  10948. reqHeaders := make(http.Header)
  10949. for k, v := range c.header_ {
  10950. reqHeaders[k] = v
  10951. }
  10952. reqHeaders.Set("User-Agent", c.s.userAgent())
  10953. var body io.Reader = nil
  10954. c.urlParams_.Set("alt", alt)
  10955. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  10956. urls += "?" + c.urlParams_.Encode()
  10957. req, _ := http.NewRequest("DELETE", urls, body)
  10958. req.Header = reqHeaders
  10959. googleapi.Expand(req.URL, map[string]string{
  10960. "sinkName": c.sinkNameid,
  10961. })
  10962. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10963. }
  10964. // Do executes the "logging.projects.sinks.delete" call.
  10965. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  10966. // code is an error. Response headers are in either
  10967. // *Empty.ServerResponse.Header or (if a response was returned at all)
  10968. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  10969. // check whether the returned error was because http.StatusNotModified
  10970. // was returned.
  10971. func (c *ProjectsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  10972. gensupport.SetOptions(c.urlParams_, opts...)
  10973. res, err := c.doRequest("json")
  10974. if res != nil && res.StatusCode == http.StatusNotModified {
  10975. if res.Body != nil {
  10976. res.Body.Close()
  10977. }
  10978. return nil, &googleapi.Error{
  10979. Code: res.StatusCode,
  10980. Header: res.Header,
  10981. }
  10982. }
  10983. if err != nil {
  10984. return nil, err
  10985. }
  10986. defer googleapi.CloseBody(res)
  10987. if err := googleapi.CheckResponse(res); err != nil {
  10988. return nil, err
  10989. }
  10990. ret := &Empty{
  10991. ServerResponse: googleapi.ServerResponse{
  10992. Header: res.Header,
  10993. HTTPStatusCode: res.StatusCode,
  10994. },
  10995. }
  10996. target := &ret
  10997. if err := gensupport.DecodeResponse(target, res); err != nil {
  10998. return nil, err
  10999. }
  11000. return ret, nil
  11001. // {
  11002. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  11003. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  11004. // "httpMethod": "DELETE",
  11005. // "id": "logging.projects.sinks.delete",
  11006. // "parameterOrder": [
  11007. // "sinkName"
  11008. // ],
  11009. // "parameters": {
  11010. // "sinkName": {
  11011. // "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\".",
  11012. // "location": "path",
  11013. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  11014. // "required": true,
  11015. // "type": "string"
  11016. // }
  11017. // },
  11018. // "path": "v2/{+sinkName}",
  11019. // "response": {
  11020. // "$ref": "Empty"
  11021. // },
  11022. // "scopes": [
  11023. // "https://www.googleapis.com/auth/cloud-platform",
  11024. // "https://www.googleapis.com/auth/logging.admin"
  11025. // ]
  11026. // }
  11027. }
  11028. // method id "logging.projects.sinks.get":
  11029. type ProjectsSinksGetCall struct {
  11030. s *Service
  11031. sinkName string
  11032. urlParams_ gensupport.URLParams
  11033. ifNoneMatch_ string
  11034. ctx_ context.Context
  11035. header_ http.Header
  11036. }
  11037. // Get: Gets a sink.
  11038. func (r *ProjectsSinksService) Get(sinkName string) *ProjectsSinksGetCall {
  11039. c := &ProjectsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11040. c.sinkName = sinkName
  11041. return c
  11042. }
  11043. // Fields allows partial responses to be retrieved. See
  11044. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11045. // for more information.
  11046. func (c *ProjectsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsSinksGetCall {
  11047. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11048. return c
  11049. }
  11050. // IfNoneMatch sets the optional parameter which makes the operation
  11051. // fail if the object's ETag matches the given value. This is useful for
  11052. // getting updates only after the object has changed since the last
  11053. // request. Use googleapi.IsNotModified to check whether the response
  11054. // error from Do is the result of In-None-Match.
  11055. func (c *ProjectsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsSinksGetCall {
  11056. c.ifNoneMatch_ = entityTag
  11057. return c
  11058. }
  11059. // Context sets the context to be used in this call's Do method. Any
  11060. // pending HTTP request will be aborted if the provided context is
  11061. // canceled.
  11062. func (c *ProjectsSinksGetCall) Context(ctx context.Context) *ProjectsSinksGetCall {
  11063. c.ctx_ = ctx
  11064. return c
  11065. }
  11066. // Header returns an http.Header that can be modified by the caller to
  11067. // add HTTP headers to the request.
  11068. func (c *ProjectsSinksGetCall) Header() http.Header {
  11069. if c.header_ == nil {
  11070. c.header_ = make(http.Header)
  11071. }
  11072. return c.header_
  11073. }
  11074. func (c *ProjectsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  11075. reqHeaders := make(http.Header)
  11076. for k, v := range c.header_ {
  11077. reqHeaders[k] = v
  11078. }
  11079. reqHeaders.Set("User-Agent", c.s.userAgent())
  11080. if c.ifNoneMatch_ != "" {
  11081. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11082. }
  11083. var body io.Reader = nil
  11084. c.urlParams_.Set("alt", alt)
  11085. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  11086. urls += "?" + c.urlParams_.Encode()
  11087. req, _ := http.NewRequest("GET", urls, body)
  11088. req.Header = reqHeaders
  11089. googleapi.Expand(req.URL, map[string]string{
  11090. "sinkName": c.sinkName,
  11091. })
  11092. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11093. }
  11094. // Do executes the "logging.projects.sinks.get" call.
  11095. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  11096. // code is an error. Response headers are in either
  11097. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  11098. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11099. // check whether the returned error was because http.StatusNotModified
  11100. // was returned.
  11101. func (c *ProjectsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  11102. gensupport.SetOptions(c.urlParams_, opts...)
  11103. res, err := c.doRequest("json")
  11104. if res != nil && res.StatusCode == http.StatusNotModified {
  11105. if res.Body != nil {
  11106. res.Body.Close()
  11107. }
  11108. return nil, &googleapi.Error{
  11109. Code: res.StatusCode,
  11110. Header: res.Header,
  11111. }
  11112. }
  11113. if err != nil {
  11114. return nil, err
  11115. }
  11116. defer googleapi.CloseBody(res)
  11117. if err := googleapi.CheckResponse(res); err != nil {
  11118. return nil, err
  11119. }
  11120. ret := &LogSink{
  11121. ServerResponse: googleapi.ServerResponse{
  11122. Header: res.Header,
  11123. HTTPStatusCode: res.StatusCode,
  11124. },
  11125. }
  11126. target := &ret
  11127. if err := gensupport.DecodeResponse(target, res); err != nil {
  11128. return nil, err
  11129. }
  11130. return ret, nil
  11131. // {
  11132. // "description": "Gets a sink.",
  11133. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  11134. // "httpMethod": "GET",
  11135. // "id": "logging.projects.sinks.get",
  11136. // "parameterOrder": [
  11137. // "sinkName"
  11138. // ],
  11139. // "parameters": {
  11140. // "sinkName": {
  11141. // "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\".",
  11142. // "location": "path",
  11143. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  11144. // "required": true,
  11145. // "type": "string"
  11146. // }
  11147. // },
  11148. // "path": "v2/{+sinkName}",
  11149. // "response": {
  11150. // "$ref": "LogSink"
  11151. // },
  11152. // "scopes": [
  11153. // "https://www.googleapis.com/auth/cloud-platform",
  11154. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  11155. // "https://www.googleapis.com/auth/logging.admin",
  11156. // "https://www.googleapis.com/auth/logging.read"
  11157. // ]
  11158. // }
  11159. }
  11160. // method id "logging.projects.sinks.list":
  11161. type ProjectsSinksListCall struct {
  11162. s *Service
  11163. parent string
  11164. urlParams_ gensupport.URLParams
  11165. ifNoneMatch_ string
  11166. ctx_ context.Context
  11167. header_ http.Header
  11168. }
  11169. // List: Lists sinks.
  11170. func (r *ProjectsSinksService) List(parent string) *ProjectsSinksListCall {
  11171. c := &ProjectsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11172. c.parent = parent
  11173. return c
  11174. }
  11175. // PageSize sets the optional parameter "pageSize": The maximum number
  11176. // of results to return from this request. Non-positive values are
  11177. // ignored. The presence of nextPageToken in the response indicates that
  11178. // more results might be available.
  11179. func (c *ProjectsSinksListCall) PageSize(pageSize int64) *ProjectsSinksListCall {
  11180. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  11181. return c
  11182. }
  11183. // PageToken sets the optional parameter "pageToken": If present, then
  11184. // retrieve the next batch of results from the preceding call to this
  11185. // method. pageToken must be the value of nextPageToken from the
  11186. // previous response. The values of other method parameters should be
  11187. // identical to those in the previous call.
  11188. func (c *ProjectsSinksListCall) PageToken(pageToken string) *ProjectsSinksListCall {
  11189. c.urlParams_.Set("pageToken", pageToken)
  11190. return c
  11191. }
  11192. // Fields allows partial responses to be retrieved. See
  11193. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11194. // for more information.
  11195. func (c *ProjectsSinksListCall) Fields(s ...googleapi.Field) *ProjectsSinksListCall {
  11196. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11197. return c
  11198. }
  11199. // IfNoneMatch sets the optional parameter which makes the operation
  11200. // fail if the object's ETag matches the given value. This is useful for
  11201. // getting updates only after the object has changed since the last
  11202. // request. Use googleapi.IsNotModified to check whether the response
  11203. // error from Do is the result of In-None-Match.
  11204. func (c *ProjectsSinksListCall) IfNoneMatch(entityTag string) *ProjectsSinksListCall {
  11205. c.ifNoneMatch_ = entityTag
  11206. return c
  11207. }
  11208. // Context sets the context to be used in this call's Do method. Any
  11209. // pending HTTP request will be aborted if the provided context is
  11210. // canceled.
  11211. func (c *ProjectsSinksListCall) Context(ctx context.Context) *ProjectsSinksListCall {
  11212. c.ctx_ = ctx
  11213. return c
  11214. }
  11215. // Header returns an http.Header that can be modified by the caller to
  11216. // add HTTP headers to the request.
  11217. func (c *ProjectsSinksListCall) Header() http.Header {
  11218. if c.header_ == nil {
  11219. c.header_ = make(http.Header)
  11220. }
  11221. return c.header_
  11222. }
  11223. func (c *ProjectsSinksListCall) doRequest(alt string) (*http.Response, error) {
  11224. reqHeaders := make(http.Header)
  11225. for k, v := range c.header_ {
  11226. reqHeaders[k] = v
  11227. }
  11228. reqHeaders.Set("User-Agent", c.s.userAgent())
  11229. if c.ifNoneMatch_ != "" {
  11230. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11231. }
  11232. var body io.Reader = nil
  11233. c.urlParams_.Set("alt", alt)
  11234. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  11235. urls += "?" + c.urlParams_.Encode()
  11236. req, _ := http.NewRequest("GET", urls, body)
  11237. req.Header = reqHeaders
  11238. googleapi.Expand(req.URL, map[string]string{
  11239. "parent": c.parent,
  11240. })
  11241. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11242. }
  11243. // Do executes the "logging.projects.sinks.list" call.
  11244. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  11245. // non-2xx status code is an error. Response headers are in either
  11246. // *ListSinksResponse.ServerResponse.Header or (if a response was
  11247. // returned at all) in error.(*googleapi.Error).Header. Use
  11248. // googleapi.IsNotModified to check whether the returned error was
  11249. // because http.StatusNotModified was returned.
  11250. func (c *ProjectsSinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  11251. gensupport.SetOptions(c.urlParams_, opts...)
  11252. res, err := c.doRequest("json")
  11253. if res != nil && res.StatusCode == http.StatusNotModified {
  11254. if res.Body != nil {
  11255. res.Body.Close()
  11256. }
  11257. return nil, &googleapi.Error{
  11258. Code: res.StatusCode,
  11259. Header: res.Header,
  11260. }
  11261. }
  11262. if err != nil {
  11263. return nil, err
  11264. }
  11265. defer googleapi.CloseBody(res)
  11266. if err := googleapi.CheckResponse(res); err != nil {
  11267. return nil, err
  11268. }
  11269. ret := &ListSinksResponse{
  11270. ServerResponse: googleapi.ServerResponse{
  11271. Header: res.Header,
  11272. HTTPStatusCode: res.StatusCode,
  11273. },
  11274. }
  11275. target := &ret
  11276. if err := gensupport.DecodeResponse(target, res); err != nil {
  11277. return nil, err
  11278. }
  11279. return ret, nil
  11280. // {
  11281. // "description": "Lists sinks.",
  11282. // "flatPath": "v2/projects/{projectsId}/sinks",
  11283. // "httpMethod": "GET",
  11284. // "id": "logging.projects.sinks.list",
  11285. // "parameterOrder": [
  11286. // "parent"
  11287. // ],
  11288. // "parameters": {
  11289. // "pageSize": {
  11290. // "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.",
  11291. // "format": "int32",
  11292. // "location": "query",
  11293. // "type": "integer"
  11294. // },
  11295. // "pageToken": {
  11296. // "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.",
  11297. // "location": "query",
  11298. // "type": "string"
  11299. // },
  11300. // "parent": {
  11301. // "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",
  11302. // "location": "path",
  11303. // "pattern": "^projects/[^/]+$",
  11304. // "required": true,
  11305. // "type": "string"
  11306. // }
  11307. // },
  11308. // "path": "v2/{+parent}/sinks",
  11309. // "response": {
  11310. // "$ref": "ListSinksResponse"
  11311. // },
  11312. // "scopes": [
  11313. // "https://www.googleapis.com/auth/cloud-platform",
  11314. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  11315. // "https://www.googleapis.com/auth/logging.admin",
  11316. // "https://www.googleapis.com/auth/logging.read"
  11317. // ]
  11318. // }
  11319. }
  11320. // Pages invokes f for each page of results.
  11321. // A non-nil error returned from f will halt the iteration.
  11322. // The provided context supersedes any context provided to the Context method.
  11323. func (c *ProjectsSinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  11324. c.ctx_ = ctx
  11325. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11326. for {
  11327. x, err := c.Do()
  11328. if err != nil {
  11329. return err
  11330. }
  11331. if err := f(x); err != nil {
  11332. return err
  11333. }
  11334. if x.NextPageToken == "" {
  11335. return nil
  11336. }
  11337. c.PageToken(x.NextPageToken)
  11338. }
  11339. }
  11340. // method id "logging.projects.sinks.patch":
  11341. type ProjectsSinksPatchCall struct {
  11342. s *Service
  11343. sinkNameid string
  11344. logsink *LogSink
  11345. urlParams_ gensupport.URLParams
  11346. ctx_ context.Context
  11347. header_ http.Header
  11348. }
  11349. // Patch: Updates a sink. This method replaces the following fields in
  11350. // the existing sink with values from the new sink: destination, and
  11351. // filter. The updated sink might also have a new writer_identity; see
  11352. // the unique_writer_identity field.
  11353. func (r *ProjectsSinksService) Patch(sinkNameid string, logsink *LogSink) *ProjectsSinksPatchCall {
  11354. c := &ProjectsSinksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11355. c.sinkNameid = sinkNameid
  11356. c.logsink = logsink
  11357. return c
  11358. }
  11359. // UniqueWriterIdentity sets the optional parameter
  11360. // "uniqueWriterIdentity": See sinks.create for a description of this
  11361. // field. When updating a sink, the effect of this field on the value of
  11362. // writer_identity in the updated sink depends on both the old and new
  11363. // values of this field:
  11364. // If the old and new values of this field are both false or both true,
  11365. // then there is no change to the sink's writer_identity.
  11366. // If the old value is false and the new value is true, then
  11367. // writer_identity is changed to a unique service account.
  11368. // It is an error if the old value is true and the new value is set to
  11369. // false or defaulted to false.
  11370. func (c *ProjectsSinksPatchCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksPatchCall {
  11371. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  11372. return c
  11373. }
  11374. // UpdateMask sets the optional parameter "updateMask": Field mask that
  11375. // specifies the fields in sink that need an update. A sink field will
  11376. // be overwritten if, and only if, it is in the update mask. name and
  11377. // output only fields cannot be updated.An empty updateMask is
  11378. // temporarily treated as using the following mask for backwards
  11379. // compatibility purposes: destination,filter,includeChildren At some
  11380. // point in the future, behavior will be removed and specifying an empty
  11381. // updateMask will be an error.For a detailed FieldMask definition, see
  11382. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  11383. // updateMask=filter.
  11384. func (c *ProjectsSinksPatchCall) UpdateMask(updateMask string) *ProjectsSinksPatchCall {
  11385. c.urlParams_.Set("updateMask", updateMask)
  11386. return c
  11387. }
  11388. // Fields allows partial responses to be retrieved. See
  11389. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11390. // for more information.
  11391. func (c *ProjectsSinksPatchCall) Fields(s ...googleapi.Field) *ProjectsSinksPatchCall {
  11392. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11393. return c
  11394. }
  11395. // Context sets the context to be used in this call's Do method. Any
  11396. // pending HTTP request will be aborted if the provided context is
  11397. // canceled.
  11398. func (c *ProjectsSinksPatchCall) Context(ctx context.Context) *ProjectsSinksPatchCall {
  11399. c.ctx_ = ctx
  11400. return c
  11401. }
  11402. // Header returns an http.Header that can be modified by the caller to
  11403. // add HTTP headers to the request.
  11404. func (c *ProjectsSinksPatchCall) Header() http.Header {
  11405. if c.header_ == nil {
  11406. c.header_ = make(http.Header)
  11407. }
  11408. return c.header_
  11409. }
  11410. func (c *ProjectsSinksPatchCall) doRequest(alt string) (*http.Response, error) {
  11411. reqHeaders := make(http.Header)
  11412. for k, v := range c.header_ {
  11413. reqHeaders[k] = v
  11414. }
  11415. reqHeaders.Set("User-Agent", c.s.userAgent())
  11416. var body io.Reader = nil
  11417. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  11418. if err != nil {
  11419. return nil, err
  11420. }
  11421. reqHeaders.Set("Content-Type", "application/json")
  11422. c.urlParams_.Set("alt", alt)
  11423. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  11424. urls += "?" + c.urlParams_.Encode()
  11425. req, _ := http.NewRequest("PATCH", urls, body)
  11426. req.Header = reqHeaders
  11427. googleapi.Expand(req.URL, map[string]string{
  11428. "sinkName": c.sinkNameid,
  11429. })
  11430. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11431. }
  11432. // Do executes the "logging.projects.sinks.patch" call.
  11433. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  11434. // code is an error. Response headers are in either
  11435. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  11436. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11437. // check whether the returned error was because http.StatusNotModified
  11438. // was returned.
  11439. func (c *ProjectsSinksPatchCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  11440. gensupport.SetOptions(c.urlParams_, opts...)
  11441. res, err := c.doRequest("json")
  11442. if res != nil && res.StatusCode == http.StatusNotModified {
  11443. if res.Body != nil {
  11444. res.Body.Close()
  11445. }
  11446. return nil, &googleapi.Error{
  11447. Code: res.StatusCode,
  11448. Header: res.Header,
  11449. }
  11450. }
  11451. if err != nil {
  11452. return nil, err
  11453. }
  11454. defer googleapi.CloseBody(res)
  11455. if err := googleapi.CheckResponse(res); err != nil {
  11456. return nil, err
  11457. }
  11458. ret := &LogSink{
  11459. ServerResponse: googleapi.ServerResponse{
  11460. Header: res.Header,
  11461. HTTPStatusCode: res.StatusCode,
  11462. },
  11463. }
  11464. target := &ret
  11465. if err := gensupport.DecodeResponse(target, res); err != nil {
  11466. return nil, err
  11467. }
  11468. return ret, nil
  11469. // {
  11470. // "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.",
  11471. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  11472. // "httpMethod": "PATCH",
  11473. // "id": "logging.projects.sinks.patch",
  11474. // "parameterOrder": [
  11475. // "sinkName"
  11476. // ],
  11477. // "parameters": {
  11478. // "sinkName": {
  11479. // "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\".",
  11480. // "location": "path",
  11481. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  11482. // "required": true,
  11483. // "type": "string"
  11484. // },
  11485. // "uniqueWriterIdentity": {
  11486. // "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.",
  11487. // "location": "query",
  11488. // "type": "boolean"
  11489. // },
  11490. // "updateMask": {
  11491. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  11492. // "format": "google-fieldmask",
  11493. // "location": "query",
  11494. // "type": "string"
  11495. // }
  11496. // },
  11497. // "path": "v2/{+sinkName}",
  11498. // "request": {
  11499. // "$ref": "LogSink"
  11500. // },
  11501. // "response": {
  11502. // "$ref": "LogSink"
  11503. // },
  11504. // "scopes": [
  11505. // "https://www.googleapis.com/auth/cloud-platform",
  11506. // "https://www.googleapis.com/auth/logging.admin"
  11507. // ]
  11508. // }
  11509. }
  11510. // method id "logging.projects.sinks.update":
  11511. type ProjectsSinksUpdateCall struct {
  11512. s *Service
  11513. sinkNameid string
  11514. logsink *LogSink
  11515. urlParams_ gensupport.URLParams
  11516. ctx_ context.Context
  11517. header_ http.Header
  11518. }
  11519. // Update: Updates a sink. This method replaces the following fields in
  11520. // the existing sink with values from the new sink: destination, and
  11521. // filter. The updated sink might also have a new writer_identity; see
  11522. // the unique_writer_identity field.
  11523. func (r *ProjectsSinksService) Update(sinkNameid string, logsink *LogSink) *ProjectsSinksUpdateCall {
  11524. c := &ProjectsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11525. c.sinkNameid = sinkNameid
  11526. c.logsink = logsink
  11527. return c
  11528. }
  11529. // UniqueWriterIdentity sets the optional parameter
  11530. // "uniqueWriterIdentity": See sinks.create for a description of this
  11531. // field. When updating a sink, the effect of this field on the value of
  11532. // writer_identity in the updated sink depends on both the old and new
  11533. // values of this field:
  11534. // If the old and new values of this field are both false or both true,
  11535. // then there is no change to the sink's writer_identity.
  11536. // If the old value is false and the new value is true, then
  11537. // writer_identity is changed to a unique service account.
  11538. // It is an error if the old value is true and the new value is set to
  11539. // false or defaulted to false.
  11540. func (c *ProjectsSinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *ProjectsSinksUpdateCall {
  11541. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  11542. return c
  11543. }
  11544. // UpdateMask sets the optional parameter "updateMask": Field mask that
  11545. // specifies the fields in sink that need an update. A sink field will
  11546. // be overwritten if, and only if, it is in the update mask. name and
  11547. // output only fields cannot be updated.An empty updateMask is
  11548. // temporarily treated as using the following mask for backwards
  11549. // compatibility purposes: destination,filter,includeChildren At some
  11550. // point in the future, behavior will be removed and specifying an empty
  11551. // updateMask will be an error.For a detailed FieldMask definition, see
  11552. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  11553. // updateMask=filter.
  11554. func (c *ProjectsSinksUpdateCall) UpdateMask(updateMask string) *ProjectsSinksUpdateCall {
  11555. c.urlParams_.Set("updateMask", updateMask)
  11556. return c
  11557. }
  11558. // Fields allows partial responses to be retrieved. See
  11559. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11560. // for more information.
  11561. func (c *ProjectsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsSinksUpdateCall {
  11562. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11563. return c
  11564. }
  11565. // Context sets the context to be used in this call's Do method. Any
  11566. // pending HTTP request will be aborted if the provided context is
  11567. // canceled.
  11568. func (c *ProjectsSinksUpdateCall) Context(ctx context.Context) *ProjectsSinksUpdateCall {
  11569. c.ctx_ = ctx
  11570. return c
  11571. }
  11572. // Header returns an http.Header that can be modified by the caller to
  11573. // add HTTP headers to the request.
  11574. func (c *ProjectsSinksUpdateCall) Header() http.Header {
  11575. if c.header_ == nil {
  11576. c.header_ = make(http.Header)
  11577. }
  11578. return c.header_
  11579. }
  11580. func (c *ProjectsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  11581. reqHeaders := make(http.Header)
  11582. for k, v := range c.header_ {
  11583. reqHeaders[k] = v
  11584. }
  11585. reqHeaders.Set("User-Agent", c.s.userAgent())
  11586. var body io.Reader = nil
  11587. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  11588. if err != nil {
  11589. return nil, err
  11590. }
  11591. reqHeaders.Set("Content-Type", "application/json")
  11592. c.urlParams_.Set("alt", alt)
  11593. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  11594. urls += "?" + c.urlParams_.Encode()
  11595. req, _ := http.NewRequest("PUT", urls, body)
  11596. req.Header = reqHeaders
  11597. googleapi.Expand(req.URL, map[string]string{
  11598. "sinkName": c.sinkNameid,
  11599. })
  11600. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11601. }
  11602. // Do executes the "logging.projects.sinks.update" call.
  11603. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  11604. // code is an error. Response headers are in either
  11605. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  11606. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11607. // check whether the returned error was because http.StatusNotModified
  11608. // was returned.
  11609. func (c *ProjectsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  11610. gensupport.SetOptions(c.urlParams_, opts...)
  11611. res, err := c.doRequest("json")
  11612. if res != nil && res.StatusCode == http.StatusNotModified {
  11613. if res.Body != nil {
  11614. res.Body.Close()
  11615. }
  11616. return nil, &googleapi.Error{
  11617. Code: res.StatusCode,
  11618. Header: res.Header,
  11619. }
  11620. }
  11621. if err != nil {
  11622. return nil, err
  11623. }
  11624. defer googleapi.CloseBody(res)
  11625. if err := googleapi.CheckResponse(res); err != nil {
  11626. return nil, err
  11627. }
  11628. ret := &LogSink{
  11629. ServerResponse: googleapi.ServerResponse{
  11630. Header: res.Header,
  11631. HTTPStatusCode: res.StatusCode,
  11632. },
  11633. }
  11634. target := &ret
  11635. if err := gensupport.DecodeResponse(target, res); err != nil {
  11636. return nil, err
  11637. }
  11638. return ret, nil
  11639. // {
  11640. // "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.",
  11641. // "flatPath": "v2/projects/{projectsId}/sinks/{sinksId}",
  11642. // "httpMethod": "PUT",
  11643. // "id": "logging.projects.sinks.update",
  11644. // "parameterOrder": [
  11645. // "sinkName"
  11646. // ],
  11647. // "parameters": {
  11648. // "sinkName": {
  11649. // "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\".",
  11650. // "location": "path",
  11651. // "pattern": "^projects/[^/]+/sinks/[^/]+$",
  11652. // "required": true,
  11653. // "type": "string"
  11654. // },
  11655. // "uniqueWriterIdentity": {
  11656. // "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.",
  11657. // "location": "query",
  11658. // "type": "boolean"
  11659. // },
  11660. // "updateMask": {
  11661. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  11662. // "format": "google-fieldmask",
  11663. // "location": "query",
  11664. // "type": "string"
  11665. // }
  11666. // },
  11667. // "path": "v2/{+sinkName}",
  11668. // "request": {
  11669. // "$ref": "LogSink"
  11670. // },
  11671. // "response": {
  11672. // "$ref": "LogSink"
  11673. // },
  11674. // "scopes": [
  11675. // "https://www.googleapis.com/auth/cloud-platform",
  11676. // "https://www.googleapis.com/auth/logging.admin"
  11677. // ]
  11678. // }
  11679. }
  11680. // method id "logging.sinks.create":
  11681. type SinksCreateCall struct {
  11682. s *Service
  11683. parent string
  11684. logsink *LogSink
  11685. urlParams_ gensupport.URLParams
  11686. ctx_ context.Context
  11687. header_ http.Header
  11688. }
  11689. // Create: Creates a sink that exports specified log entries to a
  11690. // destination. The export of newly-ingested log entries begins
  11691. // immediately, unless the sink's writer_identity is not permitted to
  11692. // write to the destination. A sink can export log entries only from the
  11693. // resource owning the sink.
  11694. func (r *SinksService) Create(parent string, logsink *LogSink) *SinksCreateCall {
  11695. c := &SinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11696. c.parent = parent
  11697. c.logsink = logsink
  11698. return c
  11699. }
  11700. // UniqueWriterIdentity sets the optional parameter
  11701. // "uniqueWriterIdentity": Determines the kind of IAM identity returned
  11702. // as writer_identity in the new sink. If this value is omitted or set
  11703. // to false, and if the sink's parent is a project, then the value
  11704. // returned as writer_identity is the same group or service account used
  11705. // by Stackdriver Logging before the addition of writer identities to
  11706. // this API. The sink's destination must be in the same project as the
  11707. // sink itself.If this field is set to true, or if the sink is owned by
  11708. // a non-project resource such as an organization, then the value of
  11709. // writer_identity will be a unique service account used only for
  11710. // exports from the new sink. For more information, see writer_identity
  11711. // in LogSink.
  11712. func (c *SinksCreateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *SinksCreateCall {
  11713. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  11714. return c
  11715. }
  11716. // Fields allows partial responses to be retrieved. See
  11717. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11718. // for more information.
  11719. func (c *SinksCreateCall) Fields(s ...googleapi.Field) *SinksCreateCall {
  11720. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11721. return c
  11722. }
  11723. // Context sets the context to be used in this call's Do method. Any
  11724. // pending HTTP request will be aborted if the provided context is
  11725. // canceled.
  11726. func (c *SinksCreateCall) Context(ctx context.Context) *SinksCreateCall {
  11727. c.ctx_ = ctx
  11728. return c
  11729. }
  11730. // Header returns an http.Header that can be modified by the caller to
  11731. // add HTTP headers to the request.
  11732. func (c *SinksCreateCall) Header() http.Header {
  11733. if c.header_ == nil {
  11734. c.header_ = make(http.Header)
  11735. }
  11736. return c.header_
  11737. }
  11738. func (c *SinksCreateCall) doRequest(alt string) (*http.Response, error) {
  11739. reqHeaders := make(http.Header)
  11740. for k, v := range c.header_ {
  11741. reqHeaders[k] = v
  11742. }
  11743. reqHeaders.Set("User-Agent", c.s.userAgent())
  11744. var body io.Reader = nil
  11745. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  11746. if err != nil {
  11747. return nil, err
  11748. }
  11749. reqHeaders.Set("Content-Type", "application/json")
  11750. c.urlParams_.Set("alt", alt)
  11751. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  11752. urls += "?" + c.urlParams_.Encode()
  11753. req, _ := http.NewRequest("POST", urls, body)
  11754. req.Header = reqHeaders
  11755. googleapi.Expand(req.URL, map[string]string{
  11756. "parent": c.parent,
  11757. })
  11758. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11759. }
  11760. // Do executes the "logging.sinks.create" call.
  11761. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  11762. // code is an error. Response headers are in either
  11763. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  11764. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11765. // check whether the returned error was because http.StatusNotModified
  11766. // was returned.
  11767. func (c *SinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  11768. gensupport.SetOptions(c.urlParams_, opts...)
  11769. res, err := c.doRequest("json")
  11770. if res != nil && res.StatusCode == http.StatusNotModified {
  11771. if res.Body != nil {
  11772. res.Body.Close()
  11773. }
  11774. return nil, &googleapi.Error{
  11775. Code: res.StatusCode,
  11776. Header: res.Header,
  11777. }
  11778. }
  11779. if err != nil {
  11780. return nil, err
  11781. }
  11782. defer googleapi.CloseBody(res)
  11783. if err := googleapi.CheckResponse(res); err != nil {
  11784. return nil, err
  11785. }
  11786. ret := &LogSink{
  11787. ServerResponse: googleapi.ServerResponse{
  11788. Header: res.Header,
  11789. HTTPStatusCode: res.StatusCode,
  11790. },
  11791. }
  11792. target := &ret
  11793. if err := gensupport.DecodeResponse(target, res); err != nil {
  11794. return nil, err
  11795. }
  11796. return ret, nil
  11797. // {
  11798. // "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.",
  11799. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks",
  11800. // "httpMethod": "POST",
  11801. // "id": "logging.sinks.create",
  11802. // "parameterOrder": [
  11803. // "parent"
  11804. // ],
  11805. // "parameters": {
  11806. // "parent": {
  11807. // "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\".",
  11808. // "location": "path",
  11809. // "pattern": "^[^/]+/[^/]+$",
  11810. // "required": true,
  11811. // "type": "string"
  11812. // },
  11813. // "uniqueWriterIdentity": {
  11814. // "description": "Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Stackdriver Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.",
  11815. // "location": "query",
  11816. // "type": "boolean"
  11817. // }
  11818. // },
  11819. // "path": "v2/{+parent}/sinks",
  11820. // "request": {
  11821. // "$ref": "LogSink"
  11822. // },
  11823. // "response": {
  11824. // "$ref": "LogSink"
  11825. // },
  11826. // "scopes": [
  11827. // "https://www.googleapis.com/auth/cloud-platform",
  11828. // "https://www.googleapis.com/auth/logging.admin"
  11829. // ]
  11830. // }
  11831. }
  11832. // method id "logging.sinks.delete":
  11833. type SinksDeleteCall struct {
  11834. s *Service
  11835. sinkNameid string
  11836. urlParams_ gensupport.URLParams
  11837. ctx_ context.Context
  11838. header_ http.Header
  11839. }
  11840. // Delete: Deletes a sink. If the sink has a unique writer_identity,
  11841. // then that service account is also deleted.
  11842. func (r *SinksService) Delete(sinkNameid string) *SinksDeleteCall {
  11843. c := &SinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11844. c.sinkNameid = sinkNameid
  11845. return c
  11846. }
  11847. // Fields allows partial responses to be retrieved. See
  11848. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11849. // for more information.
  11850. func (c *SinksDeleteCall) Fields(s ...googleapi.Field) *SinksDeleteCall {
  11851. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11852. return c
  11853. }
  11854. // Context sets the context to be used in this call's Do method. Any
  11855. // pending HTTP request will be aborted if the provided context is
  11856. // canceled.
  11857. func (c *SinksDeleteCall) Context(ctx context.Context) *SinksDeleteCall {
  11858. c.ctx_ = ctx
  11859. return c
  11860. }
  11861. // Header returns an http.Header that can be modified by the caller to
  11862. // add HTTP headers to the request.
  11863. func (c *SinksDeleteCall) Header() http.Header {
  11864. if c.header_ == nil {
  11865. c.header_ = make(http.Header)
  11866. }
  11867. return c.header_
  11868. }
  11869. func (c *SinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  11870. reqHeaders := make(http.Header)
  11871. for k, v := range c.header_ {
  11872. reqHeaders[k] = v
  11873. }
  11874. reqHeaders.Set("User-Agent", c.s.userAgent())
  11875. var body io.Reader = nil
  11876. c.urlParams_.Set("alt", alt)
  11877. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  11878. urls += "?" + c.urlParams_.Encode()
  11879. req, _ := http.NewRequest("DELETE", urls, body)
  11880. req.Header = reqHeaders
  11881. googleapi.Expand(req.URL, map[string]string{
  11882. "sinkName": c.sinkNameid,
  11883. })
  11884. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11885. }
  11886. // Do executes the "logging.sinks.delete" call.
  11887. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  11888. // code is an error. Response headers are in either
  11889. // *Empty.ServerResponse.Header or (if a response was returned at all)
  11890. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  11891. // check whether the returned error was because http.StatusNotModified
  11892. // was returned.
  11893. func (c *SinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  11894. gensupport.SetOptions(c.urlParams_, opts...)
  11895. res, err := c.doRequest("json")
  11896. if res != nil && res.StatusCode == http.StatusNotModified {
  11897. if res.Body != nil {
  11898. res.Body.Close()
  11899. }
  11900. return nil, &googleapi.Error{
  11901. Code: res.StatusCode,
  11902. Header: res.Header,
  11903. }
  11904. }
  11905. if err != nil {
  11906. return nil, err
  11907. }
  11908. defer googleapi.CloseBody(res)
  11909. if err := googleapi.CheckResponse(res); err != nil {
  11910. return nil, err
  11911. }
  11912. ret := &Empty{
  11913. ServerResponse: googleapi.ServerResponse{
  11914. Header: res.Header,
  11915. HTTPStatusCode: res.StatusCode,
  11916. },
  11917. }
  11918. target := &ret
  11919. if err := gensupport.DecodeResponse(target, res); err != nil {
  11920. return nil, err
  11921. }
  11922. return ret, nil
  11923. // {
  11924. // "description": "Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.",
  11925. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks/{sinksId}",
  11926. // "httpMethod": "DELETE",
  11927. // "id": "logging.sinks.delete",
  11928. // "parameterOrder": [
  11929. // "sinkName"
  11930. // ],
  11931. // "parameters": {
  11932. // "sinkName": {
  11933. // "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\".",
  11934. // "location": "path",
  11935. // "pattern": "^[^/]+/[^/]+/sinks/[^/]+$",
  11936. // "required": true,
  11937. // "type": "string"
  11938. // }
  11939. // },
  11940. // "path": "v2/{+sinkName}",
  11941. // "response": {
  11942. // "$ref": "Empty"
  11943. // },
  11944. // "scopes": [
  11945. // "https://www.googleapis.com/auth/cloud-platform",
  11946. // "https://www.googleapis.com/auth/logging.admin"
  11947. // ]
  11948. // }
  11949. }
  11950. // method id "logging.sinks.get":
  11951. type SinksGetCall struct {
  11952. s *Service
  11953. sinkName string
  11954. urlParams_ gensupport.URLParams
  11955. ifNoneMatch_ string
  11956. ctx_ context.Context
  11957. header_ http.Header
  11958. }
  11959. // Get: Gets a sink.
  11960. func (r *SinksService) Get(sinkName string) *SinksGetCall {
  11961. c := &SinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11962. c.sinkName = sinkName
  11963. return c
  11964. }
  11965. // Fields allows partial responses to be retrieved. See
  11966. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11967. // for more information.
  11968. func (c *SinksGetCall) Fields(s ...googleapi.Field) *SinksGetCall {
  11969. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11970. return c
  11971. }
  11972. // IfNoneMatch sets the optional parameter which makes the operation
  11973. // fail if the object's ETag matches the given value. This is useful for
  11974. // getting updates only after the object has changed since the last
  11975. // request. Use googleapi.IsNotModified to check whether the response
  11976. // error from Do is the result of In-None-Match.
  11977. func (c *SinksGetCall) IfNoneMatch(entityTag string) *SinksGetCall {
  11978. c.ifNoneMatch_ = entityTag
  11979. return c
  11980. }
  11981. // Context sets the context to be used in this call's Do method. Any
  11982. // pending HTTP request will be aborted if the provided context is
  11983. // canceled.
  11984. func (c *SinksGetCall) Context(ctx context.Context) *SinksGetCall {
  11985. c.ctx_ = ctx
  11986. return c
  11987. }
  11988. // Header returns an http.Header that can be modified by the caller to
  11989. // add HTTP headers to the request.
  11990. func (c *SinksGetCall) Header() http.Header {
  11991. if c.header_ == nil {
  11992. c.header_ = make(http.Header)
  11993. }
  11994. return c.header_
  11995. }
  11996. func (c *SinksGetCall) doRequest(alt string) (*http.Response, error) {
  11997. reqHeaders := make(http.Header)
  11998. for k, v := range c.header_ {
  11999. reqHeaders[k] = v
  12000. }
  12001. reqHeaders.Set("User-Agent", c.s.userAgent())
  12002. if c.ifNoneMatch_ != "" {
  12003. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12004. }
  12005. var body io.Reader = nil
  12006. c.urlParams_.Set("alt", alt)
  12007. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  12008. urls += "?" + c.urlParams_.Encode()
  12009. req, _ := http.NewRequest("GET", urls, body)
  12010. req.Header = reqHeaders
  12011. googleapi.Expand(req.URL, map[string]string{
  12012. "sinkName": c.sinkName,
  12013. })
  12014. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12015. }
  12016. // Do executes the "logging.sinks.get" call.
  12017. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  12018. // code is an error. Response headers are in either
  12019. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  12020. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12021. // check whether the returned error was because http.StatusNotModified
  12022. // was returned.
  12023. func (c *SinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  12024. gensupport.SetOptions(c.urlParams_, opts...)
  12025. res, err := c.doRequest("json")
  12026. if res != nil && res.StatusCode == http.StatusNotModified {
  12027. if res.Body != nil {
  12028. res.Body.Close()
  12029. }
  12030. return nil, &googleapi.Error{
  12031. Code: res.StatusCode,
  12032. Header: res.Header,
  12033. }
  12034. }
  12035. if err != nil {
  12036. return nil, err
  12037. }
  12038. defer googleapi.CloseBody(res)
  12039. if err := googleapi.CheckResponse(res); err != nil {
  12040. return nil, err
  12041. }
  12042. ret := &LogSink{
  12043. ServerResponse: googleapi.ServerResponse{
  12044. Header: res.Header,
  12045. HTTPStatusCode: res.StatusCode,
  12046. },
  12047. }
  12048. target := &ret
  12049. if err := gensupport.DecodeResponse(target, res); err != nil {
  12050. return nil, err
  12051. }
  12052. return ret, nil
  12053. // {
  12054. // "description": "Gets a sink.",
  12055. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks/{sinksId}",
  12056. // "httpMethod": "GET",
  12057. // "id": "logging.sinks.get",
  12058. // "parameterOrder": [
  12059. // "sinkName"
  12060. // ],
  12061. // "parameters": {
  12062. // "sinkName": {
  12063. // "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\".",
  12064. // "location": "path",
  12065. // "pattern": "^[^/]+/[^/]+/sinks/[^/]+$",
  12066. // "required": true,
  12067. // "type": "string"
  12068. // }
  12069. // },
  12070. // "path": "v2/{+sinkName}",
  12071. // "response": {
  12072. // "$ref": "LogSink"
  12073. // },
  12074. // "scopes": [
  12075. // "https://www.googleapis.com/auth/cloud-platform",
  12076. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  12077. // "https://www.googleapis.com/auth/logging.admin",
  12078. // "https://www.googleapis.com/auth/logging.read"
  12079. // ]
  12080. // }
  12081. }
  12082. // method id "logging.sinks.list":
  12083. type SinksListCall struct {
  12084. s *Service
  12085. parent string
  12086. urlParams_ gensupport.URLParams
  12087. ifNoneMatch_ string
  12088. ctx_ context.Context
  12089. header_ http.Header
  12090. }
  12091. // List: Lists sinks.
  12092. func (r *SinksService) List(parent string) *SinksListCall {
  12093. c := &SinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12094. c.parent = parent
  12095. return c
  12096. }
  12097. // PageSize sets the optional parameter "pageSize": The maximum number
  12098. // of results to return from this request. Non-positive values are
  12099. // ignored. The presence of nextPageToken in the response indicates that
  12100. // more results might be available.
  12101. func (c *SinksListCall) PageSize(pageSize int64) *SinksListCall {
  12102. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  12103. return c
  12104. }
  12105. // PageToken sets the optional parameter "pageToken": If present, then
  12106. // retrieve the next batch of results from the preceding call to this
  12107. // method. pageToken must be the value of nextPageToken from the
  12108. // previous response. The values of other method parameters should be
  12109. // identical to those in the previous call.
  12110. func (c *SinksListCall) PageToken(pageToken string) *SinksListCall {
  12111. c.urlParams_.Set("pageToken", pageToken)
  12112. return c
  12113. }
  12114. // Fields allows partial responses to be retrieved. See
  12115. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12116. // for more information.
  12117. func (c *SinksListCall) Fields(s ...googleapi.Field) *SinksListCall {
  12118. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12119. return c
  12120. }
  12121. // IfNoneMatch sets the optional parameter which makes the operation
  12122. // fail if the object's ETag matches the given value. This is useful for
  12123. // getting updates only after the object has changed since the last
  12124. // request. Use googleapi.IsNotModified to check whether the response
  12125. // error from Do is the result of In-None-Match.
  12126. func (c *SinksListCall) IfNoneMatch(entityTag string) *SinksListCall {
  12127. c.ifNoneMatch_ = entityTag
  12128. return c
  12129. }
  12130. // Context sets the context to be used in this call's Do method. Any
  12131. // pending HTTP request will be aborted if the provided context is
  12132. // canceled.
  12133. func (c *SinksListCall) Context(ctx context.Context) *SinksListCall {
  12134. c.ctx_ = ctx
  12135. return c
  12136. }
  12137. // Header returns an http.Header that can be modified by the caller to
  12138. // add HTTP headers to the request.
  12139. func (c *SinksListCall) Header() http.Header {
  12140. if c.header_ == nil {
  12141. c.header_ = make(http.Header)
  12142. }
  12143. return c.header_
  12144. }
  12145. func (c *SinksListCall) doRequest(alt string) (*http.Response, error) {
  12146. reqHeaders := make(http.Header)
  12147. for k, v := range c.header_ {
  12148. reqHeaders[k] = v
  12149. }
  12150. reqHeaders.Set("User-Agent", c.s.userAgent())
  12151. if c.ifNoneMatch_ != "" {
  12152. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12153. }
  12154. var body io.Reader = nil
  12155. c.urlParams_.Set("alt", alt)
  12156. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/sinks")
  12157. urls += "?" + c.urlParams_.Encode()
  12158. req, _ := http.NewRequest("GET", urls, body)
  12159. req.Header = reqHeaders
  12160. googleapi.Expand(req.URL, map[string]string{
  12161. "parent": c.parent,
  12162. })
  12163. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12164. }
  12165. // Do executes the "logging.sinks.list" call.
  12166. // Exactly one of *ListSinksResponse or error will be non-nil. Any
  12167. // non-2xx status code is an error. Response headers are in either
  12168. // *ListSinksResponse.ServerResponse.Header or (if a response was
  12169. // returned at all) in error.(*googleapi.Error).Header. Use
  12170. // googleapi.IsNotModified to check whether the returned error was
  12171. // because http.StatusNotModified was returned.
  12172. func (c *SinksListCall) Do(opts ...googleapi.CallOption) (*ListSinksResponse, error) {
  12173. gensupport.SetOptions(c.urlParams_, opts...)
  12174. res, err := c.doRequest("json")
  12175. if res != nil && res.StatusCode == http.StatusNotModified {
  12176. if res.Body != nil {
  12177. res.Body.Close()
  12178. }
  12179. return nil, &googleapi.Error{
  12180. Code: res.StatusCode,
  12181. Header: res.Header,
  12182. }
  12183. }
  12184. if err != nil {
  12185. return nil, err
  12186. }
  12187. defer googleapi.CloseBody(res)
  12188. if err := googleapi.CheckResponse(res); err != nil {
  12189. return nil, err
  12190. }
  12191. ret := &ListSinksResponse{
  12192. ServerResponse: googleapi.ServerResponse{
  12193. Header: res.Header,
  12194. HTTPStatusCode: res.StatusCode,
  12195. },
  12196. }
  12197. target := &ret
  12198. if err := gensupport.DecodeResponse(target, res); err != nil {
  12199. return nil, err
  12200. }
  12201. return ret, nil
  12202. // {
  12203. // "description": "Lists sinks.",
  12204. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks",
  12205. // "httpMethod": "GET",
  12206. // "id": "logging.sinks.list",
  12207. // "parameterOrder": [
  12208. // "parent"
  12209. // ],
  12210. // "parameters": {
  12211. // "pageSize": {
  12212. // "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.",
  12213. // "format": "int32",
  12214. // "location": "query",
  12215. // "type": "integer"
  12216. // },
  12217. // "pageToken": {
  12218. // "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.",
  12219. // "location": "query",
  12220. // "type": "string"
  12221. // },
  12222. // "parent": {
  12223. // "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",
  12224. // "location": "path",
  12225. // "pattern": "^[^/]+/[^/]+$",
  12226. // "required": true,
  12227. // "type": "string"
  12228. // }
  12229. // },
  12230. // "path": "v2/{+parent}/sinks",
  12231. // "response": {
  12232. // "$ref": "ListSinksResponse"
  12233. // },
  12234. // "scopes": [
  12235. // "https://www.googleapis.com/auth/cloud-platform",
  12236. // "https://www.googleapis.com/auth/cloud-platform.read-only",
  12237. // "https://www.googleapis.com/auth/logging.admin",
  12238. // "https://www.googleapis.com/auth/logging.read"
  12239. // ]
  12240. // }
  12241. }
  12242. // Pages invokes f for each page of results.
  12243. // A non-nil error returned from f will halt the iteration.
  12244. // The provided context supersedes any context provided to the Context method.
  12245. func (c *SinksListCall) Pages(ctx context.Context, f func(*ListSinksResponse) error) error {
  12246. c.ctx_ = ctx
  12247. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12248. for {
  12249. x, err := c.Do()
  12250. if err != nil {
  12251. return err
  12252. }
  12253. if err := f(x); err != nil {
  12254. return err
  12255. }
  12256. if x.NextPageToken == "" {
  12257. return nil
  12258. }
  12259. c.PageToken(x.NextPageToken)
  12260. }
  12261. }
  12262. // method id "logging.sinks.update":
  12263. type SinksUpdateCall struct {
  12264. s *Service
  12265. sinkNameid string
  12266. logsink *LogSink
  12267. urlParams_ gensupport.URLParams
  12268. ctx_ context.Context
  12269. header_ http.Header
  12270. }
  12271. // Update: Updates a sink. This method replaces the following fields in
  12272. // the existing sink with values from the new sink: destination, and
  12273. // filter. The updated sink might also have a new writer_identity; see
  12274. // the unique_writer_identity field.
  12275. func (r *SinksService) Update(sinkNameid string, logsink *LogSink) *SinksUpdateCall {
  12276. c := &SinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12277. c.sinkNameid = sinkNameid
  12278. c.logsink = logsink
  12279. return c
  12280. }
  12281. // UniqueWriterIdentity sets the optional parameter
  12282. // "uniqueWriterIdentity": See sinks.create for a description of this
  12283. // field. When updating a sink, the effect of this field on the value of
  12284. // writer_identity in the updated sink depends on both the old and new
  12285. // values of this field:
  12286. // If the old and new values of this field are both false or both true,
  12287. // then there is no change to the sink's writer_identity.
  12288. // If the old value is false and the new value is true, then
  12289. // writer_identity is changed to a unique service account.
  12290. // It is an error if the old value is true and the new value is set to
  12291. // false or defaulted to false.
  12292. func (c *SinksUpdateCall) UniqueWriterIdentity(uniqueWriterIdentity bool) *SinksUpdateCall {
  12293. c.urlParams_.Set("uniqueWriterIdentity", fmt.Sprint(uniqueWriterIdentity))
  12294. return c
  12295. }
  12296. // UpdateMask sets the optional parameter "updateMask": Field mask that
  12297. // specifies the fields in sink that need an update. A sink field will
  12298. // be overwritten if, and only if, it is in the update mask. name and
  12299. // output only fields cannot be updated.An empty updateMask is
  12300. // temporarily treated as using the following mask for backwards
  12301. // compatibility purposes: destination,filter,includeChildren At some
  12302. // point in the future, behavior will be removed and specifying an empty
  12303. // updateMask will be an error.For a detailed FieldMask definition, see
  12304. // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample:
  12305. // updateMask=filter.
  12306. func (c *SinksUpdateCall) UpdateMask(updateMask string) *SinksUpdateCall {
  12307. c.urlParams_.Set("updateMask", updateMask)
  12308. return c
  12309. }
  12310. // Fields allows partial responses to be retrieved. See
  12311. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12312. // for more information.
  12313. func (c *SinksUpdateCall) Fields(s ...googleapi.Field) *SinksUpdateCall {
  12314. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12315. return c
  12316. }
  12317. // Context sets the context to be used in this call's Do method. Any
  12318. // pending HTTP request will be aborted if the provided context is
  12319. // canceled.
  12320. func (c *SinksUpdateCall) Context(ctx context.Context) *SinksUpdateCall {
  12321. c.ctx_ = ctx
  12322. return c
  12323. }
  12324. // Header returns an http.Header that can be modified by the caller to
  12325. // add HTTP headers to the request.
  12326. func (c *SinksUpdateCall) Header() http.Header {
  12327. if c.header_ == nil {
  12328. c.header_ = make(http.Header)
  12329. }
  12330. return c.header_
  12331. }
  12332. func (c *SinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  12333. reqHeaders := make(http.Header)
  12334. for k, v := range c.header_ {
  12335. reqHeaders[k] = v
  12336. }
  12337. reqHeaders.Set("User-Agent", c.s.userAgent())
  12338. var body io.Reader = nil
  12339. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  12340. if err != nil {
  12341. return nil, err
  12342. }
  12343. reqHeaders.Set("Content-Type", "application/json")
  12344. c.urlParams_.Set("alt", alt)
  12345. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+sinkName}")
  12346. urls += "?" + c.urlParams_.Encode()
  12347. req, _ := http.NewRequest("PUT", urls, body)
  12348. req.Header = reqHeaders
  12349. googleapi.Expand(req.URL, map[string]string{
  12350. "sinkName": c.sinkNameid,
  12351. })
  12352. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12353. }
  12354. // Do executes the "logging.sinks.update" call.
  12355. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  12356. // code is an error. Response headers are in either
  12357. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  12358. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  12359. // check whether the returned error was because http.StatusNotModified
  12360. // was returned.
  12361. func (c *SinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  12362. gensupport.SetOptions(c.urlParams_, opts...)
  12363. res, err := c.doRequest("json")
  12364. if res != nil && res.StatusCode == http.StatusNotModified {
  12365. if res.Body != nil {
  12366. res.Body.Close()
  12367. }
  12368. return nil, &googleapi.Error{
  12369. Code: res.StatusCode,
  12370. Header: res.Header,
  12371. }
  12372. }
  12373. if err != nil {
  12374. return nil, err
  12375. }
  12376. defer googleapi.CloseBody(res)
  12377. if err := googleapi.CheckResponse(res); err != nil {
  12378. return nil, err
  12379. }
  12380. ret := &LogSink{
  12381. ServerResponse: googleapi.ServerResponse{
  12382. Header: res.Header,
  12383. HTTPStatusCode: res.StatusCode,
  12384. },
  12385. }
  12386. target := &ret
  12387. if err := gensupport.DecodeResponse(target, res); err != nil {
  12388. return nil, err
  12389. }
  12390. return ret, nil
  12391. // {
  12392. // "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.",
  12393. // "flatPath": "v2/{v2Id}/{v2Id1}/sinks/{sinksId}",
  12394. // "httpMethod": "PUT",
  12395. // "id": "logging.sinks.update",
  12396. // "parameterOrder": [
  12397. // "sinkName"
  12398. // ],
  12399. // "parameters": {
  12400. // "sinkName": {
  12401. // "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\".",
  12402. // "location": "path",
  12403. // "pattern": "^[^/]+/[^/]+/sinks/[^/]+$",
  12404. // "required": true,
  12405. // "type": "string"
  12406. // },
  12407. // "uniqueWriterIdentity": {
  12408. // "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.",
  12409. // "location": "query",
  12410. // "type": "boolean"
  12411. // },
  12412. // "updateMask": {
  12413. // "description": "Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskExample: updateMask=filter.",
  12414. // "format": "google-fieldmask",
  12415. // "location": "query",
  12416. // "type": "string"
  12417. // }
  12418. // },
  12419. // "path": "v2/{+sinkName}",
  12420. // "request": {
  12421. // "$ref": "LogSink"
  12422. // },
  12423. // "response": {
  12424. // "$ref": "LogSink"
  12425. // },
  12426. // "scopes": [
  12427. // "https://www.googleapis.com/auth/cloud-platform",
  12428. // "https://www.googleapis.com/auth/logging.admin"
  12429. // ]
  12430. // }
  12431. }