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

10612 lines
385 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package spanner provides access to the Cloud Spanner API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/spanner instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/spanner/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/spanner/v1"
  16. // ...
  17. // ctx := context.Background()
  18. // spannerService, err := spanner.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // spannerService, err := spanner.NewService(ctx, option.WithScopes(spanner.SpannerDataScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // spannerService, err := spanner.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // spannerService, err := spanner.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package spanner // import "google.golang.org/api/spanner/v1"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "spanner:v1"
  73. const apiName = "spanner"
  74. const apiVersion = "v1"
  75. const basePath = "https://spanner.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // Administer your Spanner databases
  81. SpannerAdminScope = "https://www.googleapis.com/auth/spanner.admin"
  82. // View and manage the contents of your Spanner databases
  83. SpannerDataScope = "https://www.googleapis.com/auth/spanner.data"
  84. )
  85. // NewService creates a new Service.
  86. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  87. scopesOption := option.WithScopes(
  88. "https://www.googleapis.com/auth/cloud-platform",
  89. "https://www.googleapis.com/auth/spanner.admin",
  90. "https://www.googleapis.com/auth/spanner.data",
  91. )
  92. // NOTE: prepend, so we don't override user-specified scopes.
  93. opts = append([]option.ClientOption{scopesOption}, opts...)
  94. client, endpoint, err := htransport.NewClient(ctx, opts...)
  95. if err != nil {
  96. return nil, err
  97. }
  98. s, err := New(client)
  99. if err != nil {
  100. return nil, err
  101. }
  102. if endpoint != "" {
  103. s.BasePath = endpoint
  104. }
  105. return s, nil
  106. }
  107. // New creates a new Service. It uses the provided http.Client for requests.
  108. //
  109. // Deprecated: please use NewService instead.
  110. // To provide a custom HTTP client, use option.WithHTTPClient.
  111. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  112. func New(client *http.Client) (*Service, error) {
  113. if client == nil {
  114. return nil, errors.New("client is nil")
  115. }
  116. s := &Service{client: client, BasePath: basePath}
  117. s.Projects = NewProjectsService(s)
  118. return s, nil
  119. }
  120. type Service struct {
  121. client *http.Client
  122. BasePath string // API endpoint base URL
  123. UserAgent string // optional additional User-Agent fragment
  124. Projects *ProjectsService
  125. }
  126. func (s *Service) userAgent() string {
  127. if s.UserAgent == "" {
  128. return googleapi.UserAgent
  129. }
  130. return googleapi.UserAgent + " " + s.UserAgent
  131. }
  132. func NewProjectsService(s *Service) *ProjectsService {
  133. rs := &ProjectsService{s: s}
  134. rs.InstanceConfigs = NewProjectsInstanceConfigsService(s)
  135. rs.Instances = NewProjectsInstancesService(s)
  136. return rs
  137. }
  138. type ProjectsService struct {
  139. s *Service
  140. InstanceConfigs *ProjectsInstanceConfigsService
  141. Instances *ProjectsInstancesService
  142. }
  143. func NewProjectsInstanceConfigsService(s *Service) *ProjectsInstanceConfigsService {
  144. rs := &ProjectsInstanceConfigsService{s: s}
  145. return rs
  146. }
  147. type ProjectsInstanceConfigsService struct {
  148. s *Service
  149. }
  150. func NewProjectsInstancesService(s *Service) *ProjectsInstancesService {
  151. rs := &ProjectsInstancesService{s: s}
  152. rs.Databases = NewProjectsInstancesDatabasesService(s)
  153. rs.Operations = NewProjectsInstancesOperationsService(s)
  154. return rs
  155. }
  156. type ProjectsInstancesService struct {
  157. s *Service
  158. Databases *ProjectsInstancesDatabasesService
  159. Operations *ProjectsInstancesOperationsService
  160. }
  161. func NewProjectsInstancesDatabasesService(s *Service) *ProjectsInstancesDatabasesService {
  162. rs := &ProjectsInstancesDatabasesService{s: s}
  163. rs.Operations = NewProjectsInstancesDatabasesOperationsService(s)
  164. rs.Sessions = NewProjectsInstancesDatabasesSessionsService(s)
  165. return rs
  166. }
  167. type ProjectsInstancesDatabasesService struct {
  168. s *Service
  169. Operations *ProjectsInstancesDatabasesOperationsService
  170. Sessions *ProjectsInstancesDatabasesSessionsService
  171. }
  172. func NewProjectsInstancesDatabasesOperationsService(s *Service) *ProjectsInstancesDatabasesOperationsService {
  173. rs := &ProjectsInstancesDatabasesOperationsService{s: s}
  174. return rs
  175. }
  176. type ProjectsInstancesDatabasesOperationsService struct {
  177. s *Service
  178. }
  179. func NewProjectsInstancesDatabasesSessionsService(s *Service) *ProjectsInstancesDatabasesSessionsService {
  180. rs := &ProjectsInstancesDatabasesSessionsService{s: s}
  181. return rs
  182. }
  183. type ProjectsInstancesDatabasesSessionsService struct {
  184. s *Service
  185. }
  186. func NewProjectsInstancesOperationsService(s *Service) *ProjectsInstancesOperationsService {
  187. rs := &ProjectsInstancesOperationsService{s: s}
  188. return rs
  189. }
  190. type ProjectsInstancesOperationsService struct {
  191. s *Service
  192. }
  193. // BeginTransactionRequest: The request for BeginTransaction.
  194. type BeginTransactionRequest struct {
  195. // Options: Required. Options for the new transaction.
  196. Options *TransactionOptions `json:"options,omitempty"`
  197. // ForceSendFields is a list of field names (e.g. "Options") to
  198. // unconditionally include in API requests. By default, fields with
  199. // empty values are omitted from API requests. However, any non-pointer,
  200. // non-interface field appearing in ForceSendFields will be sent to the
  201. // server regardless of whether the field is empty or not. This may be
  202. // used to include empty fields in Patch requests.
  203. ForceSendFields []string `json:"-"`
  204. // NullFields is a list of field names (e.g. "Options") to include in
  205. // API requests with the JSON null value. By default, fields with empty
  206. // values are omitted from API requests. However, any field with an
  207. // empty value appearing in NullFields will be sent to the server as
  208. // null. It is an error if a field in this list has a non-empty value.
  209. // This may be used to include null fields in Patch requests.
  210. NullFields []string `json:"-"`
  211. }
  212. func (s *BeginTransactionRequest) MarshalJSON() ([]byte, error) {
  213. type NoMethod BeginTransactionRequest
  214. raw := NoMethod(*s)
  215. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  216. }
  217. // Binding: Associates `members` with a `role`.
  218. type Binding struct {
  219. // Condition: Unimplemented. The condition that is associated with this
  220. // binding.
  221. // NOTE: an unsatisfied condition will not allow user access via
  222. // current
  223. // binding. Different bindings, including their conditions, are
  224. // examined
  225. // independently.
  226. Condition *Expr `json:"condition,omitempty"`
  227. // Members: Specifies the identities requesting access for a Cloud
  228. // Platform resource.
  229. // `members` can have the following values:
  230. //
  231. // * `allUsers`: A special identifier that represents anyone who is
  232. // on the internet; with or without a Google account.
  233. //
  234. // * `allAuthenticatedUsers`: A special identifier that represents
  235. // anyone
  236. // who is authenticated with a Google account or a service
  237. // account.
  238. //
  239. // * `user:{emailid}`: An email address that represents a specific
  240. // Google
  241. // account. For example, `alice@gmail.com` .
  242. //
  243. //
  244. // * `serviceAccount:{emailid}`: An email address that represents a
  245. // service
  246. // account. For example,
  247. // `my-other-app@appspot.gserviceaccount.com`.
  248. //
  249. // * `group:{emailid}`: An email address that represents a Google
  250. // group.
  251. // For example, `admins@example.com`.
  252. //
  253. //
  254. // * `domain:{domain}`: A Google Apps domain name that represents all
  255. // the
  256. // users of that domain. For example, `google.com` or
  257. // `example.com`.
  258. //
  259. //
  260. Members []string `json:"members,omitempty"`
  261. // Role: Role that is assigned to `members`.
  262. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  263. Role string `json:"role,omitempty"`
  264. // ForceSendFields is a list of field names (e.g. "Condition") to
  265. // unconditionally include in API requests. By default, fields with
  266. // empty values are omitted from API requests. However, any non-pointer,
  267. // non-interface field appearing in ForceSendFields will be sent to the
  268. // server regardless of whether the field is empty or not. This may be
  269. // used to include empty fields in Patch requests.
  270. ForceSendFields []string `json:"-"`
  271. // NullFields is a list of field names (e.g. "Condition") to include in
  272. // API requests with the JSON null value. By default, fields with empty
  273. // values are omitted from API requests. However, any field with an
  274. // empty value appearing in NullFields will be sent to the server as
  275. // null. It is an error if a field in this list has a non-empty value.
  276. // This may be used to include null fields in Patch requests.
  277. NullFields []string `json:"-"`
  278. }
  279. func (s *Binding) MarshalJSON() ([]byte, error) {
  280. type NoMethod Binding
  281. raw := NoMethod(*s)
  282. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  283. }
  284. // ChildLink: Metadata associated with a parent-child relationship
  285. // appearing in a
  286. // PlanNode.
  287. type ChildLink struct {
  288. // ChildIndex: The node to which the link points.
  289. ChildIndex int64 `json:"childIndex,omitempty"`
  290. // Type: The type of the link. For example, in Hash Joins this could be
  291. // used to
  292. // distinguish between the build child and the probe child, or in the
  293. // case
  294. // of the child being an output variable, to represent the tag
  295. // associated
  296. // with the output variable.
  297. Type string `json:"type,omitempty"`
  298. // Variable: Only present if the child node is SCALAR and corresponds
  299. // to an output variable of the parent node. The field carries the name
  300. // of
  301. // the output variable.
  302. // For example, a `TableScan` operator that reads rows from a table
  303. // will
  304. // have child links to the `SCALAR` nodes representing the output
  305. // variables
  306. // created for each column that is read by the operator. The
  307. // corresponding
  308. // `variable` fields will be set to the variable names assigned to
  309. // the
  310. // columns.
  311. Variable string `json:"variable,omitempty"`
  312. // ForceSendFields is a list of field names (e.g. "ChildIndex") to
  313. // unconditionally include in API requests. By default, fields with
  314. // empty values are omitted from API requests. However, any non-pointer,
  315. // non-interface field appearing in ForceSendFields will be sent to the
  316. // server regardless of whether the field is empty or not. This may be
  317. // used to include empty fields in Patch requests.
  318. ForceSendFields []string `json:"-"`
  319. // NullFields is a list of field names (e.g. "ChildIndex") to include in
  320. // API requests with the JSON null value. By default, fields with empty
  321. // values are omitted from API requests. However, any field with an
  322. // empty value appearing in NullFields will be sent to the server as
  323. // null. It is an error if a field in this list has a non-empty value.
  324. // This may be used to include null fields in Patch requests.
  325. NullFields []string `json:"-"`
  326. }
  327. func (s *ChildLink) MarshalJSON() ([]byte, error) {
  328. type NoMethod ChildLink
  329. raw := NoMethod(*s)
  330. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  331. }
  332. // CommitRequest: The request for Commit.
  333. type CommitRequest struct {
  334. // Mutations: The mutations to be executed when this transaction
  335. // commits. All
  336. // mutations are applied atomically, in the order they appear in
  337. // this list.
  338. Mutations []*Mutation `json:"mutations,omitempty"`
  339. // SingleUseTransaction: Execute mutations in a temporary transaction.
  340. // Note that unlike
  341. // commit of a previously-started transaction, commit with a
  342. // temporary transaction is non-idempotent. That is, if
  343. // the
  344. // `CommitRequest` is sent to Cloud Spanner more than once
  345. // (for
  346. // instance, due to retries in the application, or in the
  347. // transport library), it is possible that the mutations are
  348. // executed more than once. If this is undesirable, use
  349. // BeginTransaction and
  350. // Commit instead.
  351. SingleUseTransaction *TransactionOptions `json:"singleUseTransaction,omitempty"`
  352. // TransactionId: Commit a previously-started transaction.
  353. TransactionId string `json:"transactionId,omitempty"`
  354. // ForceSendFields is a list of field names (e.g. "Mutations") to
  355. // unconditionally include in API requests. By default, fields with
  356. // empty values are omitted from API requests. However, any non-pointer,
  357. // non-interface field appearing in ForceSendFields will be sent to the
  358. // server regardless of whether the field is empty or not. This may be
  359. // used to include empty fields in Patch requests.
  360. ForceSendFields []string `json:"-"`
  361. // NullFields is a list of field names (e.g. "Mutations") to include in
  362. // API requests with the JSON null value. By default, fields with empty
  363. // values are omitted from API requests. However, any field with an
  364. // empty value appearing in NullFields will be sent to the server as
  365. // null. It is an error if a field in this list has a non-empty value.
  366. // This may be used to include null fields in Patch requests.
  367. NullFields []string `json:"-"`
  368. }
  369. func (s *CommitRequest) MarshalJSON() ([]byte, error) {
  370. type NoMethod CommitRequest
  371. raw := NoMethod(*s)
  372. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  373. }
  374. // CommitResponse: The response for Commit.
  375. type CommitResponse struct {
  376. // CommitTimestamp: The Cloud Spanner timestamp at which the transaction
  377. // committed.
  378. CommitTimestamp string `json:"commitTimestamp,omitempty"`
  379. // ServerResponse contains the HTTP response code and headers from the
  380. // server.
  381. googleapi.ServerResponse `json:"-"`
  382. // ForceSendFields is a list of field names (e.g. "CommitTimestamp") to
  383. // unconditionally include in API requests. By default, fields with
  384. // empty values are omitted from API requests. However, any non-pointer,
  385. // non-interface field appearing in ForceSendFields will be sent to the
  386. // server regardless of whether the field is empty or not. This may be
  387. // used to include empty fields in Patch requests.
  388. ForceSendFields []string `json:"-"`
  389. // NullFields is a list of field names (e.g. "CommitTimestamp") to
  390. // include in API requests with the JSON null value. By default, fields
  391. // with empty values are omitted from API requests. However, any field
  392. // with an empty value appearing in NullFields will be sent to the
  393. // server as null. It is an error if a field in this list has a
  394. // non-empty value. This may be used to include null fields in Patch
  395. // requests.
  396. NullFields []string `json:"-"`
  397. }
  398. func (s *CommitResponse) MarshalJSON() ([]byte, error) {
  399. type NoMethod CommitResponse
  400. raw := NoMethod(*s)
  401. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  402. }
  403. // CreateDatabaseMetadata: Metadata type for the operation returned
  404. // by
  405. // CreateDatabase.
  406. type CreateDatabaseMetadata struct {
  407. // Database: The database being created.
  408. Database string `json:"database,omitempty"`
  409. // ForceSendFields is a list of field names (e.g. "Database") to
  410. // unconditionally include in API requests. By default, fields with
  411. // empty values are omitted from API requests. However, any non-pointer,
  412. // non-interface field appearing in ForceSendFields will be sent to the
  413. // server regardless of whether the field is empty or not. This may be
  414. // used to include empty fields in Patch requests.
  415. ForceSendFields []string `json:"-"`
  416. // NullFields is a list of field names (e.g. "Database") to include in
  417. // API requests with the JSON null value. By default, fields with empty
  418. // values are omitted from API requests. However, any field with an
  419. // empty value appearing in NullFields will be sent to the server as
  420. // null. It is an error if a field in this list has a non-empty value.
  421. // This may be used to include null fields in Patch requests.
  422. NullFields []string `json:"-"`
  423. }
  424. func (s *CreateDatabaseMetadata) MarshalJSON() ([]byte, error) {
  425. type NoMethod CreateDatabaseMetadata
  426. raw := NoMethod(*s)
  427. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  428. }
  429. // CreateDatabaseRequest: The request for CreateDatabase.
  430. type CreateDatabaseRequest struct {
  431. // CreateStatement: Required. A `CREATE DATABASE` statement, which
  432. // specifies the ID of the
  433. // new database. The database ID must conform to the regular
  434. // expression
  435. // `a-z*[a-z0-9]` and be between 2 and 30 characters in length.
  436. // If the database ID is a reserved word or if it contains a hyphen,
  437. // the
  438. // database ID must be enclosed in backticks (`` ` ``).
  439. CreateStatement string `json:"createStatement,omitempty"`
  440. // ExtraStatements: An optional list of DDL statements to run inside the
  441. // newly created
  442. // database. Statements can create tables, indexes, etc.
  443. // These
  444. // statements execute atomically with the creation of the database:
  445. // if there is an error in any statement, the database is not created.
  446. ExtraStatements []string `json:"extraStatements,omitempty"`
  447. // ForceSendFields is a list of field names (e.g. "CreateStatement") to
  448. // unconditionally include in API requests. By default, fields with
  449. // empty values are omitted from API requests. However, any non-pointer,
  450. // non-interface field appearing in ForceSendFields will be sent to the
  451. // server regardless of whether the field is empty or not. This may be
  452. // used to include empty fields in Patch requests.
  453. ForceSendFields []string `json:"-"`
  454. // NullFields is a list of field names (e.g. "CreateStatement") to
  455. // include in API requests with the JSON null value. By default, fields
  456. // with empty values are omitted from API requests. However, any field
  457. // with an empty value appearing in NullFields will be sent to the
  458. // server as null. It is an error if a field in this list has a
  459. // non-empty value. This may be used to include null fields in Patch
  460. // requests.
  461. NullFields []string `json:"-"`
  462. }
  463. func (s *CreateDatabaseRequest) MarshalJSON() ([]byte, error) {
  464. type NoMethod CreateDatabaseRequest
  465. raw := NoMethod(*s)
  466. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  467. }
  468. // CreateInstanceMetadata: Metadata type for the operation returned
  469. // by
  470. // CreateInstance.
  471. type CreateInstanceMetadata struct {
  472. // CancelTime: The time at which this operation was cancelled. If set,
  473. // this operation is
  474. // in the process of undoing itself (which is guaranteed to succeed)
  475. // and
  476. // cannot be cancelled again.
  477. CancelTime string `json:"cancelTime,omitempty"`
  478. // EndTime: The time at which this operation failed or was completed
  479. // successfully.
  480. EndTime string `json:"endTime,omitempty"`
  481. // Instance: The instance being created.
  482. Instance *Instance `json:"instance,omitempty"`
  483. // StartTime: The time at which the
  484. // CreateInstance request was
  485. // received.
  486. StartTime string `json:"startTime,omitempty"`
  487. // ForceSendFields is a list of field names (e.g. "CancelTime") to
  488. // unconditionally include in API requests. By default, fields with
  489. // empty values are omitted from API requests. However, any non-pointer,
  490. // non-interface field appearing in ForceSendFields will be sent to the
  491. // server regardless of whether the field is empty or not. This may be
  492. // used to include empty fields in Patch requests.
  493. ForceSendFields []string `json:"-"`
  494. // NullFields is a list of field names (e.g. "CancelTime") to include in
  495. // API requests with the JSON null value. By default, fields with empty
  496. // values are omitted from API requests. However, any field with an
  497. // empty value appearing in NullFields will be sent to the server as
  498. // null. It is an error if a field in this list has a non-empty value.
  499. // This may be used to include null fields in Patch requests.
  500. NullFields []string `json:"-"`
  501. }
  502. func (s *CreateInstanceMetadata) MarshalJSON() ([]byte, error) {
  503. type NoMethod CreateInstanceMetadata
  504. raw := NoMethod(*s)
  505. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  506. }
  507. // CreateInstanceRequest: The request for CreateInstance.
  508. type CreateInstanceRequest struct {
  509. // Instance: Required. The instance to create. The name may be omitted,
  510. // but if
  511. // specified must be `<parent>/instances/<instance_id>`.
  512. Instance *Instance `json:"instance,omitempty"`
  513. // InstanceId: Required. The ID of the instance to create. Valid
  514. // identifiers are of the
  515. // form `a-z*[a-z0-9]` and must be between 6 and 30 characters
  516. // in
  517. // length.
  518. InstanceId string `json:"instanceId,omitempty"`
  519. // ForceSendFields is a list of field names (e.g. "Instance") to
  520. // unconditionally include in API requests. By default, fields with
  521. // empty values are omitted from API requests. However, any non-pointer,
  522. // non-interface field appearing in ForceSendFields will be sent to the
  523. // server regardless of whether the field is empty or not. This may be
  524. // used to include empty fields in Patch requests.
  525. ForceSendFields []string `json:"-"`
  526. // NullFields is a list of field names (e.g. "Instance") to include in
  527. // API requests with the JSON null value. By default, fields with empty
  528. // values are omitted from API requests. However, any field with an
  529. // empty value appearing in NullFields will be sent to the server as
  530. // null. It is an error if a field in this list has a non-empty value.
  531. // This may be used to include null fields in Patch requests.
  532. NullFields []string `json:"-"`
  533. }
  534. func (s *CreateInstanceRequest) MarshalJSON() ([]byte, error) {
  535. type NoMethod CreateInstanceRequest
  536. raw := NoMethod(*s)
  537. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  538. }
  539. // CreateSessionRequest: The request for CreateSession.
  540. type CreateSessionRequest struct {
  541. // Session: The session to create.
  542. Session *Session `json:"session,omitempty"`
  543. // ForceSendFields is a list of field names (e.g. "Session") to
  544. // unconditionally include in API requests. By default, fields with
  545. // empty values are omitted from API requests. However, any non-pointer,
  546. // non-interface field appearing in ForceSendFields will be sent to the
  547. // server regardless of whether the field is empty or not. This may be
  548. // used to include empty fields in Patch requests.
  549. ForceSendFields []string `json:"-"`
  550. // NullFields is a list of field names (e.g. "Session") to include in
  551. // API requests with the JSON null value. By default, fields with empty
  552. // values are omitted from API requests. However, any field with an
  553. // empty value appearing in NullFields will be sent to the server as
  554. // null. It is an error if a field in this list has a non-empty value.
  555. // This may be used to include null fields in Patch requests.
  556. NullFields []string `json:"-"`
  557. }
  558. func (s *CreateSessionRequest) MarshalJSON() ([]byte, error) {
  559. type NoMethod CreateSessionRequest
  560. raw := NoMethod(*s)
  561. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  562. }
  563. // Database: A Cloud Spanner database.
  564. type Database struct {
  565. // Name: Required. The name of the database. Values are of the
  566. // form
  567. // `projects/<project>/instances/<instance>/databases/<database>`,
  568. // w
  569. // here `<database>` is as specified in the `CREATE DATABASE`
  570. // statement. This name can be passed to other API methods to
  571. // identify the database.
  572. Name string `json:"name,omitempty"`
  573. // State: Output only. The current database state.
  574. //
  575. // Possible values:
  576. // "STATE_UNSPECIFIED" - Not specified.
  577. // "CREATING" - The database is still being created. Operations on the
  578. // database may fail
  579. // with `FAILED_PRECONDITION` in this state.
  580. // "READY" - The database is fully created and ready for use.
  581. State string `json:"state,omitempty"`
  582. // ServerResponse contains the HTTP response code and headers from the
  583. // server.
  584. googleapi.ServerResponse `json:"-"`
  585. // ForceSendFields is a list of field names (e.g. "Name") to
  586. // unconditionally include in API requests. By default, fields with
  587. // empty values are omitted from API requests. However, any non-pointer,
  588. // non-interface field appearing in ForceSendFields will be sent to the
  589. // server regardless of whether the field is empty or not. This may be
  590. // used to include empty fields in Patch requests.
  591. ForceSendFields []string `json:"-"`
  592. // NullFields is a list of field names (e.g. "Name") to include in API
  593. // requests with the JSON null value. By default, fields with empty
  594. // values are omitted from API requests. However, any field with an
  595. // empty value appearing in NullFields will be sent to the server as
  596. // null. It is an error if a field in this list has a non-empty value.
  597. // This may be used to include null fields in Patch requests.
  598. NullFields []string `json:"-"`
  599. }
  600. func (s *Database) MarshalJSON() ([]byte, error) {
  601. type NoMethod Database
  602. raw := NoMethod(*s)
  603. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  604. }
  605. // Delete: Arguments to delete operations.
  606. type Delete struct {
  607. // KeySet: Required. The primary keys of the rows within table to
  608. // delete.
  609. // Delete is idempotent. The transaction will succeed even if some or
  610. // all
  611. // rows do not exist.
  612. KeySet *KeySet `json:"keySet,omitempty"`
  613. // Table: Required. The table whose rows will be deleted.
  614. Table string `json:"table,omitempty"`
  615. // ForceSendFields is a list of field names (e.g. "KeySet") to
  616. // unconditionally include in API requests. By default, fields with
  617. // empty values are omitted from API requests. However, any non-pointer,
  618. // non-interface field appearing in ForceSendFields will be sent to the
  619. // server regardless of whether the field is empty or not. This may be
  620. // used to include empty fields in Patch requests.
  621. ForceSendFields []string `json:"-"`
  622. // NullFields is a list of field names (e.g. "KeySet") to include in API
  623. // requests with the JSON null value. By default, fields with empty
  624. // values are omitted from API requests. However, any field with an
  625. // empty value appearing in NullFields will be sent to the server as
  626. // null. It is an error if a field in this list has a non-empty value.
  627. // This may be used to include null fields in Patch requests.
  628. NullFields []string `json:"-"`
  629. }
  630. func (s *Delete) MarshalJSON() ([]byte, error) {
  631. type NoMethod Delete
  632. raw := NoMethod(*s)
  633. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  634. }
  635. // Empty: A generic empty message that you can re-use to avoid defining
  636. // duplicated
  637. // empty messages in your APIs. A typical example is to use it as the
  638. // request
  639. // or the response type of an API method. For instance:
  640. //
  641. // service Foo {
  642. // rpc Bar(google.protobuf.Empty) returns
  643. // (google.protobuf.Empty);
  644. // }
  645. //
  646. // The JSON representation for `Empty` is empty JSON object `{}`.
  647. type Empty struct {
  648. // ServerResponse contains the HTTP response code and headers from the
  649. // server.
  650. googleapi.ServerResponse `json:"-"`
  651. }
  652. // ExecuteBatchDmlRequest: The request for ExecuteBatchDml
  653. type ExecuteBatchDmlRequest struct {
  654. // Seqno: A per-transaction sequence number used to identify this
  655. // request. This is
  656. // used in the same space as the seqno in
  657. // ExecuteSqlRequest. See more details
  658. // in ExecuteSqlRequest.
  659. Seqno int64 `json:"seqno,omitempty,string"`
  660. // Statements: The list of statements to execute in this batch.
  661. // Statements are executed
  662. // serially, such that the effects of statement i are visible to
  663. // statement
  664. // i+1. Each statement must be a DML statement. Execution will stop at
  665. // the
  666. // first failed statement; the remaining statements will not
  667. // run.
  668. //
  669. // REQUIRES: statements_size() > 0.
  670. Statements []*Statement `json:"statements,omitempty"`
  671. // Transaction: The transaction to use. A ReadWrite transaction is
  672. // required. Single-use
  673. // transactions are not supported (to avoid replay). The caller must
  674. // either
  675. // supply an existing transaction ID or begin a new transaction.
  676. Transaction *TransactionSelector `json:"transaction,omitempty"`
  677. // ForceSendFields is a list of field names (e.g. "Seqno") to
  678. // unconditionally include in API requests. By default, fields with
  679. // empty values are omitted from API requests. However, any non-pointer,
  680. // non-interface field appearing in ForceSendFields will be sent to the
  681. // server regardless of whether the field is empty or not. This may be
  682. // used to include empty fields in Patch requests.
  683. ForceSendFields []string `json:"-"`
  684. // NullFields is a list of field names (e.g. "Seqno") to include in API
  685. // requests with the JSON null value. By default, fields with empty
  686. // values are omitted from API requests. However, any field with an
  687. // empty value appearing in NullFields will be sent to the server as
  688. // null. It is an error if a field in this list has a non-empty value.
  689. // This may be used to include null fields in Patch requests.
  690. NullFields []string `json:"-"`
  691. }
  692. func (s *ExecuteBatchDmlRequest) MarshalJSON() ([]byte, error) {
  693. type NoMethod ExecuteBatchDmlRequest
  694. raw := NoMethod(*s)
  695. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  696. }
  697. // ExecuteBatchDmlResponse: The response for ExecuteBatchDml. Contains a
  698. // list
  699. // of ResultSet, one for each DML statement that has successfully
  700. // executed.
  701. // If a statement fails, the error is returned as part of the response
  702. // payload.
  703. // Clients can determine whether all DML statements have run
  704. // successfully, or if
  705. // a statement failed, using one of the following approaches:
  706. //
  707. // 1. Check if 'status' field is OkStatus.
  708. // 2. Check if result_sets_size() equals the number of statements in
  709. // ExecuteBatchDmlRequest.
  710. //
  711. // Example 1: A request with 5 DML statements, all executed
  712. // successfully.
  713. // Result: A response with 5 ResultSets, one for each statement in the
  714. // same
  715. // order, and an OK status.
  716. //
  717. // Example 2: A request with 5 DML statements. The 3rd statement has a
  718. // syntax
  719. // error.
  720. // Result: A response with 2 ResultSets, for the first 2 statements
  721. // that
  722. // run successfully, and a syntax error (INVALID_ARGUMENT) status.
  723. // From
  724. // result_set_size() client can determine that the 3rd statement has
  725. // failed.
  726. type ExecuteBatchDmlResponse struct {
  727. // ResultSets: ResultSets, one for each statement in the request that
  728. // ran successfully, in
  729. // the same order as the statements in the request. Each ResultSet
  730. // will
  731. // not contain any rows. The ResultSetStats in each ResultSet
  732. // will
  733. // contain the number of rows modified by the statement.
  734. //
  735. // Only the first ResultSet in the response contains a
  736. // valid
  737. // ResultSetMetadata.
  738. ResultSets []*ResultSet `json:"resultSets,omitempty"`
  739. // Status: If all DML statements are executed successfully, status will
  740. // be OK.
  741. // Otherwise, the error status of the first failed statement.
  742. Status *Status `json:"status,omitempty"`
  743. // ServerResponse contains the HTTP response code and headers from the
  744. // server.
  745. googleapi.ServerResponse `json:"-"`
  746. // ForceSendFields is a list of field names (e.g. "ResultSets") to
  747. // unconditionally include in API requests. By default, fields with
  748. // empty values are omitted from API requests. However, any non-pointer,
  749. // non-interface field appearing in ForceSendFields will be sent to the
  750. // server regardless of whether the field is empty or not. This may be
  751. // used to include empty fields in Patch requests.
  752. ForceSendFields []string `json:"-"`
  753. // NullFields is a list of field names (e.g. "ResultSets") to include in
  754. // API requests with the JSON null value. By default, fields with empty
  755. // values are omitted from API requests. However, any field with an
  756. // empty value appearing in NullFields will be sent to the server as
  757. // null. It is an error if a field in this list has a non-empty value.
  758. // This may be used to include null fields in Patch requests.
  759. NullFields []string `json:"-"`
  760. }
  761. func (s *ExecuteBatchDmlResponse) MarshalJSON() ([]byte, error) {
  762. type NoMethod ExecuteBatchDmlResponse
  763. raw := NoMethod(*s)
  764. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  765. }
  766. // ExecuteSqlRequest: The request for ExecuteSql
  767. // and
  768. // ExecuteStreamingSql.
  769. type ExecuteSqlRequest struct {
  770. // ParamTypes: It is not always possible for Cloud Spanner to infer the
  771. // right SQL type
  772. // from a JSON value. For example, values of type `BYTES` and values
  773. // of type `STRING` both appear in params as JSON strings.
  774. //
  775. // In these cases, `param_types` can be used to specify the exact
  776. // SQL type for some or all of the SQL statement parameters. See
  777. // the
  778. // definition of Type for more information
  779. // about SQL types.
  780. ParamTypes map[string]Type `json:"paramTypes,omitempty"`
  781. // Params: The SQL string can contain parameter placeholders. A
  782. // parameter
  783. // placeholder consists of `'@'` followed by the parameter
  784. // name. Parameter names consist of any combination of letters,
  785. // numbers, and underscores.
  786. //
  787. // Parameters can appear anywhere that a literal value is expected. The
  788. // same
  789. // parameter name can be used more than once, for example:
  790. // "WHERE id > @msg_id AND id < @msg_id + 100"
  791. //
  792. // It is an error to execute an SQL statement with unbound
  793. // parameters.
  794. //
  795. // Parameter values are specified using `params`, which is a JSON
  796. // object whose keys are parameter names, and whose values are
  797. // the
  798. // corresponding parameter values.
  799. Params googleapi.RawMessage `json:"params,omitempty"`
  800. // PartitionToken: If present, results will be restricted to the
  801. // specified partition
  802. // previously created using PartitionQuery(). There must be an
  803. // exact
  804. // match for the values of fields common to this message and
  805. // the
  806. // PartitionQueryRequest message used to create this partition_token.
  807. PartitionToken string `json:"partitionToken,omitempty"`
  808. // QueryMode: Used to control the amount of debugging information
  809. // returned in
  810. // ResultSetStats. If partition_token is set, query_mode can only
  811. // be set to QueryMode.NORMAL.
  812. //
  813. // Possible values:
  814. // "NORMAL" - The default mode. Only the statement results are
  815. // returned.
  816. // "PLAN" - This mode returns only the query plan, without any results
  817. // or
  818. // execution statistics information.
  819. // "PROFILE" - This mode returns both the query plan and the execution
  820. // statistics along
  821. // with the results.
  822. QueryMode string `json:"queryMode,omitempty"`
  823. // ResumeToken: If this request is resuming a previously interrupted SQL
  824. // statement
  825. // execution, `resume_token` should be copied from the
  826. // last
  827. // PartialResultSet yielded before the interruption. Doing this
  828. // enables the new SQL statement execution to resume where the last one
  829. // left
  830. // off. The rest of the request parameters must exactly match
  831. // the
  832. // request that yielded this token.
  833. ResumeToken string `json:"resumeToken,omitempty"`
  834. // Seqno: A per-transaction sequence number used to identify this
  835. // request. This
  836. // makes each request idempotent such that if the request is received
  837. // multiple
  838. // times, at most one will succeed.
  839. //
  840. // The sequence number must be monotonically increasing within
  841. // the
  842. // transaction. If a request arrives for the first time with an
  843. // out-of-order
  844. // sequence number, the transaction may be aborted. Replays of
  845. // previously
  846. // handled requests will yield the same response as the first
  847. // execution.
  848. //
  849. // Required for DML statements. Ignored for queries.
  850. Seqno int64 `json:"seqno,omitempty,string"`
  851. // Sql: Required. The SQL string.
  852. Sql string `json:"sql,omitempty"`
  853. // Transaction: The transaction to use. If none is provided, the default
  854. // is a
  855. // temporary read-only transaction with strong concurrency.
  856. //
  857. // The transaction to use.
  858. //
  859. // For queries, if none is provided, the default is a temporary
  860. // read-only
  861. // transaction with strong concurrency.
  862. //
  863. // Standard DML statements require a ReadWrite transaction.
  864. // Single-use
  865. // transactions are not supported (to avoid replay). The caller
  866. // must
  867. // either supply an existing transaction ID or begin a new
  868. // transaction.
  869. //
  870. // Partitioned DML requires an existing PartitionedDml transaction ID.
  871. Transaction *TransactionSelector `json:"transaction,omitempty"`
  872. // ForceSendFields is a list of field names (e.g. "ParamTypes") to
  873. // unconditionally include in API requests. By default, fields with
  874. // empty values are omitted from API requests. However, any non-pointer,
  875. // non-interface field appearing in ForceSendFields will be sent to the
  876. // server regardless of whether the field is empty or not. This may be
  877. // used to include empty fields in Patch requests.
  878. ForceSendFields []string `json:"-"`
  879. // NullFields is a list of field names (e.g. "ParamTypes") to include in
  880. // API requests with the JSON null value. By default, fields with empty
  881. // values are omitted from API requests. However, any field with an
  882. // empty value appearing in NullFields will be sent to the server as
  883. // null. It is an error if a field in this list has a non-empty value.
  884. // This may be used to include null fields in Patch requests.
  885. NullFields []string `json:"-"`
  886. }
  887. func (s *ExecuteSqlRequest) MarshalJSON() ([]byte, error) {
  888. type NoMethod ExecuteSqlRequest
  889. raw := NoMethod(*s)
  890. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  891. }
  892. // Expr: Represents an expression text. Example:
  893. //
  894. // title: "User account presence"
  895. // description: "Determines whether the request has a user account"
  896. // expression: "size(request.user) > 0"
  897. type Expr struct {
  898. // Description: An optional description of the expression. This is a
  899. // longer text which
  900. // describes the expression, e.g. when hovered over it in a UI.
  901. Description string `json:"description,omitempty"`
  902. // Expression: Textual representation of an expression in
  903. // Common Expression Language syntax.
  904. //
  905. // The application context of the containing message determines
  906. // which
  907. // well-known feature set of CEL is supported.
  908. Expression string `json:"expression,omitempty"`
  909. // Location: An optional string indicating the location of the
  910. // expression for error
  911. // reporting, e.g. a file name and a position in the file.
  912. Location string `json:"location,omitempty"`
  913. // Title: An optional title for the expression, i.e. a short string
  914. // describing
  915. // its purpose. This can be used e.g. in UIs which allow to enter
  916. // the
  917. // expression.
  918. Title string `json:"title,omitempty"`
  919. // ForceSendFields is a list of field names (e.g. "Description") to
  920. // unconditionally include in API requests. By default, fields with
  921. // empty values are omitted from API requests. However, any non-pointer,
  922. // non-interface field appearing in ForceSendFields will be sent to the
  923. // server regardless of whether the field is empty or not. This may be
  924. // used to include empty fields in Patch requests.
  925. ForceSendFields []string `json:"-"`
  926. // NullFields is a list of field names (e.g. "Description") to include
  927. // in API requests with the JSON null value. By default, fields with
  928. // empty values are omitted from API requests. However, any field with
  929. // an empty value appearing in NullFields will be sent to the server as
  930. // null. It is an error if a field in this list has a non-empty value.
  931. // This may be used to include null fields in Patch requests.
  932. NullFields []string `json:"-"`
  933. }
  934. func (s *Expr) MarshalJSON() ([]byte, error) {
  935. type NoMethod Expr
  936. raw := NoMethod(*s)
  937. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  938. }
  939. // Field: Message representing a single field of a struct.
  940. type Field struct {
  941. // Name: The name of the field. For reads, this is the column name.
  942. // For
  943. // SQL queries, it is the column alias (e.g., "Word" in the
  944. // query "SELECT 'hello' AS Word"), or the column name
  945. // (e.g.,
  946. // "ColName" in the query "SELECT ColName FROM Table"). Some
  947. // columns might have an empty name (e.g., !"SELECT
  948. // UPPER(ColName)"). Note that a query result can contain
  949. // multiple fields with the same name.
  950. Name string `json:"name,omitempty"`
  951. // Type: The type of the field.
  952. Type *Type `json:"type,omitempty"`
  953. // ForceSendFields is a list of field names (e.g. "Name") to
  954. // unconditionally include in API requests. By default, fields with
  955. // empty values are omitted from API requests. However, any non-pointer,
  956. // non-interface field appearing in ForceSendFields will be sent to the
  957. // server regardless of whether the field is empty or not. This may be
  958. // used to include empty fields in Patch requests.
  959. ForceSendFields []string `json:"-"`
  960. // NullFields is a list of field names (e.g. "Name") to include in API
  961. // requests with the JSON null value. By default, fields with empty
  962. // values are omitted from API requests. However, any field with an
  963. // empty value appearing in NullFields will be sent to the server as
  964. // null. It is an error if a field in this list has a non-empty value.
  965. // This may be used to include null fields in Patch requests.
  966. NullFields []string `json:"-"`
  967. }
  968. func (s *Field) MarshalJSON() ([]byte, error) {
  969. type NoMethod Field
  970. raw := NoMethod(*s)
  971. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  972. }
  973. // GetDatabaseDdlResponse: The response for GetDatabaseDdl.
  974. type GetDatabaseDdlResponse struct {
  975. // Statements: A list of formatted DDL statements defining the schema of
  976. // the database
  977. // specified in the request.
  978. Statements []string `json:"statements,omitempty"`
  979. // ServerResponse contains the HTTP response code and headers from the
  980. // server.
  981. googleapi.ServerResponse `json:"-"`
  982. // ForceSendFields is a list of field names (e.g. "Statements") to
  983. // unconditionally include in API requests. By default, fields with
  984. // empty values are omitted from API requests. However, any non-pointer,
  985. // non-interface field appearing in ForceSendFields will be sent to the
  986. // server regardless of whether the field is empty or not. This may be
  987. // used to include empty fields in Patch requests.
  988. ForceSendFields []string `json:"-"`
  989. // NullFields is a list of field names (e.g. "Statements") to include in
  990. // API requests with the JSON null value. By default, fields with empty
  991. // values are omitted from API requests. However, any field with an
  992. // empty value appearing in NullFields will be sent to the server as
  993. // null. It is an error if a field in this list has a non-empty value.
  994. // This may be used to include null fields in Patch requests.
  995. NullFields []string `json:"-"`
  996. }
  997. func (s *GetDatabaseDdlResponse) MarshalJSON() ([]byte, error) {
  998. type NoMethod GetDatabaseDdlResponse
  999. raw := NoMethod(*s)
  1000. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1001. }
  1002. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  1003. type GetIamPolicyRequest struct {
  1004. }
  1005. // Instance: An isolated set of Cloud Spanner resources on which
  1006. // databases can be hosted.
  1007. type Instance struct {
  1008. // Config: Required. The name of the instance's configuration. Values
  1009. // are of the form
  1010. // `projects/<project>/instanceConfigs/<configuration>`. See
  1011. // also InstanceConfig and
  1012. // ListInstanceConfigs.
  1013. Config string `json:"config,omitempty"`
  1014. // DisplayName: Required. The descriptive name for this instance as it
  1015. // appears in UIs.
  1016. // Must be unique per project and between 4 and 30 characters in length.
  1017. DisplayName string `json:"displayName,omitempty"`
  1018. // Labels: Cloud Labels are a flexible and lightweight mechanism for
  1019. // organizing cloud
  1020. // resources into groups that reflect a customer's organizational needs
  1021. // and
  1022. // deployment strategies. Cloud Labels can be used to filter collections
  1023. // of
  1024. // resources. They can be used to control how resource metrics are
  1025. // aggregated.
  1026. // And they can be used as arguments to policy management rules (e.g.
  1027. // route,
  1028. // firewall, load balancing, etc.).
  1029. //
  1030. // * Label keys must be between 1 and 63 characters long and must
  1031. // conform to
  1032. // the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  1033. // * Label values must be between 0 and 63 characters long and must
  1034. // conform
  1035. // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
  1036. // * No more than 64 labels can be associated with a given
  1037. // resource.
  1038. //
  1039. // See https://goo.gl/xmQnxf for more information on and examples of
  1040. // labels.
  1041. //
  1042. // If you plan to use labels in your own code, please note that
  1043. // additional
  1044. // characters may be allowed in the future. And so you are advised to
  1045. // use an
  1046. // internal label representation, such as JSON, which doesn't rely
  1047. // upon
  1048. // specific characters being disallowed. For example, representing
  1049. // labels
  1050. // as the string: name + "_" + value would prove problematic if we
  1051. // were to
  1052. // allow "_" in a future release.
  1053. Labels map[string]string `json:"labels,omitempty"`
  1054. // Name: Required. A unique identifier for the instance, which cannot be
  1055. // changed
  1056. // after the instance is created. Values are of the
  1057. // form
  1058. // `projects/<project>/instances/a-z*[a-z0-9]`. The final
  1059. // segment of the name must be between 6 and 30 characters in length.
  1060. Name string `json:"name,omitempty"`
  1061. // NodeCount: Required. The number of nodes allocated to this instance.
  1062. // This may be zero
  1063. // in API responses for instances that are not yet in state
  1064. // `READY`.
  1065. //
  1066. // See [the
  1067. // documentation](https://cloud.google.com/spanner/docs/instances#node_co
  1068. // unt)
  1069. // for more information about nodes.
  1070. NodeCount int64 `json:"nodeCount,omitempty"`
  1071. // State: Output only. The current instance state. For
  1072. // CreateInstance, the state must be
  1073. // either omitted or set to `CREATING`. For
  1074. // UpdateInstance, the state must be
  1075. // either omitted or set to `READY`.
  1076. //
  1077. // Possible values:
  1078. // "STATE_UNSPECIFIED" - Not specified.
  1079. // "CREATING" - The instance is still being created. Resources may not
  1080. // be
  1081. // available yet, and operations such as database creation may not
  1082. // work.
  1083. // "READY" - The instance is fully created and ready to do work such
  1084. // as
  1085. // creating databases.
  1086. State string `json:"state,omitempty"`
  1087. // ServerResponse contains the HTTP response code and headers from the
  1088. // server.
  1089. googleapi.ServerResponse `json:"-"`
  1090. // ForceSendFields is a list of field names (e.g. "Config") to
  1091. // unconditionally include in API requests. By default, fields with
  1092. // empty values are omitted from API requests. However, any non-pointer,
  1093. // non-interface field appearing in ForceSendFields will be sent to the
  1094. // server regardless of whether the field is empty or not. This may be
  1095. // used to include empty fields in Patch requests.
  1096. ForceSendFields []string `json:"-"`
  1097. // NullFields is a list of field names (e.g. "Config") to include in API
  1098. // requests with the JSON null value. By default, fields with empty
  1099. // values are omitted from API requests. However, any field with an
  1100. // empty value appearing in NullFields will be sent to the server as
  1101. // null. It is an error if a field in this list has a non-empty value.
  1102. // This may be used to include null fields in Patch requests.
  1103. NullFields []string `json:"-"`
  1104. }
  1105. func (s *Instance) MarshalJSON() ([]byte, error) {
  1106. type NoMethod Instance
  1107. raw := NoMethod(*s)
  1108. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1109. }
  1110. // InstanceConfig: A possible configuration for a Cloud Spanner
  1111. // instance. Configurations
  1112. // define the geographic placement of nodes and their replication.
  1113. type InstanceConfig struct {
  1114. // DisplayName: The name of this instance configuration as it appears in
  1115. // UIs.
  1116. DisplayName string `json:"displayName,omitempty"`
  1117. // Name: A unique identifier for the instance configuration. Values
  1118. // are of the form
  1119. // `projects/<project>/instanceConfigs/a-z*`
  1120. Name string `json:"name,omitempty"`
  1121. // ServerResponse contains the HTTP response code and headers from the
  1122. // server.
  1123. googleapi.ServerResponse `json:"-"`
  1124. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1125. // unconditionally include in API requests. By default, fields with
  1126. // empty values are omitted from API requests. However, any non-pointer,
  1127. // non-interface field appearing in ForceSendFields will be sent to the
  1128. // server regardless of whether the field is empty or not. This may be
  1129. // used to include empty fields in Patch requests.
  1130. ForceSendFields []string `json:"-"`
  1131. // NullFields is a list of field names (e.g. "DisplayName") to include
  1132. // in API requests with the JSON null value. By default, fields with
  1133. // empty values are omitted from API requests. However, any field with
  1134. // an empty value appearing in NullFields will be sent to the server as
  1135. // null. It is an error if a field in this list has a non-empty value.
  1136. // This may be used to include null fields in Patch requests.
  1137. NullFields []string `json:"-"`
  1138. }
  1139. func (s *InstanceConfig) MarshalJSON() ([]byte, error) {
  1140. type NoMethod InstanceConfig
  1141. raw := NoMethod(*s)
  1142. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1143. }
  1144. // KeyRange: KeyRange represents a range of rows in a table or index.
  1145. //
  1146. // A range has a start key and an end key. These keys can be open
  1147. // or
  1148. // closed, indicating if the range includes rows with that key.
  1149. //
  1150. // Keys are represented by lists, where the ith value in the
  1151. // list
  1152. // corresponds to the ith component of the table or index primary
  1153. // key.
  1154. // Individual values are encoded as described here.
  1155. //
  1156. // For example, consider the following table definition:
  1157. //
  1158. // CREATE TABLE UserEvents (
  1159. // UserName STRING(MAX),
  1160. // EventDate STRING(10)
  1161. // ) PRIMARY KEY(UserName, EventDate);
  1162. //
  1163. // The following keys name rows in this table:
  1164. //
  1165. // "Bob", "2014-09-23"
  1166. //
  1167. // Since the `UserEvents` table's `PRIMARY KEY` clause names
  1168. // two
  1169. // columns, each `UserEvents` key has two elements; the first is
  1170. // the
  1171. // `UserName`, and the second is the `EventDate`.
  1172. //
  1173. // Key ranges with multiple components are interpreted
  1174. // lexicographically by component using the table or index key's
  1175. // declared
  1176. // sort order. For example, the following range returns all events
  1177. // for
  1178. // user "Bob" that occurred in the year 2015:
  1179. //
  1180. // "start_closed": ["Bob", "2015-01-01"]
  1181. // "end_closed": ["Bob", "2015-12-31"]
  1182. //
  1183. // Start and end keys can omit trailing key components. This affects
  1184. // the
  1185. // inclusion and exclusion of rows that exactly match the provided
  1186. // key
  1187. // components: if the key is closed, then rows that exactly match
  1188. // the
  1189. // provided components are included; if the key is open, then rows
  1190. // that exactly match are not included.
  1191. //
  1192. // For example, the following range includes all events for "Bob"
  1193. // that
  1194. // occurred during and after the year 2000:
  1195. //
  1196. // "start_closed": ["Bob", "2000-01-01"]
  1197. // "end_closed": ["Bob"]
  1198. //
  1199. // The next example retrieves all events for "Bob":
  1200. //
  1201. // "start_closed": ["Bob"]
  1202. // "end_closed": ["Bob"]
  1203. //
  1204. // To retrieve events before the year 2000:
  1205. //
  1206. // "start_closed": ["Bob"]
  1207. // "end_open": ["Bob", "2000-01-01"]
  1208. //
  1209. // The following range includes all rows in the table:
  1210. //
  1211. // "start_closed": []
  1212. // "end_closed": []
  1213. //
  1214. // This range returns all users whose `UserName` begins with
  1215. // any
  1216. // character from A to C:
  1217. //
  1218. // "start_closed": ["A"]
  1219. // "end_open": ["D"]
  1220. //
  1221. // This range returns all users whose `UserName` begins with B:
  1222. //
  1223. // "start_closed": ["B"]
  1224. // "end_open": ["C"]
  1225. //
  1226. // Key ranges honor column sort order. For example, suppose a table
  1227. // is
  1228. // defined as follows:
  1229. //
  1230. // CREATE TABLE DescendingSortedTable {
  1231. // Key INT64,
  1232. // ...
  1233. // ) PRIMARY KEY(Key DESC);
  1234. //
  1235. // The following range retrieves all rows with key values between 1
  1236. // and 100 inclusive:
  1237. //
  1238. // "start_closed": ["100"]
  1239. // "end_closed": ["1"]
  1240. //
  1241. // Note that 100 is passed as the start, and 1 is passed as the
  1242. // end,
  1243. // because `Key` is a descending column in the schema.
  1244. type KeyRange struct {
  1245. // EndClosed: If the end is closed, then the range includes all rows
  1246. // whose
  1247. // first `len(end_closed)` key columns exactly match `end_closed`.
  1248. EndClosed []interface{} `json:"endClosed,omitempty"`
  1249. // EndOpen: If the end is open, then the range excludes rows whose
  1250. // first
  1251. // `len(end_open)` key columns exactly match `end_open`.
  1252. EndOpen []interface{} `json:"endOpen,omitempty"`
  1253. // StartClosed: If the start is closed, then the range includes all rows
  1254. // whose
  1255. // first `len(start_closed)` key columns exactly match `start_closed`.
  1256. StartClosed []interface{} `json:"startClosed,omitempty"`
  1257. // StartOpen: If the start is open, then the range excludes rows whose
  1258. // first
  1259. // `len(start_open)` key columns exactly match `start_open`.
  1260. StartOpen []interface{} `json:"startOpen,omitempty"`
  1261. // ForceSendFields is a list of field names (e.g. "EndClosed") to
  1262. // unconditionally include in API requests. By default, fields with
  1263. // empty values are omitted from API requests. However, any non-pointer,
  1264. // non-interface field appearing in ForceSendFields will be sent to the
  1265. // server regardless of whether the field is empty or not. This may be
  1266. // used to include empty fields in Patch requests.
  1267. ForceSendFields []string `json:"-"`
  1268. // NullFields is a list of field names (e.g. "EndClosed") to include in
  1269. // API requests with the JSON null value. By default, fields with empty
  1270. // values are omitted from API requests. However, any field with an
  1271. // empty value appearing in NullFields will be sent to the server as
  1272. // null. It is an error if a field in this list has a non-empty value.
  1273. // This may be used to include null fields in Patch requests.
  1274. NullFields []string `json:"-"`
  1275. }
  1276. func (s *KeyRange) MarshalJSON() ([]byte, error) {
  1277. type NoMethod KeyRange
  1278. raw := NoMethod(*s)
  1279. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1280. }
  1281. // KeySet: `KeySet` defines a collection of Cloud Spanner keys and/or
  1282. // key ranges. All
  1283. // the keys are expected to be in the same table or index. The keys
  1284. // need
  1285. // not be sorted in any particular way.
  1286. //
  1287. // If the same key is specified multiple times in the set (for
  1288. // example
  1289. // if two ranges, two keys, or a key and a range overlap), Cloud
  1290. // Spanner
  1291. // behaves as if the key were only specified once.
  1292. type KeySet struct {
  1293. // All: For convenience `all` can be set to `true` to indicate that
  1294. // this
  1295. // `KeySet` matches all keys in the table or index. Note that any
  1296. // keys
  1297. // specified in `keys` or `ranges` are only yielded once.
  1298. All bool `json:"all,omitempty"`
  1299. // Keys: A list of specific keys. Entries in `keys` should have exactly
  1300. // as
  1301. // many elements as there are columns in the primary or index key
  1302. // with which this `KeySet` is used. Individual key values are
  1303. // encoded as described here.
  1304. Keys [][]interface{} `json:"keys,omitempty"`
  1305. // Ranges: A list of key ranges. See KeyRange for more information
  1306. // about
  1307. // key range specifications.
  1308. Ranges []*KeyRange `json:"ranges,omitempty"`
  1309. // ForceSendFields is a list of field names (e.g. "All") to
  1310. // unconditionally include in API requests. By default, fields with
  1311. // empty values are omitted from API requests. However, any non-pointer,
  1312. // non-interface field appearing in ForceSendFields will be sent to the
  1313. // server regardless of whether the field is empty or not. This may be
  1314. // used to include empty fields in Patch requests.
  1315. ForceSendFields []string `json:"-"`
  1316. // NullFields is a list of field names (e.g. "All") to include in API
  1317. // requests with the JSON null value. By default, fields with empty
  1318. // values are omitted from API requests. However, any field with an
  1319. // empty value appearing in NullFields will be sent to the server as
  1320. // null. It is an error if a field in this list has a non-empty value.
  1321. // This may be used to include null fields in Patch requests.
  1322. NullFields []string `json:"-"`
  1323. }
  1324. func (s *KeySet) MarshalJSON() ([]byte, error) {
  1325. type NoMethod KeySet
  1326. raw := NoMethod(*s)
  1327. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1328. }
  1329. // ListDatabasesResponse: The response for ListDatabases.
  1330. type ListDatabasesResponse struct {
  1331. // Databases: Databases that matched the request.
  1332. Databases []*Database `json:"databases,omitempty"`
  1333. // NextPageToken: `next_page_token` can be sent in a
  1334. // subsequent
  1335. // ListDatabases call to fetch more
  1336. // of the matching databases.
  1337. NextPageToken string `json:"nextPageToken,omitempty"`
  1338. // ServerResponse contains the HTTP response code and headers from the
  1339. // server.
  1340. googleapi.ServerResponse `json:"-"`
  1341. // ForceSendFields is a list of field names (e.g. "Databases") to
  1342. // unconditionally include in API requests. By default, fields with
  1343. // empty values are omitted from API requests. However, any non-pointer,
  1344. // non-interface field appearing in ForceSendFields will be sent to the
  1345. // server regardless of whether the field is empty or not. This may be
  1346. // used to include empty fields in Patch requests.
  1347. ForceSendFields []string `json:"-"`
  1348. // NullFields is a list of field names (e.g. "Databases") to include in
  1349. // API requests with the JSON null value. By default, fields with empty
  1350. // values are omitted from API requests. However, any field with an
  1351. // empty value appearing in NullFields will be sent to the server as
  1352. // null. It is an error if a field in this list has a non-empty value.
  1353. // This may be used to include null fields in Patch requests.
  1354. NullFields []string `json:"-"`
  1355. }
  1356. func (s *ListDatabasesResponse) MarshalJSON() ([]byte, error) {
  1357. type NoMethod ListDatabasesResponse
  1358. raw := NoMethod(*s)
  1359. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1360. }
  1361. // ListInstanceConfigsResponse: The response for ListInstanceConfigs.
  1362. type ListInstanceConfigsResponse struct {
  1363. // InstanceConfigs: The list of requested instance configurations.
  1364. InstanceConfigs []*InstanceConfig `json:"instanceConfigs,omitempty"`
  1365. // NextPageToken: `next_page_token` can be sent in a
  1366. // subsequent
  1367. // ListInstanceConfigs call to
  1368. // fetch more of the matching instance configurations.
  1369. NextPageToken string `json:"nextPageToken,omitempty"`
  1370. // ServerResponse contains the HTTP response code and headers from the
  1371. // server.
  1372. googleapi.ServerResponse `json:"-"`
  1373. // ForceSendFields is a list of field names (e.g. "InstanceConfigs") to
  1374. // unconditionally include in API requests. By default, fields with
  1375. // empty values are omitted from API requests. However, any non-pointer,
  1376. // non-interface field appearing in ForceSendFields will be sent to the
  1377. // server regardless of whether the field is empty or not. This may be
  1378. // used to include empty fields in Patch requests.
  1379. ForceSendFields []string `json:"-"`
  1380. // NullFields is a list of field names (e.g. "InstanceConfigs") to
  1381. // include in API requests with the JSON null value. By default, fields
  1382. // with empty values are omitted from API requests. However, any field
  1383. // with an empty value appearing in NullFields will be sent to the
  1384. // server as null. It is an error if a field in this list has a
  1385. // non-empty value. This may be used to include null fields in Patch
  1386. // requests.
  1387. NullFields []string `json:"-"`
  1388. }
  1389. func (s *ListInstanceConfigsResponse) MarshalJSON() ([]byte, error) {
  1390. type NoMethod ListInstanceConfigsResponse
  1391. raw := NoMethod(*s)
  1392. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1393. }
  1394. // ListInstancesResponse: The response for ListInstances.
  1395. type ListInstancesResponse struct {
  1396. // Instances: The list of requested instances.
  1397. Instances []*Instance `json:"instances,omitempty"`
  1398. // NextPageToken: `next_page_token` can be sent in a
  1399. // subsequent
  1400. // ListInstances call to fetch more
  1401. // of the matching instances.
  1402. NextPageToken string `json:"nextPageToken,omitempty"`
  1403. // ServerResponse contains the HTTP response code and headers from the
  1404. // server.
  1405. googleapi.ServerResponse `json:"-"`
  1406. // ForceSendFields is a list of field names (e.g. "Instances") to
  1407. // unconditionally include in API requests. By default, fields with
  1408. // empty values are omitted from API requests. However, any non-pointer,
  1409. // non-interface field appearing in ForceSendFields will be sent to the
  1410. // server regardless of whether the field is empty or not. This may be
  1411. // used to include empty fields in Patch requests.
  1412. ForceSendFields []string `json:"-"`
  1413. // NullFields is a list of field names (e.g. "Instances") to include in
  1414. // API requests with the JSON null value. By default, fields with empty
  1415. // values are omitted from API requests. However, any field with an
  1416. // empty value appearing in NullFields will be sent to the server as
  1417. // null. It is an error if a field in this list has a non-empty value.
  1418. // This may be used to include null fields in Patch requests.
  1419. NullFields []string `json:"-"`
  1420. }
  1421. func (s *ListInstancesResponse) MarshalJSON() ([]byte, error) {
  1422. type NoMethod ListInstancesResponse
  1423. raw := NoMethod(*s)
  1424. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1425. }
  1426. // ListOperationsResponse: The response message for
  1427. // Operations.ListOperations.
  1428. type ListOperationsResponse struct {
  1429. // NextPageToken: The standard List next-page token.
  1430. NextPageToken string `json:"nextPageToken,omitempty"`
  1431. // Operations: A list of operations that matches the specified filter in
  1432. // the request.
  1433. Operations []*Operation `json:"operations,omitempty"`
  1434. // ServerResponse contains the HTTP response code and headers from the
  1435. // server.
  1436. googleapi.ServerResponse `json:"-"`
  1437. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1438. // unconditionally include in API requests. By default, fields with
  1439. // empty values are omitted from API requests. However, any non-pointer,
  1440. // non-interface field appearing in ForceSendFields will be sent to the
  1441. // server regardless of whether the field is empty or not. This may be
  1442. // used to include empty fields in Patch requests.
  1443. ForceSendFields []string `json:"-"`
  1444. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1445. // in API requests with the JSON null value. By default, fields with
  1446. // empty values are omitted from API requests. However, any field with
  1447. // an empty value appearing in NullFields will be sent to the server as
  1448. // null. It is an error if a field in this list has a non-empty value.
  1449. // This may be used to include null fields in Patch requests.
  1450. NullFields []string `json:"-"`
  1451. }
  1452. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  1453. type NoMethod ListOperationsResponse
  1454. raw := NoMethod(*s)
  1455. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1456. }
  1457. // ListSessionsResponse: The response for ListSessions.
  1458. type ListSessionsResponse struct {
  1459. // NextPageToken: `next_page_token` can be sent in a
  1460. // subsequent
  1461. // ListSessions call to fetch more of the matching
  1462. // sessions.
  1463. NextPageToken string `json:"nextPageToken,omitempty"`
  1464. // Sessions: The list of requested sessions.
  1465. Sessions []*Session `json:"sessions,omitempty"`
  1466. // ServerResponse contains the HTTP response code and headers from the
  1467. // server.
  1468. googleapi.ServerResponse `json:"-"`
  1469. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1470. // unconditionally include in API requests. By default, fields with
  1471. // empty values are omitted from API requests. However, any non-pointer,
  1472. // non-interface field appearing in ForceSendFields will be sent to the
  1473. // server regardless of whether the field is empty or not. This may be
  1474. // used to include empty fields in Patch requests.
  1475. ForceSendFields []string `json:"-"`
  1476. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1477. // in API requests with the JSON null value. By default, fields with
  1478. // empty values are omitted from API requests. However, any field with
  1479. // an empty value appearing in NullFields will be sent to the server as
  1480. // null. It is an error if a field in this list has a non-empty value.
  1481. // This may be used to include null fields in Patch requests.
  1482. NullFields []string `json:"-"`
  1483. }
  1484. func (s *ListSessionsResponse) MarshalJSON() ([]byte, error) {
  1485. type NoMethod ListSessionsResponse
  1486. raw := NoMethod(*s)
  1487. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1488. }
  1489. // Mutation: A modification to one or more Cloud Spanner rows.
  1490. // Mutations can be
  1491. // applied to a Cloud Spanner database by sending them in a
  1492. // Commit call.
  1493. type Mutation struct {
  1494. // Delete: Delete rows from a table. Succeeds whether or not the
  1495. // named
  1496. // rows were present.
  1497. Delete *Delete `json:"delete,omitempty"`
  1498. // Insert: Insert new rows in a table. If any of the rows already
  1499. // exist,
  1500. // the write or transaction fails with error `ALREADY_EXISTS`.
  1501. Insert *Write `json:"insert,omitempty"`
  1502. // InsertOrUpdate: Like insert, except that if the row already exists,
  1503. // then
  1504. // its column values are overwritten with the ones provided. Any
  1505. // column values not explicitly written are preserved.
  1506. InsertOrUpdate *Write `json:"insertOrUpdate,omitempty"`
  1507. // Replace: Like insert, except that if the row already exists, it
  1508. // is
  1509. // deleted, and the column values provided are inserted
  1510. // instead. Unlike insert_or_update, this means any values
  1511. // not
  1512. // explicitly written become `NULL`.
  1513. Replace *Write `json:"replace,omitempty"`
  1514. // Update: Update existing rows in a table. If any of the rows does
  1515. // not
  1516. // already exist, the transaction fails with error `NOT_FOUND`.
  1517. Update *Write `json:"update,omitempty"`
  1518. // ForceSendFields is a list of field names (e.g. "Delete") to
  1519. // unconditionally include in API requests. By default, fields with
  1520. // empty values are omitted from API requests. However, any non-pointer,
  1521. // non-interface field appearing in ForceSendFields will be sent to the
  1522. // server regardless of whether the field is empty or not. This may be
  1523. // used to include empty fields in Patch requests.
  1524. ForceSendFields []string `json:"-"`
  1525. // NullFields is a list of field names (e.g. "Delete") to include in API
  1526. // requests with the JSON null value. By default, fields with empty
  1527. // values are omitted from API requests. However, any field with an
  1528. // empty value appearing in NullFields will be sent to the server as
  1529. // null. It is an error if a field in this list has a non-empty value.
  1530. // This may be used to include null fields in Patch requests.
  1531. NullFields []string `json:"-"`
  1532. }
  1533. func (s *Mutation) MarshalJSON() ([]byte, error) {
  1534. type NoMethod Mutation
  1535. raw := NoMethod(*s)
  1536. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1537. }
  1538. // Operation: This resource represents a long-running operation that is
  1539. // the result of a
  1540. // network API call.
  1541. type Operation struct {
  1542. // Done: If the value is `false`, it means the operation is still in
  1543. // progress.
  1544. // If `true`, the operation is completed, and either `error` or
  1545. // `response` is
  1546. // available.
  1547. Done bool `json:"done,omitempty"`
  1548. // Error: The error result of the operation in case of failure or
  1549. // cancellation.
  1550. Error *Status `json:"error,omitempty"`
  1551. // Metadata: Service-specific metadata associated with the operation.
  1552. // It typically
  1553. // contains progress information and common metadata such as create
  1554. // time.
  1555. // Some services might not provide such metadata. Any method that
  1556. // returns a
  1557. // long-running operation should document the metadata type, if any.
  1558. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1559. // Name: The server-assigned name, which is only unique within the same
  1560. // service that
  1561. // originally returns it. If you use the default HTTP mapping,
  1562. // the
  1563. // `name` should have the format of `operations/some/unique/name`.
  1564. Name string `json:"name,omitempty"`
  1565. // Response: The normal response of the operation in case of success.
  1566. // If the original
  1567. // method returns no data on success, such as `Delete`, the response
  1568. // is
  1569. // `google.protobuf.Empty`. If the original method is
  1570. // standard
  1571. // `Get`/`Create`/`Update`, the response should be the resource. For
  1572. // other
  1573. // methods, the response should have the type `XxxResponse`, where
  1574. // `Xxx`
  1575. // is the original method name. For example, if the original method
  1576. // name
  1577. // is `TakeSnapshot()`, the inferred response type
  1578. // is
  1579. // `TakeSnapshotResponse`.
  1580. Response googleapi.RawMessage `json:"response,omitempty"`
  1581. // ServerResponse contains the HTTP response code and headers from the
  1582. // server.
  1583. googleapi.ServerResponse `json:"-"`
  1584. // ForceSendFields is a list of field names (e.g. "Done") to
  1585. // unconditionally include in API requests. By default, fields with
  1586. // empty values are omitted from API requests. However, any non-pointer,
  1587. // non-interface field appearing in ForceSendFields will be sent to the
  1588. // server regardless of whether the field is empty or not. This may be
  1589. // used to include empty fields in Patch requests.
  1590. ForceSendFields []string `json:"-"`
  1591. // NullFields is a list of field names (e.g. "Done") to include in API
  1592. // requests with the JSON null value. By default, fields with empty
  1593. // values are omitted from API requests. However, any field with an
  1594. // empty value appearing in NullFields will be sent to the server as
  1595. // null. It is an error if a field in this list has a non-empty value.
  1596. // This may be used to include null fields in Patch requests.
  1597. NullFields []string `json:"-"`
  1598. }
  1599. func (s *Operation) MarshalJSON() ([]byte, error) {
  1600. type NoMethod Operation
  1601. raw := NoMethod(*s)
  1602. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1603. }
  1604. // PartialResultSet: Partial results from a streaming read or SQL query.
  1605. // Streaming reads and
  1606. // SQL queries better tolerate large result sets, large rows, and
  1607. // large
  1608. // values, but are a little trickier to consume.
  1609. type PartialResultSet struct {
  1610. // ChunkedValue: If true, then the final value in values is chunked, and
  1611. // must
  1612. // be combined with more values from subsequent `PartialResultSet`s
  1613. // to obtain a complete field value.
  1614. ChunkedValue bool `json:"chunkedValue,omitempty"`
  1615. // Metadata: Metadata about the result set, such as row type
  1616. // information.
  1617. // Only present in the first response.
  1618. Metadata *ResultSetMetadata `json:"metadata,omitempty"`
  1619. // ResumeToken: Streaming calls might be interrupted for a variety of
  1620. // reasons, such
  1621. // as TCP connection loss. If this occurs, the stream of results can
  1622. // be resumed by re-sending the original request and
  1623. // including
  1624. // `resume_token`. Note that executing any other transaction in the
  1625. // same session invalidates the token.
  1626. ResumeToken string `json:"resumeToken,omitempty"`
  1627. // Stats: Query plan and execution statistics for the statement that
  1628. // produced this
  1629. // streaming result set. These can be requested by
  1630. // setting
  1631. // ExecuteSqlRequest.query_mode and are sent
  1632. // only once with the last response in the stream.
  1633. // This field will also be present in the last response for
  1634. // DML
  1635. // statements.
  1636. Stats *ResultSetStats `json:"stats,omitempty"`
  1637. // Values: A streamed result set consists of a stream of values, which
  1638. // might
  1639. // be split into many `PartialResultSet` messages to accommodate
  1640. // large rows and/or large values. Every N complete values defines
  1641. // a
  1642. // row, where N is equal to the number of entries
  1643. // in
  1644. // metadata.row_type.fields.
  1645. //
  1646. // Most values are encoded based on type as described
  1647. // here.
  1648. //
  1649. // It is possible that the last value in values is "chunked",
  1650. // meaning that the rest of the value is sent in
  1651. // subsequent
  1652. // `PartialResultSet`(s). This is denoted by the chunked_value
  1653. // field. Two or more chunked values can be merged to form a
  1654. // complete value as follows:
  1655. //
  1656. // * `bool/number/null`: cannot be chunked
  1657. // * `string`: concatenate the strings
  1658. // * `list`: concatenate the lists. If the last element in a list is
  1659. // a
  1660. // `string`, `list`, or `object`, merge it with the first element
  1661. // in
  1662. // the next list by applying these rules recursively.
  1663. // * `object`: concatenate the (field name, field value) pairs. If a
  1664. // field name is duplicated, then apply these rules recursively
  1665. // to merge the field values.
  1666. //
  1667. // Some examples of merging:
  1668. //
  1669. // # Strings are concatenated.
  1670. // "foo", "bar" => "foobar"
  1671. //
  1672. // # Lists of non-strings are concatenated.
  1673. // [2, 3], [4] => [2, 3, 4]
  1674. //
  1675. // # Lists are concatenated, but the last and first elements are
  1676. // merged
  1677. // # because they are strings.
  1678. // ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
  1679. //
  1680. // # Lists are concatenated, but the last and first elements are
  1681. // merged
  1682. // # because they are lists. Recursively, the last and first
  1683. // elements
  1684. // # of the inner lists are merged because they are strings.
  1685. // ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
  1686. //
  1687. // # Non-overlapping object fields are combined.
  1688. // {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
  1689. //
  1690. // # Overlapping object fields are merged.
  1691. // {"a": "1"}, {"a": "2"} => {"a": "12"}
  1692. //
  1693. // # Examples of merging objects containing lists of strings.
  1694. // {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
  1695. //
  1696. // For a more complete example, suppose a streaming SQL query
  1697. // is
  1698. // yielding a result set whose rows contain a single string
  1699. // field. The following `PartialResultSet`s might be yielded:
  1700. //
  1701. // {
  1702. // "metadata": { ... }
  1703. // "values": ["Hello", "W"]
  1704. // "chunked_value": true
  1705. // "resume_token": "Af65..."
  1706. // }
  1707. // {
  1708. // "values": ["orl"]
  1709. // "chunked_value": true
  1710. // "resume_token": "Bqp2..."
  1711. // }
  1712. // {
  1713. // "values": ["d"]
  1714. // "resume_token": "Zx1B..."
  1715. // }
  1716. //
  1717. // This sequence of `PartialResultSet`s encodes two rows, one
  1718. // containing the field value "Hello", and a second containing
  1719. // the
  1720. // field value "World" = "W" + "orl" + "d".
  1721. Values []interface{} `json:"values,omitempty"`
  1722. // ServerResponse contains the HTTP response code and headers from the
  1723. // server.
  1724. googleapi.ServerResponse `json:"-"`
  1725. // ForceSendFields is a list of field names (e.g. "ChunkedValue") to
  1726. // unconditionally include in API requests. By default, fields with
  1727. // empty values are omitted from API requests. However, any non-pointer,
  1728. // non-interface field appearing in ForceSendFields will be sent to the
  1729. // server regardless of whether the field is empty or not. This may be
  1730. // used to include empty fields in Patch requests.
  1731. ForceSendFields []string `json:"-"`
  1732. // NullFields is a list of field names (e.g. "ChunkedValue") to include
  1733. // in API requests with the JSON null value. By default, fields with
  1734. // empty values are omitted from API requests. However, any field with
  1735. // an empty value appearing in NullFields will be sent to the server as
  1736. // null. It is an error if a field in this list has a non-empty value.
  1737. // This may be used to include null fields in Patch requests.
  1738. NullFields []string `json:"-"`
  1739. }
  1740. func (s *PartialResultSet) MarshalJSON() ([]byte, error) {
  1741. type NoMethod PartialResultSet
  1742. raw := NoMethod(*s)
  1743. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1744. }
  1745. // Partition: Information returned for each partition returned in
  1746. // a
  1747. // PartitionResponse.
  1748. type Partition struct {
  1749. // PartitionToken: This token can be passed to Read, StreamingRead,
  1750. // ExecuteSql, or
  1751. // ExecuteStreamingSql requests to restrict the results to those
  1752. // identified by
  1753. // this partition token.
  1754. PartitionToken string `json:"partitionToken,omitempty"`
  1755. // ForceSendFields is a list of field names (e.g. "PartitionToken") to
  1756. // unconditionally include in API requests. By default, fields with
  1757. // empty values are omitted from API requests. However, any non-pointer,
  1758. // non-interface field appearing in ForceSendFields will be sent to the
  1759. // server regardless of whether the field is empty or not. This may be
  1760. // used to include empty fields in Patch requests.
  1761. ForceSendFields []string `json:"-"`
  1762. // NullFields is a list of field names (e.g. "PartitionToken") to
  1763. // include in API requests with the JSON null value. By default, fields
  1764. // with empty values are omitted from API requests. However, any field
  1765. // with an empty value appearing in NullFields will be sent to the
  1766. // server as null. It is an error if a field in this list has a
  1767. // non-empty value. This may be used to include null fields in Patch
  1768. // requests.
  1769. NullFields []string `json:"-"`
  1770. }
  1771. func (s *Partition) MarshalJSON() ([]byte, error) {
  1772. type NoMethod Partition
  1773. raw := NoMethod(*s)
  1774. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1775. }
  1776. // PartitionOptions: Options for a PartitionQueryRequest
  1777. // and
  1778. // PartitionReadRequest.
  1779. type PartitionOptions struct {
  1780. // MaxPartitions: **Note:** This hint is currently ignored by
  1781. // PartitionQuery and
  1782. // PartitionRead requests.
  1783. //
  1784. // The desired maximum number of partitions to return. For example,
  1785. // this may
  1786. // be set to the number of workers available. The default for this
  1787. // option
  1788. // is currently 10,000. The maximum value is currently 200,000. This is
  1789. // only
  1790. // a hint. The actual number of partitions returned may be smaller or
  1791. // larger
  1792. // than this maximum count request.
  1793. MaxPartitions int64 `json:"maxPartitions,omitempty,string"`
  1794. // PartitionSizeBytes: **Note:** This hint is currently ignored by
  1795. // PartitionQuery and
  1796. // PartitionRead requests.
  1797. //
  1798. // The desired data size for each partition generated. The default for
  1799. // this
  1800. // option is currently 1 GiB. This is only a hint. The actual size of
  1801. // each
  1802. // partition may be smaller or larger than this size request.
  1803. PartitionSizeBytes int64 `json:"partitionSizeBytes,omitempty,string"`
  1804. // ForceSendFields is a list of field names (e.g. "MaxPartitions") to
  1805. // unconditionally include in API requests. By default, fields with
  1806. // empty values are omitted from API requests. However, any non-pointer,
  1807. // non-interface field appearing in ForceSendFields will be sent to the
  1808. // server regardless of whether the field is empty or not. This may be
  1809. // used to include empty fields in Patch requests.
  1810. ForceSendFields []string `json:"-"`
  1811. // NullFields is a list of field names (e.g. "MaxPartitions") to include
  1812. // in API requests with the JSON null value. By default, fields with
  1813. // empty values are omitted from API requests. However, any field with
  1814. // an empty value appearing in NullFields will be sent to the server as
  1815. // null. It is an error if a field in this list has a non-empty value.
  1816. // This may be used to include null fields in Patch requests.
  1817. NullFields []string `json:"-"`
  1818. }
  1819. func (s *PartitionOptions) MarshalJSON() ([]byte, error) {
  1820. type NoMethod PartitionOptions
  1821. raw := NoMethod(*s)
  1822. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1823. }
  1824. // PartitionQueryRequest: The request for PartitionQuery
  1825. type PartitionQueryRequest struct {
  1826. // ParamTypes: It is not always possible for Cloud Spanner to infer the
  1827. // right SQL type
  1828. // from a JSON value. For example, values of type `BYTES` and values
  1829. // of type `STRING` both appear in params as JSON strings.
  1830. //
  1831. // In these cases, `param_types` can be used to specify the exact
  1832. // SQL type for some or all of the SQL query parameters. See
  1833. // the
  1834. // definition of Type for more information
  1835. // about SQL types.
  1836. ParamTypes map[string]Type `json:"paramTypes,omitempty"`
  1837. // Params: The SQL query string can contain parameter placeholders. A
  1838. // parameter
  1839. // placeholder consists of `'@'` followed by the parameter
  1840. // name. Parameter names consist of any combination of letters,
  1841. // numbers, and underscores.
  1842. //
  1843. // Parameters can appear anywhere that a literal value is expected. The
  1844. // same
  1845. // parameter name can be used more than once, for example:
  1846. // "WHERE id > @msg_id AND id < @msg_id + 100"
  1847. //
  1848. // It is an error to execute an SQL query with unbound
  1849. // parameters.
  1850. //
  1851. // Parameter values are specified using `params`, which is a JSON
  1852. // object whose keys are parameter names, and whose values are
  1853. // the
  1854. // corresponding parameter values.
  1855. Params googleapi.RawMessage `json:"params,omitempty"`
  1856. // PartitionOptions: Additional options that affect how many partitions
  1857. // are created.
  1858. PartitionOptions *PartitionOptions `json:"partitionOptions,omitempty"`
  1859. // Sql: The query request to generate partitions for. The request will
  1860. // fail if
  1861. // the query is not root partitionable. The query plan of a
  1862. // root
  1863. // partitionable query has a single distributed union operator. A
  1864. // distributed
  1865. // union operator conceptually divides one or more tables into
  1866. // multiple
  1867. // splits, remotely evaluates a subquery independently on each split,
  1868. // and
  1869. // then unions all results.
  1870. //
  1871. // This must not contain DML commands, such as INSERT, UPDATE,
  1872. // or
  1873. // DELETE. Use ExecuteStreamingSql with a
  1874. // PartitionedDml transaction for large, partition-friendly DML
  1875. // operations.
  1876. Sql string `json:"sql,omitempty"`
  1877. // Transaction: Read only snapshot transactions are supported,
  1878. // read/write and single use
  1879. // transactions are not.
  1880. Transaction *TransactionSelector `json:"transaction,omitempty"`
  1881. // ForceSendFields is a list of field names (e.g. "ParamTypes") to
  1882. // unconditionally include in API requests. By default, fields with
  1883. // empty values are omitted from API requests. However, any non-pointer,
  1884. // non-interface field appearing in ForceSendFields will be sent to the
  1885. // server regardless of whether the field is empty or not. This may be
  1886. // used to include empty fields in Patch requests.
  1887. ForceSendFields []string `json:"-"`
  1888. // NullFields is a list of field names (e.g. "ParamTypes") to include in
  1889. // API requests with the JSON null value. By default, fields with empty
  1890. // values are omitted from API requests. However, any field with an
  1891. // empty value appearing in NullFields will be sent to the server as
  1892. // null. It is an error if a field in this list has a non-empty value.
  1893. // This may be used to include null fields in Patch requests.
  1894. NullFields []string `json:"-"`
  1895. }
  1896. func (s *PartitionQueryRequest) MarshalJSON() ([]byte, error) {
  1897. type NoMethod PartitionQueryRequest
  1898. raw := NoMethod(*s)
  1899. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1900. }
  1901. // PartitionReadRequest: The request for PartitionRead
  1902. type PartitionReadRequest struct {
  1903. // Columns: The columns of table to be returned for each row
  1904. // matching
  1905. // this request.
  1906. Columns []string `json:"columns,omitempty"`
  1907. // Index: If non-empty, the name of an index on table. This index
  1908. // is
  1909. // used instead of the table primary key when interpreting key_set
  1910. // and sorting result rows. See key_set for further information.
  1911. Index string `json:"index,omitempty"`
  1912. // KeySet: Required. `key_set` identifies the rows to be yielded.
  1913. // `key_set` names the
  1914. // primary keys of the rows in table to be yielded, unless index
  1915. // is present. If index is present, then key_set instead names
  1916. // index keys in index.
  1917. //
  1918. // It is not an error for the `key_set` to name rows that do not
  1919. // exist in the database. Read yields nothing for nonexistent rows.
  1920. KeySet *KeySet `json:"keySet,omitempty"`
  1921. // PartitionOptions: Additional options that affect how many partitions
  1922. // are created.
  1923. PartitionOptions *PartitionOptions `json:"partitionOptions,omitempty"`
  1924. // Table: Required. The name of the table in the database to be read.
  1925. Table string `json:"table,omitempty"`
  1926. // Transaction: Read only snapshot transactions are supported,
  1927. // read/write and single use
  1928. // transactions are not.
  1929. Transaction *TransactionSelector `json:"transaction,omitempty"`
  1930. // ForceSendFields is a list of field names (e.g. "Columns") to
  1931. // unconditionally include in API requests. By default, fields with
  1932. // empty values are omitted from API requests. However, any non-pointer,
  1933. // non-interface field appearing in ForceSendFields will be sent to the
  1934. // server regardless of whether the field is empty or not. This may be
  1935. // used to include empty fields in Patch requests.
  1936. ForceSendFields []string `json:"-"`
  1937. // NullFields is a list of field names (e.g. "Columns") to include in
  1938. // API requests with the JSON null value. By default, fields with empty
  1939. // values are omitted from API requests. However, any field with an
  1940. // empty value appearing in NullFields will be sent to the server as
  1941. // null. It is an error if a field in this list has a non-empty value.
  1942. // This may be used to include null fields in Patch requests.
  1943. NullFields []string `json:"-"`
  1944. }
  1945. func (s *PartitionReadRequest) MarshalJSON() ([]byte, error) {
  1946. type NoMethod PartitionReadRequest
  1947. raw := NoMethod(*s)
  1948. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1949. }
  1950. // PartitionResponse: The response for PartitionQuery
  1951. // or PartitionRead
  1952. type PartitionResponse struct {
  1953. // Partitions: Partitions created by this request.
  1954. Partitions []*Partition `json:"partitions,omitempty"`
  1955. // Transaction: Transaction created by this request.
  1956. Transaction *Transaction `json:"transaction,omitempty"`
  1957. // ServerResponse contains the HTTP response code and headers from the
  1958. // server.
  1959. googleapi.ServerResponse `json:"-"`
  1960. // ForceSendFields is a list of field names (e.g. "Partitions") to
  1961. // unconditionally include in API requests. By default, fields with
  1962. // empty values are omitted from API requests. However, any non-pointer,
  1963. // non-interface field appearing in ForceSendFields will be sent to the
  1964. // server regardless of whether the field is empty or not. This may be
  1965. // used to include empty fields in Patch requests.
  1966. ForceSendFields []string `json:"-"`
  1967. // NullFields is a list of field names (e.g. "Partitions") to include in
  1968. // API requests with the JSON null value. By default, fields with empty
  1969. // values are omitted from API requests. However, any field with an
  1970. // empty value appearing in NullFields will be sent to the server as
  1971. // null. It is an error if a field in this list has a non-empty value.
  1972. // This may be used to include null fields in Patch requests.
  1973. NullFields []string `json:"-"`
  1974. }
  1975. func (s *PartitionResponse) MarshalJSON() ([]byte, error) {
  1976. type NoMethod PartitionResponse
  1977. raw := NoMethod(*s)
  1978. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1979. }
  1980. // PartitionedDml: Message type to initiate a Partitioned DML
  1981. // transaction.
  1982. type PartitionedDml struct {
  1983. }
  1984. // PlanNode: Node information for nodes appearing in a
  1985. // QueryPlan.plan_nodes.
  1986. type PlanNode struct {
  1987. // ChildLinks: List of child node `index`es and their relationship to
  1988. // this parent.
  1989. ChildLinks []*ChildLink `json:"childLinks,omitempty"`
  1990. // DisplayName: The display name for the node.
  1991. DisplayName string `json:"displayName,omitempty"`
  1992. // ExecutionStats: The execution statistics associated with the node,
  1993. // contained in a group of
  1994. // key-value pairs. Only present if the plan was returned as a result of
  1995. // a
  1996. // profile query. For example, number of executions, number of rows/time
  1997. // per
  1998. // execution etc.
  1999. ExecutionStats googleapi.RawMessage `json:"executionStats,omitempty"`
  2000. // Index: The `PlanNode`'s index in node list.
  2001. Index int64 `json:"index,omitempty"`
  2002. // Kind: Used to determine the type of node. May be needed for
  2003. // visualizing
  2004. // different kinds of nodes differently. For example, If the node is
  2005. // a
  2006. // SCALAR node, it will have a condensed representation
  2007. // which can be used to directly embed a description of the node in
  2008. // its
  2009. // parent.
  2010. //
  2011. // Possible values:
  2012. // "KIND_UNSPECIFIED" - Not specified.
  2013. // "RELATIONAL" - Denotes a Relational operator node in the expression
  2014. // tree. Relational
  2015. // operators represent iterative processing of rows during query
  2016. // execution.
  2017. // For example, a `TableScan` operation that reads rows from a table.
  2018. // "SCALAR" - Denotes a Scalar node in the expression tree. Scalar
  2019. // nodes represent
  2020. // non-iterable entities in the query plan. For example, constants
  2021. // or
  2022. // arithmetic operators appearing inside predicate expressions or
  2023. // references
  2024. // to column names.
  2025. Kind string `json:"kind,omitempty"`
  2026. // Metadata: Attributes relevant to the node contained in a group of
  2027. // key-value pairs.
  2028. // For example, a Parameter Reference node could have the
  2029. // following
  2030. // information in its metadata:
  2031. //
  2032. // {
  2033. // "parameter_reference": "param1",
  2034. // "parameter_type": "array"
  2035. // }
  2036. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  2037. // ShortRepresentation: Condensed representation for SCALAR nodes.
  2038. ShortRepresentation *ShortRepresentation `json:"shortRepresentation,omitempty"`
  2039. // ForceSendFields is a list of field names (e.g. "ChildLinks") to
  2040. // unconditionally include in API requests. By default, fields with
  2041. // empty values are omitted from API requests. However, any non-pointer,
  2042. // non-interface field appearing in ForceSendFields will be sent to the
  2043. // server regardless of whether the field is empty or not. This may be
  2044. // used to include empty fields in Patch requests.
  2045. ForceSendFields []string `json:"-"`
  2046. // NullFields is a list of field names (e.g. "ChildLinks") to include in
  2047. // API requests with the JSON null value. By default, fields with empty
  2048. // values are omitted from API requests. However, any field with an
  2049. // empty value appearing in NullFields will be sent to the server as
  2050. // null. It is an error if a field in this list has a non-empty value.
  2051. // This may be used to include null fields in Patch requests.
  2052. NullFields []string `json:"-"`
  2053. }
  2054. func (s *PlanNode) MarshalJSON() ([]byte, error) {
  2055. type NoMethod PlanNode
  2056. raw := NoMethod(*s)
  2057. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2058. }
  2059. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  2060. // used to
  2061. // specify access control policies for Cloud Platform resources.
  2062. //
  2063. //
  2064. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  2065. // of
  2066. // `members` to a `role`, where the members can be user accounts, Google
  2067. // groups,
  2068. // Google domains, and service accounts. A `role` is a named list of
  2069. // permissions
  2070. // defined by IAM.
  2071. //
  2072. // **JSON Example**
  2073. //
  2074. // {
  2075. // "bindings": [
  2076. // {
  2077. // "role": "roles/owner",
  2078. // "members": [
  2079. // "user:mike@example.com",
  2080. // "group:admins@example.com",
  2081. // "domain:google.com",
  2082. //
  2083. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  2084. // ]
  2085. // },
  2086. // {
  2087. // "role": "roles/viewer",
  2088. // "members": ["user:sean@example.com"]
  2089. // }
  2090. // ]
  2091. // }
  2092. //
  2093. // **YAML Example**
  2094. //
  2095. // bindings:
  2096. // - members:
  2097. // - user:mike@example.com
  2098. // - group:admins@example.com
  2099. // - domain:google.com
  2100. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  2101. // role: roles/owner
  2102. // - members:
  2103. // - user:sean@example.com
  2104. // role: roles/viewer
  2105. //
  2106. //
  2107. // For a description of IAM and its features, see the
  2108. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  2109. type Policy struct {
  2110. // Bindings: Associates a list of `members` to a `role`.
  2111. // `bindings` with no members will result in an error.
  2112. Bindings []*Binding `json:"bindings,omitempty"`
  2113. // Etag: `etag` is used for optimistic concurrency control as a way to
  2114. // help
  2115. // prevent simultaneous updates of a policy from overwriting each
  2116. // other.
  2117. // It is strongly suggested that systems make use of the `etag` in
  2118. // the
  2119. // read-modify-write cycle to perform policy updates in order to avoid
  2120. // race
  2121. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  2122. // and
  2123. // systems are expected to put that etag in the request to
  2124. // `setIamPolicy` to
  2125. // ensure that their change will be applied to the same version of the
  2126. // policy.
  2127. //
  2128. // If no `etag` is provided in the call to `setIamPolicy`, then the
  2129. // existing
  2130. // policy is overwritten blindly.
  2131. Etag string `json:"etag,omitempty"`
  2132. // Version: Deprecated.
  2133. Version int64 `json:"version,omitempty"`
  2134. // ServerResponse contains the HTTP response code and headers from the
  2135. // server.
  2136. googleapi.ServerResponse `json:"-"`
  2137. // ForceSendFields is a list of field names (e.g. "Bindings") to
  2138. // unconditionally include in API requests. By default, fields with
  2139. // empty values are omitted from API requests. However, any non-pointer,
  2140. // non-interface field appearing in ForceSendFields will be sent to the
  2141. // server regardless of whether the field is empty or not. This may be
  2142. // used to include empty fields in Patch requests.
  2143. ForceSendFields []string `json:"-"`
  2144. // NullFields is a list of field names (e.g. "Bindings") to include in
  2145. // API requests with the JSON null value. By default, fields with empty
  2146. // values are omitted from API requests. However, any field with an
  2147. // empty value appearing in NullFields will be sent to the server as
  2148. // null. It is an error if a field in this list has a non-empty value.
  2149. // This may be used to include null fields in Patch requests.
  2150. NullFields []string `json:"-"`
  2151. }
  2152. func (s *Policy) MarshalJSON() ([]byte, error) {
  2153. type NoMethod Policy
  2154. raw := NoMethod(*s)
  2155. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2156. }
  2157. // QueryPlan: Contains an ordered list of nodes appearing in the query
  2158. // plan.
  2159. type QueryPlan struct {
  2160. // PlanNodes: The nodes in the query plan. Plan nodes are returned in
  2161. // pre-order starting
  2162. // with the plan root. Each PlanNode's `id` corresponds to its index
  2163. // in
  2164. // `plan_nodes`.
  2165. PlanNodes []*PlanNode `json:"planNodes,omitempty"`
  2166. // ForceSendFields is a list of field names (e.g. "PlanNodes") to
  2167. // unconditionally include in API requests. By default, fields with
  2168. // empty values are omitted from API requests. However, any non-pointer,
  2169. // non-interface field appearing in ForceSendFields will be sent to the
  2170. // server regardless of whether the field is empty or not. This may be
  2171. // used to include empty fields in Patch requests.
  2172. ForceSendFields []string `json:"-"`
  2173. // NullFields is a list of field names (e.g. "PlanNodes") to include in
  2174. // API requests with the JSON null value. By default, fields with empty
  2175. // values are omitted from API requests. However, any field with an
  2176. // empty value appearing in NullFields will be sent to the server as
  2177. // null. It is an error if a field in this list has a non-empty value.
  2178. // This may be used to include null fields in Patch requests.
  2179. NullFields []string `json:"-"`
  2180. }
  2181. func (s *QueryPlan) MarshalJSON() ([]byte, error) {
  2182. type NoMethod QueryPlan
  2183. raw := NoMethod(*s)
  2184. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2185. }
  2186. // ReadOnly: Message type to initiate a read-only transaction.
  2187. type ReadOnly struct {
  2188. // ExactStaleness: Executes all reads at a timestamp that is
  2189. // `exact_staleness`
  2190. // old. The timestamp is chosen soon after the read is
  2191. // started.
  2192. //
  2193. // Guarantees that all writes that have committed more than
  2194. // the
  2195. // specified number of seconds ago are visible. Because Cloud
  2196. // Spanner
  2197. // chooses the exact timestamp, this mode works even if the
  2198. // client's
  2199. // local clock is substantially skewed from Cloud Spanner
  2200. // commit
  2201. // timestamps.
  2202. //
  2203. // Useful for reading at nearby replicas without the
  2204. // distributed
  2205. // timestamp negotiation overhead of `max_staleness`.
  2206. ExactStaleness string `json:"exactStaleness,omitempty"`
  2207. // MaxStaleness: Read data at a timestamp >= `NOW -
  2208. // max_staleness`
  2209. // seconds. Guarantees that all writes that have committed more
  2210. // than the specified number of seconds ago are visible. Because
  2211. // Cloud Spanner chooses the exact timestamp, this mode works even
  2212. // if
  2213. // the client's local clock is substantially skewed from Cloud
  2214. // Spanner
  2215. // commit timestamps.
  2216. //
  2217. // Useful for reading the freshest data available at a nearby
  2218. // replica, while bounding the possible staleness if the local
  2219. // replica has fallen behind.
  2220. //
  2221. // Note that this option can only be used in single-use
  2222. // transactions.
  2223. MaxStaleness string `json:"maxStaleness,omitempty"`
  2224. // MinReadTimestamp: Executes all reads at a timestamp >=
  2225. // `min_read_timestamp`.
  2226. //
  2227. // This is useful for requesting fresher data than some previous
  2228. // read, or data that is fresh enough to observe the effects of
  2229. // some
  2230. // previously committed transaction whose timestamp is known.
  2231. //
  2232. // Note that this option can only be used in single-use transactions.
  2233. //
  2234. // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to
  2235. // nanoseconds.
  2236. // Example: "2014-10-02T15:01:23.045123456Z".
  2237. MinReadTimestamp string `json:"minReadTimestamp,omitempty"`
  2238. // ReadTimestamp: Executes all reads at the given timestamp. Unlike
  2239. // other modes,
  2240. // reads at a specific timestamp are repeatable; the same read at
  2241. // the same timestamp always returns the same data. If the
  2242. // timestamp is in the future, the read will block until the
  2243. // specified timestamp, modulo the read's deadline.
  2244. //
  2245. // Useful for large scale consistent reads such as mapreduces, or
  2246. // for coordinating many reads against a consistent snapshot of
  2247. // the
  2248. // data.
  2249. //
  2250. // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to
  2251. // nanoseconds.
  2252. // Example: "2014-10-02T15:01:23.045123456Z".
  2253. ReadTimestamp string `json:"readTimestamp,omitempty"`
  2254. // ReturnReadTimestamp: If true, the Cloud Spanner-selected read
  2255. // timestamp is included in
  2256. // the Transaction message that describes the transaction.
  2257. ReturnReadTimestamp bool `json:"returnReadTimestamp,omitempty"`
  2258. // Strong: Read at a timestamp where all previously committed
  2259. // transactions
  2260. // are visible.
  2261. Strong bool `json:"strong,omitempty"`
  2262. // ForceSendFields is a list of field names (e.g. "ExactStaleness") to
  2263. // unconditionally include in API requests. By default, fields with
  2264. // empty values are omitted from API requests. However, any non-pointer,
  2265. // non-interface field appearing in ForceSendFields will be sent to the
  2266. // server regardless of whether the field is empty or not. This may be
  2267. // used to include empty fields in Patch requests.
  2268. ForceSendFields []string `json:"-"`
  2269. // NullFields is a list of field names (e.g. "ExactStaleness") to
  2270. // include in API requests with the JSON null value. By default, fields
  2271. // with empty values are omitted from API requests. However, any field
  2272. // with an empty value appearing in NullFields will be sent to the
  2273. // server as null. It is an error if a field in this list has a
  2274. // non-empty value. This may be used to include null fields in Patch
  2275. // requests.
  2276. NullFields []string `json:"-"`
  2277. }
  2278. func (s *ReadOnly) MarshalJSON() ([]byte, error) {
  2279. type NoMethod ReadOnly
  2280. raw := NoMethod(*s)
  2281. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2282. }
  2283. // ReadRequest: The request for Read and
  2284. // StreamingRead.
  2285. type ReadRequest struct {
  2286. // Columns: The columns of table to be returned for each row
  2287. // matching
  2288. // this request.
  2289. Columns []string `json:"columns,omitempty"`
  2290. // Index: If non-empty, the name of an index on table. This index
  2291. // is
  2292. // used instead of the table primary key when interpreting key_set
  2293. // and sorting result rows. See key_set for further information.
  2294. Index string `json:"index,omitempty"`
  2295. // KeySet: Required. `key_set` identifies the rows to be yielded.
  2296. // `key_set` names the
  2297. // primary keys of the rows in table to be yielded, unless index
  2298. // is present. If index is present, then key_set instead names
  2299. // index keys in index.
  2300. //
  2301. // If the partition_token field is empty, rows are yielded
  2302. // in table primary key order (if index is empty) or index key order
  2303. // (if index is non-empty). If the partition_token field is not
  2304. // empty, rows will be yielded in an unspecified order.
  2305. //
  2306. // It is not an error for the `key_set` to name rows that do not
  2307. // exist in the database. Read yields nothing for nonexistent rows.
  2308. KeySet *KeySet `json:"keySet,omitempty"`
  2309. // Limit: If greater than zero, only the first `limit` rows are yielded.
  2310. // If `limit`
  2311. // is zero, the default is no limit. A limit cannot be specified
  2312. // if
  2313. // `partition_token` is set.
  2314. Limit int64 `json:"limit,omitempty,string"`
  2315. // PartitionToken: If present, results will be restricted to the
  2316. // specified partition
  2317. // previously created using PartitionRead(). There must be an
  2318. // exact
  2319. // match for the values of fields common to this message and
  2320. // the
  2321. // PartitionReadRequest message used to create this partition_token.
  2322. PartitionToken string `json:"partitionToken,omitempty"`
  2323. // ResumeToken: If this request is resuming a previously interrupted
  2324. // read,
  2325. // `resume_token` should be copied from the last
  2326. // PartialResultSet yielded before the interruption. Doing this
  2327. // enables the new read to resume where the last read left off. The
  2328. // rest of the request parameters must exactly match the request
  2329. // that yielded this token.
  2330. ResumeToken string `json:"resumeToken,omitempty"`
  2331. // Table: Required. The name of the table in the database to be read.
  2332. Table string `json:"table,omitempty"`
  2333. // Transaction: The transaction to use. If none is provided, the default
  2334. // is a
  2335. // temporary read-only transaction with strong concurrency.
  2336. Transaction *TransactionSelector `json:"transaction,omitempty"`
  2337. // ForceSendFields is a list of field names (e.g. "Columns") to
  2338. // unconditionally include in API requests. By default, fields with
  2339. // empty values are omitted from API requests. However, any non-pointer,
  2340. // non-interface field appearing in ForceSendFields will be sent to the
  2341. // server regardless of whether the field is empty or not. This may be
  2342. // used to include empty fields in Patch requests.
  2343. ForceSendFields []string `json:"-"`
  2344. // NullFields is a list of field names (e.g. "Columns") to include in
  2345. // API requests with the JSON null value. By default, fields with empty
  2346. // values are omitted from API requests. However, any field with an
  2347. // empty value appearing in NullFields will be sent to the server as
  2348. // null. It is an error if a field in this list has a non-empty value.
  2349. // This may be used to include null fields in Patch requests.
  2350. NullFields []string `json:"-"`
  2351. }
  2352. func (s *ReadRequest) MarshalJSON() ([]byte, error) {
  2353. type NoMethod ReadRequest
  2354. raw := NoMethod(*s)
  2355. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2356. }
  2357. // ReadWrite: Message type to initiate a read-write transaction.
  2358. // Currently this
  2359. // transaction type has no options.
  2360. type ReadWrite struct {
  2361. }
  2362. // ResultSet: Results from Read or
  2363. // ExecuteSql.
  2364. type ResultSet struct {
  2365. // Metadata: Metadata about the result set, such as row type
  2366. // information.
  2367. Metadata *ResultSetMetadata `json:"metadata,omitempty"`
  2368. // Rows: Each element in `rows` is a row whose format is defined
  2369. // by
  2370. // metadata.row_type. The ith element
  2371. // in each row matches the ith field in
  2372. // metadata.row_type. Elements are
  2373. // encoded based on type as described
  2374. // here.
  2375. Rows [][]interface{} `json:"rows,omitempty"`
  2376. // Stats: Query plan and execution statistics for the SQL statement
  2377. // that
  2378. // produced this result set. These can be requested by
  2379. // setting
  2380. // ExecuteSqlRequest.query_mode.
  2381. // DML statements always produce stats containing the number of
  2382. // rows
  2383. // modified, unless executed using the
  2384. // ExecuteSqlRequest.QueryMode.PLAN ExecuteSqlRequest.query_mode.
  2385. // Other fields may or may not be populated, based on
  2386. // the
  2387. // ExecuteSqlRequest.query_mode.
  2388. Stats *ResultSetStats `json:"stats,omitempty"`
  2389. // ServerResponse contains the HTTP response code and headers from the
  2390. // server.
  2391. googleapi.ServerResponse `json:"-"`
  2392. // ForceSendFields is a list of field names (e.g. "Metadata") to
  2393. // unconditionally include in API requests. By default, fields with
  2394. // empty values are omitted from API requests. However, any non-pointer,
  2395. // non-interface field appearing in ForceSendFields will be sent to the
  2396. // server regardless of whether the field is empty or not. This may be
  2397. // used to include empty fields in Patch requests.
  2398. ForceSendFields []string `json:"-"`
  2399. // NullFields is a list of field names (e.g. "Metadata") to include in
  2400. // API requests with the JSON null value. By default, fields with empty
  2401. // values are omitted from API requests. However, any field with an
  2402. // empty value appearing in NullFields will be sent to the server as
  2403. // null. It is an error if a field in this list has a non-empty value.
  2404. // This may be used to include null fields in Patch requests.
  2405. NullFields []string `json:"-"`
  2406. }
  2407. func (s *ResultSet) MarshalJSON() ([]byte, error) {
  2408. type NoMethod ResultSet
  2409. raw := NoMethod(*s)
  2410. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2411. }
  2412. // ResultSetMetadata: Metadata about a ResultSet or PartialResultSet.
  2413. type ResultSetMetadata struct {
  2414. // RowType: Indicates the field names and types for the rows in the
  2415. // result
  2416. // set. For example, a SQL query like "SELECT UserId, UserName
  2417. // FROM
  2418. // Users" could return a `row_type` value like:
  2419. //
  2420. // "fields": [
  2421. // { "name": "UserId", "type": { "code": "INT64" } },
  2422. // { "name": "UserName", "type": { "code": "STRING" } },
  2423. // ]
  2424. RowType *StructType `json:"rowType,omitempty"`
  2425. // Transaction: If the read or SQL query began a transaction as a
  2426. // side-effect, the
  2427. // information about the new transaction is yielded here.
  2428. Transaction *Transaction `json:"transaction,omitempty"`
  2429. // ForceSendFields is a list of field names (e.g. "RowType") to
  2430. // unconditionally include in API requests. By default, fields with
  2431. // empty values are omitted from API requests. However, any non-pointer,
  2432. // non-interface field appearing in ForceSendFields will be sent to the
  2433. // server regardless of whether the field is empty or not. This may be
  2434. // used to include empty fields in Patch requests.
  2435. ForceSendFields []string `json:"-"`
  2436. // NullFields is a list of field names (e.g. "RowType") to include in
  2437. // API requests with the JSON null value. By default, fields with empty
  2438. // values are omitted from API requests. However, any field with an
  2439. // empty value appearing in NullFields will be sent to the server as
  2440. // null. It is an error if a field in this list has a non-empty value.
  2441. // This may be used to include null fields in Patch requests.
  2442. NullFields []string `json:"-"`
  2443. }
  2444. func (s *ResultSetMetadata) MarshalJSON() ([]byte, error) {
  2445. type NoMethod ResultSetMetadata
  2446. raw := NoMethod(*s)
  2447. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2448. }
  2449. // ResultSetStats: Additional statistics about a ResultSet or
  2450. // PartialResultSet.
  2451. type ResultSetStats struct {
  2452. // QueryPlan: QueryPlan for the query associated with this result.
  2453. QueryPlan *QueryPlan `json:"queryPlan,omitempty"`
  2454. // QueryStats: Aggregated statistics from the execution of the query.
  2455. // Only present when
  2456. // the query is profiled. For example, a query could return the
  2457. // statistics as
  2458. // follows:
  2459. //
  2460. // {
  2461. // "rows_returned": "3",
  2462. // "elapsed_time": "1.22 secs",
  2463. // "cpu_time": "1.19 secs"
  2464. // }
  2465. QueryStats googleapi.RawMessage `json:"queryStats,omitempty"`
  2466. // RowCountExact: Standard DML returns an exact count of rows that were
  2467. // modified.
  2468. RowCountExact int64 `json:"rowCountExact,omitempty,string"`
  2469. // RowCountLowerBound: Partitioned DML does not offer exactly-once
  2470. // semantics, so it
  2471. // returns a lower bound of the rows modified.
  2472. RowCountLowerBound int64 `json:"rowCountLowerBound,omitempty,string"`
  2473. // ForceSendFields is a list of field names (e.g. "QueryPlan") to
  2474. // unconditionally include in API requests. By default, fields with
  2475. // empty values are omitted from API requests. However, any non-pointer,
  2476. // non-interface field appearing in ForceSendFields will be sent to the
  2477. // server regardless of whether the field is empty or not. This may be
  2478. // used to include empty fields in Patch requests.
  2479. ForceSendFields []string `json:"-"`
  2480. // NullFields is a list of field names (e.g. "QueryPlan") to include in
  2481. // API requests with the JSON null value. By default, fields with empty
  2482. // values are omitted from API requests. However, any field with an
  2483. // empty value appearing in NullFields will be sent to the server as
  2484. // null. It is an error if a field in this list has a non-empty value.
  2485. // This may be used to include null fields in Patch requests.
  2486. NullFields []string `json:"-"`
  2487. }
  2488. func (s *ResultSetStats) MarshalJSON() ([]byte, error) {
  2489. type NoMethod ResultSetStats
  2490. raw := NoMethod(*s)
  2491. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2492. }
  2493. // RollbackRequest: The request for Rollback.
  2494. type RollbackRequest struct {
  2495. // TransactionId: Required. The transaction to roll back.
  2496. TransactionId string `json:"transactionId,omitempty"`
  2497. // ForceSendFields is a list of field names (e.g. "TransactionId") to
  2498. // unconditionally include in API requests. By default, fields with
  2499. // empty values are omitted from API requests. However, any non-pointer,
  2500. // non-interface field appearing in ForceSendFields will be sent to the
  2501. // server regardless of whether the field is empty or not. This may be
  2502. // used to include empty fields in Patch requests.
  2503. ForceSendFields []string `json:"-"`
  2504. // NullFields is a list of field names (e.g. "TransactionId") to include
  2505. // in API requests with the JSON null value. By default, fields with
  2506. // empty values are omitted from API requests. However, any field with
  2507. // an empty value appearing in NullFields will be sent to the server as
  2508. // null. It is an error if a field in this list has a non-empty value.
  2509. // This may be used to include null fields in Patch requests.
  2510. NullFields []string `json:"-"`
  2511. }
  2512. func (s *RollbackRequest) MarshalJSON() ([]byte, error) {
  2513. type NoMethod RollbackRequest
  2514. raw := NoMethod(*s)
  2515. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2516. }
  2517. // Session: A session in the Cloud Spanner API.
  2518. type Session struct {
  2519. // ApproximateLastUseTime: Output only. The approximate timestamp when
  2520. // the session is last used. It is
  2521. // typically earlier than the actual last use time.
  2522. ApproximateLastUseTime string `json:"approximateLastUseTime,omitempty"`
  2523. // CreateTime: Output only. The timestamp when the session is created.
  2524. CreateTime string `json:"createTime,omitempty"`
  2525. // Labels: The labels for the session.
  2526. //
  2527. // * Label keys must be between 1 and 63 characters long and must
  2528. // conform to
  2529. // the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  2530. // * Label values must be between 0 and 63 characters long and must
  2531. // conform
  2532. // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
  2533. // * No more than 64 labels can be associated with a given
  2534. // session.
  2535. //
  2536. // See https://goo.gl/xmQnxf for more information on and examples of
  2537. // labels.
  2538. Labels map[string]string `json:"labels,omitempty"`
  2539. // Name: The name of the session. This is always system-assigned; values
  2540. // provided
  2541. // when creating a session are ignored.
  2542. Name string `json:"name,omitempty"`
  2543. // ServerResponse contains the HTTP response code and headers from the
  2544. // server.
  2545. googleapi.ServerResponse `json:"-"`
  2546. // ForceSendFields is a list of field names (e.g.
  2547. // "ApproximateLastUseTime") to unconditionally include in API requests.
  2548. // By default, fields with empty values are omitted from API requests.
  2549. // However, any non-pointer, non-interface field appearing in
  2550. // ForceSendFields will be sent to the server regardless of whether the
  2551. // field is empty or not. This may be used to include empty fields in
  2552. // Patch requests.
  2553. ForceSendFields []string `json:"-"`
  2554. // NullFields is a list of field names (e.g. "ApproximateLastUseTime")
  2555. // to include in API requests with the JSON null value. By default,
  2556. // fields with empty values are omitted from API requests. However, any
  2557. // field with an empty value appearing in NullFields will be sent to the
  2558. // server as null. It is an error if a field in this list has a
  2559. // non-empty value. This may be used to include null fields in Patch
  2560. // requests.
  2561. NullFields []string `json:"-"`
  2562. }
  2563. func (s *Session) MarshalJSON() ([]byte, error) {
  2564. type NoMethod Session
  2565. raw := NoMethod(*s)
  2566. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2567. }
  2568. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  2569. type SetIamPolicyRequest struct {
  2570. // Policy: REQUIRED: The complete policy to be applied to the
  2571. // `resource`. The size of
  2572. // the policy is limited to a few 10s of KB. An empty policy is a
  2573. // valid policy but certain Cloud Platform services (such as
  2574. // Projects)
  2575. // might reject them.
  2576. Policy *Policy `json:"policy,omitempty"`
  2577. // ForceSendFields is a list of field names (e.g. "Policy") to
  2578. // unconditionally include in API requests. By default, fields with
  2579. // empty values are omitted from API requests. However, any non-pointer,
  2580. // non-interface field appearing in ForceSendFields will be sent to the
  2581. // server regardless of whether the field is empty or not. This may be
  2582. // used to include empty fields in Patch requests.
  2583. ForceSendFields []string `json:"-"`
  2584. // NullFields is a list of field names (e.g. "Policy") to include in API
  2585. // requests with the JSON null value. By default, fields with empty
  2586. // values are omitted from API requests. However, any field with an
  2587. // empty value appearing in NullFields will be sent to the server as
  2588. // null. It is an error if a field in this list has a non-empty value.
  2589. // This may be used to include null fields in Patch requests.
  2590. NullFields []string `json:"-"`
  2591. }
  2592. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  2593. type NoMethod SetIamPolicyRequest
  2594. raw := NoMethod(*s)
  2595. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2596. }
  2597. // ShortRepresentation: Condensed representation of a node and its
  2598. // subtree. Only present for
  2599. // `SCALAR` PlanNode(s).
  2600. type ShortRepresentation struct {
  2601. // Description: A string representation of the expression subtree rooted
  2602. // at this node.
  2603. Description string `json:"description,omitempty"`
  2604. // Subqueries: A mapping of (subquery variable name) -> (subquery node
  2605. // id) for cases
  2606. // where the `description` string of this node references a
  2607. // `SCALAR`
  2608. // subquery contained in the expression subtree rooted at this node.
  2609. // The
  2610. // referenced `SCALAR` subquery may not necessarily be a direct child
  2611. // of
  2612. // this node.
  2613. Subqueries map[string]int64 `json:"subqueries,omitempty"`
  2614. // ForceSendFields is a list of field names (e.g. "Description") to
  2615. // unconditionally include in API requests. By default, fields with
  2616. // empty values are omitted from API requests. However, any non-pointer,
  2617. // non-interface field appearing in ForceSendFields will be sent to the
  2618. // server regardless of whether the field is empty or not. This may be
  2619. // used to include empty fields in Patch requests.
  2620. ForceSendFields []string `json:"-"`
  2621. // NullFields is a list of field names (e.g. "Description") to include
  2622. // in API requests with the JSON null value. By default, fields with
  2623. // empty values are omitted from API requests. However, any field with
  2624. // an empty value appearing in NullFields will be sent to the server as
  2625. // null. It is an error if a field in this list has a non-empty value.
  2626. // This may be used to include null fields in Patch requests.
  2627. NullFields []string `json:"-"`
  2628. }
  2629. func (s *ShortRepresentation) MarshalJSON() ([]byte, error) {
  2630. type NoMethod ShortRepresentation
  2631. raw := NoMethod(*s)
  2632. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2633. }
  2634. // Statement: A single DML statement.
  2635. type Statement struct {
  2636. // ParamTypes: It is not always possible for Cloud Spanner to infer the
  2637. // right SQL type
  2638. // from a JSON value. For example, values of type `BYTES` and values
  2639. // of type `STRING` both appear in params as JSON strings.
  2640. //
  2641. // In these cases, `param_types` can be used to specify the exact
  2642. // SQL type for some or all of the SQL statement parameters. See
  2643. // the
  2644. // definition of Type for more information
  2645. // about SQL types.
  2646. ParamTypes map[string]Type `json:"paramTypes,omitempty"`
  2647. // Params: The DML string can contain parameter placeholders. A
  2648. // parameter
  2649. // placeholder consists of `'@'` followed by the parameter
  2650. // name. Parameter names consist of any combination of letters,
  2651. // numbers, and underscores.
  2652. //
  2653. // Parameters can appear anywhere that a literal value is expected.
  2654. // The
  2655. // same parameter name can be used more than once, for example:
  2656. // "WHERE id > @msg_id AND id < @msg_id + 100"
  2657. //
  2658. // It is an error to execute an SQL statement with unbound
  2659. // parameters.
  2660. //
  2661. // Parameter values are specified using `params`, which is a JSON
  2662. // object whose keys are parameter names, and whose values are
  2663. // the
  2664. // corresponding parameter values.
  2665. Params googleapi.RawMessage `json:"params,omitempty"`
  2666. // Sql: Required. The DML string.
  2667. Sql string `json:"sql,omitempty"`
  2668. // ForceSendFields is a list of field names (e.g. "ParamTypes") to
  2669. // unconditionally include in API requests. By default, fields with
  2670. // empty values are omitted from API requests. However, any non-pointer,
  2671. // non-interface field appearing in ForceSendFields will be sent to the
  2672. // server regardless of whether the field is empty or not. This may be
  2673. // used to include empty fields in Patch requests.
  2674. ForceSendFields []string `json:"-"`
  2675. // NullFields is a list of field names (e.g. "ParamTypes") to include in
  2676. // API requests with the JSON null value. By default, fields with empty
  2677. // values are omitted from API requests. However, any field with an
  2678. // empty value appearing in NullFields will be sent to the server as
  2679. // null. It is an error if a field in this list has a non-empty value.
  2680. // This may be used to include null fields in Patch requests.
  2681. NullFields []string `json:"-"`
  2682. }
  2683. func (s *Statement) MarshalJSON() ([]byte, error) {
  2684. type NoMethod Statement
  2685. raw := NoMethod(*s)
  2686. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2687. }
  2688. // Status: The `Status` type defines a logical error model that is
  2689. // suitable for different
  2690. // programming environments, including REST APIs and RPC APIs. It is
  2691. // used by
  2692. // [gRPC](https://github.com/grpc). The error model is designed to
  2693. // be:
  2694. //
  2695. // - Simple to use and understand for most users
  2696. // - Flexible enough to meet unexpected needs
  2697. //
  2698. // # Overview
  2699. //
  2700. // The `Status` message contains three pieces of data: error code, error
  2701. // message,
  2702. // and error details. The error code should be an enum value
  2703. // of
  2704. // google.rpc.Code, but it may accept additional error codes if needed.
  2705. // The
  2706. // error message should be a developer-facing English message that
  2707. // helps
  2708. // developers *understand* and *resolve* the error. If a localized
  2709. // user-facing
  2710. // error message is needed, put the localized message in the error
  2711. // details or
  2712. // localize it in the client. The optional error details may contain
  2713. // arbitrary
  2714. // information about the error. There is a predefined set of error
  2715. // detail types
  2716. // in the package `google.rpc` that can be used for common error
  2717. // conditions.
  2718. //
  2719. // # Language mapping
  2720. //
  2721. // The `Status` message is the logical representation of the error
  2722. // model, but it
  2723. // is not necessarily the actual wire format. When the `Status` message
  2724. // is
  2725. // exposed in different client libraries and different wire protocols,
  2726. // it can be
  2727. // mapped differently. For example, it will likely be mapped to some
  2728. // exceptions
  2729. // in Java, but more likely mapped to some error codes in C.
  2730. //
  2731. // # Other uses
  2732. //
  2733. // The error model and the `Status` message can be used in a variety
  2734. // of
  2735. // environments, either with or without APIs, to provide a
  2736. // consistent developer experience across different
  2737. // environments.
  2738. //
  2739. // Example uses of this error model include:
  2740. //
  2741. // - Partial errors. If a service needs to return partial errors to the
  2742. // client,
  2743. // it may embed the `Status` in the normal response to indicate the
  2744. // partial
  2745. // errors.
  2746. //
  2747. // - Workflow errors. A typical workflow has multiple steps. Each step
  2748. // may
  2749. // have a `Status` message for error reporting.
  2750. //
  2751. // - Batch operations. If a client uses batch request and batch
  2752. // response, the
  2753. // `Status` message should be used directly inside batch response,
  2754. // one for
  2755. // each error sub-response.
  2756. //
  2757. // - Asynchronous operations. If an API call embeds asynchronous
  2758. // operation
  2759. // results in its response, the status of those operations should
  2760. // be
  2761. // represented directly using the `Status` message.
  2762. //
  2763. // - Logging. If some API errors are stored in logs, the message
  2764. // `Status` could
  2765. // be used directly after any stripping needed for security/privacy
  2766. // reasons.
  2767. type Status struct {
  2768. // Code: The status code, which should be an enum value of
  2769. // google.rpc.Code.
  2770. Code int64 `json:"code,omitempty"`
  2771. // Details: A list of messages that carry the error details. There is a
  2772. // common set of
  2773. // message types for APIs to use.
  2774. Details []googleapi.RawMessage `json:"details,omitempty"`
  2775. // Message: A developer-facing error message, which should be in
  2776. // English. Any
  2777. // user-facing error message should be localized and sent in
  2778. // the
  2779. // google.rpc.Status.details field, or localized by the client.
  2780. Message string `json:"message,omitempty"`
  2781. // ForceSendFields is a list of field names (e.g. "Code") to
  2782. // unconditionally include in API requests. By default, fields with
  2783. // empty values are omitted from API requests. However, any non-pointer,
  2784. // non-interface field appearing in ForceSendFields will be sent to the
  2785. // server regardless of whether the field is empty or not. This may be
  2786. // used to include empty fields in Patch requests.
  2787. ForceSendFields []string `json:"-"`
  2788. // NullFields is a list of field names (e.g. "Code") to include in API
  2789. // requests with the JSON null value. By default, fields with empty
  2790. // values are omitted from API requests. However, any field with an
  2791. // empty value appearing in NullFields will be sent to the server as
  2792. // null. It is an error if a field in this list has a non-empty value.
  2793. // This may be used to include null fields in Patch requests.
  2794. NullFields []string `json:"-"`
  2795. }
  2796. func (s *Status) MarshalJSON() ([]byte, error) {
  2797. type NoMethod Status
  2798. raw := NoMethod(*s)
  2799. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2800. }
  2801. // StructType: `StructType` defines the fields of a STRUCT type.
  2802. type StructType struct {
  2803. // Fields: The list of fields that make up this struct. Order
  2804. // is
  2805. // significant, because values of this struct type are represented
  2806. // as
  2807. // lists, where the order of field values matches the order of
  2808. // fields in the StructType. In turn, the order of fields
  2809. // matches the order of columns in a read request, or the order
  2810. // of
  2811. // fields in the `SELECT` clause of a query.
  2812. Fields []*Field `json:"fields,omitempty"`
  2813. // ForceSendFields is a list of field names (e.g. "Fields") to
  2814. // unconditionally include in API requests. By default, fields with
  2815. // empty values are omitted from API requests. However, any non-pointer,
  2816. // non-interface field appearing in ForceSendFields will be sent to the
  2817. // server regardless of whether the field is empty or not. This may be
  2818. // used to include empty fields in Patch requests.
  2819. ForceSendFields []string `json:"-"`
  2820. // NullFields is a list of field names (e.g. "Fields") to include in API
  2821. // requests with the JSON null value. By default, fields with empty
  2822. // values are omitted from API requests. However, any field with an
  2823. // empty value appearing in NullFields will be sent to the server as
  2824. // null. It is an error if a field in this list has a non-empty value.
  2825. // This may be used to include null fields in Patch requests.
  2826. NullFields []string `json:"-"`
  2827. }
  2828. func (s *StructType) MarshalJSON() ([]byte, error) {
  2829. type NoMethod StructType
  2830. raw := NoMethod(*s)
  2831. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2832. }
  2833. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  2834. // method.
  2835. type TestIamPermissionsRequest struct {
  2836. // Permissions: REQUIRED: The set of permissions to check for
  2837. // 'resource'.
  2838. // Permissions with wildcards (such as '*', 'spanner.*',
  2839. // 'spanner.instances.*') are not allowed.
  2840. Permissions []string `json:"permissions,omitempty"`
  2841. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2842. // unconditionally include in API requests. By default, fields with
  2843. // empty values are omitted from API requests. However, any non-pointer,
  2844. // non-interface field appearing in ForceSendFields will be sent to the
  2845. // server regardless of whether the field is empty or not. This may be
  2846. // used to include empty fields in Patch requests.
  2847. ForceSendFields []string `json:"-"`
  2848. // NullFields is a list of field names (e.g. "Permissions") to include
  2849. // in API requests with the JSON null value. By default, fields with
  2850. // empty values are omitted from API requests. However, any field with
  2851. // an empty value appearing in NullFields will be sent to the server as
  2852. // null. It is an error if a field in this list has a non-empty value.
  2853. // This may be used to include null fields in Patch requests.
  2854. NullFields []string `json:"-"`
  2855. }
  2856. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  2857. type NoMethod TestIamPermissionsRequest
  2858. raw := NoMethod(*s)
  2859. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2860. }
  2861. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  2862. // method.
  2863. type TestIamPermissionsResponse struct {
  2864. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  2865. // the caller is
  2866. // allowed.
  2867. Permissions []string `json:"permissions,omitempty"`
  2868. // ServerResponse contains the HTTP response code and headers from the
  2869. // server.
  2870. googleapi.ServerResponse `json:"-"`
  2871. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2872. // unconditionally include in API requests. By default, fields with
  2873. // empty values are omitted from API requests. However, any non-pointer,
  2874. // non-interface field appearing in ForceSendFields will be sent to the
  2875. // server regardless of whether the field is empty or not. This may be
  2876. // used to include empty fields in Patch requests.
  2877. ForceSendFields []string `json:"-"`
  2878. // NullFields is a list of field names (e.g. "Permissions") to include
  2879. // in API requests with the JSON null value. By default, fields with
  2880. // empty values are omitted from API requests. However, any field with
  2881. // an empty value appearing in NullFields will be sent to the server as
  2882. // null. It is an error if a field in this list has a non-empty value.
  2883. // This may be used to include null fields in Patch requests.
  2884. NullFields []string `json:"-"`
  2885. }
  2886. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  2887. type NoMethod TestIamPermissionsResponse
  2888. raw := NoMethod(*s)
  2889. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2890. }
  2891. // Transaction: A transaction.
  2892. type Transaction struct {
  2893. // Id: `id` may be used to identify the transaction in
  2894. // subsequent
  2895. // Read,
  2896. // ExecuteSql,
  2897. // Commit, or
  2898. // Rollback calls.
  2899. //
  2900. // Single-use read-only transactions do not have IDs, because
  2901. // single-use transactions do not support multiple requests.
  2902. Id string `json:"id,omitempty"`
  2903. // ReadTimestamp: For snapshot read-only transactions, the read
  2904. // timestamp chosen
  2905. // for the transaction. Not returned by default:
  2906. // see
  2907. // TransactionOptions.ReadOnly.return_read_timestamp.
  2908. //
  2909. // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to
  2910. // nanoseconds.
  2911. // Example: "2014-10-02T15:01:23.045123456Z".
  2912. ReadTimestamp string `json:"readTimestamp,omitempty"`
  2913. // ServerResponse contains the HTTP response code and headers from the
  2914. // server.
  2915. googleapi.ServerResponse `json:"-"`
  2916. // ForceSendFields is a list of field names (e.g. "Id") to
  2917. // unconditionally include in API requests. By default, fields with
  2918. // empty values are omitted from API requests. However, any non-pointer,
  2919. // non-interface field appearing in ForceSendFields will be sent to the
  2920. // server regardless of whether the field is empty or not. This may be
  2921. // used to include empty fields in Patch requests.
  2922. ForceSendFields []string `json:"-"`
  2923. // NullFields is a list of field names (e.g. "Id") to include in API
  2924. // requests with the JSON null value. By default, fields with empty
  2925. // values are omitted from API requests. However, any field with an
  2926. // empty value appearing in NullFields will be sent to the server as
  2927. // null. It is an error if a field in this list has a non-empty value.
  2928. // This may be used to include null fields in Patch requests.
  2929. NullFields []string `json:"-"`
  2930. }
  2931. func (s *Transaction) MarshalJSON() ([]byte, error) {
  2932. type NoMethod Transaction
  2933. raw := NoMethod(*s)
  2934. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2935. }
  2936. // TransactionOptions: # Transactions
  2937. //
  2938. //
  2939. // Each session can have at most one active transaction at a time. After
  2940. // the
  2941. // active transaction is completed, the session can immediately
  2942. // be
  2943. // re-used for the next transaction. It is not necessary to create a
  2944. // new session for each transaction.
  2945. //
  2946. // # Transaction Modes
  2947. //
  2948. // Cloud Spanner supports three transaction modes:
  2949. //
  2950. // 1. Locking read-write. This type of transaction is the only way
  2951. // to write data into Cloud Spanner. These transactions rely on
  2952. // pessimistic locking and, if necessary, two-phase commit.
  2953. // Locking read-write transactions may abort, requiring the
  2954. // application to retry.
  2955. //
  2956. // 2. Snapshot read-only. This transaction type provides guaranteed
  2957. // consistency across several reads, but does not allow
  2958. // writes. Snapshot read-only transactions can be configured to
  2959. // read at timestamps in the past. Snapshot read-only
  2960. // transactions do not need to be committed.
  2961. //
  2962. // 3. Partitioned DML. This type of transaction is used to execute
  2963. // a single Partitioned DML statement. Partitioned DML partitions
  2964. // the key space and runs the DML statement over each partition
  2965. // in parallel using separate, internal transactions that commit
  2966. // independently. Partitioned DML transactions do not need to be
  2967. // committed.
  2968. //
  2969. // For transactions that only read, snapshot read-only
  2970. // transactions
  2971. // provide simpler semantics and are almost always faster.
  2972. // In
  2973. // particular, read-only transactions do not take locks, so they do
  2974. // not conflict with read-write transactions. As a consequence of
  2975. // not
  2976. // taking locks, they also do not abort, so retry loops are not
  2977. // needed.
  2978. //
  2979. // Transactions may only read/write data in a single database. They
  2980. // may, however, read/write data in different tables within
  2981. // that
  2982. // database.
  2983. //
  2984. // ## Locking Read-Write Transactions
  2985. //
  2986. // Locking transactions may be used to atomically read-modify-write
  2987. // data anywhere in a database. This type of transaction is
  2988. // externally
  2989. // consistent.
  2990. //
  2991. // Clients should attempt to minimize the amount of time a
  2992. // transaction
  2993. // is active. Faster transactions commit with higher probability
  2994. // and cause less contention. Cloud Spanner attempts to keep read
  2995. // locks
  2996. // active as long as the transaction continues to do reads, and
  2997. // the
  2998. // transaction has not been terminated by
  2999. // Commit or
  3000. // Rollback. Long periods of
  3001. // inactivity at the client may cause Cloud Spanner to release
  3002. // a
  3003. // transaction's locks and abort it.
  3004. //
  3005. // Conceptually, a read-write transaction consists of zero or more
  3006. // reads or SQL statements followed by
  3007. // Commit. At any time before
  3008. // Commit, the client can send a
  3009. // Rollback request to abort the
  3010. // transaction.
  3011. //
  3012. // ### Semantics
  3013. //
  3014. // Cloud Spanner can commit the transaction if all read locks it
  3015. // acquired
  3016. // are still valid at commit time, and it is able to acquire write
  3017. // locks for all writes. Cloud Spanner can abort the transaction for
  3018. // any
  3019. // reason. If a commit attempt returns `ABORTED`, Cloud Spanner
  3020. // guarantees
  3021. // that the transaction has not modified any user data in Cloud
  3022. // Spanner.
  3023. //
  3024. // Unless the transaction commits, Cloud Spanner makes no guarantees
  3025. // about
  3026. // how long the transaction's locks were held for. It is an error to
  3027. // use Cloud Spanner locks for any sort of mutual exclusion other
  3028. // than
  3029. // between Cloud Spanner transactions themselves.
  3030. //
  3031. // ### Retrying Aborted Transactions
  3032. //
  3033. // When a transaction aborts, the application can choose to retry
  3034. // the
  3035. // whole transaction again. To maximize the chances of
  3036. // successfully
  3037. // committing the retry, the client should execute the retry in the
  3038. // same session as the original attempt. The original session's
  3039. // lock
  3040. // priority increases with each consecutive abort, meaning that
  3041. // each
  3042. // attempt has a slightly better chance of success than the
  3043. // previous.
  3044. //
  3045. // Under some circumstances (e.g., many transactions attempting
  3046. // to
  3047. // modify the same row(s)), a transaction can abort many times in
  3048. // a
  3049. // short period before successfully committing. Thus, it is not a
  3050. // good
  3051. // idea to cap the number of retries a transaction can attempt;
  3052. // instead, it is better to limit the total amount of wall time
  3053. // spent
  3054. // retrying.
  3055. //
  3056. // ### Idle Transactions
  3057. //
  3058. // A transaction is considered idle if it has no outstanding reads
  3059. // or
  3060. // SQL queries and has not started a read or SQL query within the last
  3061. // 10
  3062. // seconds. Idle transactions can be aborted by Cloud Spanner so that
  3063. // they
  3064. // don't hold on to locks indefinitely. In that case, the commit
  3065. // will
  3066. // fail with error `ABORTED`.
  3067. //
  3068. // If this behavior is undesirable, periodically executing a simple
  3069. // SQL query in the transaction (e.g., `SELECT 1`) prevents
  3070. // the
  3071. // transaction from becoming idle.
  3072. //
  3073. // ## Snapshot Read-Only Transactions
  3074. //
  3075. // Snapshot read-only transactions provides a simpler method
  3076. // than
  3077. // locking read-write transactions for doing several consistent
  3078. // reads. However, this type of transaction does not support
  3079. // writes.
  3080. //
  3081. // Snapshot transactions do not take locks. Instead, they work
  3082. // by
  3083. // choosing a Cloud Spanner timestamp, then executing all reads at
  3084. // that
  3085. // timestamp. Since they do not acquire locks, they do not
  3086. // block
  3087. // concurrent read-write transactions.
  3088. //
  3089. // Unlike locking read-write transactions, snapshot
  3090. // read-only
  3091. // transactions never abort. They can fail if the chosen read
  3092. // timestamp is garbage collected; however, the default
  3093. // garbage
  3094. // collection policy is generous enough that most applications do
  3095. // not
  3096. // need to worry about this in practice.
  3097. //
  3098. // Snapshot read-only transactions do not need to call
  3099. // Commit or
  3100. // Rollback (and in fact are not
  3101. // permitted to do so).
  3102. //
  3103. // To execute a snapshot transaction, the client specifies a
  3104. // timestamp
  3105. // bound, which tells Cloud Spanner how to choose a read timestamp.
  3106. //
  3107. // The types of timestamp bound are:
  3108. //
  3109. // - Strong (the default).
  3110. // - Bounded staleness.
  3111. // - Exact staleness.
  3112. //
  3113. // If the Cloud Spanner database to be read is geographically
  3114. // distributed,
  3115. // stale read-only transactions can execute more quickly than strong
  3116. // or read-write transaction, because they are able to execute far
  3117. // from the leader replica.
  3118. //
  3119. // Each type of timestamp bound is discussed in detail below.
  3120. //
  3121. // ### Strong
  3122. //
  3123. // Strong reads are guaranteed to see the effects of all
  3124. // transactions
  3125. // that have committed before the start of the read. Furthermore,
  3126. // all
  3127. // rows yielded by a single read are consistent with each other --
  3128. // if
  3129. // any part of the read observes a transaction, all parts of the
  3130. // read
  3131. // see the transaction.
  3132. //
  3133. // Strong reads are not repeatable: two consecutive strong
  3134. // read-only
  3135. // transactions might return inconsistent results if there
  3136. // are
  3137. // concurrent writes. If consistency across reads is required, the
  3138. // reads should be executed within a transaction or at an exact
  3139. // read
  3140. // timestamp.
  3141. //
  3142. // See TransactionOptions.ReadOnly.strong.
  3143. //
  3144. // ### Exact Staleness
  3145. //
  3146. // These timestamp bounds execute reads at a user-specified
  3147. // timestamp. Reads at a timestamp are guaranteed to see a
  3148. // consistent
  3149. // prefix of the global transaction history: they observe
  3150. // modifications done by all transactions with a commit timestamp <=
  3151. // the read timestamp, and observe none of the modifications done
  3152. // by
  3153. // transactions with a larger commit timestamp. They will block
  3154. // until
  3155. // all conflicting transactions that may be assigned commit
  3156. // timestamps
  3157. // <= the read timestamp have finished.
  3158. //
  3159. // The timestamp can either be expressed as an absolute Cloud Spanner
  3160. // commit
  3161. // timestamp or a staleness relative to the current time.
  3162. //
  3163. // These modes do not require a "negotiation phase" to pick a
  3164. // timestamp. As a result, they execute slightly faster than
  3165. // the
  3166. // equivalent boundedly stale concurrency modes. On the other
  3167. // hand,
  3168. // boundedly stale reads usually return fresher results.
  3169. //
  3170. // See TransactionOptions.ReadOnly.read_timestamp
  3171. // and
  3172. // TransactionOptions.ReadOnly.exact_staleness.
  3173. //
  3174. // ### Bounded Staleness
  3175. //
  3176. // Bounded staleness modes allow Cloud Spanner to pick the read
  3177. // timestamp,
  3178. // subject to a user-provided staleness bound. Cloud Spanner chooses
  3179. // the
  3180. // newest timestamp within the staleness bound that allows execution
  3181. // of the reads at the closest available replica without blocking.
  3182. //
  3183. // All rows yielded are consistent with each other -- if any part of
  3184. // the read observes a transaction, all parts of the read see
  3185. // the
  3186. // transaction. Boundedly stale reads are not repeatable: two
  3187. // stale
  3188. // reads, even if they use the same staleness bound, can execute
  3189. // at
  3190. // different timestamps and thus return inconsistent results.
  3191. //
  3192. // Boundedly stale reads execute in two phases: the first
  3193. // phase
  3194. // negotiates a timestamp among all replicas needed to serve the
  3195. // read. In the second phase, reads are executed at the
  3196. // negotiated
  3197. // timestamp.
  3198. //
  3199. // As a result of the two phase execution, bounded staleness reads
  3200. // are
  3201. // usually a little slower than comparable exact staleness
  3202. // reads. However, they are typically able to return fresher
  3203. // results, and are more likely to execute at the closest
  3204. // replica.
  3205. //
  3206. // Because the timestamp negotiation requires up-front knowledge
  3207. // of
  3208. // which rows will be read, it can only be used with
  3209. // single-use
  3210. // read-only transactions.
  3211. //
  3212. // See TransactionOptions.ReadOnly.max_staleness
  3213. // and
  3214. // TransactionOptions.ReadOnly.min_read_timestamp.
  3215. //
  3216. // ### Old Read Timestamps and Garbage Collection
  3217. //
  3218. // Cloud Spanner continuously garbage collects deleted and overwritten
  3219. // data
  3220. // in the background to reclaim storage space. This process is known
  3221. // as "version GC". By default, version GC reclaims versions after
  3222. // they
  3223. // are one hour old. Because of this, Cloud Spanner cannot perform
  3224. // reads
  3225. // at read timestamps more than one hour in the past. This
  3226. // restriction also applies to in-progress reads and/or SQL queries
  3227. // whose
  3228. // timestamp become too old while executing. Reads and SQL queries
  3229. // with
  3230. // too-old read timestamps fail with the error
  3231. // `FAILED_PRECONDITION`.
  3232. //
  3233. // ## Partitioned DML Transactions
  3234. //
  3235. // Partitioned DML transactions are used to execute DML statements with
  3236. // a
  3237. // different execution strategy that provides different, and often
  3238. // better,
  3239. // scalability properties for large, table-wide operations than DML in
  3240. // a
  3241. // ReadWrite transaction. Smaller scoped statements, such as an OLTP
  3242. // workload,
  3243. // should prefer using ReadWrite transactions.
  3244. //
  3245. // Partitioned DML partitions the keyspace and runs the DML statement on
  3246. // each
  3247. // partition in separate, internal transactions. These transactions
  3248. // commit
  3249. // automatically when complete, and run independently from one
  3250. // another.
  3251. //
  3252. // To reduce lock contention, this execution strategy only acquires read
  3253. // locks
  3254. // on rows that match the WHERE clause of the statement. Additionally,
  3255. // the
  3256. // smaller per-partition transactions hold locks for less time.
  3257. //
  3258. // That said, Partitioned DML is not a drop-in replacement for standard
  3259. // DML used
  3260. // in ReadWrite transactions.
  3261. //
  3262. // - The DML statement must be fully-partitionable. Specifically, the
  3263. // statement
  3264. // must be expressible as the union of many statements which each
  3265. // access only
  3266. // a single row of the table.
  3267. //
  3268. // - The statement is not applied atomically to all rows of the table.
  3269. // Rather,
  3270. // the statement is applied atomically to partitions of the table,
  3271. // in
  3272. // independent transactions. Secondary index rows are updated
  3273. // atomically
  3274. // with the base table rows.
  3275. //
  3276. // - Partitioned DML does not guarantee exactly-once execution
  3277. // semantics
  3278. // against a partition. The statement will be applied at least once
  3279. // to each
  3280. // partition. It is strongly recommended that the DML statement
  3281. // should be
  3282. // idempotent to avoid unexpected results. For instance, it is
  3283. // potentially
  3284. // dangerous to run a statement such as
  3285. // `UPDATE table SET column = column + 1` as it could be run multiple
  3286. // times
  3287. // against some rows.
  3288. //
  3289. // - The partitions are committed automatically - there is no support
  3290. // for
  3291. // Commit or Rollback. If the call returns an error, or if the client
  3292. // issuing
  3293. // the ExecuteSql call dies, it is possible that some rows had the
  3294. // statement
  3295. // executed on them successfully. It is also possible that statement
  3296. // was
  3297. // never executed against other rows.
  3298. //
  3299. // - Partitioned DML transactions may only contain the execution of a
  3300. // single
  3301. // DML statement via ExecuteSql or ExecuteStreamingSql.
  3302. //
  3303. // - If any error is encountered during the execution of the
  3304. // partitioned DML
  3305. // operation (for instance, a UNIQUE INDEX violation, division by
  3306. // zero, or a
  3307. // value that cannot be stored due to schema constraints), then the
  3308. // operation is stopped at that point and an error is returned. It
  3309. // is
  3310. // possible that at this point, some partitions have been committed
  3311. // (or even
  3312. // committed multiple times), and other partitions have not been run
  3313. // at all.
  3314. //
  3315. // Given the above, Partitioned DML is good fit for large,
  3316. // database-wide,
  3317. // operations that are idempotent, such as deleting old rows from a very
  3318. // large
  3319. // table.
  3320. type TransactionOptions struct {
  3321. // PartitionedDml: Partitioned DML transaction.
  3322. //
  3323. // Authorization to begin a Partitioned DML transaction
  3324. // requires
  3325. // `spanner.databases.beginPartitionedDmlTransaction` permission
  3326. // on the `session` resource.
  3327. PartitionedDml *PartitionedDml `json:"partitionedDml,omitempty"`
  3328. // ReadOnly: Transaction will not write.
  3329. //
  3330. // Authorization to begin a read-only transaction
  3331. // requires
  3332. // `spanner.databases.beginReadOnlyTransaction` permission
  3333. // on the `session` resource.
  3334. ReadOnly *ReadOnly `json:"readOnly,omitempty"`
  3335. // ReadWrite: Transaction may write.
  3336. //
  3337. // Authorization to begin a read-write transaction
  3338. // requires
  3339. // `spanner.databases.beginOrRollbackReadWriteTransaction` permission
  3340. // on the `session` resource.
  3341. ReadWrite *ReadWrite `json:"readWrite,omitempty"`
  3342. // ForceSendFields is a list of field names (e.g. "PartitionedDml") to
  3343. // unconditionally include in API requests. By default, fields with
  3344. // empty values are omitted from API requests. However, any non-pointer,
  3345. // non-interface field appearing in ForceSendFields will be sent to the
  3346. // server regardless of whether the field is empty or not. This may be
  3347. // used to include empty fields in Patch requests.
  3348. ForceSendFields []string `json:"-"`
  3349. // NullFields is a list of field names (e.g. "PartitionedDml") to
  3350. // include in API requests with the JSON null value. By default, fields
  3351. // with empty values are omitted from API requests. However, any field
  3352. // with an empty value appearing in NullFields will be sent to the
  3353. // server as null. It is an error if a field in this list has a
  3354. // non-empty value. This may be used to include null fields in Patch
  3355. // requests.
  3356. NullFields []string `json:"-"`
  3357. }
  3358. func (s *TransactionOptions) MarshalJSON() ([]byte, error) {
  3359. type NoMethod TransactionOptions
  3360. raw := NoMethod(*s)
  3361. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3362. }
  3363. // TransactionSelector: This message is used to select the transaction
  3364. // in which a
  3365. // Read or
  3366. // ExecuteSql call runs.
  3367. //
  3368. // See TransactionOptions for more information about transactions.
  3369. type TransactionSelector struct {
  3370. // Begin: Begin a new transaction and execute this read or SQL query
  3371. // in
  3372. // it. The transaction ID of the new transaction is returned
  3373. // in
  3374. // ResultSetMetadata.transaction, which is a Transaction.
  3375. Begin *TransactionOptions `json:"begin,omitempty"`
  3376. // Id: Execute the read or SQL query in a previously-started
  3377. // transaction.
  3378. Id string `json:"id,omitempty"`
  3379. // SingleUse: Execute the read or SQL query in a temporary
  3380. // transaction.
  3381. // This is the most efficient way to execute a transaction that
  3382. // consists of a single SQL query.
  3383. SingleUse *TransactionOptions `json:"singleUse,omitempty"`
  3384. // ForceSendFields is a list of field names (e.g. "Begin") to
  3385. // unconditionally include in API requests. By default, fields with
  3386. // empty values are omitted from API requests. However, any non-pointer,
  3387. // non-interface field appearing in ForceSendFields will be sent to the
  3388. // server regardless of whether the field is empty or not. This may be
  3389. // used to include empty fields in Patch requests.
  3390. ForceSendFields []string `json:"-"`
  3391. // NullFields is a list of field names (e.g. "Begin") to include in API
  3392. // requests with the JSON null value. By default, fields with empty
  3393. // values are omitted from API requests. However, any field with an
  3394. // empty value appearing in NullFields will be sent to the server as
  3395. // null. It is an error if a field in this list has a non-empty value.
  3396. // This may be used to include null fields in Patch requests.
  3397. NullFields []string `json:"-"`
  3398. }
  3399. func (s *TransactionSelector) MarshalJSON() ([]byte, error) {
  3400. type NoMethod TransactionSelector
  3401. raw := NoMethod(*s)
  3402. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3403. }
  3404. // Type: `Type` indicates the type of a Cloud Spanner value, as might be
  3405. // stored in a
  3406. // table cell or returned from an SQL query.
  3407. type Type struct {
  3408. // ArrayElementType: If code == ARRAY, then `array_element_type`
  3409. // is the type of the array elements.
  3410. ArrayElementType *Type `json:"arrayElementType,omitempty"`
  3411. // Code: Required. The TypeCode for this type.
  3412. //
  3413. // Possible values:
  3414. // "TYPE_CODE_UNSPECIFIED" - Not specified.
  3415. // "BOOL" - Encoded as JSON `true` or `false`.
  3416. // "INT64" - Encoded as `string`, in decimal format.
  3417. // "FLOAT64" - Encoded as `number`, or the strings "NaN",
  3418. // "Infinity", or
  3419. // "-Infinity".
  3420. // "TIMESTAMP" - Encoded as `string` in RFC 3339 timestamp format. The
  3421. // time zone
  3422. // must be present, and must be "Z".
  3423. //
  3424. // If the schema has the column option
  3425. // `allow_commit_timestamp=true`, the placeholder
  3426. // string
  3427. // "spanner.commit_timestamp()" can be used to instruct the system
  3428. // to insert the commit timestamp associated with the
  3429. // transaction
  3430. // commit.
  3431. // "DATE" - Encoded as `string` in RFC 3339 date format.
  3432. // "STRING" - Encoded as `string`.
  3433. // "BYTES" - Encoded as a base64-encoded `string`, as described in RFC
  3434. // 4648,
  3435. // section 4.
  3436. // "ARRAY" - Encoded as `list`, where the list elements are
  3437. // represented
  3438. // according to array_element_type.
  3439. // "STRUCT" - Encoded as `list`, where list element `i` is represented
  3440. // according
  3441. // to [struct_type.fields[i]][google.spanner.v1.StructType.fields].
  3442. Code string `json:"code,omitempty"`
  3443. // StructType: If code == STRUCT, then `struct_type`
  3444. // provides type information for the struct's fields.
  3445. StructType *StructType `json:"structType,omitempty"`
  3446. // ForceSendFields is a list of field names (e.g. "ArrayElementType") to
  3447. // unconditionally include in API requests. By default, fields with
  3448. // empty values are omitted from API requests. However, any non-pointer,
  3449. // non-interface field appearing in ForceSendFields will be sent to the
  3450. // server regardless of whether the field is empty or not. This may be
  3451. // used to include empty fields in Patch requests.
  3452. ForceSendFields []string `json:"-"`
  3453. // NullFields is a list of field names (e.g. "ArrayElementType") to
  3454. // include in API requests with the JSON null value. By default, fields
  3455. // with empty values are omitted from API requests. However, any field
  3456. // with an empty value appearing in NullFields will be sent to the
  3457. // server as null. It is an error if a field in this list has a
  3458. // non-empty value. This may be used to include null fields in Patch
  3459. // requests.
  3460. NullFields []string `json:"-"`
  3461. }
  3462. func (s *Type) MarshalJSON() ([]byte, error) {
  3463. type NoMethod Type
  3464. raw := NoMethod(*s)
  3465. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3466. }
  3467. // UpdateDatabaseDdlMetadata: Metadata type for the operation returned
  3468. // by
  3469. // UpdateDatabaseDdl.
  3470. type UpdateDatabaseDdlMetadata struct {
  3471. // CommitTimestamps: Reports the commit timestamps of all statements
  3472. // that have
  3473. // succeeded so far, where `commit_timestamps[i]` is the
  3474. // commit
  3475. // timestamp for the statement `statements[i]`.
  3476. CommitTimestamps []string `json:"commitTimestamps,omitempty"`
  3477. // Database: The database being modified.
  3478. Database string `json:"database,omitempty"`
  3479. // Statements: For an update this list contains all the statements. For
  3480. // an
  3481. // individual statement, this list contains only that statement.
  3482. Statements []string `json:"statements,omitempty"`
  3483. // ForceSendFields is a list of field names (e.g. "CommitTimestamps") to
  3484. // unconditionally include in API requests. By default, fields with
  3485. // empty values are omitted from API requests. However, any non-pointer,
  3486. // non-interface field appearing in ForceSendFields will be sent to the
  3487. // server regardless of whether the field is empty or not. This may be
  3488. // used to include empty fields in Patch requests.
  3489. ForceSendFields []string `json:"-"`
  3490. // NullFields is a list of field names (e.g. "CommitTimestamps") to
  3491. // include in API requests with the JSON null value. By default, fields
  3492. // with empty values are omitted from API requests. However, any field
  3493. // with an empty value appearing in NullFields will be sent to the
  3494. // server as null. It is an error if a field in this list has a
  3495. // non-empty value. This may be used to include null fields in Patch
  3496. // requests.
  3497. NullFields []string `json:"-"`
  3498. }
  3499. func (s *UpdateDatabaseDdlMetadata) MarshalJSON() ([]byte, error) {
  3500. type NoMethod UpdateDatabaseDdlMetadata
  3501. raw := NoMethod(*s)
  3502. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3503. }
  3504. // UpdateDatabaseDdlRequest: Enqueues the given DDL statements to be
  3505. // applied, in order but not
  3506. // necessarily all at once, to the database schema at some point
  3507. // (or
  3508. // points) in the future. The server checks that the statements
  3509. // are executable (syntactically valid, name tables that exist,
  3510. // etc.)
  3511. // before enqueueing them, but they may still fail upon
  3512. // later execution (e.g., if a statement from another batch
  3513. // of
  3514. // statements is applied first and it conflicts in some way, or if
  3515. // there is some data-related problem like a `NULL` value in a column
  3516. // to
  3517. // which `NOT NULL` would be added). If a statement fails,
  3518. // all
  3519. // subsequent statements in the batch are automatically cancelled.
  3520. //
  3521. // Each batch of statements is assigned a name which can be used
  3522. // with
  3523. // the Operations API to monitor
  3524. // progress. See the
  3525. // operation_id field for more
  3526. // details.
  3527. type UpdateDatabaseDdlRequest struct {
  3528. // OperationId: If empty, the new update request is assigned
  3529. // an
  3530. // automatically-generated operation ID. Otherwise, `operation_id`
  3531. // is used to construct the name of the resulting
  3532. // Operation.
  3533. //
  3534. // Specifying an explicit operation ID simplifies determining
  3535. // whether the statements were executed in the event that
  3536. // the
  3537. // UpdateDatabaseDdl call is replayed,
  3538. // or the return value is otherwise lost: the database
  3539. // and
  3540. // `operation_id` fields can be combined to form the
  3541. // name of the resulting
  3542. // longrunning.Operation:
  3543. // `<database>/operations/<operation_id>`.
  3544. //
  3545. // `operation_id` should be unique within the database, and must be
  3546. // a valid identifier: `a-z*`. Note that
  3547. // automatically-generated operation IDs always begin with
  3548. // an
  3549. // underscore. If the named operation already exists,
  3550. // UpdateDatabaseDdl returns
  3551. // `ALREADY_EXISTS`.
  3552. OperationId string `json:"operationId,omitempty"`
  3553. // Statements: DDL statements to be applied to the database.
  3554. Statements []string `json:"statements,omitempty"`
  3555. // ForceSendFields is a list of field names (e.g. "OperationId") to
  3556. // unconditionally include in API requests. By default, fields with
  3557. // empty values are omitted from API requests. However, any non-pointer,
  3558. // non-interface field appearing in ForceSendFields will be sent to the
  3559. // server regardless of whether the field is empty or not. This may be
  3560. // used to include empty fields in Patch requests.
  3561. ForceSendFields []string `json:"-"`
  3562. // NullFields is a list of field names (e.g. "OperationId") to include
  3563. // in API requests with the JSON null value. By default, fields with
  3564. // empty values are omitted from API requests. However, any field with
  3565. // an empty value appearing in NullFields will be sent to the server as
  3566. // null. It is an error if a field in this list has a non-empty value.
  3567. // This may be used to include null fields in Patch requests.
  3568. NullFields []string `json:"-"`
  3569. }
  3570. func (s *UpdateDatabaseDdlRequest) MarshalJSON() ([]byte, error) {
  3571. type NoMethod UpdateDatabaseDdlRequest
  3572. raw := NoMethod(*s)
  3573. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3574. }
  3575. // UpdateInstanceMetadata: Metadata type for the operation returned
  3576. // by
  3577. // UpdateInstance.
  3578. type UpdateInstanceMetadata struct {
  3579. // CancelTime: The time at which this operation was cancelled. If set,
  3580. // this operation is
  3581. // in the process of undoing itself (which is guaranteed to succeed)
  3582. // and
  3583. // cannot be cancelled again.
  3584. CancelTime string `json:"cancelTime,omitempty"`
  3585. // EndTime: The time at which this operation failed or was completed
  3586. // successfully.
  3587. EndTime string `json:"endTime,omitempty"`
  3588. // Instance: The desired end state of the update.
  3589. Instance *Instance `json:"instance,omitempty"`
  3590. // StartTime: The time at which UpdateInstance
  3591. // request was received.
  3592. StartTime string `json:"startTime,omitempty"`
  3593. // ForceSendFields is a list of field names (e.g. "CancelTime") to
  3594. // unconditionally include in API requests. By default, fields with
  3595. // empty values are omitted from API requests. However, any non-pointer,
  3596. // non-interface field appearing in ForceSendFields will be sent to the
  3597. // server regardless of whether the field is empty or not. This may be
  3598. // used to include empty fields in Patch requests.
  3599. ForceSendFields []string `json:"-"`
  3600. // NullFields is a list of field names (e.g. "CancelTime") to include in
  3601. // API requests with the JSON null value. By default, fields with empty
  3602. // values are omitted from API requests. However, any field with an
  3603. // empty value appearing in NullFields will be sent to the server as
  3604. // null. It is an error if a field in this list has a non-empty value.
  3605. // This may be used to include null fields in Patch requests.
  3606. NullFields []string `json:"-"`
  3607. }
  3608. func (s *UpdateInstanceMetadata) MarshalJSON() ([]byte, error) {
  3609. type NoMethod UpdateInstanceMetadata
  3610. raw := NoMethod(*s)
  3611. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3612. }
  3613. // UpdateInstanceRequest: The request for UpdateInstance.
  3614. type UpdateInstanceRequest struct {
  3615. // FieldMask: Required. A mask specifying which fields in
  3616. // [][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance]
  3617. // should be updated.
  3618. // The field mask must always be specified; this prevents any future
  3619. // fields in
  3620. // [][google.spanner.admin.instance.v1.Instance] from being erased
  3621. // accidentally by clients that do not know
  3622. // about them.
  3623. FieldMask string `json:"fieldMask,omitempty"`
  3624. // Instance: Required. The instance to update, which must always include
  3625. // the instance
  3626. // name. Otherwise, only fields mentioned in
  3627. // [][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]
  3628. // need be included.
  3629. Instance *Instance `json:"instance,omitempty"`
  3630. // ForceSendFields is a list of field names (e.g. "FieldMask") to
  3631. // unconditionally include in API requests. By default, fields with
  3632. // empty values are omitted from API requests. However, any non-pointer,
  3633. // non-interface field appearing in ForceSendFields will be sent to the
  3634. // server regardless of whether the field is empty or not. This may be
  3635. // used to include empty fields in Patch requests.
  3636. ForceSendFields []string `json:"-"`
  3637. // NullFields is a list of field names (e.g. "FieldMask") to include in
  3638. // API requests with the JSON null value. By default, fields with empty
  3639. // values are omitted from API requests. However, any field with an
  3640. // empty value appearing in NullFields will be sent to the server as
  3641. // null. It is an error if a field in this list has a non-empty value.
  3642. // This may be used to include null fields in Patch requests.
  3643. NullFields []string `json:"-"`
  3644. }
  3645. func (s *UpdateInstanceRequest) MarshalJSON() ([]byte, error) {
  3646. type NoMethod UpdateInstanceRequest
  3647. raw := NoMethod(*s)
  3648. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3649. }
  3650. // Write: Arguments to insert, update, insert_or_update, and
  3651. // replace operations.
  3652. type Write struct {
  3653. // Columns: The names of the columns in table to be written.
  3654. //
  3655. // The list of columns must contain enough columns to allow
  3656. // Cloud Spanner to derive values for all primary key columns in
  3657. // the
  3658. // row(s) to be modified.
  3659. Columns []string `json:"columns,omitempty"`
  3660. // Table: Required. The table whose rows will be written.
  3661. Table string `json:"table,omitempty"`
  3662. // Values: The values to be written. `values` can contain more than
  3663. // one
  3664. // list of values. If it does, then multiple rows are written, one
  3665. // for each entry in `values`. Each list in `values` must have
  3666. // exactly as many entries as there are entries in columns
  3667. // above. Sending multiple lists is equivalent to sending
  3668. // multiple
  3669. // `Mutation`s, each containing one `values` entry and repeating
  3670. // table and columns. Individual values in each list are
  3671. // encoded as described here.
  3672. Values [][]interface{} `json:"values,omitempty"`
  3673. // ForceSendFields is a list of field names (e.g. "Columns") to
  3674. // unconditionally include in API requests. By default, fields with
  3675. // empty values are omitted from API requests. However, any non-pointer,
  3676. // non-interface field appearing in ForceSendFields will be sent to the
  3677. // server regardless of whether the field is empty or not. This may be
  3678. // used to include empty fields in Patch requests.
  3679. ForceSendFields []string `json:"-"`
  3680. // NullFields is a list of field names (e.g. "Columns") to include in
  3681. // API requests with the JSON null value. By default, fields with empty
  3682. // values are omitted from API requests. However, any field with an
  3683. // empty value appearing in NullFields will be sent to the server as
  3684. // null. It is an error if a field in this list has a non-empty value.
  3685. // This may be used to include null fields in Patch requests.
  3686. NullFields []string `json:"-"`
  3687. }
  3688. func (s *Write) MarshalJSON() ([]byte, error) {
  3689. type NoMethod Write
  3690. raw := NoMethod(*s)
  3691. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3692. }
  3693. // method id "spanner.projects.instanceConfigs.get":
  3694. type ProjectsInstanceConfigsGetCall struct {
  3695. s *Service
  3696. name string
  3697. urlParams_ gensupport.URLParams
  3698. ifNoneMatch_ string
  3699. ctx_ context.Context
  3700. header_ http.Header
  3701. }
  3702. // Get: Gets information about a particular instance configuration.
  3703. func (r *ProjectsInstanceConfigsService) Get(name string) *ProjectsInstanceConfigsGetCall {
  3704. c := &ProjectsInstanceConfigsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3705. c.name = name
  3706. return c
  3707. }
  3708. // Fields allows partial responses to be retrieved. See
  3709. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3710. // for more information.
  3711. func (c *ProjectsInstanceConfigsGetCall) Fields(s ...googleapi.Field) *ProjectsInstanceConfigsGetCall {
  3712. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3713. return c
  3714. }
  3715. // IfNoneMatch sets the optional parameter which makes the operation
  3716. // fail if the object's ETag matches the given value. This is useful for
  3717. // getting updates only after the object has changed since the last
  3718. // request. Use googleapi.IsNotModified to check whether the response
  3719. // error from Do is the result of In-None-Match.
  3720. func (c *ProjectsInstanceConfigsGetCall) IfNoneMatch(entityTag string) *ProjectsInstanceConfigsGetCall {
  3721. c.ifNoneMatch_ = entityTag
  3722. return c
  3723. }
  3724. // Context sets the context to be used in this call's Do method. Any
  3725. // pending HTTP request will be aborted if the provided context is
  3726. // canceled.
  3727. func (c *ProjectsInstanceConfigsGetCall) Context(ctx context.Context) *ProjectsInstanceConfigsGetCall {
  3728. c.ctx_ = ctx
  3729. return c
  3730. }
  3731. // Header returns an http.Header that can be modified by the caller to
  3732. // add HTTP headers to the request.
  3733. func (c *ProjectsInstanceConfigsGetCall) Header() http.Header {
  3734. if c.header_ == nil {
  3735. c.header_ = make(http.Header)
  3736. }
  3737. return c.header_
  3738. }
  3739. func (c *ProjectsInstanceConfigsGetCall) doRequest(alt string) (*http.Response, error) {
  3740. reqHeaders := make(http.Header)
  3741. for k, v := range c.header_ {
  3742. reqHeaders[k] = v
  3743. }
  3744. reqHeaders.Set("User-Agent", c.s.userAgent())
  3745. if c.ifNoneMatch_ != "" {
  3746. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3747. }
  3748. var body io.Reader = nil
  3749. c.urlParams_.Set("alt", alt)
  3750. c.urlParams_.Set("prettyPrint", "false")
  3751. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3752. urls += "?" + c.urlParams_.Encode()
  3753. req, err := http.NewRequest("GET", urls, body)
  3754. if err != nil {
  3755. return nil, err
  3756. }
  3757. req.Header = reqHeaders
  3758. googleapi.Expand(req.URL, map[string]string{
  3759. "name": c.name,
  3760. })
  3761. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3762. }
  3763. // Do executes the "spanner.projects.instanceConfigs.get" call.
  3764. // Exactly one of *InstanceConfig or error will be non-nil. Any non-2xx
  3765. // status code is an error. Response headers are in either
  3766. // *InstanceConfig.ServerResponse.Header or (if a response was returned
  3767. // at all) in error.(*googleapi.Error).Header. Use
  3768. // googleapi.IsNotModified to check whether the returned error was
  3769. // because http.StatusNotModified was returned.
  3770. func (c *ProjectsInstanceConfigsGetCall) Do(opts ...googleapi.CallOption) (*InstanceConfig, error) {
  3771. gensupport.SetOptions(c.urlParams_, opts...)
  3772. res, err := c.doRequest("json")
  3773. if res != nil && res.StatusCode == http.StatusNotModified {
  3774. if res.Body != nil {
  3775. res.Body.Close()
  3776. }
  3777. return nil, &googleapi.Error{
  3778. Code: res.StatusCode,
  3779. Header: res.Header,
  3780. }
  3781. }
  3782. if err != nil {
  3783. return nil, err
  3784. }
  3785. defer googleapi.CloseBody(res)
  3786. if err := googleapi.CheckResponse(res); err != nil {
  3787. return nil, err
  3788. }
  3789. ret := &InstanceConfig{
  3790. ServerResponse: googleapi.ServerResponse{
  3791. Header: res.Header,
  3792. HTTPStatusCode: res.StatusCode,
  3793. },
  3794. }
  3795. target := &ret
  3796. if err := gensupport.DecodeResponse(target, res); err != nil {
  3797. return nil, err
  3798. }
  3799. return ret, nil
  3800. // {
  3801. // "description": "Gets information about a particular instance configuration.",
  3802. // "flatPath": "v1/projects/{projectsId}/instanceConfigs/{instanceConfigsId}",
  3803. // "httpMethod": "GET",
  3804. // "id": "spanner.projects.instanceConfigs.get",
  3805. // "parameterOrder": [
  3806. // "name"
  3807. // ],
  3808. // "parameters": {
  3809. // "name": {
  3810. // "description": "Required. The name of the requested instance configuration. Values are of\nthe form `projects/\u003cproject\u003e/instanceConfigs/\u003cconfig\u003e`.",
  3811. // "location": "path",
  3812. // "pattern": "^projects/[^/]+/instanceConfigs/[^/]+$",
  3813. // "required": true,
  3814. // "type": "string"
  3815. // }
  3816. // },
  3817. // "path": "v1/{+name}",
  3818. // "response": {
  3819. // "$ref": "InstanceConfig"
  3820. // },
  3821. // "scopes": [
  3822. // "https://www.googleapis.com/auth/cloud-platform",
  3823. // "https://www.googleapis.com/auth/spanner.admin"
  3824. // ]
  3825. // }
  3826. }
  3827. // method id "spanner.projects.instanceConfigs.list":
  3828. type ProjectsInstanceConfigsListCall struct {
  3829. s *Service
  3830. parent string
  3831. urlParams_ gensupport.URLParams
  3832. ifNoneMatch_ string
  3833. ctx_ context.Context
  3834. header_ http.Header
  3835. }
  3836. // List: Lists the supported instance configurations for a given
  3837. // project.
  3838. func (r *ProjectsInstanceConfigsService) List(parent string) *ProjectsInstanceConfigsListCall {
  3839. c := &ProjectsInstanceConfigsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3840. c.parent = parent
  3841. return c
  3842. }
  3843. // PageSize sets the optional parameter "pageSize": Number of instance
  3844. // configurations to be returned in the response. If 0 or
  3845. // less, defaults to the server's maximum allowed page size.
  3846. func (c *ProjectsInstanceConfigsListCall) PageSize(pageSize int64) *ProjectsInstanceConfigsListCall {
  3847. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3848. return c
  3849. }
  3850. // PageToken sets the optional parameter "pageToken": If non-empty,
  3851. // `page_token` should contain a
  3852. // next_page_token
  3853. // from a previous ListInstanceConfigsResponse.
  3854. func (c *ProjectsInstanceConfigsListCall) PageToken(pageToken string) *ProjectsInstanceConfigsListCall {
  3855. c.urlParams_.Set("pageToken", pageToken)
  3856. return c
  3857. }
  3858. // Fields allows partial responses to be retrieved. See
  3859. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3860. // for more information.
  3861. func (c *ProjectsInstanceConfigsListCall) Fields(s ...googleapi.Field) *ProjectsInstanceConfigsListCall {
  3862. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3863. return c
  3864. }
  3865. // IfNoneMatch sets the optional parameter which makes the operation
  3866. // fail if the object's ETag matches the given value. This is useful for
  3867. // getting updates only after the object has changed since the last
  3868. // request. Use googleapi.IsNotModified to check whether the response
  3869. // error from Do is the result of In-None-Match.
  3870. func (c *ProjectsInstanceConfigsListCall) IfNoneMatch(entityTag string) *ProjectsInstanceConfigsListCall {
  3871. c.ifNoneMatch_ = entityTag
  3872. return c
  3873. }
  3874. // Context sets the context to be used in this call's Do method. Any
  3875. // pending HTTP request will be aborted if the provided context is
  3876. // canceled.
  3877. func (c *ProjectsInstanceConfigsListCall) Context(ctx context.Context) *ProjectsInstanceConfigsListCall {
  3878. c.ctx_ = ctx
  3879. return c
  3880. }
  3881. // Header returns an http.Header that can be modified by the caller to
  3882. // add HTTP headers to the request.
  3883. func (c *ProjectsInstanceConfigsListCall) Header() http.Header {
  3884. if c.header_ == nil {
  3885. c.header_ = make(http.Header)
  3886. }
  3887. return c.header_
  3888. }
  3889. func (c *ProjectsInstanceConfigsListCall) doRequest(alt string) (*http.Response, error) {
  3890. reqHeaders := make(http.Header)
  3891. for k, v := range c.header_ {
  3892. reqHeaders[k] = v
  3893. }
  3894. reqHeaders.Set("User-Agent", c.s.userAgent())
  3895. if c.ifNoneMatch_ != "" {
  3896. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3897. }
  3898. var body io.Reader = nil
  3899. c.urlParams_.Set("alt", alt)
  3900. c.urlParams_.Set("prettyPrint", "false")
  3901. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instanceConfigs")
  3902. urls += "?" + c.urlParams_.Encode()
  3903. req, err := http.NewRequest("GET", urls, body)
  3904. if err != nil {
  3905. return nil, err
  3906. }
  3907. req.Header = reqHeaders
  3908. googleapi.Expand(req.URL, map[string]string{
  3909. "parent": c.parent,
  3910. })
  3911. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3912. }
  3913. // Do executes the "spanner.projects.instanceConfigs.list" call.
  3914. // Exactly one of *ListInstanceConfigsResponse or error will be non-nil.
  3915. // Any non-2xx status code is an error. Response headers are in either
  3916. // *ListInstanceConfigsResponse.ServerResponse.Header or (if a response
  3917. // was returned at all) in error.(*googleapi.Error).Header. Use
  3918. // googleapi.IsNotModified to check whether the returned error was
  3919. // because http.StatusNotModified was returned.
  3920. func (c *ProjectsInstanceConfigsListCall) Do(opts ...googleapi.CallOption) (*ListInstanceConfigsResponse, error) {
  3921. gensupport.SetOptions(c.urlParams_, opts...)
  3922. res, err := c.doRequest("json")
  3923. if res != nil && res.StatusCode == http.StatusNotModified {
  3924. if res.Body != nil {
  3925. res.Body.Close()
  3926. }
  3927. return nil, &googleapi.Error{
  3928. Code: res.StatusCode,
  3929. Header: res.Header,
  3930. }
  3931. }
  3932. if err != nil {
  3933. return nil, err
  3934. }
  3935. defer googleapi.CloseBody(res)
  3936. if err := googleapi.CheckResponse(res); err != nil {
  3937. return nil, err
  3938. }
  3939. ret := &ListInstanceConfigsResponse{
  3940. ServerResponse: googleapi.ServerResponse{
  3941. Header: res.Header,
  3942. HTTPStatusCode: res.StatusCode,
  3943. },
  3944. }
  3945. target := &ret
  3946. if err := gensupport.DecodeResponse(target, res); err != nil {
  3947. return nil, err
  3948. }
  3949. return ret, nil
  3950. // {
  3951. // "description": "Lists the supported instance configurations for a given project.",
  3952. // "flatPath": "v1/projects/{projectsId}/instanceConfigs",
  3953. // "httpMethod": "GET",
  3954. // "id": "spanner.projects.instanceConfigs.list",
  3955. // "parameterOrder": [
  3956. // "parent"
  3957. // ],
  3958. // "parameters": {
  3959. // "pageSize": {
  3960. // "description": "Number of instance configurations to be returned in the response. If 0 or\nless, defaults to the server's maximum allowed page size.",
  3961. // "format": "int32",
  3962. // "location": "query",
  3963. // "type": "integer"
  3964. // },
  3965. // "pageToken": {
  3966. // "description": "If non-empty, `page_token` should contain a\nnext_page_token\nfrom a previous ListInstanceConfigsResponse.",
  3967. // "location": "query",
  3968. // "type": "string"
  3969. // },
  3970. // "parent": {
  3971. // "description": "Required. The name of the project for which a list of supported instance\nconfigurations is requested. Values are of the form\n`projects/\u003cproject\u003e`.",
  3972. // "location": "path",
  3973. // "pattern": "^projects/[^/]+$",
  3974. // "required": true,
  3975. // "type": "string"
  3976. // }
  3977. // },
  3978. // "path": "v1/{+parent}/instanceConfigs",
  3979. // "response": {
  3980. // "$ref": "ListInstanceConfigsResponse"
  3981. // },
  3982. // "scopes": [
  3983. // "https://www.googleapis.com/auth/cloud-platform",
  3984. // "https://www.googleapis.com/auth/spanner.admin"
  3985. // ]
  3986. // }
  3987. }
  3988. // Pages invokes f for each page of results.
  3989. // A non-nil error returned from f will halt the iteration.
  3990. // The provided context supersedes any context provided to the Context method.
  3991. func (c *ProjectsInstanceConfigsListCall) Pages(ctx context.Context, f func(*ListInstanceConfigsResponse) error) error {
  3992. c.ctx_ = ctx
  3993. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3994. for {
  3995. x, err := c.Do()
  3996. if err != nil {
  3997. return err
  3998. }
  3999. if err := f(x); err != nil {
  4000. return err
  4001. }
  4002. if x.NextPageToken == "" {
  4003. return nil
  4004. }
  4005. c.PageToken(x.NextPageToken)
  4006. }
  4007. }
  4008. // method id "spanner.projects.instances.create":
  4009. type ProjectsInstancesCreateCall struct {
  4010. s *Service
  4011. parent string
  4012. createinstancerequest *CreateInstanceRequest
  4013. urlParams_ gensupport.URLParams
  4014. ctx_ context.Context
  4015. header_ http.Header
  4016. }
  4017. // Create: Creates an instance and begins preparing it to begin serving.
  4018. // The
  4019. // returned long-running operation
  4020. // can be used to track the progress of preparing the new
  4021. // instance. The instance name is assigned by the caller. If the
  4022. // named instance already exists, `CreateInstance`
  4023. // returns
  4024. // `ALREADY_EXISTS`.
  4025. //
  4026. // Immediately upon completion of this request:
  4027. //
  4028. // * The instance is readable via the API, with all requested
  4029. // attributes
  4030. // but no allocated resources. Its state is `CREATING`.
  4031. //
  4032. // Until completion of the returned operation:
  4033. //
  4034. // * Cancelling the operation renders the instance immediately
  4035. // unreadable
  4036. // via the API.
  4037. // * The instance can be deleted.
  4038. // * All other attempts to modify the instance are rejected.
  4039. //
  4040. // Upon completion of the returned operation:
  4041. //
  4042. // * Billing for all successfully-allocated resources begins (some
  4043. // types
  4044. // may have lower than the requested levels).
  4045. // * Databases can be created in the instance.
  4046. // * The instance's allocated resource levels are readable via the
  4047. // API.
  4048. // * The instance's state becomes `READY`.
  4049. //
  4050. // The returned long-running operation will
  4051. // have a name of the format `<instance_name>/operations/<operation_id>`
  4052. // and
  4053. // can be used to track creation of the instance. The
  4054. // metadata field type is
  4055. // CreateInstanceMetadata.
  4056. // The response field type is
  4057. // Instance, if successful.
  4058. func (r *ProjectsInstancesService) Create(parent string, createinstancerequest *CreateInstanceRequest) *ProjectsInstancesCreateCall {
  4059. c := &ProjectsInstancesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4060. c.parent = parent
  4061. c.createinstancerequest = createinstancerequest
  4062. return c
  4063. }
  4064. // Fields allows partial responses to be retrieved. See
  4065. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4066. // for more information.
  4067. func (c *ProjectsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsInstancesCreateCall {
  4068. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4069. return c
  4070. }
  4071. // Context sets the context to be used in this call's Do method. Any
  4072. // pending HTTP request will be aborted if the provided context is
  4073. // canceled.
  4074. func (c *ProjectsInstancesCreateCall) Context(ctx context.Context) *ProjectsInstancesCreateCall {
  4075. c.ctx_ = ctx
  4076. return c
  4077. }
  4078. // Header returns an http.Header that can be modified by the caller to
  4079. // add HTTP headers to the request.
  4080. func (c *ProjectsInstancesCreateCall) Header() http.Header {
  4081. if c.header_ == nil {
  4082. c.header_ = make(http.Header)
  4083. }
  4084. return c.header_
  4085. }
  4086. func (c *ProjectsInstancesCreateCall) doRequest(alt string) (*http.Response, error) {
  4087. reqHeaders := make(http.Header)
  4088. for k, v := range c.header_ {
  4089. reqHeaders[k] = v
  4090. }
  4091. reqHeaders.Set("User-Agent", c.s.userAgent())
  4092. var body io.Reader = nil
  4093. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createinstancerequest)
  4094. if err != nil {
  4095. return nil, err
  4096. }
  4097. reqHeaders.Set("Content-Type", "application/json")
  4098. c.urlParams_.Set("alt", alt)
  4099. c.urlParams_.Set("prettyPrint", "false")
  4100. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances")
  4101. urls += "?" + c.urlParams_.Encode()
  4102. req, err := http.NewRequest("POST", urls, body)
  4103. if err != nil {
  4104. return nil, err
  4105. }
  4106. req.Header = reqHeaders
  4107. googleapi.Expand(req.URL, map[string]string{
  4108. "parent": c.parent,
  4109. })
  4110. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4111. }
  4112. // Do executes the "spanner.projects.instances.create" call.
  4113. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4114. // status code is an error. Response headers are in either
  4115. // *Operation.ServerResponse.Header or (if a response was returned at
  4116. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4117. // to check whether the returned error was because
  4118. // http.StatusNotModified was returned.
  4119. func (c *ProjectsInstancesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4120. gensupport.SetOptions(c.urlParams_, opts...)
  4121. res, err := c.doRequest("json")
  4122. if res != nil && res.StatusCode == http.StatusNotModified {
  4123. if res.Body != nil {
  4124. res.Body.Close()
  4125. }
  4126. return nil, &googleapi.Error{
  4127. Code: res.StatusCode,
  4128. Header: res.Header,
  4129. }
  4130. }
  4131. if err != nil {
  4132. return nil, err
  4133. }
  4134. defer googleapi.CloseBody(res)
  4135. if err := googleapi.CheckResponse(res); err != nil {
  4136. return nil, err
  4137. }
  4138. ret := &Operation{
  4139. ServerResponse: googleapi.ServerResponse{
  4140. Header: res.Header,
  4141. HTTPStatusCode: res.StatusCode,
  4142. },
  4143. }
  4144. target := &ret
  4145. if err := gensupport.DecodeResponse(target, res); err != nil {
  4146. return nil, err
  4147. }
  4148. return ret, nil
  4149. // {
  4150. // "description": "Creates an instance and begins preparing it to begin serving. The\nreturned long-running operation\ncan be used to track the progress of preparing the new\ninstance. The instance name is assigned by the caller. If the\nnamed instance already exists, `CreateInstance` returns\n`ALREADY_EXISTS`.\n\nImmediately upon completion of this request:\n\n * The instance is readable via the API, with all requested attributes\n but no allocated resources. Its state is `CREATING`.\n\nUntil completion of the returned operation:\n\n * Cancelling the operation renders the instance immediately unreadable\n via the API.\n * The instance can be deleted.\n * All other attempts to modify the instance are rejected.\n\nUpon completion of the returned operation:\n\n * Billing for all successfully-allocated resources begins (some types\n may have lower than the requested levels).\n * Databases can be created in the instance.\n * The instance's allocated resource levels are readable via the API.\n * The instance's state becomes `READY`.\n\nThe returned long-running operation will\nhave a name of the format `\u003cinstance_name\u003e/operations/\u003coperation_id\u003e` and\ncan be used to track creation of the instance. The\nmetadata field type is\nCreateInstanceMetadata.\nThe response field type is\nInstance, if successful.",
  4151. // "flatPath": "v1/projects/{projectsId}/instances",
  4152. // "httpMethod": "POST",
  4153. // "id": "spanner.projects.instances.create",
  4154. // "parameterOrder": [
  4155. // "parent"
  4156. // ],
  4157. // "parameters": {
  4158. // "parent": {
  4159. // "description": "Required. The name of the project in which to create the instance. Values\nare of the form `projects/\u003cproject\u003e`.",
  4160. // "location": "path",
  4161. // "pattern": "^projects/[^/]+$",
  4162. // "required": true,
  4163. // "type": "string"
  4164. // }
  4165. // },
  4166. // "path": "v1/{+parent}/instances",
  4167. // "request": {
  4168. // "$ref": "CreateInstanceRequest"
  4169. // },
  4170. // "response": {
  4171. // "$ref": "Operation"
  4172. // },
  4173. // "scopes": [
  4174. // "https://www.googleapis.com/auth/cloud-platform",
  4175. // "https://www.googleapis.com/auth/spanner.admin"
  4176. // ]
  4177. // }
  4178. }
  4179. // method id "spanner.projects.instances.delete":
  4180. type ProjectsInstancesDeleteCall struct {
  4181. s *Service
  4182. name string
  4183. urlParams_ gensupport.URLParams
  4184. ctx_ context.Context
  4185. header_ http.Header
  4186. }
  4187. // Delete: Deletes an instance.
  4188. //
  4189. // Immediately upon completion of the request:
  4190. //
  4191. // * Billing ceases for all of the instance's reserved
  4192. // resources.
  4193. //
  4194. // Soon afterward:
  4195. //
  4196. // * The instance and *all of its databases* immediately and
  4197. // irrevocably disappear from the API. All data in the databases
  4198. // is permanently deleted.
  4199. func (r *ProjectsInstancesService) Delete(name string) *ProjectsInstancesDeleteCall {
  4200. c := &ProjectsInstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4201. c.name = name
  4202. return c
  4203. }
  4204. // Fields allows partial responses to be retrieved. See
  4205. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4206. // for more information.
  4207. func (c *ProjectsInstancesDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesDeleteCall {
  4208. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4209. return c
  4210. }
  4211. // Context sets the context to be used in this call's Do method. Any
  4212. // pending HTTP request will be aborted if the provided context is
  4213. // canceled.
  4214. func (c *ProjectsInstancesDeleteCall) Context(ctx context.Context) *ProjectsInstancesDeleteCall {
  4215. c.ctx_ = ctx
  4216. return c
  4217. }
  4218. // Header returns an http.Header that can be modified by the caller to
  4219. // add HTTP headers to the request.
  4220. func (c *ProjectsInstancesDeleteCall) Header() http.Header {
  4221. if c.header_ == nil {
  4222. c.header_ = make(http.Header)
  4223. }
  4224. return c.header_
  4225. }
  4226. func (c *ProjectsInstancesDeleteCall) doRequest(alt string) (*http.Response, error) {
  4227. reqHeaders := make(http.Header)
  4228. for k, v := range c.header_ {
  4229. reqHeaders[k] = v
  4230. }
  4231. reqHeaders.Set("User-Agent", c.s.userAgent())
  4232. var body io.Reader = nil
  4233. c.urlParams_.Set("alt", alt)
  4234. c.urlParams_.Set("prettyPrint", "false")
  4235. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4236. urls += "?" + c.urlParams_.Encode()
  4237. req, err := http.NewRequest("DELETE", urls, body)
  4238. if err != nil {
  4239. return nil, err
  4240. }
  4241. req.Header = reqHeaders
  4242. googleapi.Expand(req.URL, map[string]string{
  4243. "name": c.name,
  4244. })
  4245. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4246. }
  4247. // Do executes the "spanner.projects.instances.delete" call.
  4248. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4249. // code is an error. Response headers are in either
  4250. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4251. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4252. // check whether the returned error was because http.StatusNotModified
  4253. // was returned.
  4254. func (c *ProjectsInstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4255. gensupport.SetOptions(c.urlParams_, opts...)
  4256. res, err := c.doRequest("json")
  4257. if res != nil && res.StatusCode == http.StatusNotModified {
  4258. if res.Body != nil {
  4259. res.Body.Close()
  4260. }
  4261. return nil, &googleapi.Error{
  4262. Code: res.StatusCode,
  4263. Header: res.Header,
  4264. }
  4265. }
  4266. if err != nil {
  4267. return nil, err
  4268. }
  4269. defer googleapi.CloseBody(res)
  4270. if err := googleapi.CheckResponse(res); err != nil {
  4271. return nil, err
  4272. }
  4273. ret := &Empty{
  4274. ServerResponse: googleapi.ServerResponse{
  4275. Header: res.Header,
  4276. HTTPStatusCode: res.StatusCode,
  4277. },
  4278. }
  4279. target := &ret
  4280. if err := gensupport.DecodeResponse(target, res); err != nil {
  4281. return nil, err
  4282. }
  4283. return ret, nil
  4284. // {
  4285. // "description": "Deletes an instance.\n\nImmediately upon completion of the request:\n\n * Billing ceases for all of the instance's reserved resources.\n\nSoon afterward:\n\n * The instance and *all of its databases* immediately and\n irrevocably disappear from the API. All data in the databases\n is permanently deleted.",
  4286. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}",
  4287. // "httpMethod": "DELETE",
  4288. // "id": "spanner.projects.instances.delete",
  4289. // "parameterOrder": [
  4290. // "name"
  4291. // ],
  4292. // "parameters": {
  4293. // "name": {
  4294. // "description": "Required. The name of the instance to be deleted. Values are of the form\n`projects/\u003cproject\u003e/instances/\u003cinstance\u003e`",
  4295. // "location": "path",
  4296. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4297. // "required": true,
  4298. // "type": "string"
  4299. // }
  4300. // },
  4301. // "path": "v1/{+name}",
  4302. // "response": {
  4303. // "$ref": "Empty"
  4304. // },
  4305. // "scopes": [
  4306. // "https://www.googleapis.com/auth/cloud-platform",
  4307. // "https://www.googleapis.com/auth/spanner.admin"
  4308. // ]
  4309. // }
  4310. }
  4311. // method id "spanner.projects.instances.get":
  4312. type ProjectsInstancesGetCall struct {
  4313. s *Service
  4314. name string
  4315. urlParams_ gensupport.URLParams
  4316. ifNoneMatch_ string
  4317. ctx_ context.Context
  4318. header_ http.Header
  4319. }
  4320. // Get: Gets information about a particular instance.
  4321. func (r *ProjectsInstancesService) Get(name string) *ProjectsInstancesGetCall {
  4322. c := &ProjectsInstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4323. c.name = name
  4324. return c
  4325. }
  4326. // Fields allows partial responses to be retrieved. See
  4327. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4328. // for more information.
  4329. func (c *ProjectsInstancesGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesGetCall {
  4330. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4331. return c
  4332. }
  4333. // IfNoneMatch sets the optional parameter which makes the operation
  4334. // fail if the object's ETag matches the given value. This is useful for
  4335. // getting updates only after the object has changed since the last
  4336. // request. Use googleapi.IsNotModified to check whether the response
  4337. // error from Do is the result of In-None-Match.
  4338. func (c *ProjectsInstancesGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesGetCall {
  4339. c.ifNoneMatch_ = entityTag
  4340. return c
  4341. }
  4342. // Context sets the context to be used in this call's Do method. Any
  4343. // pending HTTP request will be aborted if the provided context is
  4344. // canceled.
  4345. func (c *ProjectsInstancesGetCall) Context(ctx context.Context) *ProjectsInstancesGetCall {
  4346. c.ctx_ = ctx
  4347. return c
  4348. }
  4349. // Header returns an http.Header that can be modified by the caller to
  4350. // add HTTP headers to the request.
  4351. func (c *ProjectsInstancesGetCall) Header() http.Header {
  4352. if c.header_ == nil {
  4353. c.header_ = make(http.Header)
  4354. }
  4355. return c.header_
  4356. }
  4357. func (c *ProjectsInstancesGetCall) doRequest(alt string) (*http.Response, error) {
  4358. reqHeaders := make(http.Header)
  4359. for k, v := range c.header_ {
  4360. reqHeaders[k] = v
  4361. }
  4362. reqHeaders.Set("User-Agent", c.s.userAgent())
  4363. if c.ifNoneMatch_ != "" {
  4364. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4365. }
  4366. var body io.Reader = nil
  4367. c.urlParams_.Set("alt", alt)
  4368. c.urlParams_.Set("prettyPrint", "false")
  4369. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4370. urls += "?" + c.urlParams_.Encode()
  4371. req, err := http.NewRequest("GET", urls, body)
  4372. if err != nil {
  4373. return nil, err
  4374. }
  4375. req.Header = reqHeaders
  4376. googleapi.Expand(req.URL, map[string]string{
  4377. "name": c.name,
  4378. })
  4379. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4380. }
  4381. // Do executes the "spanner.projects.instances.get" call.
  4382. // Exactly one of *Instance or error will be non-nil. Any non-2xx status
  4383. // code is an error. Response headers are in either
  4384. // *Instance.ServerResponse.Header or (if a response was returned at
  4385. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4386. // to check whether the returned error was because
  4387. // http.StatusNotModified was returned.
  4388. func (c *ProjectsInstancesGetCall) Do(opts ...googleapi.CallOption) (*Instance, error) {
  4389. gensupport.SetOptions(c.urlParams_, opts...)
  4390. res, err := c.doRequest("json")
  4391. if res != nil && res.StatusCode == http.StatusNotModified {
  4392. if res.Body != nil {
  4393. res.Body.Close()
  4394. }
  4395. return nil, &googleapi.Error{
  4396. Code: res.StatusCode,
  4397. Header: res.Header,
  4398. }
  4399. }
  4400. if err != nil {
  4401. return nil, err
  4402. }
  4403. defer googleapi.CloseBody(res)
  4404. if err := googleapi.CheckResponse(res); err != nil {
  4405. return nil, err
  4406. }
  4407. ret := &Instance{
  4408. ServerResponse: googleapi.ServerResponse{
  4409. Header: res.Header,
  4410. HTTPStatusCode: res.StatusCode,
  4411. },
  4412. }
  4413. target := &ret
  4414. if err := gensupport.DecodeResponse(target, res); err != nil {
  4415. return nil, err
  4416. }
  4417. return ret, nil
  4418. // {
  4419. // "description": "Gets information about a particular instance.",
  4420. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}",
  4421. // "httpMethod": "GET",
  4422. // "id": "spanner.projects.instances.get",
  4423. // "parameterOrder": [
  4424. // "name"
  4425. // ],
  4426. // "parameters": {
  4427. // "name": {
  4428. // "description": "Required. The name of the requested instance. Values are of the form\n`projects/\u003cproject\u003e/instances/\u003cinstance\u003e`.",
  4429. // "location": "path",
  4430. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4431. // "required": true,
  4432. // "type": "string"
  4433. // }
  4434. // },
  4435. // "path": "v1/{+name}",
  4436. // "response": {
  4437. // "$ref": "Instance"
  4438. // },
  4439. // "scopes": [
  4440. // "https://www.googleapis.com/auth/cloud-platform",
  4441. // "https://www.googleapis.com/auth/spanner.admin"
  4442. // ]
  4443. // }
  4444. }
  4445. // method id "spanner.projects.instances.getIamPolicy":
  4446. type ProjectsInstancesGetIamPolicyCall struct {
  4447. s *Service
  4448. resource string
  4449. getiampolicyrequest *GetIamPolicyRequest
  4450. urlParams_ gensupport.URLParams
  4451. ctx_ context.Context
  4452. header_ http.Header
  4453. }
  4454. // GetIamPolicy: Gets the access control policy for an instance
  4455. // resource. Returns an empty
  4456. // policy if an instance exists but does not have a policy
  4457. // set.
  4458. //
  4459. // Authorization requires `spanner.instances.getIamPolicy` on
  4460. // resource.
  4461. func (r *ProjectsInstancesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsInstancesGetIamPolicyCall {
  4462. c := &ProjectsInstancesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4463. c.resource = resource
  4464. c.getiampolicyrequest = getiampolicyrequest
  4465. return c
  4466. }
  4467. // Fields allows partial responses to be retrieved. See
  4468. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4469. // for more information.
  4470. func (c *ProjectsInstancesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesGetIamPolicyCall {
  4471. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4472. return c
  4473. }
  4474. // Context sets the context to be used in this call's Do method. Any
  4475. // pending HTTP request will be aborted if the provided context is
  4476. // canceled.
  4477. func (c *ProjectsInstancesGetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesGetIamPolicyCall {
  4478. c.ctx_ = ctx
  4479. return c
  4480. }
  4481. // Header returns an http.Header that can be modified by the caller to
  4482. // add HTTP headers to the request.
  4483. func (c *ProjectsInstancesGetIamPolicyCall) Header() http.Header {
  4484. if c.header_ == nil {
  4485. c.header_ = make(http.Header)
  4486. }
  4487. return c.header_
  4488. }
  4489. func (c *ProjectsInstancesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4490. reqHeaders := make(http.Header)
  4491. for k, v := range c.header_ {
  4492. reqHeaders[k] = v
  4493. }
  4494. reqHeaders.Set("User-Agent", c.s.userAgent())
  4495. var body io.Reader = nil
  4496. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  4497. if err != nil {
  4498. return nil, err
  4499. }
  4500. reqHeaders.Set("Content-Type", "application/json")
  4501. c.urlParams_.Set("alt", alt)
  4502. c.urlParams_.Set("prettyPrint", "false")
  4503. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  4504. urls += "?" + c.urlParams_.Encode()
  4505. req, err := http.NewRequest("POST", urls, body)
  4506. if err != nil {
  4507. return nil, err
  4508. }
  4509. req.Header = reqHeaders
  4510. googleapi.Expand(req.URL, map[string]string{
  4511. "resource": c.resource,
  4512. })
  4513. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4514. }
  4515. // Do executes the "spanner.projects.instances.getIamPolicy" call.
  4516. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4517. // code is an error. Response headers are in either
  4518. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4519. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4520. // check whether the returned error was because http.StatusNotModified
  4521. // was returned.
  4522. func (c *ProjectsInstancesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4523. gensupport.SetOptions(c.urlParams_, opts...)
  4524. res, err := c.doRequest("json")
  4525. if res != nil && res.StatusCode == http.StatusNotModified {
  4526. if res.Body != nil {
  4527. res.Body.Close()
  4528. }
  4529. return nil, &googleapi.Error{
  4530. Code: res.StatusCode,
  4531. Header: res.Header,
  4532. }
  4533. }
  4534. if err != nil {
  4535. return nil, err
  4536. }
  4537. defer googleapi.CloseBody(res)
  4538. if err := googleapi.CheckResponse(res); err != nil {
  4539. return nil, err
  4540. }
  4541. ret := &Policy{
  4542. ServerResponse: googleapi.ServerResponse{
  4543. Header: res.Header,
  4544. HTTPStatusCode: res.StatusCode,
  4545. },
  4546. }
  4547. target := &ret
  4548. if err := gensupport.DecodeResponse(target, res); err != nil {
  4549. return nil, err
  4550. }
  4551. return ret, nil
  4552. // {
  4553. // "description": "Gets the access control policy for an instance resource. Returns an empty\npolicy if an instance exists but does not have a policy set.\n\nAuthorization requires `spanner.instances.getIamPolicy` on\nresource.",
  4554. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}:getIamPolicy",
  4555. // "httpMethod": "POST",
  4556. // "id": "spanner.projects.instances.getIamPolicy",
  4557. // "parameterOrder": [
  4558. // "resource"
  4559. // ],
  4560. // "parameters": {
  4561. // "resource": {
  4562. // "description": "REQUIRED: The Cloud Spanner resource for which the policy is being retrieved. The format is `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e` for instance resources and `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e/databases/\u003cdatabase ID\u003e` for database resources.",
  4563. // "location": "path",
  4564. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4565. // "required": true,
  4566. // "type": "string"
  4567. // }
  4568. // },
  4569. // "path": "v1/{+resource}:getIamPolicy",
  4570. // "request": {
  4571. // "$ref": "GetIamPolicyRequest"
  4572. // },
  4573. // "response": {
  4574. // "$ref": "Policy"
  4575. // },
  4576. // "scopes": [
  4577. // "https://www.googleapis.com/auth/cloud-platform",
  4578. // "https://www.googleapis.com/auth/spanner.admin"
  4579. // ]
  4580. // }
  4581. }
  4582. // method id "spanner.projects.instances.list":
  4583. type ProjectsInstancesListCall struct {
  4584. s *Service
  4585. parent string
  4586. urlParams_ gensupport.URLParams
  4587. ifNoneMatch_ string
  4588. ctx_ context.Context
  4589. header_ http.Header
  4590. }
  4591. // List: Lists all instances in the given project.
  4592. func (r *ProjectsInstancesService) List(parent string) *ProjectsInstancesListCall {
  4593. c := &ProjectsInstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4594. c.parent = parent
  4595. return c
  4596. }
  4597. // Filter sets the optional parameter "filter": An expression for
  4598. // filtering the results of the request. Filter rules are
  4599. // case insensitive. The fields eligible for filtering are:
  4600. //
  4601. // * `name`
  4602. // * `display_name`
  4603. // * `labels.key` where key is the name of a label
  4604. //
  4605. // Some examples of using filters are:
  4606. //
  4607. // * `name:*` --> The instance has a name.
  4608. // * `name:Howl` --> The instance's name contains the string "howl".
  4609. // * `name:HOWL` --> Equivalent to above.
  4610. // * `NAME:howl` --> Equivalent to above.
  4611. // * `labels.env:*` --> The instance has the label "env".
  4612. // * `labels.env:dev` --> The instance has the label "env" and the
  4613. // value of
  4614. // the label contains the string "dev".
  4615. // * `name:howl labels.env:dev` --> The instance's name contains
  4616. // "howl" and
  4617. // it has the label "env" with its
  4618. // value
  4619. // containing "dev".
  4620. func (c *ProjectsInstancesListCall) Filter(filter string) *ProjectsInstancesListCall {
  4621. c.urlParams_.Set("filter", filter)
  4622. return c
  4623. }
  4624. // PageSize sets the optional parameter "pageSize": Number of instances
  4625. // to be returned in the response. If 0 or less, defaults
  4626. // to the server's maximum allowed page size.
  4627. func (c *ProjectsInstancesListCall) PageSize(pageSize int64) *ProjectsInstancesListCall {
  4628. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4629. return c
  4630. }
  4631. // PageToken sets the optional parameter "pageToken": If non-empty,
  4632. // `page_token` should contain a
  4633. // next_page_token from a
  4634. // previous ListInstancesResponse.
  4635. func (c *ProjectsInstancesListCall) PageToken(pageToken string) *ProjectsInstancesListCall {
  4636. c.urlParams_.Set("pageToken", pageToken)
  4637. return c
  4638. }
  4639. // Fields allows partial responses to be retrieved. See
  4640. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4641. // for more information.
  4642. func (c *ProjectsInstancesListCall) Fields(s ...googleapi.Field) *ProjectsInstancesListCall {
  4643. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4644. return c
  4645. }
  4646. // IfNoneMatch sets the optional parameter which makes the operation
  4647. // fail if the object's ETag matches the given value. This is useful for
  4648. // getting updates only after the object has changed since the last
  4649. // request. Use googleapi.IsNotModified to check whether the response
  4650. // error from Do is the result of In-None-Match.
  4651. func (c *ProjectsInstancesListCall) IfNoneMatch(entityTag string) *ProjectsInstancesListCall {
  4652. c.ifNoneMatch_ = entityTag
  4653. return c
  4654. }
  4655. // Context sets the context to be used in this call's Do method. Any
  4656. // pending HTTP request will be aborted if the provided context is
  4657. // canceled.
  4658. func (c *ProjectsInstancesListCall) Context(ctx context.Context) *ProjectsInstancesListCall {
  4659. c.ctx_ = ctx
  4660. return c
  4661. }
  4662. // Header returns an http.Header that can be modified by the caller to
  4663. // add HTTP headers to the request.
  4664. func (c *ProjectsInstancesListCall) Header() http.Header {
  4665. if c.header_ == nil {
  4666. c.header_ = make(http.Header)
  4667. }
  4668. return c.header_
  4669. }
  4670. func (c *ProjectsInstancesListCall) doRequest(alt string) (*http.Response, error) {
  4671. reqHeaders := make(http.Header)
  4672. for k, v := range c.header_ {
  4673. reqHeaders[k] = v
  4674. }
  4675. reqHeaders.Set("User-Agent", c.s.userAgent())
  4676. if c.ifNoneMatch_ != "" {
  4677. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4678. }
  4679. var body io.Reader = nil
  4680. c.urlParams_.Set("alt", alt)
  4681. c.urlParams_.Set("prettyPrint", "false")
  4682. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances")
  4683. urls += "?" + c.urlParams_.Encode()
  4684. req, err := http.NewRequest("GET", urls, body)
  4685. if err != nil {
  4686. return nil, err
  4687. }
  4688. req.Header = reqHeaders
  4689. googleapi.Expand(req.URL, map[string]string{
  4690. "parent": c.parent,
  4691. })
  4692. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4693. }
  4694. // Do executes the "spanner.projects.instances.list" call.
  4695. // Exactly one of *ListInstancesResponse or error will be non-nil. Any
  4696. // non-2xx status code is an error. Response headers are in either
  4697. // *ListInstancesResponse.ServerResponse.Header or (if a response was
  4698. // returned at all) in error.(*googleapi.Error).Header. Use
  4699. // googleapi.IsNotModified to check whether the returned error was
  4700. // because http.StatusNotModified was returned.
  4701. func (c *ProjectsInstancesListCall) Do(opts ...googleapi.CallOption) (*ListInstancesResponse, error) {
  4702. gensupport.SetOptions(c.urlParams_, opts...)
  4703. res, err := c.doRequest("json")
  4704. if res != nil && res.StatusCode == http.StatusNotModified {
  4705. if res.Body != nil {
  4706. res.Body.Close()
  4707. }
  4708. return nil, &googleapi.Error{
  4709. Code: res.StatusCode,
  4710. Header: res.Header,
  4711. }
  4712. }
  4713. if err != nil {
  4714. return nil, err
  4715. }
  4716. defer googleapi.CloseBody(res)
  4717. if err := googleapi.CheckResponse(res); err != nil {
  4718. return nil, err
  4719. }
  4720. ret := &ListInstancesResponse{
  4721. ServerResponse: googleapi.ServerResponse{
  4722. Header: res.Header,
  4723. HTTPStatusCode: res.StatusCode,
  4724. },
  4725. }
  4726. target := &ret
  4727. if err := gensupport.DecodeResponse(target, res); err != nil {
  4728. return nil, err
  4729. }
  4730. return ret, nil
  4731. // {
  4732. // "description": "Lists all instances in the given project.",
  4733. // "flatPath": "v1/projects/{projectsId}/instances",
  4734. // "httpMethod": "GET",
  4735. // "id": "spanner.projects.instances.list",
  4736. // "parameterOrder": [
  4737. // "parent"
  4738. // ],
  4739. // "parameters": {
  4740. // "filter": {
  4741. // "description": "An expression for filtering the results of the request. Filter rules are\ncase insensitive. The fields eligible for filtering are:\n\n * `name`\n * `display_name`\n * `labels.key` where key is the name of a label\n\nSome examples of using filters are:\n\n * `name:*` --\u003e The instance has a name.\n * `name:Howl` --\u003e The instance's name contains the string \"howl\".\n * `name:HOWL` --\u003e Equivalent to above.\n * `NAME:howl` --\u003e Equivalent to above.\n * `labels.env:*` --\u003e The instance has the label \"env\".\n * `labels.env:dev` --\u003e The instance has the label \"env\" and the value of\n the label contains the string \"dev\".\n * `name:howl labels.env:dev` --\u003e The instance's name contains \"howl\" and\n it has the label \"env\" with its value\n containing \"dev\".",
  4742. // "location": "query",
  4743. // "type": "string"
  4744. // },
  4745. // "pageSize": {
  4746. // "description": "Number of instances to be returned in the response. If 0 or less, defaults\nto the server's maximum allowed page size.",
  4747. // "format": "int32",
  4748. // "location": "query",
  4749. // "type": "integer"
  4750. // },
  4751. // "pageToken": {
  4752. // "description": "If non-empty, `page_token` should contain a\nnext_page_token from a\nprevious ListInstancesResponse.",
  4753. // "location": "query",
  4754. // "type": "string"
  4755. // },
  4756. // "parent": {
  4757. // "description": "Required. The name of the project for which a list of instances is\nrequested. Values are of the form `projects/\u003cproject\u003e`.",
  4758. // "location": "path",
  4759. // "pattern": "^projects/[^/]+$",
  4760. // "required": true,
  4761. // "type": "string"
  4762. // }
  4763. // },
  4764. // "path": "v1/{+parent}/instances",
  4765. // "response": {
  4766. // "$ref": "ListInstancesResponse"
  4767. // },
  4768. // "scopes": [
  4769. // "https://www.googleapis.com/auth/cloud-platform",
  4770. // "https://www.googleapis.com/auth/spanner.admin"
  4771. // ]
  4772. // }
  4773. }
  4774. // Pages invokes f for each page of results.
  4775. // A non-nil error returned from f will halt the iteration.
  4776. // The provided context supersedes any context provided to the Context method.
  4777. func (c *ProjectsInstancesListCall) Pages(ctx context.Context, f func(*ListInstancesResponse) error) error {
  4778. c.ctx_ = ctx
  4779. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4780. for {
  4781. x, err := c.Do()
  4782. if err != nil {
  4783. return err
  4784. }
  4785. if err := f(x); err != nil {
  4786. return err
  4787. }
  4788. if x.NextPageToken == "" {
  4789. return nil
  4790. }
  4791. c.PageToken(x.NextPageToken)
  4792. }
  4793. }
  4794. // method id "spanner.projects.instances.patch":
  4795. type ProjectsInstancesPatchCall struct {
  4796. s *Service
  4797. nameid string
  4798. updateinstancerequest *UpdateInstanceRequest
  4799. urlParams_ gensupport.URLParams
  4800. ctx_ context.Context
  4801. header_ http.Header
  4802. }
  4803. // Patch: Updates an instance, and begins allocating or releasing
  4804. // resources
  4805. // as requested. The returned long-running
  4806. // operation can be used to track the
  4807. // progress of updating the instance. If the named instance does
  4808. // not
  4809. // exist, returns `NOT_FOUND`.
  4810. //
  4811. // Immediately upon completion of this request:
  4812. //
  4813. // * For resource types for which a decrease in the instance's
  4814. // allocation
  4815. // has been requested, billing is based on the newly-requested
  4816. // level.
  4817. //
  4818. // Until completion of the returned operation:
  4819. //
  4820. // * Cancelling the operation sets its metadata's
  4821. // cancel_time, and begins
  4822. // restoring resources to their pre-request values. The operation
  4823. // is guaranteed to succeed at undoing all resource changes,
  4824. // after which point it terminates with a `CANCELLED` status.
  4825. // * All other attempts to modify the instance are rejected.
  4826. // * Reading the instance via the API continues to give the
  4827. // pre-request
  4828. // resource levels.
  4829. //
  4830. // Upon completion of the returned operation:
  4831. //
  4832. // * Billing begins for all successfully-allocated resources (some
  4833. // types
  4834. // may have lower than the requested levels).
  4835. // * All newly-reserved resources are available for serving the
  4836. // instance's
  4837. // tables.
  4838. // * The instance's new resource levels are readable via the API.
  4839. //
  4840. // The returned long-running operation will
  4841. // have a name of the format `<instance_name>/operations/<operation_id>`
  4842. // and
  4843. // can be used to track the instance modification. The
  4844. // metadata field type is
  4845. // UpdateInstanceMetadata.
  4846. // The response field type is
  4847. // Instance, if successful.
  4848. //
  4849. // Authorization requires `spanner.instances.update` permission
  4850. // on
  4851. // resource name.
  4852. func (r *ProjectsInstancesService) Patch(nameid string, updateinstancerequest *UpdateInstanceRequest) *ProjectsInstancesPatchCall {
  4853. c := &ProjectsInstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4854. c.nameid = nameid
  4855. c.updateinstancerequest = updateinstancerequest
  4856. return c
  4857. }
  4858. // Fields allows partial responses to be retrieved. See
  4859. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4860. // for more information.
  4861. func (c *ProjectsInstancesPatchCall) Fields(s ...googleapi.Field) *ProjectsInstancesPatchCall {
  4862. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4863. return c
  4864. }
  4865. // Context sets the context to be used in this call's Do method. Any
  4866. // pending HTTP request will be aborted if the provided context is
  4867. // canceled.
  4868. func (c *ProjectsInstancesPatchCall) Context(ctx context.Context) *ProjectsInstancesPatchCall {
  4869. c.ctx_ = ctx
  4870. return c
  4871. }
  4872. // Header returns an http.Header that can be modified by the caller to
  4873. // add HTTP headers to the request.
  4874. func (c *ProjectsInstancesPatchCall) Header() http.Header {
  4875. if c.header_ == nil {
  4876. c.header_ = make(http.Header)
  4877. }
  4878. return c.header_
  4879. }
  4880. func (c *ProjectsInstancesPatchCall) doRequest(alt string) (*http.Response, error) {
  4881. reqHeaders := make(http.Header)
  4882. for k, v := range c.header_ {
  4883. reqHeaders[k] = v
  4884. }
  4885. reqHeaders.Set("User-Agent", c.s.userAgent())
  4886. var body io.Reader = nil
  4887. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updateinstancerequest)
  4888. if err != nil {
  4889. return nil, err
  4890. }
  4891. reqHeaders.Set("Content-Type", "application/json")
  4892. c.urlParams_.Set("alt", alt)
  4893. c.urlParams_.Set("prettyPrint", "false")
  4894. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4895. urls += "?" + c.urlParams_.Encode()
  4896. req, err := http.NewRequest("PATCH", urls, body)
  4897. if err != nil {
  4898. return nil, err
  4899. }
  4900. req.Header = reqHeaders
  4901. googleapi.Expand(req.URL, map[string]string{
  4902. "name": c.nameid,
  4903. })
  4904. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4905. }
  4906. // Do executes the "spanner.projects.instances.patch" call.
  4907. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4908. // status code is an error. Response headers are in either
  4909. // *Operation.ServerResponse.Header or (if a response was returned at
  4910. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4911. // to check whether the returned error was because
  4912. // http.StatusNotModified was returned.
  4913. func (c *ProjectsInstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4914. gensupport.SetOptions(c.urlParams_, opts...)
  4915. res, err := c.doRequest("json")
  4916. if res != nil && res.StatusCode == http.StatusNotModified {
  4917. if res.Body != nil {
  4918. res.Body.Close()
  4919. }
  4920. return nil, &googleapi.Error{
  4921. Code: res.StatusCode,
  4922. Header: res.Header,
  4923. }
  4924. }
  4925. if err != nil {
  4926. return nil, err
  4927. }
  4928. defer googleapi.CloseBody(res)
  4929. if err := googleapi.CheckResponse(res); err != nil {
  4930. return nil, err
  4931. }
  4932. ret := &Operation{
  4933. ServerResponse: googleapi.ServerResponse{
  4934. Header: res.Header,
  4935. HTTPStatusCode: res.StatusCode,
  4936. },
  4937. }
  4938. target := &ret
  4939. if err := gensupport.DecodeResponse(target, res); err != nil {
  4940. return nil, err
  4941. }
  4942. return ret, nil
  4943. // {
  4944. // "description": "Updates an instance, and begins allocating or releasing resources\nas requested. The returned long-running\noperation can be used to track the\nprogress of updating the instance. If the named instance does not\nexist, returns `NOT_FOUND`.\n\nImmediately upon completion of this request:\n\n * For resource types for which a decrease in the instance's allocation\n has been requested, billing is based on the newly-requested level.\n\nUntil completion of the returned operation:\n\n * Cancelling the operation sets its metadata's\n cancel_time, and begins\n restoring resources to their pre-request values. The operation\n is guaranteed to succeed at undoing all resource changes,\n after which point it terminates with a `CANCELLED` status.\n * All other attempts to modify the instance are rejected.\n * Reading the instance via the API continues to give the pre-request\n resource levels.\n\nUpon completion of the returned operation:\n\n * Billing begins for all successfully-allocated resources (some types\n may have lower than the requested levels).\n * All newly-reserved resources are available for serving the instance's\n tables.\n * The instance's new resource levels are readable via the API.\n\nThe returned long-running operation will\nhave a name of the format `\u003cinstance_name\u003e/operations/\u003coperation_id\u003e` and\ncan be used to track the instance modification. The\nmetadata field type is\nUpdateInstanceMetadata.\nThe response field type is\nInstance, if successful.\n\nAuthorization requires `spanner.instances.update` permission on\nresource name.",
  4945. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}",
  4946. // "httpMethod": "PATCH",
  4947. // "id": "spanner.projects.instances.patch",
  4948. // "parameterOrder": [
  4949. // "name"
  4950. // ],
  4951. // "parameters": {
  4952. // "name": {
  4953. // "description": "Required. A unique identifier for the instance, which cannot be changed\nafter the instance is created. Values are of the form\n`projects/\u003cproject\u003e/instances/a-z*[a-z0-9]`. The final\nsegment of the name must be between 6 and 30 characters in length.",
  4954. // "location": "path",
  4955. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4956. // "required": true,
  4957. // "type": "string"
  4958. // }
  4959. // },
  4960. // "path": "v1/{+name}",
  4961. // "request": {
  4962. // "$ref": "UpdateInstanceRequest"
  4963. // },
  4964. // "response": {
  4965. // "$ref": "Operation"
  4966. // },
  4967. // "scopes": [
  4968. // "https://www.googleapis.com/auth/cloud-platform",
  4969. // "https://www.googleapis.com/auth/spanner.admin"
  4970. // ]
  4971. // }
  4972. }
  4973. // method id "spanner.projects.instances.setIamPolicy":
  4974. type ProjectsInstancesSetIamPolicyCall struct {
  4975. s *Service
  4976. resource string
  4977. setiampolicyrequest *SetIamPolicyRequest
  4978. urlParams_ gensupport.URLParams
  4979. ctx_ context.Context
  4980. header_ http.Header
  4981. }
  4982. // SetIamPolicy: Sets the access control policy on an instance resource.
  4983. // Replaces any
  4984. // existing policy.
  4985. //
  4986. // Authorization requires `spanner.instances.setIamPolicy` on
  4987. // resource.
  4988. func (r *ProjectsInstancesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsInstancesSetIamPolicyCall {
  4989. c := &ProjectsInstancesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4990. c.resource = resource
  4991. c.setiampolicyrequest = setiampolicyrequest
  4992. return c
  4993. }
  4994. // Fields allows partial responses to be retrieved. See
  4995. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4996. // for more information.
  4997. func (c *ProjectsInstancesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesSetIamPolicyCall {
  4998. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4999. return c
  5000. }
  5001. // Context sets the context to be used in this call's Do method. Any
  5002. // pending HTTP request will be aborted if the provided context is
  5003. // canceled.
  5004. func (c *ProjectsInstancesSetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesSetIamPolicyCall {
  5005. c.ctx_ = ctx
  5006. return c
  5007. }
  5008. // Header returns an http.Header that can be modified by the caller to
  5009. // add HTTP headers to the request.
  5010. func (c *ProjectsInstancesSetIamPolicyCall) Header() http.Header {
  5011. if c.header_ == nil {
  5012. c.header_ = make(http.Header)
  5013. }
  5014. return c.header_
  5015. }
  5016. func (c *ProjectsInstancesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5017. reqHeaders := make(http.Header)
  5018. for k, v := range c.header_ {
  5019. reqHeaders[k] = v
  5020. }
  5021. reqHeaders.Set("User-Agent", c.s.userAgent())
  5022. var body io.Reader = nil
  5023. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  5024. if err != nil {
  5025. return nil, err
  5026. }
  5027. reqHeaders.Set("Content-Type", "application/json")
  5028. c.urlParams_.Set("alt", alt)
  5029. c.urlParams_.Set("prettyPrint", "false")
  5030. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  5031. urls += "?" + c.urlParams_.Encode()
  5032. req, err := http.NewRequest("POST", urls, body)
  5033. if err != nil {
  5034. return nil, err
  5035. }
  5036. req.Header = reqHeaders
  5037. googleapi.Expand(req.URL, map[string]string{
  5038. "resource": c.resource,
  5039. })
  5040. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5041. }
  5042. // Do executes the "spanner.projects.instances.setIamPolicy" call.
  5043. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5044. // code is an error. Response headers are in either
  5045. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5046. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5047. // check whether the returned error was because http.StatusNotModified
  5048. // was returned.
  5049. func (c *ProjectsInstancesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5050. gensupport.SetOptions(c.urlParams_, opts...)
  5051. res, err := c.doRequest("json")
  5052. if res != nil && res.StatusCode == http.StatusNotModified {
  5053. if res.Body != nil {
  5054. res.Body.Close()
  5055. }
  5056. return nil, &googleapi.Error{
  5057. Code: res.StatusCode,
  5058. Header: res.Header,
  5059. }
  5060. }
  5061. if err != nil {
  5062. return nil, err
  5063. }
  5064. defer googleapi.CloseBody(res)
  5065. if err := googleapi.CheckResponse(res); err != nil {
  5066. return nil, err
  5067. }
  5068. ret := &Policy{
  5069. ServerResponse: googleapi.ServerResponse{
  5070. Header: res.Header,
  5071. HTTPStatusCode: res.StatusCode,
  5072. },
  5073. }
  5074. target := &ret
  5075. if err := gensupport.DecodeResponse(target, res); err != nil {
  5076. return nil, err
  5077. }
  5078. return ret, nil
  5079. // {
  5080. // "description": "Sets the access control policy on an instance resource. Replaces any\nexisting policy.\n\nAuthorization requires `spanner.instances.setIamPolicy` on\nresource.",
  5081. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}:setIamPolicy",
  5082. // "httpMethod": "POST",
  5083. // "id": "spanner.projects.instances.setIamPolicy",
  5084. // "parameterOrder": [
  5085. // "resource"
  5086. // ],
  5087. // "parameters": {
  5088. // "resource": {
  5089. // "description": "REQUIRED: The Cloud Spanner resource for which the policy is being set. The format is `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e` for instance resources and `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e/databases/\u003cdatabase ID\u003e` for databases resources.",
  5090. // "location": "path",
  5091. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  5092. // "required": true,
  5093. // "type": "string"
  5094. // }
  5095. // },
  5096. // "path": "v1/{+resource}:setIamPolicy",
  5097. // "request": {
  5098. // "$ref": "SetIamPolicyRequest"
  5099. // },
  5100. // "response": {
  5101. // "$ref": "Policy"
  5102. // },
  5103. // "scopes": [
  5104. // "https://www.googleapis.com/auth/cloud-platform",
  5105. // "https://www.googleapis.com/auth/spanner.admin"
  5106. // ]
  5107. // }
  5108. }
  5109. // method id "spanner.projects.instances.testIamPermissions":
  5110. type ProjectsInstancesTestIamPermissionsCall struct {
  5111. s *Service
  5112. resource string
  5113. testiampermissionsrequest *TestIamPermissionsRequest
  5114. urlParams_ gensupport.URLParams
  5115. ctx_ context.Context
  5116. header_ http.Header
  5117. }
  5118. // TestIamPermissions: Returns permissions that the caller has on the
  5119. // specified instance resource.
  5120. //
  5121. // Attempting this RPC on a non-existent Cloud Spanner instance resource
  5122. // will
  5123. // result in a NOT_FOUND error if the user has
  5124. // `spanner.instances.list`
  5125. // permission on the containing Google Cloud Project. Otherwise returns
  5126. // an
  5127. // empty set of permissions.
  5128. func (r *ProjectsInstancesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsInstancesTestIamPermissionsCall {
  5129. c := &ProjectsInstancesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5130. c.resource = resource
  5131. c.testiampermissionsrequest = testiampermissionsrequest
  5132. return c
  5133. }
  5134. // Fields allows partial responses to be retrieved. See
  5135. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5136. // for more information.
  5137. func (c *ProjectsInstancesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsInstancesTestIamPermissionsCall {
  5138. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5139. return c
  5140. }
  5141. // Context sets the context to be used in this call's Do method. Any
  5142. // pending HTTP request will be aborted if the provided context is
  5143. // canceled.
  5144. func (c *ProjectsInstancesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsInstancesTestIamPermissionsCall {
  5145. c.ctx_ = ctx
  5146. return c
  5147. }
  5148. // Header returns an http.Header that can be modified by the caller to
  5149. // add HTTP headers to the request.
  5150. func (c *ProjectsInstancesTestIamPermissionsCall) Header() http.Header {
  5151. if c.header_ == nil {
  5152. c.header_ = make(http.Header)
  5153. }
  5154. return c.header_
  5155. }
  5156. func (c *ProjectsInstancesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  5157. reqHeaders := make(http.Header)
  5158. for k, v := range c.header_ {
  5159. reqHeaders[k] = v
  5160. }
  5161. reqHeaders.Set("User-Agent", c.s.userAgent())
  5162. var body io.Reader = nil
  5163. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  5164. if err != nil {
  5165. return nil, err
  5166. }
  5167. reqHeaders.Set("Content-Type", "application/json")
  5168. c.urlParams_.Set("alt", alt)
  5169. c.urlParams_.Set("prettyPrint", "false")
  5170. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  5171. urls += "?" + c.urlParams_.Encode()
  5172. req, err := http.NewRequest("POST", urls, body)
  5173. if err != nil {
  5174. return nil, err
  5175. }
  5176. req.Header = reqHeaders
  5177. googleapi.Expand(req.URL, map[string]string{
  5178. "resource": c.resource,
  5179. })
  5180. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5181. }
  5182. // Do executes the "spanner.projects.instances.testIamPermissions" call.
  5183. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  5184. // Any non-2xx status code is an error. Response headers are in either
  5185. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  5186. // was returned at all) in error.(*googleapi.Error).Header. Use
  5187. // googleapi.IsNotModified to check whether the returned error was
  5188. // because http.StatusNotModified was returned.
  5189. func (c *ProjectsInstancesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  5190. gensupport.SetOptions(c.urlParams_, opts...)
  5191. res, err := c.doRequest("json")
  5192. if res != nil && res.StatusCode == http.StatusNotModified {
  5193. if res.Body != nil {
  5194. res.Body.Close()
  5195. }
  5196. return nil, &googleapi.Error{
  5197. Code: res.StatusCode,
  5198. Header: res.Header,
  5199. }
  5200. }
  5201. if err != nil {
  5202. return nil, err
  5203. }
  5204. defer googleapi.CloseBody(res)
  5205. if err := googleapi.CheckResponse(res); err != nil {
  5206. return nil, err
  5207. }
  5208. ret := &TestIamPermissionsResponse{
  5209. ServerResponse: googleapi.ServerResponse{
  5210. Header: res.Header,
  5211. HTTPStatusCode: res.StatusCode,
  5212. },
  5213. }
  5214. target := &ret
  5215. if err := gensupport.DecodeResponse(target, res); err != nil {
  5216. return nil, err
  5217. }
  5218. return ret, nil
  5219. // {
  5220. // "description": "Returns permissions that the caller has on the specified instance resource.\n\nAttempting this RPC on a non-existent Cloud Spanner instance resource will\nresult in a NOT_FOUND error if the user has `spanner.instances.list`\npermission on the containing Google Cloud Project. Otherwise returns an\nempty set of permissions.",
  5221. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}:testIamPermissions",
  5222. // "httpMethod": "POST",
  5223. // "id": "spanner.projects.instances.testIamPermissions",
  5224. // "parameterOrder": [
  5225. // "resource"
  5226. // ],
  5227. // "parameters": {
  5228. // "resource": {
  5229. // "description": "REQUIRED: The Cloud Spanner resource for which permissions are being tested. The format is `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e` for instance resources and `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e/databases/\u003cdatabase ID\u003e` for database resources.",
  5230. // "location": "path",
  5231. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  5232. // "required": true,
  5233. // "type": "string"
  5234. // }
  5235. // },
  5236. // "path": "v1/{+resource}:testIamPermissions",
  5237. // "request": {
  5238. // "$ref": "TestIamPermissionsRequest"
  5239. // },
  5240. // "response": {
  5241. // "$ref": "TestIamPermissionsResponse"
  5242. // },
  5243. // "scopes": [
  5244. // "https://www.googleapis.com/auth/cloud-platform",
  5245. // "https://www.googleapis.com/auth/spanner.admin"
  5246. // ]
  5247. // }
  5248. }
  5249. // method id "spanner.projects.instances.databases.create":
  5250. type ProjectsInstancesDatabasesCreateCall struct {
  5251. s *Service
  5252. parent string
  5253. createdatabaserequest *CreateDatabaseRequest
  5254. urlParams_ gensupport.URLParams
  5255. ctx_ context.Context
  5256. header_ http.Header
  5257. }
  5258. // Create: Creates a new Cloud Spanner database and starts to prepare it
  5259. // for serving.
  5260. // The returned long-running operation will
  5261. // have a name of the format `<database_name>/operations/<operation_id>`
  5262. // and
  5263. // can be used to track preparation of the database. The
  5264. // metadata field type is
  5265. // CreateDatabaseMetadata. The
  5266. // response field type is
  5267. // Database, if successful.
  5268. func (r *ProjectsInstancesDatabasesService) Create(parent string, createdatabaserequest *CreateDatabaseRequest) *ProjectsInstancesDatabasesCreateCall {
  5269. c := &ProjectsInstancesDatabasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5270. c.parent = parent
  5271. c.createdatabaserequest = createdatabaserequest
  5272. return c
  5273. }
  5274. // Fields allows partial responses to be retrieved. See
  5275. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5276. // for more information.
  5277. func (c *ProjectsInstancesDatabasesCreateCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesCreateCall {
  5278. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5279. return c
  5280. }
  5281. // Context sets the context to be used in this call's Do method. Any
  5282. // pending HTTP request will be aborted if the provided context is
  5283. // canceled.
  5284. func (c *ProjectsInstancesDatabasesCreateCall) Context(ctx context.Context) *ProjectsInstancesDatabasesCreateCall {
  5285. c.ctx_ = ctx
  5286. return c
  5287. }
  5288. // Header returns an http.Header that can be modified by the caller to
  5289. // add HTTP headers to the request.
  5290. func (c *ProjectsInstancesDatabasesCreateCall) Header() http.Header {
  5291. if c.header_ == nil {
  5292. c.header_ = make(http.Header)
  5293. }
  5294. return c.header_
  5295. }
  5296. func (c *ProjectsInstancesDatabasesCreateCall) doRequest(alt string) (*http.Response, error) {
  5297. reqHeaders := make(http.Header)
  5298. for k, v := range c.header_ {
  5299. reqHeaders[k] = v
  5300. }
  5301. reqHeaders.Set("User-Agent", c.s.userAgent())
  5302. var body io.Reader = nil
  5303. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createdatabaserequest)
  5304. if err != nil {
  5305. return nil, err
  5306. }
  5307. reqHeaders.Set("Content-Type", "application/json")
  5308. c.urlParams_.Set("alt", alt)
  5309. c.urlParams_.Set("prettyPrint", "false")
  5310. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/databases")
  5311. urls += "?" + c.urlParams_.Encode()
  5312. req, err := http.NewRequest("POST", urls, body)
  5313. if err != nil {
  5314. return nil, err
  5315. }
  5316. req.Header = reqHeaders
  5317. googleapi.Expand(req.URL, map[string]string{
  5318. "parent": c.parent,
  5319. })
  5320. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5321. }
  5322. // Do executes the "spanner.projects.instances.databases.create" call.
  5323. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  5324. // status code is an error. Response headers are in either
  5325. // *Operation.ServerResponse.Header or (if a response was returned at
  5326. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5327. // to check whether the returned error was because
  5328. // http.StatusNotModified was returned.
  5329. func (c *ProjectsInstancesDatabasesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  5330. gensupport.SetOptions(c.urlParams_, opts...)
  5331. res, err := c.doRequest("json")
  5332. if res != nil && res.StatusCode == http.StatusNotModified {
  5333. if res.Body != nil {
  5334. res.Body.Close()
  5335. }
  5336. return nil, &googleapi.Error{
  5337. Code: res.StatusCode,
  5338. Header: res.Header,
  5339. }
  5340. }
  5341. if err != nil {
  5342. return nil, err
  5343. }
  5344. defer googleapi.CloseBody(res)
  5345. if err := googleapi.CheckResponse(res); err != nil {
  5346. return nil, err
  5347. }
  5348. ret := &Operation{
  5349. ServerResponse: googleapi.ServerResponse{
  5350. Header: res.Header,
  5351. HTTPStatusCode: res.StatusCode,
  5352. },
  5353. }
  5354. target := &ret
  5355. if err := gensupport.DecodeResponse(target, res); err != nil {
  5356. return nil, err
  5357. }
  5358. return ret, nil
  5359. // {
  5360. // "description": "Creates a new Cloud Spanner database and starts to prepare it for serving.\nThe returned long-running operation will\nhave a name of the format `\u003cdatabase_name\u003e/operations/\u003coperation_id\u003e` and\ncan be used to track preparation of the database. The\nmetadata field type is\nCreateDatabaseMetadata. The\nresponse field type is\nDatabase, if successful.",
  5361. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases",
  5362. // "httpMethod": "POST",
  5363. // "id": "spanner.projects.instances.databases.create",
  5364. // "parameterOrder": [
  5365. // "parent"
  5366. // ],
  5367. // "parameters": {
  5368. // "parent": {
  5369. // "description": "Required. The name of the instance that will serve the new database.\nValues are of the form `projects/\u003cproject\u003e/instances/\u003cinstance\u003e`.",
  5370. // "location": "path",
  5371. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  5372. // "required": true,
  5373. // "type": "string"
  5374. // }
  5375. // },
  5376. // "path": "v1/{+parent}/databases",
  5377. // "request": {
  5378. // "$ref": "CreateDatabaseRequest"
  5379. // },
  5380. // "response": {
  5381. // "$ref": "Operation"
  5382. // },
  5383. // "scopes": [
  5384. // "https://www.googleapis.com/auth/cloud-platform",
  5385. // "https://www.googleapis.com/auth/spanner.admin"
  5386. // ]
  5387. // }
  5388. }
  5389. // method id "spanner.projects.instances.databases.dropDatabase":
  5390. type ProjectsInstancesDatabasesDropDatabaseCall struct {
  5391. s *Service
  5392. database string
  5393. urlParams_ gensupport.URLParams
  5394. ctx_ context.Context
  5395. header_ http.Header
  5396. }
  5397. // DropDatabase: Drops (aka deletes) a Cloud Spanner database.
  5398. func (r *ProjectsInstancesDatabasesService) DropDatabase(database string) *ProjectsInstancesDatabasesDropDatabaseCall {
  5399. c := &ProjectsInstancesDatabasesDropDatabaseCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5400. c.database = database
  5401. return c
  5402. }
  5403. // Fields allows partial responses to be retrieved. See
  5404. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5405. // for more information.
  5406. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesDropDatabaseCall {
  5407. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5408. return c
  5409. }
  5410. // Context sets the context to be used in this call's Do method. Any
  5411. // pending HTTP request will be aborted if the provided context is
  5412. // canceled.
  5413. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Context(ctx context.Context) *ProjectsInstancesDatabasesDropDatabaseCall {
  5414. c.ctx_ = ctx
  5415. return c
  5416. }
  5417. // Header returns an http.Header that can be modified by the caller to
  5418. // add HTTP headers to the request.
  5419. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Header() http.Header {
  5420. if c.header_ == nil {
  5421. c.header_ = make(http.Header)
  5422. }
  5423. return c.header_
  5424. }
  5425. func (c *ProjectsInstancesDatabasesDropDatabaseCall) doRequest(alt string) (*http.Response, error) {
  5426. reqHeaders := make(http.Header)
  5427. for k, v := range c.header_ {
  5428. reqHeaders[k] = v
  5429. }
  5430. reqHeaders.Set("User-Agent", c.s.userAgent())
  5431. var body io.Reader = nil
  5432. c.urlParams_.Set("alt", alt)
  5433. c.urlParams_.Set("prettyPrint", "false")
  5434. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}")
  5435. urls += "?" + c.urlParams_.Encode()
  5436. req, err := http.NewRequest("DELETE", urls, body)
  5437. if err != nil {
  5438. return nil, err
  5439. }
  5440. req.Header = reqHeaders
  5441. googleapi.Expand(req.URL, map[string]string{
  5442. "database": c.database,
  5443. })
  5444. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5445. }
  5446. // Do executes the "spanner.projects.instances.databases.dropDatabase" call.
  5447. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5448. // code is an error. Response headers are in either
  5449. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5450. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5451. // check whether the returned error was because http.StatusNotModified
  5452. // was returned.
  5453. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5454. gensupport.SetOptions(c.urlParams_, opts...)
  5455. res, err := c.doRequest("json")
  5456. if res != nil && res.StatusCode == http.StatusNotModified {
  5457. if res.Body != nil {
  5458. res.Body.Close()
  5459. }
  5460. return nil, &googleapi.Error{
  5461. Code: res.StatusCode,
  5462. Header: res.Header,
  5463. }
  5464. }
  5465. if err != nil {
  5466. return nil, err
  5467. }
  5468. defer googleapi.CloseBody(res)
  5469. if err := googleapi.CheckResponse(res); err != nil {
  5470. return nil, err
  5471. }
  5472. ret := &Empty{
  5473. ServerResponse: googleapi.ServerResponse{
  5474. Header: res.Header,
  5475. HTTPStatusCode: res.StatusCode,
  5476. },
  5477. }
  5478. target := &ret
  5479. if err := gensupport.DecodeResponse(target, res); err != nil {
  5480. return nil, err
  5481. }
  5482. return ret, nil
  5483. // {
  5484. // "description": "Drops (aka deletes) a Cloud Spanner database.",
  5485. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}",
  5486. // "httpMethod": "DELETE",
  5487. // "id": "spanner.projects.instances.databases.dropDatabase",
  5488. // "parameterOrder": [
  5489. // "database"
  5490. // ],
  5491. // "parameters": {
  5492. // "database": {
  5493. // "description": "Required. The database to be dropped.",
  5494. // "location": "path",
  5495. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5496. // "required": true,
  5497. // "type": "string"
  5498. // }
  5499. // },
  5500. // "path": "v1/{+database}",
  5501. // "response": {
  5502. // "$ref": "Empty"
  5503. // },
  5504. // "scopes": [
  5505. // "https://www.googleapis.com/auth/cloud-platform",
  5506. // "https://www.googleapis.com/auth/spanner.admin"
  5507. // ]
  5508. // }
  5509. }
  5510. // method id "spanner.projects.instances.databases.get":
  5511. type ProjectsInstancesDatabasesGetCall struct {
  5512. s *Service
  5513. name string
  5514. urlParams_ gensupport.URLParams
  5515. ifNoneMatch_ string
  5516. ctx_ context.Context
  5517. header_ http.Header
  5518. }
  5519. // Get: Gets the state of a Cloud Spanner database.
  5520. func (r *ProjectsInstancesDatabasesService) Get(name string) *ProjectsInstancesDatabasesGetCall {
  5521. c := &ProjectsInstancesDatabasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5522. c.name = name
  5523. return c
  5524. }
  5525. // Fields allows partial responses to be retrieved. See
  5526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5527. // for more information.
  5528. func (c *ProjectsInstancesDatabasesGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesGetCall {
  5529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5530. return c
  5531. }
  5532. // IfNoneMatch sets the optional parameter which makes the operation
  5533. // fail if the object's ETag matches the given value. This is useful for
  5534. // getting updates only after the object has changed since the last
  5535. // request. Use googleapi.IsNotModified to check whether the response
  5536. // error from Do is the result of In-None-Match.
  5537. func (c *ProjectsInstancesDatabasesGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesGetCall {
  5538. c.ifNoneMatch_ = entityTag
  5539. return c
  5540. }
  5541. // Context sets the context to be used in this call's Do method. Any
  5542. // pending HTTP request will be aborted if the provided context is
  5543. // canceled.
  5544. func (c *ProjectsInstancesDatabasesGetCall) Context(ctx context.Context) *ProjectsInstancesDatabasesGetCall {
  5545. c.ctx_ = ctx
  5546. return c
  5547. }
  5548. // Header returns an http.Header that can be modified by the caller to
  5549. // add HTTP headers to the request.
  5550. func (c *ProjectsInstancesDatabasesGetCall) Header() http.Header {
  5551. if c.header_ == nil {
  5552. c.header_ = make(http.Header)
  5553. }
  5554. return c.header_
  5555. }
  5556. func (c *ProjectsInstancesDatabasesGetCall) doRequest(alt string) (*http.Response, error) {
  5557. reqHeaders := make(http.Header)
  5558. for k, v := range c.header_ {
  5559. reqHeaders[k] = v
  5560. }
  5561. reqHeaders.Set("User-Agent", c.s.userAgent())
  5562. if c.ifNoneMatch_ != "" {
  5563. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5564. }
  5565. var body io.Reader = nil
  5566. c.urlParams_.Set("alt", alt)
  5567. c.urlParams_.Set("prettyPrint", "false")
  5568. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5569. urls += "?" + c.urlParams_.Encode()
  5570. req, err := http.NewRequest("GET", urls, body)
  5571. if err != nil {
  5572. return nil, err
  5573. }
  5574. req.Header = reqHeaders
  5575. googleapi.Expand(req.URL, map[string]string{
  5576. "name": c.name,
  5577. })
  5578. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5579. }
  5580. // Do executes the "spanner.projects.instances.databases.get" call.
  5581. // Exactly one of *Database or error will be non-nil. Any non-2xx status
  5582. // code is an error. Response headers are in either
  5583. // *Database.ServerResponse.Header or (if a response was returned at
  5584. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5585. // to check whether the returned error was because
  5586. // http.StatusNotModified was returned.
  5587. func (c *ProjectsInstancesDatabasesGetCall) Do(opts ...googleapi.CallOption) (*Database, error) {
  5588. gensupport.SetOptions(c.urlParams_, opts...)
  5589. res, err := c.doRequest("json")
  5590. if res != nil && res.StatusCode == http.StatusNotModified {
  5591. if res.Body != nil {
  5592. res.Body.Close()
  5593. }
  5594. return nil, &googleapi.Error{
  5595. Code: res.StatusCode,
  5596. Header: res.Header,
  5597. }
  5598. }
  5599. if err != nil {
  5600. return nil, err
  5601. }
  5602. defer googleapi.CloseBody(res)
  5603. if err := googleapi.CheckResponse(res); err != nil {
  5604. return nil, err
  5605. }
  5606. ret := &Database{
  5607. ServerResponse: googleapi.ServerResponse{
  5608. Header: res.Header,
  5609. HTTPStatusCode: res.StatusCode,
  5610. },
  5611. }
  5612. target := &ret
  5613. if err := gensupport.DecodeResponse(target, res); err != nil {
  5614. return nil, err
  5615. }
  5616. return ret, nil
  5617. // {
  5618. // "description": "Gets the state of a Cloud Spanner database.",
  5619. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}",
  5620. // "httpMethod": "GET",
  5621. // "id": "spanner.projects.instances.databases.get",
  5622. // "parameterOrder": [
  5623. // "name"
  5624. // ],
  5625. // "parameters": {
  5626. // "name": {
  5627. // "description": "Required. The name of the requested database. Values are of the form\n`projects/\u003cproject\u003e/instances/\u003cinstance\u003e/databases/\u003cdatabase\u003e`.",
  5628. // "location": "path",
  5629. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5630. // "required": true,
  5631. // "type": "string"
  5632. // }
  5633. // },
  5634. // "path": "v1/{+name}",
  5635. // "response": {
  5636. // "$ref": "Database"
  5637. // },
  5638. // "scopes": [
  5639. // "https://www.googleapis.com/auth/cloud-platform",
  5640. // "https://www.googleapis.com/auth/spanner.admin"
  5641. // ]
  5642. // }
  5643. }
  5644. // method id "spanner.projects.instances.databases.getDdl":
  5645. type ProjectsInstancesDatabasesGetDdlCall struct {
  5646. s *Service
  5647. database string
  5648. urlParams_ gensupport.URLParams
  5649. ifNoneMatch_ string
  5650. ctx_ context.Context
  5651. header_ http.Header
  5652. }
  5653. // GetDdl: Returns the schema of a Cloud Spanner database as a list of
  5654. // formatted
  5655. // DDL statements. This method does not show pending schema updates,
  5656. // those may
  5657. // be queried using the Operations API.
  5658. func (r *ProjectsInstancesDatabasesService) GetDdl(database string) *ProjectsInstancesDatabasesGetDdlCall {
  5659. c := &ProjectsInstancesDatabasesGetDdlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5660. c.database = database
  5661. return c
  5662. }
  5663. // Fields allows partial responses to be retrieved. See
  5664. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5665. // for more information.
  5666. func (c *ProjectsInstancesDatabasesGetDdlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesGetDdlCall {
  5667. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5668. return c
  5669. }
  5670. // IfNoneMatch sets the optional parameter which makes the operation
  5671. // fail if the object's ETag matches the given value. This is useful for
  5672. // getting updates only after the object has changed since the last
  5673. // request. Use googleapi.IsNotModified to check whether the response
  5674. // error from Do is the result of In-None-Match.
  5675. func (c *ProjectsInstancesDatabasesGetDdlCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesGetDdlCall {
  5676. c.ifNoneMatch_ = entityTag
  5677. return c
  5678. }
  5679. // Context sets the context to be used in this call's Do method. Any
  5680. // pending HTTP request will be aborted if the provided context is
  5681. // canceled.
  5682. func (c *ProjectsInstancesDatabasesGetDdlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesGetDdlCall {
  5683. c.ctx_ = ctx
  5684. return c
  5685. }
  5686. // Header returns an http.Header that can be modified by the caller to
  5687. // add HTTP headers to the request.
  5688. func (c *ProjectsInstancesDatabasesGetDdlCall) Header() http.Header {
  5689. if c.header_ == nil {
  5690. c.header_ = make(http.Header)
  5691. }
  5692. return c.header_
  5693. }
  5694. func (c *ProjectsInstancesDatabasesGetDdlCall) doRequest(alt string) (*http.Response, error) {
  5695. reqHeaders := make(http.Header)
  5696. for k, v := range c.header_ {
  5697. reqHeaders[k] = v
  5698. }
  5699. reqHeaders.Set("User-Agent", c.s.userAgent())
  5700. if c.ifNoneMatch_ != "" {
  5701. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5702. }
  5703. var body io.Reader = nil
  5704. c.urlParams_.Set("alt", alt)
  5705. c.urlParams_.Set("prettyPrint", "false")
  5706. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/ddl")
  5707. urls += "?" + c.urlParams_.Encode()
  5708. req, err := http.NewRequest("GET", urls, body)
  5709. if err != nil {
  5710. return nil, err
  5711. }
  5712. req.Header = reqHeaders
  5713. googleapi.Expand(req.URL, map[string]string{
  5714. "database": c.database,
  5715. })
  5716. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5717. }
  5718. // Do executes the "spanner.projects.instances.databases.getDdl" call.
  5719. // Exactly one of *GetDatabaseDdlResponse or error will be non-nil. Any
  5720. // non-2xx status code is an error. Response headers are in either
  5721. // *GetDatabaseDdlResponse.ServerResponse.Header or (if a response was
  5722. // returned at all) in error.(*googleapi.Error).Header. Use
  5723. // googleapi.IsNotModified to check whether the returned error was
  5724. // because http.StatusNotModified was returned.
  5725. func (c *ProjectsInstancesDatabasesGetDdlCall) Do(opts ...googleapi.CallOption) (*GetDatabaseDdlResponse, error) {
  5726. gensupport.SetOptions(c.urlParams_, opts...)
  5727. res, err := c.doRequest("json")
  5728. if res != nil && res.StatusCode == http.StatusNotModified {
  5729. if res.Body != nil {
  5730. res.Body.Close()
  5731. }
  5732. return nil, &googleapi.Error{
  5733. Code: res.StatusCode,
  5734. Header: res.Header,
  5735. }
  5736. }
  5737. if err != nil {
  5738. return nil, err
  5739. }
  5740. defer googleapi.CloseBody(res)
  5741. if err := googleapi.CheckResponse(res); err != nil {
  5742. return nil, err
  5743. }
  5744. ret := &GetDatabaseDdlResponse{
  5745. ServerResponse: googleapi.ServerResponse{
  5746. Header: res.Header,
  5747. HTTPStatusCode: res.StatusCode,
  5748. },
  5749. }
  5750. target := &ret
  5751. if err := gensupport.DecodeResponse(target, res); err != nil {
  5752. return nil, err
  5753. }
  5754. return ret, nil
  5755. // {
  5756. // "description": "Returns the schema of a Cloud Spanner database as a list of formatted\nDDL statements. This method does not show pending schema updates, those may\nbe queried using the Operations API.",
  5757. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/ddl",
  5758. // "httpMethod": "GET",
  5759. // "id": "spanner.projects.instances.databases.getDdl",
  5760. // "parameterOrder": [
  5761. // "database"
  5762. // ],
  5763. // "parameters": {
  5764. // "database": {
  5765. // "description": "Required. The database whose schema we wish to get.",
  5766. // "location": "path",
  5767. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5768. // "required": true,
  5769. // "type": "string"
  5770. // }
  5771. // },
  5772. // "path": "v1/{+database}/ddl",
  5773. // "response": {
  5774. // "$ref": "GetDatabaseDdlResponse"
  5775. // },
  5776. // "scopes": [
  5777. // "https://www.googleapis.com/auth/cloud-platform",
  5778. // "https://www.googleapis.com/auth/spanner.admin"
  5779. // ]
  5780. // }
  5781. }
  5782. // method id "spanner.projects.instances.databases.getIamPolicy":
  5783. type ProjectsInstancesDatabasesGetIamPolicyCall struct {
  5784. s *Service
  5785. resource string
  5786. getiampolicyrequest *GetIamPolicyRequest
  5787. urlParams_ gensupport.URLParams
  5788. ctx_ context.Context
  5789. header_ http.Header
  5790. }
  5791. // GetIamPolicy: Gets the access control policy for a database
  5792. // resource.
  5793. // Returns an empty policy if a database exists but does
  5794. // not have a policy set.
  5795. //
  5796. // Authorization requires `spanner.databases.getIamPolicy` permission
  5797. // on
  5798. // resource.
  5799. func (r *ProjectsInstancesDatabasesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsInstancesDatabasesGetIamPolicyCall {
  5800. c := &ProjectsInstancesDatabasesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5801. c.resource = resource
  5802. c.getiampolicyrequest = getiampolicyrequest
  5803. return c
  5804. }
  5805. // Fields allows partial responses to be retrieved. See
  5806. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5807. // for more information.
  5808. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesGetIamPolicyCall {
  5809. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5810. return c
  5811. }
  5812. // Context sets the context to be used in this call's Do method. Any
  5813. // pending HTTP request will be aborted if the provided context is
  5814. // canceled.
  5815. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesDatabasesGetIamPolicyCall {
  5816. c.ctx_ = ctx
  5817. return c
  5818. }
  5819. // Header returns an http.Header that can be modified by the caller to
  5820. // add HTTP headers to the request.
  5821. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Header() http.Header {
  5822. if c.header_ == nil {
  5823. c.header_ = make(http.Header)
  5824. }
  5825. return c.header_
  5826. }
  5827. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5828. reqHeaders := make(http.Header)
  5829. for k, v := range c.header_ {
  5830. reqHeaders[k] = v
  5831. }
  5832. reqHeaders.Set("User-Agent", c.s.userAgent())
  5833. var body io.Reader = nil
  5834. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  5835. if err != nil {
  5836. return nil, err
  5837. }
  5838. reqHeaders.Set("Content-Type", "application/json")
  5839. c.urlParams_.Set("alt", alt)
  5840. c.urlParams_.Set("prettyPrint", "false")
  5841. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  5842. urls += "?" + c.urlParams_.Encode()
  5843. req, err := http.NewRequest("POST", urls, body)
  5844. if err != nil {
  5845. return nil, err
  5846. }
  5847. req.Header = reqHeaders
  5848. googleapi.Expand(req.URL, map[string]string{
  5849. "resource": c.resource,
  5850. })
  5851. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5852. }
  5853. // Do executes the "spanner.projects.instances.databases.getIamPolicy" call.
  5854. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5855. // code is an error. Response headers are in either
  5856. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5857. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5858. // check whether the returned error was because http.StatusNotModified
  5859. // was returned.
  5860. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5861. gensupport.SetOptions(c.urlParams_, opts...)
  5862. res, err := c.doRequest("json")
  5863. if res != nil && res.StatusCode == http.StatusNotModified {
  5864. if res.Body != nil {
  5865. res.Body.Close()
  5866. }
  5867. return nil, &googleapi.Error{
  5868. Code: res.StatusCode,
  5869. Header: res.Header,
  5870. }
  5871. }
  5872. if err != nil {
  5873. return nil, err
  5874. }
  5875. defer googleapi.CloseBody(res)
  5876. if err := googleapi.CheckResponse(res); err != nil {
  5877. return nil, err
  5878. }
  5879. ret := &Policy{
  5880. ServerResponse: googleapi.ServerResponse{
  5881. Header: res.Header,
  5882. HTTPStatusCode: res.StatusCode,
  5883. },
  5884. }
  5885. target := &ret
  5886. if err := gensupport.DecodeResponse(target, res); err != nil {
  5887. return nil, err
  5888. }
  5889. return ret, nil
  5890. // {
  5891. // "description": "Gets the access control policy for a database resource.\nReturns an empty policy if a database exists but does\nnot have a policy set.\n\nAuthorization requires `spanner.databases.getIamPolicy` permission on\nresource.",
  5892. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}:getIamPolicy",
  5893. // "httpMethod": "POST",
  5894. // "id": "spanner.projects.instances.databases.getIamPolicy",
  5895. // "parameterOrder": [
  5896. // "resource"
  5897. // ],
  5898. // "parameters": {
  5899. // "resource": {
  5900. // "description": "REQUIRED: The Cloud Spanner resource for which the policy is being retrieved. The format is `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e` for instance resources and `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e/databases/\u003cdatabase ID\u003e` for database resources.",
  5901. // "location": "path",
  5902. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5903. // "required": true,
  5904. // "type": "string"
  5905. // }
  5906. // },
  5907. // "path": "v1/{+resource}:getIamPolicy",
  5908. // "request": {
  5909. // "$ref": "GetIamPolicyRequest"
  5910. // },
  5911. // "response": {
  5912. // "$ref": "Policy"
  5913. // },
  5914. // "scopes": [
  5915. // "https://www.googleapis.com/auth/cloud-platform",
  5916. // "https://www.googleapis.com/auth/spanner.admin"
  5917. // ]
  5918. // }
  5919. }
  5920. // method id "spanner.projects.instances.databases.list":
  5921. type ProjectsInstancesDatabasesListCall struct {
  5922. s *Service
  5923. parent string
  5924. urlParams_ gensupport.URLParams
  5925. ifNoneMatch_ string
  5926. ctx_ context.Context
  5927. header_ http.Header
  5928. }
  5929. // List: Lists Cloud Spanner databases.
  5930. func (r *ProjectsInstancesDatabasesService) List(parent string) *ProjectsInstancesDatabasesListCall {
  5931. c := &ProjectsInstancesDatabasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5932. c.parent = parent
  5933. return c
  5934. }
  5935. // PageSize sets the optional parameter "pageSize": Number of databases
  5936. // to be returned in the response. If 0 or less,
  5937. // defaults to the server's maximum allowed page size.
  5938. func (c *ProjectsInstancesDatabasesListCall) PageSize(pageSize int64) *ProjectsInstancesDatabasesListCall {
  5939. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5940. return c
  5941. }
  5942. // PageToken sets the optional parameter "pageToken": If non-empty,
  5943. // `page_token` should contain a
  5944. // next_page_token from a
  5945. // previous ListDatabasesResponse.
  5946. func (c *ProjectsInstancesDatabasesListCall) PageToken(pageToken string) *ProjectsInstancesDatabasesListCall {
  5947. c.urlParams_.Set("pageToken", pageToken)
  5948. return c
  5949. }
  5950. // Fields allows partial responses to be retrieved. See
  5951. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5952. // for more information.
  5953. func (c *ProjectsInstancesDatabasesListCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesListCall {
  5954. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5955. return c
  5956. }
  5957. // IfNoneMatch sets the optional parameter which makes the operation
  5958. // fail if the object's ETag matches the given value. This is useful for
  5959. // getting updates only after the object has changed since the last
  5960. // request. Use googleapi.IsNotModified to check whether the response
  5961. // error from Do is the result of In-None-Match.
  5962. func (c *ProjectsInstancesDatabasesListCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesListCall {
  5963. c.ifNoneMatch_ = entityTag
  5964. return c
  5965. }
  5966. // Context sets the context to be used in this call's Do method. Any
  5967. // pending HTTP request will be aborted if the provided context is
  5968. // canceled.
  5969. func (c *ProjectsInstancesDatabasesListCall) Context(ctx context.Context) *ProjectsInstancesDatabasesListCall {
  5970. c.ctx_ = ctx
  5971. return c
  5972. }
  5973. // Header returns an http.Header that can be modified by the caller to
  5974. // add HTTP headers to the request.
  5975. func (c *ProjectsInstancesDatabasesListCall) Header() http.Header {
  5976. if c.header_ == nil {
  5977. c.header_ = make(http.Header)
  5978. }
  5979. return c.header_
  5980. }
  5981. func (c *ProjectsInstancesDatabasesListCall) doRequest(alt string) (*http.Response, error) {
  5982. reqHeaders := make(http.Header)
  5983. for k, v := range c.header_ {
  5984. reqHeaders[k] = v
  5985. }
  5986. reqHeaders.Set("User-Agent", c.s.userAgent())
  5987. if c.ifNoneMatch_ != "" {
  5988. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5989. }
  5990. var body io.Reader = nil
  5991. c.urlParams_.Set("alt", alt)
  5992. c.urlParams_.Set("prettyPrint", "false")
  5993. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/databases")
  5994. urls += "?" + c.urlParams_.Encode()
  5995. req, err := http.NewRequest("GET", urls, body)
  5996. if err != nil {
  5997. return nil, err
  5998. }
  5999. req.Header = reqHeaders
  6000. googleapi.Expand(req.URL, map[string]string{
  6001. "parent": c.parent,
  6002. })
  6003. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6004. }
  6005. // Do executes the "spanner.projects.instances.databases.list" call.
  6006. // Exactly one of *ListDatabasesResponse or error will be non-nil. Any
  6007. // non-2xx status code is an error. Response headers are in either
  6008. // *ListDatabasesResponse.ServerResponse.Header or (if a response was
  6009. // returned at all) in error.(*googleapi.Error).Header. Use
  6010. // googleapi.IsNotModified to check whether the returned error was
  6011. // because http.StatusNotModified was returned.
  6012. func (c *ProjectsInstancesDatabasesListCall) Do(opts ...googleapi.CallOption) (*ListDatabasesResponse, error) {
  6013. gensupport.SetOptions(c.urlParams_, opts...)
  6014. res, err := c.doRequest("json")
  6015. if res != nil && res.StatusCode == http.StatusNotModified {
  6016. if res.Body != nil {
  6017. res.Body.Close()
  6018. }
  6019. return nil, &googleapi.Error{
  6020. Code: res.StatusCode,
  6021. Header: res.Header,
  6022. }
  6023. }
  6024. if err != nil {
  6025. return nil, err
  6026. }
  6027. defer googleapi.CloseBody(res)
  6028. if err := googleapi.CheckResponse(res); err != nil {
  6029. return nil, err
  6030. }
  6031. ret := &ListDatabasesResponse{
  6032. ServerResponse: googleapi.ServerResponse{
  6033. Header: res.Header,
  6034. HTTPStatusCode: res.StatusCode,
  6035. },
  6036. }
  6037. target := &ret
  6038. if err := gensupport.DecodeResponse(target, res); err != nil {
  6039. return nil, err
  6040. }
  6041. return ret, nil
  6042. // {
  6043. // "description": "Lists Cloud Spanner databases.",
  6044. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases",
  6045. // "httpMethod": "GET",
  6046. // "id": "spanner.projects.instances.databases.list",
  6047. // "parameterOrder": [
  6048. // "parent"
  6049. // ],
  6050. // "parameters": {
  6051. // "pageSize": {
  6052. // "description": "Number of databases to be returned in the response. If 0 or less,\ndefaults to the server's maximum allowed page size.",
  6053. // "format": "int32",
  6054. // "location": "query",
  6055. // "type": "integer"
  6056. // },
  6057. // "pageToken": {
  6058. // "description": "If non-empty, `page_token` should contain a\nnext_page_token from a\nprevious ListDatabasesResponse.",
  6059. // "location": "query",
  6060. // "type": "string"
  6061. // },
  6062. // "parent": {
  6063. // "description": "Required. The instance whose databases should be listed.\nValues are of the form `projects/\u003cproject\u003e/instances/\u003cinstance\u003e`.",
  6064. // "location": "path",
  6065. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  6066. // "required": true,
  6067. // "type": "string"
  6068. // }
  6069. // },
  6070. // "path": "v1/{+parent}/databases",
  6071. // "response": {
  6072. // "$ref": "ListDatabasesResponse"
  6073. // },
  6074. // "scopes": [
  6075. // "https://www.googleapis.com/auth/cloud-platform",
  6076. // "https://www.googleapis.com/auth/spanner.admin"
  6077. // ]
  6078. // }
  6079. }
  6080. // Pages invokes f for each page of results.
  6081. // A non-nil error returned from f will halt the iteration.
  6082. // The provided context supersedes any context provided to the Context method.
  6083. func (c *ProjectsInstancesDatabasesListCall) Pages(ctx context.Context, f func(*ListDatabasesResponse) error) error {
  6084. c.ctx_ = ctx
  6085. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6086. for {
  6087. x, err := c.Do()
  6088. if err != nil {
  6089. return err
  6090. }
  6091. if err := f(x); err != nil {
  6092. return err
  6093. }
  6094. if x.NextPageToken == "" {
  6095. return nil
  6096. }
  6097. c.PageToken(x.NextPageToken)
  6098. }
  6099. }
  6100. // method id "spanner.projects.instances.databases.setIamPolicy":
  6101. type ProjectsInstancesDatabasesSetIamPolicyCall struct {
  6102. s *Service
  6103. resource string
  6104. setiampolicyrequest *SetIamPolicyRequest
  6105. urlParams_ gensupport.URLParams
  6106. ctx_ context.Context
  6107. header_ http.Header
  6108. }
  6109. // SetIamPolicy: Sets the access control policy on a database
  6110. // resource.
  6111. // Replaces any existing policy.
  6112. //
  6113. // Authorization requires `spanner.databases.setIamPolicy`
  6114. // permission on resource.
  6115. func (r *ProjectsInstancesDatabasesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsInstancesDatabasesSetIamPolicyCall {
  6116. c := &ProjectsInstancesDatabasesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6117. c.resource = resource
  6118. c.setiampolicyrequest = setiampolicyrequest
  6119. return c
  6120. }
  6121. // Fields allows partial responses to be retrieved. See
  6122. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6123. // for more information.
  6124. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSetIamPolicyCall {
  6125. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6126. return c
  6127. }
  6128. // Context sets the context to be used in this call's Do method. Any
  6129. // pending HTTP request will be aborted if the provided context is
  6130. // canceled.
  6131. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSetIamPolicyCall {
  6132. c.ctx_ = ctx
  6133. return c
  6134. }
  6135. // Header returns an http.Header that can be modified by the caller to
  6136. // add HTTP headers to the request.
  6137. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Header() http.Header {
  6138. if c.header_ == nil {
  6139. c.header_ = make(http.Header)
  6140. }
  6141. return c.header_
  6142. }
  6143. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  6144. reqHeaders := make(http.Header)
  6145. for k, v := range c.header_ {
  6146. reqHeaders[k] = v
  6147. }
  6148. reqHeaders.Set("User-Agent", c.s.userAgent())
  6149. var body io.Reader = nil
  6150. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  6151. if err != nil {
  6152. return nil, err
  6153. }
  6154. reqHeaders.Set("Content-Type", "application/json")
  6155. c.urlParams_.Set("alt", alt)
  6156. c.urlParams_.Set("prettyPrint", "false")
  6157. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  6158. urls += "?" + c.urlParams_.Encode()
  6159. req, err := http.NewRequest("POST", urls, body)
  6160. if err != nil {
  6161. return nil, err
  6162. }
  6163. req.Header = reqHeaders
  6164. googleapi.Expand(req.URL, map[string]string{
  6165. "resource": c.resource,
  6166. })
  6167. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6168. }
  6169. // Do executes the "spanner.projects.instances.databases.setIamPolicy" call.
  6170. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  6171. // code is an error. Response headers are in either
  6172. // *Policy.ServerResponse.Header or (if a response was returned at all)
  6173. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6174. // check whether the returned error was because http.StatusNotModified
  6175. // was returned.
  6176. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  6177. gensupport.SetOptions(c.urlParams_, opts...)
  6178. res, err := c.doRequest("json")
  6179. if res != nil && res.StatusCode == http.StatusNotModified {
  6180. if res.Body != nil {
  6181. res.Body.Close()
  6182. }
  6183. return nil, &googleapi.Error{
  6184. Code: res.StatusCode,
  6185. Header: res.Header,
  6186. }
  6187. }
  6188. if err != nil {
  6189. return nil, err
  6190. }
  6191. defer googleapi.CloseBody(res)
  6192. if err := googleapi.CheckResponse(res); err != nil {
  6193. return nil, err
  6194. }
  6195. ret := &Policy{
  6196. ServerResponse: googleapi.ServerResponse{
  6197. Header: res.Header,
  6198. HTTPStatusCode: res.StatusCode,
  6199. },
  6200. }
  6201. target := &ret
  6202. if err := gensupport.DecodeResponse(target, res); err != nil {
  6203. return nil, err
  6204. }
  6205. return ret, nil
  6206. // {
  6207. // "description": "Sets the access control policy on a database resource.\nReplaces any existing policy.\n\nAuthorization requires `spanner.databases.setIamPolicy`\npermission on resource.",
  6208. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}:setIamPolicy",
  6209. // "httpMethod": "POST",
  6210. // "id": "spanner.projects.instances.databases.setIamPolicy",
  6211. // "parameterOrder": [
  6212. // "resource"
  6213. // ],
  6214. // "parameters": {
  6215. // "resource": {
  6216. // "description": "REQUIRED: The Cloud Spanner resource for which the policy is being set. The format is `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e` for instance resources and `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e/databases/\u003cdatabase ID\u003e` for databases resources.",
  6217. // "location": "path",
  6218. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  6219. // "required": true,
  6220. // "type": "string"
  6221. // }
  6222. // },
  6223. // "path": "v1/{+resource}:setIamPolicy",
  6224. // "request": {
  6225. // "$ref": "SetIamPolicyRequest"
  6226. // },
  6227. // "response": {
  6228. // "$ref": "Policy"
  6229. // },
  6230. // "scopes": [
  6231. // "https://www.googleapis.com/auth/cloud-platform",
  6232. // "https://www.googleapis.com/auth/spanner.admin"
  6233. // ]
  6234. // }
  6235. }
  6236. // method id "spanner.projects.instances.databases.testIamPermissions":
  6237. type ProjectsInstancesDatabasesTestIamPermissionsCall struct {
  6238. s *Service
  6239. resource string
  6240. testiampermissionsrequest *TestIamPermissionsRequest
  6241. urlParams_ gensupport.URLParams
  6242. ctx_ context.Context
  6243. header_ http.Header
  6244. }
  6245. // TestIamPermissions: Returns permissions that the caller has on the
  6246. // specified database resource.
  6247. //
  6248. // Attempting this RPC on a non-existent Cloud Spanner database
  6249. // will
  6250. // result in a NOT_FOUND error if the user has
  6251. // `spanner.databases.list` permission on the containing Cloud
  6252. // Spanner instance. Otherwise returns an empty set of permissions.
  6253. func (r *ProjectsInstancesDatabasesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsInstancesDatabasesTestIamPermissionsCall {
  6254. c := &ProjectsInstancesDatabasesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6255. c.resource = resource
  6256. c.testiampermissionsrequest = testiampermissionsrequest
  6257. return c
  6258. }
  6259. // Fields allows partial responses to be retrieved. See
  6260. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6261. // for more information.
  6262. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesTestIamPermissionsCall {
  6263. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6264. return c
  6265. }
  6266. // Context sets the context to be used in this call's Do method. Any
  6267. // pending HTTP request will be aborted if the provided context is
  6268. // canceled.
  6269. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsInstancesDatabasesTestIamPermissionsCall {
  6270. c.ctx_ = ctx
  6271. return c
  6272. }
  6273. // Header returns an http.Header that can be modified by the caller to
  6274. // add HTTP headers to the request.
  6275. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Header() http.Header {
  6276. if c.header_ == nil {
  6277. c.header_ = make(http.Header)
  6278. }
  6279. return c.header_
  6280. }
  6281. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  6282. reqHeaders := make(http.Header)
  6283. for k, v := range c.header_ {
  6284. reqHeaders[k] = v
  6285. }
  6286. reqHeaders.Set("User-Agent", c.s.userAgent())
  6287. var body io.Reader = nil
  6288. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  6289. if err != nil {
  6290. return nil, err
  6291. }
  6292. reqHeaders.Set("Content-Type", "application/json")
  6293. c.urlParams_.Set("alt", alt)
  6294. c.urlParams_.Set("prettyPrint", "false")
  6295. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  6296. urls += "?" + c.urlParams_.Encode()
  6297. req, err := http.NewRequest("POST", urls, body)
  6298. if err != nil {
  6299. return nil, err
  6300. }
  6301. req.Header = reqHeaders
  6302. googleapi.Expand(req.URL, map[string]string{
  6303. "resource": c.resource,
  6304. })
  6305. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6306. }
  6307. // Do executes the "spanner.projects.instances.databases.testIamPermissions" call.
  6308. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  6309. // Any non-2xx status code is an error. Response headers are in either
  6310. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  6311. // was returned at all) in error.(*googleapi.Error).Header. Use
  6312. // googleapi.IsNotModified to check whether the returned error was
  6313. // because http.StatusNotModified was returned.
  6314. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  6315. gensupport.SetOptions(c.urlParams_, opts...)
  6316. res, err := c.doRequest("json")
  6317. if res != nil && res.StatusCode == http.StatusNotModified {
  6318. if res.Body != nil {
  6319. res.Body.Close()
  6320. }
  6321. return nil, &googleapi.Error{
  6322. Code: res.StatusCode,
  6323. Header: res.Header,
  6324. }
  6325. }
  6326. if err != nil {
  6327. return nil, err
  6328. }
  6329. defer googleapi.CloseBody(res)
  6330. if err := googleapi.CheckResponse(res); err != nil {
  6331. return nil, err
  6332. }
  6333. ret := &TestIamPermissionsResponse{
  6334. ServerResponse: googleapi.ServerResponse{
  6335. Header: res.Header,
  6336. HTTPStatusCode: res.StatusCode,
  6337. },
  6338. }
  6339. target := &ret
  6340. if err := gensupport.DecodeResponse(target, res); err != nil {
  6341. return nil, err
  6342. }
  6343. return ret, nil
  6344. // {
  6345. // "description": "Returns permissions that the caller has on the specified database resource.\n\nAttempting this RPC on a non-existent Cloud Spanner database will\nresult in a NOT_FOUND error if the user has\n`spanner.databases.list` permission on the containing Cloud\nSpanner instance. Otherwise returns an empty set of permissions.",
  6346. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}:testIamPermissions",
  6347. // "httpMethod": "POST",
  6348. // "id": "spanner.projects.instances.databases.testIamPermissions",
  6349. // "parameterOrder": [
  6350. // "resource"
  6351. // ],
  6352. // "parameters": {
  6353. // "resource": {
  6354. // "description": "REQUIRED: The Cloud Spanner resource for which permissions are being tested. The format is `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e` for instance resources and `projects/\u003cproject ID\u003e/instances/\u003cinstance ID\u003e/databases/\u003cdatabase ID\u003e` for database resources.",
  6355. // "location": "path",
  6356. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  6357. // "required": true,
  6358. // "type": "string"
  6359. // }
  6360. // },
  6361. // "path": "v1/{+resource}:testIamPermissions",
  6362. // "request": {
  6363. // "$ref": "TestIamPermissionsRequest"
  6364. // },
  6365. // "response": {
  6366. // "$ref": "TestIamPermissionsResponse"
  6367. // },
  6368. // "scopes": [
  6369. // "https://www.googleapis.com/auth/cloud-platform",
  6370. // "https://www.googleapis.com/auth/spanner.admin"
  6371. // ]
  6372. // }
  6373. }
  6374. // method id "spanner.projects.instances.databases.updateDdl":
  6375. type ProjectsInstancesDatabasesUpdateDdlCall struct {
  6376. s *Service
  6377. database string
  6378. updatedatabaseddlrequest *UpdateDatabaseDdlRequest
  6379. urlParams_ gensupport.URLParams
  6380. ctx_ context.Context
  6381. header_ http.Header
  6382. }
  6383. // UpdateDdl: Updates the schema of a Cloud Spanner database
  6384. // by
  6385. // creating/altering/dropping tables, columns, indexes, etc. The
  6386. // returned
  6387. // long-running operation will have a name of
  6388. // the format `<database_name>/operations/<operation_id>` and can be
  6389. // used to
  6390. // track execution of the schema change(s). The
  6391. // metadata field type is
  6392. // UpdateDatabaseDdlMetadata. The operation has no response.
  6393. func (r *ProjectsInstancesDatabasesService) UpdateDdl(database string, updatedatabaseddlrequest *UpdateDatabaseDdlRequest) *ProjectsInstancesDatabasesUpdateDdlCall {
  6394. c := &ProjectsInstancesDatabasesUpdateDdlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6395. c.database = database
  6396. c.updatedatabaseddlrequest = updatedatabaseddlrequest
  6397. return c
  6398. }
  6399. // Fields allows partial responses to be retrieved. See
  6400. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6401. // for more information.
  6402. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesUpdateDdlCall {
  6403. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6404. return c
  6405. }
  6406. // Context sets the context to be used in this call's Do method. Any
  6407. // pending HTTP request will be aborted if the provided context is
  6408. // canceled.
  6409. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesUpdateDdlCall {
  6410. c.ctx_ = ctx
  6411. return c
  6412. }
  6413. // Header returns an http.Header that can be modified by the caller to
  6414. // add HTTP headers to the request.
  6415. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Header() http.Header {
  6416. if c.header_ == nil {
  6417. c.header_ = make(http.Header)
  6418. }
  6419. return c.header_
  6420. }
  6421. func (c *ProjectsInstancesDatabasesUpdateDdlCall) doRequest(alt string) (*http.Response, error) {
  6422. reqHeaders := make(http.Header)
  6423. for k, v := range c.header_ {
  6424. reqHeaders[k] = v
  6425. }
  6426. reqHeaders.Set("User-Agent", c.s.userAgent())
  6427. var body io.Reader = nil
  6428. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatedatabaseddlrequest)
  6429. if err != nil {
  6430. return nil, err
  6431. }
  6432. reqHeaders.Set("Content-Type", "application/json")
  6433. c.urlParams_.Set("alt", alt)
  6434. c.urlParams_.Set("prettyPrint", "false")
  6435. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/ddl")
  6436. urls += "?" + c.urlParams_.Encode()
  6437. req, err := http.NewRequest("PATCH", urls, body)
  6438. if err != nil {
  6439. return nil, err
  6440. }
  6441. req.Header = reqHeaders
  6442. googleapi.Expand(req.URL, map[string]string{
  6443. "database": c.database,
  6444. })
  6445. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6446. }
  6447. // Do executes the "spanner.projects.instances.databases.updateDdl" call.
  6448. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  6449. // status code is an error. Response headers are in either
  6450. // *Operation.ServerResponse.Header or (if a response was returned at
  6451. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6452. // to check whether the returned error was because
  6453. // http.StatusNotModified was returned.
  6454. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  6455. gensupport.SetOptions(c.urlParams_, opts...)
  6456. res, err := c.doRequest("json")
  6457. if res != nil && res.StatusCode == http.StatusNotModified {
  6458. if res.Body != nil {
  6459. res.Body.Close()
  6460. }
  6461. return nil, &googleapi.Error{
  6462. Code: res.StatusCode,
  6463. Header: res.Header,
  6464. }
  6465. }
  6466. if err != nil {
  6467. return nil, err
  6468. }
  6469. defer googleapi.CloseBody(res)
  6470. if err := googleapi.CheckResponse(res); err != nil {
  6471. return nil, err
  6472. }
  6473. ret := &Operation{
  6474. ServerResponse: googleapi.ServerResponse{
  6475. Header: res.Header,
  6476. HTTPStatusCode: res.StatusCode,
  6477. },
  6478. }
  6479. target := &ret
  6480. if err := gensupport.DecodeResponse(target, res); err != nil {
  6481. return nil, err
  6482. }
  6483. return ret, nil
  6484. // {
  6485. // "description": "Updates the schema of a Cloud Spanner database by\ncreating/altering/dropping tables, columns, indexes, etc. The returned\nlong-running operation will have a name of\nthe format `\u003cdatabase_name\u003e/operations/\u003coperation_id\u003e` and can be used to\ntrack execution of the schema change(s). The\nmetadata field type is\nUpdateDatabaseDdlMetadata. The operation has no response.",
  6486. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/ddl",
  6487. // "httpMethod": "PATCH",
  6488. // "id": "spanner.projects.instances.databases.updateDdl",
  6489. // "parameterOrder": [
  6490. // "database"
  6491. // ],
  6492. // "parameters": {
  6493. // "database": {
  6494. // "description": "Required. The database to update.",
  6495. // "location": "path",
  6496. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  6497. // "required": true,
  6498. // "type": "string"
  6499. // }
  6500. // },
  6501. // "path": "v1/{+database}/ddl",
  6502. // "request": {
  6503. // "$ref": "UpdateDatabaseDdlRequest"
  6504. // },
  6505. // "response": {
  6506. // "$ref": "Operation"
  6507. // },
  6508. // "scopes": [
  6509. // "https://www.googleapis.com/auth/cloud-platform",
  6510. // "https://www.googleapis.com/auth/spanner.admin"
  6511. // ]
  6512. // }
  6513. }
  6514. // method id "spanner.projects.instances.databases.operations.cancel":
  6515. type ProjectsInstancesDatabasesOperationsCancelCall struct {
  6516. s *Service
  6517. name string
  6518. urlParams_ gensupport.URLParams
  6519. ctx_ context.Context
  6520. header_ http.Header
  6521. }
  6522. // Cancel: Starts asynchronous cancellation on a long-running operation.
  6523. // The server
  6524. // makes a best effort to cancel the operation, but success is
  6525. // not
  6526. // guaranteed. If the server doesn't support this method, it
  6527. // returns
  6528. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  6529. // use
  6530. // Operations.GetOperation or
  6531. // other methods to check whether the cancellation succeeded or whether
  6532. // the
  6533. // operation completed despite cancellation. On successful
  6534. // cancellation,
  6535. // the operation is not deleted; instead, it becomes an operation
  6536. // with
  6537. // an Operation.error value with a google.rpc.Status.code of
  6538. // 1,
  6539. // corresponding to `Code.CANCELLED`.
  6540. func (r *ProjectsInstancesDatabasesOperationsService) Cancel(name string) *ProjectsInstancesDatabasesOperationsCancelCall {
  6541. c := &ProjectsInstancesDatabasesOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6542. c.name = name
  6543. return c
  6544. }
  6545. // Fields allows partial responses to be retrieved. See
  6546. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6547. // for more information.
  6548. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsCancelCall {
  6549. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6550. return c
  6551. }
  6552. // Context sets the context to be used in this call's Do method. Any
  6553. // pending HTTP request will be aborted if the provided context is
  6554. // canceled.
  6555. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsCancelCall {
  6556. c.ctx_ = ctx
  6557. return c
  6558. }
  6559. // Header returns an http.Header that can be modified by the caller to
  6560. // add HTTP headers to the request.
  6561. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Header() http.Header {
  6562. if c.header_ == nil {
  6563. c.header_ = make(http.Header)
  6564. }
  6565. return c.header_
  6566. }
  6567. func (c *ProjectsInstancesDatabasesOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  6568. reqHeaders := make(http.Header)
  6569. for k, v := range c.header_ {
  6570. reqHeaders[k] = v
  6571. }
  6572. reqHeaders.Set("User-Agent", c.s.userAgent())
  6573. var body io.Reader = nil
  6574. c.urlParams_.Set("alt", alt)
  6575. c.urlParams_.Set("prettyPrint", "false")
  6576. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  6577. urls += "?" + c.urlParams_.Encode()
  6578. req, err := http.NewRequest("POST", urls, body)
  6579. if err != nil {
  6580. return nil, err
  6581. }
  6582. req.Header = reqHeaders
  6583. googleapi.Expand(req.URL, map[string]string{
  6584. "name": c.name,
  6585. })
  6586. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6587. }
  6588. // Do executes the "spanner.projects.instances.databases.operations.cancel" call.
  6589. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6590. // code is an error. Response headers are in either
  6591. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6592. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6593. // check whether the returned error was because http.StatusNotModified
  6594. // was returned.
  6595. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6596. gensupport.SetOptions(c.urlParams_, opts...)
  6597. res, err := c.doRequest("json")
  6598. if res != nil && res.StatusCode == http.StatusNotModified {
  6599. if res.Body != nil {
  6600. res.Body.Close()
  6601. }
  6602. return nil, &googleapi.Error{
  6603. Code: res.StatusCode,
  6604. Header: res.Header,
  6605. }
  6606. }
  6607. if err != nil {
  6608. return nil, err
  6609. }
  6610. defer googleapi.CloseBody(res)
  6611. if err := googleapi.CheckResponse(res); err != nil {
  6612. return nil, err
  6613. }
  6614. ret := &Empty{
  6615. ServerResponse: googleapi.ServerResponse{
  6616. Header: res.Header,
  6617. HTTPStatusCode: res.StatusCode,
  6618. },
  6619. }
  6620. target := &ret
  6621. if err := gensupport.DecodeResponse(target, res); err != nil {
  6622. return nil, err
  6623. }
  6624. return ret, nil
  6625. // {
  6626. // "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
  6627. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations/{operationsId}:cancel",
  6628. // "httpMethod": "POST",
  6629. // "id": "spanner.projects.instances.databases.operations.cancel",
  6630. // "parameterOrder": [
  6631. // "name"
  6632. // ],
  6633. // "parameters": {
  6634. // "name": {
  6635. // "description": "The name of the operation resource to be cancelled.",
  6636. // "location": "path",
  6637. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$",
  6638. // "required": true,
  6639. // "type": "string"
  6640. // }
  6641. // },
  6642. // "path": "v1/{+name}:cancel",
  6643. // "response": {
  6644. // "$ref": "Empty"
  6645. // },
  6646. // "scopes": [
  6647. // "https://www.googleapis.com/auth/cloud-platform",
  6648. // "https://www.googleapis.com/auth/spanner.admin"
  6649. // ]
  6650. // }
  6651. }
  6652. // method id "spanner.projects.instances.databases.operations.delete":
  6653. type ProjectsInstancesDatabasesOperationsDeleteCall struct {
  6654. s *Service
  6655. name string
  6656. urlParams_ gensupport.URLParams
  6657. ctx_ context.Context
  6658. header_ http.Header
  6659. }
  6660. // Delete: Deletes a long-running operation. This method indicates that
  6661. // the client is
  6662. // no longer interested in the operation result. It does not cancel
  6663. // the
  6664. // operation. If the server doesn't support this method, it
  6665. // returns
  6666. // `google.rpc.Code.UNIMPLEMENTED`.
  6667. func (r *ProjectsInstancesDatabasesOperationsService) Delete(name string) *ProjectsInstancesDatabasesOperationsDeleteCall {
  6668. c := &ProjectsInstancesDatabasesOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6669. c.name = name
  6670. return c
  6671. }
  6672. // Fields allows partial responses to be retrieved. See
  6673. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6674. // for more information.
  6675. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsDeleteCall {
  6676. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6677. return c
  6678. }
  6679. // Context sets the context to be used in this call's Do method. Any
  6680. // pending HTTP request will be aborted if the provided context is
  6681. // canceled.
  6682. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsDeleteCall {
  6683. c.ctx_ = ctx
  6684. return c
  6685. }
  6686. // Header returns an http.Header that can be modified by the caller to
  6687. // add HTTP headers to the request.
  6688. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Header() http.Header {
  6689. if c.header_ == nil {
  6690. c.header_ = make(http.Header)
  6691. }
  6692. return c.header_
  6693. }
  6694. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6695. reqHeaders := make(http.Header)
  6696. for k, v := range c.header_ {
  6697. reqHeaders[k] = v
  6698. }
  6699. reqHeaders.Set("User-Agent", c.s.userAgent())
  6700. var body io.Reader = nil
  6701. c.urlParams_.Set("alt", alt)
  6702. c.urlParams_.Set("prettyPrint", "false")
  6703. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6704. urls += "?" + c.urlParams_.Encode()
  6705. req, err := http.NewRequest("DELETE", urls, body)
  6706. if err != nil {
  6707. return nil, err
  6708. }
  6709. req.Header = reqHeaders
  6710. googleapi.Expand(req.URL, map[string]string{
  6711. "name": c.name,
  6712. })
  6713. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6714. }
  6715. // Do executes the "spanner.projects.instances.databases.operations.delete" call.
  6716. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6717. // code is an error. Response headers are in either
  6718. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6719. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6720. // check whether the returned error was because http.StatusNotModified
  6721. // was returned.
  6722. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6723. gensupport.SetOptions(c.urlParams_, opts...)
  6724. res, err := c.doRequest("json")
  6725. if res != nil && res.StatusCode == http.StatusNotModified {
  6726. if res.Body != nil {
  6727. res.Body.Close()
  6728. }
  6729. return nil, &googleapi.Error{
  6730. Code: res.StatusCode,
  6731. Header: res.Header,
  6732. }
  6733. }
  6734. if err != nil {
  6735. return nil, err
  6736. }
  6737. defer googleapi.CloseBody(res)
  6738. if err := googleapi.CheckResponse(res); err != nil {
  6739. return nil, err
  6740. }
  6741. ret := &Empty{
  6742. ServerResponse: googleapi.ServerResponse{
  6743. Header: res.Header,
  6744. HTTPStatusCode: res.StatusCode,
  6745. },
  6746. }
  6747. target := &ret
  6748. if err := gensupport.DecodeResponse(target, res); err != nil {
  6749. return nil, err
  6750. }
  6751. return ret, nil
  6752. // {
  6753. // "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
  6754. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations/{operationsId}",
  6755. // "httpMethod": "DELETE",
  6756. // "id": "spanner.projects.instances.databases.operations.delete",
  6757. // "parameterOrder": [
  6758. // "name"
  6759. // ],
  6760. // "parameters": {
  6761. // "name": {
  6762. // "description": "The name of the operation resource to be deleted.",
  6763. // "location": "path",
  6764. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$",
  6765. // "required": true,
  6766. // "type": "string"
  6767. // }
  6768. // },
  6769. // "path": "v1/{+name}",
  6770. // "response": {
  6771. // "$ref": "Empty"
  6772. // },
  6773. // "scopes": [
  6774. // "https://www.googleapis.com/auth/cloud-platform",
  6775. // "https://www.googleapis.com/auth/spanner.admin"
  6776. // ]
  6777. // }
  6778. }
  6779. // method id "spanner.projects.instances.databases.operations.get":
  6780. type ProjectsInstancesDatabasesOperationsGetCall struct {
  6781. s *Service
  6782. name string
  6783. urlParams_ gensupport.URLParams
  6784. ifNoneMatch_ string
  6785. ctx_ context.Context
  6786. header_ http.Header
  6787. }
  6788. // Get: Gets the latest state of a long-running operation. Clients can
  6789. // use this
  6790. // method to poll the operation result at intervals as recommended by
  6791. // the API
  6792. // service.
  6793. func (r *ProjectsInstancesDatabasesOperationsService) Get(name string) *ProjectsInstancesDatabasesOperationsGetCall {
  6794. c := &ProjectsInstancesDatabasesOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6795. c.name = name
  6796. return c
  6797. }
  6798. // Fields allows partial responses to be retrieved. See
  6799. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6800. // for more information.
  6801. func (c *ProjectsInstancesDatabasesOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsGetCall {
  6802. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6803. return c
  6804. }
  6805. // IfNoneMatch sets the optional parameter which makes the operation
  6806. // fail if the object's ETag matches the given value. This is useful for
  6807. // getting updates only after the object has changed since the last
  6808. // request. Use googleapi.IsNotModified to check whether the response
  6809. // error from Do is the result of In-None-Match.
  6810. func (c *ProjectsInstancesDatabasesOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesOperationsGetCall {
  6811. c.ifNoneMatch_ = entityTag
  6812. return c
  6813. }
  6814. // Context sets the context to be used in this call's Do method. Any
  6815. // pending HTTP request will be aborted if the provided context is
  6816. // canceled.
  6817. func (c *ProjectsInstancesDatabasesOperationsGetCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsGetCall {
  6818. c.ctx_ = ctx
  6819. return c
  6820. }
  6821. // Header returns an http.Header that can be modified by the caller to
  6822. // add HTTP headers to the request.
  6823. func (c *ProjectsInstancesDatabasesOperationsGetCall) Header() http.Header {
  6824. if c.header_ == nil {
  6825. c.header_ = make(http.Header)
  6826. }
  6827. return c.header_
  6828. }
  6829. func (c *ProjectsInstancesDatabasesOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  6830. reqHeaders := make(http.Header)
  6831. for k, v := range c.header_ {
  6832. reqHeaders[k] = v
  6833. }
  6834. reqHeaders.Set("User-Agent", c.s.userAgent())
  6835. if c.ifNoneMatch_ != "" {
  6836. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6837. }
  6838. var body io.Reader = nil
  6839. c.urlParams_.Set("alt", alt)
  6840. c.urlParams_.Set("prettyPrint", "false")
  6841. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6842. urls += "?" + c.urlParams_.Encode()
  6843. req, err := http.NewRequest("GET", urls, body)
  6844. if err != nil {
  6845. return nil, err
  6846. }
  6847. req.Header = reqHeaders
  6848. googleapi.Expand(req.URL, map[string]string{
  6849. "name": c.name,
  6850. })
  6851. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6852. }
  6853. // Do executes the "spanner.projects.instances.databases.operations.get" call.
  6854. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  6855. // status code is an error. Response headers are in either
  6856. // *Operation.ServerResponse.Header or (if a response was returned at
  6857. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6858. // to check whether the returned error was because
  6859. // http.StatusNotModified was returned.
  6860. func (c *ProjectsInstancesDatabasesOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  6861. gensupport.SetOptions(c.urlParams_, opts...)
  6862. res, err := c.doRequest("json")
  6863. if res != nil && res.StatusCode == http.StatusNotModified {
  6864. if res.Body != nil {
  6865. res.Body.Close()
  6866. }
  6867. return nil, &googleapi.Error{
  6868. Code: res.StatusCode,
  6869. Header: res.Header,
  6870. }
  6871. }
  6872. if err != nil {
  6873. return nil, err
  6874. }
  6875. defer googleapi.CloseBody(res)
  6876. if err := googleapi.CheckResponse(res); err != nil {
  6877. return nil, err
  6878. }
  6879. ret := &Operation{
  6880. ServerResponse: googleapi.ServerResponse{
  6881. Header: res.Header,
  6882. HTTPStatusCode: res.StatusCode,
  6883. },
  6884. }
  6885. target := &ret
  6886. if err := gensupport.DecodeResponse(target, res); err != nil {
  6887. return nil, err
  6888. }
  6889. return ret, nil
  6890. // {
  6891. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  6892. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations/{operationsId}",
  6893. // "httpMethod": "GET",
  6894. // "id": "spanner.projects.instances.databases.operations.get",
  6895. // "parameterOrder": [
  6896. // "name"
  6897. // ],
  6898. // "parameters": {
  6899. // "name": {
  6900. // "description": "The name of the operation resource.",
  6901. // "location": "path",
  6902. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$",
  6903. // "required": true,
  6904. // "type": "string"
  6905. // }
  6906. // },
  6907. // "path": "v1/{+name}",
  6908. // "response": {
  6909. // "$ref": "Operation"
  6910. // },
  6911. // "scopes": [
  6912. // "https://www.googleapis.com/auth/cloud-platform",
  6913. // "https://www.googleapis.com/auth/spanner.admin"
  6914. // ]
  6915. // }
  6916. }
  6917. // method id "spanner.projects.instances.databases.operations.list":
  6918. type ProjectsInstancesDatabasesOperationsListCall struct {
  6919. s *Service
  6920. name string
  6921. urlParams_ gensupport.URLParams
  6922. ifNoneMatch_ string
  6923. ctx_ context.Context
  6924. header_ http.Header
  6925. }
  6926. // List: Lists operations that match the specified filter in the
  6927. // request. If the
  6928. // server doesn't support this method, it returns
  6929. // `UNIMPLEMENTED`.
  6930. //
  6931. // NOTE: the `name` binding allows API services to override the
  6932. // binding
  6933. // to use different resource name schemes, such as `users/*/operations`.
  6934. // To
  6935. // override the binding, API services can add a binding such
  6936. // as
  6937. // "/v1/{name=users/*}/operations" to their service configuration.
  6938. // For backwards compatibility, the default name includes the
  6939. // operations
  6940. // collection id, however overriding users must ensure the name
  6941. // binding
  6942. // is the parent resource, without the operations collection id.
  6943. func (r *ProjectsInstancesDatabasesOperationsService) List(name string) *ProjectsInstancesDatabasesOperationsListCall {
  6944. c := &ProjectsInstancesDatabasesOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6945. c.name = name
  6946. return c
  6947. }
  6948. // Filter sets the optional parameter "filter": The standard list
  6949. // filter.
  6950. func (c *ProjectsInstancesDatabasesOperationsListCall) Filter(filter string) *ProjectsInstancesDatabasesOperationsListCall {
  6951. c.urlParams_.Set("filter", filter)
  6952. return c
  6953. }
  6954. // PageSize sets the optional parameter "pageSize": The standard list
  6955. // page size.
  6956. func (c *ProjectsInstancesDatabasesOperationsListCall) PageSize(pageSize int64) *ProjectsInstancesDatabasesOperationsListCall {
  6957. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6958. return c
  6959. }
  6960. // PageToken sets the optional parameter "pageToken": The standard list
  6961. // page token.
  6962. func (c *ProjectsInstancesDatabasesOperationsListCall) PageToken(pageToken string) *ProjectsInstancesDatabasesOperationsListCall {
  6963. c.urlParams_.Set("pageToken", pageToken)
  6964. return c
  6965. }
  6966. // Fields allows partial responses to be retrieved. See
  6967. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6968. // for more information.
  6969. func (c *ProjectsInstancesDatabasesOperationsListCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsListCall {
  6970. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6971. return c
  6972. }
  6973. // IfNoneMatch sets the optional parameter which makes the operation
  6974. // fail if the object's ETag matches the given value. This is useful for
  6975. // getting updates only after the object has changed since the last
  6976. // request. Use googleapi.IsNotModified to check whether the response
  6977. // error from Do is the result of In-None-Match.
  6978. func (c *ProjectsInstancesDatabasesOperationsListCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesOperationsListCall {
  6979. c.ifNoneMatch_ = entityTag
  6980. return c
  6981. }
  6982. // Context sets the context to be used in this call's Do method. Any
  6983. // pending HTTP request will be aborted if the provided context is
  6984. // canceled.
  6985. func (c *ProjectsInstancesDatabasesOperationsListCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsListCall {
  6986. c.ctx_ = ctx
  6987. return c
  6988. }
  6989. // Header returns an http.Header that can be modified by the caller to
  6990. // add HTTP headers to the request.
  6991. func (c *ProjectsInstancesDatabasesOperationsListCall) Header() http.Header {
  6992. if c.header_ == nil {
  6993. c.header_ = make(http.Header)
  6994. }
  6995. return c.header_
  6996. }
  6997. func (c *ProjectsInstancesDatabasesOperationsListCall) doRequest(alt string) (*http.Response, error) {
  6998. reqHeaders := make(http.Header)
  6999. for k, v := range c.header_ {
  7000. reqHeaders[k] = v
  7001. }
  7002. reqHeaders.Set("User-Agent", c.s.userAgent())
  7003. if c.ifNoneMatch_ != "" {
  7004. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7005. }
  7006. var body io.Reader = nil
  7007. c.urlParams_.Set("alt", alt)
  7008. c.urlParams_.Set("prettyPrint", "false")
  7009. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  7010. urls += "?" + c.urlParams_.Encode()
  7011. req, err := http.NewRequest("GET", urls, body)
  7012. if err != nil {
  7013. return nil, err
  7014. }
  7015. req.Header = reqHeaders
  7016. googleapi.Expand(req.URL, map[string]string{
  7017. "name": c.name,
  7018. })
  7019. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7020. }
  7021. // Do executes the "spanner.projects.instances.databases.operations.list" call.
  7022. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  7023. // non-2xx status code is an error. Response headers are in either
  7024. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  7025. // returned at all) in error.(*googleapi.Error).Header. Use
  7026. // googleapi.IsNotModified to check whether the returned error was
  7027. // because http.StatusNotModified was returned.
  7028. func (c *ProjectsInstancesDatabasesOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  7029. gensupport.SetOptions(c.urlParams_, opts...)
  7030. res, err := c.doRequest("json")
  7031. if res != nil && res.StatusCode == http.StatusNotModified {
  7032. if res.Body != nil {
  7033. res.Body.Close()
  7034. }
  7035. return nil, &googleapi.Error{
  7036. Code: res.StatusCode,
  7037. Header: res.Header,
  7038. }
  7039. }
  7040. if err != nil {
  7041. return nil, err
  7042. }
  7043. defer googleapi.CloseBody(res)
  7044. if err := googleapi.CheckResponse(res); err != nil {
  7045. return nil, err
  7046. }
  7047. ret := &ListOperationsResponse{
  7048. ServerResponse: googleapi.ServerResponse{
  7049. Header: res.Header,
  7050. HTTPStatusCode: res.StatusCode,
  7051. },
  7052. }
  7053. target := &ret
  7054. if err := gensupport.DecodeResponse(target, res); err != nil {
  7055. return nil, err
  7056. }
  7057. return ret, nil
  7058. // {
  7059. // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
  7060. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations",
  7061. // "httpMethod": "GET",
  7062. // "id": "spanner.projects.instances.databases.operations.list",
  7063. // "parameterOrder": [
  7064. // "name"
  7065. // ],
  7066. // "parameters": {
  7067. // "filter": {
  7068. // "description": "The standard list filter.",
  7069. // "location": "query",
  7070. // "type": "string"
  7071. // },
  7072. // "name": {
  7073. // "description": "The name of the operation's parent resource.",
  7074. // "location": "path",
  7075. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations$",
  7076. // "required": true,
  7077. // "type": "string"
  7078. // },
  7079. // "pageSize": {
  7080. // "description": "The standard list page size.",
  7081. // "format": "int32",
  7082. // "location": "query",
  7083. // "type": "integer"
  7084. // },
  7085. // "pageToken": {
  7086. // "description": "The standard list page token.",
  7087. // "location": "query",
  7088. // "type": "string"
  7089. // }
  7090. // },
  7091. // "path": "v1/{+name}",
  7092. // "response": {
  7093. // "$ref": "ListOperationsResponse"
  7094. // },
  7095. // "scopes": [
  7096. // "https://www.googleapis.com/auth/cloud-platform",
  7097. // "https://www.googleapis.com/auth/spanner.admin"
  7098. // ]
  7099. // }
  7100. }
  7101. // Pages invokes f for each page of results.
  7102. // A non-nil error returned from f will halt the iteration.
  7103. // The provided context supersedes any context provided to the Context method.
  7104. func (c *ProjectsInstancesDatabasesOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  7105. c.ctx_ = ctx
  7106. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7107. for {
  7108. x, err := c.Do()
  7109. if err != nil {
  7110. return err
  7111. }
  7112. if err := f(x); err != nil {
  7113. return err
  7114. }
  7115. if x.NextPageToken == "" {
  7116. return nil
  7117. }
  7118. c.PageToken(x.NextPageToken)
  7119. }
  7120. }
  7121. // method id "spanner.projects.instances.databases.sessions.beginTransaction":
  7122. type ProjectsInstancesDatabasesSessionsBeginTransactionCall struct {
  7123. s *Service
  7124. session string
  7125. begintransactionrequest *BeginTransactionRequest
  7126. urlParams_ gensupport.URLParams
  7127. ctx_ context.Context
  7128. header_ http.Header
  7129. }
  7130. // BeginTransaction: Begins a new transaction. This step can often be
  7131. // skipped:
  7132. // Read, ExecuteSql and
  7133. // Commit can begin a new transaction as a
  7134. // side-effect.
  7135. func (r *ProjectsInstancesDatabasesSessionsService) BeginTransaction(session string, begintransactionrequest *BeginTransactionRequest) *ProjectsInstancesDatabasesSessionsBeginTransactionCall {
  7136. c := &ProjectsInstancesDatabasesSessionsBeginTransactionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7137. c.session = session
  7138. c.begintransactionrequest = begintransactionrequest
  7139. return c
  7140. }
  7141. // Fields allows partial responses to be retrieved. See
  7142. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7143. // for more information.
  7144. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsBeginTransactionCall {
  7145. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7146. return c
  7147. }
  7148. // Context sets the context to be used in this call's Do method. Any
  7149. // pending HTTP request will be aborted if the provided context is
  7150. // canceled.
  7151. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsBeginTransactionCall {
  7152. c.ctx_ = ctx
  7153. return c
  7154. }
  7155. // Header returns an http.Header that can be modified by the caller to
  7156. // add HTTP headers to the request.
  7157. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Header() http.Header {
  7158. if c.header_ == nil {
  7159. c.header_ = make(http.Header)
  7160. }
  7161. return c.header_
  7162. }
  7163. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) doRequest(alt string) (*http.Response, error) {
  7164. reqHeaders := make(http.Header)
  7165. for k, v := range c.header_ {
  7166. reqHeaders[k] = v
  7167. }
  7168. reqHeaders.Set("User-Agent", c.s.userAgent())
  7169. var body io.Reader = nil
  7170. body, err := googleapi.WithoutDataWrapper.JSONReader(c.begintransactionrequest)
  7171. if err != nil {
  7172. return nil, err
  7173. }
  7174. reqHeaders.Set("Content-Type", "application/json")
  7175. c.urlParams_.Set("alt", alt)
  7176. c.urlParams_.Set("prettyPrint", "false")
  7177. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:beginTransaction")
  7178. urls += "?" + c.urlParams_.Encode()
  7179. req, err := http.NewRequest("POST", urls, body)
  7180. if err != nil {
  7181. return nil, err
  7182. }
  7183. req.Header = reqHeaders
  7184. googleapi.Expand(req.URL, map[string]string{
  7185. "session": c.session,
  7186. })
  7187. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7188. }
  7189. // Do executes the "spanner.projects.instances.databases.sessions.beginTransaction" call.
  7190. // Exactly one of *Transaction or error will be non-nil. Any non-2xx
  7191. // status code is an error. Response headers are in either
  7192. // *Transaction.ServerResponse.Header or (if a response was returned at
  7193. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7194. // to check whether the returned error was because
  7195. // http.StatusNotModified was returned.
  7196. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Do(opts ...googleapi.CallOption) (*Transaction, error) {
  7197. gensupport.SetOptions(c.urlParams_, opts...)
  7198. res, err := c.doRequest("json")
  7199. if res != nil && res.StatusCode == http.StatusNotModified {
  7200. if res.Body != nil {
  7201. res.Body.Close()
  7202. }
  7203. return nil, &googleapi.Error{
  7204. Code: res.StatusCode,
  7205. Header: res.Header,
  7206. }
  7207. }
  7208. if err != nil {
  7209. return nil, err
  7210. }
  7211. defer googleapi.CloseBody(res)
  7212. if err := googleapi.CheckResponse(res); err != nil {
  7213. return nil, err
  7214. }
  7215. ret := &Transaction{
  7216. ServerResponse: googleapi.ServerResponse{
  7217. Header: res.Header,
  7218. HTTPStatusCode: res.StatusCode,
  7219. },
  7220. }
  7221. target := &ret
  7222. if err := gensupport.DecodeResponse(target, res); err != nil {
  7223. return nil, err
  7224. }
  7225. return ret, nil
  7226. // {
  7227. // "description": "Begins a new transaction. This step can often be skipped:\nRead, ExecuteSql and\nCommit can begin a new transaction as a\nside-effect.",
  7228. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:beginTransaction",
  7229. // "httpMethod": "POST",
  7230. // "id": "spanner.projects.instances.databases.sessions.beginTransaction",
  7231. // "parameterOrder": [
  7232. // "session"
  7233. // ],
  7234. // "parameters": {
  7235. // "session": {
  7236. // "description": "Required. The session in which the transaction runs.",
  7237. // "location": "path",
  7238. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7239. // "required": true,
  7240. // "type": "string"
  7241. // }
  7242. // },
  7243. // "path": "v1/{+session}:beginTransaction",
  7244. // "request": {
  7245. // "$ref": "BeginTransactionRequest"
  7246. // },
  7247. // "response": {
  7248. // "$ref": "Transaction"
  7249. // },
  7250. // "scopes": [
  7251. // "https://www.googleapis.com/auth/cloud-platform",
  7252. // "https://www.googleapis.com/auth/spanner.data"
  7253. // ]
  7254. // }
  7255. }
  7256. // method id "spanner.projects.instances.databases.sessions.commit":
  7257. type ProjectsInstancesDatabasesSessionsCommitCall struct {
  7258. s *Service
  7259. session string
  7260. commitrequest *CommitRequest
  7261. urlParams_ gensupport.URLParams
  7262. ctx_ context.Context
  7263. header_ http.Header
  7264. }
  7265. // Commit: Commits a transaction. The request includes the mutations to
  7266. // be
  7267. // applied to rows in the database.
  7268. //
  7269. // `Commit` might return an `ABORTED` error. This can occur at any
  7270. // time;
  7271. // commonly, the cause is conflicts with concurrent
  7272. // transactions. However, it can also happen for a variety of
  7273. // other
  7274. // reasons. If `Commit` returns `ABORTED`, the caller should
  7275. // re-attempt
  7276. // the transaction from the beginning, re-using the same session.
  7277. func (r *ProjectsInstancesDatabasesSessionsService) Commit(session string, commitrequest *CommitRequest) *ProjectsInstancesDatabasesSessionsCommitCall {
  7278. c := &ProjectsInstancesDatabasesSessionsCommitCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7279. c.session = session
  7280. c.commitrequest = commitrequest
  7281. return c
  7282. }
  7283. // Fields allows partial responses to be retrieved. See
  7284. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7285. // for more information.
  7286. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsCommitCall {
  7287. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7288. return c
  7289. }
  7290. // Context sets the context to be used in this call's Do method. Any
  7291. // pending HTTP request will be aborted if the provided context is
  7292. // canceled.
  7293. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsCommitCall {
  7294. c.ctx_ = ctx
  7295. return c
  7296. }
  7297. // Header returns an http.Header that can be modified by the caller to
  7298. // add HTTP headers to the request.
  7299. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Header() http.Header {
  7300. if c.header_ == nil {
  7301. c.header_ = make(http.Header)
  7302. }
  7303. return c.header_
  7304. }
  7305. func (c *ProjectsInstancesDatabasesSessionsCommitCall) doRequest(alt string) (*http.Response, error) {
  7306. reqHeaders := make(http.Header)
  7307. for k, v := range c.header_ {
  7308. reqHeaders[k] = v
  7309. }
  7310. reqHeaders.Set("User-Agent", c.s.userAgent())
  7311. var body io.Reader = nil
  7312. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commitrequest)
  7313. if err != nil {
  7314. return nil, err
  7315. }
  7316. reqHeaders.Set("Content-Type", "application/json")
  7317. c.urlParams_.Set("alt", alt)
  7318. c.urlParams_.Set("prettyPrint", "false")
  7319. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:commit")
  7320. urls += "?" + c.urlParams_.Encode()
  7321. req, err := http.NewRequest("POST", urls, body)
  7322. if err != nil {
  7323. return nil, err
  7324. }
  7325. req.Header = reqHeaders
  7326. googleapi.Expand(req.URL, map[string]string{
  7327. "session": c.session,
  7328. })
  7329. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7330. }
  7331. // Do executes the "spanner.projects.instances.databases.sessions.commit" call.
  7332. // Exactly one of *CommitResponse or error will be non-nil. Any non-2xx
  7333. // status code is an error. Response headers are in either
  7334. // *CommitResponse.ServerResponse.Header or (if a response was returned
  7335. // at all) in error.(*googleapi.Error).Header. Use
  7336. // googleapi.IsNotModified to check whether the returned error was
  7337. // because http.StatusNotModified was returned.
  7338. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Do(opts ...googleapi.CallOption) (*CommitResponse, error) {
  7339. gensupport.SetOptions(c.urlParams_, opts...)
  7340. res, err := c.doRequest("json")
  7341. if res != nil && res.StatusCode == http.StatusNotModified {
  7342. if res.Body != nil {
  7343. res.Body.Close()
  7344. }
  7345. return nil, &googleapi.Error{
  7346. Code: res.StatusCode,
  7347. Header: res.Header,
  7348. }
  7349. }
  7350. if err != nil {
  7351. return nil, err
  7352. }
  7353. defer googleapi.CloseBody(res)
  7354. if err := googleapi.CheckResponse(res); err != nil {
  7355. return nil, err
  7356. }
  7357. ret := &CommitResponse{
  7358. ServerResponse: googleapi.ServerResponse{
  7359. Header: res.Header,
  7360. HTTPStatusCode: res.StatusCode,
  7361. },
  7362. }
  7363. target := &ret
  7364. if err := gensupport.DecodeResponse(target, res); err != nil {
  7365. return nil, err
  7366. }
  7367. return ret, nil
  7368. // {
  7369. // "description": "Commits a transaction. The request includes the mutations to be\napplied to rows in the database.\n\n`Commit` might return an `ABORTED` error. This can occur at any time;\ncommonly, the cause is conflicts with concurrent\ntransactions. However, it can also happen for a variety of other\nreasons. If `Commit` returns `ABORTED`, the caller should re-attempt\nthe transaction from the beginning, re-using the same session.",
  7370. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:commit",
  7371. // "httpMethod": "POST",
  7372. // "id": "spanner.projects.instances.databases.sessions.commit",
  7373. // "parameterOrder": [
  7374. // "session"
  7375. // ],
  7376. // "parameters": {
  7377. // "session": {
  7378. // "description": "Required. The session in which the transaction to be committed is running.",
  7379. // "location": "path",
  7380. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7381. // "required": true,
  7382. // "type": "string"
  7383. // }
  7384. // },
  7385. // "path": "v1/{+session}:commit",
  7386. // "request": {
  7387. // "$ref": "CommitRequest"
  7388. // },
  7389. // "response": {
  7390. // "$ref": "CommitResponse"
  7391. // },
  7392. // "scopes": [
  7393. // "https://www.googleapis.com/auth/cloud-platform",
  7394. // "https://www.googleapis.com/auth/spanner.data"
  7395. // ]
  7396. // }
  7397. }
  7398. // method id "spanner.projects.instances.databases.sessions.create":
  7399. type ProjectsInstancesDatabasesSessionsCreateCall struct {
  7400. s *Service
  7401. database string
  7402. createsessionrequest *CreateSessionRequest
  7403. urlParams_ gensupport.URLParams
  7404. ctx_ context.Context
  7405. header_ http.Header
  7406. }
  7407. // Create: Creates a new session. A session can be used to
  7408. // perform
  7409. // transactions that read and/or modify data in a Cloud Spanner
  7410. // database.
  7411. // Sessions are meant to be reused for many
  7412. // consecutive
  7413. // transactions.
  7414. //
  7415. // Sessions can only execute one transaction at a time. To
  7416. // execute
  7417. // multiple concurrent read-write/write-only transactions,
  7418. // create
  7419. // multiple sessions. Note that standalone reads and queries use
  7420. // a
  7421. // transaction internally, and count toward the one
  7422. // transaction
  7423. // limit.
  7424. //
  7425. // Cloud Spanner limits the number of sessions that can exist at any
  7426. // given
  7427. // time; thus, it is a good idea to delete idle and/or unneeded
  7428. // sessions.
  7429. // Aside from explicit deletes, Cloud Spanner can delete sessions for
  7430. // which no
  7431. // operations are sent for more than an hour. If a session is
  7432. // deleted,
  7433. // requests to it return `NOT_FOUND`.
  7434. //
  7435. // Idle sessions can be kept alive by sending a trivial SQL
  7436. // query
  7437. // periodically, e.g., "SELECT 1".
  7438. func (r *ProjectsInstancesDatabasesSessionsService) Create(database string, createsessionrequest *CreateSessionRequest) *ProjectsInstancesDatabasesSessionsCreateCall {
  7439. c := &ProjectsInstancesDatabasesSessionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7440. c.database = database
  7441. c.createsessionrequest = createsessionrequest
  7442. return c
  7443. }
  7444. // Fields allows partial responses to be retrieved. See
  7445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7446. // for more information.
  7447. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsCreateCall {
  7448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7449. return c
  7450. }
  7451. // Context sets the context to be used in this call's Do method. Any
  7452. // pending HTTP request will be aborted if the provided context is
  7453. // canceled.
  7454. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsCreateCall {
  7455. c.ctx_ = ctx
  7456. return c
  7457. }
  7458. // Header returns an http.Header that can be modified by the caller to
  7459. // add HTTP headers to the request.
  7460. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Header() http.Header {
  7461. if c.header_ == nil {
  7462. c.header_ = make(http.Header)
  7463. }
  7464. return c.header_
  7465. }
  7466. func (c *ProjectsInstancesDatabasesSessionsCreateCall) doRequest(alt string) (*http.Response, error) {
  7467. reqHeaders := make(http.Header)
  7468. for k, v := range c.header_ {
  7469. reqHeaders[k] = v
  7470. }
  7471. reqHeaders.Set("User-Agent", c.s.userAgent())
  7472. var body io.Reader = nil
  7473. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createsessionrequest)
  7474. if err != nil {
  7475. return nil, err
  7476. }
  7477. reqHeaders.Set("Content-Type", "application/json")
  7478. c.urlParams_.Set("alt", alt)
  7479. c.urlParams_.Set("prettyPrint", "false")
  7480. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/sessions")
  7481. urls += "?" + c.urlParams_.Encode()
  7482. req, err := http.NewRequest("POST", urls, body)
  7483. if err != nil {
  7484. return nil, err
  7485. }
  7486. req.Header = reqHeaders
  7487. googleapi.Expand(req.URL, map[string]string{
  7488. "database": c.database,
  7489. })
  7490. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7491. }
  7492. // Do executes the "spanner.projects.instances.databases.sessions.create" call.
  7493. // Exactly one of *Session or error will be non-nil. Any non-2xx status
  7494. // code is an error. Response headers are in either
  7495. // *Session.ServerResponse.Header or (if a response was returned at all)
  7496. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7497. // check whether the returned error was because http.StatusNotModified
  7498. // was returned.
  7499. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Do(opts ...googleapi.CallOption) (*Session, error) {
  7500. gensupport.SetOptions(c.urlParams_, opts...)
  7501. res, err := c.doRequest("json")
  7502. if res != nil && res.StatusCode == http.StatusNotModified {
  7503. if res.Body != nil {
  7504. res.Body.Close()
  7505. }
  7506. return nil, &googleapi.Error{
  7507. Code: res.StatusCode,
  7508. Header: res.Header,
  7509. }
  7510. }
  7511. if err != nil {
  7512. return nil, err
  7513. }
  7514. defer googleapi.CloseBody(res)
  7515. if err := googleapi.CheckResponse(res); err != nil {
  7516. return nil, err
  7517. }
  7518. ret := &Session{
  7519. ServerResponse: googleapi.ServerResponse{
  7520. Header: res.Header,
  7521. HTTPStatusCode: res.StatusCode,
  7522. },
  7523. }
  7524. target := &ret
  7525. if err := gensupport.DecodeResponse(target, res); err != nil {
  7526. return nil, err
  7527. }
  7528. return ret, nil
  7529. // {
  7530. // "description": "Creates a new session. A session can be used to perform\ntransactions that read and/or modify data in a Cloud Spanner database.\nSessions are meant to be reused for many consecutive\ntransactions.\n\nSessions can only execute one transaction at a time. To execute\nmultiple concurrent read-write/write-only transactions, create\nmultiple sessions. Note that standalone reads and queries use a\ntransaction internally, and count toward the one transaction\nlimit.\n\nCloud Spanner limits the number of sessions that can exist at any given\ntime; thus, it is a good idea to delete idle and/or unneeded sessions.\nAside from explicit deletes, Cloud Spanner can delete sessions for which no\noperations are sent for more than an hour. If a session is deleted,\nrequests to it return `NOT_FOUND`.\n\nIdle sessions can be kept alive by sending a trivial SQL query\nperiodically, e.g., `\"SELECT 1\"`.",
  7531. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions",
  7532. // "httpMethod": "POST",
  7533. // "id": "spanner.projects.instances.databases.sessions.create",
  7534. // "parameterOrder": [
  7535. // "database"
  7536. // ],
  7537. // "parameters": {
  7538. // "database": {
  7539. // "description": "Required. The database in which the new session is created.",
  7540. // "location": "path",
  7541. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  7542. // "required": true,
  7543. // "type": "string"
  7544. // }
  7545. // },
  7546. // "path": "v1/{+database}/sessions",
  7547. // "request": {
  7548. // "$ref": "CreateSessionRequest"
  7549. // },
  7550. // "response": {
  7551. // "$ref": "Session"
  7552. // },
  7553. // "scopes": [
  7554. // "https://www.googleapis.com/auth/cloud-platform",
  7555. // "https://www.googleapis.com/auth/spanner.data"
  7556. // ]
  7557. // }
  7558. }
  7559. // method id "spanner.projects.instances.databases.sessions.delete":
  7560. type ProjectsInstancesDatabasesSessionsDeleteCall struct {
  7561. s *Service
  7562. name string
  7563. urlParams_ gensupport.URLParams
  7564. ctx_ context.Context
  7565. header_ http.Header
  7566. }
  7567. // Delete: Ends a session, releasing server resources associated with
  7568. // it. This will
  7569. // asynchronously trigger cancellation of any operations that are
  7570. // running with
  7571. // this session.
  7572. func (r *ProjectsInstancesDatabasesSessionsService) Delete(name string) *ProjectsInstancesDatabasesSessionsDeleteCall {
  7573. c := &ProjectsInstancesDatabasesSessionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7574. c.name = name
  7575. return c
  7576. }
  7577. // Fields allows partial responses to be retrieved. See
  7578. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7579. // for more information.
  7580. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsDeleteCall {
  7581. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7582. return c
  7583. }
  7584. // Context sets the context to be used in this call's Do method. Any
  7585. // pending HTTP request will be aborted if the provided context is
  7586. // canceled.
  7587. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsDeleteCall {
  7588. c.ctx_ = ctx
  7589. return c
  7590. }
  7591. // Header returns an http.Header that can be modified by the caller to
  7592. // add HTTP headers to the request.
  7593. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Header() http.Header {
  7594. if c.header_ == nil {
  7595. c.header_ = make(http.Header)
  7596. }
  7597. return c.header_
  7598. }
  7599. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7600. reqHeaders := make(http.Header)
  7601. for k, v := range c.header_ {
  7602. reqHeaders[k] = v
  7603. }
  7604. reqHeaders.Set("User-Agent", c.s.userAgent())
  7605. var body io.Reader = nil
  7606. c.urlParams_.Set("alt", alt)
  7607. c.urlParams_.Set("prettyPrint", "false")
  7608. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  7609. urls += "?" + c.urlParams_.Encode()
  7610. req, err := http.NewRequest("DELETE", urls, body)
  7611. if err != nil {
  7612. return nil, err
  7613. }
  7614. req.Header = reqHeaders
  7615. googleapi.Expand(req.URL, map[string]string{
  7616. "name": c.name,
  7617. })
  7618. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7619. }
  7620. // Do executes the "spanner.projects.instances.databases.sessions.delete" call.
  7621. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7622. // code is an error. Response headers are in either
  7623. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7624. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7625. // check whether the returned error was because http.StatusNotModified
  7626. // was returned.
  7627. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7628. gensupport.SetOptions(c.urlParams_, opts...)
  7629. res, err := c.doRequest("json")
  7630. if res != nil && res.StatusCode == http.StatusNotModified {
  7631. if res.Body != nil {
  7632. res.Body.Close()
  7633. }
  7634. return nil, &googleapi.Error{
  7635. Code: res.StatusCode,
  7636. Header: res.Header,
  7637. }
  7638. }
  7639. if err != nil {
  7640. return nil, err
  7641. }
  7642. defer googleapi.CloseBody(res)
  7643. if err := googleapi.CheckResponse(res); err != nil {
  7644. return nil, err
  7645. }
  7646. ret := &Empty{
  7647. ServerResponse: googleapi.ServerResponse{
  7648. Header: res.Header,
  7649. HTTPStatusCode: res.StatusCode,
  7650. },
  7651. }
  7652. target := &ret
  7653. if err := gensupport.DecodeResponse(target, res); err != nil {
  7654. return nil, err
  7655. }
  7656. return ret, nil
  7657. // {
  7658. // "description": "Ends a session, releasing server resources associated with it. This will\nasynchronously trigger cancellation of any operations that are running with\nthis session.",
  7659. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}",
  7660. // "httpMethod": "DELETE",
  7661. // "id": "spanner.projects.instances.databases.sessions.delete",
  7662. // "parameterOrder": [
  7663. // "name"
  7664. // ],
  7665. // "parameters": {
  7666. // "name": {
  7667. // "description": "Required. The name of the session to delete.",
  7668. // "location": "path",
  7669. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7670. // "required": true,
  7671. // "type": "string"
  7672. // }
  7673. // },
  7674. // "path": "v1/{+name}",
  7675. // "response": {
  7676. // "$ref": "Empty"
  7677. // },
  7678. // "scopes": [
  7679. // "https://www.googleapis.com/auth/cloud-platform",
  7680. // "https://www.googleapis.com/auth/spanner.data"
  7681. // ]
  7682. // }
  7683. }
  7684. // method id "spanner.projects.instances.databases.sessions.executeBatchDml":
  7685. type ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall struct {
  7686. s *Service
  7687. session string
  7688. executebatchdmlrequest *ExecuteBatchDmlRequest
  7689. urlParams_ gensupport.URLParams
  7690. ctx_ context.Context
  7691. header_ http.Header
  7692. }
  7693. // ExecuteBatchDml: Executes a batch of SQL DML statements. This method
  7694. // allows many statements
  7695. // to be run with lower latency than submitting them sequentially
  7696. // with
  7697. // ExecuteSql.
  7698. //
  7699. // Statements are executed in order,
  7700. // sequentially.
  7701. // ExecuteBatchDmlResponse will contain a
  7702. // ResultSet for each DML statement that has successfully executed. If
  7703. // a
  7704. // statement fails, its error status will be returned as part of
  7705. // the
  7706. // ExecuteBatchDmlResponse. Execution will
  7707. // stop at the first failed statement; the remaining statements will not
  7708. // run.
  7709. //
  7710. // ExecuteBatchDml is expected to return an OK status with a response
  7711. // even if
  7712. // there was an error while processing one of the DML statements.
  7713. // Clients must
  7714. // inspect response.status to determine if there were any errors
  7715. // while
  7716. // processing the request.
  7717. //
  7718. // See more details in
  7719. // ExecuteBatchDmlRequest and
  7720. // ExecuteBatchDmlResponse.
  7721. func (r *ProjectsInstancesDatabasesSessionsService) ExecuteBatchDml(session string, executebatchdmlrequest *ExecuteBatchDmlRequest) *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall {
  7722. c := &ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7723. c.session = session
  7724. c.executebatchdmlrequest = executebatchdmlrequest
  7725. return c
  7726. }
  7727. // Fields allows partial responses to be retrieved. See
  7728. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7729. // for more information.
  7730. func (c *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall {
  7731. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7732. return c
  7733. }
  7734. // Context sets the context to be used in this call's Do method. Any
  7735. // pending HTTP request will be aborted if the provided context is
  7736. // canceled.
  7737. func (c *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall {
  7738. c.ctx_ = ctx
  7739. return c
  7740. }
  7741. // Header returns an http.Header that can be modified by the caller to
  7742. // add HTTP headers to the request.
  7743. func (c *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall) Header() http.Header {
  7744. if c.header_ == nil {
  7745. c.header_ = make(http.Header)
  7746. }
  7747. return c.header_
  7748. }
  7749. func (c *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall) doRequest(alt string) (*http.Response, error) {
  7750. reqHeaders := make(http.Header)
  7751. for k, v := range c.header_ {
  7752. reqHeaders[k] = v
  7753. }
  7754. reqHeaders.Set("User-Agent", c.s.userAgent())
  7755. var body io.Reader = nil
  7756. body, err := googleapi.WithoutDataWrapper.JSONReader(c.executebatchdmlrequest)
  7757. if err != nil {
  7758. return nil, err
  7759. }
  7760. reqHeaders.Set("Content-Type", "application/json")
  7761. c.urlParams_.Set("alt", alt)
  7762. c.urlParams_.Set("prettyPrint", "false")
  7763. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:executeBatchDml")
  7764. urls += "?" + c.urlParams_.Encode()
  7765. req, err := http.NewRequest("POST", urls, body)
  7766. if err != nil {
  7767. return nil, err
  7768. }
  7769. req.Header = reqHeaders
  7770. googleapi.Expand(req.URL, map[string]string{
  7771. "session": c.session,
  7772. })
  7773. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7774. }
  7775. // Do executes the "spanner.projects.instances.databases.sessions.executeBatchDml" call.
  7776. // Exactly one of *ExecuteBatchDmlResponse or error will be non-nil. Any
  7777. // non-2xx status code is an error. Response headers are in either
  7778. // *ExecuteBatchDmlResponse.ServerResponse.Header or (if a response was
  7779. // returned at all) in error.(*googleapi.Error).Header. Use
  7780. // googleapi.IsNotModified to check whether the returned error was
  7781. // because http.StatusNotModified was returned.
  7782. func (c *ProjectsInstancesDatabasesSessionsExecuteBatchDmlCall) Do(opts ...googleapi.CallOption) (*ExecuteBatchDmlResponse, error) {
  7783. gensupport.SetOptions(c.urlParams_, opts...)
  7784. res, err := c.doRequest("json")
  7785. if res != nil && res.StatusCode == http.StatusNotModified {
  7786. if res.Body != nil {
  7787. res.Body.Close()
  7788. }
  7789. return nil, &googleapi.Error{
  7790. Code: res.StatusCode,
  7791. Header: res.Header,
  7792. }
  7793. }
  7794. if err != nil {
  7795. return nil, err
  7796. }
  7797. defer googleapi.CloseBody(res)
  7798. if err := googleapi.CheckResponse(res); err != nil {
  7799. return nil, err
  7800. }
  7801. ret := &ExecuteBatchDmlResponse{
  7802. ServerResponse: googleapi.ServerResponse{
  7803. Header: res.Header,
  7804. HTTPStatusCode: res.StatusCode,
  7805. },
  7806. }
  7807. target := &ret
  7808. if err := gensupport.DecodeResponse(target, res); err != nil {
  7809. return nil, err
  7810. }
  7811. return ret, nil
  7812. // {
  7813. // "description": "Executes a batch of SQL DML statements. This method allows many statements\nto be run with lower latency than submitting them sequentially with\nExecuteSql.\n\nStatements are executed in order, sequentially.\nExecuteBatchDmlResponse will contain a\nResultSet for each DML statement that has successfully executed. If a\nstatement fails, its error status will be returned as part of the\nExecuteBatchDmlResponse. Execution will\nstop at the first failed statement; the remaining statements will not run.\n\nExecuteBatchDml is expected to return an OK status with a response even if\nthere was an error while processing one of the DML statements. Clients must\ninspect response.status to determine if there were any errors while\nprocessing the request.\n\nSee more details in\nExecuteBatchDmlRequest and\nExecuteBatchDmlResponse.",
  7814. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:executeBatchDml",
  7815. // "httpMethod": "POST",
  7816. // "id": "spanner.projects.instances.databases.sessions.executeBatchDml",
  7817. // "parameterOrder": [
  7818. // "session"
  7819. // ],
  7820. // "parameters": {
  7821. // "session": {
  7822. // "description": "Required. The session in which the DML statements should be performed.",
  7823. // "location": "path",
  7824. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7825. // "required": true,
  7826. // "type": "string"
  7827. // }
  7828. // },
  7829. // "path": "v1/{+session}:executeBatchDml",
  7830. // "request": {
  7831. // "$ref": "ExecuteBatchDmlRequest"
  7832. // },
  7833. // "response": {
  7834. // "$ref": "ExecuteBatchDmlResponse"
  7835. // },
  7836. // "scopes": [
  7837. // "https://www.googleapis.com/auth/cloud-platform",
  7838. // "https://www.googleapis.com/auth/spanner.data"
  7839. // ]
  7840. // }
  7841. }
  7842. // method id "spanner.projects.instances.databases.sessions.executeSql":
  7843. type ProjectsInstancesDatabasesSessionsExecuteSqlCall struct {
  7844. s *Service
  7845. session string
  7846. executesqlrequest *ExecuteSqlRequest
  7847. urlParams_ gensupport.URLParams
  7848. ctx_ context.Context
  7849. header_ http.Header
  7850. }
  7851. // ExecuteSql: Executes an SQL statement, returning all results in a
  7852. // single reply. This
  7853. // method cannot be used to return a result set larger than 10 MiB;
  7854. // if the query yields more data than that, the query fails with
  7855. // a `FAILED_PRECONDITION` error.
  7856. //
  7857. // Operations inside read-write transactions might return `ABORTED`.
  7858. // If
  7859. // this occurs, the application should restart the transaction from
  7860. // the beginning. See Transaction for more details.
  7861. //
  7862. // Larger result sets can be fetched in streaming fashion by
  7863. // calling
  7864. // ExecuteStreamingSql instead.
  7865. func (r *ProjectsInstancesDatabasesSessionsService) ExecuteSql(session string, executesqlrequest *ExecuteSqlRequest) *ProjectsInstancesDatabasesSessionsExecuteSqlCall {
  7866. c := &ProjectsInstancesDatabasesSessionsExecuteSqlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7867. c.session = session
  7868. c.executesqlrequest = executesqlrequest
  7869. return c
  7870. }
  7871. // Fields allows partial responses to be retrieved. See
  7872. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7873. // for more information.
  7874. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsExecuteSqlCall {
  7875. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7876. return c
  7877. }
  7878. // Context sets the context to be used in this call's Do method. Any
  7879. // pending HTTP request will be aborted if the provided context is
  7880. // canceled.
  7881. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsExecuteSqlCall {
  7882. c.ctx_ = ctx
  7883. return c
  7884. }
  7885. // Header returns an http.Header that can be modified by the caller to
  7886. // add HTTP headers to the request.
  7887. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Header() http.Header {
  7888. if c.header_ == nil {
  7889. c.header_ = make(http.Header)
  7890. }
  7891. return c.header_
  7892. }
  7893. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) doRequest(alt string) (*http.Response, error) {
  7894. reqHeaders := make(http.Header)
  7895. for k, v := range c.header_ {
  7896. reqHeaders[k] = v
  7897. }
  7898. reqHeaders.Set("User-Agent", c.s.userAgent())
  7899. var body io.Reader = nil
  7900. body, err := googleapi.WithoutDataWrapper.JSONReader(c.executesqlrequest)
  7901. if err != nil {
  7902. return nil, err
  7903. }
  7904. reqHeaders.Set("Content-Type", "application/json")
  7905. c.urlParams_.Set("alt", alt)
  7906. c.urlParams_.Set("prettyPrint", "false")
  7907. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:executeSql")
  7908. urls += "?" + c.urlParams_.Encode()
  7909. req, err := http.NewRequest("POST", urls, body)
  7910. if err != nil {
  7911. return nil, err
  7912. }
  7913. req.Header = reqHeaders
  7914. googleapi.Expand(req.URL, map[string]string{
  7915. "session": c.session,
  7916. })
  7917. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7918. }
  7919. // Do executes the "spanner.projects.instances.databases.sessions.executeSql" call.
  7920. // Exactly one of *ResultSet or error will be non-nil. Any non-2xx
  7921. // status code is an error. Response headers are in either
  7922. // *ResultSet.ServerResponse.Header or (if a response was returned at
  7923. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7924. // to check whether the returned error was because
  7925. // http.StatusNotModified was returned.
  7926. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Do(opts ...googleapi.CallOption) (*ResultSet, error) {
  7927. gensupport.SetOptions(c.urlParams_, opts...)
  7928. res, err := c.doRequest("json")
  7929. if res != nil && res.StatusCode == http.StatusNotModified {
  7930. if res.Body != nil {
  7931. res.Body.Close()
  7932. }
  7933. return nil, &googleapi.Error{
  7934. Code: res.StatusCode,
  7935. Header: res.Header,
  7936. }
  7937. }
  7938. if err != nil {
  7939. return nil, err
  7940. }
  7941. defer googleapi.CloseBody(res)
  7942. if err := googleapi.CheckResponse(res); err != nil {
  7943. return nil, err
  7944. }
  7945. ret := &ResultSet{
  7946. ServerResponse: googleapi.ServerResponse{
  7947. Header: res.Header,
  7948. HTTPStatusCode: res.StatusCode,
  7949. },
  7950. }
  7951. target := &ret
  7952. if err := gensupport.DecodeResponse(target, res); err != nil {
  7953. return nil, err
  7954. }
  7955. return ret, nil
  7956. // {
  7957. // "description": "Executes an SQL statement, returning all results in a single reply. This\nmethod cannot be used to return a result set larger than 10 MiB;\nif the query yields more data than that, the query fails with\na `FAILED_PRECONDITION` error.\n\nOperations inside read-write transactions might return `ABORTED`. If\nthis occurs, the application should restart the transaction from\nthe beginning. See Transaction for more details.\n\nLarger result sets can be fetched in streaming fashion by calling\nExecuteStreamingSql instead.",
  7958. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:executeSql",
  7959. // "httpMethod": "POST",
  7960. // "id": "spanner.projects.instances.databases.sessions.executeSql",
  7961. // "parameterOrder": [
  7962. // "session"
  7963. // ],
  7964. // "parameters": {
  7965. // "session": {
  7966. // "description": "Required. The session in which the SQL query should be performed.",
  7967. // "location": "path",
  7968. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7969. // "required": true,
  7970. // "type": "string"
  7971. // }
  7972. // },
  7973. // "path": "v1/{+session}:executeSql",
  7974. // "request": {
  7975. // "$ref": "ExecuteSqlRequest"
  7976. // },
  7977. // "response": {
  7978. // "$ref": "ResultSet"
  7979. // },
  7980. // "scopes": [
  7981. // "https://www.googleapis.com/auth/cloud-platform",
  7982. // "https://www.googleapis.com/auth/spanner.data"
  7983. // ]
  7984. // }
  7985. }
  7986. // method id "spanner.projects.instances.databases.sessions.executeStreamingSql":
  7987. type ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall struct {
  7988. s *Service
  7989. session string
  7990. executesqlrequest *ExecuteSqlRequest
  7991. urlParams_ gensupport.URLParams
  7992. ctx_ context.Context
  7993. header_ http.Header
  7994. }
  7995. // ExecuteStreamingSql: Like ExecuteSql, except returns the result
  7996. // set as a stream. Unlike ExecuteSql, there
  7997. // is no limit on the size of the returned result set. However,
  7998. // no
  7999. // individual row in the result set can exceed 100 MiB, and no
  8000. // column value can exceed 10 MiB.
  8001. func (r *ProjectsInstancesDatabasesSessionsService) ExecuteStreamingSql(session string, executesqlrequest *ExecuteSqlRequest) *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall {
  8002. c := &ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8003. c.session = session
  8004. c.executesqlrequest = executesqlrequest
  8005. return c
  8006. }
  8007. // Fields allows partial responses to be retrieved. See
  8008. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8009. // for more information.
  8010. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall {
  8011. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8012. return c
  8013. }
  8014. // Context sets the context to be used in this call's Do method. Any
  8015. // pending HTTP request will be aborted if the provided context is
  8016. // canceled.
  8017. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall {
  8018. c.ctx_ = ctx
  8019. return c
  8020. }
  8021. // Header returns an http.Header that can be modified by the caller to
  8022. // add HTTP headers to the request.
  8023. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Header() http.Header {
  8024. if c.header_ == nil {
  8025. c.header_ = make(http.Header)
  8026. }
  8027. return c.header_
  8028. }
  8029. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) doRequest(alt string) (*http.Response, error) {
  8030. reqHeaders := make(http.Header)
  8031. for k, v := range c.header_ {
  8032. reqHeaders[k] = v
  8033. }
  8034. reqHeaders.Set("User-Agent", c.s.userAgent())
  8035. var body io.Reader = nil
  8036. body, err := googleapi.WithoutDataWrapper.JSONReader(c.executesqlrequest)
  8037. if err != nil {
  8038. return nil, err
  8039. }
  8040. reqHeaders.Set("Content-Type", "application/json")
  8041. c.urlParams_.Set("alt", alt)
  8042. c.urlParams_.Set("prettyPrint", "false")
  8043. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:executeStreamingSql")
  8044. urls += "?" + c.urlParams_.Encode()
  8045. req, err := http.NewRequest("POST", urls, body)
  8046. if err != nil {
  8047. return nil, err
  8048. }
  8049. req.Header = reqHeaders
  8050. googleapi.Expand(req.URL, map[string]string{
  8051. "session": c.session,
  8052. })
  8053. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8054. }
  8055. // Do executes the "spanner.projects.instances.databases.sessions.executeStreamingSql" call.
  8056. // Exactly one of *PartialResultSet or error will be non-nil. Any
  8057. // non-2xx status code is an error. Response headers are in either
  8058. // *PartialResultSet.ServerResponse.Header or (if a response was
  8059. // returned at all) in error.(*googleapi.Error).Header. Use
  8060. // googleapi.IsNotModified to check whether the returned error was
  8061. // because http.StatusNotModified was returned.
  8062. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Do(opts ...googleapi.CallOption) (*PartialResultSet, error) {
  8063. gensupport.SetOptions(c.urlParams_, opts...)
  8064. res, err := c.doRequest("json")
  8065. if res != nil && res.StatusCode == http.StatusNotModified {
  8066. if res.Body != nil {
  8067. res.Body.Close()
  8068. }
  8069. return nil, &googleapi.Error{
  8070. Code: res.StatusCode,
  8071. Header: res.Header,
  8072. }
  8073. }
  8074. if err != nil {
  8075. return nil, err
  8076. }
  8077. defer googleapi.CloseBody(res)
  8078. if err := googleapi.CheckResponse(res); err != nil {
  8079. return nil, err
  8080. }
  8081. ret := &PartialResultSet{
  8082. ServerResponse: googleapi.ServerResponse{
  8083. Header: res.Header,
  8084. HTTPStatusCode: res.StatusCode,
  8085. },
  8086. }
  8087. target := &ret
  8088. if err := gensupport.DecodeResponse(target, res); err != nil {
  8089. return nil, err
  8090. }
  8091. return ret, nil
  8092. // {
  8093. // "description": "Like ExecuteSql, except returns the result\nset as a stream. Unlike ExecuteSql, there\nis no limit on the size of the returned result set. However, no\nindividual row in the result set can exceed 100 MiB, and no\ncolumn value can exceed 10 MiB.",
  8094. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:executeStreamingSql",
  8095. // "httpMethod": "POST",
  8096. // "id": "spanner.projects.instances.databases.sessions.executeStreamingSql",
  8097. // "parameterOrder": [
  8098. // "session"
  8099. // ],
  8100. // "parameters": {
  8101. // "session": {
  8102. // "description": "Required. The session in which the SQL query should be performed.",
  8103. // "location": "path",
  8104. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8105. // "required": true,
  8106. // "type": "string"
  8107. // }
  8108. // },
  8109. // "path": "v1/{+session}:executeStreamingSql",
  8110. // "request": {
  8111. // "$ref": "ExecuteSqlRequest"
  8112. // },
  8113. // "response": {
  8114. // "$ref": "PartialResultSet"
  8115. // },
  8116. // "scopes": [
  8117. // "https://www.googleapis.com/auth/cloud-platform",
  8118. // "https://www.googleapis.com/auth/spanner.data"
  8119. // ]
  8120. // }
  8121. }
  8122. // method id "spanner.projects.instances.databases.sessions.get":
  8123. type ProjectsInstancesDatabasesSessionsGetCall struct {
  8124. s *Service
  8125. name string
  8126. urlParams_ gensupport.URLParams
  8127. ifNoneMatch_ string
  8128. ctx_ context.Context
  8129. header_ http.Header
  8130. }
  8131. // Get: Gets a session. Returns `NOT_FOUND` if the session does not
  8132. // exist.
  8133. // This is mainly useful for determining whether a session is
  8134. // still
  8135. // alive.
  8136. func (r *ProjectsInstancesDatabasesSessionsService) Get(name string) *ProjectsInstancesDatabasesSessionsGetCall {
  8137. c := &ProjectsInstancesDatabasesSessionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8138. c.name = name
  8139. return c
  8140. }
  8141. // Fields allows partial responses to be retrieved. See
  8142. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8143. // for more information.
  8144. func (c *ProjectsInstancesDatabasesSessionsGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsGetCall {
  8145. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8146. return c
  8147. }
  8148. // IfNoneMatch sets the optional parameter which makes the operation
  8149. // fail if the object's ETag matches the given value. This is useful for
  8150. // getting updates only after the object has changed since the last
  8151. // request. Use googleapi.IsNotModified to check whether the response
  8152. // error from Do is the result of In-None-Match.
  8153. func (c *ProjectsInstancesDatabasesSessionsGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesSessionsGetCall {
  8154. c.ifNoneMatch_ = entityTag
  8155. return c
  8156. }
  8157. // Context sets the context to be used in this call's Do method. Any
  8158. // pending HTTP request will be aborted if the provided context is
  8159. // canceled.
  8160. func (c *ProjectsInstancesDatabasesSessionsGetCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsGetCall {
  8161. c.ctx_ = ctx
  8162. return c
  8163. }
  8164. // Header returns an http.Header that can be modified by the caller to
  8165. // add HTTP headers to the request.
  8166. func (c *ProjectsInstancesDatabasesSessionsGetCall) Header() http.Header {
  8167. if c.header_ == nil {
  8168. c.header_ = make(http.Header)
  8169. }
  8170. return c.header_
  8171. }
  8172. func (c *ProjectsInstancesDatabasesSessionsGetCall) doRequest(alt string) (*http.Response, error) {
  8173. reqHeaders := make(http.Header)
  8174. for k, v := range c.header_ {
  8175. reqHeaders[k] = v
  8176. }
  8177. reqHeaders.Set("User-Agent", c.s.userAgent())
  8178. if c.ifNoneMatch_ != "" {
  8179. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8180. }
  8181. var body io.Reader = nil
  8182. c.urlParams_.Set("alt", alt)
  8183. c.urlParams_.Set("prettyPrint", "false")
  8184. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  8185. urls += "?" + c.urlParams_.Encode()
  8186. req, err := http.NewRequest("GET", urls, body)
  8187. if err != nil {
  8188. return nil, err
  8189. }
  8190. req.Header = reqHeaders
  8191. googleapi.Expand(req.URL, map[string]string{
  8192. "name": c.name,
  8193. })
  8194. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8195. }
  8196. // Do executes the "spanner.projects.instances.databases.sessions.get" call.
  8197. // Exactly one of *Session or error will be non-nil. Any non-2xx status
  8198. // code is an error. Response headers are in either
  8199. // *Session.ServerResponse.Header or (if a response was returned at all)
  8200. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8201. // check whether the returned error was because http.StatusNotModified
  8202. // was returned.
  8203. func (c *ProjectsInstancesDatabasesSessionsGetCall) Do(opts ...googleapi.CallOption) (*Session, error) {
  8204. gensupport.SetOptions(c.urlParams_, opts...)
  8205. res, err := c.doRequest("json")
  8206. if res != nil && res.StatusCode == http.StatusNotModified {
  8207. if res.Body != nil {
  8208. res.Body.Close()
  8209. }
  8210. return nil, &googleapi.Error{
  8211. Code: res.StatusCode,
  8212. Header: res.Header,
  8213. }
  8214. }
  8215. if err != nil {
  8216. return nil, err
  8217. }
  8218. defer googleapi.CloseBody(res)
  8219. if err := googleapi.CheckResponse(res); err != nil {
  8220. return nil, err
  8221. }
  8222. ret := &Session{
  8223. ServerResponse: googleapi.ServerResponse{
  8224. Header: res.Header,
  8225. HTTPStatusCode: res.StatusCode,
  8226. },
  8227. }
  8228. target := &ret
  8229. if err := gensupport.DecodeResponse(target, res); err != nil {
  8230. return nil, err
  8231. }
  8232. return ret, nil
  8233. // {
  8234. // "description": "Gets a session. Returns `NOT_FOUND` if the session does not exist.\nThis is mainly useful for determining whether a session is still\nalive.",
  8235. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}",
  8236. // "httpMethod": "GET",
  8237. // "id": "spanner.projects.instances.databases.sessions.get",
  8238. // "parameterOrder": [
  8239. // "name"
  8240. // ],
  8241. // "parameters": {
  8242. // "name": {
  8243. // "description": "Required. The name of the session to retrieve.",
  8244. // "location": "path",
  8245. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8246. // "required": true,
  8247. // "type": "string"
  8248. // }
  8249. // },
  8250. // "path": "v1/{+name}",
  8251. // "response": {
  8252. // "$ref": "Session"
  8253. // },
  8254. // "scopes": [
  8255. // "https://www.googleapis.com/auth/cloud-platform",
  8256. // "https://www.googleapis.com/auth/spanner.data"
  8257. // ]
  8258. // }
  8259. }
  8260. // method id "spanner.projects.instances.databases.sessions.list":
  8261. type ProjectsInstancesDatabasesSessionsListCall struct {
  8262. s *Service
  8263. database string
  8264. urlParams_ gensupport.URLParams
  8265. ifNoneMatch_ string
  8266. ctx_ context.Context
  8267. header_ http.Header
  8268. }
  8269. // List: Lists all sessions in a given database.
  8270. func (r *ProjectsInstancesDatabasesSessionsService) List(database string) *ProjectsInstancesDatabasesSessionsListCall {
  8271. c := &ProjectsInstancesDatabasesSessionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8272. c.database = database
  8273. return c
  8274. }
  8275. // Filter sets the optional parameter "filter": An expression for
  8276. // filtering the results of the request. Filter rules are
  8277. // case insensitive. The fields eligible for filtering are:
  8278. //
  8279. // * `labels.key` where key is the name of a label
  8280. //
  8281. // Some examples of using filters are:
  8282. //
  8283. // * `labels.env:*` --> The session has the label "env".
  8284. // * `labels.env:dev` --> The session has the label "env" and the
  8285. // value of
  8286. // the label contains the string "dev".
  8287. func (c *ProjectsInstancesDatabasesSessionsListCall) Filter(filter string) *ProjectsInstancesDatabasesSessionsListCall {
  8288. c.urlParams_.Set("filter", filter)
  8289. return c
  8290. }
  8291. // PageSize sets the optional parameter "pageSize": Number of sessions
  8292. // to be returned in the response. If 0 or less, defaults
  8293. // to the server's maximum allowed page size.
  8294. func (c *ProjectsInstancesDatabasesSessionsListCall) PageSize(pageSize int64) *ProjectsInstancesDatabasesSessionsListCall {
  8295. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8296. return c
  8297. }
  8298. // PageToken sets the optional parameter "pageToken": If non-empty,
  8299. // `page_token` should contain a
  8300. // next_page_token from a previous
  8301. // ListSessionsResponse.
  8302. func (c *ProjectsInstancesDatabasesSessionsListCall) PageToken(pageToken string) *ProjectsInstancesDatabasesSessionsListCall {
  8303. c.urlParams_.Set("pageToken", pageToken)
  8304. return c
  8305. }
  8306. // Fields allows partial responses to be retrieved. See
  8307. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8308. // for more information.
  8309. func (c *ProjectsInstancesDatabasesSessionsListCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsListCall {
  8310. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8311. return c
  8312. }
  8313. // IfNoneMatch sets the optional parameter which makes the operation
  8314. // fail if the object's ETag matches the given value. This is useful for
  8315. // getting updates only after the object has changed since the last
  8316. // request. Use googleapi.IsNotModified to check whether the response
  8317. // error from Do is the result of In-None-Match.
  8318. func (c *ProjectsInstancesDatabasesSessionsListCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesSessionsListCall {
  8319. c.ifNoneMatch_ = entityTag
  8320. return c
  8321. }
  8322. // Context sets the context to be used in this call's Do method. Any
  8323. // pending HTTP request will be aborted if the provided context is
  8324. // canceled.
  8325. func (c *ProjectsInstancesDatabasesSessionsListCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsListCall {
  8326. c.ctx_ = ctx
  8327. return c
  8328. }
  8329. // Header returns an http.Header that can be modified by the caller to
  8330. // add HTTP headers to the request.
  8331. func (c *ProjectsInstancesDatabasesSessionsListCall) Header() http.Header {
  8332. if c.header_ == nil {
  8333. c.header_ = make(http.Header)
  8334. }
  8335. return c.header_
  8336. }
  8337. func (c *ProjectsInstancesDatabasesSessionsListCall) doRequest(alt string) (*http.Response, error) {
  8338. reqHeaders := make(http.Header)
  8339. for k, v := range c.header_ {
  8340. reqHeaders[k] = v
  8341. }
  8342. reqHeaders.Set("User-Agent", c.s.userAgent())
  8343. if c.ifNoneMatch_ != "" {
  8344. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8345. }
  8346. var body io.Reader = nil
  8347. c.urlParams_.Set("alt", alt)
  8348. c.urlParams_.Set("prettyPrint", "false")
  8349. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/sessions")
  8350. urls += "?" + c.urlParams_.Encode()
  8351. req, err := http.NewRequest("GET", urls, body)
  8352. if err != nil {
  8353. return nil, err
  8354. }
  8355. req.Header = reqHeaders
  8356. googleapi.Expand(req.URL, map[string]string{
  8357. "database": c.database,
  8358. })
  8359. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8360. }
  8361. // Do executes the "spanner.projects.instances.databases.sessions.list" call.
  8362. // Exactly one of *ListSessionsResponse or error will be non-nil. Any
  8363. // non-2xx status code is an error. Response headers are in either
  8364. // *ListSessionsResponse.ServerResponse.Header or (if a response was
  8365. // returned at all) in error.(*googleapi.Error).Header. Use
  8366. // googleapi.IsNotModified to check whether the returned error was
  8367. // because http.StatusNotModified was returned.
  8368. func (c *ProjectsInstancesDatabasesSessionsListCall) Do(opts ...googleapi.CallOption) (*ListSessionsResponse, error) {
  8369. gensupport.SetOptions(c.urlParams_, opts...)
  8370. res, err := c.doRequest("json")
  8371. if res != nil && res.StatusCode == http.StatusNotModified {
  8372. if res.Body != nil {
  8373. res.Body.Close()
  8374. }
  8375. return nil, &googleapi.Error{
  8376. Code: res.StatusCode,
  8377. Header: res.Header,
  8378. }
  8379. }
  8380. if err != nil {
  8381. return nil, err
  8382. }
  8383. defer googleapi.CloseBody(res)
  8384. if err := googleapi.CheckResponse(res); err != nil {
  8385. return nil, err
  8386. }
  8387. ret := &ListSessionsResponse{
  8388. ServerResponse: googleapi.ServerResponse{
  8389. Header: res.Header,
  8390. HTTPStatusCode: res.StatusCode,
  8391. },
  8392. }
  8393. target := &ret
  8394. if err := gensupport.DecodeResponse(target, res); err != nil {
  8395. return nil, err
  8396. }
  8397. return ret, nil
  8398. // {
  8399. // "description": "Lists all sessions in a given database.",
  8400. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions",
  8401. // "httpMethod": "GET",
  8402. // "id": "spanner.projects.instances.databases.sessions.list",
  8403. // "parameterOrder": [
  8404. // "database"
  8405. // ],
  8406. // "parameters": {
  8407. // "database": {
  8408. // "description": "Required. The database in which to list sessions.",
  8409. // "location": "path",
  8410. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  8411. // "required": true,
  8412. // "type": "string"
  8413. // },
  8414. // "filter": {
  8415. // "description": "An expression for filtering the results of the request. Filter rules are\ncase insensitive. The fields eligible for filtering are:\n\n * `labels.key` where key is the name of a label\n\nSome examples of using filters are:\n\n * `labels.env:*` --\u003e The session has the label \"env\".\n * `labels.env:dev` --\u003e The session has the label \"env\" and the value of\n the label contains the string \"dev\".",
  8416. // "location": "query",
  8417. // "type": "string"
  8418. // },
  8419. // "pageSize": {
  8420. // "description": "Number of sessions to be returned in the response. If 0 or less, defaults\nto the server's maximum allowed page size.",
  8421. // "format": "int32",
  8422. // "location": "query",
  8423. // "type": "integer"
  8424. // },
  8425. // "pageToken": {
  8426. // "description": "If non-empty, `page_token` should contain a\nnext_page_token from a previous\nListSessionsResponse.",
  8427. // "location": "query",
  8428. // "type": "string"
  8429. // }
  8430. // },
  8431. // "path": "v1/{+database}/sessions",
  8432. // "response": {
  8433. // "$ref": "ListSessionsResponse"
  8434. // },
  8435. // "scopes": [
  8436. // "https://www.googleapis.com/auth/cloud-platform",
  8437. // "https://www.googleapis.com/auth/spanner.data"
  8438. // ]
  8439. // }
  8440. }
  8441. // Pages invokes f for each page of results.
  8442. // A non-nil error returned from f will halt the iteration.
  8443. // The provided context supersedes any context provided to the Context method.
  8444. func (c *ProjectsInstancesDatabasesSessionsListCall) Pages(ctx context.Context, f func(*ListSessionsResponse) error) error {
  8445. c.ctx_ = ctx
  8446. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8447. for {
  8448. x, err := c.Do()
  8449. if err != nil {
  8450. return err
  8451. }
  8452. if err := f(x); err != nil {
  8453. return err
  8454. }
  8455. if x.NextPageToken == "" {
  8456. return nil
  8457. }
  8458. c.PageToken(x.NextPageToken)
  8459. }
  8460. }
  8461. // method id "spanner.projects.instances.databases.sessions.partitionQuery":
  8462. type ProjectsInstancesDatabasesSessionsPartitionQueryCall struct {
  8463. s *Service
  8464. session string
  8465. partitionqueryrequest *PartitionQueryRequest
  8466. urlParams_ gensupport.URLParams
  8467. ctx_ context.Context
  8468. header_ http.Header
  8469. }
  8470. // PartitionQuery: Creates a set of partition tokens that can be used to
  8471. // execute a query
  8472. // operation in parallel. Each of the returned partition tokens can be
  8473. // used
  8474. // by ExecuteStreamingSql to specify a subset
  8475. // of the query result to read. The same session and read-only
  8476. // transaction
  8477. // must be used by the PartitionQueryRequest used to create
  8478. // the
  8479. // partition tokens and the ExecuteSqlRequests that use the partition
  8480. // tokens.
  8481. //
  8482. // Partition tokens become invalid when the session used to create
  8483. // them
  8484. // is deleted, is idle for too long, begins a new transaction, or
  8485. // becomes too
  8486. // old. When any of these happen, it is not possible to resume the
  8487. // query, and
  8488. // the whole operation must be restarted from the beginning.
  8489. func (r *ProjectsInstancesDatabasesSessionsService) PartitionQuery(session string, partitionqueryrequest *PartitionQueryRequest) *ProjectsInstancesDatabasesSessionsPartitionQueryCall {
  8490. c := &ProjectsInstancesDatabasesSessionsPartitionQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8491. c.session = session
  8492. c.partitionqueryrequest = partitionqueryrequest
  8493. return c
  8494. }
  8495. // Fields allows partial responses to be retrieved. See
  8496. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8497. // for more information.
  8498. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsPartitionQueryCall {
  8499. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8500. return c
  8501. }
  8502. // Context sets the context to be used in this call's Do method. Any
  8503. // pending HTTP request will be aborted if the provided context is
  8504. // canceled.
  8505. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsPartitionQueryCall {
  8506. c.ctx_ = ctx
  8507. return c
  8508. }
  8509. // Header returns an http.Header that can be modified by the caller to
  8510. // add HTTP headers to the request.
  8511. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Header() http.Header {
  8512. if c.header_ == nil {
  8513. c.header_ = make(http.Header)
  8514. }
  8515. return c.header_
  8516. }
  8517. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) doRequest(alt string) (*http.Response, error) {
  8518. reqHeaders := make(http.Header)
  8519. for k, v := range c.header_ {
  8520. reqHeaders[k] = v
  8521. }
  8522. reqHeaders.Set("User-Agent", c.s.userAgent())
  8523. var body io.Reader = nil
  8524. body, err := googleapi.WithoutDataWrapper.JSONReader(c.partitionqueryrequest)
  8525. if err != nil {
  8526. return nil, err
  8527. }
  8528. reqHeaders.Set("Content-Type", "application/json")
  8529. c.urlParams_.Set("alt", alt)
  8530. c.urlParams_.Set("prettyPrint", "false")
  8531. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:partitionQuery")
  8532. urls += "?" + c.urlParams_.Encode()
  8533. req, err := http.NewRequest("POST", urls, body)
  8534. if err != nil {
  8535. return nil, err
  8536. }
  8537. req.Header = reqHeaders
  8538. googleapi.Expand(req.URL, map[string]string{
  8539. "session": c.session,
  8540. })
  8541. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8542. }
  8543. // Do executes the "spanner.projects.instances.databases.sessions.partitionQuery" call.
  8544. // Exactly one of *PartitionResponse or error will be non-nil. Any
  8545. // non-2xx status code is an error. Response headers are in either
  8546. // *PartitionResponse.ServerResponse.Header or (if a response was
  8547. // returned at all) in error.(*googleapi.Error).Header. Use
  8548. // googleapi.IsNotModified to check whether the returned error was
  8549. // because http.StatusNotModified was returned.
  8550. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Do(opts ...googleapi.CallOption) (*PartitionResponse, error) {
  8551. gensupport.SetOptions(c.urlParams_, opts...)
  8552. res, err := c.doRequest("json")
  8553. if res != nil && res.StatusCode == http.StatusNotModified {
  8554. if res.Body != nil {
  8555. res.Body.Close()
  8556. }
  8557. return nil, &googleapi.Error{
  8558. Code: res.StatusCode,
  8559. Header: res.Header,
  8560. }
  8561. }
  8562. if err != nil {
  8563. return nil, err
  8564. }
  8565. defer googleapi.CloseBody(res)
  8566. if err := googleapi.CheckResponse(res); err != nil {
  8567. return nil, err
  8568. }
  8569. ret := &PartitionResponse{
  8570. ServerResponse: googleapi.ServerResponse{
  8571. Header: res.Header,
  8572. HTTPStatusCode: res.StatusCode,
  8573. },
  8574. }
  8575. target := &ret
  8576. if err := gensupport.DecodeResponse(target, res); err != nil {
  8577. return nil, err
  8578. }
  8579. return ret, nil
  8580. // {
  8581. // "description": "Creates a set of partition tokens that can be used to execute a query\noperation in parallel. Each of the returned partition tokens can be used\nby ExecuteStreamingSql to specify a subset\nof the query result to read. The same session and read-only transaction\nmust be used by the PartitionQueryRequest used to create the\npartition tokens and the ExecuteSqlRequests that use the partition tokens.\n\nPartition tokens become invalid when the session used to create them\nis deleted, is idle for too long, begins a new transaction, or becomes too\nold. When any of these happen, it is not possible to resume the query, and\nthe whole operation must be restarted from the beginning.",
  8582. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:partitionQuery",
  8583. // "httpMethod": "POST",
  8584. // "id": "spanner.projects.instances.databases.sessions.partitionQuery",
  8585. // "parameterOrder": [
  8586. // "session"
  8587. // ],
  8588. // "parameters": {
  8589. // "session": {
  8590. // "description": "Required. The session used to create the partitions.",
  8591. // "location": "path",
  8592. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8593. // "required": true,
  8594. // "type": "string"
  8595. // }
  8596. // },
  8597. // "path": "v1/{+session}:partitionQuery",
  8598. // "request": {
  8599. // "$ref": "PartitionQueryRequest"
  8600. // },
  8601. // "response": {
  8602. // "$ref": "PartitionResponse"
  8603. // },
  8604. // "scopes": [
  8605. // "https://www.googleapis.com/auth/cloud-platform",
  8606. // "https://www.googleapis.com/auth/spanner.data"
  8607. // ]
  8608. // }
  8609. }
  8610. // method id "spanner.projects.instances.databases.sessions.partitionRead":
  8611. type ProjectsInstancesDatabasesSessionsPartitionReadCall struct {
  8612. s *Service
  8613. session string
  8614. partitionreadrequest *PartitionReadRequest
  8615. urlParams_ gensupport.URLParams
  8616. ctx_ context.Context
  8617. header_ http.Header
  8618. }
  8619. // PartitionRead: Creates a set of partition tokens that can be used to
  8620. // execute a read
  8621. // operation in parallel. Each of the returned partition tokens can be
  8622. // used
  8623. // by StreamingRead to specify a subset of the read
  8624. // result to read. The same session and read-only transaction must be
  8625. // used by
  8626. // the PartitionReadRequest used to create the partition tokens and
  8627. // the
  8628. // ReadRequests that use the partition tokens. There are no
  8629. // ordering
  8630. // guarantees on rows returned among the returned partition tokens, or
  8631. // even
  8632. // within each individual StreamingRead call issued with a
  8633. // partition_token.
  8634. //
  8635. // Partition tokens become invalid when the session used to create
  8636. // them
  8637. // is deleted, is idle for too long, begins a new transaction, or
  8638. // becomes too
  8639. // old. When any of these happen, it is not possible to resume the
  8640. // read, and
  8641. // the whole operation must be restarted from the beginning.
  8642. func (r *ProjectsInstancesDatabasesSessionsService) PartitionRead(session string, partitionreadrequest *PartitionReadRequest) *ProjectsInstancesDatabasesSessionsPartitionReadCall {
  8643. c := &ProjectsInstancesDatabasesSessionsPartitionReadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8644. c.session = session
  8645. c.partitionreadrequest = partitionreadrequest
  8646. return c
  8647. }
  8648. // Fields allows partial responses to be retrieved. See
  8649. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8650. // for more information.
  8651. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsPartitionReadCall {
  8652. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8653. return c
  8654. }
  8655. // Context sets the context to be used in this call's Do method. Any
  8656. // pending HTTP request will be aborted if the provided context is
  8657. // canceled.
  8658. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsPartitionReadCall {
  8659. c.ctx_ = ctx
  8660. return c
  8661. }
  8662. // Header returns an http.Header that can be modified by the caller to
  8663. // add HTTP headers to the request.
  8664. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Header() http.Header {
  8665. if c.header_ == nil {
  8666. c.header_ = make(http.Header)
  8667. }
  8668. return c.header_
  8669. }
  8670. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) doRequest(alt string) (*http.Response, error) {
  8671. reqHeaders := make(http.Header)
  8672. for k, v := range c.header_ {
  8673. reqHeaders[k] = v
  8674. }
  8675. reqHeaders.Set("User-Agent", c.s.userAgent())
  8676. var body io.Reader = nil
  8677. body, err := googleapi.WithoutDataWrapper.JSONReader(c.partitionreadrequest)
  8678. if err != nil {
  8679. return nil, err
  8680. }
  8681. reqHeaders.Set("Content-Type", "application/json")
  8682. c.urlParams_.Set("alt", alt)
  8683. c.urlParams_.Set("prettyPrint", "false")
  8684. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:partitionRead")
  8685. urls += "?" + c.urlParams_.Encode()
  8686. req, err := http.NewRequest("POST", urls, body)
  8687. if err != nil {
  8688. return nil, err
  8689. }
  8690. req.Header = reqHeaders
  8691. googleapi.Expand(req.URL, map[string]string{
  8692. "session": c.session,
  8693. })
  8694. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8695. }
  8696. // Do executes the "spanner.projects.instances.databases.sessions.partitionRead" call.
  8697. // Exactly one of *PartitionResponse or error will be non-nil. Any
  8698. // non-2xx status code is an error. Response headers are in either
  8699. // *PartitionResponse.ServerResponse.Header or (if a response was
  8700. // returned at all) in error.(*googleapi.Error).Header. Use
  8701. // googleapi.IsNotModified to check whether the returned error was
  8702. // because http.StatusNotModified was returned.
  8703. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Do(opts ...googleapi.CallOption) (*PartitionResponse, error) {
  8704. gensupport.SetOptions(c.urlParams_, opts...)
  8705. res, err := c.doRequest("json")
  8706. if res != nil && res.StatusCode == http.StatusNotModified {
  8707. if res.Body != nil {
  8708. res.Body.Close()
  8709. }
  8710. return nil, &googleapi.Error{
  8711. Code: res.StatusCode,
  8712. Header: res.Header,
  8713. }
  8714. }
  8715. if err != nil {
  8716. return nil, err
  8717. }
  8718. defer googleapi.CloseBody(res)
  8719. if err := googleapi.CheckResponse(res); err != nil {
  8720. return nil, err
  8721. }
  8722. ret := &PartitionResponse{
  8723. ServerResponse: googleapi.ServerResponse{
  8724. Header: res.Header,
  8725. HTTPStatusCode: res.StatusCode,
  8726. },
  8727. }
  8728. target := &ret
  8729. if err := gensupport.DecodeResponse(target, res); err != nil {
  8730. return nil, err
  8731. }
  8732. return ret, nil
  8733. // {
  8734. // "description": "Creates a set of partition tokens that can be used to execute a read\noperation in parallel. Each of the returned partition tokens can be used\nby StreamingRead to specify a subset of the read\nresult to read. The same session and read-only transaction must be used by\nthe PartitionReadRequest used to create the partition tokens and the\nReadRequests that use the partition tokens. There are no ordering\nguarantees on rows returned among the returned partition tokens, or even\nwithin each individual StreamingRead call issued with a partition_token.\n\nPartition tokens become invalid when the session used to create them\nis deleted, is idle for too long, begins a new transaction, or becomes too\nold. When any of these happen, it is not possible to resume the read, and\nthe whole operation must be restarted from the beginning.",
  8735. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:partitionRead",
  8736. // "httpMethod": "POST",
  8737. // "id": "spanner.projects.instances.databases.sessions.partitionRead",
  8738. // "parameterOrder": [
  8739. // "session"
  8740. // ],
  8741. // "parameters": {
  8742. // "session": {
  8743. // "description": "Required. The session used to create the partitions.",
  8744. // "location": "path",
  8745. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8746. // "required": true,
  8747. // "type": "string"
  8748. // }
  8749. // },
  8750. // "path": "v1/{+session}:partitionRead",
  8751. // "request": {
  8752. // "$ref": "PartitionReadRequest"
  8753. // },
  8754. // "response": {
  8755. // "$ref": "PartitionResponse"
  8756. // },
  8757. // "scopes": [
  8758. // "https://www.googleapis.com/auth/cloud-platform",
  8759. // "https://www.googleapis.com/auth/spanner.data"
  8760. // ]
  8761. // }
  8762. }
  8763. // method id "spanner.projects.instances.databases.sessions.read":
  8764. type ProjectsInstancesDatabasesSessionsReadCall struct {
  8765. s *Service
  8766. session string
  8767. readrequest *ReadRequest
  8768. urlParams_ gensupport.URLParams
  8769. ctx_ context.Context
  8770. header_ http.Header
  8771. }
  8772. // Read: Reads rows from the database using key lookups and scans, as
  8773. // a
  8774. // simple key/value style alternative to
  8775. // ExecuteSql. This method cannot be used to
  8776. // return a result set larger than 10 MiB; if the read matches more
  8777. // data than that, the read fails with a
  8778. // `FAILED_PRECONDITION`
  8779. // error.
  8780. //
  8781. // Reads inside read-write transactions might return `ABORTED`. If
  8782. // this occurs, the application should restart the transaction from
  8783. // the beginning. See Transaction for more details.
  8784. //
  8785. // Larger result sets can be yielded in streaming fashion by
  8786. // calling
  8787. // StreamingRead instead.
  8788. func (r *ProjectsInstancesDatabasesSessionsService) Read(session string, readrequest *ReadRequest) *ProjectsInstancesDatabasesSessionsReadCall {
  8789. c := &ProjectsInstancesDatabasesSessionsReadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8790. c.session = session
  8791. c.readrequest = readrequest
  8792. return c
  8793. }
  8794. // Fields allows partial responses to be retrieved. See
  8795. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8796. // for more information.
  8797. func (c *ProjectsInstancesDatabasesSessionsReadCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsReadCall {
  8798. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8799. return c
  8800. }
  8801. // Context sets the context to be used in this call's Do method. Any
  8802. // pending HTTP request will be aborted if the provided context is
  8803. // canceled.
  8804. func (c *ProjectsInstancesDatabasesSessionsReadCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsReadCall {
  8805. c.ctx_ = ctx
  8806. return c
  8807. }
  8808. // Header returns an http.Header that can be modified by the caller to
  8809. // add HTTP headers to the request.
  8810. func (c *ProjectsInstancesDatabasesSessionsReadCall) Header() http.Header {
  8811. if c.header_ == nil {
  8812. c.header_ = make(http.Header)
  8813. }
  8814. return c.header_
  8815. }
  8816. func (c *ProjectsInstancesDatabasesSessionsReadCall) doRequest(alt string) (*http.Response, error) {
  8817. reqHeaders := make(http.Header)
  8818. for k, v := range c.header_ {
  8819. reqHeaders[k] = v
  8820. }
  8821. reqHeaders.Set("User-Agent", c.s.userAgent())
  8822. var body io.Reader = nil
  8823. body, err := googleapi.WithoutDataWrapper.JSONReader(c.readrequest)
  8824. if err != nil {
  8825. return nil, err
  8826. }
  8827. reqHeaders.Set("Content-Type", "application/json")
  8828. c.urlParams_.Set("alt", alt)
  8829. c.urlParams_.Set("prettyPrint", "false")
  8830. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:read")
  8831. urls += "?" + c.urlParams_.Encode()
  8832. req, err := http.NewRequest("POST", urls, body)
  8833. if err != nil {
  8834. return nil, err
  8835. }
  8836. req.Header = reqHeaders
  8837. googleapi.Expand(req.URL, map[string]string{
  8838. "session": c.session,
  8839. })
  8840. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8841. }
  8842. // Do executes the "spanner.projects.instances.databases.sessions.read" call.
  8843. // Exactly one of *ResultSet or error will be non-nil. Any non-2xx
  8844. // status code is an error. Response headers are in either
  8845. // *ResultSet.ServerResponse.Header or (if a response was returned at
  8846. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8847. // to check whether the returned error was because
  8848. // http.StatusNotModified was returned.
  8849. func (c *ProjectsInstancesDatabasesSessionsReadCall) Do(opts ...googleapi.CallOption) (*ResultSet, error) {
  8850. gensupport.SetOptions(c.urlParams_, opts...)
  8851. res, err := c.doRequest("json")
  8852. if res != nil && res.StatusCode == http.StatusNotModified {
  8853. if res.Body != nil {
  8854. res.Body.Close()
  8855. }
  8856. return nil, &googleapi.Error{
  8857. Code: res.StatusCode,
  8858. Header: res.Header,
  8859. }
  8860. }
  8861. if err != nil {
  8862. return nil, err
  8863. }
  8864. defer googleapi.CloseBody(res)
  8865. if err := googleapi.CheckResponse(res); err != nil {
  8866. return nil, err
  8867. }
  8868. ret := &ResultSet{
  8869. ServerResponse: googleapi.ServerResponse{
  8870. Header: res.Header,
  8871. HTTPStatusCode: res.StatusCode,
  8872. },
  8873. }
  8874. target := &ret
  8875. if err := gensupport.DecodeResponse(target, res); err != nil {
  8876. return nil, err
  8877. }
  8878. return ret, nil
  8879. // {
  8880. // "description": "Reads rows from the database using key lookups and scans, as a\nsimple key/value style alternative to\nExecuteSql. This method cannot be used to\nreturn a result set larger than 10 MiB; if the read matches more\ndata than that, the read fails with a `FAILED_PRECONDITION`\nerror.\n\nReads inside read-write transactions might return `ABORTED`. If\nthis occurs, the application should restart the transaction from\nthe beginning. See Transaction for more details.\n\nLarger result sets can be yielded in streaming fashion by calling\nStreamingRead instead.",
  8881. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:read",
  8882. // "httpMethod": "POST",
  8883. // "id": "spanner.projects.instances.databases.sessions.read",
  8884. // "parameterOrder": [
  8885. // "session"
  8886. // ],
  8887. // "parameters": {
  8888. // "session": {
  8889. // "description": "Required. The session in which the read should be performed.",
  8890. // "location": "path",
  8891. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8892. // "required": true,
  8893. // "type": "string"
  8894. // }
  8895. // },
  8896. // "path": "v1/{+session}:read",
  8897. // "request": {
  8898. // "$ref": "ReadRequest"
  8899. // },
  8900. // "response": {
  8901. // "$ref": "ResultSet"
  8902. // },
  8903. // "scopes": [
  8904. // "https://www.googleapis.com/auth/cloud-platform",
  8905. // "https://www.googleapis.com/auth/spanner.data"
  8906. // ]
  8907. // }
  8908. }
  8909. // method id "spanner.projects.instances.databases.sessions.rollback":
  8910. type ProjectsInstancesDatabasesSessionsRollbackCall struct {
  8911. s *Service
  8912. session string
  8913. rollbackrequest *RollbackRequest
  8914. urlParams_ gensupport.URLParams
  8915. ctx_ context.Context
  8916. header_ http.Header
  8917. }
  8918. // Rollback: Rolls back a transaction, releasing any locks it holds. It
  8919. // is a good
  8920. // idea to call this for any transaction that includes one or more
  8921. // Read or ExecuteSql requests and
  8922. // ultimately decides not to commit.
  8923. //
  8924. // `Rollback` returns `OK` if it successfully aborts the transaction,
  8925. // the
  8926. // transaction was already aborted, or the transaction is not
  8927. // found. `Rollback` never returns `ABORTED`.
  8928. func (r *ProjectsInstancesDatabasesSessionsService) Rollback(session string, rollbackrequest *RollbackRequest) *ProjectsInstancesDatabasesSessionsRollbackCall {
  8929. c := &ProjectsInstancesDatabasesSessionsRollbackCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8930. c.session = session
  8931. c.rollbackrequest = rollbackrequest
  8932. return c
  8933. }
  8934. // Fields allows partial responses to be retrieved. See
  8935. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8936. // for more information.
  8937. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsRollbackCall {
  8938. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8939. return c
  8940. }
  8941. // Context sets the context to be used in this call's Do method. Any
  8942. // pending HTTP request will be aborted if the provided context is
  8943. // canceled.
  8944. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsRollbackCall {
  8945. c.ctx_ = ctx
  8946. return c
  8947. }
  8948. // Header returns an http.Header that can be modified by the caller to
  8949. // add HTTP headers to the request.
  8950. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Header() http.Header {
  8951. if c.header_ == nil {
  8952. c.header_ = make(http.Header)
  8953. }
  8954. return c.header_
  8955. }
  8956. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) doRequest(alt string) (*http.Response, error) {
  8957. reqHeaders := make(http.Header)
  8958. for k, v := range c.header_ {
  8959. reqHeaders[k] = v
  8960. }
  8961. reqHeaders.Set("User-Agent", c.s.userAgent())
  8962. var body io.Reader = nil
  8963. body, err := googleapi.WithoutDataWrapper.JSONReader(c.rollbackrequest)
  8964. if err != nil {
  8965. return nil, err
  8966. }
  8967. reqHeaders.Set("Content-Type", "application/json")
  8968. c.urlParams_.Set("alt", alt)
  8969. c.urlParams_.Set("prettyPrint", "false")
  8970. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:rollback")
  8971. urls += "?" + c.urlParams_.Encode()
  8972. req, err := http.NewRequest("POST", urls, body)
  8973. if err != nil {
  8974. return nil, err
  8975. }
  8976. req.Header = reqHeaders
  8977. googleapi.Expand(req.URL, map[string]string{
  8978. "session": c.session,
  8979. })
  8980. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8981. }
  8982. // Do executes the "spanner.projects.instances.databases.sessions.rollback" call.
  8983. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8984. // code is an error. Response headers are in either
  8985. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8986. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8987. // check whether the returned error was because http.StatusNotModified
  8988. // was returned.
  8989. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8990. gensupport.SetOptions(c.urlParams_, opts...)
  8991. res, err := c.doRequest("json")
  8992. if res != nil && res.StatusCode == http.StatusNotModified {
  8993. if res.Body != nil {
  8994. res.Body.Close()
  8995. }
  8996. return nil, &googleapi.Error{
  8997. Code: res.StatusCode,
  8998. Header: res.Header,
  8999. }
  9000. }
  9001. if err != nil {
  9002. return nil, err
  9003. }
  9004. defer googleapi.CloseBody(res)
  9005. if err := googleapi.CheckResponse(res); err != nil {
  9006. return nil, err
  9007. }
  9008. ret := &Empty{
  9009. ServerResponse: googleapi.ServerResponse{
  9010. Header: res.Header,
  9011. HTTPStatusCode: res.StatusCode,
  9012. },
  9013. }
  9014. target := &ret
  9015. if err := gensupport.DecodeResponse(target, res); err != nil {
  9016. return nil, err
  9017. }
  9018. return ret, nil
  9019. // {
  9020. // "description": "Rolls back a transaction, releasing any locks it holds. It is a good\nidea to call this for any transaction that includes one or more\nRead or ExecuteSql requests and\nultimately decides not to commit.\n\n`Rollback` returns `OK` if it successfully aborts the transaction, the\ntransaction was already aborted, or the transaction is not\nfound. `Rollback` never returns `ABORTED`.",
  9021. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:rollback",
  9022. // "httpMethod": "POST",
  9023. // "id": "spanner.projects.instances.databases.sessions.rollback",
  9024. // "parameterOrder": [
  9025. // "session"
  9026. // ],
  9027. // "parameters": {
  9028. // "session": {
  9029. // "description": "Required. The session in which the transaction to roll back is running.",
  9030. // "location": "path",
  9031. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  9032. // "required": true,
  9033. // "type": "string"
  9034. // }
  9035. // },
  9036. // "path": "v1/{+session}:rollback",
  9037. // "request": {
  9038. // "$ref": "RollbackRequest"
  9039. // },
  9040. // "response": {
  9041. // "$ref": "Empty"
  9042. // },
  9043. // "scopes": [
  9044. // "https://www.googleapis.com/auth/cloud-platform",
  9045. // "https://www.googleapis.com/auth/spanner.data"
  9046. // ]
  9047. // }
  9048. }
  9049. // method id "spanner.projects.instances.databases.sessions.streamingRead":
  9050. type ProjectsInstancesDatabasesSessionsStreamingReadCall struct {
  9051. s *Service
  9052. session string
  9053. readrequest *ReadRequest
  9054. urlParams_ gensupport.URLParams
  9055. ctx_ context.Context
  9056. header_ http.Header
  9057. }
  9058. // StreamingRead: Like Read, except returns the result set as a
  9059. // stream. Unlike Read, there is no limit on the
  9060. // size of the returned result set. However, no individual row in
  9061. // the result set can exceed 100 MiB, and no column value can exceed
  9062. // 10 MiB.
  9063. func (r *ProjectsInstancesDatabasesSessionsService) StreamingRead(session string, readrequest *ReadRequest) *ProjectsInstancesDatabasesSessionsStreamingReadCall {
  9064. c := &ProjectsInstancesDatabasesSessionsStreamingReadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9065. c.session = session
  9066. c.readrequest = readrequest
  9067. return c
  9068. }
  9069. // Fields allows partial responses to be retrieved. See
  9070. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9071. // for more information.
  9072. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsStreamingReadCall {
  9073. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9074. return c
  9075. }
  9076. // Context sets the context to be used in this call's Do method. Any
  9077. // pending HTTP request will be aborted if the provided context is
  9078. // canceled.
  9079. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsStreamingReadCall {
  9080. c.ctx_ = ctx
  9081. return c
  9082. }
  9083. // Header returns an http.Header that can be modified by the caller to
  9084. // add HTTP headers to the request.
  9085. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Header() http.Header {
  9086. if c.header_ == nil {
  9087. c.header_ = make(http.Header)
  9088. }
  9089. return c.header_
  9090. }
  9091. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) doRequest(alt string) (*http.Response, error) {
  9092. reqHeaders := make(http.Header)
  9093. for k, v := range c.header_ {
  9094. reqHeaders[k] = v
  9095. }
  9096. reqHeaders.Set("User-Agent", c.s.userAgent())
  9097. var body io.Reader = nil
  9098. body, err := googleapi.WithoutDataWrapper.JSONReader(c.readrequest)
  9099. if err != nil {
  9100. return nil, err
  9101. }
  9102. reqHeaders.Set("Content-Type", "application/json")
  9103. c.urlParams_.Set("alt", alt)
  9104. c.urlParams_.Set("prettyPrint", "false")
  9105. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:streamingRead")
  9106. urls += "?" + c.urlParams_.Encode()
  9107. req, err := http.NewRequest("POST", urls, body)
  9108. if err != nil {
  9109. return nil, err
  9110. }
  9111. req.Header = reqHeaders
  9112. googleapi.Expand(req.URL, map[string]string{
  9113. "session": c.session,
  9114. })
  9115. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9116. }
  9117. // Do executes the "spanner.projects.instances.databases.sessions.streamingRead" call.
  9118. // Exactly one of *PartialResultSet or error will be non-nil. Any
  9119. // non-2xx status code is an error. Response headers are in either
  9120. // *PartialResultSet.ServerResponse.Header or (if a response was
  9121. // returned at all) in error.(*googleapi.Error).Header. Use
  9122. // googleapi.IsNotModified to check whether the returned error was
  9123. // because http.StatusNotModified was returned.
  9124. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Do(opts ...googleapi.CallOption) (*PartialResultSet, error) {
  9125. gensupport.SetOptions(c.urlParams_, opts...)
  9126. res, err := c.doRequest("json")
  9127. if res != nil && res.StatusCode == http.StatusNotModified {
  9128. if res.Body != nil {
  9129. res.Body.Close()
  9130. }
  9131. return nil, &googleapi.Error{
  9132. Code: res.StatusCode,
  9133. Header: res.Header,
  9134. }
  9135. }
  9136. if err != nil {
  9137. return nil, err
  9138. }
  9139. defer googleapi.CloseBody(res)
  9140. if err := googleapi.CheckResponse(res); err != nil {
  9141. return nil, err
  9142. }
  9143. ret := &PartialResultSet{
  9144. ServerResponse: googleapi.ServerResponse{
  9145. Header: res.Header,
  9146. HTTPStatusCode: res.StatusCode,
  9147. },
  9148. }
  9149. target := &ret
  9150. if err := gensupport.DecodeResponse(target, res); err != nil {
  9151. return nil, err
  9152. }
  9153. return ret, nil
  9154. // {
  9155. // "description": "Like Read, except returns the result set as a\nstream. Unlike Read, there is no limit on the\nsize of the returned result set. However, no individual row in\nthe result set can exceed 100 MiB, and no column value can exceed\n10 MiB.",
  9156. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:streamingRead",
  9157. // "httpMethod": "POST",
  9158. // "id": "spanner.projects.instances.databases.sessions.streamingRead",
  9159. // "parameterOrder": [
  9160. // "session"
  9161. // ],
  9162. // "parameters": {
  9163. // "session": {
  9164. // "description": "Required. The session in which the read should be performed.",
  9165. // "location": "path",
  9166. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  9167. // "required": true,
  9168. // "type": "string"
  9169. // }
  9170. // },
  9171. // "path": "v1/{+session}:streamingRead",
  9172. // "request": {
  9173. // "$ref": "ReadRequest"
  9174. // },
  9175. // "response": {
  9176. // "$ref": "PartialResultSet"
  9177. // },
  9178. // "scopes": [
  9179. // "https://www.googleapis.com/auth/cloud-platform",
  9180. // "https://www.googleapis.com/auth/spanner.data"
  9181. // ]
  9182. // }
  9183. }
  9184. // method id "spanner.projects.instances.operations.cancel":
  9185. type ProjectsInstancesOperationsCancelCall struct {
  9186. s *Service
  9187. name string
  9188. urlParams_ gensupport.URLParams
  9189. ctx_ context.Context
  9190. header_ http.Header
  9191. }
  9192. // Cancel: Starts asynchronous cancellation on a long-running operation.
  9193. // The server
  9194. // makes a best effort to cancel the operation, but success is
  9195. // not
  9196. // guaranteed. If the server doesn't support this method, it
  9197. // returns
  9198. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  9199. // use
  9200. // Operations.GetOperation or
  9201. // other methods to check whether the cancellation succeeded or whether
  9202. // the
  9203. // operation completed despite cancellation. On successful
  9204. // cancellation,
  9205. // the operation is not deleted; instead, it becomes an operation
  9206. // with
  9207. // an Operation.error value with a google.rpc.Status.code of
  9208. // 1,
  9209. // corresponding to `Code.CANCELLED`.
  9210. func (r *ProjectsInstancesOperationsService) Cancel(name string) *ProjectsInstancesOperationsCancelCall {
  9211. c := &ProjectsInstancesOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9212. c.name = name
  9213. return c
  9214. }
  9215. // Fields allows partial responses to be retrieved. See
  9216. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9217. // for more information.
  9218. func (c *ProjectsInstancesOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsCancelCall {
  9219. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9220. return c
  9221. }
  9222. // Context sets the context to be used in this call's Do method. Any
  9223. // pending HTTP request will be aborted if the provided context is
  9224. // canceled.
  9225. func (c *ProjectsInstancesOperationsCancelCall) Context(ctx context.Context) *ProjectsInstancesOperationsCancelCall {
  9226. c.ctx_ = ctx
  9227. return c
  9228. }
  9229. // Header returns an http.Header that can be modified by the caller to
  9230. // add HTTP headers to the request.
  9231. func (c *ProjectsInstancesOperationsCancelCall) Header() http.Header {
  9232. if c.header_ == nil {
  9233. c.header_ = make(http.Header)
  9234. }
  9235. return c.header_
  9236. }
  9237. func (c *ProjectsInstancesOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  9238. reqHeaders := make(http.Header)
  9239. for k, v := range c.header_ {
  9240. reqHeaders[k] = v
  9241. }
  9242. reqHeaders.Set("User-Agent", c.s.userAgent())
  9243. var body io.Reader = nil
  9244. c.urlParams_.Set("alt", alt)
  9245. c.urlParams_.Set("prettyPrint", "false")
  9246. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  9247. urls += "?" + c.urlParams_.Encode()
  9248. req, err := http.NewRequest("POST", urls, body)
  9249. if err != nil {
  9250. return nil, err
  9251. }
  9252. req.Header = reqHeaders
  9253. googleapi.Expand(req.URL, map[string]string{
  9254. "name": c.name,
  9255. })
  9256. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9257. }
  9258. // Do executes the "spanner.projects.instances.operations.cancel" call.
  9259. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9260. // code is an error. Response headers are in either
  9261. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9262. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9263. // check whether the returned error was because http.StatusNotModified
  9264. // was returned.
  9265. func (c *ProjectsInstancesOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9266. gensupport.SetOptions(c.urlParams_, opts...)
  9267. res, err := c.doRequest("json")
  9268. if res != nil && res.StatusCode == http.StatusNotModified {
  9269. if res.Body != nil {
  9270. res.Body.Close()
  9271. }
  9272. return nil, &googleapi.Error{
  9273. Code: res.StatusCode,
  9274. Header: res.Header,
  9275. }
  9276. }
  9277. if err != nil {
  9278. return nil, err
  9279. }
  9280. defer googleapi.CloseBody(res)
  9281. if err := googleapi.CheckResponse(res); err != nil {
  9282. return nil, err
  9283. }
  9284. ret := &Empty{
  9285. ServerResponse: googleapi.ServerResponse{
  9286. Header: res.Header,
  9287. HTTPStatusCode: res.StatusCode,
  9288. },
  9289. }
  9290. target := &ret
  9291. if err := gensupport.DecodeResponse(target, res); err != nil {
  9292. return nil, err
  9293. }
  9294. return ret, nil
  9295. // {
  9296. // "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
  9297. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations/{operationsId}:cancel",
  9298. // "httpMethod": "POST",
  9299. // "id": "spanner.projects.instances.operations.cancel",
  9300. // "parameterOrder": [
  9301. // "name"
  9302. // ],
  9303. // "parameters": {
  9304. // "name": {
  9305. // "description": "The name of the operation resource to be cancelled.",
  9306. // "location": "path",
  9307. // "pattern": "^projects/[^/]+/instances/[^/]+/operations/[^/]+$",
  9308. // "required": true,
  9309. // "type": "string"
  9310. // }
  9311. // },
  9312. // "path": "v1/{+name}:cancel",
  9313. // "response": {
  9314. // "$ref": "Empty"
  9315. // },
  9316. // "scopes": [
  9317. // "https://www.googleapis.com/auth/cloud-platform",
  9318. // "https://www.googleapis.com/auth/spanner.admin"
  9319. // ]
  9320. // }
  9321. }
  9322. // method id "spanner.projects.instances.operations.delete":
  9323. type ProjectsInstancesOperationsDeleteCall struct {
  9324. s *Service
  9325. name string
  9326. urlParams_ gensupport.URLParams
  9327. ctx_ context.Context
  9328. header_ http.Header
  9329. }
  9330. // Delete: Deletes a long-running operation. This method indicates that
  9331. // the client is
  9332. // no longer interested in the operation result. It does not cancel
  9333. // the
  9334. // operation. If the server doesn't support this method, it
  9335. // returns
  9336. // `google.rpc.Code.UNIMPLEMENTED`.
  9337. func (r *ProjectsInstancesOperationsService) Delete(name string) *ProjectsInstancesOperationsDeleteCall {
  9338. c := &ProjectsInstancesOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9339. c.name = name
  9340. return c
  9341. }
  9342. // Fields allows partial responses to be retrieved. See
  9343. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9344. // for more information.
  9345. func (c *ProjectsInstancesOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsDeleteCall {
  9346. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9347. return c
  9348. }
  9349. // Context sets the context to be used in this call's Do method. Any
  9350. // pending HTTP request will be aborted if the provided context is
  9351. // canceled.
  9352. func (c *ProjectsInstancesOperationsDeleteCall) Context(ctx context.Context) *ProjectsInstancesOperationsDeleteCall {
  9353. c.ctx_ = ctx
  9354. return c
  9355. }
  9356. // Header returns an http.Header that can be modified by the caller to
  9357. // add HTTP headers to the request.
  9358. func (c *ProjectsInstancesOperationsDeleteCall) Header() http.Header {
  9359. if c.header_ == nil {
  9360. c.header_ = make(http.Header)
  9361. }
  9362. return c.header_
  9363. }
  9364. func (c *ProjectsInstancesOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9365. reqHeaders := make(http.Header)
  9366. for k, v := range c.header_ {
  9367. reqHeaders[k] = v
  9368. }
  9369. reqHeaders.Set("User-Agent", c.s.userAgent())
  9370. var body io.Reader = nil
  9371. c.urlParams_.Set("alt", alt)
  9372. c.urlParams_.Set("prettyPrint", "false")
  9373. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  9374. urls += "?" + c.urlParams_.Encode()
  9375. req, err := http.NewRequest("DELETE", urls, body)
  9376. if err != nil {
  9377. return nil, err
  9378. }
  9379. req.Header = reqHeaders
  9380. googleapi.Expand(req.URL, map[string]string{
  9381. "name": c.name,
  9382. })
  9383. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9384. }
  9385. // Do executes the "spanner.projects.instances.operations.delete" call.
  9386. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  9387. // code is an error. Response headers are in either
  9388. // *Empty.ServerResponse.Header or (if a response was returned at all)
  9389. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9390. // check whether the returned error was because http.StatusNotModified
  9391. // was returned.
  9392. func (c *ProjectsInstancesOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  9393. gensupport.SetOptions(c.urlParams_, opts...)
  9394. res, err := c.doRequest("json")
  9395. if res != nil && res.StatusCode == http.StatusNotModified {
  9396. if res.Body != nil {
  9397. res.Body.Close()
  9398. }
  9399. return nil, &googleapi.Error{
  9400. Code: res.StatusCode,
  9401. Header: res.Header,
  9402. }
  9403. }
  9404. if err != nil {
  9405. return nil, err
  9406. }
  9407. defer googleapi.CloseBody(res)
  9408. if err := googleapi.CheckResponse(res); err != nil {
  9409. return nil, err
  9410. }
  9411. ret := &Empty{
  9412. ServerResponse: googleapi.ServerResponse{
  9413. Header: res.Header,
  9414. HTTPStatusCode: res.StatusCode,
  9415. },
  9416. }
  9417. target := &ret
  9418. if err := gensupport.DecodeResponse(target, res); err != nil {
  9419. return nil, err
  9420. }
  9421. return ret, nil
  9422. // {
  9423. // "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
  9424. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations/{operationsId}",
  9425. // "httpMethod": "DELETE",
  9426. // "id": "spanner.projects.instances.operations.delete",
  9427. // "parameterOrder": [
  9428. // "name"
  9429. // ],
  9430. // "parameters": {
  9431. // "name": {
  9432. // "description": "The name of the operation resource to be deleted.",
  9433. // "location": "path",
  9434. // "pattern": "^projects/[^/]+/instances/[^/]+/operations/[^/]+$",
  9435. // "required": true,
  9436. // "type": "string"
  9437. // }
  9438. // },
  9439. // "path": "v1/{+name}",
  9440. // "response": {
  9441. // "$ref": "Empty"
  9442. // },
  9443. // "scopes": [
  9444. // "https://www.googleapis.com/auth/cloud-platform",
  9445. // "https://www.googleapis.com/auth/spanner.admin"
  9446. // ]
  9447. // }
  9448. }
  9449. // method id "spanner.projects.instances.operations.get":
  9450. type ProjectsInstancesOperationsGetCall struct {
  9451. s *Service
  9452. name string
  9453. urlParams_ gensupport.URLParams
  9454. ifNoneMatch_ string
  9455. ctx_ context.Context
  9456. header_ http.Header
  9457. }
  9458. // Get: Gets the latest state of a long-running operation. Clients can
  9459. // use this
  9460. // method to poll the operation result at intervals as recommended by
  9461. // the API
  9462. // service.
  9463. func (r *ProjectsInstancesOperationsService) Get(name string) *ProjectsInstancesOperationsGetCall {
  9464. c := &ProjectsInstancesOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9465. c.name = name
  9466. return c
  9467. }
  9468. // Fields allows partial responses to be retrieved. See
  9469. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9470. // for more information.
  9471. func (c *ProjectsInstancesOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsGetCall {
  9472. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9473. return c
  9474. }
  9475. // IfNoneMatch sets the optional parameter which makes the operation
  9476. // fail if the object's ETag matches the given value. This is useful for
  9477. // getting updates only after the object has changed since the last
  9478. // request. Use googleapi.IsNotModified to check whether the response
  9479. // error from Do is the result of In-None-Match.
  9480. func (c *ProjectsInstancesOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesOperationsGetCall {
  9481. c.ifNoneMatch_ = entityTag
  9482. return c
  9483. }
  9484. // Context sets the context to be used in this call's Do method. Any
  9485. // pending HTTP request will be aborted if the provided context is
  9486. // canceled.
  9487. func (c *ProjectsInstancesOperationsGetCall) Context(ctx context.Context) *ProjectsInstancesOperationsGetCall {
  9488. c.ctx_ = ctx
  9489. return c
  9490. }
  9491. // Header returns an http.Header that can be modified by the caller to
  9492. // add HTTP headers to the request.
  9493. func (c *ProjectsInstancesOperationsGetCall) Header() http.Header {
  9494. if c.header_ == nil {
  9495. c.header_ = make(http.Header)
  9496. }
  9497. return c.header_
  9498. }
  9499. func (c *ProjectsInstancesOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  9500. reqHeaders := make(http.Header)
  9501. for k, v := range c.header_ {
  9502. reqHeaders[k] = v
  9503. }
  9504. reqHeaders.Set("User-Agent", c.s.userAgent())
  9505. if c.ifNoneMatch_ != "" {
  9506. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9507. }
  9508. var body io.Reader = nil
  9509. c.urlParams_.Set("alt", alt)
  9510. c.urlParams_.Set("prettyPrint", "false")
  9511. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  9512. urls += "?" + c.urlParams_.Encode()
  9513. req, err := http.NewRequest("GET", urls, body)
  9514. if err != nil {
  9515. return nil, err
  9516. }
  9517. req.Header = reqHeaders
  9518. googleapi.Expand(req.URL, map[string]string{
  9519. "name": c.name,
  9520. })
  9521. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9522. }
  9523. // Do executes the "spanner.projects.instances.operations.get" call.
  9524. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  9525. // status code is an error. Response headers are in either
  9526. // *Operation.ServerResponse.Header or (if a response was returned at
  9527. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9528. // to check whether the returned error was because
  9529. // http.StatusNotModified was returned.
  9530. func (c *ProjectsInstancesOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  9531. gensupport.SetOptions(c.urlParams_, opts...)
  9532. res, err := c.doRequest("json")
  9533. if res != nil && res.StatusCode == http.StatusNotModified {
  9534. if res.Body != nil {
  9535. res.Body.Close()
  9536. }
  9537. return nil, &googleapi.Error{
  9538. Code: res.StatusCode,
  9539. Header: res.Header,
  9540. }
  9541. }
  9542. if err != nil {
  9543. return nil, err
  9544. }
  9545. defer googleapi.CloseBody(res)
  9546. if err := googleapi.CheckResponse(res); err != nil {
  9547. return nil, err
  9548. }
  9549. ret := &Operation{
  9550. ServerResponse: googleapi.ServerResponse{
  9551. Header: res.Header,
  9552. HTTPStatusCode: res.StatusCode,
  9553. },
  9554. }
  9555. target := &ret
  9556. if err := gensupport.DecodeResponse(target, res); err != nil {
  9557. return nil, err
  9558. }
  9559. return ret, nil
  9560. // {
  9561. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  9562. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations/{operationsId}",
  9563. // "httpMethod": "GET",
  9564. // "id": "spanner.projects.instances.operations.get",
  9565. // "parameterOrder": [
  9566. // "name"
  9567. // ],
  9568. // "parameters": {
  9569. // "name": {
  9570. // "description": "The name of the operation resource.",
  9571. // "location": "path",
  9572. // "pattern": "^projects/[^/]+/instances/[^/]+/operations/[^/]+$",
  9573. // "required": true,
  9574. // "type": "string"
  9575. // }
  9576. // },
  9577. // "path": "v1/{+name}",
  9578. // "response": {
  9579. // "$ref": "Operation"
  9580. // },
  9581. // "scopes": [
  9582. // "https://www.googleapis.com/auth/cloud-platform",
  9583. // "https://www.googleapis.com/auth/spanner.admin"
  9584. // ]
  9585. // }
  9586. }
  9587. // method id "spanner.projects.instances.operations.list":
  9588. type ProjectsInstancesOperationsListCall struct {
  9589. s *Service
  9590. name string
  9591. urlParams_ gensupport.URLParams
  9592. ifNoneMatch_ string
  9593. ctx_ context.Context
  9594. header_ http.Header
  9595. }
  9596. // List: Lists operations that match the specified filter in the
  9597. // request. If the
  9598. // server doesn't support this method, it returns
  9599. // `UNIMPLEMENTED`.
  9600. //
  9601. // NOTE: the `name` binding allows API services to override the
  9602. // binding
  9603. // to use different resource name schemes, such as `users/*/operations`.
  9604. // To
  9605. // override the binding, API services can add a binding such
  9606. // as
  9607. // "/v1/{name=users/*}/operations" to their service configuration.
  9608. // For backwards compatibility, the default name includes the
  9609. // operations
  9610. // collection id, however overriding users must ensure the name
  9611. // binding
  9612. // is the parent resource, without the operations collection id.
  9613. func (r *ProjectsInstancesOperationsService) List(name string) *ProjectsInstancesOperationsListCall {
  9614. c := &ProjectsInstancesOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9615. c.name = name
  9616. return c
  9617. }
  9618. // Filter sets the optional parameter "filter": The standard list
  9619. // filter.
  9620. func (c *ProjectsInstancesOperationsListCall) Filter(filter string) *ProjectsInstancesOperationsListCall {
  9621. c.urlParams_.Set("filter", filter)
  9622. return c
  9623. }
  9624. // PageSize sets the optional parameter "pageSize": The standard list
  9625. // page size.
  9626. func (c *ProjectsInstancesOperationsListCall) PageSize(pageSize int64) *ProjectsInstancesOperationsListCall {
  9627. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  9628. return c
  9629. }
  9630. // PageToken sets the optional parameter "pageToken": The standard list
  9631. // page token.
  9632. func (c *ProjectsInstancesOperationsListCall) PageToken(pageToken string) *ProjectsInstancesOperationsListCall {
  9633. c.urlParams_.Set("pageToken", pageToken)
  9634. return c
  9635. }
  9636. // Fields allows partial responses to be retrieved. See
  9637. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9638. // for more information.
  9639. func (c *ProjectsInstancesOperationsListCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsListCall {
  9640. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9641. return c
  9642. }
  9643. // IfNoneMatch sets the optional parameter which makes the operation
  9644. // fail if the object's ETag matches the given value. This is useful for
  9645. // getting updates only after the object has changed since the last
  9646. // request. Use googleapi.IsNotModified to check whether the response
  9647. // error from Do is the result of In-None-Match.
  9648. func (c *ProjectsInstancesOperationsListCall) IfNoneMatch(entityTag string) *ProjectsInstancesOperationsListCall {
  9649. c.ifNoneMatch_ = entityTag
  9650. return c
  9651. }
  9652. // Context sets the context to be used in this call's Do method. Any
  9653. // pending HTTP request will be aborted if the provided context is
  9654. // canceled.
  9655. func (c *ProjectsInstancesOperationsListCall) Context(ctx context.Context) *ProjectsInstancesOperationsListCall {
  9656. c.ctx_ = ctx
  9657. return c
  9658. }
  9659. // Header returns an http.Header that can be modified by the caller to
  9660. // add HTTP headers to the request.
  9661. func (c *ProjectsInstancesOperationsListCall) Header() http.Header {
  9662. if c.header_ == nil {
  9663. c.header_ = make(http.Header)
  9664. }
  9665. return c.header_
  9666. }
  9667. func (c *ProjectsInstancesOperationsListCall) doRequest(alt string) (*http.Response, error) {
  9668. reqHeaders := make(http.Header)
  9669. for k, v := range c.header_ {
  9670. reqHeaders[k] = v
  9671. }
  9672. reqHeaders.Set("User-Agent", c.s.userAgent())
  9673. if c.ifNoneMatch_ != "" {
  9674. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9675. }
  9676. var body io.Reader = nil
  9677. c.urlParams_.Set("alt", alt)
  9678. c.urlParams_.Set("prettyPrint", "false")
  9679. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  9680. urls += "?" + c.urlParams_.Encode()
  9681. req, err := http.NewRequest("GET", urls, body)
  9682. if err != nil {
  9683. return nil, err
  9684. }
  9685. req.Header = reqHeaders
  9686. googleapi.Expand(req.URL, map[string]string{
  9687. "name": c.name,
  9688. })
  9689. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9690. }
  9691. // Do executes the "spanner.projects.instances.operations.list" call.
  9692. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  9693. // non-2xx status code is an error. Response headers are in either
  9694. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  9695. // returned at all) in error.(*googleapi.Error).Header. Use
  9696. // googleapi.IsNotModified to check whether the returned error was
  9697. // because http.StatusNotModified was returned.
  9698. func (c *ProjectsInstancesOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  9699. gensupport.SetOptions(c.urlParams_, opts...)
  9700. res, err := c.doRequest("json")
  9701. if res != nil && res.StatusCode == http.StatusNotModified {
  9702. if res.Body != nil {
  9703. res.Body.Close()
  9704. }
  9705. return nil, &googleapi.Error{
  9706. Code: res.StatusCode,
  9707. Header: res.Header,
  9708. }
  9709. }
  9710. if err != nil {
  9711. return nil, err
  9712. }
  9713. defer googleapi.CloseBody(res)
  9714. if err := googleapi.CheckResponse(res); err != nil {
  9715. return nil, err
  9716. }
  9717. ret := &ListOperationsResponse{
  9718. ServerResponse: googleapi.ServerResponse{
  9719. Header: res.Header,
  9720. HTTPStatusCode: res.StatusCode,
  9721. },
  9722. }
  9723. target := &ret
  9724. if err := gensupport.DecodeResponse(target, res); err != nil {
  9725. return nil, err
  9726. }
  9727. return ret, nil
  9728. // {
  9729. // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
  9730. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations",
  9731. // "httpMethod": "GET",
  9732. // "id": "spanner.projects.instances.operations.list",
  9733. // "parameterOrder": [
  9734. // "name"
  9735. // ],
  9736. // "parameters": {
  9737. // "filter": {
  9738. // "description": "The standard list filter.",
  9739. // "location": "query",
  9740. // "type": "string"
  9741. // },
  9742. // "name": {
  9743. // "description": "The name of the operation's parent resource.",
  9744. // "location": "path",
  9745. // "pattern": "^projects/[^/]+/instances/[^/]+/operations$",
  9746. // "required": true,
  9747. // "type": "string"
  9748. // },
  9749. // "pageSize": {
  9750. // "description": "The standard list page size.",
  9751. // "format": "int32",
  9752. // "location": "query",
  9753. // "type": "integer"
  9754. // },
  9755. // "pageToken": {
  9756. // "description": "The standard list page token.",
  9757. // "location": "query",
  9758. // "type": "string"
  9759. // }
  9760. // },
  9761. // "path": "v1/{+name}",
  9762. // "response": {
  9763. // "$ref": "ListOperationsResponse"
  9764. // },
  9765. // "scopes": [
  9766. // "https://www.googleapis.com/auth/cloud-platform",
  9767. // "https://www.googleapis.com/auth/spanner.admin"
  9768. // ]
  9769. // }
  9770. }
  9771. // Pages invokes f for each page of results.
  9772. // A non-nil error returned from f will halt the iteration.
  9773. // The provided context supersedes any context provided to the Context method.
  9774. func (c *ProjectsInstancesOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  9775. c.ctx_ = ctx
  9776. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9777. for {
  9778. x, err := c.Do()
  9779. if err != nil {
  9780. return err
  9781. }
  9782. if err := f(x); err != nil {
  9783. return err
  9784. }
  9785. if x.NextPageToken == "" {
  9786. return nil
  9787. }
  9788. c.PageToken(x.NextPageToken)
  9789. }
  9790. }