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

3270 linhas
112 KiB

  1. // Copyright YEAR Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package logging provides access to the Google Cloud Logging API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/logging instead.
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/logging/v1beta3"
  14. // ...
  15. // ctx := context.Background()
  16. // loggingService, err := logging.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // loggingService, err := logging.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // loggingService, err := logging.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package logging // import "google.golang.org/api/logging/v1beta3"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "logging:v1beta3"
  67. const apiName = "logging"
  68. const apiVersion = "v1beta3"
  69. const basePath = "https://logging.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Projects = NewProjectsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Projects *ProjectsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewProjectsService(s *Service) *ProjectsService {
  121. rs := &ProjectsService{s: s}
  122. rs.LogServices = NewProjectsLogServicesService(s)
  123. rs.Logs = NewProjectsLogsService(s)
  124. return rs
  125. }
  126. type ProjectsService struct {
  127. s *Service
  128. LogServices *ProjectsLogServicesService
  129. Logs *ProjectsLogsService
  130. }
  131. func NewProjectsLogServicesService(s *Service) *ProjectsLogServicesService {
  132. rs := &ProjectsLogServicesService{s: s}
  133. rs.Indexes = NewProjectsLogServicesIndexesService(s)
  134. rs.Sinks = NewProjectsLogServicesSinksService(s)
  135. return rs
  136. }
  137. type ProjectsLogServicesService struct {
  138. s *Service
  139. Indexes *ProjectsLogServicesIndexesService
  140. Sinks *ProjectsLogServicesSinksService
  141. }
  142. func NewProjectsLogServicesIndexesService(s *Service) *ProjectsLogServicesIndexesService {
  143. rs := &ProjectsLogServicesIndexesService{s: s}
  144. return rs
  145. }
  146. type ProjectsLogServicesIndexesService struct {
  147. s *Service
  148. }
  149. func NewProjectsLogServicesSinksService(s *Service) *ProjectsLogServicesSinksService {
  150. rs := &ProjectsLogServicesSinksService{s: s}
  151. return rs
  152. }
  153. type ProjectsLogServicesSinksService struct {
  154. s *Service
  155. }
  156. func NewProjectsLogsService(s *Service) *ProjectsLogsService {
  157. rs := &ProjectsLogsService{s: s}
  158. rs.Entries = NewProjectsLogsEntriesService(s)
  159. rs.Sinks = NewProjectsLogsSinksService(s)
  160. return rs
  161. }
  162. type ProjectsLogsService struct {
  163. s *Service
  164. Entries *ProjectsLogsEntriesService
  165. Sinks *ProjectsLogsSinksService
  166. }
  167. func NewProjectsLogsEntriesService(s *Service) *ProjectsLogsEntriesService {
  168. rs := &ProjectsLogsEntriesService{s: s}
  169. return rs
  170. }
  171. type ProjectsLogsEntriesService struct {
  172. s *Service
  173. }
  174. func NewProjectsLogsSinksService(s *Service) *ProjectsLogsSinksService {
  175. rs := &ProjectsLogsSinksService{s: s}
  176. return rs
  177. }
  178. type ProjectsLogsSinksService struct {
  179. s *Service
  180. }
  181. // Empty: A generic empty message that you can re-use to avoid defining
  182. // duplicated empty messages in your APIs. A typical example is to use
  183. // it as the request or the response type of an API method. For
  184. // instance: service Foo { rpc Bar(google.protobuf.Empty) returns
  185. // (google.protobuf.Empty); }
  186. type Empty struct {
  187. // ServerResponse contains the HTTP response code and headers from the
  188. // server.
  189. googleapi.ServerResponse `json:"-"`
  190. }
  191. // ListLogServiceIndexesResponse: Result returned from
  192. // ListLogServiceIndexesRequest.
  193. type ListLogServiceIndexesResponse struct {
  194. // NextPageToken: If there are more results, then `nextPageToken` is
  195. // returned in the response. To get the next batch of indexes, use the
  196. // value of `nextPageToken` as `pageToken` in the next call of
  197. // `ListLogServiceIndexess`. If `nextPageToken` is empty, then there are
  198. // no more results.
  199. NextPageToken string `json:"nextPageToken,omitempty"`
  200. // ServiceIndexPrefixes: A list of log service index prefixes.
  201. ServiceIndexPrefixes []string `json:"serviceIndexPrefixes,omitempty"`
  202. // ServerResponse contains the HTTP response code and headers from the
  203. // server.
  204. googleapi.ServerResponse `json:"-"`
  205. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  206. // unconditionally include in API requests. By default, fields with
  207. // empty values are omitted from API requests. However, any non-pointer,
  208. // non-interface field appearing in ForceSendFields will be sent to the
  209. // server regardless of whether the field is empty or not. This may be
  210. // used to include empty fields in Patch requests.
  211. ForceSendFields []string `json:"-"`
  212. // NullFields is a list of field names (e.g. "NextPageToken") to include
  213. // in API requests with the JSON null value. By default, fields with
  214. // empty values are omitted from API requests. However, any field with
  215. // an empty value appearing in NullFields will be sent to the server as
  216. // null. It is an error if a field in this list has a non-empty value.
  217. // This may be used to include null fields in Patch requests.
  218. NullFields []string `json:"-"`
  219. }
  220. func (s *ListLogServiceIndexesResponse) MarshalJSON() ([]byte, error) {
  221. type NoMethod ListLogServiceIndexesResponse
  222. raw := NoMethod(*s)
  223. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  224. }
  225. // ListLogServiceSinksResponse: Result returned from
  226. // `ListLogServiceSinks`.
  227. type ListLogServiceSinksResponse struct {
  228. // Sinks: The requested log service sinks. If any of the returned
  229. // `LogSink` objects have an empty `destination` field, then call
  230. // `logServices.sinks.get` to retrieve the complete `LogSink` object.
  231. Sinks []*LogSink `json:"sinks,omitempty"`
  232. // ServerResponse contains the HTTP response code and headers from the
  233. // server.
  234. googleapi.ServerResponse `json:"-"`
  235. // ForceSendFields is a list of field names (e.g. "Sinks") to
  236. // unconditionally include in API requests. By default, fields with
  237. // empty values are omitted from API requests. However, any non-pointer,
  238. // non-interface field appearing in ForceSendFields will be sent to the
  239. // server regardless of whether the field is empty or not. This may be
  240. // used to include empty fields in Patch requests.
  241. ForceSendFields []string `json:"-"`
  242. // NullFields is a list of field names (e.g. "Sinks") to include in API
  243. // requests with the JSON null value. By default, fields with empty
  244. // values are omitted from API requests. However, any field with an
  245. // empty value appearing in NullFields will be sent to the server as
  246. // null. It is an error if a field in this list has a non-empty value.
  247. // This may be used to include null fields in Patch requests.
  248. NullFields []string `json:"-"`
  249. }
  250. func (s *ListLogServiceSinksResponse) MarshalJSON() ([]byte, error) {
  251. type NoMethod ListLogServiceSinksResponse
  252. raw := NoMethod(*s)
  253. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  254. }
  255. // ListLogServicesResponse: Result returned from
  256. // `ListLogServicesRequest`.
  257. type ListLogServicesResponse struct {
  258. // LogServices: A list of log services.
  259. LogServices []*LogService `json:"logServices,omitempty"`
  260. // NextPageToken: If there are more results, then `nextPageToken` is
  261. // returned in the response. To get the next batch of services, use the
  262. // value of `nextPageToken` as `pageToken` in the next call of
  263. // `ListLogServices`. If `nextPageToken` is empty, then there are no
  264. // more results.
  265. NextPageToken string `json:"nextPageToken,omitempty"`
  266. // ServerResponse contains the HTTP response code and headers from the
  267. // server.
  268. googleapi.ServerResponse `json:"-"`
  269. // ForceSendFields is a list of field names (e.g. "LogServices") to
  270. // unconditionally include in API requests. By default, fields with
  271. // empty values are omitted from API requests. However, any non-pointer,
  272. // non-interface field appearing in ForceSendFields will be sent to the
  273. // server regardless of whether the field is empty or not. This may be
  274. // used to include empty fields in Patch requests.
  275. ForceSendFields []string `json:"-"`
  276. // NullFields is a list of field names (e.g. "LogServices") to include
  277. // in API requests with the JSON null value. By default, fields with
  278. // empty values are omitted from API requests. However, any field with
  279. // an empty value appearing in NullFields will be sent to the server as
  280. // null. It is an error if a field in this list has a non-empty value.
  281. // This may be used to include null fields in Patch requests.
  282. NullFields []string `json:"-"`
  283. }
  284. func (s *ListLogServicesResponse) MarshalJSON() ([]byte, error) {
  285. type NoMethod ListLogServicesResponse
  286. raw := NoMethod(*s)
  287. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  288. }
  289. // ListLogSinksResponse: Result returned from `ListLogSinks`.
  290. type ListLogSinksResponse struct {
  291. // Sinks: The requested log sinks. If any of the returned `LogSink`
  292. // objects have an empty `destination` field, then call
  293. // `logServices.sinks.get` to retrieve the complete `LogSink` object.
  294. Sinks []*LogSink `json:"sinks,omitempty"`
  295. // ServerResponse contains the HTTP response code and headers from the
  296. // server.
  297. googleapi.ServerResponse `json:"-"`
  298. // ForceSendFields is a list of field names (e.g. "Sinks") to
  299. // unconditionally include in API requests. By default, fields with
  300. // empty values are omitted from API requests. However, any non-pointer,
  301. // non-interface field appearing in ForceSendFields will be sent to the
  302. // server regardless of whether the field is empty or not. This may be
  303. // used to include empty fields in Patch requests.
  304. ForceSendFields []string `json:"-"`
  305. // NullFields is a list of field names (e.g. "Sinks") to include in API
  306. // requests with the JSON null value. By default, fields with empty
  307. // values are omitted from API requests. However, any field with an
  308. // empty value appearing in NullFields will be sent to the server as
  309. // null. It is an error if a field in this list has a non-empty value.
  310. // This may be used to include null fields in Patch requests.
  311. NullFields []string `json:"-"`
  312. }
  313. func (s *ListLogSinksResponse) MarshalJSON() ([]byte, error) {
  314. type NoMethod ListLogSinksResponse
  315. raw := NoMethod(*s)
  316. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  317. }
  318. // ListLogsResponse: Result returned from ListLogs.
  319. type ListLogsResponse struct {
  320. // Logs: A list of log resources.
  321. Logs []*Log `json:"logs,omitempty"`
  322. // NextPageToken: If there are more results, then `nextPageToken` is
  323. // returned in the response. To get the next batch of logs, use the
  324. // value of `nextPageToken` as `pageToken` in the next call of
  325. // `ListLogs`. If `nextPageToken` is empty, then there are no more
  326. // results.
  327. NextPageToken string `json:"nextPageToken,omitempty"`
  328. // ServerResponse contains the HTTP response code and headers from the
  329. // server.
  330. googleapi.ServerResponse `json:"-"`
  331. // ForceSendFields is a list of field names (e.g. "Logs") to
  332. // unconditionally include in API requests. By default, fields with
  333. // empty values are omitted from API requests. However, any non-pointer,
  334. // non-interface field appearing in ForceSendFields will be sent to the
  335. // server regardless of whether the field is empty or not. This may be
  336. // used to include empty fields in Patch requests.
  337. ForceSendFields []string `json:"-"`
  338. // NullFields is a list of field names (e.g. "Logs") to include in API
  339. // requests with the JSON null value. By default, fields with empty
  340. // values are omitted from API requests. However, any field with an
  341. // empty value appearing in NullFields will be sent to the server as
  342. // null. It is an error if a field in this list has a non-empty value.
  343. // This may be used to include null fields in Patch requests.
  344. NullFields []string `json:"-"`
  345. }
  346. func (s *ListLogsResponse) MarshalJSON() ([]byte, error) {
  347. type NoMethod ListLogsResponse
  348. raw := NoMethod(*s)
  349. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  350. }
  351. // Log: A log object.
  352. type Log struct {
  353. // DisplayName: Name used when displaying the log to the user (for
  354. // example, in a UI). Example: "activity_log"
  355. DisplayName string `json:"displayName,omitempty"`
  356. // Name: REQUIRED: The log's name name. Example:
  357. // "compute.googleapis.com/activity_log".
  358. Name string `json:"name,omitempty"`
  359. // PayloadType: Type URL describing the expected payload type for the
  360. // log.
  361. PayloadType string `json:"payloadType,omitempty"`
  362. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  363. // unconditionally include in API requests. By default, fields with
  364. // empty values are omitted from API requests. However, any non-pointer,
  365. // non-interface field appearing in ForceSendFields will be sent to the
  366. // server regardless of whether the field is empty or not. This may be
  367. // used to include empty fields in Patch requests.
  368. ForceSendFields []string `json:"-"`
  369. // NullFields is a list of field names (e.g. "DisplayName") to include
  370. // in API requests with the JSON null value. By default, fields with
  371. // empty values are omitted from API requests. However, any field with
  372. // an empty value appearing in NullFields will be sent to the server as
  373. // null. It is an error if a field in this list has a non-empty value.
  374. // This may be used to include null fields in Patch requests.
  375. NullFields []string `json:"-"`
  376. }
  377. func (s *Log) MarshalJSON() ([]byte, error) {
  378. type NoMethod Log
  379. raw := NoMethod(*s)
  380. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  381. }
  382. // LogEntry: An individual entry in a log.
  383. type LogEntry struct {
  384. // InsertId: A unique ID for the log entry. If you provide this field,
  385. // the logging service considers other log entries in the same log with
  386. // the same ID as duplicates which can be removed.
  387. InsertId string `json:"insertId,omitempty"`
  388. // Log: The log to which this entry belongs. When a log entry is
  389. // ingested, the value of this field is set by the logging system.
  390. Log string `json:"log,omitempty"`
  391. // Metadata: Information about the log entry.
  392. Metadata *LogEntryMetadata `json:"metadata,omitempty"`
  393. // ProtoPayload: The log entry payload, represented as a protocol buffer
  394. // that is expressed as a JSON object. You can only pass `protoPayload`
  395. // values that belong to a set of approved types.
  396. ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"`
  397. // StructPayload: The log entry payload, represented as a structure that
  398. // is expressed as a JSON object.
  399. StructPayload googleapi.RawMessage `json:"structPayload,omitempty"`
  400. // TextPayload: The log entry payload, represented as a text string.
  401. TextPayload string `json:"textPayload,omitempty"`
  402. // ForceSendFields is a list of field names (e.g. "InsertId") to
  403. // unconditionally include in API requests. By default, fields with
  404. // empty values are omitted from API requests. However, any non-pointer,
  405. // non-interface field appearing in ForceSendFields will be sent to the
  406. // server regardless of whether the field is empty or not. This may be
  407. // used to include empty fields in Patch requests.
  408. ForceSendFields []string `json:"-"`
  409. // NullFields is a list of field names (e.g. "InsertId") to include in
  410. // API requests with the JSON null value. By default, fields with empty
  411. // values are omitted from API requests. However, any field with an
  412. // empty value appearing in NullFields will be sent to the server as
  413. // null. It is an error if a field in this list has a non-empty value.
  414. // This may be used to include null fields in Patch requests.
  415. NullFields []string `json:"-"`
  416. }
  417. func (s *LogEntry) MarshalJSON() ([]byte, error) {
  418. type NoMethod LogEntry
  419. raw := NoMethod(*s)
  420. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  421. }
  422. // LogEntryMetadata: Additional data that is associated with a log
  423. // entry, set by the service creating the log entry.
  424. type LogEntryMetadata struct {
  425. // Labels: A set of (key, value) data that provides additional
  426. // information about the log entry. If the log entry is from one of the
  427. // Google Cloud Platform sources listed below, the indicated (key,
  428. // value) information must be provided: Google App Engine, service_name
  429. // `appengine.googleapis.com`: "appengine.googleapis.com/module_id",
  430. // "appengine.googleapis.com/version_id", and one of:
  431. // "appengine.googleapis.com/replica_index",
  432. // "appengine.googleapis.com/clone_id", or else provide the following
  433. // Compute Engine labels: Google Compute Engine, service_name
  434. // `compute.googleapis.com`: "compute.googleapis.com/resource_type",
  435. // "instance" "compute.googleapis.com/resource_id",
  436. Labels map[string]string `json:"labels,omitempty"`
  437. // ProjectId: The project ID of the Google Cloud Platform service that
  438. // created the log entry.
  439. ProjectId string `json:"projectId,omitempty"`
  440. // Region: The region name of the Google Cloud Platform service that
  441. // created the log entry. For example, "us-central1".
  442. Region string `json:"region,omitempty"`
  443. // ServiceName: The API name of the Google Cloud Platform service that
  444. // created the log entry. For example, "compute.googleapis.com".
  445. ServiceName string `json:"serviceName,omitempty"`
  446. // Severity: The severity of the log entry.
  447. //
  448. // Possible values:
  449. // "DEFAULT" - This is the DEFAULT description
  450. // "DEBUG" - This is the DEBUG description
  451. // "INFO" - This is the INFO description
  452. // "NOTICE" - This is the NOTICE description
  453. // "WARNING" - This is the WARNING description
  454. // "ERROR" - This is the ERROR description
  455. // "CRITICAL" - This is the CRITICAL description
  456. // "ALERT" - This is the ALERT description
  457. // "EMERGENCY" (default) - This is the EMERGENCY description
  458. Severity string `json:"severity,omitempty"`
  459. // Timestamp: The time the event described by the log entry occurred.
  460. // Timestamps must be later than January 1, 1970.
  461. Timestamp string `json:"timestamp,omitempty"`
  462. // UserId: The fully-qualified email address of the authenticated user
  463. // that performed or requested the action represented by the log entry.
  464. // If the log entry does not apply to an action taken by an
  465. // authenticated user, then the field should be empty.
  466. UserId string `json:"userId,omitempty"`
  467. // Zone: The zone of the Google Cloud Platform service that created the
  468. // log entry. For example, "us-central1-a".
  469. Zone string `json:"zone,omitempty"`
  470. // ForceSendFields is a list of field names (e.g. "Labels") to
  471. // unconditionally include in API requests. By default, fields with
  472. // empty values are omitted from API requests. However, any non-pointer,
  473. // non-interface field appearing in ForceSendFields will be sent to the
  474. // server regardless of whether the field is empty or not. This may be
  475. // used to include empty fields in Patch requests.
  476. ForceSendFields []string `json:"-"`
  477. // NullFields is a list of field names (e.g. "Labels") to include in API
  478. // requests with the JSON null value. By default, fields with empty
  479. // values are omitted from API requests. However, any field with an
  480. // empty value appearing in NullFields will be sent to the server as
  481. // null. It is an error if a field in this list has a non-empty value.
  482. // This may be used to include null fields in Patch requests.
  483. NullFields []string `json:"-"`
  484. }
  485. func (s *LogEntryMetadata) MarshalJSON() ([]byte, error) {
  486. type NoMethod LogEntryMetadata
  487. raw := NoMethod(*s)
  488. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  489. }
  490. // LogError: A problem in a sink or the sink's configuration.
  491. type LogError struct {
  492. // Resource: The resource associated with the error. It may be different
  493. // from the sink destination. For example, the sink may point to a
  494. // BigQuery dataset, but the error may refer to a table resource inside
  495. // the dataset.
  496. Resource string `json:"resource,omitempty"`
  497. // Status: The description of the last error observed.
  498. Status *Status `json:"status,omitempty"`
  499. // TimeNanos: The last time the error was observed, in nanoseconds since
  500. // the Unix epoch.
  501. TimeNanos int64 `json:"timeNanos,omitempty,string"`
  502. // ForceSendFields is a list of field names (e.g. "Resource") to
  503. // unconditionally include in API requests. By default, fields with
  504. // empty values are omitted from API requests. However, any non-pointer,
  505. // non-interface field appearing in ForceSendFields will be sent to the
  506. // server regardless of whether the field is empty or not. This may be
  507. // used to include empty fields in Patch requests.
  508. ForceSendFields []string `json:"-"`
  509. // NullFields is a list of field names (e.g. "Resource") to include in
  510. // API requests with the JSON null value. By default, fields with empty
  511. // values are omitted from API requests. However, any field with an
  512. // empty value appearing in NullFields will be sent to the server as
  513. // null. It is an error if a field in this list has a non-empty value.
  514. // This may be used to include null fields in Patch requests.
  515. NullFields []string `json:"-"`
  516. }
  517. func (s *LogError) MarshalJSON() ([]byte, error) {
  518. type NoMethod LogError
  519. raw := NoMethod(*s)
  520. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  521. }
  522. // LogService: A log service object.
  523. type LogService struct {
  524. // IndexKeys: Label keys used when labeling log entries for this
  525. // service. The order of the keys is significant, with higher priority
  526. // keys coming earlier in the list.
  527. IndexKeys []string `json:"indexKeys,omitempty"`
  528. // Name: The service's name.
  529. Name string `json:"name,omitempty"`
  530. // ForceSendFields is a list of field names (e.g. "IndexKeys") to
  531. // unconditionally include in API requests. By default, fields with
  532. // empty values are omitted from API requests. However, any non-pointer,
  533. // non-interface field appearing in ForceSendFields will be sent to the
  534. // server regardless of whether the field is empty or not. This may be
  535. // used to include empty fields in Patch requests.
  536. ForceSendFields []string `json:"-"`
  537. // NullFields is a list of field names (e.g. "IndexKeys") to include in
  538. // API requests with the JSON null value. By default, fields with empty
  539. // values are omitted from API requests. However, any field with an
  540. // empty value appearing in NullFields will be sent to the server as
  541. // null. It is an error if a field in this list has a non-empty value.
  542. // This may be used to include null fields in Patch requests.
  543. NullFields []string `json:"-"`
  544. }
  545. func (s *LogService) MarshalJSON() ([]byte, error) {
  546. type NoMethod LogService
  547. raw := NoMethod(*s)
  548. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  549. }
  550. // LogSink: An object that describes where a log may be written.
  551. type LogSink struct {
  552. // Destination: The resource to send log entries to. The supported sink
  553. // resource types are: + Google Cloud Storage:
  554. // `storage.googleapis.com/BUCKET` or `BUCKET.storage.googleapis.com/` +
  555. // Google BigQuery:
  556. // `bigquery.googleapis.com/projects/PROJECT/datasets/DATASET` Currently
  557. // the Cloud Logging API supports at most one sink for each resource
  558. // type per log or log service resource.
  559. Destination string `json:"destination,omitempty"`
  560. // Errors: _Output only._ All active errors found for this sink.
  561. Errors []*LogError `json:"errors,omitempty"`
  562. // Name: The name of this sink. This is a client-assigned identifier for
  563. // the resource. This is ignored by UpdateLogSink and
  564. // UpdateLogServicesSink.
  565. Name string `json:"name,omitempty"`
  566. // ServerResponse contains the HTTP response code and headers from the
  567. // server.
  568. googleapi.ServerResponse `json:"-"`
  569. // ForceSendFields is a list of field names (e.g. "Destination") to
  570. // unconditionally include in API requests. By default, fields with
  571. // empty values are omitted from API requests. However, any non-pointer,
  572. // non-interface field appearing in ForceSendFields will be sent to the
  573. // server regardless of whether the field is empty or not. This may be
  574. // used to include empty fields in Patch requests.
  575. ForceSendFields []string `json:"-"`
  576. // NullFields is a list of field names (e.g. "Destination") to include
  577. // in API requests with the JSON null value. By default, fields with
  578. // empty values are omitted from API requests. However, any field with
  579. // an empty value appearing in NullFields will be sent to the server as
  580. // null. It is an error if a field in this list has a non-empty value.
  581. // This may be used to include null fields in Patch requests.
  582. NullFields []string `json:"-"`
  583. }
  584. func (s *LogSink) MarshalJSON() ([]byte, error) {
  585. type NoMethod LogSink
  586. raw := NoMethod(*s)
  587. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  588. }
  589. // Status: Represents the RPC error status for Google APIs. See
  590. // http://go/errormodel for details.
  591. type Status struct {
  592. // Code: The status code, which should be an enum value of
  593. // [google.rpc.Code][].
  594. Code int64 `json:"code,omitempty"`
  595. // Details: A list of messages that carry the error details. There will
  596. // be a common set of message types for APIs to use.
  597. Details []googleapi.RawMessage `json:"details,omitempty"`
  598. // Message: A developer-facing error message, which should be in
  599. // English. The user-facing error message should be localized and stored
  600. // in the [google.rpc.Status.details][google.rpc.Status.details] field.
  601. Message string `json:"message,omitempty"`
  602. // ForceSendFields is a list of field names (e.g. "Code") to
  603. // unconditionally include in API requests. By default, fields with
  604. // empty values are omitted from API requests. However, any non-pointer,
  605. // non-interface field appearing in ForceSendFields will be sent to the
  606. // server regardless of whether the field is empty or not. This may be
  607. // used to include empty fields in Patch requests.
  608. ForceSendFields []string `json:"-"`
  609. // NullFields is a list of field names (e.g. "Code") to include in API
  610. // requests with the JSON null value. By default, fields with empty
  611. // values are omitted from API requests. However, any field with an
  612. // empty value appearing in NullFields will be sent to the server as
  613. // null. It is an error if a field in this list has a non-empty value.
  614. // This may be used to include null fields in Patch requests.
  615. NullFields []string `json:"-"`
  616. }
  617. func (s *Status) MarshalJSON() ([]byte, error) {
  618. type NoMethod Status
  619. raw := NoMethod(*s)
  620. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  621. }
  622. // WriteLogEntriesRequest: The parameters to WriteLogEntries.
  623. type WriteLogEntriesRequest struct {
  624. // CommonLabels: Metadata labels that apply to all entries in this
  625. // request. If one of the log entries contains a (key, value) with the
  626. // same key that is in `commonLabels`, then the entry's (key, value)
  627. // overrides the one in `commonLabels`.
  628. CommonLabels map[string]string `json:"commonLabels,omitempty"`
  629. // Entries: Log entries to insert.
  630. Entries []*LogEntry `json:"entries,omitempty"`
  631. // ForceSendFields is a list of field names (e.g. "CommonLabels") to
  632. // unconditionally include in API requests. By default, fields with
  633. // empty values are omitted from API requests. However, any non-pointer,
  634. // non-interface field appearing in ForceSendFields will be sent to the
  635. // server regardless of whether the field is empty or not. This may be
  636. // used to include empty fields in Patch requests.
  637. ForceSendFields []string `json:"-"`
  638. // NullFields is a list of field names (e.g. "CommonLabels") to include
  639. // in API requests with the JSON null value. By default, fields with
  640. // empty values are omitted from API requests. However, any field with
  641. // an empty value appearing in NullFields will be sent to the server as
  642. // null. It is an error if a field in this list has a non-empty value.
  643. // This may be used to include null fields in Patch requests.
  644. NullFields []string `json:"-"`
  645. }
  646. func (s *WriteLogEntriesRequest) MarshalJSON() ([]byte, error) {
  647. type NoMethod WriteLogEntriesRequest
  648. raw := NoMethod(*s)
  649. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  650. }
  651. // WriteLogEntriesResponse: Result returned from WriteLogEntries. empty
  652. type WriteLogEntriesResponse struct {
  653. // ServerResponse contains the HTTP response code and headers from the
  654. // server.
  655. googleapi.ServerResponse `json:"-"`
  656. }
  657. // method id "logging.projects.logServices.list":
  658. type ProjectsLogServicesListCall struct {
  659. s *Service
  660. projectsId string
  661. urlParams_ gensupport.URLParams
  662. ifNoneMatch_ string
  663. ctx_ context.Context
  664. header_ http.Header
  665. }
  666. // List: Lists log services associated with log entries ingested for a
  667. // project.
  668. func (r *ProjectsLogServicesService) List(projectsId string) *ProjectsLogServicesListCall {
  669. c := &ProjectsLogServicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  670. c.projectsId = projectsId
  671. return c
  672. }
  673. // Log sets the optional parameter "log": The name of the log resource
  674. // whose services are to be listed. log for which to list services. When
  675. // empty, all services are listed.
  676. func (c *ProjectsLogServicesListCall) Log(log string) *ProjectsLogServicesListCall {
  677. c.urlParams_.Set("log", log)
  678. return c
  679. }
  680. // PageSize sets the optional parameter "pageSize": The maximum number
  681. // of `LogService` objects to return in one operation.
  682. func (c *ProjectsLogServicesListCall) PageSize(pageSize int64) *ProjectsLogServicesListCall {
  683. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  684. return c
  685. }
  686. // PageToken sets the optional parameter "pageToken": An opaque token,
  687. // returned as `nextPageToken` by a prior `ListLogServices` operation.
  688. // If `pageToken` is supplied, then the other fields of this request are
  689. // ignored, and instead the previous `ListLogServices` operation is
  690. // continued.
  691. func (c *ProjectsLogServicesListCall) PageToken(pageToken string) *ProjectsLogServicesListCall {
  692. c.urlParams_.Set("pageToken", pageToken)
  693. return c
  694. }
  695. // Fields allows partial responses to be retrieved. See
  696. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  697. // for more information.
  698. func (c *ProjectsLogServicesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesListCall {
  699. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  700. return c
  701. }
  702. // IfNoneMatch sets the optional parameter which makes the operation
  703. // fail if the object's ETag matches the given value. This is useful for
  704. // getting updates only after the object has changed since the last
  705. // request. Use googleapi.IsNotModified to check whether the response
  706. // error from Do is the result of In-None-Match.
  707. func (c *ProjectsLogServicesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesListCall {
  708. c.ifNoneMatch_ = entityTag
  709. return c
  710. }
  711. // Context sets the context to be used in this call's Do method. Any
  712. // pending HTTP request will be aborted if the provided context is
  713. // canceled.
  714. func (c *ProjectsLogServicesListCall) Context(ctx context.Context) *ProjectsLogServicesListCall {
  715. c.ctx_ = ctx
  716. return c
  717. }
  718. // Header returns an http.Header that can be modified by the caller to
  719. // add HTTP headers to the request.
  720. func (c *ProjectsLogServicesListCall) Header() http.Header {
  721. if c.header_ == nil {
  722. c.header_ = make(http.Header)
  723. }
  724. return c.header_
  725. }
  726. func (c *ProjectsLogServicesListCall) doRequest(alt string) (*http.Response, error) {
  727. reqHeaders := make(http.Header)
  728. for k, v := range c.header_ {
  729. reqHeaders[k] = v
  730. }
  731. reqHeaders.Set("User-Agent", c.s.userAgent())
  732. if c.ifNoneMatch_ != "" {
  733. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  734. }
  735. var body io.Reader = nil
  736. c.urlParams_.Set("alt", alt)
  737. c.urlParams_.Set("prettyPrint", "false")
  738. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices")
  739. urls += "?" + c.urlParams_.Encode()
  740. req, err := http.NewRequest("GET", urls, body)
  741. if err != nil {
  742. return nil, err
  743. }
  744. req.Header = reqHeaders
  745. googleapi.Expand(req.URL, map[string]string{
  746. "projectsId": c.projectsId,
  747. })
  748. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  749. }
  750. // Do executes the "logging.projects.logServices.list" call.
  751. // Exactly one of *ListLogServicesResponse or error will be non-nil. Any
  752. // non-2xx status code is an error. Response headers are in either
  753. // *ListLogServicesResponse.ServerResponse.Header or (if a response was
  754. // returned at all) in error.(*googleapi.Error).Header. Use
  755. // googleapi.IsNotModified to check whether the returned error was
  756. // because http.StatusNotModified was returned.
  757. func (c *ProjectsLogServicesListCall) Do(opts ...googleapi.CallOption) (*ListLogServicesResponse, error) {
  758. gensupport.SetOptions(c.urlParams_, opts...)
  759. res, err := c.doRequest("json")
  760. if res != nil && res.StatusCode == http.StatusNotModified {
  761. if res.Body != nil {
  762. res.Body.Close()
  763. }
  764. return nil, &googleapi.Error{
  765. Code: res.StatusCode,
  766. Header: res.Header,
  767. }
  768. }
  769. if err != nil {
  770. return nil, err
  771. }
  772. defer googleapi.CloseBody(res)
  773. if err := googleapi.CheckResponse(res); err != nil {
  774. return nil, err
  775. }
  776. ret := &ListLogServicesResponse{
  777. ServerResponse: googleapi.ServerResponse{
  778. Header: res.Header,
  779. HTTPStatusCode: res.StatusCode,
  780. },
  781. }
  782. target := &ret
  783. if err := gensupport.DecodeResponse(target, res); err != nil {
  784. return nil, err
  785. }
  786. return ret, nil
  787. // {
  788. // "description": "Lists log services associated with log entries ingested for a project.",
  789. // "httpMethod": "GET",
  790. // "id": "logging.projects.logServices.list",
  791. // "parameterOrder": [
  792. // "projectsId"
  793. // ],
  794. // "parameters": {
  795. // "log": {
  796. // "description": "The name of the log resource whose services are to be listed. log for which to list services. When empty, all services are listed.",
  797. // "location": "query",
  798. // "type": "string"
  799. // },
  800. // "pageSize": {
  801. // "description": "The maximum number of `LogService` objects to return in one operation.",
  802. // "format": "int32",
  803. // "location": "query",
  804. // "type": "integer"
  805. // },
  806. // "pageToken": {
  807. // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogServices` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogServices` operation is continued.",
  808. // "location": "query",
  809. // "type": "string"
  810. // },
  811. // "projectsId": {
  812. // "description": "Part of `projectName`. The project resource whose services are to be listed.",
  813. // "location": "path",
  814. // "required": true,
  815. // "type": "string"
  816. // }
  817. // },
  818. // "path": "v1beta3/projects/{projectsId}/logServices",
  819. // "response": {
  820. // "$ref": "ListLogServicesResponse"
  821. // },
  822. // "scopes": [
  823. // "https://www.googleapis.com/auth/cloud-platform"
  824. // ]
  825. // }
  826. }
  827. // Pages invokes f for each page of results.
  828. // A non-nil error returned from f will halt the iteration.
  829. // The provided context supersedes any context provided to the Context method.
  830. func (c *ProjectsLogServicesListCall) Pages(ctx context.Context, f func(*ListLogServicesResponse) error) error {
  831. c.ctx_ = ctx
  832. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  833. for {
  834. x, err := c.Do()
  835. if err != nil {
  836. return err
  837. }
  838. if err := f(x); err != nil {
  839. return err
  840. }
  841. if x.NextPageToken == "" {
  842. return nil
  843. }
  844. c.PageToken(x.NextPageToken)
  845. }
  846. }
  847. // method id "logging.projects.logServices.indexes.list":
  848. type ProjectsLogServicesIndexesListCall struct {
  849. s *Service
  850. projectsId string
  851. logServicesId string
  852. urlParams_ gensupport.URLParams
  853. ifNoneMatch_ string
  854. ctx_ context.Context
  855. header_ http.Header
  856. }
  857. // List: Lists log service indexes associated with a log service.
  858. func (r *ProjectsLogServicesIndexesService) List(projectsId string, logServicesId string) *ProjectsLogServicesIndexesListCall {
  859. c := &ProjectsLogServicesIndexesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  860. c.projectsId = projectsId
  861. c.logServicesId = logServicesId
  862. return c
  863. }
  864. // Depth sets the optional parameter "depth": A limit to the number of
  865. // levels of the index hierarchy that are expanded. If `depth` is 0, it
  866. // defaults to the level specified by the prefix field (the number of
  867. // slash separators). The default empty prefix implies a `depth` of 1.
  868. // It is an error for `depth` to be any non-zero value less than the
  869. // number of components in `indexPrefix`.
  870. func (c *ProjectsLogServicesIndexesListCall) Depth(depth int64) *ProjectsLogServicesIndexesListCall {
  871. c.urlParams_.Set("depth", fmt.Sprint(depth))
  872. return c
  873. }
  874. // IndexPrefix sets the optional parameter "indexPrefix": Restricts the
  875. // indexes returned to be those with a specified prefix. The prefix has
  876. // the form "/label_value/label_value/...", in order corresponding to
  877. // the [`LogService
  878. // indexKeys`][google.logging.v1.LogService.index_keys]. Non-empty
  879. // prefixes must begin with `/` . Example prefixes: + "/myModule/"
  880. // retrieves App Engine versions associated with `myModule`. The
  881. // trailing slash terminates the value. + "/myModule" retrieves App
  882. // Engine modules with names beginning with `myModule`. + "" retrieves
  883. // all indexes.
  884. func (c *ProjectsLogServicesIndexesListCall) IndexPrefix(indexPrefix string) *ProjectsLogServicesIndexesListCall {
  885. c.urlParams_.Set("indexPrefix", indexPrefix)
  886. return c
  887. }
  888. // Log sets the optional parameter "log": A log resource like
  889. // `/projects/project_id/logs/log_name`, identifying the log for which
  890. // to list service indexes.
  891. func (c *ProjectsLogServicesIndexesListCall) Log(log string) *ProjectsLogServicesIndexesListCall {
  892. c.urlParams_.Set("log", log)
  893. return c
  894. }
  895. // PageSize sets the optional parameter "pageSize": The maximum number
  896. // of log service index resources to return in one operation.
  897. func (c *ProjectsLogServicesIndexesListCall) PageSize(pageSize int64) *ProjectsLogServicesIndexesListCall {
  898. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  899. return c
  900. }
  901. // PageToken sets the optional parameter "pageToken": An opaque token,
  902. // returned as `nextPageToken` by a prior `ListLogServiceIndexes`
  903. // operation. If `pageToken` is supplied, then the other fields of this
  904. // request are ignored, and instead the previous `ListLogServiceIndexes`
  905. // operation is continued.
  906. func (c *ProjectsLogServicesIndexesListCall) PageToken(pageToken string) *ProjectsLogServicesIndexesListCall {
  907. c.urlParams_.Set("pageToken", pageToken)
  908. return c
  909. }
  910. // Fields allows partial responses to be retrieved. See
  911. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  912. // for more information.
  913. func (c *ProjectsLogServicesIndexesListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesIndexesListCall {
  914. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  915. return c
  916. }
  917. // IfNoneMatch sets the optional parameter which makes the operation
  918. // fail if the object's ETag matches the given value. This is useful for
  919. // getting updates only after the object has changed since the last
  920. // request. Use googleapi.IsNotModified to check whether the response
  921. // error from Do is the result of In-None-Match.
  922. func (c *ProjectsLogServicesIndexesListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesIndexesListCall {
  923. c.ifNoneMatch_ = entityTag
  924. return c
  925. }
  926. // Context sets the context to be used in this call's Do method. Any
  927. // pending HTTP request will be aborted if the provided context is
  928. // canceled.
  929. func (c *ProjectsLogServicesIndexesListCall) Context(ctx context.Context) *ProjectsLogServicesIndexesListCall {
  930. c.ctx_ = ctx
  931. return c
  932. }
  933. // Header returns an http.Header that can be modified by the caller to
  934. // add HTTP headers to the request.
  935. func (c *ProjectsLogServicesIndexesListCall) Header() http.Header {
  936. if c.header_ == nil {
  937. c.header_ = make(http.Header)
  938. }
  939. return c.header_
  940. }
  941. func (c *ProjectsLogServicesIndexesListCall) doRequest(alt string) (*http.Response, error) {
  942. reqHeaders := make(http.Header)
  943. for k, v := range c.header_ {
  944. reqHeaders[k] = v
  945. }
  946. reqHeaders.Set("User-Agent", c.s.userAgent())
  947. if c.ifNoneMatch_ != "" {
  948. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  949. }
  950. var body io.Reader = nil
  951. c.urlParams_.Set("alt", alt)
  952. c.urlParams_.Set("prettyPrint", "false")
  953. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/indexes")
  954. urls += "?" + c.urlParams_.Encode()
  955. req, err := http.NewRequest("GET", urls, body)
  956. if err != nil {
  957. return nil, err
  958. }
  959. req.Header = reqHeaders
  960. googleapi.Expand(req.URL, map[string]string{
  961. "projectsId": c.projectsId,
  962. "logServicesId": c.logServicesId,
  963. })
  964. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  965. }
  966. // Do executes the "logging.projects.logServices.indexes.list" call.
  967. // Exactly one of *ListLogServiceIndexesResponse or error will be
  968. // non-nil. Any non-2xx status code is an error. Response headers are in
  969. // either *ListLogServiceIndexesResponse.ServerResponse.Header or (if a
  970. // response was returned at all) in error.(*googleapi.Error).Header. Use
  971. // googleapi.IsNotModified to check whether the returned error was
  972. // because http.StatusNotModified was returned.
  973. func (c *ProjectsLogServicesIndexesListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceIndexesResponse, error) {
  974. gensupport.SetOptions(c.urlParams_, opts...)
  975. res, err := c.doRequest("json")
  976. if res != nil && res.StatusCode == http.StatusNotModified {
  977. if res.Body != nil {
  978. res.Body.Close()
  979. }
  980. return nil, &googleapi.Error{
  981. Code: res.StatusCode,
  982. Header: res.Header,
  983. }
  984. }
  985. if err != nil {
  986. return nil, err
  987. }
  988. defer googleapi.CloseBody(res)
  989. if err := googleapi.CheckResponse(res); err != nil {
  990. return nil, err
  991. }
  992. ret := &ListLogServiceIndexesResponse{
  993. ServerResponse: googleapi.ServerResponse{
  994. Header: res.Header,
  995. HTTPStatusCode: res.StatusCode,
  996. },
  997. }
  998. target := &ret
  999. if err := gensupport.DecodeResponse(target, res); err != nil {
  1000. return nil, err
  1001. }
  1002. return ret, nil
  1003. // {
  1004. // "description": "Lists log service indexes associated with a log service.",
  1005. // "httpMethod": "GET",
  1006. // "id": "logging.projects.logServices.indexes.list",
  1007. // "parameterOrder": [
  1008. // "projectsId",
  1009. // "logServicesId"
  1010. // ],
  1011. // "parameters": {
  1012. // "depth": {
  1013. // "description": "A limit to the number of levels of the index hierarchy that are expanded. If `depth` is 0, it defaults to the level specified by the prefix field (the number of slash separators). The default empty prefix implies a `depth` of 1. It is an error for `depth` to be any non-zero value less than the number of components in `indexPrefix`.",
  1014. // "format": "int32",
  1015. // "location": "query",
  1016. // "type": "integer"
  1017. // },
  1018. // "indexPrefix": {
  1019. // "description": "Restricts the indexes returned to be those with a specified prefix. The prefix has the form `\"/label_value/label_value/...\"`, in order corresponding to the [`LogService indexKeys`][google.logging.v1.LogService.index_keys]. Non-empty prefixes must begin with `/` . Example prefixes: + `\"/myModule/\"` retrieves App Engine versions associated with `myModule`. The trailing slash terminates the value. + `\"/myModule\"` retrieves App Engine modules with names beginning with `myModule`. + `\"\"` retrieves all indexes.",
  1020. // "location": "query",
  1021. // "type": "string"
  1022. // },
  1023. // "log": {
  1024. // "description": "A log resource like `/projects/project_id/logs/log_name`, identifying the log for which to list service indexes.",
  1025. // "location": "query",
  1026. // "type": "string"
  1027. // },
  1028. // "logServicesId": {
  1029. // "description": "Part of `serviceName`. See documentation of `projectsId`.",
  1030. // "location": "path",
  1031. // "required": true,
  1032. // "type": "string"
  1033. // },
  1034. // "pageSize": {
  1035. // "description": "The maximum number of log service index resources to return in one operation.",
  1036. // "format": "int32",
  1037. // "location": "query",
  1038. // "type": "integer"
  1039. // },
  1040. // "pageToken": {
  1041. // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogServiceIndexes` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogServiceIndexes` operation is continued.",
  1042. // "location": "query",
  1043. // "type": "string"
  1044. // },
  1045. // "projectsId": {
  1046. // "description": "Part of `serviceName`. A log service resource of the form `/projects/*/logServices/*`. The service indexes of the log service are returned. Example: `\"/projects/myProj/logServices/appengine.googleapis.com\"`.",
  1047. // "location": "path",
  1048. // "required": true,
  1049. // "type": "string"
  1050. // }
  1051. // },
  1052. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/indexes",
  1053. // "response": {
  1054. // "$ref": "ListLogServiceIndexesResponse"
  1055. // },
  1056. // "scopes": [
  1057. // "https://www.googleapis.com/auth/cloud-platform"
  1058. // ]
  1059. // }
  1060. }
  1061. // Pages invokes f for each page of results.
  1062. // A non-nil error returned from f will halt the iteration.
  1063. // The provided context supersedes any context provided to the Context method.
  1064. func (c *ProjectsLogServicesIndexesListCall) Pages(ctx context.Context, f func(*ListLogServiceIndexesResponse) error) error {
  1065. c.ctx_ = ctx
  1066. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1067. for {
  1068. x, err := c.Do()
  1069. if err != nil {
  1070. return err
  1071. }
  1072. if err := f(x); err != nil {
  1073. return err
  1074. }
  1075. if x.NextPageToken == "" {
  1076. return nil
  1077. }
  1078. c.PageToken(x.NextPageToken)
  1079. }
  1080. }
  1081. // method id "logging.projects.logServices.sinks.create":
  1082. type ProjectsLogServicesSinksCreateCall struct {
  1083. s *Service
  1084. projectsId string
  1085. logServicesId string
  1086. logsink *LogSink
  1087. urlParams_ gensupport.URLParams
  1088. ctx_ context.Context
  1089. header_ http.Header
  1090. }
  1091. // Create: Creates the specified log service sink resource.
  1092. func (r *ProjectsLogServicesSinksService) Create(projectsId string, logServicesId string, logsink *LogSink) *ProjectsLogServicesSinksCreateCall {
  1093. c := &ProjectsLogServicesSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1094. c.projectsId = projectsId
  1095. c.logServicesId = logServicesId
  1096. c.logsink = logsink
  1097. return c
  1098. }
  1099. // Fields allows partial responses to be retrieved. See
  1100. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1101. // for more information.
  1102. func (c *ProjectsLogServicesSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksCreateCall {
  1103. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1104. return c
  1105. }
  1106. // Context sets the context to be used in this call's Do method. Any
  1107. // pending HTTP request will be aborted if the provided context is
  1108. // canceled.
  1109. func (c *ProjectsLogServicesSinksCreateCall) Context(ctx context.Context) *ProjectsLogServicesSinksCreateCall {
  1110. c.ctx_ = ctx
  1111. return c
  1112. }
  1113. // Header returns an http.Header that can be modified by the caller to
  1114. // add HTTP headers to the request.
  1115. func (c *ProjectsLogServicesSinksCreateCall) Header() http.Header {
  1116. if c.header_ == nil {
  1117. c.header_ = make(http.Header)
  1118. }
  1119. return c.header_
  1120. }
  1121. func (c *ProjectsLogServicesSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  1122. reqHeaders := make(http.Header)
  1123. for k, v := range c.header_ {
  1124. reqHeaders[k] = v
  1125. }
  1126. reqHeaders.Set("User-Agent", c.s.userAgent())
  1127. var body io.Reader = nil
  1128. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  1129. if err != nil {
  1130. return nil, err
  1131. }
  1132. reqHeaders.Set("Content-Type", "application/json")
  1133. c.urlParams_.Set("alt", alt)
  1134. c.urlParams_.Set("prettyPrint", "false")
  1135. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks")
  1136. urls += "?" + c.urlParams_.Encode()
  1137. req, err := http.NewRequest("POST", urls, body)
  1138. if err != nil {
  1139. return nil, err
  1140. }
  1141. req.Header = reqHeaders
  1142. googleapi.Expand(req.URL, map[string]string{
  1143. "projectsId": c.projectsId,
  1144. "logServicesId": c.logServicesId,
  1145. })
  1146. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1147. }
  1148. // Do executes the "logging.projects.logServices.sinks.create" call.
  1149. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  1150. // code is an error. Response headers are in either
  1151. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  1152. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1153. // check whether the returned error was because http.StatusNotModified
  1154. // was returned.
  1155. func (c *ProjectsLogServicesSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  1156. gensupport.SetOptions(c.urlParams_, opts...)
  1157. res, err := c.doRequest("json")
  1158. if res != nil && res.StatusCode == http.StatusNotModified {
  1159. if res.Body != nil {
  1160. res.Body.Close()
  1161. }
  1162. return nil, &googleapi.Error{
  1163. Code: res.StatusCode,
  1164. Header: res.Header,
  1165. }
  1166. }
  1167. if err != nil {
  1168. return nil, err
  1169. }
  1170. defer googleapi.CloseBody(res)
  1171. if err := googleapi.CheckResponse(res); err != nil {
  1172. return nil, err
  1173. }
  1174. ret := &LogSink{
  1175. ServerResponse: googleapi.ServerResponse{
  1176. Header: res.Header,
  1177. HTTPStatusCode: res.StatusCode,
  1178. },
  1179. }
  1180. target := &ret
  1181. if err := gensupport.DecodeResponse(target, res); err != nil {
  1182. return nil, err
  1183. }
  1184. return ret, nil
  1185. // {
  1186. // "description": "Creates the specified log service sink resource.",
  1187. // "httpMethod": "POST",
  1188. // "id": "logging.projects.logServices.sinks.create",
  1189. // "parameterOrder": [
  1190. // "projectsId",
  1191. // "logServicesId"
  1192. // ],
  1193. // "parameters": {
  1194. // "logServicesId": {
  1195. // "description": "Part of `serviceName`. See documentation of `projectsId`.",
  1196. // "location": "path",
  1197. // "required": true,
  1198. // "type": "string"
  1199. // },
  1200. // "projectsId": {
  1201. // "description": "Part of `serviceName`. The name of the service in which to create a sink.",
  1202. // "location": "path",
  1203. // "required": true,
  1204. // "type": "string"
  1205. // }
  1206. // },
  1207. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks",
  1208. // "request": {
  1209. // "$ref": "LogSink"
  1210. // },
  1211. // "response": {
  1212. // "$ref": "LogSink"
  1213. // },
  1214. // "scopes": [
  1215. // "https://www.googleapis.com/auth/cloud-platform"
  1216. // ]
  1217. // }
  1218. }
  1219. // method id "logging.projects.logServices.sinks.delete":
  1220. type ProjectsLogServicesSinksDeleteCall struct {
  1221. s *Service
  1222. projectsId string
  1223. logServicesId string
  1224. sinksId string
  1225. urlParams_ gensupport.URLParams
  1226. ctx_ context.Context
  1227. header_ http.Header
  1228. }
  1229. // Delete: Deletes the specified log service sink.
  1230. func (r *ProjectsLogServicesSinksService) Delete(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksDeleteCall {
  1231. c := &ProjectsLogServicesSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1232. c.projectsId = projectsId
  1233. c.logServicesId = logServicesId
  1234. c.sinksId = sinksId
  1235. return c
  1236. }
  1237. // Fields allows partial responses to be retrieved. See
  1238. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1239. // for more information.
  1240. func (c *ProjectsLogServicesSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksDeleteCall {
  1241. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1242. return c
  1243. }
  1244. // Context sets the context to be used in this call's Do method. Any
  1245. // pending HTTP request will be aborted if the provided context is
  1246. // canceled.
  1247. func (c *ProjectsLogServicesSinksDeleteCall) Context(ctx context.Context) *ProjectsLogServicesSinksDeleteCall {
  1248. c.ctx_ = ctx
  1249. return c
  1250. }
  1251. // Header returns an http.Header that can be modified by the caller to
  1252. // add HTTP headers to the request.
  1253. func (c *ProjectsLogServicesSinksDeleteCall) Header() http.Header {
  1254. if c.header_ == nil {
  1255. c.header_ = make(http.Header)
  1256. }
  1257. return c.header_
  1258. }
  1259. func (c *ProjectsLogServicesSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  1260. reqHeaders := make(http.Header)
  1261. for k, v := range c.header_ {
  1262. reqHeaders[k] = v
  1263. }
  1264. reqHeaders.Set("User-Agent", c.s.userAgent())
  1265. var body io.Reader = nil
  1266. c.urlParams_.Set("alt", alt)
  1267. c.urlParams_.Set("prettyPrint", "false")
  1268. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
  1269. urls += "?" + c.urlParams_.Encode()
  1270. req, err := http.NewRequest("DELETE", urls, body)
  1271. if err != nil {
  1272. return nil, err
  1273. }
  1274. req.Header = reqHeaders
  1275. googleapi.Expand(req.URL, map[string]string{
  1276. "projectsId": c.projectsId,
  1277. "logServicesId": c.logServicesId,
  1278. "sinksId": c.sinksId,
  1279. })
  1280. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1281. }
  1282. // Do executes the "logging.projects.logServices.sinks.delete" call.
  1283. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1284. // code is an error. Response headers are in either
  1285. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1286. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1287. // check whether the returned error was because http.StatusNotModified
  1288. // was returned.
  1289. func (c *ProjectsLogServicesSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1290. gensupport.SetOptions(c.urlParams_, opts...)
  1291. res, err := c.doRequest("json")
  1292. if res != nil && res.StatusCode == http.StatusNotModified {
  1293. if res.Body != nil {
  1294. res.Body.Close()
  1295. }
  1296. return nil, &googleapi.Error{
  1297. Code: res.StatusCode,
  1298. Header: res.Header,
  1299. }
  1300. }
  1301. if err != nil {
  1302. return nil, err
  1303. }
  1304. defer googleapi.CloseBody(res)
  1305. if err := googleapi.CheckResponse(res); err != nil {
  1306. return nil, err
  1307. }
  1308. ret := &Empty{
  1309. ServerResponse: googleapi.ServerResponse{
  1310. Header: res.Header,
  1311. HTTPStatusCode: res.StatusCode,
  1312. },
  1313. }
  1314. target := &ret
  1315. if err := gensupport.DecodeResponse(target, res); err != nil {
  1316. return nil, err
  1317. }
  1318. return ret, nil
  1319. // {
  1320. // "description": "Deletes the specified log service sink.",
  1321. // "httpMethod": "DELETE",
  1322. // "id": "logging.projects.logServices.sinks.delete",
  1323. // "parameterOrder": [
  1324. // "projectsId",
  1325. // "logServicesId",
  1326. // "sinksId"
  1327. // ],
  1328. // "parameters": {
  1329. // "logServicesId": {
  1330. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1331. // "location": "path",
  1332. // "required": true,
  1333. // "type": "string"
  1334. // },
  1335. // "projectsId": {
  1336. // "description": "Part of `sinkName`. The name of the sink to delete.",
  1337. // "location": "path",
  1338. // "required": true,
  1339. // "type": "string"
  1340. // },
  1341. // "sinksId": {
  1342. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1343. // "location": "path",
  1344. // "required": true,
  1345. // "type": "string"
  1346. // }
  1347. // },
  1348. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}",
  1349. // "response": {
  1350. // "$ref": "Empty"
  1351. // },
  1352. // "scopes": [
  1353. // "https://www.googleapis.com/auth/cloud-platform"
  1354. // ]
  1355. // }
  1356. }
  1357. // method id "logging.projects.logServices.sinks.get":
  1358. type ProjectsLogServicesSinksGetCall struct {
  1359. s *Service
  1360. projectsId string
  1361. logServicesId string
  1362. sinksId string
  1363. urlParams_ gensupport.URLParams
  1364. ifNoneMatch_ string
  1365. ctx_ context.Context
  1366. header_ http.Header
  1367. }
  1368. // Get: Gets the specified log service sink resource.
  1369. func (r *ProjectsLogServicesSinksService) Get(projectsId string, logServicesId string, sinksId string) *ProjectsLogServicesSinksGetCall {
  1370. c := &ProjectsLogServicesSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1371. c.projectsId = projectsId
  1372. c.logServicesId = logServicesId
  1373. c.sinksId = sinksId
  1374. return c
  1375. }
  1376. // Fields allows partial responses to be retrieved. See
  1377. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1378. // for more information.
  1379. func (c *ProjectsLogServicesSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksGetCall {
  1380. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1381. return c
  1382. }
  1383. // IfNoneMatch sets the optional parameter which makes the operation
  1384. // fail if the object's ETag matches the given value. This is useful for
  1385. // getting updates only after the object has changed since the last
  1386. // request. Use googleapi.IsNotModified to check whether the response
  1387. // error from Do is the result of In-None-Match.
  1388. func (c *ProjectsLogServicesSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksGetCall {
  1389. c.ifNoneMatch_ = entityTag
  1390. return c
  1391. }
  1392. // Context sets the context to be used in this call's Do method. Any
  1393. // pending HTTP request will be aborted if the provided context is
  1394. // canceled.
  1395. func (c *ProjectsLogServicesSinksGetCall) Context(ctx context.Context) *ProjectsLogServicesSinksGetCall {
  1396. c.ctx_ = ctx
  1397. return c
  1398. }
  1399. // Header returns an http.Header that can be modified by the caller to
  1400. // add HTTP headers to the request.
  1401. func (c *ProjectsLogServicesSinksGetCall) Header() http.Header {
  1402. if c.header_ == nil {
  1403. c.header_ = make(http.Header)
  1404. }
  1405. return c.header_
  1406. }
  1407. func (c *ProjectsLogServicesSinksGetCall) doRequest(alt string) (*http.Response, error) {
  1408. reqHeaders := make(http.Header)
  1409. for k, v := range c.header_ {
  1410. reqHeaders[k] = v
  1411. }
  1412. reqHeaders.Set("User-Agent", c.s.userAgent())
  1413. if c.ifNoneMatch_ != "" {
  1414. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1415. }
  1416. var body io.Reader = nil
  1417. c.urlParams_.Set("alt", alt)
  1418. c.urlParams_.Set("prettyPrint", "false")
  1419. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
  1420. urls += "?" + c.urlParams_.Encode()
  1421. req, err := http.NewRequest("GET", urls, body)
  1422. if err != nil {
  1423. return nil, err
  1424. }
  1425. req.Header = reqHeaders
  1426. googleapi.Expand(req.URL, map[string]string{
  1427. "projectsId": c.projectsId,
  1428. "logServicesId": c.logServicesId,
  1429. "sinksId": c.sinksId,
  1430. })
  1431. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1432. }
  1433. // Do executes the "logging.projects.logServices.sinks.get" call.
  1434. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  1435. // code is an error. Response headers are in either
  1436. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  1437. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1438. // check whether the returned error was because http.StatusNotModified
  1439. // was returned.
  1440. func (c *ProjectsLogServicesSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  1441. gensupport.SetOptions(c.urlParams_, opts...)
  1442. res, err := c.doRequest("json")
  1443. if res != nil && res.StatusCode == http.StatusNotModified {
  1444. if res.Body != nil {
  1445. res.Body.Close()
  1446. }
  1447. return nil, &googleapi.Error{
  1448. Code: res.StatusCode,
  1449. Header: res.Header,
  1450. }
  1451. }
  1452. if err != nil {
  1453. return nil, err
  1454. }
  1455. defer googleapi.CloseBody(res)
  1456. if err := googleapi.CheckResponse(res); err != nil {
  1457. return nil, err
  1458. }
  1459. ret := &LogSink{
  1460. ServerResponse: googleapi.ServerResponse{
  1461. Header: res.Header,
  1462. HTTPStatusCode: res.StatusCode,
  1463. },
  1464. }
  1465. target := &ret
  1466. if err := gensupport.DecodeResponse(target, res); err != nil {
  1467. return nil, err
  1468. }
  1469. return ret, nil
  1470. // {
  1471. // "description": "Gets the specified log service sink resource.",
  1472. // "httpMethod": "GET",
  1473. // "id": "logging.projects.logServices.sinks.get",
  1474. // "parameterOrder": [
  1475. // "projectsId",
  1476. // "logServicesId",
  1477. // "sinksId"
  1478. // ],
  1479. // "parameters": {
  1480. // "logServicesId": {
  1481. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1482. // "location": "path",
  1483. // "required": true,
  1484. // "type": "string"
  1485. // },
  1486. // "projectsId": {
  1487. // "description": "Part of `sinkName`. The name of the sink to return.",
  1488. // "location": "path",
  1489. // "required": true,
  1490. // "type": "string"
  1491. // },
  1492. // "sinksId": {
  1493. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1494. // "location": "path",
  1495. // "required": true,
  1496. // "type": "string"
  1497. // }
  1498. // },
  1499. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}",
  1500. // "response": {
  1501. // "$ref": "LogSink"
  1502. // },
  1503. // "scopes": [
  1504. // "https://www.googleapis.com/auth/cloud-platform"
  1505. // ]
  1506. // }
  1507. }
  1508. // method id "logging.projects.logServices.sinks.list":
  1509. type ProjectsLogServicesSinksListCall struct {
  1510. s *Service
  1511. projectsId string
  1512. logServicesId string
  1513. urlParams_ gensupport.URLParams
  1514. ifNoneMatch_ string
  1515. ctx_ context.Context
  1516. header_ http.Header
  1517. }
  1518. // List: Lists log service sinks associated with the specified service.
  1519. func (r *ProjectsLogServicesSinksService) List(projectsId string, logServicesId string) *ProjectsLogServicesSinksListCall {
  1520. c := &ProjectsLogServicesSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1521. c.projectsId = projectsId
  1522. c.logServicesId = logServicesId
  1523. return c
  1524. }
  1525. // Fields allows partial responses to be retrieved. See
  1526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1527. // for more information.
  1528. func (c *ProjectsLogServicesSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksListCall {
  1529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1530. return c
  1531. }
  1532. // IfNoneMatch sets the optional parameter which makes the operation
  1533. // fail if the object's ETag matches the given value. This is useful for
  1534. // getting updates only after the object has changed since the last
  1535. // request. Use googleapi.IsNotModified to check whether the response
  1536. // error from Do is the result of In-None-Match.
  1537. func (c *ProjectsLogServicesSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogServicesSinksListCall {
  1538. c.ifNoneMatch_ = entityTag
  1539. return c
  1540. }
  1541. // Context sets the context to be used in this call's Do method. Any
  1542. // pending HTTP request will be aborted if the provided context is
  1543. // canceled.
  1544. func (c *ProjectsLogServicesSinksListCall) Context(ctx context.Context) *ProjectsLogServicesSinksListCall {
  1545. c.ctx_ = ctx
  1546. return c
  1547. }
  1548. // Header returns an http.Header that can be modified by the caller to
  1549. // add HTTP headers to the request.
  1550. func (c *ProjectsLogServicesSinksListCall) Header() http.Header {
  1551. if c.header_ == nil {
  1552. c.header_ = make(http.Header)
  1553. }
  1554. return c.header_
  1555. }
  1556. func (c *ProjectsLogServicesSinksListCall) doRequest(alt string) (*http.Response, error) {
  1557. reqHeaders := make(http.Header)
  1558. for k, v := range c.header_ {
  1559. reqHeaders[k] = v
  1560. }
  1561. reqHeaders.Set("User-Agent", c.s.userAgent())
  1562. if c.ifNoneMatch_ != "" {
  1563. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1564. }
  1565. var body io.Reader = nil
  1566. c.urlParams_.Set("alt", alt)
  1567. c.urlParams_.Set("prettyPrint", "false")
  1568. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks")
  1569. urls += "?" + c.urlParams_.Encode()
  1570. req, err := http.NewRequest("GET", urls, body)
  1571. if err != nil {
  1572. return nil, err
  1573. }
  1574. req.Header = reqHeaders
  1575. googleapi.Expand(req.URL, map[string]string{
  1576. "projectsId": c.projectsId,
  1577. "logServicesId": c.logServicesId,
  1578. })
  1579. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1580. }
  1581. // Do executes the "logging.projects.logServices.sinks.list" call.
  1582. // Exactly one of *ListLogServiceSinksResponse or error will be non-nil.
  1583. // Any non-2xx status code is an error. Response headers are in either
  1584. // *ListLogServiceSinksResponse.ServerResponse.Header or (if a response
  1585. // was returned at all) in error.(*googleapi.Error).Header. Use
  1586. // googleapi.IsNotModified to check whether the returned error was
  1587. // because http.StatusNotModified was returned.
  1588. func (c *ProjectsLogServicesSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogServiceSinksResponse, error) {
  1589. gensupport.SetOptions(c.urlParams_, opts...)
  1590. res, err := c.doRequest("json")
  1591. if res != nil && res.StatusCode == http.StatusNotModified {
  1592. if res.Body != nil {
  1593. res.Body.Close()
  1594. }
  1595. return nil, &googleapi.Error{
  1596. Code: res.StatusCode,
  1597. Header: res.Header,
  1598. }
  1599. }
  1600. if err != nil {
  1601. return nil, err
  1602. }
  1603. defer googleapi.CloseBody(res)
  1604. if err := googleapi.CheckResponse(res); err != nil {
  1605. return nil, err
  1606. }
  1607. ret := &ListLogServiceSinksResponse{
  1608. ServerResponse: googleapi.ServerResponse{
  1609. Header: res.Header,
  1610. HTTPStatusCode: res.StatusCode,
  1611. },
  1612. }
  1613. target := &ret
  1614. if err := gensupport.DecodeResponse(target, res); err != nil {
  1615. return nil, err
  1616. }
  1617. return ret, nil
  1618. // {
  1619. // "description": "Lists log service sinks associated with the specified service.",
  1620. // "httpMethod": "GET",
  1621. // "id": "logging.projects.logServices.sinks.list",
  1622. // "parameterOrder": [
  1623. // "projectsId",
  1624. // "logServicesId"
  1625. // ],
  1626. // "parameters": {
  1627. // "logServicesId": {
  1628. // "description": "Part of `serviceName`. See documentation of `projectsId`.",
  1629. // "location": "path",
  1630. // "required": true,
  1631. // "type": "string"
  1632. // },
  1633. // "projectsId": {
  1634. // "description": "Part of `serviceName`. The name of the service for which to list sinks.",
  1635. // "location": "path",
  1636. // "required": true,
  1637. // "type": "string"
  1638. // }
  1639. // },
  1640. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks",
  1641. // "response": {
  1642. // "$ref": "ListLogServiceSinksResponse"
  1643. // },
  1644. // "scopes": [
  1645. // "https://www.googleapis.com/auth/cloud-platform"
  1646. // ]
  1647. // }
  1648. }
  1649. // method id "logging.projects.logServices.sinks.update":
  1650. type ProjectsLogServicesSinksUpdateCall struct {
  1651. s *Service
  1652. projectsId string
  1653. logServicesId string
  1654. sinksId string
  1655. logsink *LogSink
  1656. urlParams_ gensupport.URLParams
  1657. ctx_ context.Context
  1658. header_ http.Header
  1659. }
  1660. // Update: Creates or update the specified log service sink resource.
  1661. func (r *ProjectsLogServicesSinksService) Update(projectsId string, logServicesId string, sinksId string, logsink *LogSink) *ProjectsLogServicesSinksUpdateCall {
  1662. c := &ProjectsLogServicesSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1663. c.projectsId = projectsId
  1664. c.logServicesId = logServicesId
  1665. c.sinksId = sinksId
  1666. c.logsink = logsink
  1667. return c
  1668. }
  1669. // Fields allows partial responses to be retrieved. See
  1670. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1671. // for more information.
  1672. func (c *ProjectsLogServicesSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogServicesSinksUpdateCall {
  1673. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1674. return c
  1675. }
  1676. // Context sets the context to be used in this call's Do method. Any
  1677. // pending HTTP request will be aborted if the provided context is
  1678. // canceled.
  1679. func (c *ProjectsLogServicesSinksUpdateCall) Context(ctx context.Context) *ProjectsLogServicesSinksUpdateCall {
  1680. c.ctx_ = ctx
  1681. return c
  1682. }
  1683. // Header returns an http.Header that can be modified by the caller to
  1684. // add HTTP headers to the request.
  1685. func (c *ProjectsLogServicesSinksUpdateCall) Header() http.Header {
  1686. if c.header_ == nil {
  1687. c.header_ = make(http.Header)
  1688. }
  1689. return c.header_
  1690. }
  1691. func (c *ProjectsLogServicesSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  1692. reqHeaders := make(http.Header)
  1693. for k, v := range c.header_ {
  1694. reqHeaders[k] = v
  1695. }
  1696. reqHeaders.Set("User-Agent", c.s.userAgent())
  1697. var body io.Reader = nil
  1698. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  1699. if err != nil {
  1700. return nil, err
  1701. }
  1702. reqHeaders.Set("Content-Type", "application/json")
  1703. c.urlParams_.Set("alt", alt)
  1704. c.urlParams_.Set("prettyPrint", "false")
  1705. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}")
  1706. urls += "?" + c.urlParams_.Encode()
  1707. req, err := http.NewRequest("PUT", urls, body)
  1708. if err != nil {
  1709. return nil, err
  1710. }
  1711. req.Header = reqHeaders
  1712. googleapi.Expand(req.URL, map[string]string{
  1713. "projectsId": c.projectsId,
  1714. "logServicesId": c.logServicesId,
  1715. "sinksId": c.sinksId,
  1716. })
  1717. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1718. }
  1719. // Do executes the "logging.projects.logServices.sinks.update" call.
  1720. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  1721. // code is an error. Response headers are in either
  1722. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  1723. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1724. // check whether the returned error was because http.StatusNotModified
  1725. // was returned.
  1726. func (c *ProjectsLogServicesSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  1727. gensupport.SetOptions(c.urlParams_, opts...)
  1728. res, err := c.doRequest("json")
  1729. if res != nil && res.StatusCode == http.StatusNotModified {
  1730. if res.Body != nil {
  1731. res.Body.Close()
  1732. }
  1733. return nil, &googleapi.Error{
  1734. Code: res.StatusCode,
  1735. Header: res.Header,
  1736. }
  1737. }
  1738. if err != nil {
  1739. return nil, err
  1740. }
  1741. defer googleapi.CloseBody(res)
  1742. if err := googleapi.CheckResponse(res); err != nil {
  1743. return nil, err
  1744. }
  1745. ret := &LogSink{
  1746. ServerResponse: googleapi.ServerResponse{
  1747. Header: res.Header,
  1748. HTTPStatusCode: res.StatusCode,
  1749. },
  1750. }
  1751. target := &ret
  1752. if err := gensupport.DecodeResponse(target, res); err != nil {
  1753. return nil, err
  1754. }
  1755. return ret, nil
  1756. // {
  1757. // "description": "Creates or update the specified log service sink resource.",
  1758. // "httpMethod": "PUT",
  1759. // "id": "logging.projects.logServices.sinks.update",
  1760. // "parameterOrder": [
  1761. // "projectsId",
  1762. // "logServicesId",
  1763. // "sinksId"
  1764. // ],
  1765. // "parameters": {
  1766. // "logServicesId": {
  1767. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1768. // "location": "path",
  1769. // "required": true,
  1770. // "type": "string"
  1771. // },
  1772. // "projectsId": {
  1773. // "description": "Part of `sinkName`. The name of the sink to update.",
  1774. // "location": "path",
  1775. // "required": true,
  1776. // "type": "string"
  1777. // },
  1778. // "sinksId": {
  1779. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  1780. // "location": "path",
  1781. // "required": true,
  1782. // "type": "string"
  1783. // }
  1784. // },
  1785. // "path": "v1beta3/projects/{projectsId}/logServices/{logServicesId}/sinks/{sinksId}",
  1786. // "request": {
  1787. // "$ref": "LogSink"
  1788. // },
  1789. // "response": {
  1790. // "$ref": "LogSink"
  1791. // },
  1792. // "scopes": [
  1793. // "https://www.googleapis.com/auth/cloud-platform"
  1794. // ]
  1795. // }
  1796. }
  1797. // method id "logging.projects.logs.delete":
  1798. type ProjectsLogsDeleteCall struct {
  1799. s *Service
  1800. projectsId string
  1801. logsId string
  1802. urlParams_ gensupport.URLParams
  1803. ctx_ context.Context
  1804. header_ http.Header
  1805. }
  1806. // Delete: Deletes the specified log resource and all log entries
  1807. // contained in it.
  1808. func (r *ProjectsLogsService) Delete(projectsId string, logsId string) *ProjectsLogsDeleteCall {
  1809. c := &ProjectsLogsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1810. c.projectsId = projectsId
  1811. c.logsId = logsId
  1812. return c
  1813. }
  1814. // Fields allows partial responses to be retrieved. See
  1815. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1816. // for more information.
  1817. func (c *ProjectsLogsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsDeleteCall {
  1818. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1819. return c
  1820. }
  1821. // Context sets the context to be used in this call's Do method. Any
  1822. // pending HTTP request will be aborted if the provided context is
  1823. // canceled.
  1824. func (c *ProjectsLogsDeleteCall) Context(ctx context.Context) *ProjectsLogsDeleteCall {
  1825. c.ctx_ = ctx
  1826. return c
  1827. }
  1828. // Header returns an http.Header that can be modified by the caller to
  1829. // add HTTP headers to the request.
  1830. func (c *ProjectsLogsDeleteCall) Header() http.Header {
  1831. if c.header_ == nil {
  1832. c.header_ = make(http.Header)
  1833. }
  1834. return c.header_
  1835. }
  1836. func (c *ProjectsLogsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1837. reqHeaders := make(http.Header)
  1838. for k, v := range c.header_ {
  1839. reqHeaders[k] = v
  1840. }
  1841. reqHeaders.Set("User-Agent", c.s.userAgent())
  1842. var body io.Reader = nil
  1843. c.urlParams_.Set("alt", alt)
  1844. c.urlParams_.Set("prettyPrint", "false")
  1845. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}")
  1846. urls += "?" + c.urlParams_.Encode()
  1847. req, err := http.NewRequest("DELETE", urls, body)
  1848. if err != nil {
  1849. return nil, err
  1850. }
  1851. req.Header = reqHeaders
  1852. googleapi.Expand(req.URL, map[string]string{
  1853. "projectsId": c.projectsId,
  1854. "logsId": c.logsId,
  1855. })
  1856. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1857. }
  1858. // Do executes the "logging.projects.logs.delete" call.
  1859. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1860. // code is an error. Response headers are in either
  1861. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1862. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1863. // check whether the returned error was because http.StatusNotModified
  1864. // was returned.
  1865. func (c *ProjectsLogsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1866. gensupport.SetOptions(c.urlParams_, opts...)
  1867. res, err := c.doRequest("json")
  1868. if res != nil && res.StatusCode == http.StatusNotModified {
  1869. if res.Body != nil {
  1870. res.Body.Close()
  1871. }
  1872. return nil, &googleapi.Error{
  1873. Code: res.StatusCode,
  1874. Header: res.Header,
  1875. }
  1876. }
  1877. if err != nil {
  1878. return nil, err
  1879. }
  1880. defer googleapi.CloseBody(res)
  1881. if err := googleapi.CheckResponse(res); err != nil {
  1882. return nil, err
  1883. }
  1884. ret := &Empty{
  1885. ServerResponse: googleapi.ServerResponse{
  1886. Header: res.Header,
  1887. HTTPStatusCode: res.StatusCode,
  1888. },
  1889. }
  1890. target := &ret
  1891. if err := gensupport.DecodeResponse(target, res); err != nil {
  1892. return nil, err
  1893. }
  1894. return ret, nil
  1895. // {
  1896. // "description": "Deletes the specified log resource and all log entries contained in it.",
  1897. // "httpMethod": "DELETE",
  1898. // "id": "logging.projects.logs.delete",
  1899. // "parameterOrder": [
  1900. // "projectsId",
  1901. // "logsId"
  1902. // ],
  1903. // "parameters": {
  1904. // "logsId": {
  1905. // "description": "Part of `logName`. See documentation of `projectsId`.",
  1906. // "location": "path",
  1907. // "required": true,
  1908. // "type": "string"
  1909. // },
  1910. // "projectsId": {
  1911. // "description": "Part of `logName`. The log resource to delete.",
  1912. // "location": "path",
  1913. // "required": true,
  1914. // "type": "string"
  1915. // }
  1916. // },
  1917. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}",
  1918. // "response": {
  1919. // "$ref": "Empty"
  1920. // },
  1921. // "scopes": [
  1922. // "https://www.googleapis.com/auth/cloud-platform"
  1923. // ]
  1924. // }
  1925. }
  1926. // method id "logging.projects.logs.list":
  1927. type ProjectsLogsListCall struct {
  1928. s *Service
  1929. projectsId string
  1930. urlParams_ gensupport.URLParams
  1931. ifNoneMatch_ string
  1932. ctx_ context.Context
  1933. header_ http.Header
  1934. }
  1935. // List: Lists log resources belonging to the specified project.
  1936. func (r *ProjectsLogsService) List(projectsId string) *ProjectsLogsListCall {
  1937. c := &ProjectsLogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1938. c.projectsId = projectsId
  1939. return c
  1940. }
  1941. // PageSize sets the optional parameter "pageSize": The maximum number
  1942. // of results to return.
  1943. func (c *ProjectsLogsListCall) PageSize(pageSize int64) *ProjectsLogsListCall {
  1944. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1945. return c
  1946. }
  1947. // PageToken sets the optional parameter "pageToken": An opaque token,
  1948. // returned as `nextPageToken` by a prior `ListLogs` operation. If
  1949. // `pageToken` is supplied, then the other fields of this request are
  1950. // ignored, and instead the previous `ListLogs` operation is continued.
  1951. func (c *ProjectsLogsListCall) PageToken(pageToken string) *ProjectsLogsListCall {
  1952. c.urlParams_.Set("pageToken", pageToken)
  1953. return c
  1954. }
  1955. // ServiceIndexPrefix sets the optional parameter "serviceIndexPrefix":
  1956. // A log service index prefix for which to list logs. Only logs
  1957. // containing entries whose metadata that includes these label values
  1958. // (associated with index keys) are returned. The prefix is a slash
  1959. // separated list of values, and need not specify all index labels. An
  1960. // empty index (or a single slash) matches all log service indexes.
  1961. func (c *ProjectsLogsListCall) ServiceIndexPrefix(serviceIndexPrefix string) *ProjectsLogsListCall {
  1962. c.urlParams_.Set("serviceIndexPrefix", serviceIndexPrefix)
  1963. return c
  1964. }
  1965. // ServiceName sets the optional parameter "serviceName": A service name
  1966. // for which to list logs. Only logs containing entries whose metadata
  1967. // includes this service name are returned. If `serviceName` and
  1968. // `serviceIndexPrefix` are both empty, then all log names are returned.
  1969. // To list all log names, regardless of service, leave both the
  1970. // `serviceName` and `serviceIndexPrefix` empty. To list log names
  1971. // containing entries with a particular service name (or explicitly
  1972. // empty service name) set `serviceName` to the desired value and
  1973. // `serviceIndexPrefix` to "/".
  1974. func (c *ProjectsLogsListCall) ServiceName(serviceName string) *ProjectsLogsListCall {
  1975. c.urlParams_.Set("serviceName", serviceName)
  1976. return c
  1977. }
  1978. // Fields allows partial responses to be retrieved. See
  1979. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1980. // for more information.
  1981. func (c *ProjectsLogsListCall) Fields(s ...googleapi.Field) *ProjectsLogsListCall {
  1982. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1983. return c
  1984. }
  1985. // IfNoneMatch sets the optional parameter which makes the operation
  1986. // fail if the object's ETag matches the given value. This is useful for
  1987. // getting updates only after the object has changed since the last
  1988. // request. Use googleapi.IsNotModified to check whether the response
  1989. // error from Do is the result of In-None-Match.
  1990. func (c *ProjectsLogsListCall) IfNoneMatch(entityTag string) *ProjectsLogsListCall {
  1991. c.ifNoneMatch_ = entityTag
  1992. return c
  1993. }
  1994. // Context sets the context to be used in this call's Do method. Any
  1995. // pending HTTP request will be aborted if the provided context is
  1996. // canceled.
  1997. func (c *ProjectsLogsListCall) Context(ctx context.Context) *ProjectsLogsListCall {
  1998. c.ctx_ = ctx
  1999. return c
  2000. }
  2001. // Header returns an http.Header that can be modified by the caller to
  2002. // add HTTP headers to the request.
  2003. func (c *ProjectsLogsListCall) Header() http.Header {
  2004. if c.header_ == nil {
  2005. c.header_ = make(http.Header)
  2006. }
  2007. return c.header_
  2008. }
  2009. func (c *ProjectsLogsListCall) doRequest(alt string) (*http.Response, error) {
  2010. reqHeaders := make(http.Header)
  2011. for k, v := range c.header_ {
  2012. reqHeaders[k] = v
  2013. }
  2014. reqHeaders.Set("User-Agent", c.s.userAgent())
  2015. if c.ifNoneMatch_ != "" {
  2016. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2017. }
  2018. var body io.Reader = nil
  2019. c.urlParams_.Set("alt", alt)
  2020. c.urlParams_.Set("prettyPrint", "false")
  2021. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs")
  2022. urls += "?" + c.urlParams_.Encode()
  2023. req, err := http.NewRequest("GET", urls, body)
  2024. if err != nil {
  2025. return nil, err
  2026. }
  2027. req.Header = reqHeaders
  2028. googleapi.Expand(req.URL, map[string]string{
  2029. "projectsId": c.projectsId,
  2030. })
  2031. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2032. }
  2033. // Do executes the "logging.projects.logs.list" call.
  2034. // Exactly one of *ListLogsResponse or error will be non-nil. Any
  2035. // non-2xx status code is an error. Response headers are in either
  2036. // *ListLogsResponse.ServerResponse.Header or (if a response was
  2037. // returned at all) in error.(*googleapi.Error).Header. Use
  2038. // googleapi.IsNotModified to check whether the returned error was
  2039. // because http.StatusNotModified was returned.
  2040. func (c *ProjectsLogsListCall) Do(opts ...googleapi.CallOption) (*ListLogsResponse, error) {
  2041. gensupport.SetOptions(c.urlParams_, opts...)
  2042. res, err := c.doRequest("json")
  2043. if res != nil && res.StatusCode == http.StatusNotModified {
  2044. if res.Body != nil {
  2045. res.Body.Close()
  2046. }
  2047. return nil, &googleapi.Error{
  2048. Code: res.StatusCode,
  2049. Header: res.Header,
  2050. }
  2051. }
  2052. if err != nil {
  2053. return nil, err
  2054. }
  2055. defer googleapi.CloseBody(res)
  2056. if err := googleapi.CheckResponse(res); err != nil {
  2057. return nil, err
  2058. }
  2059. ret := &ListLogsResponse{
  2060. ServerResponse: googleapi.ServerResponse{
  2061. Header: res.Header,
  2062. HTTPStatusCode: res.StatusCode,
  2063. },
  2064. }
  2065. target := &ret
  2066. if err := gensupport.DecodeResponse(target, res); err != nil {
  2067. return nil, err
  2068. }
  2069. return ret, nil
  2070. // {
  2071. // "description": "Lists log resources belonging to the specified project.",
  2072. // "httpMethod": "GET",
  2073. // "id": "logging.projects.logs.list",
  2074. // "parameterOrder": [
  2075. // "projectsId"
  2076. // ],
  2077. // "parameters": {
  2078. // "pageSize": {
  2079. // "description": "The maximum number of results to return.",
  2080. // "format": "int32",
  2081. // "location": "query",
  2082. // "type": "integer"
  2083. // },
  2084. // "pageToken": {
  2085. // "description": "An opaque token, returned as `nextPageToken` by a prior `ListLogs` operation. If `pageToken` is supplied, then the other fields of this request are ignored, and instead the previous `ListLogs` operation is continued.",
  2086. // "location": "query",
  2087. // "type": "string"
  2088. // },
  2089. // "projectsId": {
  2090. // "description": "Part of `projectName`. The project name for which to list the log resources.",
  2091. // "location": "path",
  2092. // "required": true,
  2093. // "type": "string"
  2094. // },
  2095. // "serviceIndexPrefix": {
  2096. // "description": "A log service index prefix for which to list logs. Only logs containing entries whose metadata that includes these label values (associated with index keys) are returned. The prefix is a slash separated list of values, and need not specify all index labels. An empty index (or a single slash) matches all log service indexes.",
  2097. // "location": "query",
  2098. // "type": "string"
  2099. // },
  2100. // "serviceName": {
  2101. // "description": "A service name for which to list logs. Only logs containing entries whose metadata includes this service name are returned. If `serviceName` and `serviceIndexPrefix` are both empty, then all log names are returned. To list all log names, regardless of service, leave both the `serviceName` and `serviceIndexPrefix` empty. To list log names containing entries with a particular service name (or explicitly empty service name) set `serviceName` to the desired value and `serviceIndexPrefix` to `\"/\"`.",
  2102. // "location": "query",
  2103. // "type": "string"
  2104. // }
  2105. // },
  2106. // "path": "v1beta3/projects/{projectsId}/logs",
  2107. // "response": {
  2108. // "$ref": "ListLogsResponse"
  2109. // },
  2110. // "scopes": [
  2111. // "https://www.googleapis.com/auth/cloud-platform"
  2112. // ]
  2113. // }
  2114. }
  2115. // Pages invokes f for each page of results.
  2116. // A non-nil error returned from f will halt the iteration.
  2117. // The provided context supersedes any context provided to the Context method.
  2118. func (c *ProjectsLogsListCall) Pages(ctx context.Context, f func(*ListLogsResponse) error) error {
  2119. c.ctx_ = ctx
  2120. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2121. for {
  2122. x, err := c.Do()
  2123. if err != nil {
  2124. return err
  2125. }
  2126. if err := f(x); err != nil {
  2127. return err
  2128. }
  2129. if x.NextPageToken == "" {
  2130. return nil
  2131. }
  2132. c.PageToken(x.NextPageToken)
  2133. }
  2134. }
  2135. // method id "logging.projects.logs.entries.write":
  2136. type ProjectsLogsEntriesWriteCall struct {
  2137. s *Service
  2138. projectsId string
  2139. logsId string
  2140. writelogentriesrequest *WriteLogEntriesRequest
  2141. urlParams_ gensupport.URLParams
  2142. ctx_ context.Context
  2143. header_ http.Header
  2144. }
  2145. // Write: Creates one or more log entries in a log. You must supply a
  2146. // list of `LogEntry` objects, named `entries`. Each `LogEntry` object
  2147. // must contain a payload object and a `LogEntryMetadata` object that
  2148. // describes the entry. You must fill in all the fields of the entry,
  2149. // metadata, and payload. You can also supply a map, `commonLabels`,
  2150. // that supplies default (key, value) data for the
  2151. // `entries[].metadata.labels` maps, saving you the trouble of creating
  2152. // identical copies for each entry.
  2153. func (r *ProjectsLogsEntriesService) Write(projectsId string, logsId string, writelogentriesrequest *WriteLogEntriesRequest) *ProjectsLogsEntriesWriteCall {
  2154. c := &ProjectsLogsEntriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2155. c.projectsId = projectsId
  2156. c.logsId = logsId
  2157. c.writelogentriesrequest = writelogentriesrequest
  2158. return c
  2159. }
  2160. // Fields allows partial responses to be retrieved. See
  2161. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2162. // for more information.
  2163. func (c *ProjectsLogsEntriesWriteCall) Fields(s ...googleapi.Field) *ProjectsLogsEntriesWriteCall {
  2164. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2165. return c
  2166. }
  2167. // Context sets the context to be used in this call's Do method. Any
  2168. // pending HTTP request will be aborted if the provided context is
  2169. // canceled.
  2170. func (c *ProjectsLogsEntriesWriteCall) Context(ctx context.Context) *ProjectsLogsEntriesWriteCall {
  2171. c.ctx_ = ctx
  2172. return c
  2173. }
  2174. // Header returns an http.Header that can be modified by the caller to
  2175. // add HTTP headers to the request.
  2176. func (c *ProjectsLogsEntriesWriteCall) Header() http.Header {
  2177. if c.header_ == nil {
  2178. c.header_ = make(http.Header)
  2179. }
  2180. return c.header_
  2181. }
  2182. func (c *ProjectsLogsEntriesWriteCall) doRequest(alt string) (*http.Response, error) {
  2183. reqHeaders := make(http.Header)
  2184. for k, v := range c.header_ {
  2185. reqHeaders[k] = v
  2186. }
  2187. reqHeaders.Set("User-Agent", c.s.userAgent())
  2188. var body io.Reader = nil
  2189. body, err := googleapi.WithoutDataWrapper.JSONReader(c.writelogentriesrequest)
  2190. if err != nil {
  2191. return nil, err
  2192. }
  2193. reqHeaders.Set("Content-Type", "application/json")
  2194. c.urlParams_.Set("alt", alt)
  2195. c.urlParams_.Set("prettyPrint", "false")
  2196. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/entries:write")
  2197. urls += "?" + c.urlParams_.Encode()
  2198. req, err := http.NewRequest("POST", urls, body)
  2199. if err != nil {
  2200. return nil, err
  2201. }
  2202. req.Header = reqHeaders
  2203. googleapi.Expand(req.URL, map[string]string{
  2204. "projectsId": c.projectsId,
  2205. "logsId": c.logsId,
  2206. })
  2207. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2208. }
  2209. // Do executes the "logging.projects.logs.entries.write" call.
  2210. // Exactly one of *WriteLogEntriesResponse or error will be non-nil. Any
  2211. // non-2xx status code is an error. Response headers are in either
  2212. // *WriteLogEntriesResponse.ServerResponse.Header or (if a response was
  2213. // returned at all) in error.(*googleapi.Error).Header. Use
  2214. // googleapi.IsNotModified to check whether the returned error was
  2215. // because http.StatusNotModified was returned.
  2216. func (c *ProjectsLogsEntriesWriteCall) Do(opts ...googleapi.CallOption) (*WriteLogEntriesResponse, error) {
  2217. gensupport.SetOptions(c.urlParams_, opts...)
  2218. res, err := c.doRequest("json")
  2219. if res != nil && res.StatusCode == http.StatusNotModified {
  2220. if res.Body != nil {
  2221. res.Body.Close()
  2222. }
  2223. return nil, &googleapi.Error{
  2224. Code: res.StatusCode,
  2225. Header: res.Header,
  2226. }
  2227. }
  2228. if err != nil {
  2229. return nil, err
  2230. }
  2231. defer googleapi.CloseBody(res)
  2232. if err := googleapi.CheckResponse(res); err != nil {
  2233. return nil, err
  2234. }
  2235. ret := &WriteLogEntriesResponse{
  2236. ServerResponse: googleapi.ServerResponse{
  2237. Header: res.Header,
  2238. HTTPStatusCode: res.StatusCode,
  2239. },
  2240. }
  2241. target := &ret
  2242. if err := gensupport.DecodeResponse(target, res); err != nil {
  2243. return nil, err
  2244. }
  2245. return ret, nil
  2246. // {
  2247. // "description": "Creates one or more log entries in a log. You must supply a list of `LogEntry` objects, named `entries`. Each `LogEntry` object must contain a payload object and a `LogEntryMetadata` object that describes the entry. You must fill in all the fields of the entry, metadata, and payload. You can also supply a map, `commonLabels`, that supplies default (key, value) data for the `entries[].metadata.labels` maps, saving you the trouble of creating identical copies for each entry.",
  2248. // "httpMethod": "POST",
  2249. // "id": "logging.projects.logs.entries.write",
  2250. // "parameterOrder": [
  2251. // "projectsId",
  2252. // "logsId"
  2253. // ],
  2254. // "parameters": {
  2255. // "logsId": {
  2256. // "description": "Part of `logName`. See documentation of `projectsId`.",
  2257. // "location": "path",
  2258. // "required": true,
  2259. // "type": "string"
  2260. // },
  2261. // "projectsId": {
  2262. // "description": "Part of `logName`. The name of the log resource into which to insert the log entries.",
  2263. // "location": "path",
  2264. // "required": true,
  2265. // "type": "string"
  2266. // }
  2267. // },
  2268. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/entries:write",
  2269. // "request": {
  2270. // "$ref": "WriteLogEntriesRequest"
  2271. // },
  2272. // "response": {
  2273. // "$ref": "WriteLogEntriesResponse"
  2274. // },
  2275. // "scopes": [
  2276. // "https://www.googleapis.com/auth/cloud-platform"
  2277. // ]
  2278. // }
  2279. }
  2280. // method id "logging.projects.logs.sinks.create":
  2281. type ProjectsLogsSinksCreateCall struct {
  2282. s *Service
  2283. projectsId string
  2284. logsId string
  2285. logsink *LogSink
  2286. urlParams_ gensupport.URLParams
  2287. ctx_ context.Context
  2288. header_ http.Header
  2289. }
  2290. // Create: Creates the specified log sink resource.
  2291. func (r *ProjectsLogsSinksService) Create(projectsId string, logsId string, logsink *LogSink) *ProjectsLogsSinksCreateCall {
  2292. c := &ProjectsLogsSinksCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2293. c.projectsId = projectsId
  2294. c.logsId = logsId
  2295. c.logsink = logsink
  2296. return c
  2297. }
  2298. // Fields allows partial responses to be retrieved. See
  2299. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2300. // for more information.
  2301. func (c *ProjectsLogsSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksCreateCall {
  2302. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2303. return c
  2304. }
  2305. // Context sets the context to be used in this call's Do method. Any
  2306. // pending HTTP request will be aborted if the provided context is
  2307. // canceled.
  2308. func (c *ProjectsLogsSinksCreateCall) Context(ctx context.Context) *ProjectsLogsSinksCreateCall {
  2309. c.ctx_ = ctx
  2310. return c
  2311. }
  2312. // Header returns an http.Header that can be modified by the caller to
  2313. // add HTTP headers to the request.
  2314. func (c *ProjectsLogsSinksCreateCall) Header() http.Header {
  2315. if c.header_ == nil {
  2316. c.header_ = make(http.Header)
  2317. }
  2318. return c.header_
  2319. }
  2320. func (c *ProjectsLogsSinksCreateCall) doRequest(alt string) (*http.Response, error) {
  2321. reqHeaders := make(http.Header)
  2322. for k, v := range c.header_ {
  2323. reqHeaders[k] = v
  2324. }
  2325. reqHeaders.Set("User-Agent", c.s.userAgent())
  2326. var body io.Reader = nil
  2327. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  2328. if err != nil {
  2329. return nil, err
  2330. }
  2331. reqHeaders.Set("Content-Type", "application/json")
  2332. c.urlParams_.Set("alt", alt)
  2333. c.urlParams_.Set("prettyPrint", "false")
  2334. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks")
  2335. urls += "?" + c.urlParams_.Encode()
  2336. req, err := http.NewRequest("POST", urls, body)
  2337. if err != nil {
  2338. return nil, err
  2339. }
  2340. req.Header = reqHeaders
  2341. googleapi.Expand(req.URL, map[string]string{
  2342. "projectsId": c.projectsId,
  2343. "logsId": c.logsId,
  2344. })
  2345. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2346. }
  2347. // Do executes the "logging.projects.logs.sinks.create" call.
  2348. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2349. // code is an error. Response headers are in either
  2350. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2351. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2352. // check whether the returned error was because http.StatusNotModified
  2353. // was returned.
  2354. func (c *ProjectsLogsSinksCreateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2355. gensupport.SetOptions(c.urlParams_, opts...)
  2356. res, err := c.doRequest("json")
  2357. if res != nil && res.StatusCode == http.StatusNotModified {
  2358. if res.Body != nil {
  2359. res.Body.Close()
  2360. }
  2361. return nil, &googleapi.Error{
  2362. Code: res.StatusCode,
  2363. Header: res.Header,
  2364. }
  2365. }
  2366. if err != nil {
  2367. return nil, err
  2368. }
  2369. defer googleapi.CloseBody(res)
  2370. if err := googleapi.CheckResponse(res); err != nil {
  2371. return nil, err
  2372. }
  2373. ret := &LogSink{
  2374. ServerResponse: googleapi.ServerResponse{
  2375. Header: res.Header,
  2376. HTTPStatusCode: res.StatusCode,
  2377. },
  2378. }
  2379. target := &ret
  2380. if err := gensupport.DecodeResponse(target, res); err != nil {
  2381. return nil, err
  2382. }
  2383. return ret, nil
  2384. // {
  2385. // "description": "Creates the specified log sink resource.",
  2386. // "httpMethod": "POST",
  2387. // "id": "logging.projects.logs.sinks.create",
  2388. // "parameterOrder": [
  2389. // "projectsId",
  2390. // "logsId"
  2391. // ],
  2392. // "parameters": {
  2393. // "logsId": {
  2394. // "description": "Part of `logName`. See documentation of `projectsId`.",
  2395. // "location": "path",
  2396. // "required": true,
  2397. // "type": "string"
  2398. // },
  2399. // "projectsId": {
  2400. // "description": "Part of `logName`. The log in which to create a sink resource.",
  2401. // "location": "path",
  2402. // "required": true,
  2403. // "type": "string"
  2404. // }
  2405. // },
  2406. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks",
  2407. // "request": {
  2408. // "$ref": "LogSink"
  2409. // },
  2410. // "response": {
  2411. // "$ref": "LogSink"
  2412. // },
  2413. // "scopes": [
  2414. // "https://www.googleapis.com/auth/cloud-platform"
  2415. // ]
  2416. // }
  2417. }
  2418. // method id "logging.projects.logs.sinks.delete":
  2419. type ProjectsLogsSinksDeleteCall struct {
  2420. s *Service
  2421. projectsId string
  2422. logsId string
  2423. sinksId string
  2424. urlParams_ gensupport.URLParams
  2425. ctx_ context.Context
  2426. header_ http.Header
  2427. }
  2428. // Delete: Deletes the specified log sink resource.
  2429. func (r *ProjectsLogsSinksService) Delete(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksDeleteCall {
  2430. c := &ProjectsLogsSinksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2431. c.projectsId = projectsId
  2432. c.logsId = logsId
  2433. c.sinksId = sinksId
  2434. return c
  2435. }
  2436. // Fields allows partial responses to be retrieved. See
  2437. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2438. // for more information.
  2439. func (c *ProjectsLogsSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksDeleteCall {
  2440. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2441. return c
  2442. }
  2443. // Context sets the context to be used in this call's Do method. Any
  2444. // pending HTTP request will be aborted if the provided context is
  2445. // canceled.
  2446. func (c *ProjectsLogsSinksDeleteCall) Context(ctx context.Context) *ProjectsLogsSinksDeleteCall {
  2447. c.ctx_ = ctx
  2448. return c
  2449. }
  2450. // Header returns an http.Header that can be modified by the caller to
  2451. // add HTTP headers to the request.
  2452. func (c *ProjectsLogsSinksDeleteCall) Header() http.Header {
  2453. if c.header_ == nil {
  2454. c.header_ = make(http.Header)
  2455. }
  2456. return c.header_
  2457. }
  2458. func (c *ProjectsLogsSinksDeleteCall) doRequest(alt string) (*http.Response, error) {
  2459. reqHeaders := make(http.Header)
  2460. for k, v := range c.header_ {
  2461. reqHeaders[k] = v
  2462. }
  2463. reqHeaders.Set("User-Agent", c.s.userAgent())
  2464. var body io.Reader = nil
  2465. c.urlParams_.Set("alt", alt)
  2466. c.urlParams_.Set("prettyPrint", "false")
  2467. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
  2468. urls += "?" + c.urlParams_.Encode()
  2469. req, err := http.NewRequest("DELETE", urls, body)
  2470. if err != nil {
  2471. return nil, err
  2472. }
  2473. req.Header = reqHeaders
  2474. googleapi.Expand(req.URL, map[string]string{
  2475. "projectsId": c.projectsId,
  2476. "logsId": c.logsId,
  2477. "sinksId": c.sinksId,
  2478. })
  2479. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2480. }
  2481. // Do executes the "logging.projects.logs.sinks.delete" call.
  2482. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2483. // code is an error. Response headers are in either
  2484. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2485. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2486. // check whether the returned error was because http.StatusNotModified
  2487. // was returned.
  2488. func (c *ProjectsLogsSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2489. gensupport.SetOptions(c.urlParams_, opts...)
  2490. res, err := c.doRequest("json")
  2491. if res != nil && res.StatusCode == http.StatusNotModified {
  2492. if res.Body != nil {
  2493. res.Body.Close()
  2494. }
  2495. return nil, &googleapi.Error{
  2496. Code: res.StatusCode,
  2497. Header: res.Header,
  2498. }
  2499. }
  2500. if err != nil {
  2501. return nil, err
  2502. }
  2503. defer googleapi.CloseBody(res)
  2504. if err := googleapi.CheckResponse(res); err != nil {
  2505. return nil, err
  2506. }
  2507. ret := &Empty{
  2508. ServerResponse: googleapi.ServerResponse{
  2509. Header: res.Header,
  2510. HTTPStatusCode: res.StatusCode,
  2511. },
  2512. }
  2513. target := &ret
  2514. if err := gensupport.DecodeResponse(target, res); err != nil {
  2515. return nil, err
  2516. }
  2517. return ret, nil
  2518. // {
  2519. // "description": "Deletes the specified log sink resource.",
  2520. // "httpMethod": "DELETE",
  2521. // "id": "logging.projects.logs.sinks.delete",
  2522. // "parameterOrder": [
  2523. // "projectsId",
  2524. // "logsId",
  2525. // "sinksId"
  2526. // ],
  2527. // "parameters": {
  2528. // "logsId": {
  2529. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2530. // "location": "path",
  2531. // "required": true,
  2532. // "type": "string"
  2533. // },
  2534. // "projectsId": {
  2535. // "description": "Part of `sinkName`. The name of the sink to delete.",
  2536. // "location": "path",
  2537. // "required": true,
  2538. // "type": "string"
  2539. // },
  2540. // "sinksId": {
  2541. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2542. // "location": "path",
  2543. // "required": true,
  2544. // "type": "string"
  2545. // }
  2546. // },
  2547. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}",
  2548. // "response": {
  2549. // "$ref": "Empty"
  2550. // },
  2551. // "scopes": [
  2552. // "https://www.googleapis.com/auth/cloud-platform"
  2553. // ]
  2554. // }
  2555. }
  2556. // method id "logging.projects.logs.sinks.get":
  2557. type ProjectsLogsSinksGetCall struct {
  2558. s *Service
  2559. projectsId string
  2560. logsId string
  2561. sinksId string
  2562. urlParams_ gensupport.URLParams
  2563. ifNoneMatch_ string
  2564. ctx_ context.Context
  2565. header_ http.Header
  2566. }
  2567. // Get: Gets the specified log sink resource.
  2568. func (r *ProjectsLogsSinksService) Get(projectsId string, logsId string, sinksId string) *ProjectsLogsSinksGetCall {
  2569. c := &ProjectsLogsSinksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2570. c.projectsId = projectsId
  2571. c.logsId = logsId
  2572. c.sinksId = sinksId
  2573. return c
  2574. }
  2575. // Fields allows partial responses to be retrieved. See
  2576. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2577. // for more information.
  2578. func (c *ProjectsLogsSinksGetCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksGetCall {
  2579. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2580. return c
  2581. }
  2582. // IfNoneMatch sets the optional parameter which makes the operation
  2583. // fail if the object's ETag matches the given value. This is useful for
  2584. // getting updates only after the object has changed since the last
  2585. // request. Use googleapi.IsNotModified to check whether the response
  2586. // error from Do is the result of In-None-Match.
  2587. func (c *ProjectsLogsSinksGetCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksGetCall {
  2588. c.ifNoneMatch_ = entityTag
  2589. return c
  2590. }
  2591. // Context sets the context to be used in this call's Do method. Any
  2592. // pending HTTP request will be aborted if the provided context is
  2593. // canceled.
  2594. func (c *ProjectsLogsSinksGetCall) Context(ctx context.Context) *ProjectsLogsSinksGetCall {
  2595. c.ctx_ = ctx
  2596. return c
  2597. }
  2598. // Header returns an http.Header that can be modified by the caller to
  2599. // add HTTP headers to the request.
  2600. func (c *ProjectsLogsSinksGetCall) Header() http.Header {
  2601. if c.header_ == nil {
  2602. c.header_ = make(http.Header)
  2603. }
  2604. return c.header_
  2605. }
  2606. func (c *ProjectsLogsSinksGetCall) doRequest(alt string) (*http.Response, error) {
  2607. reqHeaders := make(http.Header)
  2608. for k, v := range c.header_ {
  2609. reqHeaders[k] = v
  2610. }
  2611. reqHeaders.Set("User-Agent", c.s.userAgent())
  2612. if c.ifNoneMatch_ != "" {
  2613. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2614. }
  2615. var body io.Reader = nil
  2616. c.urlParams_.Set("alt", alt)
  2617. c.urlParams_.Set("prettyPrint", "false")
  2618. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
  2619. urls += "?" + c.urlParams_.Encode()
  2620. req, err := http.NewRequest("GET", urls, body)
  2621. if err != nil {
  2622. return nil, err
  2623. }
  2624. req.Header = reqHeaders
  2625. googleapi.Expand(req.URL, map[string]string{
  2626. "projectsId": c.projectsId,
  2627. "logsId": c.logsId,
  2628. "sinksId": c.sinksId,
  2629. })
  2630. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2631. }
  2632. // Do executes the "logging.projects.logs.sinks.get" call.
  2633. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2634. // code is an error. Response headers are in either
  2635. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2636. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2637. // check whether the returned error was because http.StatusNotModified
  2638. // was returned.
  2639. func (c *ProjectsLogsSinksGetCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2640. gensupport.SetOptions(c.urlParams_, opts...)
  2641. res, err := c.doRequest("json")
  2642. if res != nil && res.StatusCode == http.StatusNotModified {
  2643. if res.Body != nil {
  2644. res.Body.Close()
  2645. }
  2646. return nil, &googleapi.Error{
  2647. Code: res.StatusCode,
  2648. Header: res.Header,
  2649. }
  2650. }
  2651. if err != nil {
  2652. return nil, err
  2653. }
  2654. defer googleapi.CloseBody(res)
  2655. if err := googleapi.CheckResponse(res); err != nil {
  2656. return nil, err
  2657. }
  2658. ret := &LogSink{
  2659. ServerResponse: googleapi.ServerResponse{
  2660. Header: res.Header,
  2661. HTTPStatusCode: res.StatusCode,
  2662. },
  2663. }
  2664. target := &ret
  2665. if err := gensupport.DecodeResponse(target, res); err != nil {
  2666. return nil, err
  2667. }
  2668. return ret, nil
  2669. // {
  2670. // "description": "Gets the specified log sink resource.",
  2671. // "httpMethod": "GET",
  2672. // "id": "logging.projects.logs.sinks.get",
  2673. // "parameterOrder": [
  2674. // "projectsId",
  2675. // "logsId",
  2676. // "sinksId"
  2677. // ],
  2678. // "parameters": {
  2679. // "logsId": {
  2680. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2681. // "location": "path",
  2682. // "required": true,
  2683. // "type": "string"
  2684. // },
  2685. // "projectsId": {
  2686. // "description": "Part of `sinkName`. The name of the sink resource to return.",
  2687. // "location": "path",
  2688. // "required": true,
  2689. // "type": "string"
  2690. // },
  2691. // "sinksId": {
  2692. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2693. // "location": "path",
  2694. // "required": true,
  2695. // "type": "string"
  2696. // }
  2697. // },
  2698. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}",
  2699. // "response": {
  2700. // "$ref": "LogSink"
  2701. // },
  2702. // "scopes": [
  2703. // "https://www.googleapis.com/auth/cloud-platform"
  2704. // ]
  2705. // }
  2706. }
  2707. // method id "logging.projects.logs.sinks.list":
  2708. type ProjectsLogsSinksListCall struct {
  2709. s *Service
  2710. projectsId string
  2711. logsId string
  2712. urlParams_ gensupport.URLParams
  2713. ifNoneMatch_ string
  2714. ctx_ context.Context
  2715. header_ http.Header
  2716. }
  2717. // List: Lists log sinks associated with the specified log.
  2718. func (r *ProjectsLogsSinksService) List(projectsId string, logsId string) *ProjectsLogsSinksListCall {
  2719. c := &ProjectsLogsSinksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2720. c.projectsId = projectsId
  2721. c.logsId = logsId
  2722. return c
  2723. }
  2724. // Fields allows partial responses to be retrieved. See
  2725. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2726. // for more information.
  2727. func (c *ProjectsLogsSinksListCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksListCall {
  2728. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2729. return c
  2730. }
  2731. // IfNoneMatch sets the optional parameter which makes the operation
  2732. // fail if the object's ETag matches the given value. This is useful for
  2733. // getting updates only after the object has changed since the last
  2734. // request. Use googleapi.IsNotModified to check whether the response
  2735. // error from Do is the result of In-None-Match.
  2736. func (c *ProjectsLogsSinksListCall) IfNoneMatch(entityTag string) *ProjectsLogsSinksListCall {
  2737. c.ifNoneMatch_ = entityTag
  2738. return c
  2739. }
  2740. // Context sets the context to be used in this call's Do method. Any
  2741. // pending HTTP request will be aborted if the provided context is
  2742. // canceled.
  2743. func (c *ProjectsLogsSinksListCall) Context(ctx context.Context) *ProjectsLogsSinksListCall {
  2744. c.ctx_ = ctx
  2745. return c
  2746. }
  2747. // Header returns an http.Header that can be modified by the caller to
  2748. // add HTTP headers to the request.
  2749. func (c *ProjectsLogsSinksListCall) Header() http.Header {
  2750. if c.header_ == nil {
  2751. c.header_ = make(http.Header)
  2752. }
  2753. return c.header_
  2754. }
  2755. func (c *ProjectsLogsSinksListCall) doRequest(alt string) (*http.Response, error) {
  2756. reqHeaders := make(http.Header)
  2757. for k, v := range c.header_ {
  2758. reqHeaders[k] = v
  2759. }
  2760. reqHeaders.Set("User-Agent", c.s.userAgent())
  2761. if c.ifNoneMatch_ != "" {
  2762. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2763. }
  2764. var body io.Reader = nil
  2765. c.urlParams_.Set("alt", alt)
  2766. c.urlParams_.Set("prettyPrint", "false")
  2767. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks")
  2768. urls += "?" + c.urlParams_.Encode()
  2769. req, err := http.NewRequest("GET", urls, body)
  2770. if err != nil {
  2771. return nil, err
  2772. }
  2773. req.Header = reqHeaders
  2774. googleapi.Expand(req.URL, map[string]string{
  2775. "projectsId": c.projectsId,
  2776. "logsId": c.logsId,
  2777. })
  2778. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2779. }
  2780. // Do executes the "logging.projects.logs.sinks.list" call.
  2781. // Exactly one of *ListLogSinksResponse or error will be non-nil. Any
  2782. // non-2xx status code is an error. Response headers are in either
  2783. // *ListLogSinksResponse.ServerResponse.Header or (if a response was
  2784. // returned at all) in error.(*googleapi.Error).Header. Use
  2785. // googleapi.IsNotModified to check whether the returned error was
  2786. // because http.StatusNotModified was returned.
  2787. func (c *ProjectsLogsSinksListCall) Do(opts ...googleapi.CallOption) (*ListLogSinksResponse, error) {
  2788. gensupport.SetOptions(c.urlParams_, opts...)
  2789. res, err := c.doRequest("json")
  2790. if res != nil && res.StatusCode == http.StatusNotModified {
  2791. if res.Body != nil {
  2792. res.Body.Close()
  2793. }
  2794. return nil, &googleapi.Error{
  2795. Code: res.StatusCode,
  2796. Header: res.Header,
  2797. }
  2798. }
  2799. if err != nil {
  2800. return nil, err
  2801. }
  2802. defer googleapi.CloseBody(res)
  2803. if err := googleapi.CheckResponse(res); err != nil {
  2804. return nil, err
  2805. }
  2806. ret := &ListLogSinksResponse{
  2807. ServerResponse: googleapi.ServerResponse{
  2808. Header: res.Header,
  2809. HTTPStatusCode: res.StatusCode,
  2810. },
  2811. }
  2812. target := &ret
  2813. if err := gensupport.DecodeResponse(target, res); err != nil {
  2814. return nil, err
  2815. }
  2816. return ret, nil
  2817. // {
  2818. // "description": "Lists log sinks associated with the specified log.",
  2819. // "httpMethod": "GET",
  2820. // "id": "logging.projects.logs.sinks.list",
  2821. // "parameterOrder": [
  2822. // "projectsId",
  2823. // "logsId"
  2824. // ],
  2825. // "parameters": {
  2826. // "logsId": {
  2827. // "description": "Part of `logName`. See documentation of `projectsId`.",
  2828. // "location": "path",
  2829. // "required": true,
  2830. // "type": "string"
  2831. // },
  2832. // "projectsId": {
  2833. // "description": "Part of `logName`. The log for which to list sinks.",
  2834. // "location": "path",
  2835. // "required": true,
  2836. // "type": "string"
  2837. // }
  2838. // },
  2839. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks",
  2840. // "response": {
  2841. // "$ref": "ListLogSinksResponse"
  2842. // },
  2843. // "scopes": [
  2844. // "https://www.googleapis.com/auth/cloud-platform"
  2845. // ]
  2846. // }
  2847. }
  2848. // method id "logging.projects.logs.sinks.update":
  2849. type ProjectsLogsSinksUpdateCall struct {
  2850. s *Service
  2851. projectsId string
  2852. logsId string
  2853. sinksId string
  2854. logsink *LogSink
  2855. urlParams_ gensupport.URLParams
  2856. ctx_ context.Context
  2857. header_ http.Header
  2858. }
  2859. // Update: Creates or updates the specified log sink resource.
  2860. func (r *ProjectsLogsSinksService) Update(projectsId string, logsId string, sinksId string, logsink *LogSink) *ProjectsLogsSinksUpdateCall {
  2861. c := &ProjectsLogsSinksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2862. c.projectsId = projectsId
  2863. c.logsId = logsId
  2864. c.sinksId = sinksId
  2865. c.logsink = logsink
  2866. return c
  2867. }
  2868. // Fields allows partial responses to be retrieved. See
  2869. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2870. // for more information.
  2871. func (c *ProjectsLogsSinksUpdateCall) Fields(s ...googleapi.Field) *ProjectsLogsSinksUpdateCall {
  2872. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2873. return c
  2874. }
  2875. // Context sets the context to be used in this call's Do method. Any
  2876. // pending HTTP request will be aborted if the provided context is
  2877. // canceled.
  2878. func (c *ProjectsLogsSinksUpdateCall) Context(ctx context.Context) *ProjectsLogsSinksUpdateCall {
  2879. c.ctx_ = ctx
  2880. return c
  2881. }
  2882. // Header returns an http.Header that can be modified by the caller to
  2883. // add HTTP headers to the request.
  2884. func (c *ProjectsLogsSinksUpdateCall) Header() http.Header {
  2885. if c.header_ == nil {
  2886. c.header_ = make(http.Header)
  2887. }
  2888. return c.header_
  2889. }
  2890. func (c *ProjectsLogsSinksUpdateCall) doRequest(alt string) (*http.Response, error) {
  2891. reqHeaders := make(http.Header)
  2892. for k, v := range c.header_ {
  2893. reqHeaders[k] = v
  2894. }
  2895. reqHeaders.Set("User-Agent", c.s.userAgent())
  2896. var body io.Reader = nil
  2897. body, err := googleapi.WithoutDataWrapper.JSONReader(c.logsink)
  2898. if err != nil {
  2899. return nil, err
  2900. }
  2901. reqHeaders.Set("Content-Type", "application/json")
  2902. c.urlParams_.Set("alt", alt)
  2903. c.urlParams_.Set("prettyPrint", "false")
  2904. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}")
  2905. urls += "?" + c.urlParams_.Encode()
  2906. req, err := http.NewRequest("PUT", urls, body)
  2907. if err != nil {
  2908. return nil, err
  2909. }
  2910. req.Header = reqHeaders
  2911. googleapi.Expand(req.URL, map[string]string{
  2912. "projectsId": c.projectsId,
  2913. "logsId": c.logsId,
  2914. "sinksId": c.sinksId,
  2915. })
  2916. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2917. }
  2918. // Do executes the "logging.projects.logs.sinks.update" call.
  2919. // Exactly one of *LogSink or error will be non-nil. Any non-2xx status
  2920. // code is an error. Response headers are in either
  2921. // *LogSink.ServerResponse.Header or (if a response was returned at all)
  2922. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2923. // check whether the returned error was because http.StatusNotModified
  2924. // was returned.
  2925. func (c *ProjectsLogsSinksUpdateCall) Do(opts ...googleapi.CallOption) (*LogSink, error) {
  2926. gensupport.SetOptions(c.urlParams_, opts...)
  2927. res, err := c.doRequest("json")
  2928. if res != nil && res.StatusCode == http.StatusNotModified {
  2929. if res.Body != nil {
  2930. res.Body.Close()
  2931. }
  2932. return nil, &googleapi.Error{
  2933. Code: res.StatusCode,
  2934. Header: res.Header,
  2935. }
  2936. }
  2937. if err != nil {
  2938. return nil, err
  2939. }
  2940. defer googleapi.CloseBody(res)
  2941. if err := googleapi.CheckResponse(res); err != nil {
  2942. return nil, err
  2943. }
  2944. ret := &LogSink{
  2945. ServerResponse: googleapi.ServerResponse{
  2946. Header: res.Header,
  2947. HTTPStatusCode: res.StatusCode,
  2948. },
  2949. }
  2950. target := &ret
  2951. if err := gensupport.DecodeResponse(target, res); err != nil {
  2952. return nil, err
  2953. }
  2954. return ret, nil
  2955. // {
  2956. // "description": "Creates or updates the specified log sink resource.",
  2957. // "httpMethod": "PUT",
  2958. // "id": "logging.projects.logs.sinks.update",
  2959. // "parameterOrder": [
  2960. // "projectsId",
  2961. // "logsId",
  2962. // "sinksId"
  2963. // ],
  2964. // "parameters": {
  2965. // "logsId": {
  2966. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2967. // "location": "path",
  2968. // "required": true,
  2969. // "type": "string"
  2970. // },
  2971. // "projectsId": {
  2972. // "description": "Part of `sinkName`. The name of the sink to update.",
  2973. // "location": "path",
  2974. // "required": true,
  2975. // "type": "string"
  2976. // },
  2977. // "sinksId": {
  2978. // "description": "Part of `sinkName`. See documentation of `projectsId`.",
  2979. // "location": "path",
  2980. // "required": true,
  2981. // "type": "string"
  2982. // }
  2983. // },
  2984. // "path": "v1beta3/projects/{projectsId}/logs/{logsId}/sinks/{sinksId}",
  2985. // "request": {
  2986. // "$ref": "LogSink"
  2987. // },
  2988. // "response": {
  2989. // "$ref": "LogSink"
  2990. // },
  2991. // "scopes": [
  2992. // "https://www.googleapis.com/auth/cloud-platform"
  2993. // ]
  2994. // }
  2995. }