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

1292 lines
50 KiB

  1. // Package datastore provides access to the Cloud Datastore API.
  2. //
  3. // See https://cloud.google.com/datastore/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/datastore/v1beta1"
  8. // ...
  9. // datastoreService, err := datastore.New(oauthHttpClient)
  10. package datastore // import "google.golang.org/api/datastore/v1beta1"
  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 = "datastore:v1beta1"
  41. const apiName = "datastore"
  42. const apiVersion = "v1beta1"
  43. const basePath = "https://datastore.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // View and manage your Google Cloud Datastore data
  49. DatastoreScope = "https://www.googleapis.com/auth/datastore"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Projects = NewProjectsService(s)
  57. return s, nil
  58. }
  59. type Service struct {
  60. client *http.Client
  61. BasePath string // API endpoint base URL
  62. UserAgent string // optional additional User-Agent fragment
  63. Projects *ProjectsService
  64. }
  65. func (s *Service) userAgent() string {
  66. if s.UserAgent == "" {
  67. return googleapi.UserAgent
  68. }
  69. return googleapi.UserAgent + " " + s.UserAgent
  70. }
  71. func NewProjectsService(s *Service) *ProjectsService {
  72. rs := &ProjectsService{s: s}
  73. return rs
  74. }
  75. type ProjectsService struct {
  76. s *Service
  77. }
  78. // GoogleDatastoreAdminV1CommonMetadata: Metadata common to all
  79. // Datastore Admin operations.
  80. type GoogleDatastoreAdminV1CommonMetadata struct {
  81. // EndTime: The time the operation ended, either successfully or
  82. // otherwise.
  83. EndTime string `json:"endTime,omitempty"`
  84. // Labels: The client-assigned labels which were provided when the
  85. // operation was
  86. // created. May also include additional labels.
  87. Labels map[string]string `json:"labels,omitempty"`
  88. // OperationType: The type of the operation. Can be used as a filter
  89. // in
  90. // ListOperationsRequest.
  91. //
  92. // Possible values:
  93. // "OPERATION_TYPE_UNSPECIFIED" - Unspecified.
  94. // "EXPORT_ENTITIES" - ExportEntities.
  95. // "IMPORT_ENTITIES" - ImportEntities.
  96. OperationType string `json:"operationType,omitempty"`
  97. // StartTime: The time that work began on the operation.
  98. StartTime string `json:"startTime,omitempty"`
  99. // State: The current state of the Operation.
  100. //
  101. // Possible values:
  102. // "STATE_UNSPECIFIED" - Unspecified.
  103. // "INITIALIZING" - Request is being prepared for processing.
  104. // "PROCESSING" - Request is actively being processed.
  105. // "CANCELLING" - Request is in the process of being cancelled after
  106. // user called
  107. // google.longrunning.Operations.CancelOperation on the operation.
  108. // "FINALIZING" - Request has been processed and is in its
  109. // finalization stage.
  110. // "SUCCESSFUL" - Request has completed successfully.
  111. // "FAILED" - Request has finished being processed, but encountered an
  112. // error.
  113. // "CANCELLED" - Request has finished being cancelled after user
  114. // called
  115. // google.longrunning.Operations.CancelOperation.
  116. State string `json:"state,omitempty"`
  117. // ForceSendFields is a list of field names (e.g. "EndTime") to
  118. // unconditionally include in API requests. By default, fields with
  119. // empty values are omitted from API requests. However, any non-pointer,
  120. // non-interface field appearing in ForceSendFields will be sent to the
  121. // server regardless of whether the field is empty or not. This may be
  122. // used to include empty fields in Patch requests.
  123. ForceSendFields []string `json:"-"`
  124. // NullFields is a list of field names (e.g. "EndTime") to include in
  125. // API requests with the JSON null value. By default, fields with empty
  126. // values are omitted from API requests. However, any field with an
  127. // empty value appearing in NullFields will be sent to the server as
  128. // null. It is an error if a field in this list has a non-empty value.
  129. // This may be used to include null fields in Patch requests.
  130. NullFields []string `json:"-"`
  131. }
  132. func (s *GoogleDatastoreAdminV1CommonMetadata) MarshalJSON() ([]byte, error) {
  133. type NoMethod GoogleDatastoreAdminV1CommonMetadata
  134. raw := NoMethod(*s)
  135. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  136. }
  137. // GoogleDatastoreAdminV1EntityFilter: Identifies a subset of entities
  138. // in a project. This is specified as
  139. // combinations of kinds and namespaces (either or both of which may be
  140. // all, as
  141. // described in the following examples).
  142. // Example usage:
  143. //
  144. // Entire project:
  145. // kinds=[], namespace_ids=[]
  146. //
  147. // Kinds Foo and Bar in all namespaces:
  148. // kinds=['Foo', 'Bar'], namespace_ids=[]
  149. //
  150. // Kinds Foo and Bar only in the default namespace:
  151. // kinds=['Foo', 'Bar'], namespace_ids=['']
  152. //
  153. // Kinds Foo and Bar in both the default and Baz namespaces:
  154. // kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz']
  155. //
  156. // The entire Baz namespace:
  157. // kinds=[], namespace_ids=['Baz']
  158. type GoogleDatastoreAdminV1EntityFilter struct {
  159. // Kinds: If empty, then this represents all kinds.
  160. Kinds []string `json:"kinds,omitempty"`
  161. // NamespaceIds: An empty list represents all namespaces. This is the
  162. // preferred
  163. // usage for projects that don't use namespaces.
  164. //
  165. // An empty string element represents the default namespace. This should
  166. // be
  167. // used if the project has data in non-default namespaces, but doesn't
  168. // want to
  169. // include them.
  170. // Each namespace in this list must be unique.
  171. NamespaceIds []string `json:"namespaceIds,omitempty"`
  172. // ForceSendFields is a list of field names (e.g. "Kinds") to
  173. // unconditionally include in API requests. By default, fields with
  174. // empty values are omitted from API requests. However, any non-pointer,
  175. // non-interface field appearing in ForceSendFields will be sent to the
  176. // server regardless of whether the field is empty or not. This may be
  177. // used to include empty fields in Patch requests.
  178. ForceSendFields []string `json:"-"`
  179. // NullFields is a list of field names (e.g. "Kinds") to include in API
  180. // requests with the JSON null value. By default, fields with empty
  181. // values are omitted from API requests. However, any field with an
  182. // empty value appearing in NullFields will be sent to the server as
  183. // null. It is an error if a field in this list has a non-empty value.
  184. // This may be used to include null fields in Patch requests.
  185. NullFields []string `json:"-"`
  186. }
  187. func (s *GoogleDatastoreAdminV1EntityFilter) MarshalJSON() ([]byte, error) {
  188. type NoMethod GoogleDatastoreAdminV1EntityFilter
  189. raw := NoMethod(*s)
  190. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  191. }
  192. // GoogleDatastoreAdminV1ExportEntitiesMetadata: Metadata for
  193. // ExportEntities operations.
  194. type GoogleDatastoreAdminV1ExportEntitiesMetadata struct {
  195. // Common: Metadata common to all Datastore Admin operations.
  196. Common *GoogleDatastoreAdminV1CommonMetadata `json:"common,omitempty"`
  197. // EntityFilter: Description of which entities are being exported.
  198. EntityFilter *GoogleDatastoreAdminV1EntityFilter `json:"entityFilter,omitempty"`
  199. // OutputUrlPrefix: Location for the export metadata and data files.
  200. // This will be the same
  201. // value as
  202. // the
  203. // google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix
  204. //
  205. // field. The final output location is provided
  206. // in
  207. // google.datastore.admin.v1.ExportEntitiesResponse.output_url.
  208. OutputUrlPrefix string `json:"outputUrlPrefix,omitempty"`
  209. // ProgressBytes: An estimate of the number of bytes processed.
  210. ProgressBytes *GoogleDatastoreAdminV1Progress `json:"progressBytes,omitempty"`
  211. // ProgressEntities: An estimate of the number of entities processed.
  212. ProgressEntities *GoogleDatastoreAdminV1Progress `json:"progressEntities,omitempty"`
  213. // ForceSendFields is a list of field names (e.g. "Common") to
  214. // unconditionally include in API requests. By default, fields with
  215. // empty values are omitted from API requests. However, any non-pointer,
  216. // non-interface field appearing in ForceSendFields will be sent to the
  217. // server regardless of whether the field is empty or not. This may be
  218. // used to include empty fields in Patch requests.
  219. ForceSendFields []string `json:"-"`
  220. // NullFields is a list of field names (e.g. "Common") to include in API
  221. // requests with the JSON null value. By default, fields with empty
  222. // values are omitted from API requests. However, any field with an
  223. // empty value appearing in NullFields will be sent to the server as
  224. // null. It is an error if a field in this list has a non-empty value.
  225. // This may be used to include null fields in Patch requests.
  226. NullFields []string `json:"-"`
  227. }
  228. func (s *GoogleDatastoreAdminV1ExportEntitiesMetadata) MarshalJSON() ([]byte, error) {
  229. type NoMethod GoogleDatastoreAdminV1ExportEntitiesMetadata
  230. raw := NoMethod(*s)
  231. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  232. }
  233. // GoogleDatastoreAdminV1ExportEntitiesResponse: The response
  234. // for
  235. // google.datastore.admin.v1.DatastoreAdmin.ExportEntities.
  236. type GoogleDatastoreAdminV1ExportEntitiesResponse struct {
  237. // OutputUrl: Location of the output metadata file. This can be used to
  238. // begin an import
  239. // into Cloud Datastore (this project or another project).
  240. // See
  241. // google.datastore.admin.v1.ImportEntitiesRequest.input_url.
  242. // Only present if the operation completed successfully.
  243. OutputUrl string `json:"outputUrl,omitempty"`
  244. // ForceSendFields is a list of field names (e.g. "OutputUrl") to
  245. // unconditionally include in API requests. By default, fields with
  246. // empty values are omitted from API requests. However, any non-pointer,
  247. // non-interface field appearing in ForceSendFields will be sent to the
  248. // server regardless of whether the field is empty or not. This may be
  249. // used to include empty fields in Patch requests.
  250. ForceSendFields []string `json:"-"`
  251. // NullFields is a list of field names (e.g. "OutputUrl") to include in
  252. // API requests with the JSON null value. By default, fields with empty
  253. // values are omitted from API requests. However, any field with an
  254. // empty value appearing in NullFields will be sent to the server as
  255. // null. It is an error if a field in this list has a non-empty value.
  256. // This may be used to include null fields in Patch requests.
  257. NullFields []string `json:"-"`
  258. }
  259. func (s *GoogleDatastoreAdminV1ExportEntitiesResponse) MarshalJSON() ([]byte, error) {
  260. type NoMethod GoogleDatastoreAdminV1ExportEntitiesResponse
  261. raw := NoMethod(*s)
  262. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  263. }
  264. // GoogleDatastoreAdminV1ImportEntitiesMetadata: Metadata for
  265. // ImportEntities operations.
  266. type GoogleDatastoreAdminV1ImportEntitiesMetadata struct {
  267. // Common: Metadata common to all Datastore Admin operations.
  268. Common *GoogleDatastoreAdminV1CommonMetadata `json:"common,omitempty"`
  269. // EntityFilter: Description of which entities are being imported.
  270. EntityFilter *GoogleDatastoreAdminV1EntityFilter `json:"entityFilter,omitempty"`
  271. // InputUrl: The location of the import metadata file. This will be the
  272. // same value as
  273. // the google.datastore.admin.v1.ExportEntitiesResponse.output_url
  274. // field.
  275. InputUrl string `json:"inputUrl,omitempty"`
  276. // ProgressBytes: An estimate of the number of bytes processed.
  277. ProgressBytes *GoogleDatastoreAdminV1Progress `json:"progressBytes,omitempty"`
  278. // ProgressEntities: An estimate of the number of entities processed.
  279. ProgressEntities *GoogleDatastoreAdminV1Progress `json:"progressEntities,omitempty"`
  280. // ForceSendFields is a list of field names (e.g. "Common") to
  281. // unconditionally include in API requests. By default, fields with
  282. // empty values are omitted from API requests. However, any non-pointer,
  283. // non-interface field appearing in ForceSendFields will be sent to the
  284. // server regardless of whether the field is empty or not. This may be
  285. // used to include empty fields in Patch requests.
  286. ForceSendFields []string `json:"-"`
  287. // NullFields is a list of field names (e.g. "Common") to include in API
  288. // requests with the JSON null value. By default, fields with empty
  289. // values are omitted from API requests. However, any field with an
  290. // empty value appearing in NullFields will be sent to the server as
  291. // null. It is an error if a field in this list has a non-empty value.
  292. // This may be used to include null fields in Patch requests.
  293. NullFields []string `json:"-"`
  294. }
  295. func (s *GoogleDatastoreAdminV1ImportEntitiesMetadata) MarshalJSON() ([]byte, error) {
  296. type NoMethod GoogleDatastoreAdminV1ImportEntitiesMetadata
  297. raw := NoMethod(*s)
  298. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  299. }
  300. // GoogleDatastoreAdminV1Progress: Measures the progress of a particular
  301. // metric.
  302. type GoogleDatastoreAdminV1Progress struct {
  303. // WorkCompleted: The amount of work that has been completed. Note that
  304. // this may be greater
  305. // than work_estimated.
  306. WorkCompleted int64 `json:"workCompleted,omitempty,string"`
  307. // WorkEstimated: An estimate of how much work needs to be performed.
  308. // May be zero if the
  309. // work estimate is unavailable.
  310. WorkEstimated int64 `json:"workEstimated,omitempty,string"`
  311. // ForceSendFields is a list of field names (e.g. "WorkCompleted") to
  312. // unconditionally include in API requests. By default, fields with
  313. // empty values are omitted from API requests. However, any non-pointer,
  314. // non-interface field appearing in ForceSendFields will be sent to the
  315. // server regardless of whether the field is empty or not. This may be
  316. // used to include empty fields in Patch requests.
  317. ForceSendFields []string `json:"-"`
  318. // NullFields is a list of field names (e.g. "WorkCompleted") to include
  319. // in API requests with the JSON null value. By default, fields with
  320. // empty values are omitted from API requests. However, any field with
  321. // an empty value appearing in NullFields will be sent to the server as
  322. // null. It is an error if a field in this list has a non-empty value.
  323. // This may be used to include null fields in Patch requests.
  324. NullFields []string `json:"-"`
  325. }
  326. func (s *GoogleDatastoreAdminV1Progress) MarshalJSON() ([]byte, error) {
  327. type NoMethod GoogleDatastoreAdminV1Progress
  328. raw := NoMethod(*s)
  329. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  330. }
  331. // GoogleDatastoreAdminV1beta1CommonMetadata: Metadata common to all
  332. // Datastore Admin operations.
  333. type GoogleDatastoreAdminV1beta1CommonMetadata struct {
  334. // EndTime: The time the operation ended, either successfully or
  335. // otherwise.
  336. EndTime string `json:"endTime,omitempty"`
  337. // Labels: The client-assigned labels which were provided when the
  338. // operation was
  339. // created. May also include additional labels.
  340. Labels map[string]string `json:"labels,omitempty"`
  341. // OperationType: The type of the operation. Can be used as a filter
  342. // in
  343. // ListOperationsRequest.
  344. //
  345. // Possible values:
  346. // "OPERATION_TYPE_UNSPECIFIED" - Unspecified.
  347. // "EXPORT_ENTITIES" - ExportEntities.
  348. // "IMPORT_ENTITIES" - ImportEntities.
  349. OperationType string `json:"operationType,omitempty"`
  350. // StartTime: The time that work began on the operation.
  351. StartTime string `json:"startTime,omitempty"`
  352. // State: The current state of the Operation.
  353. //
  354. // Possible values:
  355. // "STATE_UNSPECIFIED" - Unspecified.
  356. // "INITIALIZING" - Request is being prepared for processing.
  357. // "PROCESSING" - Request is actively being processed.
  358. // "CANCELLING" - Request is in the process of being cancelled after
  359. // user called
  360. // google.longrunning.Operations.CancelOperation on the operation.
  361. // "FINALIZING" - Request has been processed and is in its
  362. // finalization stage.
  363. // "SUCCESSFUL" - Request has completed successfully.
  364. // "FAILED" - Request has finished being processed, but encountered an
  365. // error.
  366. // "CANCELLED" - Request has finished being cancelled after user
  367. // called
  368. // google.longrunning.Operations.CancelOperation.
  369. State string `json:"state,omitempty"`
  370. // ForceSendFields is a list of field names (e.g. "EndTime") to
  371. // unconditionally include in API requests. By default, fields with
  372. // empty values are omitted from API requests. However, any non-pointer,
  373. // non-interface field appearing in ForceSendFields will be sent to the
  374. // server regardless of whether the field is empty or not. This may be
  375. // used to include empty fields in Patch requests.
  376. ForceSendFields []string `json:"-"`
  377. // NullFields is a list of field names (e.g. "EndTime") to include in
  378. // API requests with the JSON null value. By default, fields with empty
  379. // values are omitted from API requests. However, any field with an
  380. // empty value appearing in NullFields will be sent to the server as
  381. // null. It is an error if a field in this list has a non-empty value.
  382. // This may be used to include null fields in Patch requests.
  383. NullFields []string `json:"-"`
  384. }
  385. func (s *GoogleDatastoreAdminV1beta1CommonMetadata) MarshalJSON() ([]byte, error) {
  386. type NoMethod GoogleDatastoreAdminV1beta1CommonMetadata
  387. raw := NoMethod(*s)
  388. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  389. }
  390. // GoogleDatastoreAdminV1beta1EntityFilter: Identifies a subset of
  391. // entities in a project. This is specified as
  392. // combinations of kinds and namespaces (either or both of which may be
  393. // all, as
  394. // described in the following examples).
  395. // Example usage:
  396. //
  397. // Entire project:
  398. // kinds=[], namespace_ids=[]
  399. //
  400. // Kinds Foo and Bar in all namespaces:
  401. // kinds=['Foo', 'Bar'], namespace_ids=[]
  402. //
  403. // Kinds Foo and Bar only in the default namespace:
  404. // kinds=['Foo', 'Bar'], namespace_ids=['']
  405. //
  406. // Kinds Foo and Bar in both the default and Baz namespaces:
  407. // kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz']
  408. //
  409. // The entire Baz namespace:
  410. // kinds=[], namespace_ids=['Baz']
  411. type GoogleDatastoreAdminV1beta1EntityFilter struct {
  412. // Kinds: If empty, then this represents all kinds.
  413. Kinds []string `json:"kinds,omitempty"`
  414. // NamespaceIds: An empty list represents all namespaces. This is the
  415. // preferred
  416. // usage for projects that don't use namespaces.
  417. //
  418. // An empty string element represents the default namespace. This should
  419. // be
  420. // used if the project has data in non-default namespaces, but doesn't
  421. // want to
  422. // include them.
  423. // Each namespace in this list must be unique.
  424. NamespaceIds []string `json:"namespaceIds,omitempty"`
  425. // ForceSendFields is a list of field names (e.g. "Kinds") to
  426. // unconditionally include in API requests. By default, fields with
  427. // empty values are omitted from API requests. However, any non-pointer,
  428. // non-interface field appearing in ForceSendFields will be sent to the
  429. // server regardless of whether the field is empty or not. This may be
  430. // used to include empty fields in Patch requests.
  431. ForceSendFields []string `json:"-"`
  432. // NullFields is a list of field names (e.g. "Kinds") to include in API
  433. // requests with the JSON null value. By default, fields with empty
  434. // values are omitted from API requests. However, any field with an
  435. // empty value appearing in NullFields will be sent to the server as
  436. // null. It is an error if a field in this list has a non-empty value.
  437. // This may be used to include null fields in Patch requests.
  438. NullFields []string `json:"-"`
  439. }
  440. func (s *GoogleDatastoreAdminV1beta1EntityFilter) MarshalJSON() ([]byte, error) {
  441. type NoMethod GoogleDatastoreAdminV1beta1EntityFilter
  442. raw := NoMethod(*s)
  443. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  444. }
  445. // GoogleDatastoreAdminV1beta1ExportEntitiesMetadata: Metadata for
  446. // ExportEntities operations.
  447. type GoogleDatastoreAdminV1beta1ExportEntitiesMetadata struct {
  448. // Common: Metadata common to all Datastore Admin operations.
  449. Common *GoogleDatastoreAdminV1beta1CommonMetadata `json:"common,omitempty"`
  450. // EntityFilter: Description of which entities are being exported.
  451. EntityFilter *GoogleDatastoreAdminV1beta1EntityFilter `json:"entityFilter,omitempty"`
  452. // OutputUrlPrefix: Location for the export metadata and data files.
  453. // This will be the same
  454. // value as
  455. // the
  456. // google.datastore.admin.v1beta1.ExportEntitiesRequest.output_url_pr
  457. // efix
  458. // field. The final output location is provided
  459. // in
  460. // google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url.
  461. OutputUrlPrefix string `json:"outputUrlPrefix,omitempty"`
  462. // ProgressBytes: An estimate of the number of bytes processed.
  463. ProgressBytes *GoogleDatastoreAdminV1beta1Progress `json:"progressBytes,omitempty"`
  464. // ProgressEntities: An estimate of the number of entities processed.
  465. ProgressEntities *GoogleDatastoreAdminV1beta1Progress `json:"progressEntities,omitempty"`
  466. // ForceSendFields is a list of field names (e.g. "Common") to
  467. // unconditionally include in API requests. By default, fields with
  468. // empty values are omitted from API requests. However, any non-pointer,
  469. // non-interface field appearing in ForceSendFields will be sent to the
  470. // server regardless of whether the field is empty or not. This may be
  471. // used to include empty fields in Patch requests.
  472. ForceSendFields []string `json:"-"`
  473. // NullFields is a list of field names (e.g. "Common") to include in API
  474. // requests with the JSON null value. By default, fields with empty
  475. // values are omitted from API requests. However, any field with an
  476. // empty value appearing in NullFields will be sent to the server as
  477. // null. It is an error if a field in this list has a non-empty value.
  478. // This may be used to include null fields in Patch requests.
  479. NullFields []string `json:"-"`
  480. }
  481. func (s *GoogleDatastoreAdminV1beta1ExportEntitiesMetadata) MarshalJSON() ([]byte, error) {
  482. type NoMethod GoogleDatastoreAdminV1beta1ExportEntitiesMetadata
  483. raw := NoMethod(*s)
  484. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  485. }
  486. // GoogleDatastoreAdminV1beta1ExportEntitiesRequest: The request
  487. // for
  488. // google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities.
  489. type GoogleDatastoreAdminV1beta1ExportEntitiesRequest struct {
  490. // EntityFilter: Description of what data from the project is included
  491. // in the export.
  492. EntityFilter *GoogleDatastoreAdminV1beta1EntityFilter `json:"entityFilter,omitempty"`
  493. // Labels: Client-assigned labels.
  494. Labels map[string]string `json:"labels,omitempty"`
  495. // OutputUrlPrefix: Location for the export metadata and data
  496. // files.
  497. //
  498. // The full resource URL of the external storage location. Currently,
  499. // only
  500. // Google Cloud Storage is supported. So output_url_prefix should be of
  501. // the
  502. // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is
  503. // the
  504. // name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional
  505. // Cloud
  506. // Storage namespace path (this is not a Cloud Datastore namespace). For
  507. // more
  508. // information about Cloud Storage namespace paths, see
  509. // [Object
  510. // name
  511. // considerations](https://cloud.google.com/storage/docs/naming#obje
  512. // ct-considerations).
  513. //
  514. // The resulting files will be nested deeper than the specified URL
  515. // prefix.
  516. // The final output URL will be provided in
  517. // the
  518. // google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url
  519. // f
  520. // ield. That value should be used for subsequent ImportEntities
  521. // operations.
  522. //
  523. // By nesting the data files deeper, the same Cloud Storage bucket can
  524. // be used
  525. // in multiple ExportEntities operations without conflict.
  526. OutputUrlPrefix string `json:"outputUrlPrefix,omitempty"`
  527. // ForceSendFields is a list of field names (e.g. "EntityFilter") to
  528. // unconditionally include in API requests. By default, fields with
  529. // empty values are omitted from API requests. However, any non-pointer,
  530. // non-interface field appearing in ForceSendFields will be sent to the
  531. // server regardless of whether the field is empty or not. This may be
  532. // used to include empty fields in Patch requests.
  533. ForceSendFields []string `json:"-"`
  534. // NullFields is a list of field names (e.g. "EntityFilter") to include
  535. // in API requests with the JSON null value. By default, fields with
  536. // empty values are omitted from API requests. However, any field with
  537. // an empty value appearing in NullFields will be sent to the server as
  538. // null. It is an error if a field in this list has a non-empty value.
  539. // This may be used to include null fields in Patch requests.
  540. NullFields []string `json:"-"`
  541. }
  542. func (s *GoogleDatastoreAdminV1beta1ExportEntitiesRequest) MarshalJSON() ([]byte, error) {
  543. type NoMethod GoogleDatastoreAdminV1beta1ExportEntitiesRequest
  544. raw := NoMethod(*s)
  545. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  546. }
  547. // GoogleDatastoreAdminV1beta1ExportEntitiesResponse: The response
  548. // for
  549. // google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities.
  550. type GoogleDatastoreAdminV1beta1ExportEntitiesResponse struct {
  551. // OutputUrl: Location of the output metadata file. This can be used to
  552. // begin an import
  553. // into Cloud Datastore (this project or another project).
  554. // See
  555. // google.datastore.admin.v1beta1.ImportEntitiesRequest.input_url.
  556. // On
  557. // ly present if the operation completed successfully.
  558. OutputUrl string `json:"outputUrl,omitempty"`
  559. // ForceSendFields is a list of field names (e.g. "OutputUrl") to
  560. // unconditionally include in API requests. By default, fields with
  561. // empty values are omitted from API requests. However, any non-pointer,
  562. // non-interface field appearing in ForceSendFields will be sent to the
  563. // server regardless of whether the field is empty or not. This may be
  564. // used to include empty fields in Patch requests.
  565. ForceSendFields []string `json:"-"`
  566. // NullFields is a list of field names (e.g. "OutputUrl") to include in
  567. // API requests with the JSON null value. By default, fields with empty
  568. // values are omitted from API requests. However, any field with an
  569. // empty value appearing in NullFields will be sent to the server as
  570. // null. It is an error if a field in this list has a non-empty value.
  571. // This may be used to include null fields in Patch requests.
  572. NullFields []string `json:"-"`
  573. }
  574. func (s *GoogleDatastoreAdminV1beta1ExportEntitiesResponse) MarshalJSON() ([]byte, error) {
  575. type NoMethod GoogleDatastoreAdminV1beta1ExportEntitiesResponse
  576. raw := NoMethod(*s)
  577. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  578. }
  579. // GoogleDatastoreAdminV1beta1ImportEntitiesMetadata: Metadata for
  580. // ImportEntities operations.
  581. type GoogleDatastoreAdminV1beta1ImportEntitiesMetadata struct {
  582. // Common: Metadata common to all Datastore Admin operations.
  583. Common *GoogleDatastoreAdminV1beta1CommonMetadata `json:"common,omitempty"`
  584. // EntityFilter: Description of which entities are being imported.
  585. EntityFilter *GoogleDatastoreAdminV1beta1EntityFilter `json:"entityFilter,omitempty"`
  586. // InputUrl: The location of the import metadata file. This will be the
  587. // same value as
  588. // the
  589. // google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url
  590. // field
  591. // .
  592. InputUrl string `json:"inputUrl,omitempty"`
  593. // ProgressBytes: An estimate of the number of bytes processed.
  594. ProgressBytes *GoogleDatastoreAdminV1beta1Progress `json:"progressBytes,omitempty"`
  595. // ProgressEntities: An estimate of the number of entities processed.
  596. ProgressEntities *GoogleDatastoreAdminV1beta1Progress `json:"progressEntities,omitempty"`
  597. // ForceSendFields is a list of field names (e.g. "Common") to
  598. // unconditionally include in API requests. By default, fields with
  599. // empty values are omitted from API requests. However, any non-pointer,
  600. // non-interface field appearing in ForceSendFields will be sent to the
  601. // server regardless of whether the field is empty or not. This may be
  602. // used to include empty fields in Patch requests.
  603. ForceSendFields []string `json:"-"`
  604. // NullFields is a list of field names (e.g. "Common") to include in API
  605. // requests with the JSON null value. By default, fields with empty
  606. // values are omitted from API requests. However, any field with an
  607. // empty value appearing in NullFields will be sent to the server as
  608. // null. It is an error if a field in this list has a non-empty value.
  609. // This may be used to include null fields in Patch requests.
  610. NullFields []string `json:"-"`
  611. }
  612. func (s *GoogleDatastoreAdminV1beta1ImportEntitiesMetadata) MarshalJSON() ([]byte, error) {
  613. type NoMethod GoogleDatastoreAdminV1beta1ImportEntitiesMetadata
  614. raw := NoMethod(*s)
  615. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  616. }
  617. // GoogleDatastoreAdminV1beta1ImportEntitiesRequest: The request
  618. // for
  619. // google.datastore.admin.v1beta1.DatastoreAdmin.ImportEntities.
  620. type GoogleDatastoreAdminV1beta1ImportEntitiesRequest struct {
  621. // EntityFilter: Optionally specify which kinds/namespaces are to be
  622. // imported. If provided,
  623. // the list must be a subset of the EntityFilter used in creating the
  624. // export,
  625. // otherwise a FAILED_PRECONDITION error will be returned. If no filter
  626. // is
  627. // specified then all entities from the export are imported.
  628. EntityFilter *GoogleDatastoreAdminV1beta1EntityFilter `json:"entityFilter,omitempty"`
  629. // InputUrl: The full resource URL of the external storage location.
  630. // Currently, only
  631. // Google Cloud Storage is supported. So input_url should be of the
  632. // form:
  633. // `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`
  634. // , where
  635. // `BUCKET_NAME` is the name of the Cloud Storage bucket,
  636. // `NAMESPACE_PATH` is
  637. // an optional Cloud Storage namespace path (this is not a Cloud
  638. // Datastore
  639. // namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file
  640. // written
  641. // by the ExportEntities operation. For more information about Cloud
  642. // Storage
  643. // namespace paths, see
  644. // [Object
  645. // name
  646. // considerations](https://cloud.google.com/storage/docs/naming#obje
  647. // ct-considerations).
  648. //
  649. // For more information,
  650. // see
  651. // google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url.
  652. InputUrl string `json:"inputUrl,omitempty"`
  653. // Labels: Client-assigned labels.
  654. Labels map[string]string `json:"labels,omitempty"`
  655. // ForceSendFields is a list of field names (e.g. "EntityFilter") to
  656. // unconditionally include in API requests. By default, fields with
  657. // empty values are omitted from API requests. However, any non-pointer,
  658. // non-interface field appearing in ForceSendFields will be sent to the
  659. // server regardless of whether the field is empty or not. This may be
  660. // used to include empty fields in Patch requests.
  661. ForceSendFields []string `json:"-"`
  662. // NullFields is a list of field names (e.g. "EntityFilter") to include
  663. // in API requests with the JSON null value. By default, fields with
  664. // empty values are omitted from API requests. However, any field with
  665. // an empty value appearing in NullFields will be sent to the server as
  666. // null. It is an error if a field in this list has a non-empty value.
  667. // This may be used to include null fields in Patch requests.
  668. NullFields []string `json:"-"`
  669. }
  670. func (s *GoogleDatastoreAdminV1beta1ImportEntitiesRequest) MarshalJSON() ([]byte, error) {
  671. type NoMethod GoogleDatastoreAdminV1beta1ImportEntitiesRequest
  672. raw := NoMethod(*s)
  673. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  674. }
  675. // GoogleDatastoreAdminV1beta1Progress: Measures the progress of a
  676. // particular metric.
  677. type GoogleDatastoreAdminV1beta1Progress struct {
  678. // WorkCompleted: The amount of work that has been completed. Note that
  679. // this may be greater
  680. // than work_estimated.
  681. WorkCompleted int64 `json:"workCompleted,omitempty,string"`
  682. // WorkEstimated: An estimate of how much work needs to be performed.
  683. // May be zero if the
  684. // work estimate is unavailable.
  685. WorkEstimated int64 `json:"workEstimated,omitempty,string"`
  686. // ForceSendFields is a list of field names (e.g. "WorkCompleted") to
  687. // unconditionally include in API requests. By default, fields with
  688. // empty values are omitted from API requests. However, any non-pointer,
  689. // non-interface field appearing in ForceSendFields will be sent to the
  690. // server regardless of whether the field is empty or not. This may be
  691. // used to include empty fields in Patch requests.
  692. ForceSendFields []string `json:"-"`
  693. // NullFields is a list of field names (e.g. "WorkCompleted") to include
  694. // in API requests with the JSON null value. By default, fields with
  695. // empty values are omitted from API requests. However, any field with
  696. // an empty value appearing in NullFields will be sent to the server as
  697. // null. It is an error if a field in this list has a non-empty value.
  698. // This may be used to include null fields in Patch requests.
  699. NullFields []string `json:"-"`
  700. }
  701. func (s *GoogleDatastoreAdminV1beta1Progress) MarshalJSON() ([]byte, error) {
  702. type NoMethod GoogleDatastoreAdminV1beta1Progress
  703. raw := NoMethod(*s)
  704. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  705. }
  706. // GoogleLongrunningOperation: This resource represents a long-running
  707. // operation that is the result of a
  708. // network API call.
  709. type GoogleLongrunningOperation struct {
  710. // Done: If the value is `false`, it means the operation is still in
  711. // progress.
  712. // If `true`, the operation is completed, and either `error` or
  713. // `response` is
  714. // available.
  715. Done bool `json:"done,omitempty"`
  716. // Error: The error result of the operation in case of failure or
  717. // cancellation.
  718. Error *Status `json:"error,omitempty"`
  719. // Metadata: Service-specific metadata associated with the operation.
  720. // It typically
  721. // contains progress information and common metadata such as create
  722. // time.
  723. // Some services might not provide such metadata. Any method that
  724. // returns a
  725. // long-running operation should document the metadata type, if any.
  726. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  727. // Name: The server-assigned name, which is only unique within the same
  728. // service that
  729. // originally returns it. If you use the default HTTP mapping,
  730. // the
  731. // `name` should have the format of `operations/some/unique/name`.
  732. Name string `json:"name,omitempty"`
  733. // Response: The normal response of the operation in case of success.
  734. // If the original
  735. // method returns no data on success, such as `Delete`, the response
  736. // is
  737. // `google.protobuf.Empty`. If the original method is
  738. // standard
  739. // `Get`/`Create`/`Update`, the response should be the resource. For
  740. // other
  741. // methods, the response should have the type `XxxResponse`, where
  742. // `Xxx`
  743. // is the original method name. For example, if the original method
  744. // name
  745. // is `TakeSnapshot()`, the inferred response type
  746. // is
  747. // `TakeSnapshotResponse`.
  748. Response googleapi.RawMessage `json:"response,omitempty"`
  749. // ServerResponse contains the HTTP response code and headers from the
  750. // server.
  751. googleapi.ServerResponse `json:"-"`
  752. // ForceSendFields is a list of field names (e.g. "Done") to
  753. // unconditionally include in API requests. By default, fields with
  754. // empty values are omitted from API requests. However, any non-pointer,
  755. // non-interface field appearing in ForceSendFields will be sent to the
  756. // server regardless of whether the field is empty or not. This may be
  757. // used to include empty fields in Patch requests.
  758. ForceSendFields []string `json:"-"`
  759. // NullFields is a list of field names (e.g. "Done") to include in API
  760. // requests with the JSON null value. By default, fields with empty
  761. // values are omitted from API requests. However, any field with an
  762. // empty value appearing in NullFields will be sent to the server as
  763. // null. It is an error if a field in this list has a non-empty value.
  764. // This may be used to include null fields in Patch requests.
  765. NullFields []string `json:"-"`
  766. }
  767. func (s *GoogleLongrunningOperation) MarshalJSON() ([]byte, error) {
  768. type NoMethod GoogleLongrunningOperation
  769. raw := NoMethod(*s)
  770. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  771. }
  772. // Status: The `Status` type defines a logical error model that is
  773. // suitable for different
  774. // programming environments, including REST APIs and RPC APIs. It is
  775. // used by
  776. // [gRPC](https://github.com/grpc). The error model is designed to
  777. // be:
  778. //
  779. // - Simple to use and understand for most users
  780. // - Flexible enough to meet unexpected needs
  781. //
  782. // # Overview
  783. //
  784. // The `Status` message contains three pieces of data: error code, error
  785. // message,
  786. // and error details. The error code should be an enum value
  787. // of
  788. // google.rpc.Code, but it may accept additional error codes if needed.
  789. // The
  790. // error message should be a developer-facing English message that
  791. // helps
  792. // developers *understand* and *resolve* the error. If a localized
  793. // user-facing
  794. // error message is needed, put the localized message in the error
  795. // details or
  796. // localize it in the client. The optional error details may contain
  797. // arbitrary
  798. // information about the error. There is a predefined set of error
  799. // detail types
  800. // in the package `google.rpc` that can be used for common error
  801. // conditions.
  802. //
  803. // # Language mapping
  804. //
  805. // The `Status` message is the logical representation of the error
  806. // model, but it
  807. // is not necessarily the actual wire format. When the `Status` message
  808. // is
  809. // exposed in different client libraries and different wire protocols,
  810. // it can be
  811. // mapped differently. For example, it will likely be mapped to some
  812. // exceptions
  813. // in Java, but more likely mapped to some error codes in C.
  814. //
  815. // # Other uses
  816. //
  817. // The error model and the `Status` message can be used in a variety
  818. // of
  819. // environments, either with or without APIs, to provide a
  820. // consistent developer experience across different
  821. // environments.
  822. //
  823. // Example uses of this error model include:
  824. //
  825. // - Partial errors. If a service needs to return partial errors to the
  826. // client,
  827. // it may embed the `Status` in the normal response to indicate the
  828. // partial
  829. // errors.
  830. //
  831. // - Workflow errors. A typical workflow has multiple steps. Each step
  832. // may
  833. // have a `Status` message for error reporting.
  834. //
  835. // - Batch operations. If a client uses batch request and batch
  836. // response, the
  837. // `Status` message should be used directly inside batch response,
  838. // one for
  839. // each error sub-response.
  840. //
  841. // - Asynchronous operations. If an API call embeds asynchronous
  842. // operation
  843. // results in its response, the status of those operations should
  844. // be
  845. // represented directly using the `Status` message.
  846. //
  847. // - Logging. If some API errors are stored in logs, the message
  848. // `Status` could
  849. // be used directly after any stripping needed for security/privacy
  850. // reasons.
  851. type Status struct {
  852. // Code: The status code, which should be an enum value of
  853. // google.rpc.Code.
  854. Code int64 `json:"code,omitempty"`
  855. // Details: A list of messages that carry the error details. There is a
  856. // common set of
  857. // message types for APIs to use.
  858. Details []googleapi.RawMessage `json:"details,omitempty"`
  859. // Message: A developer-facing error message, which should be in
  860. // English. Any
  861. // user-facing error message should be localized and sent in
  862. // the
  863. // google.rpc.Status.details field, or localized by the client.
  864. Message string `json:"message,omitempty"`
  865. // ForceSendFields is a list of field names (e.g. "Code") to
  866. // unconditionally include in API requests. By default, fields with
  867. // empty values are omitted from API requests. However, any non-pointer,
  868. // non-interface field appearing in ForceSendFields will be sent to the
  869. // server regardless of whether the field is empty or not. This may be
  870. // used to include empty fields in Patch requests.
  871. ForceSendFields []string `json:"-"`
  872. // NullFields is a list of field names (e.g. "Code") to include in API
  873. // requests with the JSON null value. By default, fields with empty
  874. // values are omitted from API requests. However, any field with an
  875. // empty value appearing in NullFields will be sent to the server as
  876. // null. It is an error if a field in this list has a non-empty value.
  877. // This may be used to include null fields in Patch requests.
  878. NullFields []string `json:"-"`
  879. }
  880. func (s *Status) MarshalJSON() ([]byte, error) {
  881. type NoMethod Status
  882. raw := NoMethod(*s)
  883. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  884. }
  885. // method id "datastore.projects.export":
  886. type ProjectsExportCall struct {
  887. s *Service
  888. projectId string
  889. googledatastoreadminv1beta1exportentitiesrequest *GoogleDatastoreAdminV1beta1ExportEntitiesRequest
  890. urlParams_ gensupport.URLParams
  891. ctx_ context.Context
  892. header_ http.Header
  893. }
  894. // Export: Exports a copy of all or a subset of entities from Google
  895. // Cloud Datastore
  896. // to another storage system, such as Google Cloud Storage. Recent
  897. // updates to
  898. // entities may not be reflected in the export. The export occurs in
  899. // the
  900. // background and its progress can be monitored and managed via
  901. // the
  902. // Operation resource that is created. The output of an export may only
  903. // be
  904. // used once the associated operation is done. If an export operation
  905. // is
  906. // cancelled before completion it may leave partial data behind in
  907. // Google
  908. // Cloud Storage.
  909. func (r *ProjectsService) Export(projectId string, googledatastoreadminv1beta1exportentitiesrequest *GoogleDatastoreAdminV1beta1ExportEntitiesRequest) *ProjectsExportCall {
  910. c := &ProjectsExportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  911. c.projectId = projectId
  912. c.googledatastoreadminv1beta1exportentitiesrequest = googledatastoreadminv1beta1exportentitiesrequest
  913. return c
  914. }
  915. // Fields allows partial responses to be retrieved. See
  916. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  917. // for more information.
  918. func (c *ProjectsExportCall) Fields(s ...googleapi.Field) *ProjectsExportCall {
  919. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  920. return c
  921. }
  922. // Context sets the context to be used in this call's Do method. Any
  923. // pending HTTP request will be aborted if the provided context is
  924. // canceled.
  925. func (c *ProjectsExportCall) Context(ctx context.Context) *ProjectsExportCall {
  926. c.ctx_ = ctx
  927. return c
  928. }
  929. // Header returns an http.Header that can be modified by the caller to
  930. // add HTTP headers to the request.
  931. func (c *ProjectsExportCall) Header() http.Header {
  932. if c.header_ == nil {
  933. c.header_ = make(http.Header)
  934. }
  935. return c.header_
  936. }
  937. func (c *ProjectsExportCall) doRequest(alt string) (*http.Response, error) {
  938. reqHeaders := make(http.Header)
  939. for k, v := range c.header_ {
  940. reqHeaders[k] = v
  941. }
  942. reqHeaders.Set("User-Agent", c.s.userAgent())
  943. var body io.Reader = nil
  944. body, err := googleapi.WithoutDataWrapper.JSONReader(c.googledatastoreadminv1beta1exportentitiesrequest)
  945. if err != nil {
  946. return nil, err
  947. }
  948. reqHeaders.Set("Content-Type", "application/json")
  949. c.urlParams_.Set("alt", alt)
  950. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}:export")
  951. urls += "?" + c.urlParams_.Encode()
  952. req, _ := http.NewRequest("POST", urls, body)
  953. req.Header = reqHeaders
  954. googleapi.Expand(req.URL, map[string]string{
  955. "projectId": c.projectId,
  956. })
  957. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  958. }
  959. // Do executes the "datastore.projects.export" call.
  960. // Exactly one of *GoogleLongrunningOperation or error will be non-nil.
  961. // Any non-2xx status code is an error. Response headers are in either
  962. // *GoogleLongrunningOperation.ServerResponse.Header or (if a response
  963. // was returned at all) in error.(*googleapi.Error).Header. Use
  964. // googleapi.IsNotModified to check whether the returned error was
  965. // because http.StatusNotModified was returned.
  966. func (c *ProjectsExportCall) Do(opts ...googleapi.CallOption) (*GoogleLongrunningOperation, error) {
  967. gensupport.SetOptions(c.urlParams_, opts...)
  968. res, err := c.doRequest("json")
  969. if res != nil && res.StatusCode == http.StatusNotModified {
  970. if res.Body != nil {
  971. res.Body.Close()
  972. }
  973. return nil, &googleapi.Error{
  974. Code: res.StatusCode,
  975. Header: res.Header,
  976. }
  977. }
  978. if err != nil {
  979. return nil, err
  980. }
  981. defer googleapi.CloseBody(res)
  982. if err := googleapi.CheckResponse(res); err != nil {
  983. return nil, err
  984. }
  985. ret := &GoogleLongrunningOperation{
  986. ServerResponse: googleapi.ServerResponse{
  987. Header: res.Header,
  988. HTTPStatusCode: res.StatusCode,
  989. },
  990. }
  991. target := &ret
  992. if err := gensupport.DecodeResponse(target, res); err != nil {
  993. return nil, err
  994. }
  995. return ret, nil
  996. // {
  997. // "description": "Exports a copy of all or a subset of entities from Google Cloud Datastore\nto another storage system, such as Google Cloud Storage. Recent updates to\nentities may not be reflected in the export. The export occurs in the\nbackground and its progress can be monitored and managed via the\nOperation resource that is created. The output of an export may only be\nused once the associated operation is done. If an export operation is\ncancelled before completion it may leave partial data behind in Google\nCloud Storage.",
  998. // "flatPath": "v1beta1/projects/{projectId}:export",
  999. // "httpMethod": "POST",
  1000. // "id": "datastore.projects.export",
  1001. // "parameterOrder": [
  1002. // "projectId"
  1003. // ],
  1004. // "parameters": {
  1005. // "projectId": {
  1006. // "description": "Project ID against which to make the request.",
  1007. // "location": "path",
  1008. // "required": true,
  1009. // "type": "string"
  1010. // }
  1011. // },
  1012. // "path": "v1beta1/projects/{projectId}:export",
  1013. // "request": {
  1014. // "$ref": "GoogleDatastoreAdminV1beta1ExportEntitiesRequest"
  1015. // },
  1016. // "response": {
  1017. // "$ref": "GoogleLongrunningOperation"
  1018. // },
  1019. // "scopes": [
  1020. // "https://www.googleapis.com/auth/cloud-platform",
  1021. // "https://www.googleapis.com/auth/datastore"
  1022. // ]
  1023. // }
  1024. }
  1025. // method id "datastore.projects.import":
  1026. type ProjectsImportCall struct {
  1027. s *Service
  1028. projectId string
  1029. googledatastoreadminv1beta1importentitiesrequest *GoogleDatastoreAdminV1beta1ImportEntitiesRequest
  1030. urlParams_ gensupport.URLParams
  1031. ctx_ context.Context
  1032. header_ http.Header
  1033. }
  1034. // Import: Imports entities into Google Cloud Datastore. Existing
  1035. // entities with the
  1036. // same key are overwritten. The import occurs in the background and
  1037. // its
  1038. // progress can be monitored and managed via the Operation resource that
  1039. // is
  1040. // created. If an ImportEntities operation is cancelled, it is
  1041. // possible
  1042. // that a subset of the data has already been imported to Cloud
  1043. // Datastore.
  1044. func (r *ProjectsService) Import(projectId string, googledatastoreadminv1beta1importentitiesrequest *GoogleDatastoreAdminV1beta1ImportEntitiesRequest) *ProjectsImportCall {
  1045. c := &ProjectsImportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1046. c.projectId = projectId
  1047. c.googledatastoreadminv1beta1importentitiesrequest = googledatastoreadminv1beta1importentitiesrequest
  1048. return c
  1049. }
  1050. // Fields allows partial responses to be retrieved. See
  1051. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1052. // for more information.
  1053. func (c *ProjectsImportCall) Fields(s ...googleapi.Field) *ProjectsImportCall {
  1054. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1055. return c
  1056. }
  1057. // Context sets the context to be used in this call's Do method. Any
  1058. // pending HTTP request will be aborted if the provided context is
  1059. // canceled.
  1060. func (c *ProjectsImportCall) Context(ctx context.Context) *ProjectsImportCall {
  1061. c.ctx_ = ctx
  1062. return c
  1063. }
  1064. // Header returns an http.Header that can be modified by the caller to
  1065. // add HTTP headers to the request.
  1066. func (c *ProjectsImportCall) Header() http.Header {
  1067. if c.header_ == nil {
  1068. c.header_ = make(http.Header)
  1069. }
  1070. return c.header_
  1071. }
  1072. func (c *ProjectsImportCall) doRequest(alt string) (*http.Response, error) {
  1073. reqHeaders := make(http.Header)
  1074. for k, v := range c.header_ {
  1075. reqHeaders[k] = v
  1076. }
  1077. reqHeaders.Set("User-Agent", c.s.userAgent())
  1078. var body io.Reader = nil
  1079. body, err := googleapi.WithoutDataWrapper.JSONReader(c.googledatastoreadminv1beta1importentitiesrequest)
  1080. if err != nil {
  1081. return nil, err
  1082. }
  1083. reqHeaders.Set("Content-Type", "application/json")
  1084. c.urlParams_.Set("alt", alt)
  1085. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}:import")
  1086. urls += "?" + c.urlParams_.Encode()
  1087. req, _ := http.NewRequest("POST", urls, body)
  1088. req.Header = reqHeaders
  1089. googleapi.Expand(req.URL, map[string]string{
  1090. "projectId": c.projectId,
  1091. })
  1092. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1093. }
  1094. // Do executes the "datastore.projects.import" call.
  1095. // Exactly one of *GoogleLongrunningOperation or error will be non-nil.
  1096. // Any non-2xx status code is an error. Response headers are in either
  1097. // *GoogleLongrunningOperation.ServerResponse.Header or (if a response
  1098. // was returned at all) in error.(*googleapi.Error).Header. Use
  1099. // googleapi.IsNotModified to check whether the returned error was
  1100. // because http.StatusNotModified was returned.
  1101. func (c *ProjectsImportCall) Do(opts ...googleapi.CallOption) (*GoogleLongrunningOperation, error) {
  1102. gensupport.SetOptions(c.urlParams_, opts...)
  1103. res, err := c.doRequest("json")
  1104. if res != nil && res.StatusCode == http.StatusNotModified {
  1105. if res.Body != nil {
  1106. res.Body.Close()
  1107. }
  1108. return nil, &googleapi.Error{
  1109. Code: res.StatusCode,
  1110. Header: res.Header,
  1111. }
  1112. }
  1113. if err != nil {
  1114. return nil, err
  1115. }
  1116. defer googleapi.CloseBody(res)
  1117. if err := googleapi.CheckResponse(res); err != nil {
  1118. return nil, err
  1119. }
  1120. ret := &GoogleLongrunningOperation{
  1121. ServerResponse: googleapi.ServerResponse{
  1122. Header: res.Header,
  1123. HTTPStatusCode: res.StatusCode,
  1124. },
  1125. }
  1126. target := &ret
  1127. if err := gensupport.DecodeResponse(target, res); err != nil {
  1128. return nil, err
  1129. }
  1130. return ret, nil
  1131. // {
  1132. // "description": "Imports entities into Google Cloud Datastore. Existing entities with the\nsame key are overwritten. The import occurs in the background and its\nprogress can be monitored and managed via the Operation resource that is\ncreated. If an ImportEntities operation is cancelled, it is possible\nthat a subset of the data has already been imported to Cloud Datastore.",
  1133. // "flatPath": "v1beta1/projects/{projectId}:import",
  1134. // "httpMethod": "POST",
  1135. // "id": "datastore.projects.import",
  1136. // "parameterOrder": [
  1137. // "projectId"
  1138. // ],
  1139. // "parameters": {
  1140. // "projectId": {
  1141. // "description": "Project ID against which to make the request.",
  1142. // "location": "path",
  1143. // "required": true,
  1144. // "type": "string"
  1145. // }
  1146. // },
  1147. // "path": "v1beta1/projects/{projectId}:import",
  1148. // "request": {
  1149. // "$ref": "GoogleDatastoreAdminV1beta1ImportEntitiesRequest"
  1150. // },
  1151. // "response": {
  1152. // "$ref": "GoogleLongrunningOperation"
  1153. // },
  1154. // "scopes": [
  1155. // "https://www.googleapis.com/auth/cloud-platform",
  1156. // "https://www.googleapis.com/auth/datastore"
  1157. // ]
  1158. // }
  1159. }