25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

3153 satır
109 KiB

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