25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

9800 lines
356 KiB

  1. // Package spanner provides access to the Cloud Spanner API.
  2. //
  3. // See https://cloud.google.com/spanner/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/spanner/v1"
  8. // ...
  9. // spannerService, err := spanner.New(oauthHttpClient)
  10. package spanner // import "google.golang.org/api/spanner/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "spanner:v1"
  41. const apiName = "spanner"
  42. const apiVersion = "v1"
  43. const basePath = "https://spanner.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // Administer your Spanner databases
  49. SpannerAdminScope = "https://www.googleapis.com/auth/spanner.admin"
  50. // View and manage the contents of your Spanner databases
  51. SpannerDataScope = "https://www.googleapis.com/auth/spanner.data"
  52. )
  53. func New(client *http.Client) (*Service, error) {
  54. if client == nil {
  55. return nil, errors.New("client is nil")
  56. }
  57. s := &Service{client: client, BasePath: basePath}
  58. s.Projects = NewProjectsService(s)
  59. return s, nil
  60. }
  61. type Service struct {
  62. client *http.Client
  63. BasePath string // API endpoint base URL
  64. UserAgent string // optional additional User-Agent fragment
  65. Projects *ProjectsService
  66. }
  67. func (s *Service) userAgent() string {
  68. if s.UserAgent == "" {
  69. return googleapi.UserAgent
  70. }
  71. return googleapi.UserAgent + " " + s.UserAgent
  72. }
  73. func NewProjectsService(s *Service) *ProjectsService {
  74. rs := &ProjectsService{s: s}
  75. rs.InstanceConfigs = NewProjectsInstanceConfigsService(s)
  76. rs.Instances = NewProjectsInstancesService(s)
  77. return rs
  78. }
  79. type ProjectsService struct {
  80. s *Service
  81. InstanceConfigs *ProjectsInstanceConfigsService
  82. Instances *ProjectsInstancesService
  83. }
  84. func NewProjectsInstanceConfigsService(s *Service) *ProjectsInstanceConfigsService {
  85. rs := &ProjectsInstanceConfigsService{s: s}
  86. return rs
  87. }
  88. type ProjectsInstanceConfigsService struct {
  89. s *Service
  90. }
  91. func NewProjectsInstancesService(s *Service) *ProjectsInstancesService {
  92. rs := &ProjectsInstancesService{s: s}
  93. rs.Databases = NewProjectsInstancesDatabasesService(s)
  94. rs.Operations = NewProjectsInstancesOperationsService(s)
  95. return rs
  96. }
  97. type ProjectsInstancesService struct {
  98. s *Service
  99. Databases *ProjectsInstancesDatabasesService
  100. Operations *ProjectsInstancesOperationsService
  101. }
  102. func NewProjectsInstancesDatabasesService(s *Service) *ProjectsInstancesDatabasesService {
  103. rs := &ProjectsInstancesDatabasesService{s: s}
  104. rs.Operations = NewProjectsInstancesDatabasesOperationsService(s)
  105. rs.Sessions = NewProjectsInstancesDatabasesSessionsService(s)
  106. return rs
  107. }
  108. type ProjectsInstancesDatabasesService struct {
  109. s *Service
  110. Operations *ProjectsInstancesDatabasesOperationsService
  111. Sessions *ProjectsInstancesDatabasesSessionsService
  112. }
  113. func NewProjectsInstancesDatabasesOperationsService(s *Service) *ProjectsInstancesDatabasesOperationsService {
  114. rs := &ProjectsInstancesDatabasesOperationsService{s: s}
  115. return rs
  116. }
  117. type ProjectsInstancesDatabasesOperationsService struct {
  118. s *Service
  119. }
  120. func NewProjectsInstancesDatabasesSessionsService(s *Service) *ProjectsInstancesDatabasesSessionsService {
  121. rs := &ProjectsInstancesDatabasesSessionsService{s: s}
  122. return rs
  123. }
  124. type ProjectsInstancesDatabasesSessionsService struct {
  125. s *Service
  126. }
  127. func NewProjectsInstancesOperationsService(s *Service) *ProjectsInstancesOperationsService {
  128. rs := &ProjectsInstancesOperationsService{s: s}
  129. return rs
  130. }
  131. type ProjectsInstancesOperationsService struct {
  132. s *Service
  133. }
  134. // BeginTransactionRequest: The request for BeginTransaction.
  135. type BeginTransactionRequest struct {
  136. // Options: Required. Options for the new transaction.
  137. Options *TransactionOptions `json:"options,omitempty"`
  138. // ForceSendFields is a list of field names (e.g. "Options") to
  139. // unconditionally include in API requests. By default, fields with
  140. // empty values are omitted from API requests. However, any non-pointer,
  141. // non-interface field appearing in ForceSendFields will be sent to the
  142. // server regardless of whether the field is empty or not. This may be
  143. // used to include empty fields in Patch requests.
  144. ForceSendFields []string `json:"-"`
  145. // NullFields is a list of field names (e.g. "Options") to include in
  146. // API requests with the JSON null value. By default, fields with empty
  147. // values are omitted from API requests. However, any field with an
  148. // empty value appearing in NullFields will be sent to the server as
  149. // null. It is an error if a field in this list has a non-empty value.
  150. // This may be used to include null fields in Patch requests.
  151. NullFields []string `json:"-"`
  152. }
  153. func (s *BeginTransactionRequest) MarshalJSON() ([]byte, error) {
  154. type NoMethod BeginTransactionRequest
  155. raw := NoMethod(*s)
  156. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  157. }
  158. // Binding: Associates `members` with a `role`.
  159. type Binding struct {
  160. // Members: Specifies the identities requesting access for a Cloud
  161. // Platform resource.
  162. // `members` can have the following values:
  163. //
  164. // * `allUsers`: A special identifier that represents anyone who is
  165. // on the internet; with or without a Google account.
  166. //
  167. // * `allAuthenticatedUsers`: A special identifier that represents
  168. // anyone
  169. // who is authenticated with a Google account or a service
  170. // account.
  171. //
  172. // * `user:{emailid}`: An email address that represents a specific
  173. // Google
  174. // account. For example, `alice@gmail.com` .
  175. //
  176. //
  177. // * `serviceAccount:{emailid}`: An email address that represents a
  178. // service
  179. // account. For example,
  180. // `my-other-app@appspot.gserviceaccount.com`.
  181. //
  182. // * `group:{emailid}`: An email address that represents a Google
  183. // group.
  184. // For example, `admins@example.com`.
  185. //
  186. //
  187. // * `domain:{domain}`: A Google Apps domain name that represents all
  188. // the
  189. // users of that domain. For example, `google.com` or
  190. // `example.com`.
  191. //
  192. //
  193. Members []string `json:"members,omitempty"`
  194. // Role: Role that is assigned to `members`.
  195. // For example, `roles/viewer`, `roles/editor`, or
  196. // `roles/owner`.
  197. // Required
  198. Role string `json:"role,omitempty"`
  199. // ForceSendFields is a list of field names (e.g. "Members") to
  200. // unconditionally include in API requests. By default, fields with
  201. // empty values are omitted from API requests. However, any non-pointer,
  202. // non-interface field appearing in ForceSendFields will be sent to the
  203. // server regardless of whether the field is empty or not. This may be
  204. // used to include empty fields in Patch requests.
  205. ForceSendFields []string `json:"-"`
  206. // NullFields is a list of field names (e.g. "Members") to include in
  207. // API requests with the JSON null value. By default, fields with empty
  208. // values are omitted from API requests. However, any field with an
  209. // empty value appearing in NullFields will be sent to the server as
  210. // null. It is an error if a field in this list has a non-empty value.
  211. // This may be used to include null fields in Patch requests.
  212. NullFields []string `json:"-"`
  213. }
  214. func (s *Binding) MarshalJSON() ([]byte, error) {
  215. type NoMethod Binding
  216. raw := NoMethod(*s)
  217. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  218. }
  219. // ChildLink: Metadata associated with a parent-child relationship
  220. // appearing in a
  221. // PlanNode.
  222. type ChildLink struct {
  223. // ChildIndex: The node to which the link points.
  224. ChildIndex int64 `json:"childIndex,omitempty"`
  225. // Type: The type of the link. For example, in Hash Joins this could be
  226. // used to
  227. // distinguish between the build child and the probe child, or in the
  228. // case
  229. // of the child being an output variable, to represent the tag
  230. // associated
  231. // with the output variable.
  232. Type string `json:"type,omitempty"`
  233. // Variable: Only present if the child node is SCALAR and corresponds
  234. // to an output variable of the parent node. The field carries the name
  235. // of
  236. // the output variable.
  237. // For example, a `TableScan` operator that reads rows from a table
  238. // will
  239. // have child links to the `SCALAR` nodes representing the output
  240. // variables
  241. // created for each column that is read by the operator. The
  242. // corresponding
  243. // `variable` fields will be set to the variable names assigned to
  244. // the
  245. // columns.
  246. Variable string `json:"variable,omitempty"`
  247. // ForceSendFields is a list of field names (e.g. "ChildIndex") to
  248. // unconditionally include in API requests. By default, fields with
  249. // empty values are omitted from API requests. However, any non-pointer,
  250. // non-interface field appearing in ForceSendFields will be sent to the
  251. // server regardless of whether the field is empty or not. This may be
  252. // used to include empty fields in Patch requests.
  253. ForceSendFields []string `json:"-"`
  254. // NullFields is a list of field names (e.g. "ChildIndex") to include in
  255. // API requests with the JSON null value. By default, fields with empty
  256. // values are omitted from API requests. However, any field with an
  257. // empty value appearing in NullFields will be sent to the server as
  258. // null. It is an error if a field in this list has a non-empty value.
  259. // This may be used to include null fields in Patch requests.
  260. NullFields []string `json:"-"`
  261. }
  262. func (s *ChildLink) MarshalJSON() ([]byte, error) {
  263. type NoMethod ChildLink
  264. raw := NoMethod(*s)
  265. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  266. }
  267. // CommitRequest: The request for Commit.
  268. type CommitRequest struct {
  269. // Mutations: The mutations to be executed when this transaction
  270. // commits. All
  271. // mutations are applied atomically, in the order they appear in
  272. // this list.
  273. Mutations []*Mutation `json:"mutations,omitempty"`
  274. // SingleUseTransaction: Execute mutations in a temporary transaction.
  275. // Note that unlike
  276. // commit of a previously-started transaction, commit with a
  277. // temporary transaction is non-idempotent. That is, if
  278. // the
  279. // `CommitRequest` is sent to Cloud Spanner more than once
  280. // (for
  281. // instance, due to retries in the application, or in the
  282. // transport library), it is possible that the mutations are
  283. // executed more than once. If this is undesirable, use
  284. // BeginTransaction and
  285. // Commit instead.
  286. SingleUseTransaction *TransactionOptions `json:"singleUseTransaction,omitempty"`
  287. // TransactionId: Commit a previously-started transaction.
  288. TransactionId string `json:"transactionId,omitempty"`
  289. // ForceSendFields is a list of field names (e.g. "Mutations") to
  290. // unconditionally include in API requests. By default, fields with
  291. // empty values are omitted from API requests. However, any non-pointer,
  292. // non-interface field appearing in ForceSendFields will be sent to the
  293. // server regardless of whether the field is empty or not. This may be
  294. // used to include empty fields in Patch requests.
  295. ForceSendFields []string `json:"-"`
  296. // NullFields is a list of field names (e.g. "Mutations") to include in
  297. // API requests with the JSON null value. By default, fields with empty
  298. // values are omitted from API requests. However, any field with an
  299. // empty value appearing in NullFields will be sent to the server as
  300. // null. It is an error if a field in this list has a non-empty value.
  301. // This may be used to include null fields in Patch requests.
  302. NullFields []string `json:"-"`
  303. }
  304. func (s *CommitRequest) MarshalJSON() ([]byte, error) {
  305. type NoMethod CommitRequest
  306. raw := NoMethod(*s)
  307. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  308. }
  309. // CommitResponse: The response for Commit.
  310. type CommitResponse struct {
  311. // CommitTimestamp: The Cloud Spanner timestamp at which the transaction
  312. // committed.
  313. CommitTimestamp string `json:"commitTimestamp,omitempty"`
  314. // ServerResponse contains the HTTP response code and headers from the
  315. // server.
  316. googleapi.ServerResponse `json:"-"`
  317. // ForceSendFields is a list of field names (e.g. "CommitTimestamp") to
  318. // unconditionally include in API requests. By default, fields with
  319. // empty values are omitted from API requests. However, any non-pointer,
  320. // non-interface field appearing in ForceSendFields will be sent to the
  321. // server regardless of whether the field is empty or not. This may be
  322. // used to include empty fields in Patch requests.
  323. ForceSendFields []string `json:"-"`
  324. // NullFields is a list of field names (e.g. "CommitTimestamp") to
  325. // include in API requests with the JSON null value. By default, fields
  326. // with empty values are omitted from API requests. However, any field
  327. // with an empty value appearing in NullFields will be sent to the
  328. // server as null. It is an error if a field in this list has a
  329. // non-empty value. This may be used to include null fields in Patch
  330. // requests.
  331. NullFields []string `json:"-"`
  332. }
  333. func (s *CommitResponse) MarshalJSON() ([]byte, error) {
  334. type NoMethod CommitResponse
  335. raw := NoMethod(*s)
  336. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  337. }
  338. // CreateDatabaseMetadata: Metadata type for the operation returned
  339. // by
  340. // CreateDatabase.
  341. type CreateDatabaseMetadata struct {
  342. // Database: The database being created.
  343. Database string `json:"database,omitempty"`
  344. // ForceSendFields is a list of field names (e.g. "Database") to
  345. // unconditionally include in API requests. By default, fields with
  346. // empty values are omitted from API requests. However, any non-pointer,
  347. // non-interface field appearing in ForceSendFields will be sent to the
  348. // server regardless of whether the field is empty or not. This may be
  349. // used to include empty fields in Patch requests.
  350. ForceSendFields []string `json:"-"`
  351. // NullFields is a list of field names (e.g. "Database") to include in
  352. // API requests with the JSON null value. By default, fields with empty
  353. // values are omitted from API requests. However, any field with an
  354. // empty value appearing in NullFields will be sent to the server as
  355. // null. It is an error if a field in this list has a non-empty value.
  356. // This may be used to include null fields in Patch requests.
  357. NullFields []string `json:"-"`
  358. }
  359. func (s *CreateDatabaseMetadata) MarshalJSON() ([]byte, error) {
  360. type NoMethod CreateDatabaseMetadata
  361. raw := NoMethod(*s)
  362. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  363. }
  364. // CreateDatabaseRequest: The request for CreateDatabase.
  365. type CreateDatabaseRequest struct {
  366. // CreateStatement: Required. A `CREATE DATABASE` statement, which
  367. // specifies the ID of the
  368. // new database. The database ID must conform to the regular
  369. // expression
  370. // `a-z*[a-z0-9]` and be between 2 and 30 characters in length.
  371. // If the database ID is a reserved word or if it contains a hyphen,
  372. // the
  373. // database ID must be enclosed in backticks (`` ` ``).
  374. CreateStatement string `json:"createStatement,omitempty"`
  375. // ExtraStatements: An optional list of DDL statements to run inside the
  376. // newly created
  377. // database. Statements can create tables, indexes, etc.
  378. // These
  379. // statements execute atomically with the creation of the database:
  380. // if there is an error in any statement, the database is not created.
  381. ExtraStatements []string `json:"extraStatements,omitempty"`
  382. // ForceSendFields is a list of field names (e.g. "CreateStatement") 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. "CreateStatement") 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 *CreateDatabaseRequest) MarshalJSON() ([]byte, error) {
  399. type NoMethod CreateDatabaseRequest
  400. raw := NoMethod(*s)
  401. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  402. }
  403. // CreateInstanceMetadata: Metadata type for the operation returned
  404. // by
  405. // CreateInstance.
  406. type CreateInstanceMetadata struct {
  407. // CancelTime: The time at which this operation was cancelled. If set,
  408. // this operation is
  409. // in the process of undoing itself (which is guaranteed to succeed)
  410. // and
  411. // cannot be cancelled again.
  412. CancelTime string `json:"cancelTime,omitempty"`
  413. // EndTime: The time at which this operation failed or was completed
  414. // successfully.
  415. EndTime string `json:"endTime,omitempty"`
  416. // Instance: The instance being created.
  417. Instance *Instance `json:"instance,omitempty"`
  418. // StartTime: The time at which the
  419. // CreateInstance request was
  420. // received.
  421. StartTime string `json:"startTime,omitempty"`
  422. // ForceSendFields is a list of field names (e.g. "CancelTime") to
  423. // unconditionally include in API requests. By default, fields with
  424. // empty values are omitted from API requests. However, any non-pointer,
  425. // non-interface field appearing in ForceSendFields will be sent to the
  426. // server regardless of whether the field is empty or not. This may be
  427. // used to include empty fields in Patch requests.
  428. ForceSendFields []string `json:"-"`
  429. // NullFields is a list of field names (e.g. "CancelTime") to include in
  430. // API requests with the JSON null value. By default, fields with empty
  431. // values are omitted from API requests. However, any field with an
  432. // empty value appearing in NullFields will be sent to the server as
  433. // null. It is an error if a field in this list has a non-empty value.
  434. // This may be used to include null fields in Patch requests.
  435. NullFields []string `json:"-"`
  436. }
  437. func (s *CreateInstanceMetadata) MarshalJSON() ([]byte, error) {
  438. type NoMethod CreateInstanceMetadata
  439. raw := NoMethod(*s)
  440. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  441. }
  442. // CreateInstanceRequest: The request for CreateInstance.
  443. type CreateInstanceRequest struct {
  444. // Instance: Required. The instance to create. The name may be omitted,
  445. // but if
  446. // specified must be `<parent>/instances/<instance_id>`.
  447. Instance *Instance `json:"instance,omitempty"`
  448. // InstanceId: Required. The ID of the instance to create. Valid
  449. // identifiers are of the
  450. // form `a-z*[a-z0-9]` and must be between 6 and 30 characters
  451. // in
  452. // length.
  453. InstanceId string `json:"instanceId,omitempty"`
  454. // ForceSendFields is a list of field names (e.g. "Instance") to
  455. // unconditionally include in API requests. By default, fields with
  456. // empty values are omitted from API requests. However, any non-pointer,
  457. // non-interface field appearing in ForceSendFields will be sent to the
  458. // server regardless of whether the field is empty or not. This may be
  459. // used to include empty fields in Patch requests.
  460. ForceSendFields []string `json:"-"`
  461. // NullFields is a list of field names (e.g. "Instance") to include in
  462. // API requests with the JSON null value. By default, fields with empty
  463. // values are omitted from API requests. However, any field with an
  464. // empty value appearing in NullFields will be sent to the server as
  465. // null. It is an error if a field in this list has a non-empty value.
  466. // This may be used to include null fields in Patch requests.
  467. NullFields []string `json:"-"`
  468. }
  469. func (s *CreateInstanceRequest) MarshalJSON() ([]byte, error) {
  470. type NoMethod CreateInstanceRequest
  471. raw := NoMethod(*s)
  472. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  473. }
  474. // CreateSessionRequest: The request for CreateSession.
  475. type CreateSessionRequest struct {
  476. // Session: The session to create.
  477. Session *Session `json:"session,omitempty"`
  478. // ForceSendFields is a list of field names (e.g. "Session") to
  479. // unconditionally include in API requests. By default, fields with
  480. // empty values are omitted from API requests. However, any non-pointer,
  481. // non-interface field appearing in ForceSendFields will be sent to the
  482. // server regardless of whether the field is empty or not. This may be
  483. // used to include empty fields in Patch requests.
  484. ForceSendFields []string `json:"-"`
  485. // NullFields is a list of field names (e.g. "Session") to include in
  486. // API requests with the JSON null value. By default, fields with empty
  487. // values are omitted from API requests. However, any field with an
  488. // empty value appearing in NullFields will be sent to the server as
  489. // null. It is an error if a field in this list has a non-empty value.
  490. // This may be used to include null fields in Patch requests.
  491. NullFields []string `json:"-"`
  492. }
  493. func (s *CreateSessionRequest) MarshalJSON() ([]byte, error) {
  494. type NoMethod CreateSessionRequest
  495. raw := NoMethod(*s)
  496. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  497. }
  498. // Database: A Cloud Spanner database.
  499. type Database struct {
  500. // Name: Required. The name of the database. Values are of the
  501. // form
  502. // `projects/<project>/instances/<instance>/databases/<database>`,
  503. // w
  504. // here `<database>` is as specified in the `CREATE DATABASE`
  505. // statement. This name can be passed to other API methods to
  506. // identify the database.
  507. Name string `json:"name,omitempty"`
  508. // State: Output only. The current database state.
  509. //
  510. // Possible values:
  511. // "STATE_UNSPECIFIED" - Not specified.
  512. // "CREATING" - The database is still being created. Operations on the
  513. // database may fail
  514. // with `FAILED_PRECONDITION` in this state.
  515. // "READY" - The database is fully created and ready for use.
  516. State string `json:"state,omitempty"`
  517. // ServerResponse contains the HTTP response code and headers from the
  518. // server.
  519. googleapi.ServerResponse `json:"-"`
  520. // ForceSendFields is a list of field names (e.g. "Name") to
  521. // unconditionally include in API requests. By default, fields with
  522. // empty values are omitted from API requests. However, any non-pointer,
  523. // non-interface field appearing in ForceSendFields will be sent to the
  524. // server regardless of whether the field is empty or not. This may be
  525. // used to include empty fields in Patch requests.
  526. ForceSendFields []string `json:"-"`
  527. // NullFields is a list of field names (e.g. "Name") to include in API
  528. // requests with the JSON null value. By default, fields with empty
  529. // values are omitted from API requests. However, any field with an
  530. // empty value appearing in NullFields will be sent to the server as
  531. // null. It is an error if a field in this list has a non-empty value.
  532. // This may be used to include null fields in Patch requests.
  533. NullFields []string `json:"-"`
  534. }
  535. func (s *Database) MarshalJSON() ([]byte, error) {
  536. type NoMethod Database
  537. raw := NoMethod(*s)
  538. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  539. }
  540. // Delete: Arguments to delete operations.
  541. type Delete struct {
  542. // KeySet: Required. The primary keys of the rows within table to
  543. // delete.
  544. // Delete is idempotent. The transaction will succeed even if some or
  545. // all
  546. // rows do not exist.
  547. KeySet *KeySet `json:"keySet,omitempty"`
  548. // Table: Required. The table whose rows will be deleted.
  549. Table string `json:"table,omitempty"`
  550. // ForceSendFields is a list of field names (e.g. "KeySet") to
  551. // unconditionally include in API requests. By default, fields with
  552. // empty values are omitted from API requests. However, any non-pointer,
  553. // non-interface field appearing in ForceSendFields will be sent to the
  554. // server regardless of whether the field is empty or not. This may be
  555. // used to include empty fields in Patch requests.
  556. ForceSendFields []string `json:"-"`
  557. // NullFields is a list of field names (e.g. "KeySet") to include in API
  558. // requests with the JSON null value. By default, fields with empty
  559. // values are omitted from API requests. However, any field with an
  560. // empty value appearing in NullFields will be sent to the server as
  561. // null. It is an error if a field in this list has a non-empty value.
  562. // This may be used to include null fields in Patch requests.
  563. NullFields []string `json:"-"`
  564. }
  565. func (s *Delete) MarshalJSON() ([]byte, error) {
  566. type NoMethod Delete
  567. raw := NoMethod(*s)
  568. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  569. }
  570. // Empty: A generic empty message that you can re-use to avoid defining
  571. // duplicated
  572. // empty messages in your APIs. A typical example is to use it as the
  573. // request
  574. // or the response type of an API method. For instance:
  575. //
  576. // service Foo {
  577. // rpc Bar(google.protobuf.Empty) returns
  578. // (google.protobuf.Empty);
  579. // }
  580. //
  581. // The JSON representation for `Empty` is empty JSON object `{}`.
  582. type Empty struct {
  583. // ServerResponse contains the HTTP response code and headers from the
  584. // server.
  585. googleapi.ServerResponse `json:"-"`
  586. }
  587. // ExecuteSqlRequest: The request for ExecuteSql
  588. // and
  589. // ExecuteStreamingSql.
  590. type ExecuteSqlRequest struct {
  591. // ParamTypes: It is not always possible for Cloud Spanner to infer the
  592. // right SQL type
  593. // from a JSON value. For example, values of type `BYTES` and values
  594. // of type `STRING` both appear in params as JSON strings.
  595. //
  596. // In these cases, `param_types` can be used to specify the exact
  597. // SQL type for some or all of the SQL statement parameters. See
  598. // the
  599. // definition of Type for more information
  600. // about SQL types.
  601. ParamTypes map[string]Type `json:"paramTypes,omitempty"`
  602. // Params: The SQL string can contain parameter placeholders. A
  603. // parameter
  604. // placeholder consists of `'@'` followed by the parameter
  605. // name. Parameter names consist of any combination of letters,
  606. // numbers, and underscores.
  607. //
  608. // Parameters can appear anywhere that a literal value is expected. The
  609. // same
  610. // parameter name can be used more than once, for example:
  611. // "WHERE id > @msg_id AND id < @msg_id + 100"
  612. //
  613. // It is an error to execute an SQL statement with unbound
  614. // parameters.
  615. //
  616. // Parameter values are specified using `params`, which is a JSON
  617. // object whose keys are parameter names, and whose values are
  618. // the
  619. // corresponding parameter values.
  620. Params googleapi.RawMessage `json:"params,omitempty"`
  621. // PartitionToken: If present, results will be restricted to the
  622. // specified partition
  623. // previously created using PartitionQuery(). There must be an
  624. // exact
  625. // match for the values of fields common to this message and
  626. // the
  627. // PartitionQueryRequest message used to create this partition_token.
  628. PartitionToken string `json:"partitionToken,omitempty"`
  629. // QueryMode: Used to control the amount of debugging information
  630. // returned in
  631. // ResultSetStats. If partition_token is set, query_mode can only
  632. // be set to QueryMode.NORMAL.
  633. //
  634. // Possible values:
  635. // "NORMAL" - The default mode. Only the statement results are
  636. // returned.
  637. // "PLAN" - This mode returns only the query plan, without any results
  638. // or
  639. // execution statistics information.
  640. // "PROFILE" - This mode returns both the query plan and the execution
  641. // statistics along
  642. // with the results.
  643. QueryMode string `json:"queryMode,omitempty"`
  644. // ResumeToken: If this request is resuming a previously interrupted SQL
  645. // statement
  646. // execution, `resume_token` should be copied from the
  647. // last
  648. // PartialResultSet yielded before the interruption. Doing this
  649. // enables the new SQL statement execution to resume where the last one
  650. // left
  651. // off. The rest of the request parameters must exactly match
  652. // the
  653. // request that yielded this token.
  654. ResumeToken string `json:"resumeToken,omitempty"`
  655. // Sql: Required. The SQL string.
  656. Sql string `json:"sql,omitempty"`
  657. // Transaction: The transaction to use. If none is provided, the default
  658. // is a
  659. // temporary read-only transaction with strong concurrency.
  660. Transaction *TransactionSelector `json:"transaction,omitempty"`
  661. // ForceSendFields is a list of field names (e.g. "ParamTypes") to
  662. // unconditionally include in API requests. By default, fields with
  663. // empty values are omitted from API requests. However, any non-pointer,
  664. // non-interface field appearing in ForceSendFields will be sent to the
  665. // server regardless of whether the field is empty or not. This may be
  666. // used to include empty fields in Patch requests.
  667. ForceSendFields []string `json:"-"`
  668. // NullFields is a list of field names (e.g. "ParamTypes") to include in
  669. // API requests with the JSON null value. By default, fields with empty
  670. // values are omitted from API requests. However, any field with an
  671. // empty value appearing in NullFields will be sent to the server as
  672. // null. It is an error if a field in this list has a non-empty value.
  673. // This may be used to include null fields in Patch requests.
  674. NullFields []string `json:"-"`
  675. }
  676. func (s *ExecuteSqlRequest) MarshalJSON() ([]byte, error) {
  677. type NoMethod ExecuteSqlRequest
  678. raw := NoMethod(*s)
  679. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  680. }
  681. // Field: Message representing a single field of a struct.
  682. type Field struct {
  683. // Name: The name of the field. For reads, this is the column name.
  684. // For
  685. // SQL queries, it is the column alias (e.g., "Word" in the
  686. // query "SELECT 'hello' AS Word"), or the column name
  687. // (e.g.,
  688. // "ColName" in the query "SELECT ColName FROM Table"). Some
  689. // columns might have an empty name (e.g., !"SELECT
  690. // UPPER(ColName)"). Note that a query result can contain
  691. // multiple fields with the same name.
  692. Name string `json:"name,omitempty"`
  693. // Type: The type of the field.
  694. Type *Type `json:"type,omitempty"`
  695. // ForceSendFields is a list of field names (e.g. "Name") to
  696. // unconditionally include in API requests. By default, fields with
  697. // empty values are omitted from API requests. However, any non-pointer,
  698. // non-interface field appearing in ForceSendFields will be sent to the
  699. // server regardless of whether the field is empty or not. This may be
  700. // used to include empty fields in Patch requests.
  701. ForceSendFields []string `json:"-"`
  702. // NullFields is a list of field names (e.g. "Name") to include in API
  703. // requests with the JSON null value. By default, fields with empty
  704. // values are omitted from API requests. However, any field with an
  705. // empty value appearing in NullFields will be sent to the server as
  706. // null. It is an error if a field in this list has a non-empty value.
  707. // This may be used to include null fields in Patch requests.
  708. NullFields []string `json:"-"`
  709. }
  710. func (s *Field) MarshalJSON() ([]byte, error) {
  711. type NoMethod Field
  712. raw := NoMethod(*s)
  713. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  714. }
  715. // GetDatabaseDdlResponse: The response for GetDatabaseDdl.
  716. type GetDatabaseDdlResponse struct {
  717. // Statements: A list of formatted DDL statements defining the schema of
  718. // the database
  719. // specified in the request.
  720. Statements []string `json:"statements,omitempty"`
  721. // ServerResponse contains the HTTP response code and headers from the
  722. // server.
  723. googleapi.ServerResponse `json:"-"`
  724. // ForceSendFields is a list of field names (e.g. "Statements") to
  725. // unconditionally include in API requests. By default, fields with
  726. // empty values are omitted from API requests. However, any non-pointer,
  727. // non-interface field appearing in ForceSendFields will be sent to the
  728. // server regardless of whether the field is empty or not. This may be
  729. // used to include empty fields in Patch requests.
  730. ForceSendFields []string `json:"-"`
  731. // NullFields is a list of field names (e.g. "Statements") to include in
  732. // API requests with the JSON null value. By default, fields with empty
  733. // values are omitted from API requests. However, any field with an
  734. // empty value appearing in NullFields will be sent to the server as
  735. // null. It is an error if a field in this list has a non-empty value.
  736. // This may be used to include null fields in Patch requests.
  737. NullFields []string `json:"-"`
  738. }
  739. func (s *GetDatabaseDdlResponse) MarshalJSON() ([]byte, error) {
  740. type NoMethod GetDatabaseDdlResponse
  741. raw := NoMethod(*s)
  742. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  743. }
  744. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  745. type GetIamPolicyRequest struct {
  746. }
  747. // Instance: An isolated set of Cloud Spanner resources on which
  748. // databases can be hosted.
  749. type Instance struct {
  750. // Config: Required. The name of the instance's configuration. Values
  751. // are of the form
  752. // `projects/<project>/instanceConfigs/<configuration>`. See
  753. // also InstanceConfig and
  754. // ListInstanceConfigs.
  755. Config string `json:"config,omitempty"`
  756. // DisplayName: Required. The descriptive name for this instance as it
  757. // appears in UIs.
  758. // Must be unique per project and between 4 and 30 characters in length.
  759. DisplayName string `json:"displayName,omitempty"`
  760. // Labels: Cloud Labels are a flexible and lightweight mechanism for
  761. // organizing cloud
  762. // resources into groups that reflect a customer's organizational needs
  763. // and
  764. // deployment strategies. Cloud Labels can be used to filter collections
  765. // of
  766. // resources. They can be used to control how resource metrics are
  767. // aggregated.
  768. // And they can be used as arguments to policy management rules (e.g.
  769. // route,
  770. // firewall, load balancing, etc.).
  771. //
  772. // * Label keys must be between 1 and 63 characters long and must
  773. // conform to
  774. // the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  775. // * Label values must be between 0 and 63 characters long and must
  776. // conform
  777. // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
  778. // * No more than 64 labels can be associated with a given
  779. // resource.
  780. //
  781. // See https://goo.gl/xmQnxf for more information on and examples of
  782. // labels.
  783. //
  784. // If you plan to use labels in your own code, please note that
  785. // additional
  786. // characters may be allowed in the future. And so you are advised to
  787. // use an
  788. // internal label representation, such as JSON, which doesn't rely
  789. // upon
  790. // specific characters being disallowed. For example, representing
  791. // labels
  792. // as the string: name + "_" + value would prove problematic if we
  793. // were to
  794. // allow "_" in a future release.
  795. Labels map[string]string `json:"labels,omitempty"`
  796. // Name: Required. A unique identifier for the instance, which cannot be
  797. // changed
  798. // after the instance is created. Values are of the
  799. // form
  800. // `projects/<project>/instances/a-z*[a-z0-9]`. The final
  801. // segment of the name must be between 6 and 30 characters in length.
  802. Name string `json:"name,omitempty"`
  803. // NodeCount: Required. The number of nodes allocated to this instance.
  804. // This may be zero
  805. // in API responses for instances that are not yet in state
  806. // `READY`.
  807. //
  808. // See [the
  809. // documentation](https://cloud.google.com/spanner/docs/instances#node_co
  810. // unt)
  811. // for more information about nodes.
  812. NodeCount int64 `json:"nodeCount,omitempty"`
  813. // State: Output only. The current instance state. For
  814. // CreateInstance, the state must be
  815. // either omitted or set to `CREATING`. For
  816. // UpdateInstance, the state must be
  817. // either omitted or set to `READY`.
  818. //
  819. // Possible values:
  820. // "STATE_UNSPECIFIED" - Not specified.
  821. // "CREATING" - The instance is still being created. Resources may not
  822. // be
  823. // available yet, and operations such as database creation may not
  824. // work.
  825. // "READY" - The instance is fully created and ready to do work such
  826. // as
  827. // creating databases.
  828. State string `json:"state,omitempty"`
  829. // ServerResponse contains the HTTP response code and headers from the
  830. // server.
  831. googleapi.ServerResponse `json:"-"`
  832. // ForceSendFields is a list of field names (e.g. "Config") to
  833. // unconditionally include in API requests. By default, fields with
  834. // empty values are omitted from API requests. However, any non-pointer,
  835. // non-interface field appearing in ForceSendFields will be sent to the
  836. // server regardless of whether the field is empty or not. This may be
  837. // used to include empty fields in Patch requests.
  838. ForceSendFields []string `json:"-"`
  839. // NullFields is a list of field names (e.g. "Config") to include in API
  840. // requests with the JSON null value. By default, fields with empty
  841. // values are omitted from API requests. However, any field with an
  842. // empty value appearing in NullFields will be sent to the server as
  843. // null. It is an error if a field in this list has a non-empty value.
  844. // This may be used to include null fields in Patch requests.
  845. NullFields []string `json:"-"`
  846. }
  847. func (s *Instance) MarshalJSON() ([]byte, error) {
  848. type NoMethod Instance
  849. raw := NoMethod(*s)
  850. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  851. }
  852. // InstanceConfig: A possible configuration for a Cloud Spanner
  853. // instance. Configurations
  854. // define the geographic placement of nodes and their replication.
  855. type InstanceConfig struct {
  856. // DisplayName: The name of this instance configuration as it appears in
  857. // UIs.
  858. DisplayName string `json:"displayName,omitempty"`
  859. // Name: A unique identifier for the instance configuration. Values
  860. // are of the form
  861. // `projects/<project>/instanceConfigs/a-z*`
  862. Name string `json:"name,omitempty"`
  863. // ServerResponse contains the HTTP response code and headers from the
  864. // server.
  865. googleapi.ServerResponse `json:"-"`
  866. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  867. // unconditionally include in API requests. By default, fields with
  868. // empty values are omitted from API requests. However, any non-pointer,
  869. // non-interface field appearing in ForceSendFields will be sent to the
  870. // server regardless of whether the field is empty or not. This may be
  871. // used to include empty fields in Patch requests.
  872. ForceSendFields []string `json:"-"`
  873. // NullFields is a list of field names (e.g. "DisplayName") to include
  874. // in API requests with the JSON null value. By default, fields with
  875. // empty values are omitted from API requests. However, any field with
  876. // an empty value appearing in NullFields will be sent to the server as
  877. // null. It is an error if a field in this list has a non-empty value.
  878. // This may be used to include null fields in Patch requests.
  879. NullFields []string `json:"-"`
  880. }
  881. func (s *InstanceConfig) MarshalJSON() ([]byte, error) {
  882. type NoMethod InstanceConfig
  883. raw := NoMethod(*s)
  884. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  885. }
  886. // KeyRange: KeyRange represents a range of rows in a table or index.
  887. //
  888. // A range has a start key and an end key. These keys can be open
  889. // or
  890. // closed, indicating if the range includes rows with that key.
  891. //
  892. // Keys are represented by lists, where the ith value in the
  893. // list
  894. // corresponds to the ith component of the table or index primary
  895. // key.
  896. // Individual values are encoded as described here.
  897. //
  898. // For example, consider the following table definition:
  899. //
  900. // CREATE TABLE UserEvents (
  901. // UserName STRING(MAX),
  902. // EventDate STRING(10)
  903. // ) PRIMARY KEY(UserName, EventDate);
  904. //
  905. // The following keys name rows in this table:
  906. //
  907. // "Bob", "2014-09-23"
  908. //
  909. // Since the `UserEvents` table's `PRIMARY KEY` clause names
  910. // two
  911. // columns, each `UserEvents` key has two elements; the first is
  912. // the
  913. // `UserName`, and the second is the `EventDate`.
  914. //
  915. // Key ranges with multiple components are interpreted
  916. // lexicographically by component using the table or index key's
  917. // declared
  918. // sort order. For example, the following range returns all events
  919. // for
  920. // user "Bob" that occurred in the year 2015:
  921. //
  922. // "start_closed": ["Bob", "2015-01-01"]
  923. // "end_closed": ["Bob", "2015-12-31"]
  924. //
  925. // Start and end keys can omit trailing key components. This affects
  926. // the
  927. // inclusion and exclusion of rows that exactly match the provided
  928. // key
  929. // components: if the key is closed, then rows that exactly match
  930. // the
  931. // provided components are included; if the key is open, then rows
  932. // that exactly match are not included.
  933. //
  934. // For example, the following range includes all events for "Bob"
  935. // that
  936. // occurred during and after the year 2000:
  937. //
  938. // "start_closed": ["Bob", "2000-01-01"]
  939. // "end_closed": ["Bob"]
  940. //
  941. // The next example retrieves all events for "Bob":
  942. //
  943. // "start_closed": ["Bob"]
  944. // "end_closed": ["Bob"]
  945. //
  946. // To retrieve events before the year 2000:
  947. //
  948. // "start_closed": ["Bob"]
  949. // "end_open": ["Bob", "2000-01-01"]
  950. //
  951. // The following range includes all rows in the table:
  952. //
  953. // "start_closed": []
  954. // "end_closed": []
  955. //
  956. // This range returns all users whose `UserName` begins with
  957. // any
  958. // character from A to C:
  959. //
  960. // "start_closed": ["A"]
  961. // "end_open": ["D"]
  962. //
  963. // This range returns all users whose `UserName` begins with B:
  964. //
  965. // "start_closed": ["B"]
  966. // "end_open": ["C"]
  967. //
  968. // Key ranges honor column sort order. For example, suppose a table
  969. // is
  970. // defined as follows:
  971. //
  972. // CREATE TABLE DescendingSortedTable {
  973. // Key INT64,
  974. // ...
  975. // ) PRIMARY KEY(Key DESC);
  976. //
  977. // The following range retrieves all rows with key values between 1
  978. // and 100 inclusive:
  979. //
  980. // "start_closed": ["100"]
  981. // "end_closed": ["1"]
  982. //
  983. // Note that 100 is passed as the start, and 1 is passed as the
  984. // end,
  985. // because `Key` is a descending column in the schema.
  986. type KeyRange struct {
  987. // EndClosed: If the end is closed, then the range includes all rows
  988. // whose
  989. // first `len(end_closed)` key columns exactly match `end_closed`.
  990. EndClosed []interface{} `json:"endClosed,omitempty"`
  991. // EndOpen: If the end is open, then the range excludes rows whose
  992. // first
  993. // `len(end_open)` key columns exactly match `end_open`.
  994. EndOpen []interface{} `json:"endOpen,omitempty"`
  995. // StartClosed: If the start is closed, then the range includes all rows
  996. // whose
  997. // first `len(start_closed)` key columns exactly match `start_closed`.
  998. StartClosed []interface{} `json:"startClosed,omitempty"`
  999. // StartOpen: If the start is open, then the range excludes rows whose
  1000. // first
  1001. // `len(start_open)` key columns exactly match `start_open`.
  1002. StartOpen []interface{} `json:"startOpen,omitempty"`
  1003. // ForceSendFields is a list of field names (e.g. "EndClosed") to
  1004. // unconditionally include in API requests. By default, fields with
  1005. // empty values are omitted from API requests. However, any non-pointer,
  1006. // non-interface field appearing in ForceSendFields will be sent to the
  1007. // server regardless of whether the field is empty or not. This may be
  1008. // used to include empty fields in Patch requests.
  1009. ForceSendFields []string `json:"-"`
  1010. // NullFields is a list of field names (e.g. "EndClosed") to include in
  1011. // API requests with the JSON null value. By default, fields with empty
  1012. // values are omitted from API requests. However, any field with an
  1013. // empty value appearing in NullFields will be sent to the server as
  1014. // null. It is an error if a field in this list has a non-empty value.
  1015. // This may be used to include null fields in Patch requests.
  1016. NullFields []string `json:"-"`
  1017. }
  1018. func (s *KeyRange) MarshalJSON() ([]byte, error) {
  1019. type NoMethod KeyRange
  1020. raw := NoMethod(*s)
  1021. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1022. }
  1023. // KeySet: `KeySet` defines a collection of Cloud Spanner keys and/or
  1024. // key ranges. All
  1025. // the keys are expected to be in the same table or index. The keys
  1026. // need
  1027. // not be sorted in any particular way.
  1028. //
  1029. // If the same key is specified multiple times in the set (for
  1030. // example
  1031. // if two ranges, two keys, or a key and a range overlap), Cloud
  1032. // Spanner
  1033. // behaves as if the key were only specified once.
  1034. type KeySet struct {
  1035. // All: For convenience `all` can be set to `true` to indicate that
  1036. // this
  1037. // `KeySet` matches all keys in the table or index. Note that any
  1038. // keys
  1039. // specified in `keys` or `ranges` are only yielded once.
  1040. All bool `json:"all,omitempty"`
  1041. // Keys: A list of specific keys. Entries in `keys` should have exactly
  1042. // as
  1043. // many elements as there are columns in the primary or index key
  1044. // with which this `KeySet` is used. Individual key values are
  1045. // encoded as described here.
  1046. Keys [][]interface{} `json:"keys,omitempty"`
  1047. // Ranges: A list of key ranges. See KeyRange for more information
  1048. // about
  1049. // key range specifications.
  1050. Ranges []*KeyRange `json:"ranges,omitempty"`
  1051. // ForceSendFields is a list of field names (e.g. "All") to
  1052. // unconditionally include in API requests. By default, fields with
  1053. // empty values are omitted from API requests. However, any non-pointer,
  1054. // non-interface field appearing in ForceSendFields will be sent to the
  1055. // server regardless of whether the field is empty or not. This may be
  1056. // used to include empty fields in Patch requests.
  1057. ForceSendFields []string `json:"-"`
  1058. // NullFields is a list of field names (e.g. "All") to include in API
  1059. // requests with the JSON null value. By default, fields with empty
  1060. // values are omitted from API requests. However, any field with an
  1061. // empty value appearing in NullFields will be sent to the server as
  1062. // null. It is an error if a field in this list has a non-empty value.
  1063. // This may be used to include null fields in Patch requests.
  1064. NullFields []string `json:"-"`
  1065. }
  1066. func (s *KeySet) MarshalJSON() ([]byte, error) {
  1067. type NoMethod KeySet
  1068. raw := NoMethod(*s)
  1069. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1070. }
  1071. // ListDatabasesResponse: The response for ListDatabases.
  1072. type ListDatabasesResponse struct {
  1073. // Databases: Databases that matched the request.
  1074. Databases []*Database `json:"databases,omitempty"`
  1075. // NextPageToken: `next_page_token` can be sent in a
  1076. // subsequent
  1077. // ListDatabases call to fetch more
  1078. // of the matching databases.
  1079. NextPageToken string `json:"nextPageToken,omitempty"`
  1080. // ServerResponse contains the HTTP response code and headers from the
  1081. // server.
  1082. googleapi.ServerResponse `json:"-"`
  1083. // ForceSendFields is a list of field names (e.g. "Databases") to
  1084. // unconditionally include in API requests. By default, fields with
  1085. // empty values are omitted from API requests. However, any non-pointer,
  1086. // non-interface field appearing in ForceSendFields will be sent to the
  1087. // server regardless of whether the field is empty or not. This may be
  1088. // used to include empty fields in Patch requests.
  1089. ForceSendFields []string `json:"-"`
  1090. // NullFields is a list of field names (e.g. "Databases") to include in
  1091. // API requests with the JSON null value. By default, fields with empty
  1092. // values are omitted from API requests. However, any field with an
  1093. // empty value appearing in NullFields will be sent to the server as
  1094. // null. It is an error if a field in this list has a non-empty value.
  1095. // This may be used to include null fields in Patch requests.
  1096. NullFields []string `json:"-"`
  1097. }
  1098. func (s *ListDatabasesResponse) MarshalJSON() ([]byte, error) {
  1099. type NoMethod ListDatabasesResponse
  1100. raw := NoMethod(*s)
  1101. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1102. }
  1103. // ListInstanceConfigsResponse: The response for ListInstanceConfigs.
  1104. type ListInstanceConfigsResponse struct {
  1105. // InstanceConfigs: The list of requested instance configurations.
  1106. InstanceConfigs []*InstanceConfig `json:"instanceConfigs,omitempty"`
  1107. // NextPageToken: `next_page_token` can be sent in a
  1108. // subsequent
  1109. // ListInstanceConfigs call to
  1110. // fetch more of the matching instance configurations.
  1111. NextPageToken string `json:"nextPageToken,omitempty"`
  1112. // ServerResponse contains the HTTP response code and headers from the
  1113. // server.
  1114. googleapi.ServerResponse `json:"-"`
  1115. // ForceSendFields is a list of field names (e.g. "InstanceConfigs") to
  1116. // unconditionally include in API requests. By default, fields with
  1117. // empty values are omitted from API requests. However, any non-pointer,
  1118. // non-interface field appearing in ForceSendFields will be sent to the
  1119. // server regardless of whether the field is empty or not. This may be
  1120. // used to include empty fields in Patch requests.
  1121. ForceSendFields []string `json:"-"`
  1122. // NullFields is a list of field names (e.g. "InstanceConfigs") to
  1123. // include in API requests with the JSON null value. By default, fields
  1124. // with empty values are omitted from API requests. However, any field
  1125. // with an empty value appearing in NullFields will be sent to the
  1126. // server as null. It is an error if a field in this list has a
  1127. // non-empty value. This may be used to include null fields in Patch
  1128. // requests.
  1129. NullFields []string `json:"-"`
  1130. }
  1131. func (s *ListInstanceConfigsResponse) MarshalJSON() ([]byte, error) {
  1132. type NoMethod ListInstanceConfigsResponse
  1133. raw := NoMethod(*s)
  1134. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1135. }
  1136. // ListInstancesResponse: The response for ListInstances.
  1137. type ListInstancesResponse struct {
  1138. // Instances: The list of requested instances.
  1139. Instances []*Instance `json:"instances,omitempty"`
  1140. // NextPageToken: `next_page_token` can be sent in a
  1141. // subsequent
  1142. // ListInstances call to fetch more
  1143. // of the matching instances.
  1144. NextPageToken string `json:"nextPageToken,omitempty"`
  1145. // ServerResponse contains the HTTP response code and headers from the
  1146. // server.
  1147. googleapi.ServerResponse `json:"-"`
  1148. // ForceSendFields is a list of field names (e.g. "Instances") to
  1149. // unconditionally include in API requests. By default, fields with
  1150. // empty values are omitted from API requests. However, any non-pointer,
  1151. // non-interface field appearing in ForceSendFields will be sent to the
  1152. // server regardless of whether the field is empty or not. This may be
  1153. // used to include empty fields in Patch requests.
  1154. ForceSendFields []string `json:"-"`
  1155. // NullFields is a list of field names (e.g. "Instances") to include in
  1156. // API requests with the JSON null value. By default, fields with empty
  1157. // values are omitted from API requests. However, any field with an
  1158. // empty value appearing in NullFields will be sent to the server as
  1159. // null. It is an error if a field in this list has a non-empty value.
  1160. // This may be used to include null fields in Patch requests.
  1161. NullFields []string `json:"-"`
  1162. }
  1163. func (s *ListInstancesResponse) MarshalJSON() ([]byte, error) {
  1164. type NoMethod ListInstancesResponse
  1165. raw := NoMethod(*s)
  1166. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1167. }
  1168. // ListOperationsResponse: The response message for
  1169. // Operations.ListOperations.
  1170. type ListOperationsResponse struct {
  1171. // NextPageToken: The standard List next-page token.
  1172. NextPageToken string `json:"nextPageToken,omitempty"`
  1173. // Operations: A list of operations that matches the specified filter in
  1174. // the request.
  1175. Operations []*Operation `json:"operations,omitempty"`
  1176. // ServerResponse contains the HTTP response code and headers from the
  1177. // server.
  1178. googleapi.ServerResponse `json:"-"`
  1179. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1180. // unconditionally include in API requests. By default, fields with
  1181. // empty values are omitted from API requests. However, any non-pointer,
  1182. // non-interface field appearing in ForceSendFields will be sent to the
  1183. // server regardless of whether the field is empty or not. This may be
  1184. // used to include empty fields in Patch requests.
  1185. ForceSendFields []string `json:"-"`
  1186. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1187. // in API requests with the JSON null value. By default, fields with
  1188. // empty values are omitted from API requests. However, any field with
  1189. // an empty value appearing in NullFields will be sent to the server as
  1190. // null. It is an error if a field in this list has a non-empty value.
  1191. // This may be used to include null fields in Patch requests.
  1192. NullFields []string `json:"-"`
  1193. }
  1194. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  1195. type NoMethod ListOperationsResponse
  1196. raw := NoMethod(*s)
  1197. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1198. }
  1199. // ListSessionsResponse: The response for ListSessions.
  1200. type ListSessionsResponse struct {
  1201. // NextPageToken: `next_page_token` can be sent in a
  1202. // subsequent
  1203. // ListSessions call to fetch more of the matching
  1204. // sessions.
  1205. NextPageToken string `json:"nextPageToken,omitempty"`
  1206. // Sessions: The list of requested sessions.
  1207. Sessions []*Session `json:"sessions,omitempty"`
  1208. // ServerResponse contains the HTTP response code and headers from the
  1209. // server.
  1210. googleapi.ServerResponse `json:"-"`
  1211. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1212. // unconditionally include in API requests. By default, fields with
  1213. // empty values are omitted from API requests. However, any non-pointer,
  1214. // non-interface field appearing in ForceSendFields will be sent to the
  1215. // server regardless of whether the field is empty or not. This may be
  1216. // used to include empty fields in Patch requests.
  1217. ForceSendFields []string `json:"-"`
  1218. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1219. // in API requests with the JSON null value. By default, fields with
  1220. // empty values are omitted from API requests. However, any field with
  1221. // an empty value appearing in NullFields will be sent to the server as
  1222. // null. It is an error if a field in this list has a non-empty value.
  1223. // This may be used to include null fields in Patch requests.
  1224. NullFields []string `json:"-"`
  1225. }
  1226. func (s *ListSessionsResponse) MarshalJSON() ([]byte, error) {
  1227. type NoMethod ListSessionsResponse
  1228. raw := NoMethod(*s)
  1229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1230. }
  1231. // Mutation: A modification to one or more Cloud Spanner rows.
  1232. // Mutations can be
  1233. // applied to a Cloud Spanner database by sending them in a
  1234. // Commit call.
  1235. type Mutation struct {
  1236. // Delete: Delete rows from a table. Succeeds whether or not the
  1237. // named
  1238. // rows were present.
  1239. Delete *Delete `json:"delete,omitempty"`
  1240. // Insert: Insert new rows in a table. If any of the rows already
  1241. // exist,
  1242. // the write or transaction fails with error `ALREADY_EXISTS`.
  1243. Insert *Write `json:"insert,omitempty"`
  1244. // InsertOrUpdate: Like insert, except that if the row already exists,
  1245. // then
  1246. // its column values are overwritten with the ones provided. Any
  1247. // column values not explicitly written are preserved.
  1248. InsertOrUpdate *Write `json:"insertOrUpdate,omitempty"`
  1249. // Replace: Like insert, except that if the row already exists, it
  1250. // is
  1251. // deleted, and the column values provided are inserted
  1252. // instead. Unlike insert_or_update, this means any values
  1253. // not
  1254. // explicitly written become `NULL`.
  1255. Replace *Write `json:"replace,omitempty"`
  1256. // Update: Update existing rows in a table. If any of the rows does
  1257. // not
  1258. // already exist, the transaction fails with error `NOT_FOUND`.
  1259. Update *Write `json:"update,omitempty"`
  1260. // ForceSendFields is a list of field names (e.g. "Delete") to
  1261. // unconditionally include in API requests. By default, fields with
  1262. // empty values are omitted from API requests. However, any non-pointer,
  1263. // non-interface field appearing in ForceSendFields will be sent to the
  1264. // server regardless of whether the field is empty or not. This may be
  1265. // used to include empty fields in Patch requests.
  1266. ForceSendFields []string `json:"-"`
  1267. // NullFields is a list of field names (e.g. "Delete") to include in API
  1268. // requests with the JSON null value. By default, fields with empty
  1269. // values are omitted from API requests. However, any field with an
  1270. // empty value appearing in NullFields will be sent to the server as
  1271. // null. It is an error if a field in this list has a non-empty value.
  1272. // This may be used to include null fields in Patch requests.
  1273. NullFields []string `json:"-"`
  1274. }
  1275. func (s *Mutation) MarshalJSON() ([]byte, error) {
  1276. type NoMethod Mutation
  1277. raw := NoMethod(*s)
  1278. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1279. }
  1280. // Operation: This resource represents a long-running operation that is
  1281. // the result of a
  1282. // network API call.
  1283. type Operation struct {
  1284. // Done: If the value is `false`, it means the operation is still in
  1285. // progress.
  1286. // If `true`, the operation is completed, and either `error` or
  1287. // `response` is
  1288. // available.
  1289. Done bool `json:"done,omitempty"`
  1290. // Error: The error result of the operation in case of failure or
  1291. // cancellation.
  1292. Error *Status `json:"error,omitempty"`
  1293. // Metadata: Service-specific metadata associated with the operation.
  1294. // It typically
  1295. // contains progress information and common metadata such as create
  1296. // time.
  1297. // Some services might not provide such metadata. Any method that
  1298. // returns a
  1299. // long-running operation should document the metadata type, if any.
  1300. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1301. // Name: The server-assigned name, which is only unique within the same
  1302. // service that
  1303. // originally returns it. If you use the default HTTP mapping,
  1304. // the
  1305. // `name` should have the format of `operations/some/unique/name`.
  1306. Name string `json:"name,omitempty"`
  1307. // Response: The normal response of the operation in case of success.
  1308. // If the original
  1309. // method returns no data on success, such as `Delete`, the response
  1310. // is
  1311. // `google.protobuf.Empty`. If the original method is
  1312. // standard
  1313. // `Get`/`Create`/`Update`, the response should be the resource. For
  1314. // other
  1315. // methods, the response should have the type `XxxResponse`, where
  1316. // `Xxx`
  1317. // is the original method name. For example, if the original method
  1318. // name
  1319. // is `TakeSnapshot()`, the inferred response type
  1320. // is
  1321. // `TakeSnapshotResponse`.
  1322. Response googleapi.RawMessage `json:"response,omitempty"`
  1323. // ServerResponse contains the HTTP response code and headers from the
  1324. // server.
  1325. googleapi.ServerResponse `json:"-"`
  1326. // ForceSendFields is a list of field names (e.g. "Done") to
  1327. // unconditionally include in API requests. By default, fields with
  1328. // empty values are omitted from API requests. However, any non-pointer,
  1329. // non-interface field appearing in ForceSendFields will be sent to the
  1330. // server regardless of whether the field is empty or not. This may be
  1331. // used to include empty fields in Patch requests.
  1332. ForceSendFields []string `json:"-"`
  1333. // NullFields is a list of field names (e.g. "Done") to include in API
  1334. // requests with the JSON null value. By default, fields with empty
  1335. // values are omitted from API requests. However, any field with an
  1336. // empty value appearing in NullFields will be sent to the server as
  1337. // null. It is an error if a field in this list has a non-empty value.
  1338. // This may be used to include null fields in Patch requests.
  1339. NullFields []string `json:"-"`
  1340. }
  1341. func (s *Operation) MarshalJSON() ([]byte, error) {
  1342. type NoMethod Operation
  1343. raw := NoMethod(*s)
  1344. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1345. }
  1346. // PartialResultSet: Partial results from a streaming read or SQL query.
  1347. // Streaming reads and
  1348. // SQL queries better tolerate large result sets, large rows, and
  1349. // large
  1350. // values, but are a little trickier to consume.
  1351. type PartialResultSet struct {
  1352. // ChunkedValue: If true, then the final value in values is chunked, and
  1353. // must
  1354. // be combined with more values from subsequent `PartialResultSet`s
  1355. // to obtain a complete field value.
  1356. ChunkedValue bool `json:"chunkedValue,omitempty"`
  1357. // Metadata: Metadata about the result set, such as row type
  1358. // information.
  1359. // Only present in the first response.
  1360. Metadata *ResultSetMetadata `json:"metadata,omitempty"`
  1361. // ResumeToken: Streaming calls might be interrupted for a variety of
  1362. // reasons, such
  1363. // as TCP connection loss. If this occurs, the stream of results can
  1364. // be resumed by re-sending the original request and
  1365. // including
  1366. // `resume_token`. Note that executing any other transaction in the
  1367. // same session invalidates the token.
  1368. ResumeToken string `json:"resumeToken,omitempty"`
  1369. // Stats: Query plan and execution statistics for the statement that
  1370. // produced this
  1371. // streaming result set. These can be requested by
  1372. // setting
  1373. // ExecuteSqlRequest.query_mode and are sent
  1374. // only once with the last response in the stream.
  1375. Stats *ResultSetStats `json:"stats,omitempty"`
  1376. // Values: A streamed result set consists of a stream of values, which
  1377. // might
  1378. // be split into many `PartialResultSet` messages to accommodate
  1379. // large rows and/or large values. Every N complete values defines
  1380. // a
  1381. // row, where N is equal to the number of entries
  1382. // in
  1383. // metadata.row_type.fields.
  1384. //
  1385. // Most values are encoded based on type as described
  1386. // here.
  1387. //
  1388. // It is possible that the last value in values is "chunked",
  1389. // meaning that the rest of the value is sent in
  1390. // subsequent
  1391. // `PartialResultSet`(s). This is denoted by the chunked_value
  1392. // field. Two or more chunked values can be merged to form a
  1393. // complete value as follows:
  1394. //
  1395. // * `bool/number/null`: cannot be chunked
  1396. // * `string`: concatenate the strings
  1397. // * `list`: concatenate the lists. If the last element in a list is
  1398. // a
  1399. // `string`, `list`, or `object`, merge it with the first element
  1400. // in
  1401. // the next list by applying these rules recursively.
  1402. // * `object`: concatenate the (field name, field value) pairs. If a
  1403. // field name is duplicated, then apply these rules recursively
  1404. // to merge the field values.
  1405. //
  1406. // Some examples of merging:
  1407. //
  1408. // # Strings are concatenated.
  1409. // "foo", "bar" => "foobar"
  1410. //
  1411. // # Lists of non-strings are concatenated.
  1412. // [2, 3], [4] => [2, 3, 4]
  1413. //
  1414. // # Lists are concatenated, but the last and first elements are
  1415. // merged
  1416. // # because they are strings.
  1417. // ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
  1418. //
  1419. // # Lists are concatenated, but the last and first elements are
  1420. // merged
  1421. // # because they are lists. Recursively, the last and first
  1422. // elements
  1423. // # of the inner lists are merged because they are strings.
  1424. // ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
  1425. //
  1426. // # Non-overlapping object fields are combined.
  1427. // {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
  1428. //
  1429. // # Overlapping object fields are merged.
  1430. // {"a": "1"}, {"a": "2"} => {"a": "12"}
  1431. //
  1432. // # Examples of merging objects containing lists of strings.
  1433. // {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
  1434. //
  1435. // For a more complete example, suppose a streaming SQL query
  1436. // is
  1437. // yielding a result set whose rows contain a single string
  1438. // field. The following `PartialResultSet`s might be yielded:
  1439. //
  1440. // {
  1441. // "metadata": { ... }
  1442. // "values": ["Hello", "W"]
  1443. // "chunked_value": true
  1444. // "resume_token": "Af65..."
  1445. // }
  1446. // {
  1447. // "values": ["orl"]
  1448. // "chunked_value": true
  1449. // "resume_token": "Bqp2..."
  1450. // }
  1451. // {
  1452. // "values": ["d"]
  1453. // "resume_token": "Zx1B..."
  1454. // }
  1455. //
  1456. // This sequence of `PartialResultSet`s encodes two rows, one
  1457. // containing the field value "Hello", and a second containing
  1458. // the
  1459. // field value "World" = "W" + "orl" + "d".
  1460. Values []interface{} `json:"values,omitempty"`
  1461. // ServerResponse contains the HTTP response code and headers from the
  1462. // server.
  1463. googleapi.ServerResponse `json:"-"`
  1464. // ForceSendFields is a list of field names (e.g. "ChunkedValue") to
  1465. // unconditionally include in API requests. By default, fields with
  1466. // empty values are omitted from API requests. However, any non-pointer,
  1467. // non-interface field appearing in ForceSendFields will be sent to the
  1468. // server regardless of whether the field is empty or not. This may be
  1469. // used to include empty fields in Patch requests.
  1470. ForceSendFields []string `json:"-"`
  1471. // NullFields is a list of field names (e.g. "ChunkedValue") to include
  1472. // in API requests with the JSON null value. By default, fields with
  1473. // empty values are omitted from API requests. However, any field with
  1474. // an empty value appearing in NullFields will be sent to the server as
  1475. // null. It is an error if a field in this list has a non-empty value.
  1476. // This may be used to include null fields in Patch requests.
  1477. NullFields []string `json:"-"`
  1478. }
  1479. func (s *PartialResultSet) MarshalJSON() ([]byte, error) {
  1480. type NoMethod PartialResultSet
  1481. raw := NoMethod(*s)
  1482. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1483. }
  1484. // Partition: Information returned for each partition returned in
  1485. // a
  1486. // PartitionResponse.
  1487. type Partition struct {
  1488. // PartitionToken: This token can be passed to Read, StreamingRead,
  1489. // ExecuteSql, or
  1490. // ExecuteStreamingSql requests to restrict the results to those
  1491. // identified by
  1492. // this partition token.
  1493. PartitionToken string `json:"partitionToken,omitempty"`
  1494. // ForceSendFields is a list of field names (e.g. "PartitionToken") to
  1495. // unconditionally include in API requests. By default, fields with
  1496. // empty values are omitted from API requests. However, any non-pointer,
  1497. // non-interface field appearing in ForceSendFields will be sent to the
  1498. // server regardless of whether the field is empty or not. This may be
  1499. // used to include empty fields in Patch requests.
  1500. ForceSendFields []string `json:"-"`
  1501. // NullFields is a list of field names (e.g. "PartitionToken") to
  1502. // include in API requests with the JSON null value. By default, fields
  1503. // with empty values are omitted from API requests. However, any field
  1504. // with an empty value appearing in NullFields will be sent to the
  1505. // server as null. It is an error if a field in this list has a
  1506. // non-empty value. This may be used to include null fields in Patch
  1507. // requests.
  1508. NullFields []string `json:"-"`
  1509. }
  1510. func (s *Partition) MarshalJSON() ([]byte, error) {
  1511. type NoMethod Partition
  1512. raw := NoMethod(*s)
  1513. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1514. }
  1515. // PartitionOptions: Options for a PartitionQueryRequest
  1516. // and
  1517. // PartitionReadRequest.
  1518. type PartitionOptions struct {
  1519. // MaxPartitions: **Note:** This hint is currently ignored by
  1520. // PartitionQuery and
  1521. // PartitionRead requests.
  1522. //
  1523. // The desired maximum number of partitions to return. For example,
  1524. // this may
  1525. // be set to the number of workers available. The default for this
  1526. // option
  1527. // is currently 10,000. The maximum value is currently 200,000. This is
  1528. // only
  1529. // a hint. The actual number of partitions returned may be smaller or
  1530. // larger
  1531. // than this maximum count request.
  1532. MaxPartitions int64 `json:"maxPartitions,omitempty,string"`
  1533. // PartitionSizeBytes: **Note:** This hint is currently ignored by
  1534. // PartitionQuery and
  1535. // PartitionRead requests.
  1536. //
  1537. // The desired data size for each partition generated. The default for
  1538. // this
  1539. // option is currently 1 GiB. This is only a hint. The actual size of
  1540. // each
  1541. // partition may be smaller or larger than this size request.
  1542. PartitionSizeBytes int64 `json:"partitionSizeBytes,omitempty,string"`
  1543. // ForceSendFields is a list of field names (e.g. "MaxPartitions") to
  1544. // unconditionally include in API requests. By default, fields with
  1545. // empty values are omitted from API requests. However, any non-pointer,
  1546. // non-interface field appearing in ForceSendFields will be sent to the
  1547. // server regardless of whether the field is empty or not. This may be
  1548. // used to include empty fields in Patch requests.
  1549. ForceSendFields []string `json:"-"`
  1550. // NullFields is a list of field names (e.g. "MaxPartitions") to include
  1551. // in API requests with the JSON null value. By default, fields with
  1552. // empty values are omitted from API requests. However, any field with
  1553. // an empty value appearing in NullFields will be sent to the server as
  1554. // null. It is an error if a field in this list has a non-empty value.
  1555. // This may be used to include null fields in Patch requests.
  1556. NullFields []string `json:"-"`
  1557. }
  1558. func (s *PartitionOptions) MarshalJSON() ([]byte, error) {
  1559. type NoMethod PartitionOptions
  1560. raw := NoMethod(*s)
  1561. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1562. }
  1563. // PartitionQueryRequest: The request for PartitionQuery
  1564. type PartitionQueryRequest struct {
  1565. // ParamTypes: It is not always possible for Cloud Spanner to infer the
  1566. // right SQL type
  1567. // from a JSON value. For example, values of type `BYTES` and values
  1568. // of type `STRING` both appear in params as JSON strings.
  1569. //
  1570. // In these cases, `param_types` can be used to specify the exact
  1571. // SQL type for some or all of the SQL query parameters. See
  1572. // the
  1573. // definition of Type for more information
  1574. // about SQL types.
  1575. ParamTypes map[string]Type `json:"paramTypes,omitempty"`
  1576. // Params: The SQL query string can contain parameter placeholders. A
  1577. // parameter
  1578. // placeholder consists of `'@'` followed by the parameter
  1579. // name. Parameter names consist of any combination of letters,
  1580. // numbers, and underscores.
  1581. //
  1582. // Parameters can appear anywhere that a literal value is expected. The
  1583. // same
  1584. // parameter name can be used more than once, for example:
  1585. // "WHERE id > @msg_id AND id < @msg_id + 100"
  1586. //
  1587. // It is an error to execute an SQL query with unbound
  1588. // parameters.
  1589. //
  1590. // Parameter values are specified using `params`, which is a JSON
  1591. // object whose keys are parameter names, and whose values are
  1592. // the
  1593. // corresponding parameter values.
  1594. Params googleapi.RawMessage `json:"params,omitempty"`
  1595. // PartitionOptions: Additional options that affect how many partitions
  1596. // are created.
  1597. PartitionOptions *PartitionOptions `json:"partitionOptions,omitempty"`
  1598. // Sql: The query request to generate partitions for. The request will
  1599. // fail if
  1600. // the query is not root partitionable. The query plan of a
  1601. // root
  1602. // partitionable query has a single distributed union operator. A
  1603. // distributed
  1604. // union operator conceptually divides one or more tables into
  1605. // multiple
  1606. // splits, remotely evaluates a subquery independently on each split,
  1607. // and
  1608. // then unions all results.
  1609. Sql string `json:"sql,omitempty"`
  1610. // Transaction: Read only snapshot transactions are supported,
  1611. // read/write and single use
  1612. // transactions are not.
  1613. Transaction *TransactionSelector `json:"transaction,omitempty"`
  1614. // ForceSendFields is a list of field names (e.g. "ParamTypes") to
  1615. // unconditionally include in API requests. By default, fields with
  1616. // empty values are omitted from API requests. However, any non-pointer,
  1617. // non-interface field appearing in ForceSendFields will be sent to the
  1618. // server regardless of whether the field is empty or not. This may be
  1619. // used to include empty fields in Patch requests.
  1620. ForceSendFields []string `json:"-"`
  1621. // NullFields is a list of field names (e.g. "ParamTypes") to include in
  1622. // API requests with the JSON null value. By default, fields with empty
  1623. // values are omitted from API requests. However, any field with an
  1624. // empty value appearing in NullFields will be sent to the server as
  1625. // null. It is an error if a field in this list has a non-empty value.
  1626. // This may be used to include null fields in Patch requests.
  1627. NullFields []string `json:"-"`
  1628. }
  1629. func (s *PartitionQueryRequest) MarshalJSON() ([]byte, error) {
  1630. type NoMethod PartitionQueryRequest
  1631. raw := NoMethod(*s)
  1632. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1633. }
  1634. // PartitionReadRequest: The request for PartitionRead
  1635. type PartitionReadRequest struct {
  1636. // Columns: The columns of table to be returned for each row
  1637. // matching
  1638. // this request.
  1639. Columns []string `json:"columns,omitempty"`
  1640. // Index: If non-empty, the name of an index on table. This index
  1641. // is
  1642. // used instead of the table primary key when interpreting key_set
  1643. // and sorting result rows. See key_set for further information.
  1644. Index string `json:"index,omitempty"`
  1645. // KeySet: Required. `key_set` identifies the rows to be yielded.
  1646. // `key_set` names the
  1647. // primary keys of the rows in table to be yielded, unless index
  1648. // is present. If index is present, then key_set instead names
  1649. // index keys in index.
  1650. //
  1651. // It is not an error for the `key_set` to name rows that do not
  1652. // exist in the database. Read yields nothing for nonexistent rows.
  1653. KeySet *KeySet `json:"keySet,omitempty"`
  1654. // PartitionOptions: Additional options that affect how many partitions
  1655. // are created.
  1656. PartitionOptions *PartitionOptions `json:"partitionOptions,omitempty"`
  1657. // Table: Required. The name of the table in the database to be read.
  1658. Table string `json:"table,omitempty"`
  1659. // Transaction: Read only snapshot transactions are supported,
  1660. // read/write and single use
  1661. // transactions are not.
  1662. Transaction *TransactionSelector `json:"transaction,omitempty"`
  1663. // ForceSendFields is a list of field names (e.g. "Columns") to
  1664. // unconditionally include in API requests. By default, fields with
  1665. // empty values are omitted from API requests. However, any non-pointer,
  1666. // non-interface field appearing in ForceSendFields will be sent to the
  1667. // server regardless of whether the field is empty or not. This may be
  1668. // used to include empty fields in Patch requests.
  1669. ForceSendFields []string `json:"-"`
  1670. // NullFields is a list of field names (e.g. "Columns") to include in
  1671. // API requests with the JSON null value. By default, fields with empty
  1672. // values are omitted from API requests. However, any field with an
  1673. // empty value appearing in NullFields will be sent to the server as
  1674. // null. It is an error if a field in this list has a non-empty value.
  1675. // This may be used to include null fields in Patch requests.
  1676. NullFields []string `json:"-"`
  1677. }
  1678. func (s *PartitionReadRequest) MarshalJSON() ([]byte, error) {
  1679. type NoMethod PartitionReadRequest
  1680. raw := NoMethod(*s)
  1681. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1682. }
  1683. // PartitionResponse: The response for PartitionQuery
  1684. // or PartitionRead
  1685. type PartitionResponse struct {
  1686. // Partitions: Partitions created by this request.
  1687. Partitions []*Partition `json:"partitions,omitempty"`
  1688. // Transaction: Transaction created by this request.
  1689. Transaction *Transaction `json:"transaction,omitempty"`
  1690. // ServerResponse contains the HTTP response code and headers from the
  1691. // server.
  1692. googleapi.ServerResponse `json:"-"`
  1693. // ForceSendFields is a list of field names (e.g. "Partitions") to
  1694. // unconditionally include in API requests. By default, fields with
  1695. // empty values are omitted from API requests. However, any non-pointer,
  1696. // non-interface field appearing in ForceSendFields will be sent to the
  1697. // server regardless of whether the field is empty or not. This may be
  1698. // used to include empty fields in Patch requests.
  1699. ForceSendFields []string `json:"-"`
  1700. // NullFields is a list of field names (e.g. "Partitions") to include in
  1701. // API requests with the JSON null value. By default, fields with empty
  1702. // values are omitted from API requests. However, any field with an
  1703. // empty value appearing in NullFields will be sent to the server as
  1704. // null. It is an error if a field in this list has a non-empty value.
  1705. // This may be used to include null fields in Patch requests.
  1706. NullFields []string `json:"-"`
  1707. }
  1708. func (s *PartitionResponse) MarshalJSON() ([]byte, error) {
  1709. type NoMethod PartitionResponse
  1710. raw := NoMethod(*s)
  1711. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1712. }
  1713. // PlanNode: Node information for nodes appearing in a
  1714. // QueryPlan.plan_nodes.
  1715. type PlanNode struct {
  1716. // ChildLinks: List of child node `index`es and their relationship to
  1717. // this parent.
  1718. ChildLinks []*ChildLink `json:"childLinks,omitempty"`
  1719. // DisplayName: The display name for the node.
  1720. DisplayName string `json:"displayName,omitempty"`
  1721. // ExecutionStats: The execution statistics associated with the node,
  1722. // contained in a group of
  1723. // key-value pairs. Only present if the plan was returned as a result of
  1724. // a
  1725. // profile query. For example, number of executions, number of rows/time
  1726. // per
  1727. // execution etc.
  1728. ExecutionStats googleapi.RawMessage `json:"executionStats,omitempty"`
  1729. // Index: The `PlanNode`'s index in node list.
  1730. Index int64 `json:"index,omitempty"`
  1731. // Kind: Used to determine the type of node. May be needed for
  1732. // visualizing
  1733. // different kinds of nodes differently. For example, If the node is
  1734. // a
  1735. // SCALAR node, it will have a condensed representation
  1736. // which can be used to directly embed a description of the node in
  1737. // its
  1738. // parent.
  1739. //
  1740. // Possible values:
  1741. // "KIND_UNSPECIFIED" - Not specified.
  1742. // "RELATIONAL" - Denotes a Relational operator node in the expression
  1743. // tree. Relational
  1744. // operators represent iterative processing of rows during query
  1745. // execution.
  1746. // For example, a `TableScan` operation that reads rows from a table.
  1747. // "SCALAR" - Denotes a Scalar node in the expression tree. Scalar
  1748. // nodes represent
  1749. // non-iterable entities in the query plan. For example, constants
  1750. // or
  1751. // arithmetic operators appearing inside predicate expressions or
  1752. // references
  1753. // to column names.
  1754. Kind string `json:"kind,omitempty"`
  1755. // Metadata: Attributes relevant to the node contained in a group of
  1756. // key-value pairs.
  1757. // For example, a Parameter Reference node could have the
  1758. // following
  1759. // information in its metadata:
  1760. //
  1761. // {
  1762. // "parameter_reference": "param1",
  1763. // "parameter_type": "array"
  1764. // }
  1765. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1766. // ShortRepresentation: Condensed representation for SCALAR nodes.
  1767. ShortRepresentation *ShortRepresentation `json:"shortRepresentation,omitempty"`
  1768. // ForceSendFields is a list of field names (e.g. "ChildLinks") to
  1769. // unconditionally include in API requests. By default, fields with
  1770. // empty values are omitted from API requests. However, any non-pointer,
  1771. // non-interface field appearing in ForceSendFields will be sent to the
  1772. // server regardless of whether the field is empty or not. This may be
  1773. // used to include empty fields in Patch requests.
  1774. ForceSendFields []string `json:"-"`
  1775. // NullFields is a list of field names (e.g. "ChildLinks") to include in
  1776. // API requests with the JSON null value. By default, fields with empty
  1777. // values are omitted from API requests. However, any field with an
  1778. // empty value appearing in NullFields will be sent to the server as
  1779. // null. It is an error if a field in this list has a non-empty value.
  1780. // This may be used to include null fields in Patch requests.
  1781. NullFields []string `json:"-"`
  1782. }
  1783. func (s *PlanNode) MarshalJSON() ([]byte, error) {
  1784. type NoMethod PlanNode
  1785. raw := NoMethod(*s)
  1786. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1787. }
  1788. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1789. // used to
  1790. // specify access control policies for Cloud Platform resources.
  1791. //
  1792. //
  1793. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1794. // of
  1795. // `members` to a `role`, where the members can be user accounts, Google
  1796. // groups,
  1797. // Google domains, and service accounts. A `role` is a named list of
  1798. // permissions
  1799. // defined by IAM.
  1800. //
  1801. // **JSON Example**
  1802. //
  1803. // {
  1804. // "bindings": [
  1805. // {
  1806. // "role": "roles/owner",
  1807. // "members": [
  1808. // "user:mike@example.com",
  1809. // "group:admins@example.com",
  1810. // "domain:google.com",
  1811. //
  1812. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1813. // ]
  1814. // },
  1815. // {
  1816. // "role": "roles/viewer",
  1817. // "members": ["user:sean@example.com"]
  1818. // }
  1819. // ]
  1820. // }
  1821. //
  1822. // **YAML Example**
  1823. //
  1824. // bindings:
  1825. // - members:
  1826. // - user:mike@example.com
  1827. // - group:admins@example.com
  1828. // - domain:google.com
  1829. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1830. // role: roles/owner
  1831. // - members:
  1832. // - user:sean@example.com
  1833. // role: roles/viewer
  1834. //
  1835. //
  1836. // For a description of IAM and its features, see the
  1837. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1838. type Policy struct {
  1839. // Bindings: Associates a list of `members` to a `role`.
  1840. // `bindings` with no members will result in an error.
  1841. Bindings []*Binding `json:"bindings,omitempty"`
  1842. // Etag: `etag` is used for optimistic concurrency control as a way to
  1843. // help
  1844. // prevent simultaneous updates of a policy from overwriting each
  1845. // other.
  1846. // It is strongly suggested that systems make use of the `etag` in
  1847. // the
  1848. // read-modify-write cycle to perform policy updates in order to avoid
  1849. // race
  1850. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1851. // and
  1852. // systems are expected to put that etag in the request to
  1853. // `setIamPolicy` to
  1854. // ensure that their change will be applied to the same version of the
  1855. // policy.
  1856. //
  1857. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1858. // existing
  1859. // policy is overwritten blindly.
  1860. Etag string `json:"etag,omitempty"`
  1861. // Version: Deprecated.
  1862. Version int64 `json:"version,omitempty"`
  1863. // ServerResponse contains the HTTP response code and headers from the
  1864. // server.
  1865. googleapi.ServerResponse `json:"-"`
  1866. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1867. // unconditionally include in API requests. By default, fields with
  1868. // empty values are omitted from API requests. However, any non-pointer,
  1869. // non-interface field appearing in ForceSendFields will be sent to the
  1870. // server regardless of whether the field is empty or not. This may be
  1871. // used to include empty fields in Patch requests.
  1872. ForceSendFields []string `json:"-"`
  1873. // NullFields is a list of field names (e.g. "Bindings") to include in
  1874. // API requests with the JSON null value. By default, fields with empty
  1875. // values are omitted from API requests. However, any field with an
  1876. // empty value appearing in NullFields will be sent to the server as
  1877. // null. It is an error if a field in this list has a non-empty value.
  1878. // This may be used to include null fields in Patch requests.
  1879. NullFields []string `json:"-"`
  1880. }
  1881. func (s *Policy) MarshalJSON() ([]byte, error) {
  1882. type NoMethod Policy
  1883. raw := NoMethod(*s)
  1884. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1885. }
  1886. // QueryPlan: Contains an ordered list of nodes appearing in the query
  1887. // plan.
  1888. type QueryPlan struct {
  1889. // PlanNodes: The nodes in the query plan. Plan nodes are returned in
  1890. // pre-order starting
  1891. // with the plan root. Each PlanNode's `id` corresponds to its index
  1892. // in
  1893. // `plan_nodes`.
  1894. PlanNodes []*PlanNode `json:"planNodes,omitempty"`
  1895. // ForceSendFields is a list of field names (e.g. "PlanNodes") to
  1896. // unconditionally include in API requests. By default, fields with
  1897. // empty values are omitted from API requests. However, any non-pointer,
  1898. // non-interface field appearing in ForceSendFields will be sent to the
  1899. // server regardless of whether the field is empty or not. This may be
  1900. // used to include empty fields in Patch requests.
  1901. ForceSendFields []string `json:"-"`
  1902. // NullFields is a list of field names (e.g. "PlanNodes") to include in
  1903. // API requests with the JSON null value. By default, fields with empty
  1904. // values are omitted from API requests. However, any field with an
  1905. // empty value appearing in NullFields will be sent to the server as
  1906. // null. It is an error if a field in this list has a non-empty value.
  1907. // This may be used to include null fields in Patch requests.
  1908. NullFields []string `json:"-"`
  1909. }
  1910. func (s *QueryPlan) MarshalJSON() ([]byte, error) {
  1911. type NoMethod QueryPlan
  1912. raw := NoMethod(*s)
  1913. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1914. }
  1915. // ReadOnly: Message type to initiate a read-only transaction.
  1916. type ReadOnly struct {
  1917. // ExactStaleness: Executes all reads at a timestamp that is
  1918. // `exact_staleness`
  1919. // old. The timestamp is chosen soon after the read is
  1920. // started.
  1921. //
  1922. // Guarantees that all writes that have committed more than
  1923. // the
  1924. // specified number of seconds ago are visible. Because Cloud
  1925. // Spanner
  1926. // chooses the exact timestamp, this mode works even if the
  1927. // client's
  1928. // local clock is substantially skewed from Cloud Spanner
  1929. // commit
  1930. // timestamps.
  1931. //
  1932. // Useful for reading at nearby replicas without the
  1933. // distributed
  1934. // timestamp negotiation overhead of `max_staleness`.
  1935. ExactStaleness string `json:"exactStaleness,omitempty"`
  1936. // MaxStaleness: Read data at a timestamp >= `NOW -
  1937. // max_staleness`
  1938. // seconds. Guarantees that all writes that have committed more
  1939. // than the specified number of seconds ago are visible. Because
  1940. // Cloud Spanner chooses the exact timestamp, this mode works even
  1941. // if
  1942. // the client's local clock is substantially skewed from Cloud
  1943. // Spanner
  1944. // commit timestamps.
  1945. //
  1946. // Useful for reading the freshest data available at a nearby
  1947. // replica, while bounding the possible staleness if the local
  1948. // replica has fallen behind.
  1949. //
  1950. // Note that this option can only be used in single-use
  1951. // transactions.
  1952. MaxStaleness string `json:"maxStaleness,omitempty"`
  1953. // MinReadTimestamp: Executes all reads at a timestamp >=
  1954. // `min_read_timestamp`.
  1955. //
  1956. // This is useful for requesting fresher data than some previous
  1957. // read, or data that is fresh enough to observe the effects of
  1958. // some
  1959. // previously committed transaction whose timestamp is known.
  1960. //
  1961. // Note that this option can only be used in single-use transactions.
  1962. //
  1963. // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to
  1964. // nanoseconds.
  1965. // Example: "2014-10-02T15:01:23.045123456Z".
  1966. MinReadTimestamp string `json:"minReadTimestamp,omitempty"`
  1967. // ReadTimestamp: Executes all reads at the given timestamp. Unlike
  1968. // other modes,
  1969. // reads at a specific timestamp are repeatable; the same read at
  1970. // the same timestamp always returns the same data. If the
  1971. // timestamp is in the future, the read will block until the
  1972. // specified timestamp, modulo the read's deadline.
  1973. //
  1974. // Useful for large scale consistent reads such as mapreduces, or
  1975. // for coordinating many reads against a consistent snapshot of
  1976. // the
  1977. // data.
  1978. //
  1979. // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to
  1980. // nanoseconds.
  1981. // Example: "2014-10-02T15:01:23.045123456Z".
  1982. ReadTimestamp string `json:"readTimestamp,omitempty"`
  1983. // ReturnReadTimestamp: If true, the Cloud Spanner-selected read
  1984. // timestamp is included in
  1985. // the Transaction message that describes the transaction.
  1986. ReturnReadTimestamp bool `json:"returnReadTimestamp,omitempty"`
  1987. // Strong: Read at a timestamp where all previously committed
  1988. // transactions
  1989. // are visible.
  1990. Strong bool `json:"strong,omitempty"`
  1991. // ForceSendFields is a list of field names (e.g. "ExactStaleness") to
  1992. // unconditionally include in API requests. By default, fields with
  1993. // empty values are omitted from API requests. However, any non-pointer,
  1994. // non-interface field appearing in ForceSendFields will be sent to the
  1995. // server regardless of whether the field is empty or not. This may be
  1996. // used to include empty fields in Patch requests.
  1997. ForceSendFields []string `json:"-"`
  1998. // NullFields is a list of field names (e.g. "ExactStaleness") to
  1999. // include in API requests with the JSON null value. By default, fields
  2000. // with empty values are omitted from API requests. However, any field
  2001. // with an empty value appearing in NullFields will be sent to the
  2002. // server as null. It is an error if a field in this list has a
  2003. // non-empty value. This may be used to include null fields in Patch
  2004. // requests.
  2005. NullFields []string `json:"-"`
  2006. }
  2007. func (s *ReadOnly) MarshalJSON() ([]byte, error) {
  2008. type NoMethod ReadOnly
  2009. raw := NoMethod(*s)
  2010. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2011. }
  2012. // ReadRequest: The request for Read and
  2013. // StreamingRead.
  2014. type ReadRequest struct {
  2015. // Columns: The columns of table to be returned for each row
  2016. // matching
  2017. // this request.
  2018. Columns []string `json:"columns,omitempty"`
  2019. // Index: If non-empty, the name of an index on table. This index
  2020. // is
  2021. // used instead of the table primary key when interpreting key_set
  2022. // and sorting result rows. See key_set for further information.
  2023. Index string `json:"index,omitempty"`
  2024. // KeySet: Required. `key_set` identifies the rows to be yielded.
  2025. // `key_set` names the
  2026. // primary keys of the rows in table to be yielded, unless index
  2027. // is present. If index is present, then key_set instead names
  2028. // index keys in index.
  2029. //
  2030. // If the partition_token field is empty, rows are yielded
  2031. // in table primary key order (if index is empty) or index key order
  2032. // (if index is non-empty). If the partition_token field is not
  2033. // empty, rows will be yielded in an unspecified order.
  2034. //
  2035. // It is not an error for the `key_set` to name rows that do not
  2036. // exist in the database. Read yields nothing for nonexistent rows.
  2037. KeySet *KeySet `json:"keySet,omitempty"`
  2038. // Limit: If greater than zero, only the first `limit` rows are yielded.
  2039. // If `limit`
  2040. // is zero, the default is no limit. A limit cannot be specified
  2041. // if
  2042. // `partition_token` is set.
  2043. Limit int64 `json:"limit,omitempty,string"`
  2044. // PartitionToken: If present, results will be restricted to the
  2045. // specified partition
  2046. // previously created using PartitionRead(). There must be an
  2047. // exact
  2048. // match for the values of fields common to this message and
  2049. // the
  2050. // PartitionReadRequest message used to create this partition_token.
  2051. PartitionToken string `json:"partitionToken,omitempty"`
  2052. // ResumeToken: If this request is resuming a previously interrupted
  2053. // read,
  2054. // `resume_token` should be copied from the last
  2055. // PartialResultSet yielded before the interruption. Doing this
  2056. // enables the new read to resume where the last read left off. The
  2057. // rest of the request parameters must exactly match the request
  2058. // that yielded this token.
  2059. ResumeToken string `json:"resumeToken,omitempty"`
  2060. // Table: Required. The name of the table in the database to be read.
  2061. Table string `json:"table,omitempty"`
  2062. // Transaction: The transaction to use. If none is provided, the default
  2063. // is a
  2064. // temporary read-only transaction with strong concurrency.
  2065. Transaction *TransactionSelector `json:"transaction,omitempty"`
  2066. // ForceSendFields is a list of field names (e.g. "Columns") to
  2067. // unconditionally include in API requests. By default, fields with
  2068. // empty values are omitted from API requests. However, any non-pointer,
  2069. // non-interface field appearing in ForceSendFields will be sent to the
  2070. // server regardless of whether the field is empty or not. This may be
  2071. // used to include empty fields in Patch requests.
  2072. ForceSendFields []string `json:"-"`
  2073. // NullFields is a list of field names (e.g. "Columns") to include in
  2074. // API requests with the JSON null value. By default, fields with empty
  2075. // values are omitted from API requests. However, any field with an
  2076. // empty value appearing in NullFields will be sent to the server as
  2077. // null. It is an error if a field in this list has a non-empty value.
  2078. // This may be used to include null fields in Patch requests.
  2079. NullFields []string `json:"-"`
  2080. }
  2081. func (s *ReadRequest) MarshalJSON() ([]byte, error) {
  2082. type NoMethod ReadRequest
  2083. raw := NoMethod(*s)
  2084. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2085. }
  2086. // ReadWrite: Message type to initiate a read-write transaction.
  2087. // Currently this
  2088. // transaction type has no options.
  2089. type ReadWrite struct {
  2090. }
  2091. // ResultSet: Results from Read or
  2092. // ExecuteSql.
  2093. type ResultSet struct {
  2094. // Metadata: Metadata about the result set, such as row type
  2095. // information.
  2096. Metadata *ResultSetMetadata `json:"metadata,omitempty"`
  2097. // Rows: Each element in `rows` is a row whose format is defined
  2098. // by
  2099. // metadata.row_type. The ith element
  2100. // in each row matches the ith field in
  2101. // metadata.row_type. Elements are
  2102. // encoded based on type as described
  2103. // here.
  2104. Rows [][]interface{} `json:"rows,omitempty"`
  2105. // Stats: Query plan and execution statistics for the SQL statement
  2106. // that
  2107. // produced this result set. These can be requested by
  2108. // setting
  2109. // ExecuteSqlRequest.query_mode.
  2110. Stats *ResultSetStats `json:"stats,omitempty"`
  2111. // ServerResponse contains the HTTP response code and headers from the
  2112. // server.
  2113. googleapi.ServerResponse `json:"-"`
  2114. // ForceSendFields is a list of field names (e.g. "Metadata") to
  2115. // unconditionally include in API requests. By default, fields with
  2116. // empty values are omitted from API requests. However, any non-pointer,
  2117. // non-interface field appearing in ForceSendFields will be sent to the
  2118. // server regardless of whether the field is empty or not. This may be
  2119. // used to include empty fields in Patch requests.
  2120. ForceSendFields []string `json:"-"`
  2121. // NullFields is a list of field names (e.g. "Metadata") to include in
  2122. // API requests with the JSON null value. By default, fields with empty
  2123. // values are omitted from API requests. However, any field with an
  2124. // empty value appearing in NullFields will be sent to the server as
  2125. // null. It is an error if a field in this list has a non-empty value.
  2126. // This may be used to include null fields in Patch requests.
  2127. NullFields []string `json:"-"`
  2128. }
  2129. func (s *ResultSet) MarshalJSON() ([]byte, error) {
  2130. type NoMethod ResultSet
  2131. raw := NoMethod(*s)
  2132. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2133. }
  2134. // ResultSetMetadata: Metadata about a ResultSet or PartialResultSet.
  2135. type ResultSetMetadata struct {
  2136. // RowType: Indicates the field names and types for the rows in the
  2137. // result
  2138. // set. For example, a SQL query like "SELECT UserId, UserName
  2139. // FROM
  2140. // Users" could return a `row_type` value like:
  2141. //
  2142. // "fields": [
  2143. // { "name": "UserId", "type": { "code": "INT64" } },
  2144. // { "name": "UserName", "type": { "code": "STRING" } },
  2145. // ]
  2146. RowType *StructType `json:"rowType,omitempty"`
  2147. // Transaction: If the read or SQL query began a transaction as a
  2148. // side-effect, the
  2149. // information about the new transaction is yielded here.
  2150. Transaction *Transaction `json:"transaction,omitempty"`
  2151. // ForceSendFields is a list of field names (e.g. "RowType") to
  2152. // unconditionally include in API requests. By default, fields with
  2153. // empty values are omitted from API requests. However, any non-pointer,
  2154. // non-interface field appearing in ForceSendFields will be sent to the
  2155. // server regardless of whether the field is empty or not. This may be
  2156. // used to include empty fields in Patch requests.
  2157. ForceSendFields []string `json:"-"`
  2158. // NullFields is a list of field names (e.g. "RowType") to include in
  2159. // API requests with the JSON null value. By default, fields with empty
  2160. // values are omitted from API requests. However, any field with an
  2161. // empty value appearing in NullFields will be sent to the server as
  2162. // null. It is an error if a field in this list has a non-empty value.
  2163. // This may be used to include null fields in Patch requests.
  2164. NullFields []string `json:"-"`
  2165. }
  2166. func (s *ResultSetMetadata) MarshalJSON() ([]byte, error) {
  2167. type NoMethod ResultSetMetadata
  2168. raw := NoMethod(*s)
  2169. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2170. }
  2171. // ResultSetStats: Additional statistics about a ResultSet or
  2172. // PartialResultSet.
  2173. type ResultSetStats struct {
  2174. // QueryPlan: QueryPlan for the query associated with this result.
  2175. QueryPlan *QueryPlan `json:"queryPlan,omitempty"`
  2176. // QueryStats: Aggregated statistics from the execution of the query.
  2177. // Only present when
  2178. // the query is profiled. For example, a query could return the
  2179. // statistics as
  2180. // follows:
  2181. //
  2182. // {
  2183. // "rows_returned": "3",
  2184. // "elapsed_time": "1.22 secs",
  2185. // "cpu_time": "1.19 secs"
  2186. // }
  2187. QueryStats googleapi.RawMessage `json:"queryStats,omitempty"`
  2188. // ForceSendFields is a list of field names (e.g. "QueryPlan") to
  2189. // unconditionally include in API requests. By default, fields with
  2190. // empty values are omitted from API requests. However, any non-pointer,
  2191. // non-interface field appearing in ForceSendFields will be sent to the
  2192. // server regardless of whether the field is empty or not. This may be
  2193. // used to include empty fields in Patch requests.
  2194. ForceSendFields []string `json:"-"`
  2195. // NullFields is a list of field names (e.g. "QueryPlan") to include in
  2196. // API requests with the JSON null value. By default, fields with empty
  2197. // values are omitted from API requests. However, any field with an
  2198. // empty value appearing in NullFields will be sent to the server as
  2199. // null. It is an error if a field in this list has a non-empty value.
  2200. // This may be used to include null fields in Patch requests.
  2201. NullFields []string `json:"-"`
  2202. }
  2203. func (s *ResultSetStats) MarshalJSON() ([]byte, error) {
  2204. type NoMethod ResultSetStats
  2205. raw := NoMethod(*s)
  2206. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2207. }
  2208. // RollbackRequest: The request for Rollback.
  2209. type RollbackRequest struct {
  2210. // TransactionId: Required. The transaction to roll back.
  2211. TransactionId string `json:"transactionId,omitempty"`
  2212. // ForceSendFields is a list of field names (e.g. "TransactionId") to
  2213. // unconditionally include in API requests. By default, fields with
  2214. // empty values are omitted from API requests. However, any non-pointer,
  2215. // non-interface field appearing in ForceSendFields will be sent to the
  2216. // server regardless of whether the field is empty or not. This may be
  2217. // used to include empty fields in Patch requests.
  2218. ForceSendFields []string `json:"-"`
  2219. // NullFields is a list of field names (e.g. "TransactionId") to include
  2220. // in API requests with the JSON null value. By default, fields with
  2221. // empty values are omitted from API requests. However, any field with
  2222. // an empty value appearing in NullFields will be sent to the server as
  2223. // null. It is an error if a field in this list has a non-empty value.
  2224. // This may be used to include null fields in Patch requests.
  2225. NullFields []string `json:"-"`
  2226. }
  2227. func (s *RollbackRequest) MarshalJSON() ([]byte, error) {
  2228. type NoMethod RollbackRequest
  2229. raw := NoMethod(*s)
  2230. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2231. }
  2232. // Session: A session in the Cloud Spanner API.
  2233. type Session struct {
  2234. // ApproximateLastUseTime: Output only. The approximate timestamp when
  2235. // the session is last used. It is
  2236. // typically earlier than the actual last use time.
  2237. ApproximateLastUseTime string `json:"approximateLastUseTime,omitempty"`
  2238. // CreateTime: Output only. The timestamp when the session is created.
  2239. CreateTime string `json:"createTime,omitempty"`
  2240. // Labels: The labels for the session.
  2241. //
  2242. // * Label keys must be between 1 and 63 characters long and must
  2243. // conform to
  2244. // the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  2245. // * Label values must be between 0 and 63 characters long and must
  2246. // conform
  2247. // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
  2248. // * No more than 64 labels can be associated with a given
  2249. // session.
  2250. //
  2251. // See https://goo.gl/xmQnxf for more information on and examples of
  2252. // labels.
  2253. Labels map[string]string `json:"labels,omitempty"`
  2254. // Name: The name of the session. This is always system-assigned; values
  2255. // provided
  2256. // when creating a session are ignored.
  2257. Name string `json:"name,omitempty"`
  2258. // ServerResponse contains the HTTP response code and headers from the
  2259. // server.
  2260. googleapi.ServerResponse `json:"-"`
  2261. // ForceSendFields is a list of field names (e.g.
  2262. // "ApproximateLastUseTime") to unconditionally include in API requests.
  2263. // By default, fields with empty values are omitted from API requests.
  2264. // However, any non-pointer, non-interface field appearing in
  2265. // ForceSendFields will be sent to the server regardless of whether the
  2266. // field is empty or not. This may be used to include empty fields in
  2267. // Patch requests.
  2268. ForceSendFields []string `json:"-"`
  2269. // NullFields is a list of field names (e.g. "ApproximateLastUseTime")
  2270. // to include in API requests with the JSON null value. By default,
  2271. // fields with empty values are omitted from API requests. However, any
  2272. // field 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 *Session) MarshalJSON() ([]byte, error) {
  2279. type NoMethod Session
  2280. raw := NoMethod(*s)
  2281. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2282. }
  2283. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  2284. type SetIamPolicyRequest struct {
  2285. // Policy: REQUIRED: The complete policy to be applied to the
  2286. // `resource`. The size of
  2287. // the policy is limited to a few 10s of KB. An empty policy is a
  2288. // valid policy but certain Cloud Platform services (such as
  2289. // Projects)
  2290. // might reject them.
  2291. Policy *Policy `json:"policy,omitempty"`
  2292. // ForceSendFields is a list of field names (e.g. "Policy") to
  2293. // unconditionally include in API requests. By default, fields with
  2294. // empty values are omitted from API requests. However, any non-pointer,
  2295. // non-interface field appearing in ForceSendFields will be sent to the
  2296. // server regardless of whether the field is empty or not. This may be
  2297. // used to include empty fields in Patch requests.
  2298. ForceSendFields []string `json:"-"`
  2299. // NullFields is a list of field names (e.g. "Policy") to include in API
  2300. // requests with the JSON null value. By default, fields with empty
  2301. // values are omitted from API requests. However, any field with an
  2302. // empty value appearing in NullFields will be sent to the server as
  2303. // null. It is an error if a field in this list has a non-empty value.
  2304. // This may be used to include null fields in Patch requests.
  2305. NullFields []string `json:"-"`
  2306. }
  2307. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  2308. type NoMethod SetIamPolicyRequest
  2309. raw := NoMethod(*s)
  2310. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2311. }
  2312. // ShortRepresentation: Condensed representation of a node and its
  2313. // subtree. Only present for
  2314. // `SCALAR` PlanNode(s).
  2315. type ShortRepresentation struct {
  2316. // Description: A string representation of the expression subtree rooted
  2317. // at this node.
  2318. Description string `json:"description,omitempty"`
  2319. // Subqueries: A mapping of (subquery variable name) -> (subquery node
  2320. // id) for cases
  2321. // where the `description` string of this node references a
  2322. // `SCALAR`
  2323. // subquery contained in the expression subtree rooted at this node.
  2324. // The
  2325. // referenced `SCALAR` subquery may not necessarily be a direct child
  2326. // of
  2327. // this node.
  2328. Subqueries map[string]int64 `json:"subqueries,omitempty"`
  2329. // ForceSendFields is a list of field names (e.g. "Description") to
  2330. // unconditionally include in API requests. By default, fields with
  2331. // empty values are omitted from API requests. However, any non-pointer,
  2332. // non-interface field appearing in ForceSendFields will be sent to the
  2333. // server regardless of whether the field is empty or not. This may be
  2334. // used to include empty fields in Patch requests.
  2335. ForceSendFields []string `json:"-"`
  2336. // NullFields is a list of field names (e.g. "Description") to include
  2337. // in API requests with the JSON null value. By default, fields with
  2338. // empty values are omitted from API requests. However, any field with
  2339. // an empty value appearing in NullFields will be sent to the server as
  2340. // null. It is an error if a field in this list has a non-empty value.
  2341. // This may be used to include null fields in Patch requests.
  2342. NullFields []string `json:"-"`
  2343. }
  2344. func (s *ShortRepresentation) MarshalJSON() ([]byte, error) {
  2345. type NoMethod ShortRepresentation
  2346. raw := NoMethod(*s)
  2347. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2348. }
  2349. // Status: The `Status` type defines a logical error model that is
  2350. // suitable for different
  2351. // programming environments, including REST APIs and RPC APIs. It is
  2352. // used by
  2353. // [gRPC](https://github.com/grpc). The error model is designed to
  2354. // be:
  2355. //
  2356. // - Simple to use and understand for most users
  2357. // - Flexible enough to meet unexpected needs
  2358. //
  2359. // # Overview
  2360. //
  2361. // The `Status` message contains three pieces of data: error code, error
  2362. // message,
  2363. // and error details. The error code should be an enum value
  2364. // of
  2365. // google.rpc.Code, but it may accept additional error codes if needed.
  2366. // The
  2367. // error message should be a developer-facing English message that
  2368. // helps
  2369. // developers *understand* and *resolve* the error. If a localized
  2370. // user-facing
  2371. // error message is needed, put the localized message in the error
  2372. // details or
  2373. // localize it in the client. The optional error details may contain
  2374. // arbitrary
  2375. // information about the error. There is a predefined set of error
  2376. // detail types
  2377. // in the package `google.rpc` that can be used for common error
  2378. // conditions.
  2379. //
  2380. // # Language mapping
  2381. //
  2382. // The `Status` message is the logical representation of the error
  2383. // model, but it
  2384. // is not necessarily the actual wire format. When the `Status` message
  2385. // is
  2386. // exposed in different client libraries and different wire protocols,
  2387. // it can be
  2388. // mapped differently. For example, it will likely be mapped to some
  2389. // exceptions
  2390. // in Java, but more likely mapped to some error codes in C.
  2391. //
  2392. // # Other uses
  2393. //
  2394. // The error model and the `Status` message can be used in a variety
  2395. // of
  2396. // environments, either with or without APIs, to provide a
  2397. // consistent developer experience across different
  2398. // environments.
  2399. //
  2400. // Example uses of this error model include:
  2401. //
  2402. // - Partial errors. If a service needs to return partial errors to the
  2403. // client,
  2404. // it may embed the `Status` in the normal response to indicate the
  2405. // partial
  2406. // errors.
  2407. //
  2408. // - Workflow errors. A typical workflow has multiple steps. Each step
  2409. // may
  2410. // have a `Status` message for error reporting.
  2411. //
  2412. // - Batch operations. If a client uses batch request and batch
  2413. // response, the
  2414. // `Status` message should be used directly inside batch response,
  2415. // one for
  2416. // each error sub-response.
  2417. //
  2418. // - Asynchronous operations. If an API call embeds asynchronous
  2419. // operation
  2420. // results in its response, the status of those operations should
  2421. // be
  2422. // represented directly using the `Status` message.
  2423. //
  2424. // - Logging. If some API errors are stored in logs, the message
  2425. // `Status` could
  2426. // be used directly after any stripping needed for security/privacy
  2427. // reasons.
  2428. type Status struct {
  2429. // Code: The status code, which should be an enum value of
  2430. // google.rpc.Code.
  2431. Code int64 `json:"code,omitempty"`
  2432. // Details: A list of messages that carry the error details. There is a
  2433. // common set of
  2434. // message types for APIs to use.
  2435. Details []googleapi.RawMessage `json:"details,omitempty"`
  2436. // Message: A developer-facing error message, which should be in
  2437. // English. Any
  2438. // user-facing error message should be localized and sent in
  2439. // the
  2440. // google.rpc.Status.details field, or localized by the client.
  2441. Message string `json:"message,omitempty"`
  2442. // ForceSendFields is a list of field names (e.g. "Code") to
  2443. // unconditionally include in API requests. By default, fields with
  2444. // empty values are omitted from API requests. However, any non-pointer,
  2445. // non-interface field appearing in ForceSendFields will be sent to the
  2446. // server regardless of whether the field is empty or not. This may be
  2447. // used to include empty fields in Patch requests.
  2448. ForceSendFields []string `json:"-"`
  2449. // NullFields is a list of field names (e.g. "Code") to include in API
  2450. // requests with the JSON null value. By default, fields with empty
  2451. // values are omitted from API requests. However, any field with an
  2452. // empty value appearing in NullFields will be sent to the server as
  2453. // null. It is an error if a field in this list has a non-empty value.
  2454. // This may be used to include null fields in Patch requests.
  2455. NullFields []string `json:"-"`
  2456. }
  2457. func (s *Status) MarshalJSON() ([]byte, error) {
  2458. type NoMethod Status
  2459. raw := NoMethod(*s)
  2460. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2461. }
  2462. // StructType: `StructType` defines the fields of a STRUCT type.
  2463. type StructType struct {
  2464. // Fields: The list of fields that make up this struct. Order
  2465. // is
  2466. // significant, because values of this struct type are represented
  2467. // as
  2468. // lists, where the order of field values matches the order of
  2469. // fields in the StructType. In turn, the order of fields
  2470. // matches the order of columns in a read request, or the order
  2471. // of
  2472. // fields in the `SELECT` clause of a query.
  2473. Fields []*Field `json:"fields,omitempty"`
  2474. // ForceSendFields is a list of field names (e.g. "Fields") to
  2475. // unconditionally include in API requests. By default, fields with
  2476. // empty values are omitted from API requests. However, any non-pointer,
  2477. // non-interface field appearing in ForceSendFields will be sent to the
  2478. // server regardless of whether the field is empty or not. This may be
  2479. // used to include empty fields in Patch requests.
  2480. ForceSendFields []string `json:"-"`
  2481. // NullFields is a list of field names (e.g. "Fields") to include in API
  2482. // requests with the JSON null value. By default, fields with empty
  2483. // values are omitted from API requests. However, any field with an
  2484. // empty value appearing in NullFields will be sent to the server as
  2485. // null. It is an error if a field in this list has a non-empty value.
  2486. // This may be used to include null fields in Patch requests.
  2487. NullFields []string `json:"-"`
  2488. }
  2489. func (s *StructType) MarshalJSON() ([]byte, error) {
  2490. type NoMethod StructType
  2491. raw := NoMethod(*s)
  2492. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2493. }
  2494. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  2495. // method.
  2496. type TestIamPermissionsRequest struct {
  2497. // Permissions: REQUIRED: The set of permissions to check for
  2498. // 'resource'.
  2499. // Permissions with wildcards (such as '*', 'spanner.*',
  2500. // 'spanner.instances.*') are not allowed.
  2501. Permissions []string `json:"permissions,omitempty"`
  2502. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2503. // unconditionally include in API requests. By default, fields with
  2504. // empty values are omitted from API requests. However, any non-pointer,
  2505. // non-interface field appearing in ForceSendFields will be sent to the
  2506. // server regardless of whether the field is empty or not. This may be
  2507. // used to include empty fields in Patch requests.
  2508. ForceSendFields []string `json:"-"`
  2509. // NullFields is a list of field names (e.g. "Permissions") to include
  2510. // in API requests with the JSON null value. By default, fields with
  2511. // empty values are omitted from API requests. However, any field with
  2512. // an empty value appearing in NullFields will be sent to the server as
  2513. // null. It is an error if a field in this list has a non-empty value.
  2514. // This may be used to include null fields in Patch requests.
  2515. NullFields []string `json:"-"`
  2516. }
  2517. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  2518. type NoMethod TestIamPermissionsRequest
  2519. raw := NoMethod(*s)
  2520. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2521. }
  2522. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  2523. // method.
  2524. type TestIamPermissionsResponse struct {
  2525. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  2526. // the caller is
  2527. // allowed.
  2528. Permissions []string `json:"permissions,omitempty"`
  2529. // ServerResponse contains the HTTP response code and headers from the
  2530. // server.
  2531. googleapi.ServerResponse `json:"-"`
  2532. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2533. // unconditionally include in API requests. By default, fields with
  2534. // empty values are omitted from API requests. However, any non-pointer,
  2535. // non-interface field appearing in ForceSendFields will be sent to the
  2536. // server regardless of whether the field is empty or not. This may be
  2537. // used to include empty fields in Patch requests.
  2538. ForceSendFields []string `json:"-"`
  2539. // NullFields is a list of field names (e.g. "Permissions") to include
  2540. // in API requests with the JSON null value. By default, fields with
  2541. // empty values are omitted from API requests. However, any field with
  2542. // an empty value appearing in NullFields will be sent to the server as
  2543. // null. It is an error if a field in this list has a non-empty value.
  2544. // This may be used to include null fields in Patch requests.
  2545. NullFields []string `json:"-"`
  2546. }
  2547. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  2548. type NoMethod TestIamPermissionsResponse
  2549. raw := NoMethod(*s)
  2550. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2551. }
  2552. // Transaction: A transaction.
  2553. type Transaction struct {
  2554. // Id: `id` may be used to identify the transaction in
  2555. // subsequent
  2556. // Read,
  2557. // ExecuteSql,
  2558. // Commit, or
  2559. // Rollback calls.
  2560. //
  2561. // Single-use read-only transactions do not have IDs, because
  2562. // single-use transactions do not support multiple requests.
  2563. Id string `json:"id,omitempty"`
  2564. // ReadTimestamp: For snapshot read-only transactions, the read
  2565. // timestamp chosen
  2566. // for the transaction. Not returned by default:
  2567. // see
  2568. // TransactionOptions.ReadOnly.return_read_timestamp.
  2569. //
  2570. // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to
  2571. // nanoseconds.
  2572. // Example: "2014-10-02T15:01:23.045123456Z".
  2573. ReadTimestamp string `json:"readTimestamp,omitempty"`
  2574. // ServerResponse contains the HTTP response code and headers from the
  2575. // server.
  2576. googleapi.ServerResponse `json:"-"`
  2577. // ForceSendFields is a list of field names (e.g. "Id") 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. "Id") 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 *Transaction) MarshalJSON() ([]byte, error) {
  2593. type NoMethod Transaction
  2594. raw := NoMethod(*s)
  2595. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2596. }
  2597. // TransactionOptions: # Transactions
  2598. //
  2599. //
  2600. // Each session can have at most one active transaction at a time. After
  2601. // the
  2602. // active transaction is completed, the session can immediately
  2603. // be
  2604. // re-used for the next transaction. It is not necessary to create a
  2605. // new session for each transaction.
  2606. //
  2607. // # Transaction Modes
  2608. //
  2609. // Cloud Spanner supports two transaction modes:
  2610. //
  2611. // 1. Locking read-write. This type of transaction is the only way
  2612. // to write data into Cloud Spanner. These transactions rely on
  2613. // pessimistic locking and, if necessary, two-phase commit.
  2614. // Locking read-write transactions may abort, requiring the
  2615. // application to retry.
  2616. //
  2617. // 2. Snapshot read-only. This transaction type provides guaranteed
  2618. // consistency across several reads, but does not allow
  2619. // writes. Snapshot read-only transactions can be configured to
  2620. // read at timestamps in the past. Snapshot read-only
  2621. // transactions do not need to be committed.
  2622. //
  2623. //
  2624. // For transactions that only read, snapshot read-only
  2625. // transactions
  2626. // provide simpler semantics and are almost always faster.
  2627. // In
  2628. // particular, read-only transactions do not take locks, so they do
  2629. // not conflict with read-write transactions. As a consequence of
  2630. // not
  2631. // taking locks, they also do not abort, so retry loops are not
  2632. // needed.
  2633. //
  2634. // Transactions may only read/write data in a single database. They
  2635. // may, however, read/write data in different tables within
  2636. // that
  2637. // database.
  2638. //
  2639. // ## Locking Read-Write Transactions
  2640. //
  2641. // Locking transactions may be used to atomically read-modify-write
  2642. // data anywhere in a database. This type of transaction is
  2643. // externally
  2644. // consistent.
  2645. //
  2646. // Clients should attempt to minimize the amount of time a
  2647. // transaction
  2648. // is active. Faster transactions commit with higher probability
  2649. // and cause less contention. Cloud Spanner attempts to keep read
  2650. // locks
  2651. // active as long as the transaction continues to do reads, and
  2652. // the
  2653. // transaction has not been terminated by
  2654. // Commit or
  2655. // Rollback. Long periods of
  2656. // inactivity at the client may cause Cloud Spanner to release
  2657. // a
  2658. // transaction's locks and abort it.
  2659. //
  2660. // Reads performed within a transaction acquire locks on the data
  2661. // being read. Writes can only be done at commit time, after all
  2662. // reads
  2663. // have been completed.
  2664. // Conceptually, a read-write transaction consists of zero or more
  2665. // reads or SQL queries followed by
  2666. // Commit. At any time before
  2667. // Commit, the client can send a
  2668. // Rollback request to abort the
  2669. // transaction.
  2670. //
  2671. // ### Semantics
  2672. //
  2673. // Cloud Spanner can commit the transaction if all read locks it
  2674. // acquired
  2675. // are still valid at commit time, and it is able to acquire write
  2676. // locks for all writes. Cloud Spanner can abort the transaction for
  2677. // any
  2678. // reason. If a commit attempt returns `ABORTED`, Cloud Spanner
  2679. // guarantees
  2680. // that the transaction has not modified any user data in Cloud
  2681. // Spanner.
  2682. //
  2683. // Unless the transaction commits, Cloud Spanner makes no guarantees
  2684. // about
  2685. // how long the transaction's locks were held for. It is an error to
  2686. // use Cloud Spanner locks for any sort of mutual exclusion other
  2687. // than
  2688. // between Cloud Spanner transactions themselves.
  2689. //
  2690. // ### Retrying Aborted Transactions
  2691. //
  2692. // When a transaction aborts, the application can choose to retry
  2693. // the
  2694. // whole transaction again. To maximize the chances of
  2695. // successfully
  2696. // committing the retry, the client should execute the retry in the
  2697. // same session as the original attempt. The original session's
  2698. // lock
  2699. // priority increases with each consecutive abort, meaning that
  2700. // each
  2701. // attempt has a slightly better chance of success than the
  2702. // previous.
  2703. //
  2704. // Under some circumstances (e.g., many transactions attempting
  2705. // to
  2706. // modify the same row(s)), a transaction can abort many times in
  2707. // a
  2708. // short period before successfully committing. Thus, it is not a
  2709. // good
  2710. // idea to cap the number of retries a transaction can attempt;
  2711. // instead, it is better to limit the total amount of wall time
  2712. // spent
  2713. // retrying.
  2714. //
  2715. // ### Idle Transactions
  2716. //
  2717. // A transaction is considered idle if it has no outstanding reads
  2718. // or
  2719. // SQL queries and has not started a read or SQL query within the last
  2720. // 10
  2721. // seconds. Idle transactions can be aborted by Cloud Spanner so that
  2722. // they
  2723. // don't hold on to locks indefinitely. In that case, the commit
  2724. // will
  2725. // fail with error `ABORTED`.
  2726. //
  2727. // If this behavior is undesirable, periodically executing a simple
  2728. // SQL query in the transaction (e.g., `SELECT 1`) prevents
  2729. // the
  2730. // transaction from becoming idle.
  2731. //
  2732. // ## Snapshot Read-Only Transactions
  2733. //
  2734. // Snapshot read-only transactions provides a simpler method
  2735. // than
  2736. // locking read-write transactions for doing several consistent
  2737. // reads. However, this type of transaction does not support
  2738. // writes.
  2739. //
  2740. // Snapshot transactions do not take locks. Instead, they work
  2741. // by
  2742. // choosing a Cloud Spanner timestamp, then executing all reads at
  2743. // that
  2744. // timestamp. Since they do not acquire locks, they do not
  2745. // block
  2746. // concurrent read-write transactions.
  2747. //
  2748. // Unlike locking read-write transactions, snapshot
  2749. // read-only
  2750. // transactions never abort. They can fail if the chosen read
  2751. // timestamp is garbage collected; however, the default
  2752. // garbage
  2753. // collection policy is generous enough that most applications do
  2754. // not
  2755. // need to worry about this in practice.
  2756. //
  2757. // Snapshot read-only transactions do not need to call
  2758. // Commit or
  2759. // Rollback (and in fact are not
  2760. // permitted to do so).
  2761. //
  2762. // To execute a snapshot transaction, the client specifies a
  2763. // timestamp
  2764. // bound, which tells Cloud Spanner how to choose a read timestamp.
  2765. //
  2766. // The types of timestamp bound are:
  2767. //
  2768. // - Strong (the default).
  2769. // - Bounded staleness.
  2770. // - Exact staleness.
  2771. //
  2772. // If the Cloud Spanner database to be read is geographically
  2773. // distributed,
  2774. // stale read-only transactions can execute more quickly than strong
  2775. // or read-write transaction, because they are able to execute far
  2776. // from the leader replica.
  2777. //
  2778. // Each type of timestamp bound is discussed in detail below.
  2779. //
  2780. // ### Strong
  2781. //
  2782. // Strong reads are guaranteed to see the effects of all
  2783. // transactions
  2784. // that have committed before the start of the read. Furthermore,
  2785. // all
  2786. // rows yielded by a single read are consistent with each other --
  2787. // if
  2788. // any part of the read observes a transaction, all parts of the
  2789. // read
  2790. // see the transaction.
  2791. //
  2792. // Strong reads are not repeatable: two consecutive strong
  2793. // read-only
  2794. // transactions might return inconsistent results if there
  2795. // are
  2796. // concurrent writes. If consistency across reads is required, the
  2797. // reads should be executed within a transaction or at an exact
  2798. // read
  2799. // timestamp.
  2800. //
  2801. // See TransactionOptions.ReadOnly.strong.
  2802. //
  2803. // ### Exact Staleness
  2804. //
  2805. // These timestamp bounds execute reads at a user-specified
  2806. // timestamp. Reads at a timestamp are guaranteed to see a
  2807. // consistent
  2808. // prefix of the global transaction history: they observe
  2809. // modifications done by all transactions with a commit timestamp <=
  2810. // the read timestamp, and observe none of the modifications done
  2811. // by
  2812. // transactions with a larger commit timestamp. They will block
  2813. // until
  2814. // all conflicting transactions that may be assigned commit
  2815. // timestamps
  2816. // <= the read timestamp have finished.
  2817. //
  2818. // The timestamp can either be expressed as an absolute Cloud Spanner
  2819. // commit
  2820. // timestamp or a staleness relative to the current time.
  2821. //
  2822. // These modes do not require a "negotiation phase" to pick a
  2823. // timestamp. As a result, they execute slightly faster than
  2824. // the
  2825. // equivalent boundedly stale concurrency modes. On the other
  2826. // hand,
  2827. // boundedly stale reads usually return fresher results.
  2828. //
  2829. // See TransactionOptions.ReadOnly.read_timestamp
  2830. // and
  2831. // TransactionOptions.ReadOnly.exact_staleness.
  2832. //
  2833. // ### Bounded Staleness
  2834. //
  2835. // Bounded staleness modes allow Cloud Spanner to pick the read
  2836. // timestamp,
  2837. // subject to a user-provided staleness bound. Cloud Spanner chooses
  2838. // the
  2839. // newest timestamp within the staleness bound that allows execution
  2840. // of the reads at the closest available replica without blocking.
  2841. //
  2842. // All rows yielded are consistent with each other -- if any part of
  2843. // the read observes a transaction, all parts of the read see
  2844. // the
  2845. // transaction. Boundedly stale reads are not repeatable: two
  2846. // stale
  2847. // reads, even if they use the same staleness bound, can execute
  2848. // at
  2849. // different timestamps and thus return inconsistent results.
  2850. //
  2851. // Boundedly stale reads execute in two phases: the first
  2852. // phase
  2853. // negotiates a timestamp among all replicas needed to serve the
  2854. // read. In the second phase, reads are executed at the
  2855. // negotiated
  2856. // timestamp.
  2857. //
  2858. // As a result of the two phase execution, bounded staleness reads
  2859. // are
  2860. // usually a little slower than comparable exact staleness
  2861. // reads. However, they are typically able to return fresher
  2862. // results, and are more likely to execute at the closest
  2863. // replica.
  2864. //
  2865. // Because the timestamp negotiation requires up-front knowledge
  2866. // of
  2867. // which rows will be read, it can only be used with
  2868. // single-use
  2869. // read-only transactions.
  2870. //
  2871. // See TransactionOptions.ReadOnly.max_staleness
  2872. // and
  2873. // TransactionOptions.ReadOnly.min_read_timestamp.
  2874. //
  2875. // ### Old Read Timestamps and Garbage Collection
  2876. //
  2877. // Cloud Spanner continuously garbage collects deleted and overwritten
  2878. // data
  2879. // in the background to reclaim storage space. This process is known
  2880. // as "version GC". By default, version GC reclaims versions after
  2881. // they
  2882. // are one hour old. Because of this, Cloud Spanner cannot perform
  2883. // reads
  2884. // at read timestamps more than one hour in the past. This
  2885. // restriction also applies to in-progress reads and/or SQL queries
  2886. // whose
  2887. // timestamp become too old while executing. Reads and SQL queries
  2888. // with
  2889. // too-old read timestamps fail with the error
  2890. // `FAILED_PRECONDITION`.
  2891. //
  2892. // ##
  2893. type TransactionOptions struct {
  2894. // ReadOnly: Transaction will not write.
  2895. //
  2896. // Authorization to begin a read-only transaction
  2897. // requires
  2898. // `spanner.databases.beginReadOnlyTransaction` permission
  2899. // on the `session` resource.
  2900. ReadOnly *ReadOnly `json:"readOnly,omitempty"`
  2901. // ReadWrite: Transaction may write.
  2902. //
  2903. // Authorization to begin a read-write transaction
  2904. // requires
  2905. // `spanner.databases.beginOrRollbackReadWriteTransaction` permission
  2906. // on the `session` resource.
  2907. ReadWrite *ReadWrite `json:"readWrite,omitempty"`
  2908. // ForceSendFields is a list of field names (e.g. "ReadOnly") to
  2909. // unconditionally include in API requests. By default, fields with
  2910. // empty values are omitted from API requests. However, any non-pointer,
  2911. // non-interface field appearing in ForceSendFields will be sent to the
  2912. // server regardless of whether the field is empty or not. This may be
  2913. // used to include empty fields in Patch requests.
  2914. ForceSendFields []string `json:"-"`
  2915. // NullFields is a list of field names (e.g. "ReadOnly") to include in
  2916. // API requests with the JSON null value. By default, fields with empty
  2917. // values are omitted from API requests. However, any field with an
  2918. // empty value appearing in NullFields will be sent to the server as
  2919. // null. It is an error if a field in this list has a non-empty value.
  2920. // This may be used to include null fields in Patch requests.
  2921. NullFields []string `json:"-"`
  2922. }
  2923. func (s *TransactionOptions) MarshalJSON() ([]byte, error) {
  2924. type NoMethod TransactionOptions
  2925. raw := NoMethod(*s)
  2926. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2927. }
  2928. // TransactionSelector: This message is used to select the transaction
  2929. // in which a
  2930. // Read or
  2931. // ExecuteSql call runs.
  2932. //
  2933. // See TransactionOptions for more information about transactions.
  2934. type TransactionSelector struct {
  2935. // Begin: Begin a new transaction and execute this read or SQL query
  2936. // in
  2937. // it. The transaction ID of the new transaction is returned
  2938. // in
  2939. // ResultSetMetadata.transaction, which is a Transaction.
  2940. Begin *TransactionOptions `json:"begin,omitempty"`
  2941. // Id: Execute the read or SQL query in a previously-started
  2942. // transaction.
  2943. Id string `json:"id,omitempty"`
  2944. // SingleUse: Execute the read or SQL query in a temporary
  2945. // transaction.
  2946. // This is the most efficient way to execute a transaction that
  2947. // consists of a single SQL query.
  2948. SingleUse *TransactionOptions `json:"singleUse,omitempty"`
  2949. // ForceSendFields is a list of field names (e.g. "Begin") to
  2950. // unconditionally include in API requests. By default, fields with
  2951. // empty values are omitted from API requests. However, any non-pointer,
  2952. // non-interface field appearing in ForceSendFields will be sent to the
  2953. // server regardless of whether the field is empty or not. This may be
  2954. // used to include empty fields in Patch requests.
  2955. ForceSendFields []string `json:"-"`
  2956. // NullFields is a list of field names (e.g. "Begin") to include in API
  2957. // requests with the JSON null value. By default, fields with empty
  2958. // values are omitted from API requests. However, any field with an
  2959. // empty value appearing in NullFields will be sent to the server as
  2960. // null. It is an error if a field in this list has a non-empty value.
  2961. // This may be used to include null fields in Patch requests.
  2962. NullFields []string `json:"-"`
  2963. }
  2964. func (s *TransactionSelector) MarshalJSON() ([]byte, error) {
  2965. type NoMethod TransactionSelector
  2966. raw := NoMethod(*s)
  2967. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2968. }
  2969. // Type: `Type` indicates the type of a Cloud Spanner value, as might be
  2970. // stored in a
  2971. // table cell or returned from an SQL query.
  2972. type Type struct {
  2973. // ArrayElementType: If code == ARRAY, then `array_element_type`
  2974. // is the type of the array elements.
  2975. ArrayElementType *Type `json:"arrayElementType,omitempty"`
  2976. // Code: Required. The TypeCode for this type.
  2977. //
  2978. // Possible values:
  2979. // "TYPE_CODE_UNSPECIFIED" - Not specified.
  2980. // "BOOL" - Encoded as JSON `true` or `false`.
  2981. // "INT64" - Encoded as `string`, in decimal format.
  2982. // "FLOAT64" - Encoded as `number`, or the strings "NaN",
  2983. // "Infinity", or
  2984. // "-Infinity".
  2985. // "TIMESTAMP" - Encoded as `string` in RFC 3339 timestamp format. The
  2986. // time zone
  2987. // must be present, and must be "Z".
  2988. //
  2989. // If the schema has the column option
  2990. // `allow_commit_timestamp=true`, the placeholder
  2991. // string
  2992. // "spanner.commit_timestamp()" can be used to instruct the system
  2993. // to insert the commit timestamp associated with the
  2994. // transaction
  2995. // commit.
  2996. // "DATE" - Encoded as `string` in RFC 3339 date format.
  2997. // "STRING" - Encoded as `string`.
  2998. // "BYTES" - Encoded as a base64-encoded `string`, as described in RFC
  2999. // 4648,
  3000. // section 4.
  3001. // "ARRAY" - Encoded as `list`, where the list elements are
  3002. // represented
  3003. // according to array_element_type.
  3004. // "STRUCT" - Encoded as `list`, where list element `i` is represented
  3005. // according
  3006. // to [struct_type.fields[i]][google.spanner.v1.StructType.fields].
  3007. Code string `json:"code,omitempty"`
  3008. // StructType: If code == STRUCT, then `struct_type`
  3009. // provides type information for the struct's fields.
  3010. StructType *StructType `json:"structType,omitempty"`
  3011. // ForceSendFields is a list of field names (e.g. "ArrayElementType") to
  3012. // unconditionally include in API requests. By default, fields with
  3013. // empty values are omitted from API requests. However, any non-pointer,
  3014. // non-interface field appearing in ForceSendFields will be sent to the
  3015. // server regardless of whether the field is empty or not. This may be
  3016. // used to include empty fields in Patch requests.
  3017. ForceSendFields []string `json:"-"`
  3018. // NullFields is a list of field names (e.g. "ArrayElementType") to
  3019. // include in API requests with the JSON null value. By default, fields
  3020. // with empty values are omitted from API requests. However, any field
  3021. // with an empty value appearing in NullFields will be sent to the
  3022. // server as null. It is an error if a field in this list has a
  3023. // non-empty value. This may be used to include null fields in Patch
  3024. // requests.
  3025. NullFields []string `json:"-"`
  3026. }
  3027. func (s *Type) MarshalJSON() ([]byte, error) {
  3028. type NoMethod Type
  3029. raw := NoMethod(*s)
  3030. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3031. }
  3032. // UpdateDatabaseDdlMetadata: Metadata type for the operation returned
  3033. // by
  3034. // UpdateDatabaseDdl.
  3035. type UpdateDatabaseDdlMetadata struct {
  3036. // CommitTimestamps: Reports the commit timestamps of all statements
  3037. // that have
  3038. // succeeded so far, where `commit_timestamps[i]` is the
  3039. // commit
  3040. // timestamp for the statement `statements[i]`.
  3041. CommitTimestamps []string `json:"commitTimestamps,omitempty"`
  3042. // Database: The database being modified.
  3043. Database string `json:"database,omitempty"`
  3044. // Statements: For an update this list contains all the statements. For
  3045. // an
  3046. // individual statement, this list contains only that statement.
  3047. Statements []string `json:"statements,omitempty"`
  3048. // ForceSendFields is a list of field names (e.g. "CommitTimestamps") to
  3049. // unconditionally include in API requests. By default, fields with
  3050. // empty values are omitted from API requests. However, any non-pointer,
  3051. // non-interface field appearing in ForceSendFields will be sent to the
  3052. // server regardless of whether the field is empty or not. This may be
  3053. // used to include empty fields in Patch requests.
  3054. ForceSendFields []string `json:"-"`
  3055. // NullFields is a list of field names (e.g. "CommitTimestamps") to
  3056. // include in API requests with the JSON null value. By default, fields
  3057. // with empty values are omitted from API requests. However, any field
  3058. // with an empty value appearing in NullFields will be sent to the
  3059. // server as null. It is an error if a field in this list has a
  3060. // non-empty value. This may be used to include null fields in Patch
  3061. // requests.
  3062. NullFields []string `json:"-"`
  3063. }
  3064. func (s *UpdateDatabaseDdlMetadata) MarshalJSON() ([]byte, error) {
  3065. type NoMethod UpdateDatabaseDdlMetadata
  3066. raw := NoMethod(*s)
  3067. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3068. }
  3069. // UpdateDatabaseDdlRequest: Enqueues the given DDL statements to be
  3070. // applied, in order but not
  3071. // necessarily all at once, to the database schema at some point
  3072. // (or
  3073. // points) in the future. The server checks that the statements
  3074. // are executable (syntactically valid, name tables that exist,
  3075. // etc.)
  3076. // before enqueueing them, but they may still fail upon
  3077. // later execution (e.g., if a statement from another batch
  3078. // of
  3079. // statements is applied first and it conflicts in some way, or if
  3080. // there is some data-related problem like a `NULL` value in a column
  3081. // to
  3082. // which `NOT NULL` would be added). If a statement fails,
  3083. // all
  3084. // subsequent statements in the batch are automatically cancelled.
  3085. //
  3086. // Each batch of statements is assigned a name which can be used
  3087. // with
  3088. // the Operations API to monitor
  3089. // progress. See the
  3090. // operation_id field for more
  3091. // details.
  3092. type UpdateDatabaseDdlRequest struct {
  3093. // OperationId: If empty, the new update request is assigned
  3094. // an
  3095. // automatically-generated operation ID. Otherwise, `operation_id`
  3096. // is used to construct the name of the resulting
  3097. // Operation.
  3098. //
  3099. // Specifying an explicit operation ID simplifies determining
  3100. // whether the statements were executed in the event that
  3101. // the
  3102. // UpdateDatabaseDdl call is replayed,
  3103. // or the return value is otherwise lost: the database
  3104. // and
  3105. // `operation_id` fields can be combined to form the
  3106. // name of the resulting
  3107. // longrunning.Operation:
  3108. // `<database>/operations/<operation_id>`.
  3109. //
  3110. // `operation_id` should be unique within the database, and must be
  3111. // a valid identifier: `a-z*`. Note that
  3112. // automatically-generated operation IDs always begin with
  3113. // an
  3114. // underscore. If the named operation already exists,
  3115. // UpdateDatabaseDdl returns
  3116. // `ALREADY_EXISTS`.
  3117. OperationId string `json:"operationId,omitempty"`
  3118. // Statements: DDL statements to be applied to the database.
  3119. Statements []string `json:"statements,omitempty"`
  3120. // ForceSendFields is a list of field names (e.g. "OperationId") to
  3121. // unconditionally include in API requests. By default, fields with
  3122. // empty values are omitted from API requests. However, any non-pointer,
  3123. // non-interface field appearing in ForceSendFields will be sent to the
  3124. // server regardless of whether the field is empty or not. This may be
  3125. // used to include empty fields in Patch requests.
  3126. ForceSendFields []string `json:"-"`
  3127. // NullFields is a list of field names (e.g. "OperationId") to include
  3128. // in API requests with the JSON null value. By default, fields with
  3129. // empty values are omitted from API requests. However, any field with
  3130. // an empty value appearing in NullFields will be sent to the server as
  3131. // null. It is an error if a field in this list has a non-empty value.
  3132. // This may be used to include null fields in Patch requests.
  3133. NullFields []string `json:"-"`
  3134. }
  3135. func (s *UpdateDatabaseDdlRequest) MarshalJSON() ([]byte, error) {
  3136. type NoMethod UpdateDatabaseDdlRequest
  3137. raw := NoMethod(*s)
  3138. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3139. }
  3140. // UpdateInstanceMetadata: Metadata type for the operation returned
  3141. // by
  3142. // UpdateInstance.
  3143. type UpdateInstanceMetadata struct {
  3144. // CancelTime: The time at which this operation was cancelled. If set,
  3145. // this operation is
  3146. // in the process of undoing itself (which is guaranteed to succeed)
  3147. // and
  3148. // cannot be cancelled again.
  3149. CancelTime string `json:"cancelTime,omitempty"`
  3150. // EndTime: The time at which this operation failed or was completed
  3151. // successfully.
  3152. EndTime string `json:"endTime,omitempty"`
  3153. // Instance: The desired end state of the update.
  3154. Instance *Instance `json:"instance,omitempty"`
  3155. // StartTime: The time at which UpdateInstance
  3156. // request was received.
  3157. StartTime string `json:"startTime,omitempty"`
  3158. // ForceSendFields is a list of field names (e.g. "CancelTime") to
  3159. // unconditionally include in API requests. By default, fields with
  3160. // empty values are omitted from API requests. However, any non-pointer,
  3161. // non-interface field appearing in ForceSendFields will be sent to the
  3162. // server regardless of whether the field is empty or not. This may be
  3163. // used to include empty fields in Patch requests.
  3164. ForceSendFields []string `json:"-"`
  3165. // NullFields is a list of field names (e.g. "CancelTime") to include in
  3166. // API requests with the JSON null value. By default, fields with empty
  3167. // values are omitted from API requests. However, any field with an
  3168. // empty value appearing in NullFields will be sent to the server as
  3169. // null. It is an error if a field in this list has a non-empty value.
  3170. // This may be used to include null fields in Patch requests.
  3171. NullFields []string `json:"-"`
  3172. }
  3173. func (s *UpdateInstanceMetadata) MarshalJSON() ([]byte, error) {
  3174. type NoMethod UpdateInstanceMetadata
  3175. raw := NoMethod(*s)
  3176. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3177. }
  3178. // UpdateInstanceRequest: The request for UpdateInstance.
  3179. type UpdateInstanceRequest struct {
  3180. // FieldMask: Required. A mask specifying which fields in
  3181. // [][google.spanner.admin.instance.v1.UpdateInstanceRequest.instance]
  3182. // should be updated.
  3183. // The field mask must always be specified; this prevents any future
  3184. // fields in
  3185. // [][google.spanner.admin.instance.v1.Instance] from being erased
  3186. // accidentally by clients that do not know
  3187. // about them.
  3188. FieldMask string `json:"fieldMask,omitempty"`
  3189. // Instance: Required. The instance to update, which must always include
  3190. // the instance
  3191. // name. Otherwise, only fields mentioned in
  3192. // [][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]
  3193. // need be included.
  3194. Instance *Instance `json:"instance,omitempty"`
  3195. // ForceSendFields is a list of field names (e.g. "FieldMask") to
  3196. // unconditionally include in API requests. By default, fields with
  3197. // empty values are omitted from API requests. However, any non-pointer,
  3198. // non-interface field appearing in ForceSendFields will be sent to the
  3199. // server regardless of whether the field is empty or not. This may be
  3200. // used to include empty fields in Patch requests.
  3201. ForceSendFields []string `json:"-"`
  3202. // NullFields is a list of field names (e.g. "FieldMask") to include in
  3203. // API requests with the JSON null value. By default, fields with empty
  3204. // values are omitted from API requests. However, any field with an
  3205. // empty value appearing in NullFields will be sent to the server as
  3206. // null. It is an error if a field in this list has a non-empty value.
  3207. // This may be used to include null fields in Patch requests.
  3208. NullFields []string `json:"-"`
  3209. }
  3210. func (s *UpdateInstanceRequest) MarshalJSON() ([]byte, error) {
  3211. type NoMethod UpdateInstanceRequest
  3212. raw := NoMethod(*s)
  3213. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3214. }
  3215. // Write: Arguments to insert, update, insert_or_update, and
  3216. // replace operations.
  3217. type Write struct {
  3218. // Columns: The names of the columns in table to be written.
  3219. //
  3220. // The list of columns must contain enough columns to allow
  3221. // Cloud Spanner to derive values for all primary key columns in
  3222. // the
  3223. // row(s) to be modified.
  3224. Columns []string `json:"columns,omitempty"`
  3225. // Table: Required. The table whose rows will be written.
  3226. Table string `json:"table,omitempty"`
  3227. // Values: The values to be written. `values` can contain more than
  3228. // one
  3229. // list of values. If it does, then multiple rows are written, one
  3230. // for each entry in `values`. Each list in `values` must have
  3231. // exactly as many entries as there are entries in columns
  3232. // above. Sending multiple lists is equivalent to sending
  3233. // multiple
  3234. // `Mutation`s, each containing one `values` entry and repeating
  3235. // table and columns. Individual values in each list are
  3236. // encoded as described here.
  3237. Values [][]interface{} `json:"values,omitempty"`
  3238. // ForceSendFields is a list of field names (e.g. "Columns") to
  3239. // unconditionally include in API requests. By default, fields with
  3240. // empty values are omitted from API requests. However, any non-pointer,
  3241. // non-interface field appearing in ForceSendFields will be sent to the
  3242. // server regardless of whether the field is empty or not. This may be
  3243. // used to include empty fields in Patch requests.
  3244. ForceSendFields []string `json:"-"`
  3245. // NullFields is a list of field names (e.g. "Columns") to include in
  3246. // API requests with the JSON null value. By default, fields with empty
  3247. // values are omitted from API requests. However, any field with an
  3248. // empty value appearing in NullFields will be sent to the server as
  3249. // null. It is an error if a field in this list has a non-empty value.
  3250. // This may be used to include null fields in Patch requests.
  3251. NullFields []string `json:"-"`
  3252. }
  3253. func (s *Write) MarshalJSON() ([]byte, error) {
  3254. type NoMethod Write
  3255. raw := NoMethod(*s)
  3256. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3257. }
  3258. // method id "spanner.projects.instanceConfigs.get":
  3259. type ProjectsInstanceConfigsGetCall struct {
  3260. s *Service
  3261. name string
  3262. urlParams_ gensupport.URLParams
  3263. ifNoneMatch_ string
  3264. ctx_ context.Context
  3265. header_ http.Header
  3266. }
  3267. // Get: Gets information about a particular instance configuration.
  3268. func (r *ProjectsInstanceConfigsService) Get(name string) *ProjectsInstanceConfigsGetCall {
  3269. c := &ProjectsInstanceConfigsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3270. c.name = name
  3271. return c
  3272. }
  3273. // Fields allows partial responses to be retrieved. See
  3274. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3275. // for more information.
  3276. func (c *ProjectsInstanceConfigsGetCall) Fields(s ...googleapi.Field) *ProjectsInstanceConfigsGetCall {
  3277. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3278. return c
  3279. }
  3280. // IfNoneMatch sets the optional parameter which makes the operation
  3281. // fail if the object's ETag matches the given value. This is useful for
  3282. // getting updates only after the object has changed since the last
  3283. // request. Use googleapi.IsNotModified to check whether the response
  3284. // error from Do is the result of In-None-Match.
  3285. func (c *ProjectsInstanceConfigsGetCall) IfNoneMatch(entityTag string) *ProjectsInstanceConfigsGetCall {
  3286. c.ifNoneMatch_ = entityTag
  3287. return c
  3288. }
  3289. // Context sets the context to be used in this call's Do method. Any
  3290. // pending HTTP request will be aborted if the provided context is
  3291. // canceled.
  3292. func (c *ProjectsInstanceConfigsGetCall) Context(ctx context.Context) *ProjectsInstanceConfigsGetCall {
  3293. c.ctx_ = ctx
  3294. return c
  3295. }
  3296. // Header returns an http.Header that can be modified by the caller to
  3297. // add HTTP headers to the request.
  3298. func (c *ProjectsInstanceConfigsGetCall) Header() http.Header {
  3299. if c.header_ == nil {
  3300. c.header_ = make(http.Header)
  3301. }
  3302. return c.header_
  3303. }
  3304. func (c *ProjectsInstanceConfigsGetCall) doRequest(alt string) (*http.Response, error) {
  3305. reqHeaders := make(http.Header)
  3306. for k, v := range c.header_ {
  3307. reqHeaders[k] = v
  3308. }
  3309. reqHeaders.Set("User-Agent", c.s.userAgent())
  3310. if c.ifNoneMatch_ != "" {
  3311. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3312. }
  3313. var body io.Reader = nil
  3314. c.urlParams_.Set("alt", alt)
  3315. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3316. urls += "?" + c.urlParams_.Encode()
  3317. req, _ := http.NewRequest("GET", urls, body)
  3318. req.Header = reqHeaders
  3319. googleapi.Expand(req.URL, map[string]string{
  3320. "name": c.name,
  3321. })
  3322. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3323. }
  3324. // Do executes the "spanner.projects.instanceConfigs.get" call.
  3325. // Exactly one of *InstanceConfig or error will be non-nil. Any non-2xx
  3326. // status code is an error. Response headers are in either
  3327. // *InstanceConfig.ServerResponse.Header or (if a response was returned
  3328. // at all) in error.(*googleapi.Error).Header. Use
  3329. // googleapi.IsNotModified to check whether the returned error was
  3330. // because http.StatusNotModified was returned.
  3331. func (c *ProjectsInstanceConfigsGetCall) Do(opts ...googleapi.CallOption) (*InstanceConfig, error) {
  3332. gensupport.SetOptions(c.urlParams_, opts...)
  3333. res, err := c.doRequest("json")
  3334. if res != nil && res.StatusCode == http.StatusNotModified {
  3335. if res.Body != nil {
  3336. res.Body.Close()
  3337. }
  3338. return nil, &googleapi.Error{
  3339. Code: res.StatusCode,
  3340. Header: res.Header,
  3341. }
  3342. }
  3343. if err != nil {
  3344. return nil, err
  3345. }
  3346. defer googleapi.CloseBody(res)
  3347. if err := googleapi.CheckResponse(res); err != nil {
  3348. return nil, err
  3349. }
  3350. ret := &InstanceConfig{
  3351. ServerResponse: googleapi.ServerResponse{
  3352. Header: res.Header,
  3353. HTTPStatusCode: res.StatusCode,
  3354. },
  3355. }
  3356. target := &ret
  3357. if err := gensupport.DecodeResponse(target, res); err != nil {
  3358. return nil, err
  3359. }
  3360. return ret, nil
  3361. // {
  3362. // "description": "Gets information about a particular instance configuration.",
  3363. // "flatPath": "v1/projects/{projectsId}/instanceConfigs/{instanceConfigsId}",
  3364. // "httpMethod": "GET",
  3365. // "id": "spanner.projects.instanceConfigs.get",
  3366. // "parameterOrder": [
  3367. // "name"
  3368. // ],
  3369. // "parameters": {
  3370. // "name": {
  3371. // "description": "Required. The name of the requested instance configuration. Values are of\nthe form `projects/\u003cproject\u003e/instanceConfigs/\u003cconfig\u003e`.",
  3372. // "location": "path",
  3373. // "pattern": "^projects/[^/]+/instanceConfigs/[^/]+$",
  3374. // "required": true,
  3375. // "type": "string"
  3376. // }
  3377. // },
  3378. // "path": "v1/{+name}",
  3379. // "response": {
  3380. // "$ref": "InstanceConfig"
  3381. // },
  3382. // "scopes": [
  3383. // "https://www.googleapis.com/auth/cloud-platform",
  3384. // "https://www.googleapis.com/auth/spanner.admin"
  3385. // ]
  3386. // }
  3387. }
  3388. // method id "spanner.projects.instanceConfigs.list":
  3389. type ProjectsInstanceConfigsListCall struct {
  3390. s *Service
  3391. parent string
  3392. urlParams_ gensupport.URLParams
  3393. ifNoneMatch_ string
  3394. ctx_ context.Context
  3395. header_ http.Header
  3396. }
  3397. // List: Lists the supported instance configurations for a given
  3398. // project.
  3399. func (r *ProjectsInstanceConfigsService) List(parent string) *ProjectsInstanceConfigsListCall {
  3400. c := &ProjectsInstanceConfigsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3401. c.parent = parent
  3402. return c
  3403. }
  3404. // PageSize sets the optional parameter "pageSize": Number of instance
  3405. // configurations to be returned in the response. If 0 or
  3406. // less, defaults to the server's maximum allowed page size.
  3407. func (c *ProjectsInstanceConfigsListCall) PageSize(pageSize int64) *ProjectsInstanceConfigsListCall {
  3408. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3409. return c
  3410. }
  3411. // PageToken sets the optional parameter "pageToken": If non-empty,
  3412. // `page_token` should contain a
  3413. // next_page_token
  3414. // from a previous ListInstanceConfigsResponse.
  3415. func (c *ProjectsInstanceConfigsListCall) PageToken(pageToken string) *ProjectsInstanceConfigsListCall {
  3416. c.urlParams_.Set("pageToken", pageToken)
  3417. return c
  3418. }
  3419. // Fields allows partial responses to be retrieved. See
  3420. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3421. // for more information.
  3422. func (c *ProjectsInstanceConfigsListCall) Fields(s ...googleapi.Field) *ProjectsInstanceConfigsListCall {
  3423. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3424. return c
  3425. }
  3426. // IfNoneMatch sets the optional parameter which makes the operation
  3427. // fail if the object's ETag matches the given value. This is useful for
  3428. // getting updates only after the object has changed since the last
  3429. // request. Use googleapi.IsNotModified to check whether the response
  3430. // error from Do is the result of In-None-Match.
  3431. func (c *ProjectsInstanceConfigsListCall) IfNoneMatch(entityTag string) *ProjectsInstanceConfigsListCall {
  3432. c.ifNoneMatch_ = entityTag
  3433. return c
  3434. }
  3435. // Context sets the context to be used in this call's Do method. Any
  3436. // pending HTTP request will be aborted if the provided context is
  3437. // canceled.
  3438. func (c *ProjectsInstanceConfigsListCall) Context(ctx context.Context) *ProjectsInstanceConfigsListCall {
  3439. c.ctx_ = ctx
  3440. return c
  3441. }
  3442. // Header returns an http.Header that can be modified by the caller to
  3443. // add HTTP headers to the request.
  3444. func (c *ProjectsInstanceConfigsListCall) Header() http.Header {
  3445. if c.header_ == nil {
  3446. c.header_ = make(http.Header)
  3447. }
  3448. return c.header_
  3449. }
  3450. func (c *ProjectsInstanceConfigsListCall) doRequest(alt string) (*http.Response, error) {
  3451. reqHeaders := make(http.Header)
  3452. for k, v := range c.header_ {
  3453. reqHeaders[k] = v
  3454. }
  3455. reqHeaders.Set("User-Agent", c.s.userAgent())
  3456. if c.ifNoneMatch_ != "" {
  3457. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3458. }
  3459. var body io.Reader = nil
  3460. c.urlParams_.Set("alt", alt)
  3461. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instanceConfigs")
  3462. urls += "?" + c.urlParams_.Encode()
  3463. req, _ := http.NewRequest("GET", urls, body)
  3464. req.Header = reqHeaders
  3465. googleapi.Expand(req.URL, map[string]string{
  3466. "parent": c.parent,
  3467. })
  3468. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3469. }
  3470. // Do executes the "spanner.projects.instanceConfigs.list" call.
  3471. // Exactly one of *ListInstanceConfigsResponse or error will be non-nil.
  3472. // Any non-2xx status code is an error. Response headers are in either
  3473. // *ListInstanceConfigsResponse.ServerResponse.Header or (if a response
  3474. // was returned at all) in error.(*googleapi.Error).Header. Use
  3475. // googleapi.IsNotModified to check whether the returned error was
  3476. // because http.StatusNotModified was returned.
  3477. func (c *ProjectsInstanceConfigsListCall) Do(opts ...googleapi.CallOption) (*ListInstanceConfigsResponse, error) {
  3478. gensupport.SetOptions(c.urlParams_, opts...)
  3479. res, err := c.doRequest("json")
  3480. if res != nil && res.StatusCode == http.StatusNotModified {
  3481. if res.Body != nil {
  3482. res.Body.Close()
  3483. }
  3484. return nil, &googleapi.Error{
  3485. Code: res.StatusCode,
  3486. Header: res.Header,
  3487. }
  3488. }
  3489. if err != nil {
  3490. return nil, err
  3491. }
  3492. defer googleapi.CloseBody(res)
  3493. if err := googleapi.CheckResponse(res); err != nil {
  3494. return nil, err
  3495. }
  3496. ret := &ListInstanceConfigsResponse{
  3497. ServerResponse: googleapi.ServerResponse{
  3498. Header: res.Header,
  3499. HTTPStatusCode: res.StatusCode,
  3500. },
  3501. }
  3502. target := &ret
  3503. if err := gensupport.DecodeResponse(target, res); err != nil {
  3504. return nil, err
  3505. }
  3506. return ret, nil
  3507. // {
  3508. // "description": "Lists the supported instance configurations for a given project.",
  3509. // "flatPath": "v1/projects/{projectsId}/instanceConfigs",
  3510. // "httpMethod": "GET",
  3511. // "id": "spanner.projects.instanceConfigs.list",
  3512. // "parameterOrder": [
  3513. // "parent"
  3514. // ],
  3515. // "parameters": {
  3516. // "pageSize": {
  3517. // "description": "Number of instance configurations to be returned in the response. If 0 or\nless, defaults to the server's maximum allowed page size.",
  3518. // "format": "int32",
  3519. // "location": "query",
  3520. // "type": "integer"
  3521. // },
  3522. // "pageToken": {
  3523. // "description": "If non-empty, `page_token` should contain a\nnext_page_token\nfrom a previous ListInstanceConfigsResponse.",
  3524. // "location": "query",
  3525. // "type": "string"
  3526. // },
  3527. // "parent": {
  3528. // "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`.",
  3529. // "location": "path",
  3530. // "pattern": "^projects/[^/]+$",
  3531. // "required": true,
  3532. // "type": "string"
  3533. // }
  3534. // },
  3535. // "path": "v1/{+parent}/instanceConfigs",
  3536. // "response": {
  3537. // "$ref": "ListInstanceConfigsResponse"
  3538. // },
  3539. // "scopes": [
  3540. // "https://www.googleapis.com/auth/cloud-platform",
  3541. // "https://www.googleapis.com/auth/spanner.admin"
  3542. // ]
  3543. // }
  3544. }
  3545. // Pages invokes f for each page of results.
  3546. // A non-nil error returned from f will halt the iteration.
  3547. // The provided context supersedes any context provided to the Context method.
  3548. func (c *ProjectsInstanceConfigsListCall) Pages(ctx context.Context, f func(*ListInstanceConfigsResponse) error) error {
  3549. c.ctx_ = ctx
  3550. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3551. for {
  3552. x, err := c.Do()
  3553. if err != nil {
  3554. return err
  3555. }
  3556. if err := f(x); err != nil {
  3557. return err
  3558. }
  3559. if x.NextPageToken == "" {
  3560. return nil
  3561. }
  3562. c.PageToken(x.NextPageToken)
  3563. }
  3564. }
  3565. // method id "spanner.projects.instances.create":
  3566. type ProjectsInstancesCreateCall struct {
  3567. s *Service
  3568. parent string
  3569. createinstancerequest *CreateInstanceRequest
  3570. urlParams_ gensupport.URLParams
  3571. ctx_ context.Context
  3572. header_ http.Header
  3573. }
  3574. // Create: Creates an instance and begins preparing it to begin serving.
  3575. // The
  3576. // returned long-running operation
  3577. // can be used to track the progress of preparing the new
  3578. // instance. The instance name is assigned by the caller. If the
  3579. // named instance already exists, `CreateInstance`
  3580. // returns
  3581. // `ALREADY_EXISTS`.
  3582. //
  3583. // Immediately upon completion of this request:
  3584. //
  3585. // * The instance is readable via the API, with all requested
  3586. // attributes
  3587. // but no allocated resources. Its state is `CREATING`.
  3588. //
  3589. // Until completion of the returned operation:
  3590. //
  3591. // * Cancelling the operation renders the instance immediately
  3592. // unreadable
  3593. // via the API.
  3594. // * The instance can be deleted.
  3595. // * All other attempts to modify the instance are rejected.
  3596. //
  3597. // Upon completion of the returned operation:
  3598. //
  3599. // * Billing for all successfully-allocated resources begins (some
  3600. // types
  3601. // may have lower than the requested levels).
  3602. // * Databases can be created in the instance.
  3603. // * The instance's allocated resource levels are readable via the
  3604. // API.
  3605. // * The instance's state becomes `READY`.
  3606. //
  3607. // The returned long-running operation will
  3608. // have a name of the format `<instance_name>/operations/<operation_id>`
  3609. // and
  3610. // can be used to track creation of the instance. The
  3611. // metadata field type is
  3612. // CreateInstanceMetadata.
  3613. // The response field type is
  3614. // Instance, if successful.
  3615. func (r *ProjectsInstancesService) Create(parent string, createinstancerequest *CreateInstanceRequest) *ProjectsInstancesCreateCall {
  3616. c := &ProjectsInstancesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3617. c.parent = parent
  3618. c.createinstancerequest = createinstancerequest
  3619. return c
  3620. }
  3621. // Fields allows partial responses to be retrieved. See
  3622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3623. // for more information.
  3624. func (c *ProjectsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsInstancesCreateCall {
  3625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3626. return c
  3627. }
  3628. // Context sets the context to be used in this call's Do method. Any
  3629. // pending HTTP request will be aborted if the provided context is
  3630. // canceled.
  3631. func (c *ProjectsInstancesCreateCall) Context(ctx context.Context) *ProjectsInstancesCreateCall {
  3632. c.ctx_ = ctx
  3633. return c
  3634. }
  3635. // Header returns an http.Header that can be modified by the caller to
  3636. // add HTTP headers to the request.
  3637. func (c *ProjectsInstancesCreateCall) Header() http.Header {
  3638. if c.header_ == nil {
  3639. c.header_ = make(http.Header)
  3640. }
  3641. return c.header_
  3642. }
  3643. func (c *ProjectsInstancesCreateCall) doRequest(alt string) (*http.Response, error) {
  3644. reqHeaders := make(http.Header)
  3645. for k, v := range c.header_ {
  3646. reqHeaders[k] = v
  3647. }
  3648. reqHeaders.Set("User-Agent", c.s.userAgent())
  3649. var body io.Reader = nil
  3650. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createinstancerequest)
  3651. if err != nil {
  3652. return nil, err
  3653. }
  3654. reqHeaders.Set("Content-Type", "application/json")
  3655. c.urlParams_.Set("alt", alt)
  3656. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances")
  3657. urls += "?" + c.urlParams_.Encode()
  3658. req, _ := http.NewRequest("POST", urls, body)
  3659. req.Header = reqHeaders
  3660. googleapi.Expand(req.URL, map[string]string{
  3661. "parent": c.parent,
  3662. })
  3663. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3664. }
  3665. // Do executes the "spanner.projects.instances.create" call.
  3666. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3667. // status code is an error. Response headers are in either
  3668. // *Operation.ServerResponse.Header or (if a response was returned at
  3669. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3670. // to check whether the returned error was because
  3671. // http.StatusNotModified was returned.
  3672. func (c *ProjectsInstancesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3673. gensupport.SetOptions(c.urlParams_, opts...)
  3674. res, err := c.doRequest("json")
  3675. if res != nil && res.StatusCode == http.StatusNotModified {
  3676. if res.Body != nil {
  3677. res.Body.Close()
  3678. }
  3679. return nil, &googleapi.Error{
  3680. Code: res.StatusCode,
  3681. Header: res.Header,
  3682. }
  3683. }
  3684. if err != nil {
  3685. return nil, err
  3686. }
  3687. defer googleapi.CloseBody(res)
  3688. if err := googleapi.CheckResponse(res); err != nil {
  3689. return nil, err
  3690. }
  3691. ret := &Operation{
  3692. ServerResponse: googleapi.ServerResponse{
  3693. Header: res.Header,
  3694. HTTPStatusCode: res.StatusCode,
  3695. },
  3696. }
  3697. target := &ret
  3698. if err := gensupport.DecodeResponse(target, res); err != nil {
  3699. return nil, err
  3700. }
  3701. return ret, nil
  3702. // {
  3703. // "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.",
  3704. // "flatPath": "v1/projects/{projectsId}/instances",
  3705. // "httpMethod": "POST",
  3706. // "id": "spanner.projects.instances.create",
  3707. // "parameterOrder": [
  3708. // "parent"
  3709. // ],
  3710. // "parameters": {
  3711. // "parent": {
  3712. // "description": "Required. The name of the project in which to create the instance. Values\nare of the form `projects/\u003cproject\u003e`.",
  3713. // "location": "path",
  3714. // "pattern": "^projects/[^/]+$",
  3715. // "required": true,
  3716. // "type": "string"
  3717. // }
  3718. // },
  3719. // "path": "v1/{+parent}/instances",
  3720. // "request": {
  3721. // "$ref": "CreateInstanceRequest"
  3722. // },
  3723. // "response": {
  3724. // "$ref": "Operation"
  3725. // },
  3726. // "scopes": [
  3727. // "https://www.googleapis.com/auth/cloud-platform",
  3728. // "https://www.googleapis.com/auth/spanner.admin"
  3729. // ]
  3730. // }
  3731. }
  3732. // method id "spanner.projects.instances.delete":
  3733. type ProjectsInstancesDeleteCall struct {
  3734. s *Service
  3735. name string
  3736. urlParams_ gensupport.URLParams
  3737. ctx_ context.Context
  3738. header_ http.Header
  3739. }
  3740. // Delete: Deletes an instance.
  3741. //
  3742. // Immediately upon completion of the request:
  3743. //
  3744. // * Billing ceases for all of the instance's reserved
  3745. // resources.
  3746. //
  3747. // Soon afterward:
  3748. //
  3749. // * The instance and *all of its databases* immediately and
  3750. // irrevocably disappear from the API. All data in the databases
  3751. // is permanently deleted.
  3752. func (r *ProjectsInstancesService) Delete(name string) *ProjectsInstancesDeleteCall {
  3753. c := &ProjectsInstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3754. c.name = name
  3755. return c
  3756. }
  3757. // Fields allows partial responses to be retrieved. See
  3758. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3759. // for more information.
  3760. func (c *ProjectsInstancesDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesDeleteCall {
  3761. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3762. return c
  3763. }
  3764. // Context sets the context to be used in this call's Do method. Any
  3765. // pending HTTP request will be aborted if the provided context is
  3766. // canceled.
  3767. func (c *ProjectsInstancesDeleteCall) Context(ctx context.Context) *ProjectsInstancesDeleteCall {
  3768. c.ctx_ = ctx
  3769. return c
  3770. }
  3771. // Header returns an http.Header that can be modified by the caller to
  3772. // add HTTP headers to the request.
  3773. func (c *ProjectsInstancesDeleteCall) Header() http.Header {
  3774. if c.header_ == nil {
  3775. c.header_ = make(http.Header)
  3776. }
  3777. return c.header_
  3778. }
  3779. func (c *ProjectsInstancesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3780. reqHeaders := make(http.Header)
  3781. for k, v := range c.header_ {
  3782. reqHeaders[k] = v
  3783. }
  3784. reqHeaders.Set("User-Agent", c.s.userAgent())
  3785. var body io.Reader = nil
  3786. c.urlParams_.Set("alt", alt)
  3787. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3788. urls += "?" + c.urlParams_.Encode()
  3789. req, _ := http.NewRequest("DELETE", urls, body)
  3790. req.Header = reqHeaders
  3791. googleapi.Expand(req.URL, map[string]string{
  3792. "name": c.name,
  3793. })
  3794. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3795. }
  3796. // Do executes the "spanner.projects.instances.delete" call.
  3797. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3798. // code is an error. Response headers are in either
  3799. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3800. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3801. // check whether the returned error was because http.StatusNotModified
  3802. // was returned.
  3803. func (c *ProjectsInstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3804. gensupport.SetOptions(c.urlParams_, opts...)
  3805. res, err := c.doRequest("json")
  3806. if res != nil && res.StatusCode == http.StatusNotModified {
  3807. if res.Body != nil {
  3808. res.Body.Close()
  3809. }
  3810. return nil, &googleapi.Error{
  3811. Code: res.StatusCode,
  3812. Header: res.Header,
  3813. }
  3814. }
  3815. if err != nil {
  3816. return nil, err
  3817. }
  3818. defer googleapi.CloseBody(res)
  3819. if err := googleapi.CheckResponse(res); err != nil {
  3820. return nil, err
  3821. }
  3822. ret := &Empty{
  3823. ServerResponse: googleapi.ServerResponse{
  3824. Header: res.Header,
  3825. HTTPStatusCode: res.StatusCode,
  3826. },
  3827. }
  3828. target := &ret
  3829. if err := gensupport.DecodeResponse(target, res); err != nil {
  3830. return nil, err
  3831. }
  3832. return ret, nil
  3833. // {
  3834. // "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.",
  3835. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}",
  3836. // "httpMethod": "DELETE",
  3837. // "id": "spanner.projects.instances.delete",
  3838. // "parameterOrder": [
  3839. // "name"
  3840. // ],
  3841. // "parameters": {
  3842. // "name": {
  3843. // "description": "Required. The name of the instance to be deleted. Values are of the form\n`projects/\u003cproject\u003e/instances/\u003cinstance\u003e`",
  3844. // "location": "path",
  3845. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  3846. // "required": true,
  3847. // "type": "string"
  3848. // }
  3849. // },
  3850. // "path": "v1/{+name}",
  3851. // "response": {
  3852. // "$ref": "Empty"
  3853. // },
  3854. // "scopes": [
  3855. // "https://www.googleapis.com/auth/cloud-platform",
  3856. // "https://www.googleapis.com/auth/spanner.admin"
  3857. // ]
  3858. // }
  3859. }
  3860. // method id "spanner.projects.instances.get":
  3861. type ProjectsInstancesGetCall struct {
  3862. s *Service
  3863. name string
  3864. urlParams_ gensupport.URLParams
  3865. ifNoneMatch_ string
  3866. ctx_ context.Context
  3867. header_ http.Header
  3868. }
  3869. // Get: Gets information about a particular instance.
  3870. func (r *ProjectsInstancesService) Get(name string) *ProjectsInstancesGetCall {
  3871. c := &ProjectsInstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3872. c.name = name
  3873. return c
  3874. }
  3875. // Fields allows partial responses to be retrieved. See
  3876. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3877. // for more information.
  3878. func (c *ProjectsInstancesGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesGetCall {
  3879. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3880. return c
  3881. }
  3882. // IfNoneMatch sets the optional parameter which makes the operation
  3883. // fail if the object's ETag matches the given value. This is useful for
  3884. // getting updates only after the object has changed since the last
  3885. // request. Use googleapi.IsNotModified to check whether the response
  3886. // error from Do is the result of In-None-Match.
  3887. func (c *ProjectsInstancesGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesGetCall {
  3888. c.ifNoneMatch_ = entityTag
  3889. return c
  3890. }
  3891. // Context sets the context to be used in this call's Do method. Any
  3892. // pending HTTP request will be aborted if the provided context is
  3893. // canceled.
  3894. func (c *ProjectsInstancesGetCall) Context(ctx context.Context) *ProjectsInstancesGetCall {
  3895. c.ctx_ = ctx
  3896. return c
  3897. }
  3898. // Header returns an http.Header that can be modified by the caller to
  3899. // add HTTP headers to the request.
  3900. func (c *ProjectsInstancesGetCall) Header() http.Header {
  3901. if c.header_ == nil {
  3902. c.header_ = make(http.Header)
  3903. }
  3904. return c.header_
  3905. }
  3906. func (c *ProjectsInstancesGetCall) doRequest(alt string) (*http.Response, error) {
  3907. reqHeaders := make(http.Header)
  3908. for k, v := range c.header_ {
  3909. reqHeaders[k] = v
  3910. }
  3911. reqHeaders.Set("User-Agent", c.s.userAgent())
  3912. if c.ifNoneMatch_ != "" {
  3913. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3914. }
  3915. var body io.Reader = nil
  3916. c.urlParams_.Set("alt", alt)
  3917. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3918. urls += "?" + c.urlParams_.Encode()
  3919. req, _ := http.NewRequest("GET", urls, body)
  3920. req.Header = reqHeaders
  3921. googleapi.Expand(req.URL, map[string]string{
  3922. "name": c.name,
  3923. })
  3924. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3925. }
  3926. // Do executes the "spanner.projects.instances.get" call.
  3927. // Exactly one of *Instance or error will be non-nil. Any non-2xx status
  3928. // code is an error. Response headers are in either
  3929. // *Instance.ServerResponse.Header or (if a response was returned at
  3930. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3931. // to check whether the returned error was because
  3932. // http.StatusNotModified was returned.
  3933. func (c *ProjectsInstancesGetCall) Do(opts ...googleapi.CallOption) (*Instance, error) {
  3934. gensupport.SetOptions(c.urlParams_, opts...)
  3935. res, err := c.doRequest("json")
  3936. if res != nil && res.StatusCode == http.StatusNotModified {
  3937. if res.Body != nil {
  3938. res.Body.Close()
  3939. }
  3940. return nil, &googleapi.Error{
  3941. Code: res.StatusCode,
  3942. Header: res.Header,
  3943. }
  3944. }
  3945. if err != nil {
  3946. return nil, err
  3947. }
  3948. defer googleapi.CloseBody(res)
  3949. if err := googleapi.CheckResponse(res); err != nil {
  3950. return nil, err
  3951. }
  3952. ret := &Instance{
  3953. ServerResponse: googleapi.ServerResponse{
  3954. Header: res.Header,
  3955. HTTPStatusCode: res.StatusCode,
  3956. },
  3957. }
  3958. target := &ret
  3959. if err := gensupport.DecodeResponse(target, res); err != nil {
  3960. return nil, err
  3961. }
  3962. return ret, nil
  3963. // {
  3964. // "description": "Gets information about a particular instance.",
  3965. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}",
  3966. // "httpMethod": "GET",
  3967. // "id": "spanner.projects.instances.get",
  3968. // "parameterOrder": [
  3969. // "name"
  3970. // ],
  3971. // "parameters": {
  3972. // "name": {
  3973. // "description": "Required. The name of the requested instance. Values are of the form\n`projects/\u003cproject\u003e/instances/\u003cinstance\u003e`.",
  3974. // "location": "path",
  3975. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  3976. // "required": true,
  3977. // "type": "string"
  3978. // }
  3979. // },
  3980. // "path": "v1/{+name}",
  3981. // "response": {
  3982. // "$ref": "Instance"
  3983. // },
  3984. // "scopes": [
  3985. // "https://www.googleapis.com/auth/cloud-platform",
  3986. // "https://www.googleapis.com/auth/spanner.admin"
  3987. // ]
  3988. // }
  3989. }
  3990. // method id "spanner.projects.instances.getIamPolicy":
  3991. type ProjectsInstancesGetIamPolicyCall struct {
  3992. s *Service
  3993. resource string
  3994. getiampolicyrequest *GetIamPolicyRequest
  3995. urlParams_ gensupport.URLParams
  3996. ctx_ context.Context
  3997. header_ http.Header
  3998. }
  3999. // GetIamPolicy: Gets the access control policy for an instance
  4000. // resource. Returns an empty
  4001. // policy if an instance exists but does not have a policy
  4002. // set.
  4003. //
  4004. // Authorization requires `spanner.instances.getIamPolicy` on
  4005. // resource.
  4006. func (r *ProjectsInstancesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsInstancesGetIamPolicyCall {
  4007. c := &ProjectsInstancesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4008. c.resource = resource
  4009. c.getiampolicyrequest = getiampolicyrequest
  4010. return c
  4011. }
  4012. // Fields allows partial responses to be retrieved. See
  4013. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4014. // for more information.
  4015. func (c *ProjectsInstancesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesGetIamPolicyCall {
  4016. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4017. return c
  4018. }
  4019. // Context sets the context to be used in this call's Do method. Any
  4020. // pending HTTP request will be aborted if the provided context is
  4021. // canceled.
  4022. func (c *ProjectsInstancesGetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesGetIamPolicyCall {
  4023. c.ctx_ = ctx
  4024. return c
  4025. }
  4026. // Header returns an http.Header that can be modified by the caller to
  4027. // add HTTP headers to the request.
  4028. func (c *ProjectsInstancesGetIamPolicyCall) Header() http.Header {
  4029. if c.header_ == nil {
  4030. c.header_ = make(http.Header)
  4031. }
  4032. return c.header_
  4033. }
  4034. func (c *ProjectsInstancesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4035. reqHeaders := make(http.Header)
  4036. for k, v := range c.header_ {
  4037. reqHeaders[k] = v
  4038. }
  4039. reqHeaders.Set("User-Agent", c.s.userAgent())
  4040. var body io.Reader = nil
  4041. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  4042. if err != nil {
  4043. return nil, err
  4044. }
  4045. reqHeaders.Set("Content-Type", "application/json")
  4046. c.urlParams_.Set("alt", alt)
  4047. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  4048. urls += "?" + c.urlParams_.Encode()
  4049. req, _ := http.NewRequest("POST", urls, body)
  4050. req.Header = reqHeaders
  4051. googleapi.Expand(req.URL, map[string]string{
  4052. "resource": c.resource,
  4053. })
  4054. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4055. }
  4056. // Do executes the "spanner.projects.instances.getIamPolicy" call.
  4057. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4058. // code is an error. Response headers are in either
  4059. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4060. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4061. // check whether the returned error was because http.StatusNotModified
  4062. // was returned.
  4063. func (c *ProjectsInstancesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4064. gensupport.SetOptions(c.urlParams_, opts...)
  4065. res, err := c.doRequest("json")
  4066. if res != nil && res.StatusCode == http.StatusNotModified {
  4067. if res.Body != nil {
  4068. res.Body.Close()
  4069. }
  4070. return nil, &googleapi.Error{
  4071. Code: res.StatusCode,
  4072. Header: res.Header,
  4073. }
  4074. }
  4075. if err != nil {
  4076. return nil, err
  4077. }
  4078. defer googleapi.CloseBody(res)
  4079. if err := googleapi.CheckResponse(res); err != nil {
  4080. return nil, err
  4081. }
  4082. ret := &Policy{
  4083. ServerResponse: googleapi.ServerResponse{
  4084. Header: res.Header,
  4085. HTTPStatusCode: res.StatusCode,
  4086. },
  4087. }
  4088. target := &ret
  4089. if err := gensupport.DecodeResponse(target, res); err != nil {
  4090. return nil, err
  4091. }
  4092. return ret, nil
  4093. // {
  4094. // "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.",
  4095. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}:getIamPolicy",
  4096. // "httpMethod": "POST",
  4097. // "id": "spanner.projects.instances.getIamPolicy",
  4098. // "parameterOrder": [
  4099. // "resource"
  4100. // ],
  4101. // "parameters": {
  4102. // "resource": {
  4103. // "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.",
  4104. // "location": "path",
  4105. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4106. // "required": true,
  4107. // "type": "string"
  4108. // }
  4109. // },
  4110. // "path": "v1/{+resource}:getIamPolicy",
  4111. // "request": {
  4112. // "$ref": "GetIamPolicyRequest"
  4113. // },
  4114. // "response": {
  4115. // "$ref": "Policy"
  4116. // },
  4117. // "scopes": [
  4118. // "https://www.googleapis.com/auth/cloud-platform",
  4119. // "https://www.googleapis.com/auth/spanner.admin"
  4120. // ]
  4121. // }
  4122. }
  4123. // method id "spanner.projects.instances.list":
  4124. type ProjectsInstancesListCall struct {
  4125. s *Service
  4126. parent string
  4127. urlParams_ gensupport.URLParams
  4128. ifNoneMatch_ string
  4129. ctx_ context.Context
  4130. header_ http.Header
  4131. }
  4132. // List: Lists all instances in the given project.
  4133. func (r *ProjectsInstancesService) List(parent string) *ProjectsInstancesListCall {
  4134. c := &ProjectsInstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4135. c.parent = parent
  4136. return c
  4137. }
  4138. // Filter sets the optional parameter "filter": An expression for
  4139. // filtering the results of the request. Filter rules are
  4140. // case insensitive. The fields eligible for filtering are:
  4141. //
  4142. // * `name`
  4143. // * `display_name`
  4144. // * `labels.key` where key is the name of a label
  4145. //
  4146. // Some examples of using filters are:
  4147. //
  4148. // * `name:*` --> The instance has a name.
  4149. // * `name:Howl` --> The instance's name contains the string "howl".
  4150. // * `name:HOWL` --> Equivalent to above.
  4151. // * `NAME:howl` --> Equivalent to above.
  4152. // * `labels.env:*` --> The instance has the label "env".
  4153. // * `labels.env:dev` --> The instance has the label "env" and the
  4154. // value of
  4155. // the label contains the string "dev".
  4156. // * `name:howl labels.env:dev` --> The instance's name contains
  4157. // "howl" and
  4158. // it has the label "env" with its
  4159. // value
  4160. // containing "dev".
  4161. func (c *ProjectsInstancesListCall) Filter(filter string) *ProjectsInstancesListCall {
  4162. c.urlParams_.Set("filter", filter)
  4163. return c
  4164. }
  4165. // PageSize sets the optional parameter "pageSize": Number of instances
  4166. // to be returned in the response. If 0 or less, defaults
  4167. // to the server's maximum allowed page size.
  4168. func (c *ProjectsInstancesListCall) PageSize(pageSize int64) *ProjectsInstancesListCall {
  4169. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4170. return c
  4171. }
  4172. // PageToken sets the optional parameter "pageToken": If non-empty,
  4173. // `page_token` should contain a
  4174. // next_page_token from a
  4175. // previous ListInstancesResponse.
  4176. func (c *ProjectsInstancesListCall) PageToken(pageToken string) *ProjectsInstancesListCall {
  4177. c.urlParams_.Set("pageToken", pageToken)
  4178. return c
  4179. }
  4180. // Fields allows partial responses to be retrieved. See
  4181. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4182. // for more information.
  4183. func (c *ProjectsInstancesListCall) Fields(s ...googleapi.Field) *ProjectsInstancesListCall {
  4184. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4185. return c
  4186. }
  4187. // IfNoneMatch sets the optional parameter which makes the operation
  4188. // fail if the object's ETag matches the given value. This is useful for
  4189. // getting updates only after the object has changed since the last
  4190. // request. Use googleapi.IsNotModified to check whether the response
  4191. // error from Do is the result of In-None-Match.
  4192. func (c *ProjectsInstancesListCall) IfNoneMatch(entityTag string) *ProjectsInstancesListCall {
  4193. c.ifNoneMatch_ = entityTag
  4194. return c
  4195. }
  4196. // Context sets the context to be used in this call's Do method. Any
  4197. // pending HTTP request will be aborted if the provided context is
  4198. // canceled.
  4199. func (c *ProjectsInstancesListCall) Context(ctx context.Context) *ProjectsInstancesListCall {
  4200. c.ctx_ = ctx
  4201. return c
  4202. }
  4203. // Header returns an http.Header that can be modified by the caller to
  4204. // add HTTP headers to the request.
  4205. func (c *ProjectsInstancesListCall) Header() http.Header {
  4206. if c.header_ == nil {
  4207. c.header_ = make(http.Header)
  4208. }
  4209. return c.header_
  4210. }
  4211. func (c *ProjectsInstancesListCall) doRequest(alt string) (*http.Response, error) {
  4212. reqHeaders := make(http.Header)
  4213. for k, v := range c.header_ {
  4214. reqHeaders[k] = v
  4215. }
  4216. reqHeaders.Set("User-Agent", c.s.userAgent())
  4217. if c.ifNoneMatch_ != "" {
  4218. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4219. }
  4220. var body io.Reader = nil
  4221. c.urlParams_.Set("alt", alt)
  4222. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances")
  4223. urls += "?" + c.urlParams_.Encode()
  4224. req, _ := http.NewRequest("GET", urls, body)
  4225. req.Header = reqHeaders
  4226. googleapi.Expand(req.URL, map[string]string{
  4227. "parent": c.parent,
  4228. })
  4229. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4230. }
  4231. // Do executes the "spanner.projects.instances.list" call.
  4232. // Exactly one of *ListInstancesResponse or error will be non-nil. Any
  4233. // non-2xx status code is an error. Response headers are in either
  4234. // *ListInstancesResponse.ServerResponse.Header or (if a response was
  4235. // returned at all) in error.(*googleapi.Error).Header. Use
  4236. // googleapi.IsNotModified to check whether the returned error was
  4237. // because http.StatusNotModified was returned.
  4238. func (c *ProjectsInstancesListCall) Do(opts ...googleapi.CallOption) (*ListInstancesResponse, error) {
  4239. gensupport.SetOptions(c.urlParams_, opts...)
  4240. res, err := c.doRequest("json")
  4241. if res != nil && res.StatusCode == http.StatusNotModified {
  4242. if res.Body != nil {
  4243. res.Body.Close()
  4244. }
  4245. return nil, &googleapi.Error{
  4246. Code: res.StatusCode,
  4247. Header: res.Header,
  4248. }
  4249. }
  4250. if err != nil {
  4251. return nil, err
  4252. }
  4253. defer googleapi.CloseBody(res)
  4254. if err := googleapi.CheckResponse(res); err != nil {
  4255. return nil, err
  4256. }
  4257. ret := &ListInstancesResponse{
  4258. ServerResponse: googleapi.ServerResponse{
  4259. Header: res.Header,
  4260. HTTPStatusCode: res.StatusCode,
  4261. },
  4262. }
  4263. target := &ret
  4264. if err := gensupport.DecodeResponse(target, res); err != nil {
  4265. return nil, err
  4266. }
  4267. return ret, nil
  4268. // {
  4269. // "description": "Lists all instances in the given project.",
  4270. // "flatPath": "v1/projects/{projectsId}/instances",
  4271. // "httpMethod": "GET",
  4272. // "id": "spanner.projects.instances.list",
  4273. // "parameterOrder": [
  4274. // "parent"
  4275. // ],
  4276. // "parameters": {
  4277. // "filter": {
  4278. // "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\".",
  4279. // "location": "query",
  4280. // "type": "string"
  4281. // },
  4282. // "pageSize": {
  4283. // "description": "Number of instances to be returned in the response. If 0 or less, defaults\nto the server's maximum allowed page size.",
  4284. // "format": "int32",
  4285. // "location": "query",
  4286. // "type": "integer"
  4287. // },
  4288. // "pageToken": {
  4289. // "description": "If non-empty, `page_token` should contain a\nnext_page_token from a\nprevious ListInstancesResponse.",
  4290. // "location": "query",
  4291. // "type": "string"
  4292. // },
  4293. // "parent": {
  4294. // "description": "Required. The name of the project for which a list of instances is\nrequested. Values are of the form `projects/\u003cproject\u003e`.",
  4295. // "location": "path",
  4296. // "pattern": "^projects/[^/]+$",
  4297. // "required": true,
  4298. // "type": "string"
  4299. // }
  4300. // },
  4301. // "path": "v1/{+parent}/instances",
  4302. // "response": {
  4303. // "$ref": "ListInstancesResponse"
  4304. // },
  4305. // "scopes": [
  4306. // "https://www.googleapis.com/auth/cloud-platform",
  4307. // "https://www.googleapis.com/auth/spanner.admin"
  4308. // ]
  4309. // }
  4310. }
  4311. // Pages invokes f for each page of results.
  4312. // A non-nil error returned from f will halt the iteration.
  4313. // The provided context supersedes any context provided to the Context method.
  4314. func (c *ProjectsInstancesListCall) Pages(ctx context.Context, f func(*ListInstancesResponse) error) error {
  4315. c.ctx_ = ctx
  4316. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4317. for {
  4318. x, err := c.Do()
  4319. if err != nil {
  4320. return err
  4321. }
  4322. if err := f(x); err != nil {
  4323. return err
  4324. }
  4325. if x.NextPageToken == "" {
  4326. return nil
  4327. }
  4328. c.PageToken(x.NextPageToken)
  4329. }
  4330. }
  4331. // method id "spanner.projects.instances.patch":
  4332. type ProjectsInstancesPatchCall struct {
  4333. s *Service
  4334. nameid string
  4335. updateinstancerequest *UpdateInstanceRequest
  4336. urlParams_ gensupport.URLParams
  4337. ctx_ context.Context
  4338. header_ http.Header
  4339. }
  4340. // Patch: Updates an instance, and begins allocating or releasing
  4341. // resources
  4342. // as requested. The returned long-running
  4343. // operation can be used to track the
  4344. // progress of updating the instance. If the named instance does
  4345. // not
  4346. // exist, returns `NOT_FOUND`.
  4347. //
  4348. // Immediately upon completion of this request:
  4349. //
  4350. // * For resource types for which a decrease in the instance's
  4351. // allocation
  4352. // has been requested, billing is based on the newly-requested
  4353. // level.
  4354. //
  4355. // Until completion of the returned operation:
  4356. //
  4357. // * Cancelling the operation sets its metadata's
  4358. // cancel_time, and begins
  4359. // restoring resources to their pre-request values. The operation
  4360. // is guaranteed to succeed at undoing all resource changes,
  4361. // after which point it terminates with a `CANCELLED` status.
  4362. // * All other attempts to modify the instance are rejected.
  4363. // * Reading the instance via the API continues to give the
  4364. // pre-request
  4365. // resource levels.
  4366. //
  4367. // Upon completion of the returned operation:
  4368. //
  4369. // * Billing begins for all successfully-allocated resources (some
  4370. // types
  4371. // may have lower than the requested levels).
  4372. // * All newly-reserved resources are available for serving the
  4373. // instance's
  4374. // tables.
  4375. // * The instance's new resource levels are readable via the API.
  4376. //
  4377. // The returned long-running operation will
  4378. // have a name of the format `<instance_name>/operations/<operation_id>`
  4379. // and
  4380. // can be used to track the instance modification. The
  4381. // metadata field type is
  4382. // UpdateInstanceMetadata.
  4383. // The response field type is
  4384. // Instance, if successful.
  4385. //
  4386. // Authorization requires `spanner.instances.update` permission
  4387. // on
  4388. // resource name.
  4389. func (r *ProjectsInstancesService) Patch(nameid string, updateinstancerequest *UpdateInstanceRequest) *ProjectsInstancesPatchCall {
  4390. c := &ProjectsInstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4391. c.nameid = nameid
  4392. c.updateinstancerequest = updateinstancerequest
  4393. return c
  4394. }
  4395. // Fields allows partial responses to be retrieved. See
  4396. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4397. // for more information.
  4398. func (c *ProjectsInstancesPatchCall) Fields(s ...googleapi.Field) *ProjectsInstancesPatchCall {
  4399. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4400. return c
  4401. }
  4402. // Context sets the context to be used in this call's Do method. Any
  4403. // pending HTTP request will be aborted if the provided context is
  4404. // canceled.
  4405. func (c *ProjectsInstancesPatchCall) Context(ctx context.Context) *ProjectsInstancesPatchCall {
  4406. c.ctx_ = ctx
  4407. return c
  4408. }
  4409. // Header returns an http.Header that can be modified by the caller to
  4410. // add HTTP headers to the request.
  4411. func (c *ProjectsInstancesPatchCall) Header() http.Header {
  4412. if c.header_ == nil {
  4413. c.header_ = make(http.Header)
  4414. }
  4415. return c.header_
  4416. }
  4417. func (c *ProjectsInstancesPatchCall) doRequest(alt string) (*http.Response, error) {
  4418. reqHeaders := make(http.Header)
  4419. for k, v := range c.header_ {
  4420. reqHeaders[k] = v
  4421. }
  4422. reqHeaders.Set("User-Agent", c.s.userAgent())
  4423. var body io.Reader = nil
  4424. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updateinstancerequest)
  4425. if err != nil {
  4426. return nil, err
  4427. }
  4428. reqHeaders.Set("Content-Type", "application/json")
  4429. c.urlParams_.Set("alt", alt)
  4430. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4431. urls += "?" + c.urlParams_.Encode()
  4432. req, _ := http.NewRequest("PATCH", urls, body)
  4433. req.Header = reqHeaders
  4434. googleapi.Expand(req.URL, map[string]string{
  4435. "name": c.nameid,
  4436. })
  4437. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4438. }
  4439. // Do executes the "spanner.projects.instances.patch" call.
  4440. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4441. // status code is an error. Response headers are in either
  4442. // *Operation.ServerResponse.Header or (if a response was returned at
  4443. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4444. // to check whether the returned error was because
  4445. // http.StatusNotModified was returned.
  4446. func (c *ProjectsInstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4447. gensupport.SetOptions(c.urlParams_, opts...)
  4448. res, err := c.doRequest("json")
  4449. if res != nil && res.StatusCode == http.StatusNotModified {
  4450. if res.Body != nil {
  4451. res.Body.Close()
  4452. }
  4453. return nil, &googleapi.Error{
  4454. Code: res.StatusCode,
  4455. Header: res.Header,
  4456. }
  4457. }
  4458. if err != nil {
  4459. return nil, err
  4460. }
  4461. defer googleapi.CloseBody(res)
  4462. if err := googleapi.CheckResponse(res); err != nil {
  4463. return nil, err
  4464. }
  4465. ret := &Operation{
  4466. ServerResponse: googleapi.ServerResponse{
  4467. Header: res.Header,
  4468. HTTPStatusCode: res.StatusCode,
  4469. },
  4470. }
  4471. target := &ret
  4472. if err := gensupport.DecodeResponse(target, res); err != nil {
  4473. return nil, err
  4474. }
  4475. return ret, nil
  4476. // {
  4477. // "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.",
  4478. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}",
  4479. // "httpMethod": "PATCH",
  4480. // "id": "spanner.projects.instances.patch",
  4481. // "parameterOrder": [
  4482. // "name"
  4483. // ],
  4484. // "parameters": {
  4485. // "name": {
  4486. // "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.",
  4487. // "location": "path",
  4488. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4489. // "required": true,
  4490. // "type": "string"
  4491. // }
  4492. // },
  4493. // "path": "v1/{+name}",
  4494. // "request": {
  4495. // "$ref": "UpdateInstanceRequest"
  4496. // },
  4497. // "response": {
  4498. // "$ref": "Operation"
  4499. // },
  4500. // "scopes": [
  4501. // "https://www.googleapis.com/auth/cloud-platform",
  4502. // "https://www.googleapis.com/auth/spanner.admin"
  4503. // ]
  4504. // }
  4505. }
  4506. // method id "spanner.projects.instances.setIamPolicy":
  4507. type ProjectsInstancesSetIamPolicyCall struct {
  4508. s *Service
  4509. resource string
  4510. setiampolicyrequest *SetIamPolicyRequest
  4511. urlParams_ gensupport.URLParams
  4512. ctx_ context.Context
  4513. header_ http.Header
  4514. }
  4515. // SetIamPolicy: Sets the access control policy on an instance resource.
  4516. // Replaces any
  4517. // existing policy.
  4518. //
  4519. // Authorization requires `spanner.instances.setIamPolicy` on
  4520. // resource.
  4521. func (r *ProjectsInstancesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsInstancesSetIamPolicyCall {
  4522. c := &ProjectsInstancesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4523. c.resource = resource
  4524. c.setiampolicyrequest = setiampolicyrequest
  4525. return c
  4526. }
  4527. // Fields allows partial responses to be retrieved. See
  4528. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4529. // for more information.
  4530. func (c *ProjectsInstancesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesSetIamPolicyCall {
  4531. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4532. return c
  4533. }
  4534. // Context sets the context to be used in this call's Do method. Any
  4535. // pending HTTP request will be aborted if the provided context is
  4536. // canceled.
  4537. func (c *ProjectsInstancesSetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesSetIamPolicyCall {
  4538. c.ctx_ = ctx
  4539. return c
  4540. }
  4541. // Header returns an http.Header that can be modified by the caller to
  4542. // add HTTP headers to the request.
  4543. func (c *ProjectsInstancesSetIamPolicyCall) Header() http.Header {
  4544. if c.header_ == nil {
  4545. c.header_ = make(http.Header)
  4546. }
  4547. return c.header_
  4548. }
  4549. func (c *ProjectsInstancesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4550. reqHeaders := make(http.Header)
  4551. for k, v := range c.header_ {
  4552. reqHeaders[k] = v
  4553. }
  4554. reqHeaders.Set("User-Agent", c.s.userAgent())
  4555. var body io.Reader = nil
  4556. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  4557. if err != nil {
  4558. return nil, err
  4559. }
  4560. reqHeaders.Set("Content-Type", "application/json")
  4561. c.urlParams_.Set("alt", alt)
  4562. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  4563. urls += "?" + c.urlParams_.Encode()
  4564. req, _ := http.NewRequest("POST", urls, body)
  4565. req.Header = reqHeaders
  4566. googleapi.Expand(req.URL, map[string]string{
  4567. "resource": c.resource,
  4568. })
  4569. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4570. }
  4571. // Do executes the "spanner.projects.instances.setIamPolicy" call.
  4572. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4573. // code is an error. Response headers are in either
  4574. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4575. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4576. // check whether the returned error was because http.StatusNotModified
  4577. // was returned.
  4578. func (c *ProjectsInstancesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4579. gensupport.SetOptions(c.urlParams_, opts...)
  4580. res, err := c.doRequest("json")
  4581. if res != nil && res.StatusCode == http.StatusNotModified {
  4582. if res.Body != nil {
  4583. res.Body.Close()
  4584. }
  4585. return nil, &googleapi.Error{
  4586. Code: res.StatusCode,
  4587. Header: res.Header,
  4588. }
  4589. }
  4590. if err != nil {
  4591. return nil, err
  4592. }
  4593. defer googleapi.CloseBody(res)
  4594. if err := googleapi.CheckResponse(res); err != nil {
  4595. return nil, err
  4596. }
  4597. ret := &Policy{
  4598. ServerResponse: googleapi.ServerResponse{
  4599. Header: res.Header,
  4600. HTTPStatusCode: res.StatusCode,
  4601. },
  4602. }
  4603. target := &ret
  4604. if err := gensupport.DecodeResponse(target, res); err != nil {
  4605. return nil, err
  4606. }
  4607. return ret, nil
  4608. // {
  4609. // "description": "Sets the access control policy on an instance resource. Replaces any\nexisting policy.\n\nAuthorization requires `spanner.instances.setIamPolicy` on\nresource.",
  4610. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}:setIamPolicy",
  4611. // "httpMethod": "POST",
  4612. // "id": "spanner.projects.instances.setIamPolicy",
  4613. // "parameterOrder": [
  4614. // "resource"
  4615. // ],
  4616. // "parameters": {
  4617. // "resource": {
  4618. // "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.",
  4619. // "location": "path",
  4620. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4621. // "required": true,
  4622. // "type": "string"
  4623. // }
  4624. // },
  4625. // "path": "v1/{+resource}:setIamPolicy",
  4626. // "request": {
  4627. // "$ref": "SetIamPolicyRequest"
  4628. // },
  4629. // "response": {
  4630. // "$ref": "Policy"
  4631. // },
  4632. // "scopes": [
  4633. // "https://www.googleapis.com/auth/cloud-platform",
  4634. // "https://www.googleapis.com/auth/spanner.admin"
  4635. // ]
  4636. // }
  4637. }
  4638. // method id "spanner.projects.instances.testIamPermissions":
  4639. type ProjectsInstancesTestIamPermissionsCall struct {
  4640. s *Service
  4641. resource string
  4642. testiampermissionsrequest *TestIamPermissionsRequest
  4643. urlParams_ gensupport.URLParams
  4644. ctx_ context.Context
  4645. header_ http.Header
  4646. }
  4647. // TestIamPermissions: Returns permissions that the caller has on the
  4648. // specified instance resource.
  4649. //
  4650. // Attempting this RPC on a non-existent Cloud Spanner instance resource
  4651. // will
  4652. // result in a NOT_FOUND error if the user has
  4653. // `spanner.instances.list`
  4654. // permission on the containing Google Cloud Project. Otherwise returns
  4655. // an
  4656. // empty set of permissions.
  4657. func (r *ProjectsInstancesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsInstancesTestIamPermissionsCall {
  4658. c := &ProjectsInstancesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4659. c.resource = resource
  4660. c.testiampermissionsrequest = testiampermissionsrequest
  4661. return c
  4662. }
  4663. // Fields allows partial responses to be retrieved. See
  4664. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4665. // for more information.
  4666. func (c *ProjectsInstancesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsInstancesTestIamPermissionsCall {
  4667. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4668. return c
  4669. }
  4670. // Context sets the context to be used in this call's Do method. Any
  4671. // pending HTTP request will be aborted if the provided context is
  4672. // canceled.
  4673. func (c *ProjectsInstancesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsInstancesTestIamPermissionsCall {
  4674. c.ctx_ = ctx
  4675. return c
  4676. }
  4677. // Header returns an http.Header that can be modified by the caller to
  4678. // add HTTP headers to the request.
  4679. func (c *ProjectsInstancesTestIamPermissionsCall) Header() http.Header {
  4680. if c.header_ == nil {
  4681. c.header_ = make(http.Header)
  4682. }
  4683. return c.header_
  4684. }
  4685. func (c *ProjectsInstancesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4686. reqHeaders := make(http.Header)
  4687. for k, v := range c.header_ {
  4688. reqHeaders[k] = v
  4689. }
  4690. reqHeaders.Set("User-Agent", c.s.userAgent())
  4691. var body io.Reader = nil
  4692. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  4693. if err != nil {
  4694. return nil, err
  4695. }
  4696. reqHeaders.Set("Content-Type", "application/json")
  4697. c.urlParams_.Set("alt", alt)
  4698. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  4699. urls += "?" + c.urlParams_.Encode()
  4700. req, _ := http.NewRequest("POST", urls, body)
  4701. req.Header = reqHeaders
  4702. googleapi.Expand(req.URL, map[string]string{
  4703. "resource": c.resource,
  4704. })
  4705. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4706. }
  4707. // Do executes the "spanner.projects.instances.testIamPermissions" call.
  4708. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4709. // Any non-2xx status code is an error. Response headers are in either
  4710. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4711. // was returned at all) in error.(*googleapi.Error).Header. Use
  4712. // googleapi.IsNotModified to check whether the returned error was
  4713. // because http.StatusNotModified was returned.
  4714. func (c *ProjectsInstancesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4715. gensupport.SetOptions(c.urlParams_, opts...)
  4716. res, err := c.doRequest("json")
  4717. if res != nil && res.StatusCode == http.StatusNotModified {
  4718. if res.Body != nil {
  4719. res.Body.Close()
  4720. }
  4721. return nil, &googleapi.Error{
  4722. Code: res.StatusCode,
  4723. Header: res.Header,
  4724. }
  4725. }
  4726. if err != nil {
  4727. return nil, err
  4728. }
  4729. defer googleapi.CloseBody(res)
  4730. if err := googleapi.CheckResponse(res); err != nil {
  4731. return nil, err
  4732. }
  4733. ret := &TestIamPermissionsResponse{
  4734. ServerResponse: googleapi.ServerResponse{
  4735. Header: res.Header,
  4736. HTTPStatusCode: res.StatusCode,
  4737. },
  4738. }
  4739. target := &ret
  4740. if err := gensupport.DecodeResponse(target, res); err != nil {
  4741. return nil, err
  4742. }
  4743. return ret, nil
  4744. // {
  4745. // "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.",
  4746. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}:testIamPermissions",
  4747. // "httpMethod": "POST",
  4748. // "id": "spanner.projects.instances.testIamPermissions",
  4749. // "parameterOrder": [
  4750. // "resource"
  4751. // ],
  4752. // "parameters": {
  4753. // "resource": {
  4754. // "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.",
  4755. // "location": "path",
  4756. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4757. // "required": true,
  4758. // "type": "string"
  4759. // }
  4760. // },
  4761. // "path": "v1/{+resource}:testIamPermissions",
  4762. // "request": {
  4763. // "$ref": "TestIamPermissionsRequest"
  4764. // },
  4765. // "response": {
  4766. // "$ref": "TestIamPermissionsResponse"
  4767. // },
  4768. // "scopes": [
  4769. // "https://www.googleapis.com/auth/cloud-platform",
  4770. // "https://www.googleapis.com/auth/spanner.admin"
  4771. // ]
  4772. // }
  4773. }
  4774. // method id "spanner.projects.instances.databases.create":
  4775. type ProjectsInstancesDatabasesCreateCall struct {
  4776. s *Service
  4777. parent string
  4778. createdatabaserequest *CreateDatabaseRequest
  4779. urlParams_ gensupport.URLParams
  4780. ctx_ context.Context
  4781. header_ http.Header
  4782. }
  4783. // Create: Creates a new Cloud Spanner database and starts to prepare it
  4784. // for serving.
  4785. // The returned long-running operation will
  4786. // have a name of the format `<database_name>/operations/<operation_id>`
  4787. // and
  4788. // can be used to track preparation of the database. The
  4789. // metadata field type is
  4790. // CreateDatabaseMetadata. The
  4791. // response field type is
  4792. // Database, if successful.
  4793. func (r *ProjectsInstancesDatabasesService) Create(parent string, createdatabaserequest *CreateDatabaseRequest) *ProjectsInstancesDatabasesCreateCall {
  4794. c := &ProjectsInstancesDatabasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4795. c.parent = parent
  4796. c.createdatabaserequest = createdatabaserequest
  4797. return c
  4798. }
  4799. // Fields allows partial responses to be retrieved. See
  4800. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4801. // for more information.
  4802. func (c *ProjectsInstancesDatabasesCreateCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesCreateCall {
  4803. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4804. return c
  4805. }
  4806. // Context sets the context to be used in this call's Do method. Any
  4807. // pending HTTP request will be aborted if the provided context is
  4808. // canceled.
  4809. func (c *ProjectsInstancesDatabasesCreateCall) Context(ctx context.Context) *ProjectsInstancesDatabasesCreateCall {
  4810. c.ctx_ = ctx
  4811. return c
  4812. }
  4813. // Header returns an http.Header that can be modified by the caller to
  4814. // add HTTP headers to the request.
  4815. func (c *ProjectsInstancesDatabasesCreateCall) Header() http.Header {
  4816. if c.header_ == nil {
  4817. c.header_ = make(http.Header)
  4818. }
  4819. return c.header_
  4820. }
  4821. func (c *ProjectsInstancesDatabasesCreateCall) doRequest(alt string) (*http.Response, error) {
  4822. reqHeaders := make(http.Header)
  4823. for k, v := range c.header_ {
  4824. reqHeaders[k] = v
  4825. }
  4826. reqHeaders.Set("User-Agent", c.s.userAgent())
  4827. var body io.Reader = nil
  4828. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createdatabaserequest)
  4829. if err != nil {
  4830. return nil, err
  4831. }
  4832. reqHeaders.Set("Content-Type", "application/json")
  4833. c.urlParams_.Set("alt", alt)
  4834. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/databases")
  4835. urls += "?" + c.urlParams_.Encode()
  4836. req, _ := http.NewRequest("POST", urls, body)
  4837. req.Header = reqHeaders
  4838. googleapi.Expand(req.URL, map[string]string{
  4839. "parent": c.parent,
  4840. })
  4841. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4842. }
  4843. // Do executes the "spanner.projects.instances.databases.create" call.
  4844. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4845. // status code is an error. Response headers are in either
  4846. // *Operation.ServerResponse.Header or (if a response was returned at
  4847. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4848. // to check whether the returned error was because
  4849. // http.StatusNotModified was returned.
  4850. func (c *ProjectsInstancesDatabasesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4851. gensupport.SetOptions(c.urlParams_, opts...)
  4852. res, err := c.doRequest("json")
  4853. if res != nil && res.StatusCode == http.StatusNotModified {
  4854. if res.Body != nil {
  4855. res.Body.Close()
  4856. }
  4857. return nil, &googleapi.Error{
  4858. Code: res.StatusCode,
  4859. Header: res.Header,
  4860. }
  4861. }
  4862. if err != nil {
  4863. return nil, err
  4864. }
  4865. defer googleapi.CloseBody(res)
  4866. if err := googleapi.CheckResponse(res); err != nil {
  4867. return nil, err
  4868. }
  4869. ret := &Operation{
  4870. ServerResponse: googleapi.ServerResponse{
  4871. Header: res.Header,
  4872. HTTPStatusCode: res.StatusCode,
  4873. },
  4874. }
  4875. target := &ret
  4876. if err := gensupport.DecodeResponse(target, res); err != nil {
  4877. return nil, err
  4878. }
  4879. return ret, nil
  4880. // {
  4881. // "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.",
  4882. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases",
  4883. // "httpMethod": "POST",
  4884. // "id": "spanner.projects.instances.databases.create",
  4885. // "parameterOrder": [
  4886. // "parent"
  4887. // ],
  4888. // "parameters": {
  4889. // "parent": {
  4890. // "description": "Required. The name of the instance that will serve the new database.\nValues are of the form `projects/\u003cproject\u003e/instances/\u003cinstance\u003e`.",
  4891. // "location": "path",
  4892. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  4893. // "required": true,
  4894. // "type": "string"
  4895. // }
  4896. // },
  4897. // "path": "v1/{+parent}/databases",
  4898. // "request": {
  4899. // "$ref": "CreateDatabaseRequest"
  4900. // },
  4901. // "response": {
  4902. // "$ref": "Operation"
  4903. // },
  4904. // "scopes": [
  4905. // "https://www.googleapis.com/auth/cloud-platform",
  4906. // "https://www.googleapis.com/auth/spanner.admin"
  4907. // ]
  4908. // }
  4909. }
  4910. // method id "spanner.projects.instances.databases.dropDatabase":
  4911. type ProjectsInstancesDatabasesDropDatabaseCall struct {
  4912. s *Service
  4913. database string
  4914. urlParams_ gensupport.URLParams
  4915. ctx_ context.Context
  4916. header_ http.Header
  4917. }
  4918. // DropDatabase: Drops (aka deletes) a Cloud Spanner database.
  4919. func (r *ProjectsInstancesDatabasesService) DropDatabase(database string) *ProjectsInstancesDatabasesDropDatabaseCall {
  4920. c := &ProjectsInstancesDatabasesDropDatabaseCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4921. c.database = database
  4922. return c
  4923. }
  4924. // Fields allows partial responses to be retrieved. See
  4925. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4926. // for more information.
  4927. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesDropDatabaseCall {
  4928. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4929. return c
  4930. }
  4931. // Context sets the context to be used in this call's Do method. Any
  4932. // pending HTTP request will be aborted if the provided context is
  4933. // canceled.
  4934. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Context(ctx context.Context) *ProjectsInstancesDatabasesDropDatabaseCall {
  4935. c.ctx_ = ctx
  4936. return c
  4937. }
  4938. // Header returns an http.Header that can be modified by the caller to
  4939. // add HTTP headers to the request.
  4940. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Header() http.Header {
  4941. if c.header_ == nil {
  4942. c.header_ = make(http.Header)
  4943. }
  4944. return c.header_
  4945. }
  4946. func (c *ProjectsInstancesDatabasesDropDatabaseCall) doRequest(alt string) (*http.Response, error) {
  4947. reqHeaders := make(http.Header)
  4948. for k, v := range c.header_ {
  4949. reqHeaders[k] = v
  4950. }
  4951. reqHeaders.Set("User-Agent", c.s.userAgent())
  4952. var body io.Reader = nil
  4953. c.urlParams_.Set("alt", alt)
  4954. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}")
  4955. urls += "?" + c.urlParams_.Encode()
  4956. req, _ := http.NewRequest("DELETE", urls, body)
  4957. req.Header = reqHeaders
  4958. googleapi.Expand(req.URL, map[string]string{
  4959. "database": c.database,
  4960. })
  4961. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4962. }
  4963. // Do executes the "spanner.projects.instances.databases.dropDatabase" call.
  4964. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4965. // code is an error. Response headers are in either
  4966. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4967. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4968. // check whether the returned error was because http.StatusNotModified
  4969. // was returned.
  4970. func (c *ProjectsInstancesDatabasesDropDatabaseCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4971. gensupport.SetOptions(c.urlParams_, opts...)
  4972. res, err := c.doRequest("json")
  4973. if res != nil && res.StatusCode == http.StatusNotModified {
  4974. if res.Body != nil {
  4975. res.Body.Close()
  4976. }
  4977. return nil, &googleapi.Error{
  4978. Code: res.StatusCode,
  4979. Header: res.Header,
  4980. }
  4981. }
  4982. if err != nil {
  4983. return nil, err
  4984. }
  4985. defer googleapi.CloseBody(res)
  4986. if err := googleapi.CheckResponse(res); err != nil {
  4987. return nil, err
  4988. }
  4989. ret := &Empty{
  4990. ServerResponse: googleapi.ServerResponse{
  4991. Header: res.Header,
  4992. HTTPStatusCode: res.StatusCode,
  4993. },
  4994. }
  4995. target := &ret
  4996. if err := gensupport.DecodeResponse(target, res); err != nil {
  4997. return nil, err
  4998. }
  4999. return ret, nil
  5000. // {
  5001. // "description": "Drops (aka deletes) a Cloud Spanner database.",
  5002. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}",
  5003. // "httpMethod": "DELETE",
  5004. // "id": "spanner.projects.instances.databases.dropDatabase",
  5005. // "parameterOrder": [
  5006. // "database"
  5007. // ],
  5008. // "parameters": {
  5009. // "database": {
  5010. // "description": "Required. The database to be dropped.",
  5011. // "location": "path",
  5012. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5013. // "required": true,
  5014. // "type": "string"
  5015. // }
  5016. // },
  5017. // "path": "v1/{+database}",
  5018. // "response": {
  5019. // "$ref": "Empty"
  5020. // },
  5021. // "scopes": [
  5022. // "https://www.googleapis.com/auth/cloud-platform",
  5023. // "https://www.googleapis.com/auth/spanner.admin"
  5024. // ]
  5025. // }
  5026. }
  5027. // method id "spanner.projects.instances.databases.get":
  5028. type ProjectsInstancesDatabasesGetCall struct {
  5029. s *Service
  5030. name string
  5031. urlParams_ gensupport.URLParams
  5032. ifNoneMatch_ string
  5033. ctx_ context.Context
  5034. header_ http.Header
  5035. }
  5036. // Get: Gets the state of a Cloud Spanner database.
  5037. func (r *ProjectsInstancesDatabasesService) Get(name string) *ProjectsInstancesDatabasesGetCall {
  5038. c := &ProjectsInstancesDatabasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5039. c.name = name
  5040. return c
  5041. }
  5042. // Fields allows partial responses to be retrieved. See
  5043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5044. // for more information.
  5045. func (c *ProjectsInstancesDatabasesGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesGetCall {
  5046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5047. return c
  5048. }
  5049. // IfNoneMatch sets the optional parameter which makes the operation
  5050. // fail if the object's ETag matches the given value. This is useful for
  5051. // getting updates only after the object has changed since the last
  5052. // request. Use googleapi.IsNotModified to check whether the response
  5053. // error from Do is the result of In-None-Match.
  5054. func (c *ProjectsInstancesDatabasesGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesGetCall {
  5055. c.ifNoneMatch_ = entityTag
  5056. return c
  5057. }
  5058. // Context sets the context to be used in this call's Do method. Any
  5059. // pending HTTP request will be aborted if the provided context is
  5060. // canceled.
  5061. func (c *ProjectsInstancesDatabasesGetCall) Context(ctx context.Context) *ProjectsInstancesDatabasesGetCall {
  5062. c.ctx_ = ctx
  5063. return c
  5064. }
  5065. // Header returns an http.Header that can be modified by the caller to
  5066. // add HTTP headers to the request.
  5067. func (c *ProjectsInstancesDatabasesGetCall) Header() http.Header {
  5068. if c.header_ == nil {
  5069. c.header_ = make(http.Header)
  5070. }
  5071. return c.header_
  5072. }
  5073. func (c *ProjectsInstancesDatabasesGetCall) doRequest(alt string) (*http.Response, error) {
  5074. reqHeaders := make(http.Header)
  5075. for k, v := range c.header_ {
  5076. reqHeaders[k] = v
  5077. }
  5078. reqHeaders.Set("User-Agent", c.s.userAgent())
  5079. if c.ifNoneMatch_ != "" {
  5080. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5081. }
  5082. var body io.Reader = nil
  5083. c.urlParams_.Set("alt", alt)
  5084. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5085. urls += "?" + c.urlParams_.Encode()
  5086. req, _ := http.NewRequest("GET", urls, body)
  5087. req.Header = reqHeaders
  5088. googleapi.Expand(req.URL, map[string]string{
  5089. "name": c.name,
  5090. })
  5091. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5092. }
  5093. // Do executes the "spanner.projects.instances.databases.get" call.
  5094. // Exactly one of *Database or error will be non-nil. Any non-2xx status
  5095. // code is an error. Response headers are in either
  5096. // *Database.ServerResponse.Header or (if a response was returned at
  5097. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5098. // to check whether the returned error was because
  5099. // http.StatusNotModified was returned.
  5100. func (c *ProjectsInstancesDatabasesGetCall) Do(opts ...googleapi.CallOption) (*Database, error) {
  5101. gensupport.SetOptions(c.urlParams_, opts...)
  5102. res, err := c.doRequest("json")
  5103. if res != nil && res.StatusCode == http.StatusNotModified {
  5104. if res.Body != nil {
  5105. res.Body.Close()
  5106. }
  5107. return nil, &googleapi.Error{
  5108. Code: res.StatusCode,
  5109. Header: res.Header,
  5110. }
  5111. }
  5112. if err != nil {
  5113. return nil, err
  5114. }
  5115. defer googleapi.CloseBody(res)
  5116. if err := googleapi.CheckResponse(res); err != nil {
  5117. return nil, err
  5118. }
  5119. ret := &Database{
  5120. ServerResponse: googleapi.ServerResponse{
  5121. Header: res.Header,
  5122. HTTPStatusCode: res.StatusCode,
  5123. },
  5124. }
  5125. target := &ret
  5126. if err := gensupport.DecodeResponse(target, res); err != nil {
  5127. return nil, err
  5128. }
  5129. return ret, nil
  5130. // {
  5131. // "description": "Gets the state of a Cloud Spanner database.",
  5132. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}",
  5133. // "httpMethod": "GET",
  5134. // "id": "spanner.projects.instances.databases.get",
  5135. // "parameterOrder": [
  5136. // "name"
  5137. // ],
  5138. // "parameters": {
  5139. // "name": {
  5140. // "description": "Required. The name of the requested database. Values are of the form\n`projects/\u003cproject\u003e/instances/\u003cinstance\u003e/databases/\u003cdatabase\u003e`.",
  5141. // "location": "path",
  5142. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5143. // "required": true,
  5144. // "type": "string"
  5145. // }
  5146. // },
  5147. // "path": "v1/{+name}",
  5148. // "response": {
  5149. // "$ref": "Database"
  5150. // },
  5151. // "scopes": [
  5152. // "https://www.googleapis.com/auth/cloud-platform",
  5153. // "https://www.googleapis.com/auth/spanner.admin"
  5154. // ]
  5155. // }
  5156. }
  5157. // method id "spanner.projects.instances.databases.getDdl":
  5158. type ProjectsInstancesDatabasesGetDdlCall struct {
  5159. s *Service
  5160. database string
  5161. urlParams_ gensupport.URLParams
  5162. ifNoneMatch_ string
  5163. ctx_ context.Context
  5164. header_ http.Header
  5165. }
  5166. // GetDdl: Returns the schema of a Cloud Spanner database as a list of
  5167. // formatted
  5168. // DDL statements. This method does not show pending schema updates,
  5169. // those may
  5170. // be queried using the Operations API.
  5171. func (r *ProjectsInstancesDatabasesService) GetDdl(database string) *ProjectsInstancesDatabasesGetDdlCall {
  5172. c := &ProjectsInstancesDatabasesGetDdlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5173. c.database = database
  5174. return c
  5175. }
  5176. // Fields allows partial responses to be retrieved. See
  5177. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5178. // for more information.
  5179. func (c *ProjectsInstancesDatabasesGetDdlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesGetDdlCall {
  5180. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5181. return c
  5182. }
  5183. // IfNoneMatch sets the optional parameter which makes the operation
  5184. // fail if the object's ETag matches the given value. This is useful for
  5185. // getting updates only after the object has changed since the last
  5186. // request. Use googleapi.IsNotModified to check whether the response
  5187. // error from Do is the result of In-None-Match.
  5188. func (c *ProjectsInstancesDatabasesGetDdlCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesGetDdlCall {
  5189. c.ifNoneMatch_ = entityTag
  5190. return c
  5191. }
  5192. // Context sets the context to be used in this call's Do method. Any
  5193. // pending HTTP request will be aborted if the provided context is
  5194. // canceled.
  5195. func (c *ProjectsInstancesDatabasesGetDdlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesGetDdlCall {
  5196. c.ctx_ = ctx
  5197. return c
  5198. }
  5199. // Header returns an http.Header that can be modified by the caller to
  5200. // add HTTP headers to the request.
  5201. func (c *ProjectsInstancesDatabasesGetDdlCall) Header() http.Header {
  5202. if c.header_ == nil {
  5203. c.header_ = make(http.Header)
  5204. }
  5205. return c.header_
  5206. }
  5207. func (c *ProjectsInstancesDatabasesGetDdlCall) doRequest(alt string) (*http.Response, error) {
  5208. reqHeaders := make(http.Header)
  5209. for k, v := range c.header_ {
  5210. reqHeaders[k] = v
  5211. }
  5212. reqHeaders.Set("User-Agent", c.s.userAgent())
  5213. if c.ifNoneMatch_ != "" {
  5214. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5215. }
  5216. var body io.Reader = nil
  5217. c.urlParams_.Set("alt", alt)
  5218. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/ddl")
  5219. urls += "?" + c.urlParams_.Encode()
  5220. req, _ := http.NewRequest("GET", urls, body)
  5221. req.Header = reqHeaders
  5222. googleapi.Expand(req.URL, map[string]string{
  5223. "database": c.database,
  5224. })
  5225. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5226. }
  5227. // Do executes the "spanner.projects.instances.databases.getDdl" call.
  5228. // Exactly one of *GetDatabaseDdlResponse or error will be non-nil. Any
  5229. // non-2xx status code is an error. Response headers are in either
  5230. // *GetDatabaseDdlResponse.ServerResponse.Header or (if a response was
  5231. // returned at all) in error.(*googleapi.Error).Header. Use
  5232. // googleapi.IsNotModified to check whether the returned error was
  5233. // because http.StatusNotModified was returned.
  5234. func (c *ProjectsInstancesDatabasesGetDdlCall) Do(opts ...googleapi.CallOption) (*GetDatabaseDdlResponse, error) {
  5235. gensupport.SetOptions(c.urlParams_, opts...)
  5236. res, err := c.doRequest("json")
  5237. if res != nil && res.StatusCode == http.StatusNotModified {
  5238. if res.Body != nil {
  5239. res.Body.Close()
  5240. }
  5241. return nil, &googleapi.Error{
  5242. Code: res.StatusCode,
  5243. Header: res.Header,
  5244. }
  5245. }
  5246. if err != nil {
  5247. return nil, err
  5248. }
  5249. defer googleapi.CloseBody(res)
  5250. if err := googleapi.CheckResponse(res); err != nil {
  5251. return nil, err
  5252. }
  5253. ret := &GetDatabaseDdlResponse{
  5254. ServerResponse: googleapi.ServerResponse{
  5255. Header: res.Header,
  5256. HTTPStatusCode: res.StatusCode,
  5257. },
  5258. }
  5259. target := &ret
  5260. if err := gensupport.DecodeResponse(target, res); err != nil {
  5261. return nil, err
  5262. }
  5263. return ret, nil
  5264. // {
  5265. // "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.",
  5266. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/ddl",
  5267. // "httpMethod": "GET",
  5268. // "id": "spanner.projects.instances.databases.getDdl",
  5269. // "parameterOrder": [
  5270. // "database"
  5271. // ],
  5272. // "parameters": {
  5273. // "database": {
  5274. // "description": "Required. The database whose schema we wish to get.",
  5275. // "location": "path",
  5276. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5277. // "required": true,
  5278. // "type": "string"
  5279. // }
  5280. // },
  5281. // "path": "v1/{+database}/ddl",
  5282. // "response": {
  5283. // "$ref": "GetDatabaseDdlResponse"
  5284. // },
  5285. // "scopes": [
  5286. // "https://www.googleapis.com/auth/cloud-platform",
  5287. // "https://www.googleapis.com/auth/spanner.admin"
  5288. // ]
  5289. // }
  5290. }
  5291. // method id "spanner.projects.instances.databases.getIamPolicy":
  5292. type ProjectsInstancesDatabasesGetIamPolicyCall struct {
  5293. s *Service
  5294. resource string
  5295. getiampolicyrequest *GetIamPolicyRequest
  5296. urlParams_ gensupport.URLParams
  5297. ctx_ context.Context
  5298. header_ http.Header
  5299. }
  5300. // GetIamPolicy: Gets the access control policy for a database resource.
  5301. // Returns an empty
  5302. // policy if a database exists but does not have a policy
  5303. // set.
  5304. //
  5305. // Authorization requires `spanner.databases.getIamPolicy` permission
  5306. // on
  5307. // resource.
  5308. func (r *ProjectsInstancesDatabasesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsInstancesDatabasesGetIamPolicyCall {
  5309. c := &ProjectsInstancesDatabasesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5310. c.resource = resource
  5311. c.getiampolicyrequest = getiampolicyrequest
  5312. return c
  5313. }
  5314. // Fields allows partial responses to be retrieved. See
  5315. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5316. // for more information.
  5317. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesGetIamPolicyCall {
  5318. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5319. return c
  5320. }
  5321. // Context sets the context to be used in this call's Do method. Any
  5322. // pending HTTP request will be aborted if the provided context is
  5323. // canceled.
  5324. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesDatabasesGetIamPolicyCall {
  5325. c.ctx_ = ctx
  5326. return c
  5327. }
  5328. // Header returns an http.Header that can be modified by the caller to
  5329. // add HTTP headers to the request.
  5330. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Header() http.Header {
  5331. if c.header_ == nil {
  5332. c.header_ = make(http.Header)
  5333. }
  5334. return c.header_
  5335. }
  5336. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5337. reqHeaders := make(http.Header)
  5338. for k, v := range c.header_ {
  5339. reqHeaders[k] = v
  5340. }
  5341. reqHeaders.Set("User-Agent", c.s.userAgent())
  5342. var body io.Reader = nil
  5343. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  5344. if err != nil {
  5345. return nil, err
  5346. }
  5347. reqHeaders.Set("Content-Type", "application/json")
  5348. c.urlParams_.Set("alt", alt)
  5349. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  5350. urls += "?" + c.urlParams_.Encode()
  5351. req, _ := http.NewRequest("POST", urls, body)
  5352. req.Header = reqHeaders
  5353. googleapi.Expand(req.URL, map[string]string{
  5354. "resource": c.resource,
  5355. })
  5356. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5357. }
  5358. // Do executes the "spanner.projects.instances.databases.getIamPolicy" call.
  5359. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5360. // code is an error. Response headers are in either
  5361. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5362. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5363. // check whether the returned error was because http.StatusNotModified
  5364. // was returned.
  5365. func (c *ProjectsInstancesDatabasesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5366. gensupport.SetOptions(c.urlParams_, opts...)
  5367. res, err := c.doRequest("json")
  5368. if res != nil && res.StatusCode == http.StatusNotModified {
  5369. if res.Body != nil {
  5370. res.Body.Close()
  5371. }
  5372. return nil, &googleapi.Error{
  5373. Code: res.StatusCode,
  5374. Header: res.Header,
  5375. }
  5376. }
  5377. if err != nil {
  5378. return nil, err
  5379. }
  5380. defer googleapi.CloseBody(res)
  5381. if err := googleapi.CheckResponse(res); err != nil {
  5382. return nil, err
  5383. }
  5384. ret := &Policy{
  5385. ServerResponse: googleapi.ServerResponse{
  5386. Header: res.Header,
  5387. HTTPStatusCode: res.StatusCode,
  5388. },
  5389. }
  5390. target := &ret
  5391. if err := gensupport.DecodeResponse(target, res); err != nil {
  5392. return nil, err
  5393. }
  5394. return ret, nil
  5395. // {
  5396. // "description": "Gets the access control policy for a database resource. Returns an empty\npolicy if a database exists but does not have a policy set.\n\nAuthorization requires `spanner.databases.getIamPolicy` permission on\nresource.",
  5397. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}:getIamPolicy",
  5398. // "httpMethod": "POST",
  5399. // "id": "spanner.projects.instances.databases.getIamPolicy",
  5400. // "parameterOrder": [
  5401. // "resource"
  5402. // ],
  5403. // "parameters": {
  5404. // "resource": {
  5405. // "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.",
  5406. // "location": "path",
  5407. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5408. // "required": true,
  5409. // "type": "string"
  5410. // }
  5411. // },
  5412. // "path": "v1/{+resource}:getIamPolicy",
  5413. // "request": {
  5414. // "$ref": "GetIamPolicyRequest"
  5415. // },
  5416. // "response": {
  5417. // "$ref": "Policy"
  5418. // },
  5419. // "scopes": [
  5420. // "https://www.googleapis.com/auth/cloud-platform",
  5421. // "https://www.googleapis.com/auth/spanner.admin"
  5422. // ]
  5423. // }
  5424. }
  5425. // method id "spanner.projects.instances.databases.list":
  5426. type ProjectsInstancesDatabasesListCall struct {
  5427. s *Service
  5428. parent string
  5429. urlParams_ gensupport.URLParams
  5430. ifNoneMatch_ string
  5431. ctx_ context.Context
  5432. header_ http.Header
  5433. }
  5434. // List: Lists Cloud Spanner databases.
  5435. func (r *ProjectsInstancesDatabasesService) List(parent string) *ProjectsInstancesDatabasesListCall {
  5436. c := &ProjectsInstancesDatabasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5437. c.parent = parent
  5438. return c
  5439. }
  5440. // PageSize sets the optional parameter "pageSize": Number of databases
  5441. // to be returned in the response. If 0 or less,
  5442. // defaults to the server's maximum allowed page size.
  5443. func (c *ProjectsInstancesDatabasesListCall) PageSize(pageSize int64) *ProjectsInstancesDatabasesListCall {
  5444. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5445. return c
  5446. }
  5447. // PageToken sets the optional parameter "pageToken": If non-empty,
  5448. // `page_token` should contain a
  5449. // next_page_token from a
  5450. // previous ListDatabasesResponse.
  5451. func (c *ProjectsInstancesDatabasesListCall) PageToken(pageToken string) *ProjectsInstancesDatabasesListCall {
  5452. c.urlParams_.Set("pageToken", pageToken)
  5453. return c
  5454. }
  5455. // Fields allows partial responses to be retrieved. See
  5456. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5457. // for more information.
  5458. func (c *ProjectsInstancesDatabasesListCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesListCall {
  5459. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5460. return c
  5461. }
  5462. // IfNoneMatch sets the optional parameter which makes the operation
  5463. // fail if the object's ETag matches the given value. This is useful for
  5464. // getting updates only after the object has changed since the last
  5465. // request. Use googleapi.IsNotModified to check whether the response
  5466. // error from Do is the result of In-None-Match.
  5467. func (c *ProjectsInstancesDatabasesListCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesListCall {
  5468. c.ifNoneMatch_ = entityTag
  5469. return c
  5470. }
  5471. // Context sets the context to be used in this call's Do method. Any
  5472. // pending HTTP request will be aborted if the provided context is
  5473. // canceled.
  5474. func (c *ProjectsInstancesDatabasesListCall) Context(ctx context.Context) *ProjectsInstancesDatabasesListCall {
  5475. c.ctx_ = ctx
  5476. return c
  5477. }
  5478. // Header returns an http.Header that can be modified by the caller to
  5479. // add HTTP headers to the request.
  5480. func (c *ProjectsInstancesDatabasesListCall) Header() http.Header {
  5481. if c.header_ == nil {
  5482. c.header_ = make(http.Header)
  5483. }
  5484. return c.header_
  5485. }
  5486. func (c *ProjectsInstancesDatabasesListCall) doRequest(alt string) (*http.Response, error) {
  5487. reqHeaders := make(http.Header)
  5488. for k, v := range c.header_ {
  5489. reqHeaders[k] = v
  5490. }
  5491. reqHeaders.Set("User-Agent", c.s.userAgent())
  5492. if c.ifNoneMatch_ != "" {
  5493. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5494. }
  5495. var body io.Reader = nil
  5496. c.urlParams_.Set("alt", alt)
  5497. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/databases")
  5498. urls += "?" + c.urlParams_.Encode()
  5499. req, _ := http.NewRequest("GET", urls, body)
  5500. req.Header = reqHeaders
  5501. googleapi.Expand(req.URL, map[string]string{
  5502. "parent": c.parent,
  5503. })
  5504. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5505. }
  5506. // Do executes the "spanner.projects.instances.databases.list" call.
  5507. // Exactly one of *ListDatabasesResponse or error will be non-nil. Any
  5508. // non-2xx status code is an error. Response headers are in either
  5509. // *ListDatabasesResponse.ServerResponse.Header or (if a response was
  5510. // returned at all) in error.(*googleapi.Error).Header. Use
  5511. // googleapi.IsNotModified to check whether the returned error was
  5512. // because http.StatusNotModified was returned.
  5513. func (c *ProjectsInstancesDatabasesListCall) Do(opts ...googleapi.CallOption) (*ListDatabasesResponse, error) {
  5514. gensupport.SetOptions(c.urlParams_, opts...)
  5515. res, err := c.doRequest("json")
  5516. if res != nil && res.StatusCode == http.StatusNotModified {
  5517. if res.Body != nil {
  5518. res.Body.Close()
  5519. }
  5520. return nil, &googleapi.Error{
  5521. Code: res.StatusCode,
  5522. Header: res.Header,
  5523. }
  5524. }
  5525. if err != nil {
  5526. return nil, err
  5527. }
  5528. defer googleapi.CloseBody(res)
  5529. if err := googleapi.CheckResponse(res); err != nil {
  5530. return nil, err
  5531. }
  5532. ret := &ListDatabasesResponse{
  5533. ServerResponse: googleapi.ServerResponse{
  5534. Header: res.Header,
  5535. HTTPStatusCode: res.StatusCode,
  5536. },
  5537. }
  5538. target := &ret
  5539. if err := gensupport.DecodeResponse(target, res); err != nil {
  5540. return nil, err
  5541. }
  5542. return ret, nil
  5543. // {
  5544. // "description": "Lists Cloud Spanner databases.",
  5545. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases",
  5546. // "httpMethod": "GET",
  5547. // "id": "spanner.projects.instances.databases.list",
  5548. // "parameterOrder": [
  5549. // "parent"
  5550. // ],
  5551. // "parameters": {
  5552. // "pageSize": {
  5553. // "description": "Number of databases to be returned in the response. If 0 or less,\ndefaults to the server's maximum allowed page size.",
  5554. // "format": "int32",
  5555. // "location": "query",
  5556. // "type": "integer"
  5557. // },
  5558. // "pageToken": {
  5559. // "description": "If non-empty, `page_token` should contain a\nnext_page_token from a\nprevious ListDatabasesResponse.",
  5560. // "location": "query",
  5561. // "type": "string"
  5562. // },
  5563. // "parent": {
  5564. // "description": "Required. The instance whose databases should be listed.\nValues are of the form `projects/\u003cproject\u003e/instances/\u003cinstance\u003e`.",
  5565. // "location": "path",
  5566. // "pattern": "^projects/[^/]+/instances/[^/]+$",
  5567. // "required": true,
  5568. // "type": "string"
  5569. // }
  5570. // },
  5571. // "path": "v1/{+parent}/databases",
  5572. // "response": {
  5573. // "$ref": "ListDatabasesResponse"
  5574. // },
  5575. // "scopes": [
  5576. // "https://www.googleapis.com/auth/cloud-platform",
  5577. // "https://www.googleapis.com/auth/spanner.admin"
  5578. // ]
  5579. // }
  5580. }
  5581. // Pages invokes f for each page of results.
  5582. // A non-nil error returned from f will halt the iteration.
  5583. // The provided context supersedes any context provided to the Context method.
  5584. func (c *ProjectsInstancesDatabasesListCall) Pages(ctx context.Context, f func(*ListDatabasesResponse) error) error {
  5585. c.ctx_ = ctx
  5586. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5587. for {
  5588. x, err := c.Do()
  5589. if err != nil {
  5590. return err
  5591. }
  5592. if err := f(x); err != nil {
  5593. return err
  5594. }
  5595. if x.NextPageToken == "" {
  5596. return nil
  5597. }
  5598. c.PageToken(x.NextPageToken)
  5599. }
  5600. }
  5601. // method id "spanner.projects.instances.databases.setIamPolicy":
  5602. type ProjectsInstancesDatabasesSetIamPolicyCall struct {
  5603. s *Service
  5604. resource string
  5605. setiampolicyrequest *SetIamPolicyRequest
  5606. urlParams_ gensupport.URLParams
  5607. ctx_ context.Context
  5608. header_ http.Header
  5609. }
  5610. // SetIamPolicy: Sets the access control policy on a database resource.
  5611. // Replaces any
  5612. // existing policy.
  5613. //
  5614. // Authorization requires `spanner.databases.setIamPolicy` permission
  5615. // on
  5616. // resource.
  5617. func (r *ProjectsInstancesDatabasesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsInstancesDatabasesSetIamPolicyCall {
  5618. c := &ProjectsInstancesDatabasesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5619. c.resource = resource
  5620. c.setiampolicyrequest = setiampolicyrequest
  5621. return c
  5622. }
  5623. // Fields allows partial responses to be retrieved. See
  5624. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5625. // for more information.
  5626. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSetIamPolicyCall {
  5627. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5628. return c
  5629. }
  5630. // Context sets the context to be used in this call's Do method. Any
  5631. // pending HTTP request will be aborted if the provided context is
  5632. // canceled.
  5633. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSetIamPolicyCall {
  5634. c.ctx_ = ctx
  5635. return c
  5636. }
  5637. // Header returns an http.Header that can be modified by the caller to
  5638. // add HTTP headers to the request.
  5639. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Header() http.Header {
  5640. if c.header_ == nil {
  5641. c.header_ = make(http.Header)
  5642. }
  5643. return c.header_
  5644. }
  5645. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5646. reqHeaders := make(http.Header)
  5647. for k, v := range c.header_ {
  5648. reqHeaders[k] = v
  5649. }
  5650. reqHeaders.Set("User-Agent", c.s.userAgent())
  5651. var body io.Reader = nil
  5652. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  5653. if err != nil {
  5654. return nil, err
  5655. }
  5656. reqHeaders.Set("Content-Type", "application/json")
  5657. c.urlParams_.Set("alt", alt)
  5658. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  5659. urls += "?" + c.urlParams_.Encode()
  5660. req, _ := http.NewRequest("POST", urls, body)
  5661. req.Header = reqHeaders
  5662. googleapi.Expand(req.URL, map[string]string{
  5663. "resource": c.resource,
  5664. })
  5665. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5666. }
  5667. // Do executes the "spanner.projects.instances.databases.setIamPolicy" call.
  5668. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5669. // code is an error. Response headers are in either
  5670. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5671. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5672. // check whether the returned error was because http.StatusNotModified
  5673. // was returned.
  5674. func (c *ProjectsInstancesDatabasesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5675. gensupport.SetOptions(c.urlParams_, opts...)
  5676. res, err := c.doRequest("json")
  5677. if res != nil && res.StatusCode == http.StatusNotModified {
  5678. if res.Body != nil {
  5679. res.Body.Close()
  5680. }
  5681. return nil, &googleapi.Error{
  5682. Code: res.StatusCode,
  5683. Header: res.Header,
  5684. }
  5685. }
  5686. if err != nil {
  5687. return nil, err
  5688. }
  5689. defer googleapi.CloseBody(res)
  5690. if err := googleapi.CheckResponse(res); err != nil {
  5691. return nil, err
  5692. }
  5693. ret := &Policy{
  5694. ServerResponse: googleapi.ServerResponse{
  5695. Header: res.Header,
  5696. HTTPStatusCode: res.StatusCode,
  5697. },
  5698. }
  5699. target := &ret
  5700. if err := gensupport.DecodeResponse(target, res); err != nil {
  5701. return nil, err
  5702. }
  5703. return ret, nil
  5704. // {
  5705. // "description": "Sets the access control policy on a database resource. Replaces any\nexisting policy.\n\nAuthorization requires `spanner.databases.setIamPolicy` permission on\nresource.",
  5706. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}:setIamPolicy",
  5707. // "httpMethod": "POST",
  5708. // "id": "spanner.projects.instances.databases.setIamPolicy",
  5709. // "parameterOrder": [
  5710. // "resource"
  5711. // ],
  5712. // "parameters": {
  5713. // "resource": {
  5714. // "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.",
  5715. // "location": "path",
  5716. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5717. // "required": true,
  5718. // "type": "string"
  5719. // }
  5720. // },
  5721. // "path": "v1/{+resource}:setIamPolicy",
  5722. // "request": {
  5723. // "$ref": "SetIamPolicyRequest"
  5724. // },
  5725. // "response": {
  5726. // "$ref": "Policy"
  5727. // },
  5728. // "scopes": [
  5729. // "https://www.googleapis.com/auth/cloud-platform",
  5730. // "https://www.googleapis.com/auth/spanner.admin"
  5731. // ]
  5732. // }
  5733. }
  5734. // method id "spanner.projects.instances.databases.testIamPermissions":
  5735. type ProjectsInstancesDatabasesTestIamPermissionsCall struct {
  5736. s *Service
  5737. resource string
  5738. testiampermissionsrequest *TestIamPermissionsRequest
  5739. urlParams_ gensupport.URLParams
  5740. ctx_ context.Context
  5741. header_ http.Header
  5742. }
  5743. // TestIamPermissions: Returns permissions that the caller has on the
  5744. // specified database resource.
  5745. //
  5746. // Attempting this RPC on a non-existent Cloud Spanner database will
  5747. // result in
  5748. // a NOT_FOUND error if the user has `spanner.databases.list` permission
  5749. // on
  5750. // the containing Cloud Spanner instance. Otherwise returns an empty set
  5751. // of
  5752. // permissions.
  5753. func (r *ProjectsInstancesDatabasesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsInstancesDatabasesTestIamPermissionsCall {
  5754. c := &ProjectsInstancesDatabasesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5755. c.resource = resource
  5756. c.testiampermissionsrequest = testiampermissionsrequest
  5757. return c
  5758. }
  5759. // Fields allows partial responses to be retrieved. See
  5760. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5761. // for more information.
  5762. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesTestIamPermissionsCall {
  5763. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5764. return c
  5765. }
  5766. // Context sets the context to be used in this call's Do method. Any
  5767. // pending HTTP request will be aborted if the provided context is
  5768. // canceled.
  5769. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsInstancesDatabasesTestIamPermissionsCall {
  5770. c.ctx_ = ctx
  5771. return c
  5772. }
  5773. // Header returns an http.Header that can be modified by the caller to
  5774. // add HTTP headers to the request.
  5775. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Header() http.Header {
  5776. if c.header_ == nil {
  5777. c.header_ = make(http.Header)
  5778. }
  5779. return c.header_
  5780. }
  5781. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  5782. reqHeaders := make(http.Header)
  5783. for k, v := range c.header_ {
  5784. reqHeaders[k] = v
  5785. }
  5786. reqHeaders.Set("User-Agent", c.s.userAgent())
  5787. var body io.Reader = nil
  5788. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  5789. if err != nil {
  5790. return nil, err
  5791. }
  5792. reqHeaders.Set("Content-Type", "application/json")
  5793. c.urlParams_.Set("alt", alt)
  5794. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  5795. urls += "?" + c.urlParams_.Encode()
  5796. req, _ := http.NewRequest("POST", urls, body)
  5797. req.Header = reqHeaders
  5798. googleapi.Expand(req.URL, map[string]string{
  5799. "resource": c.resource,
  5800. })
  5801. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5802. }
  5803. // Do executes the "spanner.projects.instances.databases.testIamPermissions" call.
  5804. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  5805. // Any non-2xx status code is an error. Response headers are in either
  5806. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  5807. // was returned at all) in error.(*googleapi.Error).Header. Use
  5808. // googleapi.IsNotModified to check whether the returned error was
  5809. // because http.StatusNotModified was returned.
  5810. func (c *ProjectsInstancesDatabasesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  5811. gensupport.SetOptions(c.urlParams_, opts...)
  5812. res, err := c.doRequest("json")
  5813. if res != nil && res.StatusCode == http.StatusNotModified {
  5814. if res.Body != nil {
  5815. res.Body.Close()
  5816. }
  5817. return nil, &googleapi.Error{
  5818. Code: res.StatusCode,
  5819. Header: res.Header,
  5820. }
  5821. }
  5822. if err != nil {
  5823. return nil, err
  5824. }
  5825. defer googleapi.CloseBody(res)
  5826. if err := googleapi.CheckResponse(res); err != nil {
  5827. return nil, err
  5828. }
  5829. ret := &TestIamPermissionsResponse{
  5830. ServerResponse: googleapi.ServerResponse{
  5831. Header: res.Header,
  5832. HTTPStatusCode: res.StatusCode,
  5833. },
  5834. }
  5835. target := &ret
  5836. if err := gensupport.DecodeResponse(target, res); err != nil {
  5837. return nil, err
  5838. }
  5839. return ret, nil
  5840. // {
  5841. // "description": "Returns permissions that the caller has on the specified database resource.\n\nAttempting this RPC on a non-existent Cloud Spanner database will result in\na NOT_FOUND error if the user has `spanner.databases.list` permission on\nthe containing Cloud Spanner instance. Otherwise returns an empty set of\npermissions.",
  5842. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}:testIamPermissions",
  5843. // "httpMethod": "POST",
  5844. // "id": "spanner.projects.instances.databases.testIamPermissions",
  5845. // "parameterOrder": [
  5846. // "resource"
  5847. // ],
  5848. // "parameters": {
  5849. // "resource": {
  5850. // "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.",
  5851. // "location": "path",
  5852. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5853. // "required": true,
  5854. // "type": "string"
  5855. // }
  5856. // },
  5857. // "path": "v1/{+resource}:testIamPermissions",
  5858. // "request": {
  5859. // "$ref": "TestIamPermissionsRequest"
  5860. // },
  5861. // "response": {
  5862. // "$ref": "TestIamPermissionsResponse"
  5863. // },
  5864. // "scopes": [
  5865. // "https://www.googleapis.com/auth/cloud-platform",
  5866. // "https://www.googleapis.com/auth/spanner.admin"
  5867. // ]
  5868. // }
  5869. }
  5870. // method id "spanner.projects.instances.databases.updateDdl":
  5871. type ProjectsInstancesDatabasesUpdateDdlCall struct {
  5872. s *Service
  5873. database string
  5874. updatedatabaseddlrequest *UpdateDatabaseDdlRequest
  5875. urlParams_ gensupport.URLParams
  5876. ctx_ context.Context
  5877. header_ http.Header
  5878. }
  5879. // UpdateDdl: Updates the schema of a Cloud Spanner database
  5880. // by
  5881. // creating/altering/dropping tables, columns, indexes, etc. The
  5882. // returned
  5883. // long-running operation will have a name of
  5884. // the format `<database_name>/operations/<operation_id>` and can be
  5885. // used to
  5886. // track execution of the schema change(s). The
  5887. // metadata field type is
  5888. // UpdateDatabaseDdlMetadata. The operation has no response.
  5889. func (r *ProjectsInstancesDatabasesService) UpdateDdl(database string, updatedatabaseddlrequest *UpdateDatabaseDdlRequest) *ProjectsInstancesDatabasesUpdateDdlCall {
  5890. c := &ProjectsInstancesDatabasesUpdateDdlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5891. c.database = database
  5892. c.updatedatabaseddlrequest = updatedatabaseddlrequest
  5893. return c
  5894. }
  5895. // Fields allows partial responses to be retrieved. See
  5896. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5897. // for more information.
  5898. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesUpdateDdlCall {
  5899. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5900. return c
  5901. }
  5902. // Context sets the context to be used in this call's Do method. Any
  5903. // pending HTTP request will be aborted if the provided context is
  5904. // canceled.
  5905. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesUpdateDdlCall {
  5906. c.ctx_ = ctx
  5907. return c
  5908. }
  5909. // Header returns an http.Header that can be modified by the caller to
  5910. // add HTTP headers to the request.
  5911. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Header() http.Header {
  5912. if c.header_ == nil {
  5913. c.header_ = make(http.Header)
  5914. }
  5915. return c.header_
  5916. }
  5917. func (c *ProjectsInstancesDatabasesUpdateDdlCall) doRequest(alt string) (*http.Response, error) {
  5918. reqHeaders := make(http.Header)
  5919. for k, v := range c.header_ {
  5920. reqHeaders[k] = v
  5921. }
  5922. reqHeaders.Set("User-Agent", c.s.userAgent())
  5923. var body io.Reader = nil
  5924. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatedatabaseddlrequest)
  5925. if err != nil {
  5926. return nil, err
  5927. }
  5928. reqHeaders.Set("Content-Type", "application/json")
  5929. c.urlParams_.Set("alt", alt)
  5930. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/ddl")
  5931. urls += "?" + c.urlParams_.Encode()
  5932. req, _ := http.NewRequest("PATCH", urls, body)
  5933. req.Header = reqHeaders
  5934. googleapi.Expand(req.URL, map[string]string{
  5935. "database": c.database,
  5936. })
  5937. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5938. }
  5939. // Do executes the "spanner.projects.instances.databases.updateDdl" call.
  5940. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  5941. // status code is an error. Response headers are in either
  5942. // *Operation.ServerResponse.Header or (if a response was returned at
  5943. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5944. // to check whether the returned error was because
  5945. // http.StatusNotModified was returned.
  5946. func (c *ProjectsInstancesDatabasesUpdateDdlCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  5947. gensupport.SetOptions(c.urlParams_, opts...)
  5948. res, err := c.doRequest("json")
  5949. if res != nil && res.StatusCode == http.StatusNotModified {
  5950. if res.Body != nil {
  5951. res.Body.Close()
  5952. }
  5953. return nil, &googleapi.Error{
  5954. Code: res.StatusCode,
  5955. Header: res.Header,
  5956. }
  5957. }
  5958. if err != nil {
  5959. return nil, err
  5960. }
  5961. defer googleapi.CloseBody(res)
  5962. if err := googleapi.CheckResponse(res); err != nil {
  5963. return nil, err
  5964. }
  5965. ret := &Operation{
  5966. ServerResponse: googleapi.ServerResponse{
  5967. Header: res.Header,
  5968. HTTPStatusCode: res.StatusCode,
  5969. },
  5970. }
  5971. target := &ret
  5972. if err := gensupport.DecodeResponse(target, res); err != nil {
  5973. return nil, err
  5974. }
  5975. return ret, nil
  5976. // {
  5977. // "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.",
  5978. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/ddl",
  5979. // "httpMethod": "PATCH",
  5980. // "id": "spanner.projects.instances.databases.updateDdl",
  5981. // "parameterOrder": [
  5982. // "database"
  5983. // ],
  5984. // "parameters": {
  5985. // "database": {
  5986. // "description": "Required. The database to update.",
  5987. // "location": "path",
  5988. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  5989. // "required": true,
  5990. // "type": "string"
  5991. // }
  5992. // },
  5993. // "path": "v1/{+database}/ddl",
  5994. // "request": {
  5995. // "$ref": "UpdateDatabaseDdlRequest"
  5996. // },
  5997. // "response": {
  5998. // "$ref": "Operation"
  5999. // },
  6000. // "scopes": [
  6001. // "https://www.googleapis.com/auth/cloud-platform",
  6002. // "https://www.googleapis.com/auth/spanner.admin"
  6003. // ]
  6004. // }
  6005. }
  6006. // method id "spanner.projects.instances.databases.operations.cancel":
  6007. type ProjectsInstancesDatabasesOperationsCancelCall struct {
  6008. s *Service
  6009. name string
  6010. urlParams_ gensupport.URLParams
  6011. ctx_ context.Context
  6012. header_ http.Header
  6013. }
  6014. // Cancel: Starts asynchronous cancellation on a long-running operation.
  6015. // The server
  6016. // makes a best effort to cancel the operation, but success is
  6017. // not
  6018. // guaranteed. If the server doesn't support this method, it
  6019. // returns
  6020. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  6021. // use
  6022. // Operations.GetOperation or
  6023. // other methods to check whether the cancellation succeeded or whether
  6024. // the
  6025. // operation completed despite cancellation. On successful
  6026. // cancellation,
  6027. // the operation is not deleted; instead, it becomes an operation
  6028. // with
  6029. // an Operation.error value with a google.rpc.Status.code of
  6030. // 1,
  6031. // corresponding to `Code.CANCELLED`.
  6032. func (r *ProjectsInstancesDatabasesOperationsService) Cancel(name string) *ProjectsInstancesDatabasesOperationsCancelCall {
  6033. c := &ProjectsInstancesDatabasesOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6034. c.name = name
  6035. return c
  6036. }
  6037. // Fields allows partial responses to be retrieved. See
  6038. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6039. // for more information.
  6040. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsCancelCall {
  6041. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6042. return c
  6043. }
  6044. // Context sets the context to be used in this call's Do method. Any
  6045. // pending HTTP request will be aborted if the provided context is
  6046. // canceled.
  6047. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsCancelCall {
  6048. c.ctx_ = ctx
  6049. return c
  6050. }
  6051. // Header returns an http.Header that can be modified by the caller to
  6052. // add HTTP headers to the request.
  6053. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Header() http.Header {
  6054. if c.header_ == nil {
  6055. c.header_ = make(http.Header)
  6056. }
  6057. return c.header_
  6058. }
  6059. func (c *ProjectsInstancesDatabasesOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  6060. reqHeaders := make(http.Header)
  6061. for k, v := range c.header_ {
  6062. reqHeaders[k] = v
  6063. }
  6064. reqHeaders.Set("User-Agent", c.s.userAgent())
  6065. var body io.Reader = nil
  6066. c.urlParams_.Set("alt", alt)
  6067. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  6068. urls += "?" + c.urlParams_.Encode()
  6069. req, _ := http.NewRequest("POST", urls, body)
  6070. req.Header = reqHeaders
  6071. googleapi.Expand(req.URL, map[string]string{
  6072. "name": c.name,
  6073. })
  6074. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6075. }
  6076. // Do executes the "spanner.projects.instances.databases.operations.cancel" call.
  6077. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6078. // code is an error. Response headers are in either
  6079. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6080. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6081. // check whether the returned error was because http.StatusNotModified
  6082. // was returned.
  6083. func (c *ProjectsInstancesDatabasesOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6084. gensupport.SetOptions(c.urlParams_, opts...)
  6085. res, err := c.doRequest("json")
  6086. if res != nil && res.StatusCode == http.StatusNotModified {
  6087. if res.Body != nil {
  6088. res.Body.Close()
  6089. }
  6090. return nil, &googleapi.Error{
  6091. Code: res.StatusCode,
  6092. Header: res.Header,
  6093. }
  6094. }
  6095. if err != nil {
  6096. return nil, err
  6097. }
  6098. defer googleapi.CloseBody(res)
  6099. if err := googleapi.CheckResponse(res); err != nil {
  6100. return nil, err
  6101. }
  6102. ret := &Empty{
  6103. ServerResponse: googleapi.ServerResponse{
  6104. Header: res.Header,
  6105. HTTPStatusCode: res.StatusCode,
  6106. },
  6107. }
  6108. target := &ret
  6109. if err := gensupport.DecodeResponse(target, res); err != nil {
  6110. return nil, err
  6111. }
  6112. return ret, nil
  6113. // {
  6114. // "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`.",
  6115. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations/{operationsId}:cancel",
  6116. // "httpMethod": "POST",
  6117. // "id": "spanner.projects.instances.databases.operations.cancel",
  6118. // "parameterOrder": [
  6119. // "name"
  6120. // ],
  6121. // "parameters": {
  6122. // "name": {
  6123. // "description": "The name of the operation resource to be cancelled.",
  6124. // "location": "path",
  6125. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$",
  6126. // "required": true,
  6127. // "type": "string"
  6128. // }
  6129. // },
  6130. // "path": "v1/{+name}:cancel",
  6131. // "response": {
  6132. // "$ref": "Empty"
  6133. // },
  6134. // "scopes": [
  6135. // "https://www.googleapis.com/auth/cloud-platform",
  6136. // "https://www.googleapis.com/auth/spanner.admin"
  6137. // ]
  6138. // }
  6139. }
  6140. // method id "spanner.projects.instances.databases.operations.delete":
  6141. type ProjectsInstancesDatabasesOperationsDeleteCall struct {
  6142. s *Service
  6143. name string
  6144. urlParams_ gensupport.URLParams
  6145. ctx_ context.Context
  6146. header_ http.Header
  6147. }
  6148. // Delete: Deletes a long-running operation. This method indicates that
  6149. // the client is
  6150. // no longer interested in the operation result. It does not cancel
  6151. // the
  6152. // operation. If the server doesn't support this method, it
  6153. // returns
  6154. // `google.rpc.Code.UNIMPLEMENTED`.
  6155. func (r *ProjectsInstancesDatabasesOperationsService) Delete(name string) *ProjectsInstancesDatabasesOperationsDeleteCall {
  6156. c := &ProjectsInstancesDatabasesOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6157. c.name = name
  6158. return c
  6159. }
  6160. // Fields allows partial responses to be retrieved. See
  6161. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6162. // for more information.
  6163. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsDeleteCall {
  6164. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6165. return c
  6166. }
  6167. // Context sets the context to be used in this call's Do method. Any
  6168. // pending HTTP request will be aborted if the provided context is
  6169. // canceled.
  6170. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsDeleteCall {
  6171. c.ctx_ = ctx
  6172. return c
  6173. }
  6174. // Header returns an http.Header that can be modified by the caller to
  6175. // add HTTP headers to the request.
  6176. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Header() http.Header {
  6177. if c.header_ == nil {
  6178. c.header_ = make(http.Header)
  6179. }
  6180. return c.header_
  6181. }
  6182. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6183. reqHeaders := make(http.Header)
  6184. for k, v := range c.header_ {
  6185. reqHeaders[k] = v
  6186. }
  6187. reqHeaders.Set("User-Agent", c.s.userAgent())
  6188. var body io.Reader = nil
  6189. c.urlParams_.Set("alt", alt)
  6190. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6191. urls += "?" + c.urlParams_.Encode()
  6192. req, _ := http.NewRequest("DELETE", urls, body)
  6193. req.Header = reqHeaders
  6194. googleapi.Expand(req.URL, map[string]string{
  6195. "name": c.name,
  6196. })
  6197. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6198. }
  6199. // Do executes the "spanner.projects.instances.databases.operations.delete" call.
  6200. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6201. // code is an error. Response headers are in either
  6202. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6203. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6204. // check whether the returned error was because http.StatusNotModified
  6205. // was returned.
  6206. func (c *ProjectsInstancesDatabasesOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6207. gensupport.SetOptions(c.urlParams_, opts...)
  6208. res, err := c.doRequest("json")
  6209. if res != nil && res.StatusCode == http.StatusNotModified {
  6210. if res.Body != nil {
  6211. res.Body.Close()
  6212. }
  6213. return nil, &googleapi.Error{
  6214. Code: res.StatusCode,
  6215. Header: res.Header,
  6216. }
  6217. }
  6218. if err != nil {
  6219. return nil, err
  6220. }
  6221. defer googleapi.CloseBody(res)
  6222. if err := googleapi.CheckResponse(res); err != nil {
  6223. return nil, err
  6224. }
  6225. ret := &Empty{
  6226. ServerResponse: googleapi.ServerResponse{
  6227. Header: res.Header,
  6228. HTTPStatusCode: res.StatusCode,
  6229. },
  6230. }
  6231. target := &ret
  6232. if err := gensupport.DecodeResponse(target, res); err != nil {
  6233. return nil, err
  6234. }
  6235. return ret, nil
  6236. // {
  6237. // "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`.",
  6238. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations/{operationsId}",
  6239. // "httpMethod": "DELETE",
  6240. // "id": "spanner.projects.instances.databases.operations.delete",
  6241. // "parameterOrder": [
  6242. // "name"
  6243. // ],
  6244. // "parameters": {
  6245. // "name": {
  6246. // "description": "The name of the operation resource to be deleted.",
  6247. // "location": "path",
  6248. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$",
  6249. // "required": true,
  6250. // "type": "string"
  6251. // }
  6252. // },
  6253. // "path": "v1/{+name}",
  6254. // "response": {
  6255. // "$ref": "Empty"
  6256. // },
  6257. // "scopes": [
  6258. // "https://www.googleapis.com/auth/cloud-platform",
  6259. // "https://www.googleapis.com/auth/spanner.admin"
  6260. // ]
  6261. // }
  6262. }
  6263. // method id "spanner.projects.instances.databases.operations.get":
  6264. type ProjectsInstancesDatabasesOperationsGetCall struct {
  6265. s *Service
  6266. name string
  6267. urlParams_ gensupport.URLParams
  6268. ifNoneMatch_ string
  6269. ctx_ context.Context
  6270. header_ http.Header
  6271. }
  6272. // Get: Gets the latest state of a long-running operation. Clients can
  6273. // use this
  6274. // method to poll the operation result at intervals as recommended by
  6275. // the API
  6276. // service.
  6277. func (r *ProjectsInstancesDatabasesOperationsService) Get(name string) *ProjectsInstancesDatabasesOperationsGetCall {
  6278. c := &ProjectsInstancesDatabasesOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6279. c.name = name
  6280. return c
  6281. }
  6282. // Fields allows partial responses to be retrieved. See
  6283. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6284. // for more information.
  6285. func (c *ProjectsInstancesDatabasesOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsGetCall {
  6286. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6287. return c
  6288. }
  6289. // IfNoneMatch sets the optional parameter which makes the operation
  6290. // fail if the object's ETag matches the given value. This is useful for
  6291. // getting updates only after the object has changed since the last
  6292. // request. Use googleapi.IsNotModified to check whether the response
  6293. // error from Do is the result of In-None-Match.
  6294. func (c *ProjectsInstancesDatabasesOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesOperationsGetCall {
  6295. c.ifNoneMatch_ = entityTag
  6296. return c
  6297. }
  6298. // Context sets the context to be used in this call's Do method. Any
  6299. // pending HTTP request will be aborted if the provided context is
  6300. // canceled.
  6301. func (c *ProjectsInstancesDatabasesOperationsGetCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsGetCall {
  6302. c.ctx_ = ctx
  6303. return c
  6304. }
  6305. // Header returns an http.Header that can be modified by the caller to
  6306. // add HTTP headers to the request.
  6307. func (c *ProjectsInstancesDatabasesOperationsGetCall) Header() http.Header {
  6308. if c.header_ == nil {
  6309. c.header_ = make(http.Header)
  6310. }
  6311. return c.header_
  6312. }
  6313. func (c *ProjectsInstancesDatabasesOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  6314. reqHeaders := make(http.Header)
  6315. for k, v := range c.header_ {
  6316. reqHeaders[k] = v
  6317. }
  6318. reqHeaders.Set("User-Agent", c.s.userAgent())
  6319. if c.ifNoneMatch_ != "" {
  6320. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6321. }
  6322. var body io.Reader = nil
  6323. c.urlParams_.Set("alt", alt)
  6324. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6325. urls += "?" + c.urlParams_.Encode()
  6326. req, _ := http.NewRequest("GET", urls, body)
  6327. req.Header = reqHeaders
  6328. googleapi.Expand(req.URL, map[string]string{
  6329. "name": c.name,
  6330. })
  6331. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6332. }
  6333. // Do executes the "spanner.projects.instances.databases.operations.get" call.
  6334. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  6335. // status code is an error. Response headers are in either
  6336. // *Operation.ServerResponse.Header or (if a response was returned at
  6337. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6338. // to check whether the returned error was because
  6339. // http.StatusNotModified was returned.
  6340. func (c *ProjectsInstancesDatabasesOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  6341. gensupport.SetOptions(c.urlParams_, opts...)
  6342. res, err := c.doRequest("json")
  6343. if res != nil && res.StatusCode == http.StatusNotModified {
  6344. if res.Body != nil {
  6345. res.Body.Close()
  6346. }
  6347. return nil, &googleapi.Error{
  6348. Code: res.StatusCode,
  6349. Header: res.Header,
  6350. }
  6351. }
  6352. if err != nil {
  6353. return nil, err
  6354. }
  6355. defer googleapi.CloseBody(res)
  6356. if err := googleapi.CheckResponse(res); err != nil {
  6357. return nil, err
  6358. }
  6359. ret := &Operation{
  6360. ServerResponse: googleapi.ServerResponse{
  6361. Header: res.Header,
  6362. HTTPStatusCode: res.StatusCode,
  6363. },
  6364. }
  6365. target := &ret
  6366. if err := gensupport.DecodeResponse(target, res); err != nil {
  6367. return nil, err
  6368. }
  6369. return ret, nil
  6370. // {
  6371. // "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.",
  6372. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations/{operationsId}",
  6373. // "httpMethod": "GET",
  6374. // "id": "spanner.projects.instances.databases.operations.get",
  6375. // "parameterOrder": [
  6376. // "name"
  6377. // ],
  6378. // "parameters": {
  6379. // "name": {
  6380. // "description": "The name of the operation resource.",
  6381. // "location": "path",
  6382. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+$",
  6383. // "required": true,
  6384. // "type": "string"
  6385. // }
  6386. // },
  6387. // "path": "v1/{+name}",
  6388. // "response": {
  6389. // "$ref": "Operation"
  6390. // },
  6391. // "scopes": [
  6392. // "https://www.googleapis.com/auth/cloud-platform",
  6393. // "https://www.googleapis.com/auth/spanner.admin"
  6394. // ]
  6395. // }
  6396. }
  6397. // method id "spanner.projects.instances.databases.operations.list":
  6398. type ProjectsInstancesDatabasesOperationsListCall struct {
  6399. s *Service
  6400. name string
  6401. urlParams_ gensupport.URLParams
  6402. ifNoneMatch_ string
  6403. ctx_ context.Context
  6404. header_ http.Header
  6405. }
  6406. // List: Lists operations that match the specified filter in the
  6407. // request. If the
  6408. // server doesn't support this method, it returns
  6409. // `UNIMPLEMENTED`.
  6410. //
  6411. // NOTE: the `name` binding allows API services to override the
  6412. // binding
  6413. // to use different resource name schemes, such as `users/*/operations`.
  6414. // To
  6415. // override the binding, API services can add a binding such
  6416. // as
  6417. // "/v1/{name=users/*}/operations" to their service configuration.
  6418. // For backwards compatibility, the default name includes the
  6419. // operations
  6420. // collection id, however overriding users must ensure the name
  6421. // binding
  6422. // is the parent resource, without the operations collection id.
  6423. func (r *ProjectsInstancesDatabasesOperationsService) List(name string) *ProjectsInstancesDatabasesOperationsListCall {
  6424. c := &ProjectsInstancesDatabasesOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6425. c.name = name
  6426. return c
  6427. }
  6428. // Filter sets the optional parameter "filter": The standard list
  6429. // filter.
  6430. func (c *ProjectsInstancesDatabasesOperationsListCall) Filter(filter string) *ProjectsInstancesDatabasesOperationsListCall {
  6431. c.urlParams_.Set("filter", filter)
  6432. return c
  6433. }
  6434. // PageSize sets the optional parameter "pageSize": The standard list
  6435. // page size.
  6436. func (c *ProjectsInstancesDatabasesOperationsListCall) PageSize(pageSize int64) *ProjectsInstancesDatabasesOperationsListCall {
  6437. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6438. return c
  6439. }
  6440. // PageToken sets the optional parameter "pageToken": The standard list
  6441. // page token.
  6442. func (c *ProjectsInstancesDatabasesOperationsListCall) PageToken(pageToken string) *ProjectsInstancesDatabasesOperationsListCall {
  6443. c.urlParams_.Set("pageToken", pageToken)
  6444. return c
  6445. }
  6446. // Fields allows partial responses to be retrieved. See
  6447. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6448. // for more information.
  6449. func (c *ProjectsInstancesDatabasesOperationsListCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesOperationsListCall {
  6450. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6451. return c
  6452. }
  6453. // IfNoneMatch sets the optional parameter which makes the operation
  6454. // fail if the object's ETag matches the given value. This is useful for
  6455. // getting updates only after the object has changed since the last
  6456. // request. Use googleapi.IsNotModified to check whether the response
  6457. // error from Do is the result of In-None-Match.
  6458. func (c *ProjectsInstancesDatabasesOperationsListCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesOperationsListCall {
  6459. c.ifNoneMatch_ = entityTag
  6460. return c
  6461. }
  6462. // Context sets the context to be used in this call's Do method. Any
  6463. // pending HTTP request will be aborted if the provided context is
  6464. // canceled.
  6465. func (c *ProjectsInstancesDatabasesOperationsListCall) Context(ctx context.Context) *ProjectsInstancesDatabasesOperationsListCall {
  6466. c.ctx_ = ctx
  6467. return c
  6468. }
  6469. // Header returns an http.Header that can be modified by the caller to
  6470. // add HTTP headers to the request.
  6471. func (c *ProjectsInstancesDatabasesOperationsListCall) Header() http.Header {
  6472. if c.header_ == nil {
  6473. c.header_ = make(http.Header)
  6474. }
  6475. return c.header_
  6476. }
  6477. func (c *ProjectsInstancesDatabasesOperationsListCall) doRequest(alt string) (*http.Response, error) {
  6478. reqHeaders := make(http.Header)
  6479. for k, v := range c.header_ {
  6480. reqHeaders[k] = v
  6481. }
  6482. reqHeaders.Set("User-Agent", c.s.userAgent())
  6483. if c.ifNoneMatch_ != "" {
  6484. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6485. }
  6486. var body io.Reader = nil
  6487. c.urlParams_.Set("alt", alt)
  6488. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6489. urls += "?" + c.urlParams_.Encode()
  6490. req, _ := http.NewRequest("GET", urls, body)
  6491. req.Header = reqHeaders
  6492. googleapi.Expand(req.URL, map[string]string{
  6493. "name": c.name,
  6494. })
  6495. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6496. }
  6497. // Do executes the "spanner.projects.instances.databases.operations.list" call.
  6498. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  6499. // non-2xx status code is an error. Response headers are in either
  6500. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  6501. // returned at all) in error.(*googleapi.Error).Header. Use
  6502. // googleapi.IsNotModified to check whether the returned error was
  6503. // because http.StatusNotModified was returned.
  6504. func (c *ProjectsInstancesDatabasesOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  6505. gensupport.SetOptions(c.urlParams_, opts...)
  6506. res, err := c.doRequest("json")
  6507. if res != nil && res.StatusCode == http.StatusNotModified {
  6508. if res.Body != nil {
  6509. res.Body.Close()
  6510. }
  6511. return nil, &googleapi.Error{
  6512. Code: res.StatusCode,
  6513. Header: res.Header,
  6514. }
  6515. }
  6516. if err != nil {
  6517. return nil, err
  6518. }
  6519. defer googleapi.CloseBody(res)
  6520. if err := googleapi.CheckResponse(res); err != nil {
  6521. return nil, err
  6522. }
  6523. ret := &ListOperationsResponse{
  6524. ServerResponse: googleapi.ServerResponse{
  6525. Header: res.Header,
  6526. HTTPStatusCode: res.StatusCode,
  6527. },
  6528. }
  6529. target := &ret
  6530. if err := gensupport.DecodeResponse(target, res); err != nil {
  6531. return nil, err
  6532. }
  6533. return ret, nil
  6534. // {
  6535. // "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.",
  6536. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/operations",
  6537. // "httpMethod": "GET",
  6538. // "id": "spanner.projects.instances.databases.operations.list",
  6539. // "parameterOrder": [
  6540. // "name"
  6541. // ],
  6542. // "parameters": {
  6543. // "filter": {
  6544. // "description": "The standard list filter.",
  6545. // "location": "query",
  6546. // "type": "string"
  6547. // },
  6548. // "name": {
  6549. // "description": "The name of the operation's parent resource.",
  6550. // "location": "path",
  6551. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations$",
  6552. // "required": true,
  6553. // "type": "string"
  6554. // },
  6555. // "pageSize": {
  6556. // "description": "The standard list page size.",
  6557. // "format": "int32",
  6558. // "location": "query",
  6559. // "type": "integer"
  6560. // },
  6561. // "pageToken": {
  6562. // "description": "The standard list page token.",
  6563. // "location": "query",
  6564. // "type": "string"
  6565. // }
  6566. // },
  6567. // "path": "v1/{+name}",
  6568. // "response": {
  6569. // "$ref": "ListOperationsResponse"
  6570. // },
  6571. // "scopes": [
  6572. // "https://www.googleapis.com/auth/cloud-platform",
  6573. // "https://www.googleapis.com/auth/spanner.admin"
  6574. // ]
  6575. // }
  6576. }
  6577. // Pages invokes f for each page of results.
  6578. // A non-nil error returned from f will halt the iteration.
  6579. // The provided context supersedes any context provided to the Context method.
  6580. func (c *ProjectsInstancesDatabasesOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  6581. c.ctx_ = ctx
  6582. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6583. for {
  6584. x, err := c.Do()
  6585. if err != nil {
  6586. return err
  6587. }
  6588. if err := f(x); err != nil {
  6589. return err
  6590. }
  6591. if x.NextPageToken == "" {
  6592. return nil
  6593. }
  6594. c.PageToken(x.NextPageToken)
  6595. }
  6596. }
  6597. // method id "spanner.projects.instances.databases.sessions.beginTransaction":
  6598. type ProjectsInstancesDatabasesSessionsBeginTransactionCall struct {
  6599. s *Service
  6600. session string
  6601. begintransactionrequest *BeginTransactionRequest
  6602. urlParams_ gensupport.URLParams
  6603. ctx_ context.Context
  6604. header_ http.Header
  6605. }
  6606. // BeginTransaction: Begins a new transaction. This step can often be
  6607. // skipped:
  6608. // Read, ExecuteSql and
  6609. // Commit can begin a new transaction as a
  6610. // side-effect.
  6611. func (r *ProjectsInstancesDatabasesSessionsService) BeginTransaction(session string, begintransactionrequest *BeginTransactionRequest) *ProjectsInstancesDatabasesSessionsBeginTransactionCall {
  6612. c := &ProjectsInstancesDatabasesSessionsBeginTransactionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6613. c.session = session
  6614. c.begintransactionrequest = begintransactionrequest
  6615. return c
  6616. }
  6617. // Fields allows partial responses to be retrieved. See
  6618. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6619. // for more information.
  6620. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsBeginTransactionCall {
  6621. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6622. return c
  6623. }
  6624. // Context sets the context to be used in this call's Do method. Any
  6625. // pending HTTP request will be aborted if the provided context is
  6626. // canceled.
  6627. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsBeginTransactionCall {
  6628. c.ctx_ = ctx
  6629. return c
  6630. }
  6631. // Header returns an http.Header that can be modified by the caller to
  6632. // add HTTP headers to the request.
  6633. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Header() http.Header {
  6634. if c.header_ == nil {
  6635. c.header_ = make(http.Header)
  6636. }
  6637. return c.header_
  6638. }
  6639. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) doRequest(alt string) (*http.Response, error) {
  6640. reqHeaders := make(http.Header)
  6641. for k, v := range c.header_ {
  6642. reqHeaders[k] = v
  6643. }
  6644. reqHeaders.Set("User-Agent", c.s.userAgent())
  6645. var body io.Reader = nil
  6646. body, err := googleapi.WithoutDataWrapper.JSONReader(c.begintransactionrequest)
  6647. if err != nil {
  6648. return nil, err
  6649. }
  6650. reqHeaders.Set("Content-Type", "application/json")
  6651. c.urlParams_.Set("alt", alt)
  6652. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:beginTransaction")
  6653. urls += "?" + c.urlParams_.Encode()
  6654. req, _ := http.NewRequest("POST", urls, body)
  6655. req.Header = reqHeaders
  6656. googleapi.Expand(req.URL, map[string]string{
  6657. "session": c.session,
  6658. })
  6659. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6660. }
  6661. // Do executes the "spanner.projects.instances.databases.sessions.beginTransaction" call.
  6662. // Exactly one of *Transaction or error will be non-nil. Any non-2xx
  6663. // status code is an error. Response headers are in either
  6664. // *Transaction.ServerResponse.Header or (if a response was returned at
  6665. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6666. // to check whether the returned error was because
  6667. // http.StatusNotModified was returned.
  6668. func (c *ProjectsInstancesDatabasesSessionsBeginTransactionCall) Do(opts ...googleapi.CallOption) (*Transaction, error) {
  6669. gensupport.SetOptions(c.urlParams_, opts...)
  6670. res, err := c.doRequest("json")
  6671. if res != nil && res.StatusCode == http.StatusNotModified {
  6672. if res.Body != nil {
  6673. res.Body.Close()
  6674. }
  6675. return nil, &googleapi.Error{
  6676. Code: res.StatusCode,
  6677. Header: res.Header,
  6678. }
  6679. }
  6680. if err != nil {
  6681. return nil, err
  6682. }
  6683. defer googleapi.CloseBody(res)
  6684. if err := googleapi.CheckResponse(res); err != nil {
  6685. return nil, err
  6686. }
  6687. ret := &Transaction{
  6688. ServerResponse: googleapi.ServerResponse{
  6689. Header: res.Header,
  6690. HTTPStatusCode: res.StatusCode,
  6691. },
  6692. }
  6693. target := &ret
  6694. if err := gensupport.DecodeResponse(target, res); err != nil {
  6695. return nil, err
  6696. }
  6697. return ret, nil
  6698. // {
  6699. // "description": "Begins a new transaction. This step can often be skipped:\nRead, ExecuteSql and\nCommit can begin a new transaction as a\nside-effect.",
  6700. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:beginTransaction",
  6701. // "httpMethod": "POST",
  6702. // "id": "spanner.projects.instances.databases.sessions.beginTransaction",
  6703. // "parameterOrder": [
  6704. // "session"
  6705. // ],
  6706. // "parameters": {
  6707. // "session": {
  6708. // "description": "Required. The session in which the transaction runs.",
  6709. // "location": "path",
  6710. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  6711. // "required": true,
  6712. // "type": "string"
  6713. // }
  6714. // },
  6715. // "path": "v1/{+session}:beginTransaction",
  6716. // "request": {
  6717. // "$ref": "BeginTransactionRequest"
  6718. // },
  6719. // "response": {
  6720. // "$ref": "Transaction"
  6721. // },
  6722. // "scopes": [
  6723. // "https://www.googleapis.com/auth/cloud-platform",
  6724. // "https://www.googleapis.com/auth/spanner.data"
  6725. // ]
  6726. // }
  6727. }
  6728. // method id "spanner.projects.instances.databases.sessions.commit":
  6729. type ProjectsInstancesDatabasesSessionsCommitCall struct {
  6730. s *Service
  6731. session string
  6732. commitrequest *CommitRequest
  6733. urlParams_ gensupport.URLParams
  6734. ctx_ context.Context
  6735. header_ http.Header
  6736. }
  6737. // Commit: Commits a transaction. The request includes the mutations to
  6738. // be
  6739. // applied to rows in the database.
  6740. //
  6741. // `Commit` might return an `ABORTED` error. This can occur at any
  6742. // time;
  6743. // commonly, the cause is conflicts with concurrent
  6744. // transactions. However, it can also happen for a variety of
  6745. // other
  6746. // reasons. If `Commit` returns `ABORTED`, the caller should
  6747. // re-attempt
  6748. // the transaction from the beginning, re-using the same session.
  6749. func (r *ProjectsInstancesDatabasesSessionsService) Commit(session string, commitrequest *CommitRequest) *ProjectsInstancesDatabasesSessionsCommitCall {
  6750. c := &ProjectsInstancesDatabasesSessionsCommitCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6751. c.session = session
  6752. c.commitrequest = commitrequest
  6753. return c
  6754. }
  6755. // Fields allows partial responses to be retrieved. See
  6756. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6757. // for more information.
  6758. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsCommitCall {
  6759. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6760. return c
  6761. }
  6762. // Context sets the context to be used in this call's Do method. Any
  6763. // pending HTTP request will be aborted if the provided context is
  6764. // canceled.
  6765. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsCommitCall {
  6766. c.ctx_ = ctx
  6767. return c
  6768. }
  6769. // Header returns an http.Header that can be modified by the caller to
  6770. // add HTTP headers to the request.
  6771. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Header() http.Header {
  6772. if c.header_ == nil {
  6773. c.header_ = make(http.Header)
  6774. }
  6775. return c.header_
  6776. }
  6777. func (c *ProjectsInstancesDatabasesSessionsCommitCall) doRequest(alt string) (*http.Response, error) {
  6778. reqHeaders := make(http.Header)
  6779. for k, v := range c.header_ {
  6780. reqHeaders[k] = v
  6781. }
  6782. reqHeaders.Set("User-Agent", c.s.userAgent())
  6783. var body io.Reader = nil
  6784. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commitrequest)
  6785. if err != nil {
  6786. return nil, err
  6787. }
  6788. reqHeaders.Set("Content-Type", "application/json")
  6789. c.urlParams_.Set("alt", alt)
  6790. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:commit")
  6791. urls += "?" + c.urlParams_.Encode()
  6792. req, _ := http.NewRequest("POST", urls, body)
  6793. req.Header = reqHeaders
  6794. googleapi.Expand(req.URL, map[string]string{
  6795. "session": c.session,
  6796. })
  6797. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6798. }
  6799. // Do executes the "spanner.projects.instances.databases.sessions.commit" call.
  6800. // Exactly one of *CommitResponse or error will be non-nil. Any non-2xx
  6801. // status code is an error. Response headers are in either
  6802. // *CommitResponse.ServerResponse.Header or (if a response was returned
  6803. // at all) in error.(*googleapi.Error).Header. Use
  6804. // googleapi.IsNotModified to check whether the returned error was
  6805. // because http.StatusNotModified was returned.
  6806. func (c *ProjectsInstancesDatabasesSessionsCommitCall) Do(opts ...googleapi.CallOption) (*CommitResponse, error) {
  6807. gensupport.SetOptions(c.urlParams_, opts...)
  6808. res, err := c.doRequest("json")
  6809. if res != nil && res.StatusCode == http.StatusNotModified {
  6810. if res.Body != nil {
  6811. res.Body.Close()
  6812. }
  6813. return nil, &googleapi.Error{
  6814. Code: res.StatusCode,
  6815. Header: res.Header,
  6816. }
  6817. }
  6818. if err != nil {
  6819. return nil, err
  6820. }
  6821. defer googleapi.CloseBody(res)
  6822. if err := googleapi.CheckResponse(res); err != nil {
  6823. return nil, err
  6824. }
  6825. ret := &CommitResponse{
  6826. ServerResponse: googleapi.ServerResponse{
  6827. Header: res.Header,
  6828. HTTPStatusCode: res.StatusCode,
  6829. },
  6830. }
  6831. target := &ret
  6832. if err := gensupport.DecodeResponse(target, res); err != nil {
  6833. return nil, err
  6834. }
  6835. return ret, nil
  6836. // {
  6837. // "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.",
  6838. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:commit",
  6839. // "httpMethod": "POST",
  6840. // "id": "spanner.projects.instances.databases.sessions.commit",
  6841. // "parameterOrder": [
  6842. // "session"
  6843. // ],
  6844. // "parameters": {
  6845. // "session": {
  6846. // "description": "Required. The session in which the transaction to be committed is running.",
  6847. // "location": "path",
  6848. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  6849. // "required": true,
  6850. // "type": "string"
  6851. // }
  6852. // },
  6853. // "path": "v1/{+session}:commit",
  6854. // "request": {
  6855. // "$ref": "CommitRequest"
  6856. // },
  6857. // "response": {
  6858. // "$ref": "CommitResponse"
  6859. // },
  6860. // "scopes": [
  6861. // "https://www.googleapis.com/auth/cloud-platform",
  6862. // "https://www.googleapis.com/auth/spanner.data"
  6863. // ]
  6864. // }
  6865. }
  6866. // method id "spanner.projects.instances.databases.sessions.create":
  6867. type ProjectsInstancesDatabasesSessionsCreateCall struct {
  6868. s *Service
  6869. database string
  6870. createsessionrequest *CreateSessionRequest
  6871. urlParams_ gensupport.URLParams
  6872. ctx_ context.Context
  6873. header_ http.Header
  6874. }
  6875. // Create: Creates a new session. A session can be used to
  6876. // perform
  6877. // transactions that read and/or modify data in a Cloud Spanner
  6878. // database.
  6879. // Sessions are meant to be reused for many
  6880. // consecutive
  6881. // transactions.
  6882. //
  6883. // Sessions can only execute one transaction at a time. To
  6884. // execute
  6885. // multiple concurrent read-write/write-only transactions,
  6886. // create
  6887. // multiple sessions. Note that standalone reads and queries use
  6888. // a
  6889. // transaction internally, and count toward the one
  6890. // transaction
  6891. // limit.
  6892. //
  6893. // Cloud Spanner limits the number of sessions that can exist at any
  6894. // given
  6895. // time; thus, it is a good idea to delete idle and/or unneeded
  6896. // sessions.
  6897. // Aside from explicit deletes, Cloud Spanner can delete sessions for
  6898. // which no
  6899. // operations are sent for more than an hour. If a session is
  6900. // deleted,
  6901. // requests to it return `NOT_FOUND`.
  6902. //
  6903. // Idle sessions can be kept alive by sending a trivial SQL
  6904. // query
  6905. // periodically, e.g., "SELECT 1".
  6906. func (r *ProjectsInstancesDatabasesSessionsService) Create(database string, createsessionrequest *CreateSessionRequest) *ProjectsInstancesDatabasesSessionsCreateCall {
  6907. c := &ProjectsInstancesDatabasesSessionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6908. c.database = database
  6909. c.createsessionrequest = createsessionrequest
  6910. return c
  6911. }
  6912. // Fields allows partial responses to be retrieved. See
  6913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6914. // for more information.
  6915. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsCreateCall {
  6916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6917. return c
  6918. }
  6919. // Context sets the context to be used in this call's Do method. Any
  6920. // pending HTTP request will be aborted if the provided context is
  6921. // canceled.
  6922. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsCreateCall {
  6923. c.ctx_ = ctx
  6924. return c
  6925. }
  6926. // Header returns an http.Header that can be modified by the caller to
  6927. // add HTTP headers to the request.
  6928. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Header() http.Header {
  6929. if c.header_ == nil {
  6930. c.header_ = make(http.Header)
  6931. }
  6932. return c.header_
  6933. }
  6934. func (c *ProjectsInstancesDatabasesSessionsCreateCall) doRequest(alt string) (*http.Response, error) {
  6935. reqHeaders := make(http.Header)
  6936. for k, v := range c.header_ {
  6937. reqHeaders[k] = v
  6938. }
  6939. reqHeaders.Set("User-Agent", c.s.userAgent())
  6940. var body io.Reader = nil
  6941. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createsessionrequest)
  6942. if err != nil {
  6943. return nil, err
  6944. }
  6945. reqHeaders.Set("Content-Type", "application/json")
  6946. c.urlParams_.Set("alt", alt)
  6947. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/sessions")
  6948. urls += "?" + c.urlParams_.Encode()
  6949. req, _ := http.NewRequest("POST", urls, body)
  6950. req.Header = reqHeaders
  6951. googleapi.Expand(req.URL, map[string]string{
  6952. "database": c.database,
  6953. })
  6954. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6955. }
  6956. // Do executes the "spanner.projects.instances.databases.sessions.create" call.
  6957. // Exactly one of *Session or error will be non-nil. Any non-2xx status
  6958. // code is an error. Response headers are in either
  6959. // *Session.ServerResponse.Header or (if a response was returned at all)
  6960. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6961. // check whether the returned error was because http.StatusNotModified
  6962. // was returned.
  6963. func (c *ProjectsInstancesDatabasesSessionsCreateCall) Do(opts ...googleapi.CallOption) (*Session, error) {
  6964. gensupport.SetOptions(c.urlParams_, opts...)
  6965. res, err := c.doRequest("json")
  6966. if res != nil && res.StatusCode == http.StatusNotModified {
  6967. if res.Body != nil {
  6968. res.Body.Close()
  6969. }
  6970. return nil, &googleapi.Error{
  6971. Code: res.StatusCode,
  6972. Header: res.Header,
  6973. }
  6974. }
  6975. if err != nil {
  6976. return nil, err
  6977. }
  6978. defer googleapi.CloseBody(res)
  6979. if err := googleapi.CheckResponse(res); err != nil {
  6980. return nil, err
  6981. }
  6982. ret := &Session{
  6983. ServerResponse: googleapi.ServerResponse{
  6984. Header: res.Header,
  6985. HTTPStatusCode: res.StatusCode,
  6986. },
  6987. }
  6988. target := &ret
  6989. if err := gensupport.DecodeResponse(target, res); err != nil {
  6990. return nil, err
  6991. }
  6992. return ret, nil
  6993. // {
  6994. // "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\"`.",
  6995. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions",
  6996. // "httpMethod": "POST",
  6997. // "id": "spanner.projects.instances.databases.sessions.create",
  6998. // "parameterOrder": [
  6999. // "database"
  7000. // ],
  7001. // "parameters": {
  7002. // "database": {
  7003. // "description": "Required. The database in which the new session is created.",
  7004. // "location": "path",
  7005. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  7006. // "required": true,
  7007. // "type": "string"
  7008. // }
  7009. // },
  7010. // "path": "v1/{+database}/sessions",
  7011. // "request": {
  7012. // "$ref": "CreateSessionRequest"
  7013. // },
  7014. // "response": {
  7015. // "$ref": "Session"
  7016. // },
  7017. // "scopes": [
  7018. // "https://www.googleapis.com/auth/cloud-platform",
  7019. // "https://www.googleapis.com/auth/spanner.data"
  7020. // ]
  7021. // }
  7022. }
  7023. // method id "spanner.projects.instances.databases.sessions.delete":
  7024. type ProjectsInstancesDatabasesSessionsDeleteCall struct {
  7025. s *Service
  7026. name string
  7027. urlParams_ gensupport.URLParams
  7028. ctx_ context.Context
  7029. header_ http.Header
  7030. }
  7031. // Delete: Ends a session, releasing server resources associated with
  7032. // it.
  7033. func (r *ProjectsInstancesDatabasesSessionsService) Delete(name string) *ProjectsInstancesDatabasesSessionsDeleteCall {
  7034. c := &ProjectsInstancesDatabasesSessionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7035. c.name = name
  7036. return c
  7037. }
  7038. // Fields allows partial responses to be retrieved. See
  7039. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7040. // for more information.
  7041. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsDeleteCall {
  7042. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7043. return c
  7044. }
  7045. // Context sets the context to be used in this call's Do method. Any
  7046. // pending HTTP request will be aborted if the provided context is
  7047. // canceled.
  7048. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsDeleteCall {
  7049. c.ctx_ = ctx
  7050. return c
  7051. }
  7052. // Header returns an http.Header that can be modified by the caller to
  7053. // add HTTP headers to the request.
  7054. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Header() http.Header {
  7055. if c.header_ == nil {
  7056. c.header_ = make(http.Header)
  7057. }
  7058. return c.header_
  7059. }
  7060. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7061. reqHeaders := make(http.Header)
  7062. for k, v := range c.header_ {
  7063. reqHeaders[k] = v
  7064. }
  7065. reqHeaders.Set("User-Agent", c.s.userAgent())
  7066. var body io.Reader = nil
  7067. c.urlParams_.Set("alt", alt)
  7068. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  7069. urls += "?" + c.urlParams_.Encode()
  7070. req, _ := http.NewRequest("DELETE", urls, body)
  7071. req.Header = reqHeaders
  7072. googleapi.Expand(req.URL, map[string]string{
  7073. "name": c.name,
  7074. })
  7075. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7076. }
  7077. // Do executes the "spanner.projects.instances.databases.sessions.delete" call.
  7078. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7079. // code is an error. Response headers are in either
  7080. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7081. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7082. // check whether the returned error was because http.StatusNotModified
  7083. // was returned.
  7084. func (c *ProjectsInstancesDatabasesSessionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7085. gensupport.SetOptions(c.urlParams_, opts...)
  7086. res, err := c.doRequest("json")
  7087. if res != nil && res.StatusCode == http.StatusNotModified {
  7088. if res.Body != nil {
  7089. res.Body.Close()
  7090. }
  7091. return nil, &googleapi.Error{
  7092. Code: res.StatusCode,
  7093. Header: res.Header,
  7094. }
  7095. }
  7096. if err != nil {
  7097. return nil, err
  7098. }
  7099. defer googleapi.CloseBody(res)
  7100. if err := googleapi.CheckResponse(res); err != nil {
  7101. return nil, err
  7102. }
  7103. ret := &Empty{
  7104. ServerResponse: googleapi.ServerResponse{
  7105. Header: res.Header,
  7106. HTTPStatusCode: res.StatusCode,
  7107. },
  7108. }
  7109. target := &ret
  7110. if err := gensupport.DecodeResponse(target, res); err != nil {
  7111. return nil, err
  7112. }
  7113. return ret, nil
  7114. // {
  7115. // "description": "Ends a session, releasing server resources associated with it.",
  7116. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}",
  7117. // "httpMethod": "DELETE",
  7118. // "id": "spanner.projects.instances.databases.sessions.delete",
  7119. // "parameterOrder": [
  7120. // "name"
  7121. // ],
  7122. // "parameters": {
  7123. // "name": {
  7124. // "description": "Required. The name of the session to delete.",
  7125. // "location": "path",
  7126. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7127. // "required": true,
  7128. // "type": "string"
  7129. // }
  7130. // },
  7131. // "path": "v1/{+name}",
  7132. // "response": {
  7133. // "$ref": "Empty"
  7134. // },
  7135. // "scopes": [
  7136. // "https://www.googleapis.com/auth/cloud-platform",
  7137. // "https://www.googleapis.com/auth/spanner.data"
  7138. // ]
  7139. // }
  7140. }
  7141. // method id "spanner.projects.instances.databases.sessions.executeSql":
  7142. type ProjectsInstancesDatabasesSessionsExecuteSqlCall struct {
  7143. s *Service
  7144. session string
  7145. executesqlrequest *ExecuteSqlRequest
  7146. urlParams_ gensupport.URLParams
  7147. ctx_ context.Context
  7148. header_ http.Header
  7149. }
  7150. // ExecuteSql: Executes an SQL statement, returning all results in a
  7151. // single reply. This
  7152. // method cannot be used to return a result set larger than 10 MiB;
  7153. // if the query yields more data than that, the query fails with
  7154. // a `FAILED_PRECONDITION` error.
  7155. //
  7156. // Operations inside read-write transactions might return `ABORTED`.
  7157. // If
  7158. // this occurs, the application should restart the transaction from
  7159. // the beginning. See Transaction for more details.
  7160. //
  7161. // Larger result sets can be fetched in streaming fashion by
  7162. // calling
  7163. // ExecuteStreamingSql instead.
  7164. func (r *ProjectsInstancesDatabasesSessionsService) ExecuteSql(session string, executesqlrequest *ExecuteSqlRequest) *ProjectsInstancesDatabasesSessionsExecuteSqlCall {
  7165. c := &ProjectsInstancesDatabasesSessionsExecuteSqlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7166. c.session = session
  7167. c.executesqlrequest = executesqlrequest
  7168. return c
  7169. }
  7170. // Fields allows partial responses to be retrieved. See
  7171. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7172. // for more information.
  7173. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsExecuteSqlCall {
  7174. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7175. return c
  7176. }
  7177. // Context sets the context to be used in this call's Do method. Any
  7178. // pending HTTP request will be aborted if the provided context is
  7179. // canceled.
  7180. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsExecuteSqlCall {
  7181. c.ctx_ = ctx
  7182. return c
  7183. }
  7184. // Header returns an http.Header that can be modified by the caller to
  7185. // add HTTP headers to the request.
  7186. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Header() http.Header {
  7187. if c.header_ == nil {
  7188. c.header_ = make(http.Header)
  7189. }
  7190. return c.header_
  7191. }
  7192. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) doRequest(alt string) (*http.Response, error) {
  7193. reqHeaders := make(http.Header)
  7194. for k, v := range c.header_ {
  7195. reqHeaders[k] = v
  7196. }
  7197. reqHeaders.Set("User-Agent", c.s.userAgent())
  7198. var body io.Reader = nil
  7199. body, err := googleapi.WithoutDataWrapper.JSONReader(c.executesqlrequest)
  7200. if err != nil {
  7201. return nil, err
  7202. }
  7203. reqHeaders.Set("Content-Type", "application/json")
  7204. c.urlParams_.Set("alt", alt)
  7205. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:executeSql")
  7206. urls += "?" + c.urlParams_.Encode()
  7207. req, _ := http.NewRequest("POST", urls, body)
  7208. req.Header = reqHeaders
  7209. googleapi.Expand(req.URL, map[string]string{
  7210. "session": c.session,
  7211. })
  7212. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7213. }
  7214. // Do executes the "spanner.projects.instances.databases.sessions.executeSql" call.
  7215. // Exactly one of *ResultSet or error will be non-nil. Any non-2xx
  7216. // status code is an error. Response headers are in either
  7217. // *ResultSet.ServerResponse.Header or (if a response was returned at
  7218. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7219. // to check whether the returned error was because
  7220. // http.StatusNotModified was returned.
  7221. func (c *ProjectsInstancesDatabasesSessionsExecuteSqlCall) Do(opts ...googleapi.CallOption) (*ResultSet, error) {
  7222. gensupport.SetOptions(c.urlParams_, opts...)
  7223. res, err := c.doRequest("json")
  7224. if res != nil && res.StatusCode == http.StatusNotModified {
  7225. if res.Body != nil {
  7226. res.Body.Close()
  7227. }
  7228. return nil, &googleapi.Error{
  7229. Code: res.StatusCode,
  7230. Header: res.Header,
  7231. }
  7232. }
  7233. if err != nil {
  7234. return nil, err
  7235. }
  7236. defer googleapi.CloseBody(res)
  7237. if err := googleapi.CheckResponse(res); err != nil {
  7238. return nil, err
  7239. }
  7240. ret := &ResultSet{
  7241. ServerResponse: googleapi.ServerResponse{
  7242. Header: res.Header,
  7243. HTTPStatusCode: res.StatusCode,
  7244. },
  7245. }
  7246. target := &ret
  7247. if err := gensupport.DecodeResponse(target, res); err != nil {
  7248. return nil, err
  7249. }
  7250. return ret, nil
  7251. // {
  7252. // "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.",
  7253. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:executeSql",
  7254. // "httpMethod": "POST",
  7255. // "id": "spanner.projects.instances.databases.sessions.executeSql",
  7256. // "parameterOrder": [
  7257. // "session"
  7258. // ],
  7259. // "parameters": {
  7260. // "session": {
  7261. // "description": "Required. The session in which the SQL query should be performed.",
  7262. // "location": "path",
  7263. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7264. // "required": true,
  7265. // "type": "string"
  7266. // }
  7267. // },
  7268. // "path": "v1/{+session}:executeSql",
  7269. // "request": {
  7270. // "$ref": "ExecuteSqlRequest"
  7271. // },
  7272. // "response": {
  7273. // "$ref": "ResultSet"
  7274. // },
  7275. // "scopes": [
  7276. // "https://www.googleapis.com/auth/cloud-platform",
  7277. // "https://www.googleapis.com/auth/spanner.data"
  7278. // ]
  7279. // }
  7280. }
  7281. // method id "spanner.projects.instances.databases.sessions.executeStreamingSql":
  7282. type ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall struct {
  7283. s *Service
  7284. session string
  7285. executesqlrequest *ExecuteSqlRequest
  7286. urlParams_ gensupport.URLParams
  7287. ctx_ context.Context
  7288. header_ http.Header
  7289. }
  7290. // ExecuteStreamingSql: Like ExecuteSql, except returns the result
  7291. // set as a stream. Unlike ExecuteSql, there
  7292. // is no limit on the size of the returned result set. However,
  7293. // no
  7294. // individual row in the result set can exceed 100 MiB, and no
  7295. // column value can exceed 10 MiB.
  7296. func (r *ProjectsInstancesDatabasesSessionsService) ExecuteStreamingSql(session string, executesqlrequest *ExecuteSqlRequest) *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall {
  7297. c := &ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7298. c.session = session
  7299. c.executesqlrequest = executesqlrequest
  7300. return c
  7301. }
  7302. // Fields allows partial responses to be retrieved. See
  7303. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7304. // for more information.
  7305. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall {
  7306. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7307. return c
  7308. }
  7309. // Context sets the context to be used in this call's Do method. Any
  7310. // pending HTTP request will be aborted if the provided context is
  7311. // canceled.
  7312. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall {
  7313. c.ctx_ = ctx
  7314. return c
  7315. }
  7316. // Header returns an http.Header that can be modified by the caller to
  7317. // add HTTP headers to the request.
  7318. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Header() http.Header {
  7319. if c.header_ == nil {
  7320. c.header_ = make(http.Header)
  7321. }
  7322. return c.header_
  7323. }
  7324. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) doRequest(alt string) (*http.Response, error) {
  7325. reqHeaders := make(http.Header)
  7326. for k, v := range c.header_ {
  7327. reqHeaders[k] = v
  7328. }
  7329. reqHeaders.Set("User-Agent", c.s.userAgent())
  7330. var body io.Reader = nil
  7331. body, err := googleapi.WithoutDataWrapper.JSONReader(c.executesqlrequest)
  7332. if err != nil {
  7333. return nil, err
  7334. }
  7335. reqHeaders.Set("Content-Type", "application/json")
  7336. c.urlParams_.Set("alt", alt)
  7337. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:executeStreamingSql")
  7338. urls += "?" + c.urlParams_.Encode()
  7339. req, _ := http.NewRequest("POST", urls, body)
  7340. req.Header = reqHeaders
  7341. googleapi.Expand(req.URL, map[string]string{
  7342. "session": c.session,
  7343. })
  7344. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7345. }
  7346. // Do executes the "spanner.projects.instances.databases.sessions.executeStreamingSql" call.
  7347. // Exactly one of *PartialResultSet or error will be non-nil. Any
  7348. // non-2xx status code is an error. Response headers are in either
  7349. // *PartialResultSet.ServerResponse.Header or (if a response was
  7350. // returned at all) in error.(*googleapi.Error).Header. Use
  7351. // googleapi.IsNotModified to check whether the returned error was
  7352. // because http.StatusNotModified was returned.
  7353. func (c *ProjectsInstancesDatabasesSessionsExecuteStreamingSqlCall) Do(opts ...googleapi.CallOption) (*PartialResultSet, error) {
  7354. gensupport.SetOptions(c.urlParams_, opts...)
  7355. res, err := c.doRequest("json")
  7356. if res != nil && res.StatusCode == http.StatusNotModified {
  7357. if res.Body != nil {
  7358. res.Body.Close()
  7359. }
  7360. return nil, &googleapi.Error{
  7361. Code: res.StatusCode,
  7362. Header: res.Header,
  7363. }
  7364. }
  7365. if err != nil {
  7366. return nil, err
  7367. }
  7368. defer googleapi.CloseBody(res)
  7369. if err := googleapi.CheckResponse(res); err != nil {
  7370. return nil, err
  7371. }
  7372. ret := &PartialResultSet{
  7373. ServerResponse: googleapi.ServerResponse{
  7374. Header: res.Header,
  7375. HTTPStatusCode: res.StatusCode,
  7376. },
  7377. }
  7378. target := &ret
  7379. if err := gensupport.DecodeResponse(target, res); err != nil {
  7380. return nil, err
  7381. }
  7382. return ret, nil
  7383. // {
  7384. // "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.",
  7385. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:executeStreamingSql",
  7386. // "httpMethod": "POST",
  7387. // "id": "spanner.projects.instances.databases.sessions.executeStreamingSql",
  7388. // "parameterOrder": [
  7389. // "session"
  7390. // ],
  7391. // "parameters": {
  7392. // "session": {
  7393. // "description": "Required. The session in which the SQL query should be performed.",
  7394. // "location": "path",
  7395. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7396. // "required": true,
  7397. // "type": "string"
  7398. // }
  7399. // },
  7400. // "path": "v1/{+session}:executeStreamingSql",
  7401. // "request": {
  7402. // "$ref": "ExecuteSqlRequest"
  7403. // },
  7404. // "response": {
  7405. // "$ref": "PartialResultSet"
  7406. // },
  7407. // "scopes": [
  7408. // "https://www.googleapis.com/auth/cloud-platform",
  7409. // "https://www.googleapis.com/auth/spanner.data"
  7410. // ]
  7411. // }
  7412. }
  7413. // method id "spanner.projects.instances.databases.sessions.get":
  7414. type ProjectsInstancesDatabasesSessionsGetCall struct {
  7415. s *Service
  7416. name string
  7417. urlParams_ gensupport.URLParams
  7418. ifNoneMatch_ string
  7419. ctx_ context.Context
  7420. header_ http.Header
  7421. }
  7422. // Get: Gets a session. Returns `NOT_FOUND` if the session does not
  7423. // exist.
  7424. // This is mainly useful for determining whether a session is
  7425. // still
  7426. // alive.
  7427. func (r *ProjectsInstancesDatabasesSessionsService) Get(name string) *ProjectsInstancesDatabasesSessionsGetCall {
  7428. c := &ProjectsInstancesDatabasesSessionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7429. c.name = name
  7430. return c
  7431. }
  7432. // Fields allows partial responses to be retrieved. See
  7433. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7434. // for more information.
  7435. func (c *ProjectsInstancesDatabasesSessionsGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsGetCall {
  7436. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7437. return c
  7438. }
  7439. // IfNoneMatch sets the optional parameter which makes the operation
  7440. // fail if the object's ETag matches the given value. This is useful for
  7441. // getting updates only after the object has changed since the last
  7442. // request. Use googleapi.IsNotModified to check whether the response
  7443. // error from Do is the result of In-None-Match.
  7444. func (c *ProjectsInstancesDatabasesSessionsGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesSessionsGetCall {
  7445. c.ifNoneMatch_ = entityTag
  7446. return c
  7447. }
  7448. // Context sets the context to be used in this call's Do method. Any
  7449. // pending HTTP request will be aborted if the provided context is
  7450. // canceled.
  7451. func (c *ProjectsInstancesDatabasesSessionsGetCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsGetCall {
  7452. c.ctx_ = ctx
  7453. return c
  7454. }
  7455. // Header returns an http.Header that can be modified by the caller to
  7456. // add HTTP headers to the request.
  7457. func (c *ProjectsInstancesDatabasesSessionsGetCall) Header() http.Header {
  7458. if c.header_ == nil {
  7459. c.header_ = make(http.Header)
  7460. }
  7461. return c.header_
  7462. }
  7463. func (c *ProjectsInstancesDatabasesSessionsGetCall) doRequest(alt string) (*http.Response, error) {
  7464. reqHeaders := make(http.Header)
  7465. for k, v := range c.header_ {
  7466. reqHeaders[k] = v
  7467. }
  7468. reqHeaders.Set("User-Agent", c.s.userAgent())
  7469. if c.ifNoneMatch_ != "" {
  7470. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7471. }
  7472. var body io.Reader = nil
  7473. c.urlParams_.Set("alt", alt)
  7474. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  7475. urls += "?" + c.urlParams_.Encode()
  7476. req, _ := http.NewRequest("GET", urls, body)
  7477. req.Header = reqHeaders
  7478. googleapi.Expand(req.URL, map[string]string{
  7479. "name": c.name,
  7480. })
  7481. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7482. }
  7483. // Do executes the "spanner.projects.instances.databases.sessions.get" call.
  7484. // Exactly one of *Session or error will be non-nil. Any non-2xx status
  7485. // code is an error. Response headers are in either
  7486. // *Session.ServerResponse.Header or (if a response was returned at all)
  7487. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7488. // check whether the returned error was because http.StatusNotModified
  7489. // was returned.
  7490. func (c *ProjectsInstancesDatabasesSessionsGetCall) Do(opts ...googleapi.CallOption) (*Session, error) {
  7491. gensupport.SetOptions(c.urlParams_, opts...)
  7492. res, err := c.doRequest("json")
  7493. if res != nil && res.StatusCode == http.StatusNotModified {
  7494. if res.Body != nil {
  7495. res.Body.Close()
  7496. }
  7497. return nil, &googleapi.Error{
  7498. Code: res.StatusCode,
  7499. Header: res.Header,
  7500. }
  7501. }
  7502. if err != nil {
  7503. return nil, err
  7504. }
  7505. defer googleapi.CloseBody(res)
  7506. if err := googleapi.CheckResponse(res); err != nil {
  7507. return nil, err
  7508. }
  7509. ret := &Session{
  7510. ServerResponse: googleapi.ServerResponse{
  7511. Header: res.Header,
  7512. HTTPStatusCode: res.StatusCode,
  7513. },
  7514. }
  7515. target := &ret
  7516. if err := gensupport.DecodeResponse(target, res); err != nil {
  7517. return nil, err
  7518. }
  7519. return ret, nil
  7520. // {
  7521. // "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.",
  7522. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}",
  7523. // "httpMethod": "GET",
  7524. // "id": "spanner.projects.instances.databases.sessions.get",
  7525. // "parameterOrder": [
  7526. // "name"
  7527. // ],
  7528. // "parameters": {
  7529. // "name": {
  7530. // "description": "Required. The name of the session to retrieve.",
  7531. // "location": "path",
  7532. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7533. // "required": true,
  7534. // "type": "string"
  7535. // }
  7536. // },
  7537. // "path": "v1/{+name}",
  7538. // "response": {
  7539. // "$ref": "Session"
  7540. // },
  7541. // "scopes": [
  7542. // "https://www.googleapis.com/auth/cloud-platform",
  7543. // "https://www.googleapis.com/auth/spanner.data"
  7544. // ]
  7545. // }
  7546. }
  7547. // method id "spanner.projects.instances.databases.sessions.list":
  7548. type ProjectsInstancesDatabasesSessionsListCall struct {
  7549. s *Service
  7550. database string
  7551. urlParams_ gensupport.URLParams
  7552. ifNoneMatch_ string
  7553. ctx_ context.Context
  7554. header_ http.Header
  7555. }
  7556. // List: Lists all sessions in a given database.
  7557. func (r *ProjectsInstancesDatabasesSessionsService) List(database string) *ProjectsInstancesDatabasesSessionsListCall {
  7558. c := &ProjectsInstancesDatabasesSessionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7559. c.database = database
  7560. return c
  7561. }
  7562. // Filter sets the optional parameter "filter": An expression for
  7563. // filtering the results of the request. Filter rules are
  7564. // case insensitive. The fields eligible for filtering are:
  7565. //
  7566. // * `labels.key` where key is the name of a label
  7567. //
  7568. // Some examples of using filters are:
  7569. //
  7570. // * `labels.env:*` --> The session has the label "env".
  7571. // * `labels.env:dev` --> The session has the label "env" and the
  7572. // value of
  7573. // the label contains the string "dev".
  7574. func (c *ProjectsInstancesDatabasesSessionsListCall) Filter(filter string) *ProjectsInstancesDatabasesSessionsListCall {
  7575. c.urlParams_.Set("filter", filter)
  7576. return c
  7577. }
  7578. // PageSize sets the optional parameter "pageSize": Number of sessions
  7579. // to be returned in the response. If 0 or less, defaults
  7580. // to the server's maximum allowed page size.
  7581. func (c *ProjectsInstancesDatabasesSessionsListCall) PageSize(pageSize int64) *ProjectsInstancesDatabasesSessionsListCall {
  7582. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7583. return c
  7584. }
  7585. // PageToken sets the optional parameter "pageToken": If non-empty,
  7586. // `page_token` should contain a
  7587. // next_page_token from a previous
  7588. // ListSessionsResponse.
  7589. func (c *ProjectsInstancesDatabasesSessionsListCall) PageToken(pageToken string) *ProjectsInstancesDatabasesSessionsListCall {
  7590. c.urlParams_.Set("pageToken", pageToken)
  7591. return c
  7592. }
  7593. // Fields allows partial responses to be retrieved. See
  7594. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7595. // for more information.
  7596. func (c *ProjectsInstancesDatabasesSessionsListCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsListCall {
  7597. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7598. return c
  7599. }
  7600. // IfNoneMatch sets the optional parameter which makes the operation
  7601. // fail if the object's ETag matches the given value. This is useful for
  7602. // getting updates only after the object has changed since the last
  7603. // request. Use googleapi.IsNotModified to check whether the response
  7604. // error from Do is the result of In-None-Match.
  7605. func (c *ProjectsInstancesDatabasesSessionsListCall) IfNoneMatch(entityTag string) *ProjectsInstancesDatabasesSessionsListCall {
  7606. c.ifNoneMatch_ = entityTag
  7607. return c
  7608. }
  7609. // Context sets the context to be used in this call's Do method. Any
  7610. // pending HTTP request will be aborted if the provided context is
  7611. // canceled.
  7612. func (c *ProjectsInstancesDatabasesSessionsListCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsListCall {
  7613. c.ctx_ = ctx
  7614. return c
  7615. }
  7616. // Header returns an http.Header that can be modified by the caller to
  7617. // add HTTP headers to the request.
  7618. func (c *ProjectsInstancesDatabasesSessionsListCall) Header() http.Header {
  7619. if c.header_ == nil {
  7620. c.header_ = make(http.Header)
  7621. }
  7622. return c.header_
  7623. }
  7624. func (c *ProjectsInstancesDatabasesSessionsListCall) doRequest(alt string) (*http.Response, error) {
  7625. reqHeaders := make(http.Header)
  7626. for k, v := range c.header_ {
  7627. reqHeaders[k] = v
  7628. }
  7629. reqHeaders.Set("User-Agent", c.s.userAgent())
  7630. if c.ifNoneMatch_ != "" {
  7631. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7632. }
  7633. var body io.Reader = nil
  7634. c.urlParams_.Set("alt", alt)
  7635. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+database}/sessions")
  7636. urls += "?" + c.urlParams_.Encode()
  7637. req, _ := http.NewRequest("GET", urls, body)
  7638. req.Header = reqHeaders
  7639. googleapi.Expand(req.URL, map[string]string{
  7640. "database": c.database,
  7641. })
  7642. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7643. }
  7644. // Do executes the "spanner.projects.instances.databases.sessions.list" call.
  7645. // Exactly one of *ListSessionsResponse or error will be non-nil. Any
  7646. // non-2xx status code is an error. Response headers are in either
  7647. // *ListSessionsResponse.ServerResponse.Header or (if a response was
  7648. // returned at all) in error.(*googleapi.Error).Header. Use
  7649. // googleapi.IsNotModified to check whether the returned error was
  7650. // because http.StatusNotModified was returned.
  7651. func (c *ProjectsInstancesDatabasesSessionsListCall) Do(opts ...googleapi.CallOption) (*ListSessionsResponse, error) {
  7652. gensupport.SetOptions(c.urlParams_, opts...)
  7653. res, err := c.doRequest("json")
  7654. if res != nil && res.StatusCode == http.StatusNotModified {
  7655. if res.Body != nil {
  7656. res.Body.Close()
  7657. }
  7658. return nil, &googleapi.Error{
  7659. Code: res.StatusCode,
  7660. Header: res.Header,
  7661. }
  7662. }
  7663. if err != nil {
  7664. return nil, err
  7665. }
  7666. defer googleapi.CloseBody(res)
  7667. if err := googleapi.CheckResponse(res); err != nil {
  7668. return nil, err
  7669. }
  7670. ret := &ListSessionsResponse{
  7671. ServerResponse: googleapi.ServerResponse{
  7672. Header: res.Header,
  7673. HTTPStatusCode: res.StatusCode,
  7674. },
  7675. }
  7676. target := &ret
  7677. if err := gensupport.DecodeResponse(target, res); err != nil {
  7678. return nil, err
  7679. }
  7680. return ret, nil
  7681. // {
  7682. // "description": "Lists all sessions in a given database.",
  7683. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions",
  7684. // "httpMethod": "GET",
  7685. // "id": "spanner.projects.instances.databases.sessions.list",
  7686. // "parameterOrder": [
  7687. // "database"
  7688. // ],
  7689. // "parameters": {
  7690. // "database": {
  7691. // "description": "Required. The database in which to list sessions.",
  7692. // "location": "path",
  7693. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+$",
  7694. // "required": true,
  7695. // "type": "string"
  7696. // },
  7697. // "filter": {
  7698. // "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\".",
  7699. // "location": "query",
  7700. // "type": "string"
  7701. // },
  7702. // "pageSize": {
  7703. // "description": "Number of sessions to be returned in the response. If 0 or less, defaults\nto the server's maximum allowed page size.",
  7704. // "format": "int32",
  7705. // "location": "query",
  7706. // "type": "integer"
  7707. // },
  7708. // "pageToken": {
  7709. // "description": "If non-empty, `page_token` should contain a\nnext_page_token from a previous\nListSessionsResponse.",
  7710. // "location": "query",
  7711. // "type": "string"
  7712. // }
  7713. // },
  7714. // "path": "v1/{+database}/sessions",
  7715. // "response": {
  7716. // "$ref": "ListSessionsResponse"
  7717. // },
  7718. // "scopes": [
  7719. // "https://www.googleapis.com/auth/cloud-platform",
  7720. // "https://www.googleapis.com/auth/spanner.data"
  7721. // ]
  7722. // }
  7723. }
  7724. // Pages invokes f for each page of results.
  7725. // A non-nil error returned from f will halt the iteration.
  7726. // The provided context supersedes any context provided to the Context method.
  7727. func (c *ProjectsInstancesDatabasesSessionsListCall) Pages(ctx context.Context, f func(*ListSessionsResponse) error) error {
  7728. c.ctx_ = ctx
  7729. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7730. for {
  7731. x, err := c.Do()
  7732. if err != nil {
  7733. return err
  7734. }
  7735. if err := f(x); err != nil {
  7736. return err
  7737. }
  7738. if x.NextPageToken == "" {
  7739. return nil
  7740. }
  7741. c.PageToken(x.NextPageToken)
  7742. }
  7743. }
  7744. // method id "spanner.projects.instances.databases.sessions.partitionQuery":
  7745. type ProjectsInstancesDatabasesSessionsPartitionQueryCall struct {
  7746. s *Service
  7747. session string
  7748. partitionqueryrequest *PartitionQueryRequest
  7749. urlParams_ gensupport.URLParams
  7750. ctx_ context.Context
  7751. header_ http.Header
  7752. }
  7753. // PartitionQuery: Creates a set of partition tokens that can be used to
  7754. // execute a query
  7755. // operation in parallel. Each of the returned partition tokens can be
  7756. // used
  7757. // by ExecuteStreamingSql to specify a subset
  7758. // of the query result to read. The same session and read-only
  7759. // transaction
  7760. // must be used by the PartitionQueryRequest used to create
  7761. // the
  7762. // partition tokens and the ExecuteSqlRequests that use the partition
  7763. // tokens.
  7764. // Partition tokens become invalid when the session used to create
  7765. // them
  7766. // is deleted or begins a new transaction.
  7767. func (r *ProjectsInstancesDatabasesSessionsService) PartitionQuery(session string, partitionqueryrequest *PartitionQueryRequest) *ProjectsInstancesDatabasesSessionsPartitionQueryCall {
  7768. c := &ProjectsInstancesDatabasesSessionsPartitionQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7769. c.session = session
  7770. c.partitionqueryrequest = partitionqueryrequest
  7771. return c
  7772. }
  7773. // Fields allows partial responses to be retrieved. See
  7774. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7775. // for more information.
  7776. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsPartitionQueryCall {
  7777. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7778. return c
  7779. }
  7780. // Context sets the context to be used in this call's Do method. Any
  7781. // pending HTTP request will be aborted if the provided context is
  7782. // canceled.
  7783. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsPartitionQueryCall {
  7784. c.ctx_ = ctx
  7785. return c
  7786. }
  7787. // Header returns an http.Header that can be modified by the caller to
  7788. // add HTTP headers to the request.
  7789. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Header() http.Header {
  7790. if c.header_ == nil {
  7791. c.header_ = make(http.Header)
  7792. }
  7793. return c.header_
  7794. }
  7795. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) doRequest(alt string) (*http.Response, error) {
  7796. reqHeaders := make(http.Header)
  7797. for k, v := range c.header_ {
  7798. reqHeaders[k] = v
  7799. }
  7800. reqHeaders.Set("User-Agent", c.s.userAgent())
  7801. var body io.Reader = nil
  7802. body, err := googleapi.WithoutDataWrapper.JSONReader(c.partitionqueryrequest)
  7803. if err != nil {
  7804. return nil, err
  7805. }
  7806. reqHeaders.Set("Content-Type", "application/json")
  7807. c.urlParams_.Set("alt", alt)
  7808. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:partitionQuery")
  7809. urls += "?" + c.urlParams_.Encode()
  7810. req, _ := http.NewRequest("POST", urls, body)
  7811. req.Header = reqHeaders
  7812. googleapi.Expand(req.URL, map[string]string{
  7813. "session": c.session,
  7814. })
  7815. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7816. }
  7817. // Do executes the "spanner.projects.instances.databases.sessions.partitionQuery" call.
  7818. // Exactly one of *PartitionResponse or error will be non-nil. Any
  7819. // non-2xx status code is an error. Response headers are in either
  7820. // *PartitionResponse.ServerResponse.Header or (if a response was
  7821. // returned at all) in error.(*googleapi.Error).Header. Use
  7822. // googleapi.IsNotModified to check whether the returned error was
  7823. // because http.StatusNotModified was returned.
  7824. func (c *ProjectsInstancesDatabasesSessionsPartitionQueryCall) Do(opts ...googleapi.CallOption) (*PartitionResponse, error) {
  7825. gensupport.SetOptions(c.urlParams_, opts...)
  7826. res, err := c.doRequest("json")
  7827. if res != nil && res.StatusCode == http.StatusNotModified {
  7828. if res.Body != nil {
  7829. res.Body.Close()
  7830. }
  7831. return nil, &googleapi.Error{
  7832. Code: res.StatusCode,
  7833. Header: res.Header,
  7834. }
  7835. }
  7836. if err != nil {
  7837. return nil, err
  7838. }
  7839. defer googleapi.CloseBody(res)
  7840. if err := googleapi.CheckResponse(res); err != nil {
  7841. return nil, err
  7842. }
  7843. ret := &PartitionResponse{
  7844. ServerResponse: googleapi.ServerResponse{
  7845. Header: res.Header,
  7846. HTTPStatusCode: res.StatusCode,
  7847. },
  7848. }
  7849. target := &ret
  7850. if err := gensupport.DecodeResponse(target, res); err != nil {
  7851. return nil, err
  7852. }
  7853. return ret, nil
  7854. // {
  7855. // "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.\nPartition tokens become invalid when the session used to create them\nis deleted or begins a new transaction.",
  7856. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:partitionQuery",
  7857. // "httpMethod": "POST",
  7858. // "id": "spanner.projects.instances.databases.sessions.partitionQuery",
  7859. // "parameterOrder": [
  7860. // "session"
  7861. // ],
  7862. // "parameters": {
  7863. // "session": {
  7864. // "description": "Required. The session used to create the partitions.",
  7865. // "location": "path",
  7866. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  7867. // "required": true,
  7868. // "type": "string"
  7869. // }
  7870. // },
  7871. // "path": "v1/{+session}:partitionQuery",
  7872. // "request": {
  7873. // "$ref": "PartitionQueryRequest"
  7874. // },
  7875. // "response": {
  7876. // "$ref": "PartitionResponse"
  7877. // },
  7878. // "scopes": [
  7879. // "https://www.googleapis.com/auth/cloud-platform",
  7880. // "https://www.googleapis.com/auth/spanner.data"
  7881. // ]
  7882. // }
  7883. }
  7884. // method id "spanner.projects.instances.databases.sessions.partitionRead":
  7885. type ProjectsInstancesDatabasesSessionsPartitionReadCall struct {
  7886. s *Service
  7887. session string
  7888. partitionreadrequest *PartitionReadRequest
  7889. urlParams_ gensupport.URLParams
  7890. ctx_ context.Context
  7891. header_ http.Header
  7892. }
  7893. // PartitionRead: Creates a set of partition tokens that can be used to
  7894. // execute a read
  7895. // operation in parallel. Each of the returned partition tokens can be
  7896. // used
  7897. // by StreamingRead to specify a subset of the read
  7898. // result to read. The same session and read-only transaction must be
  7899. // used by
  7900. // the PartitionReadRequest used to create the partition tokens and
  7901. // the
  7902. // ReadRequests that use the partition tokens.
  7903. // Partition tokens become invalid when the session used to create
  7904. // them
  7905. // is deleted or begins a new transaction.
  7906. func (r *ProjectsInstancesDatabasesSessionsService) PartitionRead(session string, partitionreadrequest *PartitionReadRequest) *ProjectsInstancesDatabasesSessionsPartitionReadCall {
  7907. c := &ProjectsInstancesDatabasesSessionsPartitionReadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7908. c.session = session
  7909. c.partitionreadrequest = partitionreadrequest
  7910. return c
  7911. }
  7912. // Fields allows partial responses to be retrieved. See
  7913. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7914. // for more information.
  7915. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsPartitionReadCall {
  7916. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7917. return c
  7918. }
  7919. // Context sets the context to be used in this call's Do method. Any
  7920. // pending HTTP request will be aborted if the provided context is
  7921. // canceled.
  7922. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsPartitionReadCall {
  7923. c.ctx_ = ctx
  7924. return c
  7925. }
  7926. // Header returns an http.Header that can be modified by the caller to
  7927. // add HTTP headers to the request.
  7928. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Header() http.Header {
  7929. if c.header_ == nil {
  7930. c.header_ = make(http.Header)
  7931. }
  7932. return c.header_
  7933. }
  7934. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) doRequest(alt string) (*http.Response, error) {
  7935. reqHeaders := make(http.Header)
  7936. for k, v := range c.header_ {
  7937. reqHeaders[k] = v
  7938. }
  7939. reqHeaders.Set("User-Agent", c.s.userAgent())
  7940. var body io.Reader = nil
  7941. body, err := googleapi.WithoutDataWrapper.JSONReader(c.partitionreadrequest)
  7942. if err != nil {
  7943. return nil, err
  7944. }
  7945. reqHeaders.Set("Content-Type", "application/json")
  7946. c.urlParams_.Set("alt", alt)
  7947. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:partitionRead")
  7948. urls += "?" + c.urlParams_.Encode()
  7949. req, _ := http.NewRequest("POST", urls, body)
  7950. req.Header = reqHeaders
  7951. googleapi.Expand(req.URL, map[string]string{
  7952. "session": c.session,
  7953. })
  7954. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7955. }
  7956. // Do executes the "spanner.projects.instances.databases.sessions.partitionRead" call.
  7957. // Exactly one of *PartitionResponse or error will be non-nil. Any
  7958. // non-2xx status code is an error. Response headers are in either
  7959. // *PartitionResponse.ServerResponse.Header or (if a response was
  7960. // returned at all) in error.(*googleapi.Error).Header. Use
  7961. // googleapi.IsNotModified to check whether the returned error was
  7962. // because http.StatusNotModified was returned.
  7963. func (c *ProjectsInstancesDatabasesSessionsPartitionReadCall) Do(opts ...googleapi.CallOption) (*PartitionResponse, error) {
  7964. gensupport.SetOptions(c.urlParams_, opts...)
  7965. res, err := c.doRequest("json")
  7966. if res != nil && res.StatusCode == http.StatusNotModified {
  7967. if res.Body != nil {
  7968. res.Body.Close()
  7969. }
  7970. return nil, &googleapi.Error{
  7971. Code: res.StatusCode,
  7972. Header: res.Header,
  7973. }
  7974. }
  7975. if err != nil {
  7976. return nil, err
  7977. }
  7978. defer googleapi.CloseBody(res)
  7979. if err := googleapi.CheckResponse(res); err != nil {
  7980. return nil, err
  7981. }
  7982. ret := &PartitionResponse{
  7983. ServerResponse: googleapi.ServerResponse{
  7984. Header: res.Header,
  7985. HTTPStatusCode: res.StatusCode,
  7986. },
  7987. }
  7988. target := &ret
  7989. if err := gensupport.DecodeResponse(target, res); err != nil {
  7990. return nil, err
  7991. }
  7992. return ret, nil
  7993. // {
  7994. // "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.\nPartition tokens become invalid when the session used to create them\nis deleted or begins a new transaction.",
  7995. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:partitionRead",
  7996. // "httpMethod": "POST",
  7997. // "id": "spanner.projects.instances.databases.sessions.partitionRead",
  7998. // "parameterOrder": [
  7999. // "session"
  8000. // ],
  8001. // "parameters": {
  8002. // "session": {
  8003. // "description": "Required. The session used to create the partitions.",
  8004. // "location": "path",
  8005. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8006. // "required": true,
  8007. // "type": "string"
  8008. // }
  8009. // },
  8010. // "path": "v1/{+session}:partitionRead",
  8011. // "request": {
  8012. // "$ref": "PartitionReadRequest"
  8013. // },
  8014. // "response": {
  8015. // "$ref": "PartitionResponse"
  8016. // },
  8017. // "scopes": [
  8018. // "https://www.googleapis.com/auth/cloud-platform",
  8019. // "https://www.googleapis.com/auth/spanner.data"
  8020. // ]
  8021. // }
  8022. }
  8023. // method id "spanner.projects.instances.databases.sessions.read":
  8024. type ProjectsInstancesDatabasesSessionsReadCall struct {
  8025. s *Service
  8026. session string
  8027. readrequest *ReadRequest
  8028. urlParams_ gensupport.URLParams
  8029. ctx_ context.Context
  8030. header_ http.Header
  8031. }
  8032. // Read: Reads rows from the database using key lookups and scans, as
  8033. // a
  8034. // simple key/value style alternative to
  8035. // ExecuteSql. This method cannot be used to
  8036. // return a result set larger than 10 MiB; if the read matches more
  8037. // data than that, the read fails with a
  8038. // `FAILED_PRECONDITION`
  8039. // error.
  8040. //
  8041. // Reads inside read-write transactions might return `ABORTED`. If
  8042. // this occurs, the application should restart the transaction from
  8043. // the beginning. See Transaction for more details.
  8044. //
  8045. // Larger result sets can be yielded in streaming fashion by
  8046. // calling
  8047. // StreamingRead instead.
  8048. func (r *ProjectsInstancesDatabasesSessionsService) Read(session string, readrequest *ReadRequest) *ProjectsInstancesDatabasesSessionsReadCall {
  8049. c := &ProjectsInstancesDatabasesSessionsReadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8050. c.session = session
  8051. c.readrequest = readrequest
  8052. return c
  8053. }
  8054. // Fields allows partial responses to be retrieved. See
  8055. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8056. // for more information.
  8057. func (c *ProjectsInstancesDatabasesSessionsReadCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsReadCall {
  8058. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8059. return c
  8060. }
  8061. // Context sets the context to be used in this call's Do method. Any
  8062. // pending HTTP request will be aborted if the provided context is
  8063. // canceled.
  8064. func (c *ProjectsInstancesDatabasesSessionsReadCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsReadCall {
  8065. c.ctx_ = ctx
  8066. return c
  8067. }
  8068. // Header returns an http.Header that can be modified by the caller to
  8069. // add HTTP headers to the request.
  8070. func (c *ProjectsInstancesDatabasesSessionsReadCall) Header() http.Header {
  8071. if c.header_ == nil {
  8072. c.header_ = make(http.Header)
  8073. }
  8074. return c.header_
  8075. }
  8076. func (c *ProjectsInstancesDatabasesSessionsReadCall) doRequest(alt string) (*http.Response, error) {
  8077. reqHeaders := make(http.Header)
  8078. for k, v := range c.header_ {
  8079. reqHeaders[k] = v
  8080. }
  8081. reqHeaders.Set("User-Agent", c.s.userAgent())
  8082. var body io.Reader = nil
  8083. body, err := googleapi.WithoutDataWrapper.JSONReader(c.readrequest)
  8084. if err != nil {
  8085. return nil, err
  8086. }
  8087. reqHeaders.Set("Content-Type", "application/json")
  8088. c.urlParams_.Set("alt", alt)
  8089. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:read")
  8090. urls += "?" + c.urlParams_.Encode()
  8091. req, _ := http.NewRequest("POST", urls, body)
  8092. req.Header = reqHeaders
  8093. googleapi.Expand(req.URL, map[string]string{
  8094. "session": c.session,
  8095. })
  8096. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8097. }
  8098. // Do executes the "spanner.projects.instances.databases.sessions.read" call.
  8099. // Exactly one of *ResultSet or error will be non-nil. Any non-2xx
  8100. // status code is an error. Response headers are in either
  8101. // *ResultSet.ServerResponse.Header or (if a response was returned at
  8102. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8103. // to check whether the returned error was because
  8104. // http.StatusNotModified was returned.
  8105. func (c *ProjectsInstancesDatabasesSessionsReadCall) Do(opts ...googleapi.CallOption) (*ResultSet, error) {
  8106. gensupport.SetOptions(c.urlParams_, opts...)
  8107. res, err := c.doRequest("json")
  8108. if res != nil && res.StatusCode == http.StatusNotModified {
  8109. if res.Body != nil {
  8110. res.Body.Close()
  8111. }
  8112. return nil, &googleapi.Error{
  8113. Code: res.StatusCode,
  8114. Header: res.Header,
  8115. }
  8116. }
  8117. if err != nil {
  8118. return nil, err
  8119. }
  8120. defer googleapi.CloseBody(res)
  8121. if err := googleapi.CheckResponse(res); err != nil {
  8122. return nil, err
  8123. }
  8124. ret := &ResultSet{
  8125. ServerResponse: googleapi.ServerResponse{
  8126. Header: res.Header,
  8127. HTTPStatusCode: res.StatusCode,
  8128. },
  8129. }
  8130. target := &ret
  8131. if err := gensupport.DecodeResponse(target, res); err != nil {
  8132. return nil, err
  8133. }
  8134. return ret, nil
  8135. // {
  8136. // "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.",
  8137. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:read",
  8138. // "httpMethod": "POST",
  8139. // "id": "spanner.projects.instances.databases.sessions.read",
  8140. // "parameterOrder": [
  8141. // "session"
  8142. // ],
  8143. // "parameters": {
  8144. // "session": {
  8145. // "description": "Required. The session in which the read should be performed.",
  8146. // "location": "path",
  8147. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8148. // "required": true,
  8149. // "type": "string"
  8150. // }
  8151. // },
  8152. // "path": "v1/{+session}:read",
  8153. // "request": {
  8154. // "$ref": "ReadRequest"
  8155. // },
  8156. // "response": {
  8157. // "$ref": "ResultSet"
  8158. // },
  8159. // "scopes": [
  8160. // "https://www.googleapis.com/auth/cloud-platform",
  8161. // "https://www.googleapis.com/auth/spanner.data"
  8162. // ]
  8163. // }
  8164. }
  8165. // method id "spanner.projects.instances.databases.sessions.rollback":
  8166. type ProjectsInstancesDatabasesSessionsRollbackCall struct {
  8167. s *Service
  8168. session string
  8169. rollbackrequest *RollbackRequest
  8170. urlParams_ gensupport.URLParams
  8171. ctx_ context.Context
  8172. header_ http.Header
  8173. }
  8174. // Rollback: Rolls back a transaction, releasing any locks it holds. It
  8175. // is a good
  8176. // idea to call this for any transaction that includes one or more
  8177. // Read or ExecuteSql requests and
  8178. // ultimately decides not to commit.
  8179. //
  8180. // `Rollback` returns `OK` if it successfully aborts the transaction,
  8181. // the
  8182. // transaction was already aborted, or the transaction is not
  8183. // found. `Rollback` never returns `ABORTED`.
  8184. func (r *ProjectsInstancesDatabasesSessionsService) Rollback(session string, rollbackrequest *RollbackRequest) *ProjectsInstancesDatabasesSessionsRollbackCall {
  8185. c := &ProjectsInstancesDatabasesSessionsRollbackCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8186. c.session = session
  8187. c.rollbackrequest = rollbackrequest
  8188. return c
  8189. }
  8190. // Fields allows partial responses to be retrieved. See
  8191. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8192. // for more information.
  8193. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsRollbackCall {
  8194. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8195. return c
  8196. }
  8197. // Context sets the context to be used in this call's Do method. Any
  8198. // pending HTTP request will be aborted if the provided context is
  8199. // canceled.
  8200. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsRollbackCall {
  8201. c.ctx_ = ctx
  8202. return c
  8203. }
  8204. // Header returns an http.Header that can be modified by the caller to
  8205. // add HTTP headers to the request.
  8206. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Header() http.Header {
  8207. if c.header_ == nil {
  8208. c.header_ = make(http.Header)
  8209. }
  8210. return c.header_
  8211. }
  8212. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) doRequest(alt string) (*http.Response, error) {
  8213. reqHeaders := make(http.Header)
  8214. for k, v := range c.header_ {
  8215. reqHeaders[k] = v
  8216. }
  8217. reqHeaders.Set("User-Agent", c.s.userAgent())
  8218. var body io.Reader = nil
  8219. body, err := googleapi.WithoutDataWrapper.JSONReader(c.rollbackrequest)
  8220. if err != nil {
  8221. return nil, err
  8222. }
  8223. reqHeaders.Set("Content-Type", "application/json")
  8224. c.urlParams_.Set("alt", alt)
  8225. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:rollback")
  8226. urls += "?" + c.urlParams_.Encode()
  8227. req, _ := http.NewRequest("POST", urls, body)
  8228. req.Header = reqHeaders
  8229. googleapi.Expand(req.URL, map[string]string{
  8230. "session": c.session,
  8231. })
  8232. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8233. }
  8234. // Do executes the "spanner.projects.instances.databases.sessions.rollback" call.
  8235. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8236. // code is an error. Response headers are in either
  8237. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8238. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8239. // check whether the returned error was because http.StatusNotModified
  8240. // was returned.
  8241. func (c *ProjectsInstancesDatabasesSessionsRollbackCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8242. gensupport.SetOptions(c.urlParams_, opts...)
  8243. res, err := c.doRequest("json")
  8244. if res != nil && res.StatusCode == http.StatusNotModified {
  8245. if res.Body != nil {
  8246. res.Body.Close()
  8247. }
  8248. return nil, &googleapi.Error{
  8249. Code: res.StatusCode,
  8250. Header: res.Header,
  8251. }
  8252. }
  8253. if err != nil {
  8254. return nil, err
  8255. }
  8256. defer googleapi.CloseBody(res)
  8257. if err := googleapi.CheckResponse(res); err != nil {
  8258. return nil, err
  8259. }
  8260. ret := &Empty{
  8261. ServerResponse: googleapi.ServerResponse{
  8262. Header: res.Header,
  8263. HTTPStatusCode: res.StatusCode,
  8264. },
  8265. }
  8266. target := &ret
  8267. if err := gensupport.DecodeResponse(target, res); err != nil {
  8268. return nil, err
  8269. }
  8270. return ret, nil
  8271. // {
  8272. // "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`.",
  8273. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:rollback",
  8274. // "httpMethod": "POST",
  8275. // "id": "spanner.projects.instances.databases.sessions.rollback",
  8276. // "parameterOrder": [
  8277. // "session"
  8278. // ],
  8279. // "parameters": {
  8280. // "session": {
  8281. // "description": "Required. The session in which the transaction to roll back is running.",
  8282. // "location": "path",
  8283. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8284. // "required": true,
  8285. // "type": "string"
  8286. // }
  8287. // },
  8288. // "path": "v1/{+session}:rollback",
  8289. // "request": {
  8290. // "$ref": "RollbackRequest"
  8291. // },
  8292. // "response": {
  8293. // "$ref": "Empty"
  8294. // },
  8295. // "scopes": [
  8296. // "https://www.googleapis.com/auth/cloud-platform",
  8297. // "https://www.googleapis.com/auth/spanner.data"
  8298. // ]
  8299. // }
  8300. }
  8301. // method id "spanner.projects.instances.databases.sessions.streamingRead":
  8302. type ProjectsInstancesDatabasesSessionsStreamingReadCall struct {
  8303. s *Service
  8304. session string
  8305. readrequest *ReadRequest
  8306. urlParams_ gensupport.URLParams
  8307. ctx_ context.Context
  8308. header_ http.Header
  8309. }
  8310. // StreamingRead: Like Read, except returns the result set as a
  8311. // stream. Unlike Read, there is no limit on the
  8312. // size of the returned result set. However, no individual row in
  8313. // the result set can exceed 100 MiB, and no column value can exceed
  8314. // 10 MiB.
  8315. func (r *ProjectsInstancesDatabasesSessionsService) StreamingRead(session string, readrequest *ReadRequest) *ProjectsInstancesDatabasesSessionsStreamingReadCall {
  8316. c := &ProjectsInstancesDatabasesSessionsStreamingReadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8317. c.session = session
  8318. c.readrequest = readrequest
  8319. return c
  8320. }
  8321. // Fields allows partial responses to be retrieved. See
  8322. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8323. // for more information.
  8324. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Fields(s ...googleapi.Field) *ProjectsInstancesDatabasesSessionsStreamingReadCall {
  8325. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8326. return c
  8327. }
  8328. // Context sets the context to be used in this call's Do method. Any
  8329. // pending HTTP request will be aborted if the provided context is
  8330. // canceled.
  8331. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Context(ctx context.Context) *ProjectsInstancesDatabasesSessionsStreamingReadCall {
  8332. c.ctx_ = ctx
  8333. return c
  8334. }
  8335. // Header returns an http.Header that can be modified by the caller to
  8336. // add HTTP headers to the request.
  8337. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Header() http.Header {
  8338. if c.header_ == nil {
  8339. c.header_ = make(http.Header)
  8340. }
  8341. return c.header_
  8342. }
  8343. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) doRequest(alt string) (*http.Response, error) {
  8344. reqHeaders := make(http.Header)
  8345. for k, v := range c.header_ {
  8346. reqHeaders[k] = v
  8347. }
  8348. reqHeaders.Set("User-Agent", c.s.userAgent())
  8349. var body io.Reader = nil
  8350. body, err := googleapi.WithoutDataWrapper.JSONReader(c.readrequest)
  8351. if err != nil {
  8352. return nil, err
  8353. }
  8354. reqHeaders.Set("Content-Type", "application/json")
  8355. c.urlParams_.Set("alt", alt)
  8356. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+session}:streamingRead")
  8357. urls += "?" + c.urlParams_.Encode()
  8358. req, _ := http.NewRequest("POST", urls, body)
  8359. req.Header = reqHeaders
  8360. googleapi.Expand(req.URL, map[string]string{
  8361. "session": c.session,
  8362. })
  8363. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8364. }
  8365. // Do executes the "spanner.projects.instances.databases.sessions.streamingRead" call.
  8366. // Exactly one of *PartialResultSet or error will be non-nil. Any
  8367. // non-2xx status code is an error. Response headers are in either
  8368. // *PartialResultSet.ServerResponse.Header or (if a response was
  8369. // returned at all) in error.(*googleapi.Error).Header. Use
  8370. // googleapi.IsNotModified to check whether the returned error was
  8371. // because http.StatusNotModified was returned.
  8372. func (c *ProjectsInstancesDatabasesSessionsStreamingReadCall) Do(opts ...googleapi.CallOption) (*PartialResultSet, error) {
  8373. gensupport.SetOptions(c.urlParams_, opts...)
  8374. res, err := c.doRequest("json")
  8375. if res != nil && res.StatusCode == http.StatusNotModified {
  8376. if res.Body != nil {
  8377. res.Body.Close()
  8378. }
  8379. return nil, &googleapi.Error{
  8380. Code: res.StatusCode,
  8381. Header: res.Header,
  8382. }
  8383. }
  8384. if err != nil {
  8385. return nil, err
  8386. }
  8387. defer googleapi.CloseBody(res)
  8388. if err := googleapi.CheckResponse(res); err != nil {
  8389. return nil, err
  8390. }
  8391. ret := &PartialResultSet{
  8392. ServerResponse: googleapi.ServerResponse{
  8393. Header: res.Header,
  8394. HTTPStatusCode: res.StatusCode,
  8395. },
  8396. }
  8397. target := &ret
  8398. if err := gensupport.DecodeResponse(target, res); err != nil {
  8399. return nil, err
  8400. }
  8401. return ret, nil
  8402. // {
  8403. // "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.",
  8404. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}/sessions/{sessionsId}:streamingRead",
  8405. // "httpMethod": "POST",
  8406. // "id": "spanner.projects.instances.databases.sessions.streamingRead",
  8407. // "parameterOrder": [
  8408. // "session"
  8409. // ],
  8410. // "parameters": {
  8411. // "session": {
  8412. // "description": "Required. The session in which the read should be performed.",
  8413. // "location": "path",
  8414. // "pattern": "^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+$",
  8415. // "required": true,
  8416. // "type": "string"
  8417. // }
  8418. // },
  8419. // "path": "v1/{+session}:streamingRead",
  8420. // "request": {
  8421. // "$ref": "ReadRequest"
  8422. // },
  8423. // "response": {
  8424. // "$ref": "PartialResultSet"
  8425. // },
  8426. // "scopes": [
  8427. // "https://www.googleapis.com/auth/cloud-platform",
  8428. // "https://www.googleapis.com/auth/spanner.data"
  8429. // ]
  8430. // }
  8431. }
  8432. // method id "spanner.projects.instances.operations.cancel":
  8433. type ProjectsInstancesOperationsCancelCall struct {
  8434. s *Service
  8435. name string
  8436. urlParams_ gensupport.URLParams
  8437. ctx_ context.Context
  8438. header_ http.Header
  8439. }
  8440. // Cancel: Starts asynchronous cancellation on a long-running operation.
  8441. // The server
  8442. // makes a best effort to cancel the operation, but success is
  8443. // not
  8444. // guaranteed. If the server doesn't support this method, it
  8445. // returns
  8446. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  8447. // use
  8448. // Operations.GetOperation or
  8449. // other methods to check whether the cancellation succeeded or whether
  8450. // the
  8451. // operation completed despite cancellation. On successful
  8452. // cancellation,
  8453. // the operation is not deleted; instead, it becomes an operation
  8454. // with
  8455. // an Operation.error value with a google.rpc.Status.code of
  8456. // 1,
  8457. // corresponding to `Code.CANCELLED`.
  8458. func (r *ProjectsInstancesOperationsService) Cancel(name string) *ProjectsInstancesOperationsCancelCall {
  8459. c := &ProjectsInstancesOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8460. c.name = name
  8461. return c
  8462. }
  8463. // Fields allows partial responses to be retrieved. See
  8464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8465. // for more information.
  8466. func (c *ProjectsInstancesOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsCancelCall {
  8467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8468. return c
  8469. }
  8470. // Context sets the context to be used in this call's Do method. Any
  8471. // pending HTTP request will be aborted if the provided context is
  8472. // canceled.
  8473. func (c *ProjectsInstancesOperationsCancelCall) Context(ctx context.Context) *ProjectsInstancesOperationsCancelCall {
  8474. c.ctx_ = ctx
  8475. return c
  8476. }
  8477. // Header returns an http.Header that can be modified by the caller to
  8478. // add HTTP headers to the request.
  8479. func (c *ProjectsInstancesOperationsCancelCall) Header() http.Header {
  8480. if c.header_ == nil {
  8481. c.header_ = make(http.Header)
  8482. }
  8483. return c.header_
  8484. }
  8485. func (c *ProjectsInstancesOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  8486. reqHeaders := make(http.Header)
  8487. for k, v := range c.header_ {
  8488. reqHeaders[k] = v
  8489. }
  8490. reqHeaders.Set("User-Agent", c.s.userAgent())
  8491. var body io.Reader = nil
  8492. c.urlParams_.Set("alt", alt)
  8493. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  8494. urls += "?" + c.urlParams_.Encode()
  8495. req, _ := http.NewRequest("POST", urls, body)
  8496. req.Header = reqHeaders
  8497. googleapi.Expand(req.URL, map[string]string{
  8498. "name": c.name,
  8499. })
  8500. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8501. }
  8502. // Do executes the "spanner.projects.instances.operations.cancel" call.
  8503. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8504. // code is an error. Response headers are in either
  8505. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8506. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8507. // check whether the returned error was because http.StatusNotModified
  8508. // was returned.
  8509. func (c *ProjectsInstancesOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8510. gensupport.SetOptions(c.urlParams_, opts...)
  8511. res, err := c.doRequest("json")
  8512. if res != nil && res.StatusCode == http.StatusNotModified {
  8513. if res.Body != nil {
  8514. res.Body.Close()
  8515. }
  8516. return nil, &googleapi.Error{
  8517. Code: res.StatusCode,
  8518. Header: res.Header,
  8519. }
  8520. }
  8521. if err != nil {
  8522. return nil, err
  8523. }
  8524. defer googleapi.CloseBody(res)
  8525. if err := googleapi.CheckResponse(res); err != nil {
  8526. return nil, err
  8527. }
  8528. ret := &Empty{
  8529. ServerResponse: googleapi.ServerResponse{
  8530. Header: res.Header,
  8531. HTTPStatusCode: res.StatusCode,
  8532. },
  8533. }
  8534. target := &ret
  8535. if err := gensupport.DecodeResponse(target, res); err != nil {
  8536. return nil, err
  8537. }
  8538. return ret, nil
  8539. // {
  8540. // "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`.",
  8541. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations/{operationsId}:cancel",
  8542. // "httpMethod": "POST",
  8543. // "id": "spanner.projects.instances.operations.cancel",
  8544. // "parameterOrder": [
  8545. // "name"
  8546. // ],
  8547. // "parameters": {
  8548. // "name": {
  8549. // "description": "The name of the operation resource to be cancelled.",
  8550. // "location": "path",
  8551. // "pattern": "^projects/[^/]+/instances/[^/]+/operations/[^/]+$",
  8552. // "required": true,
  8553. // "type": "string"
  8554. // }
  8555. // },
  8556. // "path": "v1/{+name}:cancel",
  8557. // "response": {
  8558. // "$ref": "Empty"
  8559. // },
  8560. // "scopes": [
  8561. // "https://www.googleapis.com/auth/cloud-platform",
  8562. // "https://www.googleapis.com/auth/spanner.admin"
  8563. // ]
  8564. // }
  8565. }
  8566. // method id "spanner.projects.instances.operations.delete":
  8567. type ProjectsInstancesOperationsDeleteCall struct {
  8568. s *Service
  8569. name string
  8570. urlParams_ gensupport.URLParams
  8571. ctx_ context.Context
  8572. header_ http.Header
  8573. }
  8574. // Delete: Deletes a long-running operation. This method indicates that
  8575. // the client is
  8576. // no longer interested in the operation result. It does not cancel
  8577. // the
  8578. // operation. If the server doesn't support this method, it
  8579. // returns
  8580. // `google.rpc.Code.UNIMPLEMENTED`.
  8581. func (r *ProjectsInstancesOperationsService) Delete(name string) *ProjectsInstancesOperationsDeleteCall {
  8582. c := &ProjectsInstancesOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8583. c.name = name
  8584. return c
  8585. }
  8586. // Fields allows partial responses to be retrieved. See
  8587. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8588. // for more information.
  8589. func (c *ProjectsInstancesOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsDeleteCall {
  8590. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8591. return c
  8592. }
  8593. // Context sets the context to be used in this call's Do method. Any
  8594. // pending HTTP request will be aborted if the provided context is
  8595. // canceled.
  8596. func (c *ProjectsInstancesOperationsDeleteCall) Context(ctx context.Context) *ProjectsInstancesOperationsDeleteCall {
  8597. c.ctx_ = ctx
  8598. return c
  8599. }
  8600. // Header returns an http.Header that can be modified by the caller to
  8601. // add HTTP headers to the request.
  8602. func (c *ProjectsInstancesOperationsDeleteCall) Header() http.Header {
  8603. if c.header_ == nil {
  8604. c.header_ = make(http.Header)
  8605. }
  8606. return c.header_
  8607. }
  8608. func (c *ProjectsInstancesOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8609. reqHeaders := make(http.Header)
  8610. for k, v := range c.header_ {
  8611. reqHeaders[k] = v
  8612. }
  8613. reqHeaders.Set("User-Agent", c.s.userAgent())
  8614. var body io.Reader = nil
  8615. c.urlParams_.Set("alt", alt)
  8616. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  8617. urls += "?" + c.urlParams_.Encode()
  8618. req, _ := http.NewRequest("DELETE", urls, body)
  8619. req.Header = reqHeaders
  8620. googleapi.Expand(req.URL, map[string]string{
  8621. "name": c.name,
  8622. })
  8623. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8624. }
  8625. // Do executes the "spanner.projects.instances.operations.delete" call.
  8626. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8627. // code is an error. Response headers are in either
  8628. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8629. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8630. // check whether the returned error was because http.StatusNotModified
  8631. // was returned.
  8632. func (c *ProjectsInstancesOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8633. gensupport.SetOptions(c.urlParams_, opts...)
  8634. res, err := c.doRequest("json")
  8635. if res != nil && res.StatusCode == http.StatusNotModified {
  8636. if res.Body != nil {
  8637. res.Body.Close()
  8638. }
  8639. return nil, &googleapi.Error{
  8640. Code: res.StatusCode,
  8641. Header: res.Header,
  8642. }
  8643. }
  8644. if err != nil {
  8645. return nil, err
  8646. }
  8647. defer googleapi.CloseBody(res)
  8648. if err := googleapi.CheckResponse(res); err != nil {
  8649. return nil, err
  8650. }
  8651. ret := &Empty{
  8652. ServerResponse: googleapi.ServerResponse{
  8653. Header: res.Header,
  8654. HTTPStatusCode: res.StatusCode,
  8655. },
  8656. }
  8657. target := &ret
  8658. if err := gensupport.DecodeResponse(target, res); err != nil {
  8659. return nil, err
  8660. }
  8661. return ret, nil
  8662. // {
  8663. // "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`.",
  8664. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations/{operationsId}",
  8665. // "httpMethod": "DELETE",
  8666. // "id": "spanner.projects.instances.operations.delete",
  8667. // "parameterOrder": [
  8668. // "name"
  8669. // ],
  8670. // "parameters": {
  8671. // "name": {
  8672. // "description": "The name of the operation resource to be deleted.",
  8673. // "location": "path",
  8674. // "pattern": "^projects/[^/]+/instances/[^/]+/operations/[^/]+$",
  8675. // "required": true,
  8676. // "type": "string"
  8677. // }
  8678. // },
  8679. // "path": "v1/{+name}",
  8680. // "response": {
  8681. // "$ref": "Empty"
  8682. // },
  8683. // "scopes": [
  8684. // "https://www.googleapis.com/auth/cloud-platform",
  8685. // "https://www.googleapis.com/auth/spanner.admin"
  8686. // ]
  8687. // }
  8688. }
  8689. // method id "spanner.projects.instances.operations.get":
  8690. type ProjectsInstancesOperationsGetCall struct {
  8691. s *Service
  8692. name string
  8693. urlParams_ gensupport.URLParams
  8694. ifNoneMatch_ string
  8695. ctx_ context.Context
  8696. header_ http.Header
  8697. }
  8698. // Get: Gets the latest state of a long-running operation. Clients can
  8699. // use this
  8700. // method to poll the operation result at intervals as recommended by
  8701. // the API
  8702. // service.
  8703. func (r *ProjectsInstancesOperationsService) Get(name string) *ProjectsInstancesOperationsGetCall {
  8704. c := &ProjectsInstancesOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8705. c.name = name
  8706. return c
  8707. }
  8708. // Fields allows partial responses to be retrieved. See
  8709. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8710. // for more information.
  8711. func (c *ProjectsInstancesOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsGetCall {
  8712. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8713. return c
  8714. }
  8715. // IfNoneMatch sets the optional parameter which makes the operation
  8716. // fail if the object's ETag matches the given value. This is useful for
  8717. // getting updates only after the object has changed since the last
  8718. // request. Use googleapi.IsNotModified to check whether the response
  8719. // error from Do is the result of In-None-Match.
  8720. func (c *ProjectsInstancesOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsInstancesOperationsGetCall {
  8721. c.ifNoneMatch_ = entityTag
  8722. return c
  8723. }
  8724. // Context sets the context to be used in this call's Do method. Any
  8725. // pending HTTP request will be aborted if the provided context is
  8726. // canceled.
  8727. func (c *ProjectsInstancesOperationsGetCall) Context(ctx context.Context) *ProjectsInstancesOperationsGetCall {
  8728. c.ctx_ = ctx
  8729. return c
  8730. }
  8731. // Header returns an http.Header that can be modified by the caller to
  8732. // add HTTP headers to the request.
  8733. func (c *ProjectsInstancesOperationsGetCall) Header() http.Header {
  8734. if c.header_ == nil {
  8735. c.header_ = make(http.Header)
  8736. }
  8737. return c.header_
  8738. }
  8739. func (c *ProjectsInstancesOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  8740. reqHeaders := make(http.Header)
  8741. for k, v := range c.header_ {
  8742. reqHeaders[k] = v
  8743. }
  8744. reqHeaders.Set("User-Agent", c.s.userAgent())
  8745. if c.ifNoneMatch_ != "" {
  8746. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8747. }
  8748. var body io.Reader = nil
  8749. c.urlParams_.Set("alt", alt)
  8750. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  8751. urls += "?" + c.urlParams_.Encode()
  8752. req, _ := http.NewRequest("GET", urls, body)
  8753. req.Header = reqHeaders
  8754. googleapi.Expand(req.URL, map[string]string{
  8755. "name": c.name,
  8756. })
  8757. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8758. }
  8759. // Do executes the "spanner.projects.instances.operations.get" call.
  8760. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  8761. // status code is an error. Response headers are in either
  8762. // *Operation.ServerResponse.Header or (if a response was returned at
  8763. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8764. // to check whether the returned error was because
  8765. // http.StatusNotModified was returned.
  8766. func (c *ProjectsInstancesOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  8767. gensupport.SetOptions(c.urlParams_, opts...)
  8768. res, err := c.doRequest("json")
  8769. if res != nil && res.StatusCode == http.StatusNotModified {
  8770. if res.Body != nil {
  8771. res.Body.Close()
  8772. }
  8773. return nil, &googleapi.Error{
  8774. Code: res.StatusCode,
  8775. Header: res.Header,
  8776. }
  8777. }
  8778. if err != nil {
  8779. return nil, err
  8780. }
  8781. defer googleapi.CloseBody(res)
  8782. if err := googleapi.CheckResponse(res); err != nil {
  8783. return nil, err
  8784. }
  8785. ret := &Operation{
  8786. ServerResponse: googleapi.ServerResponse{
  8787. Header: res.Header,
  8788. HTTPStatusCode: res.StatusCode,
  8789. },
  8790. }
  8791. target := &ret
  8792. if err := gensupport.DecodeResponse(target, res); err != nil {
  8793. return nil, err
  8794. }
  8795. return ret, nil
  8796. // {
  8797. // "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.",
  8798. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations/{operationsId}",
  8799. // "httpMethod": "GET",
  8800. // "id": "spanner.projects.instances.operations.get",
  8801. // "parameterOrder": [
  8802. // "name"
  8803. // ],
  8804. // "parameters": {
  8805. // "name": {
  8806. // "description": "The name of the operation resource.",
  8807. // "location": "path",
  8808. // "pattern": "^projects/[^/]+/instances/[^/]+/operations/[^/]+$",
  8809. // "required": true,
  8810. // "type": "string"
  8811. // }
  8812. // },
  8813. // "path": "v1/{+name}",
  8814. // "response": {
  8815. // "$ref": "Operation"
  8816. // },
  8817. // "scopes": [
  8818. // "https://www.googleapis.com/auth/cloud-platform",
  8819. // "https://www.googleapis.com/auth/spanner.admin"
  8820. // ]
  8821. // }
  8822. }
  8823. // method id "spanner.projects.instances.operations.list":
  8824. type ProjectsInstancesOperationsListCall struct {
  8825. s *Service
  8826. name string
  8827. urlParams_ gensupport.URLParams
  8828. ifNoneMatch_ string
  8829. ctx_ context.Context
  8830. header_ http.Header
  8831. }
  8832. // List: Lists operations that match the specified filter in the
  8833. // request. If the
  8834. // server doesn't support this method, it returns
  8835. // `UNIMPLEMENTED`.
  8836. //
  8837. // NOTE: the `name` binding allows API services to override the
  8838. // binding
  8839. // to use different resource name schemes, such as `users/*/operations`.
  8840. // To
  8841. // override the binding, API services can add a binding such
  8842. // as
  8843. // "/v1/{name=users/*}/operations" to their service configuration.
  8844. // For backwards compatibility, the default name includes the
  8845. // operations
  8846. // collection id, however overriding users must ensure the name
  8847. // binding
  8848. // is the parent resource, without the operations collection id.
  8849. func (r *ProjectsInstancesOperationsService) List(name string) *ProjectsInstancesOperationsListCall {
  8850. c := &ProjectsInstancesOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8851. c.name = name
  8852. return c
  8853. }
  8854. // Filter sets the optional parameter "filter": The standard list
  8855. // filter.
  8856. func (c *ProjectsInstancesOperationsListCall) Filter(filter string) *ProjectsInstancesOperationsListCall {
  8857. c.urlParams_.Set("filter", filter)
  8858. return c
  8859. }
  8860. // PageSize sets the optional parameter "pageSize": The standard list
  8861. // page size.
  8862. func (c *ProjectsInstancesOperationsListCall) PageSize(pageSize int64) *ProjectsInstancesOperationsListCall {
  8863. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8864. return c
  8865. }
  8866. // PageToken sets the optional parameter "pageToken": The standard list
  8867. // page token.
  8868. func (c *ProjectsInstancesOperationsListCall) PageToken(pageToken string) *ProjectsInstancesOperationsListCall {
  8869. c.urlParams_.Set("pageToken", pageToken)
  8870. return c
  8871. }
  8872. // Fields allows partial responses to be retrieved. See
  8873. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8874. // for more information.
  8875. func (c *ProjectsInstancesOperationsListCall) Fields(s ...googleapi.Field) *ProjectsInstancesOperationsListCall {
  8876. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8877. return c
  8878. }
  8879. // IfNoneMatch sets the optional parameter which makes the operation
  8880. // fail if the object's ETag matches the given value. This is useful for
  8881. // getting updates only after the object has changed since the last
  8882. // request. Use googleapi.IsNotModified to check whether the response
  8883. // error from Do is the result of In-None-Match.
  8884. func (c *ProjectsInstancesOperationsListCall) IfNoneMatch(entityTag string) *ProjectsInstancesOperationsListCall {
  8885. c.ifNoneMatch_ = entityTag
  8886. return c
  8887. }
  8888. // Context sets the context to be used in this call's Do method. Any
  8889. // pending HTTP request will be aborted if the provided context is
  8890. // canceled.
  8891. func (c *ProjectsInstancesOperationsListCall) Context(ctx context.Context) *ProjectsInstancesOperationsListCall {
  8892. c.ctx_ = ctx
  8893. return c
  8894. }
  8895. // Header returns an http.Header that can be modified by the caller to
  8896. // add HTTP headers to the request.
  8897. func (c *ProjectsInstancesOperationsListCall) Header() http.Header {
  8898. if c.header_ == nil {
  8899. c.header_ = make(http.Header)
  8900. }
  8901. return c.header_
  8902. }
  8903. func (c *ProjectsInstancesOperationsListCall) doRequest(alt string) (*http.Response, error) {
  8904. reqHeaders := make(http.Header)
  8905. for k, v := range c.header_ {
  8906. reqHeaders[k] = v
  8907. }
  8908. reqHeaders.Set("User-Agent", c.s.userAgent())
  8909. if c.ifNoneMatch_ != "" {
  8910. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8911. }
  8912. var body io.Reader = nil
  8913. c.urlParams_.Set("alt", alt)
  8914. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  8915. urls += "?" + c.urlParams_.Encode()
  8916. req, _ := http.NewRequest("GET", urls, body)
  8917. req.Header = reqHeaders
  8918. googleapi.Expand(req.URL, map[string]string{
  8919. "name": c.name,
  8920. })
  8921. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8922. }
  8923. // Do executes the "spanner.projects.instances.operations.list" call.
  8924. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  8925. // non-2xx status code is an error. Response headers are in either
  8926. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  8927. // returned at all) in error.(*googleapi.Error).Header. Use
  8928. // googleapi.IsNotModified to check whether the returned error was
  8929. // because http.StatusNotModified was returned.
  8930. func (c *ProjectsInstancesOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  8931. gensupport.SetOptions(c.urlParams_, opts...)
  8932. res, err := c.doRequest("json")
  8933. if res != nil && res.StatusCode == http.StatusNotModified {
  8934. if res.Body != nil {
  8935. res.Body.Close()
  8936. }
  8937. return nil, &googleapi.Error{
  8938. Code: res.StatusCode,
  8939. Header: res.Header,
  8940. }
  8941. }
  8942. if err != nil {
  8943. return nil, err
  8944. }
  8945. defer googleapi.CloseBody(res)
  8946. if err := googleapi.CheckResponse(res); err != nil {
  8947. return nil, err
  8948. }
  8949. ret := &ListOperationsResponse{
  8950. ServerResponse: googleapi.ServerResponse{
  8951. Header: res.Header,
  8952. HTTPStatusCode: res.StatusCode,
  8953. },
  8954. }
  8955. target := &ret
  8956. if err := gensupport.DecodeResponse(target, res); err != nil {
  8957. return nil, err
  8958. }
  8959. return ret, nil
  8960. // {
  8961. // "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.",
  8962. // "flatPath": "v1/projects/{projectsId}/instances/{instancesId}/operations",
  8963. // "httpMethod": "GET",
  8964. // "id": "spanner.projects.instances.operations.list",
  8965. // "parameterOrder": [
  8966. // "name"
  8967. // ],
  8968. // "parameters": {
  8969. // "filter": {
  8970. // "description": "The standard list filter.",
  8971. // "location": "query",
  8972. // "type": "string"
  8973. // },
  8974. // "name": {
  8975. // "description": "The name of the operation's parent resource.",
  8976. // "location": "path",
  8977. // "pattern": "^projects/[^/]+/instances/[^/]+/operations$",
  8978. // "required": true,
  8979. // "type": "string"
  8980. // },
  8981. // "pageSize": {
  8982. // "description": "The standard list page size.",
  8983. // "format": "int32",
  8984. // "location": "query",
  8985. // "type": "integer"
  8986. // },
  8987. // "pageToken": {
  8988. // "description": "The standard list page token.",
  8989. // "location": "query",
  8990. // "type": "string"
  8991. // }
  8992. // },
  8993. // "path": "v1/{+name}",
  8994. // "response": {
  8995. // "$ref": "ListOperationsResponse"
  8996. // },
  8997. // "scopes": [
  8998. // "https://www.googleapis.com/auth/cloud-platform",
  8999. // "https://www.googleapis.com/auth/spanner.admin"
  9000. // ]
  9001. // }
  9002. }
  9003. // Pages invokes f for each page of results.
  9004. // A non-nil error returned from f will halt the iteration.
  9005. // The provided context supersedes any context provided to the Context method.
  9006. func (c *ProjectsInstancesOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  9007. c.ctx_ = ctx
  9008. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9009. for {
  9010. x, err := c.Do()
  9011. if err != nil {
  9012. return err
  9013. }
  9014. if err := f(x); err != nil {
  9015. return err
  9016. }
  9017. if x.NextPageToken == "" {
  9018. return nil
  9019. }
  9020. c.PageToken(x.NextPageToken)
  9021. }
  9022. }