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.
 
 
 

2470 lines
85 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package cloudasset provides access to the Cloud Asset API.
  6. //
  7. // For product documentation, see: https://console.cloud.google.com/apis/api/cloudasset.googleapis.com/overview
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudasset/v1beta1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudassetService, err := cloudasset.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // cloudassetService, err := cloudasset.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // cloudassetService, err := cloudasset.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package cloudasset // import "google.golang.org/api/cloudasset/v1beta1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "cloudasset:v1beta1"
  67. const apiName = "cloudasset"
  68. const apiVersion = "v1beta1"
  69. const basePath = "https://cloudasset.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Folders = NewFoldersService(s)
  106. s.Organizations = NewOrganizationsService(s)
  107. s.Projects = NewProjectsService(s)
  108. return s, nil
  109. }
  110. type Service struct {
  111. client *http.Client
  112. BasePath string // API endpoint base URL
  113. UserAgent string // optional additional User-Agent fragment
  114. Folders *FoldersService
  115. Organizations *OrganizationsService
  116. Projects *ProjectsService
  117. }
  118. func (s *Service) userAgent() string {
  119. if s.UserAgent == "" {
  120. return googleapi.UserAgent
  121. }
  122. return googleapi.UserAgent + " " + s.UserAgent
  123. }
  124. func NewFoldersService(s *Service) *FoldersService {
  125. rs := &FoldersService{s: s}
  126. rs.Operations = NewFoldersOperationsService(s)
  127. return rs
  128. }
  129. type FoldersService struct {
  130. s *Service
  131. Operations *FoldersOperationsService
  132. }
  133. func NewFoldersOperationsService(s *Service) *FoldersOperationsService {
  134. rs := &FoldersOperationsService{s: s}
  135. return rs
  136. }
  137. type FoldersOperationsService struct {
  138. s *Service
  139. }
  140. func NewOrganizationsService(s *Service) *OrganizationsService {
  141. rs := &OrganizationsService{s: s}
  142. rs.Operations = NewOrganizationsOperationsService(s)
  143. return rs
  144. }
  145. type OrganizationsService struct {
  146. s *Service
  147. Operations *OrganizationsOperationsService
  148. }
  149. func NewOrganizationsOperationsService(s *Service) *OrganizationsOperationsService {
  150. rs := &OrganizationsOperationsService{s: s}
  151. return rs
  152. }
  153. type OrganizationsOperationsService struct {
  154. s *Service
  155. }
  156. func NewProjectsService(s *Service) *ProjectsService {
  157. rs := &ProjectsService{s: s}
  158. rs.Operations = NewProjectsOperationsService(s)
  159. return rs
  160. }
  161. type ProjectsService struct {
  162. s *Service
  163. Operations *ProjectsOperationsService
  164. }
  165. func NewProjectsOperationsService(s *Service) *ProjectsOperationsService {
  166. rs := &ProjectsOperationsService{s: s}
  167. return rs
  168. }
  169. type ProjectsOperationsService struct {
  170. s *Service
  171. }
  172. // Asset: Cloud asset. This includes all Google Cloud Platform
  173. // resources,
  174. // Cloud IAM policies, and other non-GCP assets.
  175. type Asset struct {
  176. // AssetType: Type of the asset. Example: "google.compute.Disk".
  177. AssetType string `json:"assetType,omitempty"`
  178. // IamPolicy: Representation of the actual Cloud IAM policy set on a
  179. // cloud resource. For
  180. // each resource, there must be at most one Cloud IAM policy set on it.
  181. IamPolicy *Policy `json:"iamPolicy,omitempty"`
  182. // Name: The full name of the asset. For
  183. // example:
  184. // `//compute.googleapis.com/projects/my_project_123/zones/zone1
  185. // /instances/instance1`.
  186. // See
  187. // [Resource
  188. // Names](https://cloud.google.com/apis/design/resource_names#f
  189. // ull_resource_name)
  190. // for more information.
  191. Name string `json:"name,omitempty"`
  192. // Resource: Representation of the resource.
  193. Resource *Resource `json:"resource,omitempty"`
  194. // ForceSendFields is a list of field names (e.g. "AssetType") to
  195. // unconditionally include in API requests. By default, fields with
  196. // empty values are omitted from API requests. However, any non-pointer,
  197. // non-interface field appearing in ForceSendFields will be sent to the
  198. // server regardless of whether the field is empty or not. This may be
  199. // used to include empty fields in Patch requests.
  200. ForceSendFields []string `json:"-"`
  201. // NullFields is a list of field names (e.g. "AssetType") to include in
  202. // API requests with the JSON null value. By default, fields with empty
  203. // values are omitted from API requests. However, any field with an
  204. // empty value appearing in NullFields will be sent to the server as
  205. // null. It is an error if a field in this list has a non-empty value.
  206. // This may be used to include null fields in Patch requests.
  207. NullFields []string `json:"-"`
  208. }
  209. func (s *Asset) MarshalJSON() ([]byte, error) {
  210. type NoMethod Asset
  211. raw := NoMethod(*s)
  212. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  213. }
  214. // AuditConfig: Specifies the audit configuration for a service.
  215. // The configuration determines which permission types are logged, and
  216. // what
  217. // identities, if any, are exempted from logging.
  218. // An AuditConfig must have one or more AuditLogConfigs.
  219. //
  220. // If there are AuditConfigs for both `allServices` and a specific
  221. // service,
  222. // the union of the two AuditConfigs is used for that service: the
  223. // log_types
  224. // specified in each AuditConfig are enabled, and the exempted_members
  225. // in each
  226. // AuditLogConfig are exempted.
  227. //
  228. // Example Policy with multiple AuditConfigs:
  229. //
  230. // {
  231. // "audit_configs": [
  232. // {
  233. // "service": "allServices"
  234. // "audit_log_configs": [
  235. // {
  236. // "log_type": "DATA_READ",
  237. // "exempted_members": [
  238. // "user:foo@gmail.com"
  239. // ]
  240. // },
  241. // {
  242. // "log_type": "DATA_WRITE",
  243. // },
  244. // {
  245. // "log_type": "ADMIN_READ",
  246. // }
  247. // ]
  248. // },
  249. // {
  250. // "service": "fooservice.googleapis.com"
  251. // "audit_log_configs": [
  252. // {
  253. // "log_type": "DATA_READ",
  254. // },
  255. // {
  256. // "log_type": "DATA_WRITE",
  257. // "exempted_members": [
  258. // "user:bar@gmail.com"
  259. // ]
  260. // }
  261. // ]
  262. // }
  263. // ]
  264. // }
  265. //
  266. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  267. // ADMIN_READ
  268. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  269. // and
  270. // bar@gmail.com from DATA_WRITE logging.
  271. type AuditConfig struct {
  272. // AuditLogConfigs: The configuration for logging of each type of
  273. // permission.
  274. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  275. // Service: Specifies a service that will be enabled for audit
  276. // logging.
  277. // For example, `storage.googleapis.com`,
  278. // `cloudsql.googleapis.com`.
  279. // `allServices` is a special value that covers all services.
  280. Service string `json:"service,omitempty"`
  281. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  282. // unconditionally include in API requests. By default, fields with
  283. // empty values are omitted from API requests. However, any non-pointer,
  284. // non-interface field appearing in ForceSendFields will be sent to the
  285. // server regardless of whether the field is empty or not. This may be
  286. // used to include empty fields in Patch requests.
  287. ForceSendFields []string `json:"-"`
  288. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  289. // include in API requests with the JSON null value. By default, fields
  290. // with empty values are omitted from API requests. However, any field
  291. // with an empty value appearing in NullFields will be sent to the
  292. // server as null. It is an error if a field in this list has a
  293. // non-empty value. This may be used to include null fields in Patch
  294. // requests.
  295. NullFields []string `json:"-"`
  296. }
  297. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  298. type NoMethod AuditConfig
  299. raw := NoMethod(*s)
  300. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  301. }
  302. // AuditLogConfig: Provides the configuration for logging a type of
  303. // permissions.
  304. // Example:
  305. //
  306. // {
  307. // "audit_log_configs": [
  308. // {
  309. // "log_type": "DATA_READ",
  310. // "exempted_members": [
  311. // "user:foo@gmail.com"
  312. // ]
  313. // },
  314. // {
  315. // "log_type": "DATA_WRITE",
  316. // }
  317. // ]
  318. // }
  319. //
  320. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  321. // exempting
  322. // foo@gmail.com from DATA_READ logging.
  323. type AuditLogConfig struct {
  324. // ExemptedMembers: Specifies the identities that do not cause logging
  325. // for this type of
  326. // permission.
  327. // Follows the same format of Binding.members.
  328. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  329. // LogType: The log type that this config enables.
  330. //
  331. // Possible values:
  332. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  333. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  334. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  335. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  336. LogType string `json:"logType,omitempty"`
  337. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  338. // unconditionally include in API requests. By default, fields with
  339. // empty values are omitted from API requests. However, any non-pointer,
  340. // non-interface field appearing in ForceSendFields will be sent to the
  341. // server regardless of whether the field is empty or not. This may be
  342. // used to include empty fields in Patch requests.
  343. ForceSendFields []string `json:"-"`
  344. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  345. // include in API requests with the JSON null value. By default, fields
  346. // with empty values are omitted from API requests. However, any field
  347. // with an empty value appearing in NullFields will be sent to the
  348. // server as null. It is an error if a field in this list has a
  349. // non-empty value. This may be used to include null fields in Patch
  350. // requests.
  351. NullFields []string `json:"-"`
  352. }
  353. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  354. type NoMethod AuditLogConfig
  355. raw := NoMethod(*s)
  356. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  357. }
  358. // BatchGetAssetsHistoryResponse: Batch get assets history response.
  359. type BatchGetAssetsHistoryResponse struct {
  360. // Assets: A list of assets with valid time windows.
  361. Assets []*TemporalAsset `json:"assets,omitempty"`
  362. // ServerResponse contains the HTTP response code and headers from the
  363. // server.
  364. googleapi.ServerResponse `json:"-"`
  365. // ForceSendFields is a list of field names (e.g. "Assets") to
  366. // unconditionally include in API requests. By default, fields with
  367. // empty values are omitted from API requests. However, any non-pointer,
  368. // non-interface field appearing in ForceSendFields will be sent to the
  369. // server regardless of whether the field is empty or not. This may be
  370. // used to include empty fields in Patch requests.
  371. ForceSendFields []string `json:"-"`
  372. // NullFields is a list of field names (e.g. "Assets") to include in API
  373. // requests with the JSON null value. By default, fields with empty
  374. // values are omitted from API requests. However, any field with an
  375. // empty value appearing in NullFields will be sent to the server as
  376. // null. It is an error if a field in this list has a non-empty value.
  377. // This may be used to include null fields in Patch requests.
  378. NullFields []string `json:"-"`
  379. }
  380. func (s *BatchGetAssetsHistoryResponse) MarshalJSON() ([]byte, error) {
  381. type NoMethod BatchGetAssetsHistoryResponse
  382. raw := NoMethod(*s)
  383. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  384. }
  385. // Binding: Associates `members` with a `role`.
  386. type Binding struct {
  387. // Condition: Unimplemented. The condition that is associated with this
  388. // binding.
  389. // NOTE: an unsatisfied condition will not allow user access via
  390. // current
  391. // binding. Different bindings, including their conditions, are
  392. // examined
  393. // independently.
  394. Condition *Expr `json:"condition,omitempty"`
  395. // Members: Specifies the identities requesting access for a Cloud
  396. // Platform resource.
  397. // `members` can have the following values:
  398. //
  399. // * `allUsers`: A special identifier that represents anyone who is
  400. // on the internet; with or without a Google account.
  401. //
  402. // * `allAuthenticatedUsers`: A special identifier that represents
  403. // anyone
  404. // who is authenticated with a Google account or a service
  405. // account.
  406. //
  407. // * `user:{emailid}`: An email address that represents a specific
  408. // Google
  409. // account. For example, `alice@gmail.com` .
  410. //
  411. //
  412. // * `serviceAccount:{emailid}`: An email address that represents a
  413. // service
  414. // account. For example,
  415. // `my-other-app@appspot.gserviceaccount.com`.
  416. //
  417. // * `group:{emailid}`: An email address that represents a Google
  418. // group.
  419. // For example, `admins@example.com`.
  420. //
  421. //
  422. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  423. // the
  424. // users of that domain. For example, `google.com` or
  425. // `example.com`.
  426. //
  427. //
  428. Members []string `json:"members,omitempty"`
  429. // Role: Role that is assigned to `members`.
  430. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  431. Role string `json:"role,omitempty"`
  432. // ForceSendFields is a list of field names (e.g. "Condition") to
  433. // unconditionally include in API requests. By default, fields with
  434. // empty values are omitted from API requests. However, any non-pointer,
  435. // non-interface field appearing in ForceSendFields will be sent to the
  436. // server regardless of whether the field is empty or not. This may be
  437. // used to include empty fields in Patch requests.
  438. ForceSendFields []string `json:"-"`
  439. // NullFields is a list of field names (e.g. "Condition") to include in
  440. // API requests with the JSON null value. By default, fields with empty
  441. // values are omitted from API requests. However, any field with an
  442. // empty value appearing in NullFields will be sent to the server as
  443. // null. It is an error if a field in this list has a non-empty value.
  444. // This may be used to include null fields in Patch requests.
  445. NullFields []string `json:"-"`
  446. }
  447. func (s *Binding) MarshalJSON() ([]byte, error) {
  448. type NoMethod Binding
  449. raw := NoMethod(*s)
  450. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  451. }
  452. // ExportAssetsRequest: Export asset request.
  453. type ExportAssetsRequest struct {
  454. // AssetTypes: A list of asset types of which to take a snapshot for.
  455. // For example:
  456. // "google.compute.Disk". If specified, only matching assets will be
  457. // returned.
  458. // See [Introduction to Cloud
  459. // Asset
  460. // Inventory](https://cloud.google.com/resource-manager/docs/cloud-
  461. // asset-inventory/overview)
  462. // for all supported asset types.
  463. AssetTypes []string `json:"assetTypes,omitempty"`
  464. // ContentType: Asset content type. If not specified, no content but the
  465. // asset name will be
  466. // returned.
  467. //
  468. // Possible values:
  469. // "CONTENT_TYPE_UNSPECIFIED" - Unspecified content type.
  470. // "RESOURCE" - Resource metadata.
  471. // "IAM_POLICY" - The actual IAM policy set on a resource.
  472. ContentType string `json:"contentType,omitempty"`
  473. // OutputConfig: Required. Output configuration indicating where the
  474. // results will be output
  475. // to. All results will be in newline delimited JSON format.
  476. OutputConfig *OutputConfig `json:"outputConfig,omitempty"`
  477. // ReadTime: Timestamp to take an asset snapshot. This can only be set
  478. // to a timestamp
  479. // between 2018-10-02 UTC (inclusive) and the current time. If not
  480. // specified,
  481. // the current time will be used. Due to delays in resource data
  482. // collection
  483. // and indexing, there is a volatile window during which running the
  484. // same
  485. // query may get different results.
  486. ReadTime string `json:"readTime,omitempty"`
  487. // ForceSendFields is a list of field names (e.g. "AssetTypes") to
  488. // unconditionally include in API requests. By default, fields with
  489. // empty values are omitted from API requests. However, any non-pointer,
  490. // non-interface field appearing in ForceSendFields will be sent to the
  491. // server regardless of whether the field is empty or not. This may be
  492. // used to include empty fields in Patch requests.
  493. ForceSendFields []string `json:"-"`
  494. // NullFields is a list of field names (e.g. "AssetTypes") to include in
  495. // API requests with the JSON null value. By default, fields with empty
  496. // values are omitted from API requests. However, any field with an
  497. // empty value appearing in NullFields will be sent to the server as
  498. // null. It is an error if a field in this list has a non-empty value.
  499. // This may be used to include null fields in Patch requests.
  500. NullFields []string `json:"-"`
  501. }
  502. func (s *ExportAssetsRequest) MarshalJSON() ([]byte, error) {
  503. type NoMethod ExportAssetsRequest
  504. raw := NoMethod(*s)
  505. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  506. }
  507. // Expr: Represents an expression text. Example:
  508. //
  509. // title: "User account presence"
  510. // description: "Determines whether the request has a user account"
  511. // expression: "size(request.user) > 0"
  512. type Expr struct {
  513. // Description: An optional description of the expression. This is a
  514. // longer text which
  515. // describes the expression, e.g. when hovered over it in a UI.
  516. Description string `json:"description,omitempty"`
  517. // Expression: Textual representation of an expression in
  518. // Common Expression Language syntax.
  519. //
  520. // The application context of the containing message determines
  521. // which
  522. // well-known feature set of CEL is supported.
  523. Expression string `json:"expression,omitempty"`
  524. // Location: An optional string indicating the location of the
  525. // expression for error
  526. // reporting, e.g. a file name and a position in the file.
  527. Location string `json:"location,omitempty"`
  528. // Title: An optional title for the expression, i.e. a short string
  529. // describing
  530. // its purpose. This can be used e.g. in UIs which allow to enter
  531. // the
  532. // expression.
  533. Title string `json:"title,omitempty"`
  534. // ForceSendFields is a list of field names (e.g. "Description") to
  535. // unconditionally include in API requests. By default, fields with
  536. // empty values are omitted from API requests. However, any non-pointer,
  537. // non-interface field appearing in ForceSendFields will be sent to the
  538. // server regardless of whether the field is empty or not. This may be
  539. // used to include empty fields in Patch requests.
  540. ForceSendFields []string `json:"-"`
  541. // NullFields is a list of field names (e.g. "Description") to include
  542. // in API requests with the JSON null value. By default, fields with
  543. // empty values are omitted from API requests. However, any field with
  544. // an empty value appearing in NullFields will be sent to the server as
  545. // null. It is an error if a field in this list has a non-empty value.
  546. // This may be used to include null fields in Patch requests.
  547. NullFields []string `json:"-"`
  548. }
  549. func (s *Expr) MarshalJSON() ([]byte, error) {
  550. type NoMethod Expr
  551. raw := NoMethod(*s)
  552. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  553. }
  554. // GcsDestination: A Cloud Storage location.
  555. type GcsDestination struct {
  556. // Uri: The uri of the Cloud Storage object. It's the same uri that is
  557. // used by
  558. // gsutil. For example: "gs://bucket_name/object_name". See [Viewing
  559. // and
  560. // Editing
  561. // Object
  562. // Metadata](https://cloud.google.com/storage/docs/viewing-editing
  563. // -metadata)
  564. // for more information.
  565. Uri string `json:"uri,omitempty"`
  566. // ForceSendFields is a list of field names (e.g. "Uri") to
  567. // unconditionally include in API requests. By default, fields with
  568. // empty values are omitted from API requests. However, any non-pointer,
  569. // non-interface field appearing in ForceSendFields will be sent to the
  570. // server regardless of whether the field is empty or not. This may be
  571. // used to include empty fields in Patch requests.
  572. ForceSendFields []string `json:"-"`
  573. // NullFields is a list of field names (e.g. "Uri") to include in API
  574. // requests with the JSON null value. By default, fields with empty
  575. // values are omitted from API requests. However, any field with an
  576. // empty value appearing in NullFields will be sent to the server as
  577. // null. It is an error if a field in this list has a non-empty value.
  578. // This may be used to include null fields in Patch requests.
  579. NullFields []string `json:"-"`
  580. }
  581. func (s *GcsDestination) MarshalJSON() ([]byte, error) {
  582. type NoMethod GcsDestination
  583. raw := NoMethod(*s)
  584. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  585. }
  586. // Operation: This resource represents a long-running operation that is
  587. // the result of a
  588. // network API call.
  589. type Operation struct {
  590. // Done: If the value is `false`, it means the operation is still in
  591. // progress.
  592. // If `true`, the operation is completed, and either `error` or
  593. // `response` is
  594. // available.
  595. Done bool `json:"done,omitempty"`
  596. // Error: The error result of the operation in case of failure or
  597. // cancellation.
  598. Error *Status `json:"error,omitempty"`
  599. // Metadata: Service-specific metadata associated with the operation.
  600. // It typically
  601. // contains progress information and common metadata such as create
  602. // time.
  603. // Some services might not provide such metadata. Any method that
  604. // returns a
  605. // long-running operation should document the metadata type, if any.
  606. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  607. // Name: The server-assigned name, which is only unique within the same
  608. // service that
  609. // originally returns it. If you use the default HTTP mapping,
  610. // the
  611. // `name` should have the format of `operations/some/unique/name`.
  612. Name string `json:"name,omitempty"`
  613. // Response: The normal response of the operation in case of success.
  614. // If the original
  615. // method returns no data on success, such as `Delete`, the response
  616. // is
  617. // `google.protobuf.Empty`. If the original method is
  618. // standard
  619. // `Get`/`Create`/`Update`, the response should be the resource. For
  620. // other
  621. // methods, the response should have the type `XxxResponse`, where
  622. // `Xxx`
  623. // is the original method name. For example, if the original method
  624. // name
  625. // is `TakeSnapshot()`, the inferred response type
  626. // is
  627. // `TakeSnapshotResponse`.
  628. Response googleapi.RawMessage `json:"response,omitempty"`
  629. // ServerResponse contains the HTTP response code and headers from the
  630. // server.
  631. googleapi.ServerResponse `json:"-"`
  632. // ForceSendFields is a list of field names (e.g. "Done") to
  633. // unconditionally include in API requests. By default, fields with
  634. // empty values are omitted from API requests. However, any non-pointer,
  635. // non-interface field appearing in ForceSendFields will be sent to the
  636. // server regardless of whether the field is empty or not. This may be
  637. // used to include empty fields in Patch requests.
  638. ForceSendFields []string `json:"-"`
  639. // NullFields is a list of field names (e.g. "Done") to include in API
  640. // requests with the JSON null value. By default, fields with empty
  641. // values are omitted from API requests. However, any field with an
  642. // empty value appearing in NullFields will be sent to the server as
  643. // null. It is an error if a field in this list has a non-empty value.
  644. // This may be used to include null fields in Patch requests.
  645. NullFields []string `json:"-"`
  646. }
  647. func (s *Operation) MarshalJSON() ([]byte, error) {
  648. type NoMethod Operation
  649. raw := NoMethod(*s)
  650. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  651. }
  652. // OutputConfig: Output configuration for export assets destination.
  653. type OutputConfig struct {
  654. // GcsDestination: Destination on Cloud Storage.
  655. GcsDestination *GcsDestination `json:"gcsDestination,omitempty"`
  656. // ForceSendFields is a list of field names (e.g. "GcsDestination") to
  657. // unconditionally include in API requests. By default, fields with
  658. // empty values are omitted from API requests. However, any non-pointer,
  659. // non-interface field appearing in ForceSendFields will be sent to the
  660. // server regardless of whether the field is empty or not. This may be
  661. // used to include empty fields in Patch requests.
  662. ForceSendFields []string `json:"-"`
  663. // NullFields is a list of field names (e.g. "GcsDestination") to
  664. // include in API requests with the JSON null value. By default, fields
  665. // with empty values are omitted from API requests. However, any field
  666. // with an empty value appearing in NullFields will be sent to the
  667. // server as null. It is an error if a field in this list has a
  668. // non-empty value. This may be used to include null fields in Patch
  669. // requests.
  670. NullFields []string `json:"-"`
  671. }
  672. func (s *OutputConfig) MarshalJSON() ([]byte, error) {
  673. type NoMethod OutputConfig
  674. raw := NoMethod(*s)
  675. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  676. }
  677. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  678. // used to
  679. // specify access control policies for Cloud Platform resources.
  680. //
  681. //
  682. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  683. // of
  684. // `members` to a `role`, where the members can be user accounts, Google
  685. // groups,
  686. // Google domains, and service accounts. A `role` is a named list of
  687. // permissions
  688. // defined by IAM.
  689. //
  690. // **JSON Example**
  691. //
  692. // {
  693. // "bindings": [
  694. // {
  695. // "role": "roles/owner",
  696. // "members": [
  697. // "user:mike@example.com",
  698. // "group:admins@example.com",
  699. // "domain:google.com",
  700. //
  701. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  702. // ]
  703. // },
  704. // {
  705. // "role": "roles/viewer",
  706. // "members": ["user:sean@example.com"]
  707. // }
  708. // ]
  709. // }
  710. //
  711. // **YAML Example**
  712. //
  713. // bindings:
  714. // - members:
  715. // - user:mike@example.com
  716. // - group:admins@example.com
  717. // - domain:google.com
  718. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  719. // role: roles/owner
  720. // - members:
  721. // - user:sean@example.com
  722. // role: roles/viewer
  723. //
  724. //
  725. // For a description of IAM and its features, see the
  726. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  727. type Policy struct {
  728. // AuditConfigs: Specifies cloud audit logging configuration for this
  729. // policy.
  730. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  731. // Bindings: Associates a list of `members` to a `role`.
  732. // `bindings` with no members will result in an error.
  733. Bindings []*Binding `json:"bindings,omitempty"`
  734. // Etag: `etag` is used for optimistic concurrency control as a way to
  735. // help
  736. // prevent simultaneous updates of a policy from overwriting each
  737. // other.
  738. // It is strongly suggested that systems make use of the `etag` in
  739. // the
  740. // read-modify-write cycle to perform policy updates in order to avoid
  741. // race
  742. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  743. // and
  744. // systems are expected to put that etag in the request to
  745. // `setIamPolicy` to
  746. // ensure that their change will be applied to the same version of the
  747. // policy.
  748. //
  749. // If no `etag` is provided in the call to `setIamPolicy`, then the
  750. // existing
  751. // policy is overwritten blindly.
  752. Etag string `json:"etag,omitempty"`
  753. // Version: Deprecated.
  754. Version int64 `json:"version,omitempty"`
  755. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  756. // unconditionally include in API requests. By default, fields with
  757. // empty values are omitted from API requests. However, any non-pointer,
  758. // non-interface field appearing in ForceSendFields will be sent to the
  759. // server regardless of whether the field is empty or not. This may be
  760. // used to include empty fields in Patch requests.
  761. ForceSendFields []string `json:"-"`
  762. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  763. // in API requests with the JSON null value. By default, fields with
  764. // empty values are omitted from API requests. However, any field with
  765. // an empty value appearing in NullFields will be sent to the server as
  766. // null. It is an error if a field in this list has a non-empty value.
  767. // This may be used to include null fields in Patch requests.
  768. NullFields []string `json:"-"`
  769. }
  770. func (s *Policy) MarshalJSON() ([]byte, error) {
  771. type NoMethod Policy
  772. raw := NoMethod(*s)
  773. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  774. }
  775. // Resource: Representation of a cloud resource.
  776. type Resource struct {
  777. // Data: The content of the resource, in which some sensitive fields are
  778. // scrubbed
  779. // away and may not be present.
  780. Data googleapi.RawMessage `json:"data,omitempty"`
  781. // DiscoveryDocumentUri: The URL of the discovery document containing
  782. // the resource's JSON schema.
  783. // For
  784. // example:
  785. // "https://www.googleapis.com/discovery/v1/apis/compute/v1/res
  786. // t".
  787. // It will be left unspecified for resources without a discovery-based
  788. // API,
  789. // such as Cloud Bigtable.
  790. DiscoveryDocumentUri string `json:"discoveryDocumentUri,omitempty"`
  791. // DiscoveryName: The JSON schema name listed in the discovery
  792. // document.
  793. // Example: "Project". It will be left unspecified for resources (such
  794. // as
  795. // Cloud Bigtable) without a discovery-based API.
  796. DiscoveryName string `json:"discoveryName,omitempty"`
  797. // Parent: The full name of the immediate parent of this resource.
  798. // See
  799. // [Resource
  800. // Names](https://cloud.google.com/apis/design/resource_nam
  801. // es#full_resource_name)
  802. // for more information.
  803. //
  804. // For GCP assets, it is the parent resource defined in the [Cloud IAM
  805. // policy
  806. // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hi
  807. // erarchy).
  808. // For
  809. // example:
  810. // "//cloudresourcemanager.googleapis.com/projects/my_project_1
  811. // 23".
  812. //
  813. // For third-party assets, it is up to the users to define.
  814. Parent string `json:"parent,omitempty"`
  815. // ResourceUrl: The REST URL for accessing the resource. An HTTP GET
  816. // operation using this
  817. // URL returns the resource
  818. // itself.
  819. // Example:
  820. // `https://cloudresourcemanager.googleapis.com/v1/proje
  821. // cts/my-project-123`.
  822. // It will be left unspecified for resources without a REST API.
  823. ResourceUrl string `json:"resourceUrl,omitempty"`
  824. // Version: The API version. Example: "v1".
  825. Version string `json:"version,omitempty"`
  826. // ForceSendFields is a list of field names (e.g. "Data") to
  827. // unconditionally include in API requests. By default, fields with
  828. // empty values are omitted from API requests. However, any non-pointer,
  829. // non-interface field appearing in ForceSendFields will be sent to the
  830. // server regardless of whether the field is empty or not. This may be
  831. // used to include empty fields in Patch requests.
  832. ForceSendFields []string `json:"-"`
  833. // NullFields is a list of field names (e.g. "Data") to include in API
  834. // requests with the JSON null value. By default, fields with empty
  835. // values are omitted from API requests. However, any field with an
  836. // empty value appearing in NullFields will be sent to the server as
  837. // null. It is an error if a field in this list has a non-empty value.
  838. // This may be used to include null fields in Patch requests.
  839. NullFields []string `json:"-"`
  840. }
  841. func (s *Resource) MarshalJSON() ([]byte, error) {
  842. type NoMethod Resource
  843. raw := NoMethod(*s)
  844. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  845. }
  846. // Status: The `Status` type defines a logical error model that is
  847. // suitable for
  848. // different programming environments, including REST APIs and RPC APIs.
  849. // It is
  850. // used by [gRPC](https://github.com/grpc). The error model is designed
  851. // to be:
  852. //
  853. // - Simple to use and understand for most users
  854. // - Flexible enough to meet unexpected needs
  855. //
  856. // # Overview
  857. //
  858. // The `Status` message contains three pieces of data: error code,
  859. // error
  860. // message, and error details. The error code should be an enum value
  861. // of
  862. // google.rpc.Code, but it may accept additional error codes if needed.
  863. // The
  864. // error message should be a developer-facing English message that
  865. // helps
  866. // developers *understand* and *resolve* the error. If a localized
  867. // user-facing
  868. // error message is needed, put the localized message in the error
  869. // details or
  870. // localize it in the client. The optional error details may contain
  871. // arbitrary
  872. // information about the error. There is a predefined set of error
  873. // detail types
  874. // in the package `google.rpc` that can be used for common error
  875. // conditions.
  876. //
  877. // # Language mapping
  878. //
  879. // The `Status` message is the logical representation of the error
  880. // model, but it
  881. // is not necessarily the actual wire format. When the `Status` message
  882. // is
  883. // exposed in different client libraries and different wire protocols,
  884. // it can be
  885. // mapped differently. For example, it will likely be mapped to some
  886. // exceptions
  887. // in Java, but more likely mapped to some error codes in C.
  888. //
  889. // # Other uses
  890. //
  891. // The error model and the `Status` message can be used in a variety
  892. // of
  893. // environments, either with or without APIs, to provide a
  894. // consistent developer experience across different
  895. // environments.
  896. //
  897. // Example uses of this error model include:
  898. //
  899. // - Partial errors. If a service needs to return partial errors to the
  900. // client,
  901. // it may embed the `Status` in the normal response to indicate the
  902. // partial
  903. // errors.
  904. //
  905. // - Workflow errors. A typical workflow has multiple steps. Each step
  906. // may
  907. // have a `Status` message for error reporting.
  908. //
  909. // - Batch operations. If a client uses batch request and batch
  910. // response, the
  911. // `Status` message should be used directly inside batch response,
  912. // one for
  913. // each error sub-response.
  914. //
  915. // - Asynchronous operations. If an API call embeds asynchronous
  916. // operation
  917. // results in its response, the status of those operations should
  918. // be
  919. // represented directly using the `Status` message.
  920. //
  921. // - Logging. If some API errors are stored in logs, the message
  922. // `Status` could
  923. // be used directly after any stripping needed for security/privacy
  924. // reasons.
  925. type Status struct {
  926. // Code: The status code, which should be an enum value of
  927. // google.rpc.Code.
  928. Code int64 `json:"code,omitempty"`
  929. // Details: A list of messages that carry the error details. There is a
  930. // common set of
  931. // message types for APIs to use.
  932. Details []googleapi.RawMessage `json:"details,omitempty"`
  933. // Message: A developer-facing error message, which should be in
  934. // English. Any
  935. // user-facing error message should be localized and sent in
  936. // the
  937. // google.rpc.Status.details field, or localized by the client.
  938. Message string `json:"message,omitempty"`
  939. // ForceSendFields is a list of field names (e.g. "Code") to
  940. // unconditionally include in API requests. By default, fields with
  941. // empty values are omitted from API requests. However, any non-pointer,
  942. // non-interface field appearing in ForceSendFields will be sent to the
  943. // server regardless of whether the field is empty or not. This may be
  944. // used to include empty fields in Patch requests.
  945. ForceSendFields []string `json:"-"`
  946. // NullFields is a list of field names (e.g. "Code") to include in API
  947. // requests with the JSON null value. By default, fields with empty
  948. // values are omitted from API requests. However, any field with an
  949. // empty value appearing in NullFields will be sent to the server as
  950. // null. It is an error if a field in this list has a non-empty value.
  951. // This may be used to include null fields in Patch requests.
  952. NullFields []string `json:"-"`
  953. }
  954. func (s *Status) MarshalJSON() ([]byte, error) {
  955. type NoMethod Status
  956. raw := NoMethod(*s)
  957. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  958. }
  959. // TemporalAsset: Temporal asset. In addition to the asset, the temporal
  960. // asset includes the
  961. // status of the asset and valid from and to time of it.
  962. type TemporalAsset struct {
  963. // Asset: Asset.
  964. Asset *Asset `json:"asset,omitempty"`
  965. // Deleted: If the asset is deleted or not.
  966. Deleted bool `json:"deleted,omitempty"`
  967. // Window: The time window when the asset data and state was observed.
  968. Window *TimeWindow `json:"window,omitempty"`
  969. // ForceSendFields is a list of field names (e.g. "Asset") to
  970. // unconditionally include in API requests. By default, fields with
  971. // empty values are omitted from API requests. However, any non-pointer,
  972. // non-interface field appearing in ForceSendFields will be sent to the
  973. // server regardless of whether the field is empty or not. This may be
  974. // used to include empty fields in Patch requests.
  975. ForceSendFields []string `json:"-"`
  976. // NullFields is a list of field names (e.g. "Asset") to include in API
  977. // requests with the JSON null value. By default, fields with empty
  978. // values are omitted from API requests. However, any field with an
  979. // empty value appearing in NullFields will be sent to the server as
  980. // null. It is an error if a field in this list has a non-empty value.
  981. // This may be used to include null fields in Patch requests.
  982. NullFields []string `json:"-"`
  983. }
  984. func (s *TemporalAsset) MarshalJSON() ([]byte, error) {
  985. type NoMethod TemporalAsset
  986. raw := NoMethod(*s)
  987. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  988. }
  989. // TimeWindow: A time window of (start_time, end_time].
  990. type TimeWindow struct {
  991. // EndTime: End time of the time window (inclusive).
  992. // Current timestamp if not specified.
  993. EndTime string `json:"endTime,omitempty"`
  994. // StartTime: Start time of the time window (exclusive).
  995. StartTime string `json:"startTime,omitempty"`
  996. // ForceSendFields is a list of field names (e.g. "EndTime") to
  997. // unconditionally include in API requests. By default, fields with
  998. // empty values are omitted from API requests. However, any non-pointer,
  999. // non-interface field appearing in ForceSendFields will be sent to the
  1000. // server regardless of whether the field is empty or not. This may be
  1001. // used to include empty fields in Patch requests.
  1002. ForceSendFields []string `json:"-"`
  1003. // NullFields is a list of field names (e.g. "EndTime") to include in
  1004. // API requests with the JSON null value. By default, fields with empty
  1005. // values are omitted from API requests. However, any field with an
  1006. // empty value appearing in NullFields will be sent to the server as
  1007. // null. It is an error if a field in this list has a non-empty value.
  1008. // This may be used to include null fields in Patch requests.
  1009. NullFields []string `json:"-"`
  1010. }
  1011. func (s *TimeWindow) MarshalJSON() ([]byte, error) {
  1012. type NoMethod TimeWindow
  1013. raw := NoMethod(*s)
  1014. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1015. }
  1016. // method id "cloudasset.folders.exportAssets":
  1017. type FoldersExportAssetsCall struct {
  1018. s *Service
  1019. parent string
  1020. exportassetsrequest *ExportAssetsRequest
  1021. urlParams_ gensupport.URLParams
  1022. ctx_ context.Context
  1023. header_ http.Header
  1024. }
  1025. // ExportAssets: Exports assets with time and resource types to a given
  1026. // Cloud Storage
  1027. // location. The output format is newline-delimited JSON.
  1028. // This API implements the google.longrunning.Operation API allowing
  1029. // you
  1030. // to keep track of the export.
  1031. func (r *FoldersService) ExportAssets(parent string, exportassetsrequest *ExportAssetsRequest) *FoldersExportAssetsCall {
  1032. c := &FoldersExportAssetsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1033. c.parent = parent
  1034. c.exportassetsrequest = exportassetsrequest
  1035. return c
  1036. }
  1037. // Fields allows partial responses to be retrieved. See
  1038. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1039. // for more information.
  1040. func (c *FoldersExportAssetsCall) Fields(s ...googleapi.Field) *FoldersExportAssetsCall {
  1041. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1042. return c
  1043. }
  1044. // Context sets the context to be used in this call's Do method. Any
  1045. // pending HTTP request will be aborted if the provided context is
  1046. // canceled.
  1047. func (c *FoldersExportAssetsCall) Context(ctx context.Context) *FoldersExportAssetsCall {
  1048. c.ctx_ = ctx
  1049. return c
  1050. }
  1051. // Header returns an http.Header that can be modified by the caller to
  1052. // add HTTP headers to the request.
  1053. func (c *FoldersExportAssetsCall) Header() http.Header {
  1054. if c.header_ == nil {
  1055. c.header_ = make(http.Header)
  1056. }
  1057. return c.header_
  1058. }
  1059. func (c *FoldersExportAssetsCall) doRequest(alt string) (*http.Response, error) {
  1060. reqHeaders := make(http.Header)
  1061. for k, v := range c.header_ {
  1062. reqHeaders[k] = v
  1063. }
  1064. reqHeaders.Set("User-Agent", c.s.userAgent())
  1065. var body io.Reader = nil
  1066. body, err := googleapi.WithoutDataWrapper.JSONReader(c.exportassetsrequest)
  1067. if err != nil {
  1068. return nil, err
  1069. }
  1070. reqHeaders.Set("Content-Type", "application/json")
  1071. c.urlParams_.Set("alt", alt)
  1072. c.urlParams_.Set("prettyPrint", "false")
  1073. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}:exportAssets")
  1074. urls += "?" + c.urlParams_.Encode()
  1075. req, err := http.NewRequest("POST", urls, body)
  1076. if err != nil {
  1077. return nil, err
  1078. }
  1079. req.Header = reqHeaders
  1080. googleapi.Expand(req.URL, map[string]string{
  1081. "parent": c.parent,
  1082. })
  1083. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1084. }
  1085. // Do executes the "cloudasset.folders.exportAssets" call.
  1086. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1087. // status code is an error. Response headers are in either
  1088. // *Operation.ServerResponse.Header or (if a response was returned at
  1089. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1090. // to check whether the returned error was because
  1091. // http.StatusNotModified was returned.
  1092. func (c *FoldersExportAssetsCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1093. gensupport.SetOptions(c.urlParams_, opts...)
  1094. res, err := c.doRequest("json")
  1095. if res != nil && res.StatusCode == http.StatusNotModified {
  1096. if res.Body != nil {
  1097. res.Body.Close()
  1098. }
  1099. return nil, &googleapi.Error{
  1100. Code: res.StatusCode,
  1101. Header: res.Header,
  1102. }
  1103. }
  1104. if err != nil {
  1105. return nil, err
  1106. }
  1107. defer googleapi.CloseBody(res)
  1108. if err := googleapi.CheckResponse(res); err != nil {
  1109. return nil, err
  1110. }
  1111. ret := &Operation{
  1112. ServerResponse: googleapi.ServerResponse{
  1113. Header: res.Header,
  1114. HTTPStatusCode: res.StatusCode,
  1115. },
  1116. }
  1117. target := &ret
  1118. if err := gensupport.DecodeResponse(target, res); err != nil {
  1119. return nil, err
  1120. }
  1121. return ret, nil
  1122. // {
  1123. // "description": "Exports assets with time and resource types to a given Cloud Storage\nlocation. The output format is newline-delimited JSON.\nThis API implements the google.longrunning.Operation API allowing you\nto keep track of the export.",
  1124. // "flatPath": "v1beta1/folders/{foldersId}:exportAssets",
  1125. // "httpMethod": "POST",
  1126. // "id": "cloudasset.folders.exportAssets",
  1127. // "parameterOrder": [
  1128. // "parent"
  1129. // ],
  1130. // "parameters": {
  1131. // "parent": {
  1132. // "description": "Required. The relative name of the root asset. This can only be an\norganization number (such as \"organizations/123\"), a project ID (such as\n\"projects/my-project-id\"), a project number (such as \"projects/12345\"), or\na folder number (such as \"folders/123\").",
  1133. // "location": "path",
  1134. // "pattern": "^folders/[^/]+$",
  1135. // "required": true,
  1136. // "type": "string"
  1137. // }
  1138. // },
  1139. // "path": "v1beta1/{+parent}:exportAssets",
  1140. // "request": {
  1141. // "$ref": "ExportAssetsRequest"
  1142. // },
  1143. // "response": {
  1144. // "$ref": "Operation"
  1145. // },
  1146. // "scopes": [
  1147. // "https://www.googleapis.com/auth/cloud-platform"
  1148. // ]
  1149. // }
  1150. }
  1151. // method id "cloudasset.folders.operations.get":
  1152. type FoldersOperationsGetCall struct {
  1153. s *Service
  1154. name string
  1155. urlParams_ gensupport.URLParams
  1156. ifNoneMatch_ string
  1157. ctx_ context.Context
  1158. header_ http.Header
  1159. }
  1160. // Get: Gets the latest state of a long-running operation. Clients can
  1161. // use this
  1162. // method to poll the operation result at intervals as recommended by
  1163. // the API
  1164. // service.
  1165. func (r *FoldersOperationsService) Get(name string) *FoldersOperationsGetCall {
  1166. c := &FoldersOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1167. c.name = name
  1168. return c
  1169. }
  1170. // Fields allows partial responses to be retrieved. See
  1171. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1172. // for more information.
  1173. func (c *FoldersOperationsGetCall) Fields(s ...googleapi.Field) *FoldersOperationsGetCall {
  1174. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1175. return c
  1176. }
  1177. // IfNoneMatch sets the optional parameter which makes the operation
  1178. // fail if the object's ETag matches the given value. This is useful for
  1179. // getting updates only after the object has changed since the last
  1180. // request. Use googleapi.IsNotModified to check whether the response
  1181. // error from Do is the result of In-None-Match.
  1182. func (c *FoldersOperationsGetCall) IfNoneMatch(entityTag string) *FoldersOperationsGetCall {
  1183. c.ifNoneMatch_ = entityTag
  1184. return c
  1185. }
  1186. // Context sets the context to be used in this call's Do method. Any
  1187. // pending HTTP request will be aborted if the provided context is
  1188. // canceled.
  1189. func (c *FoldersOperationsGetCall) Context(ctx context.Context) *FoldersOperationsGetCall {
  1190. c.ctx_ = ctx
  1191. return c
  1192. }
  1193. // Header returns an http.Header that can be modified by the caller to
  1194. // add HTTP headers to the request.
  1195. func (c *FoldersOperationsGetCall) Header() http.Header {
  1196. if c.header_ == nil {
  1197. c.header_ = make(http.Header)
  1198. }
  1199. return c.header_
  1200. }
  1201. func (c *FoldersOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  1202. reqHeaders := make(http.Header)
  1203. for k, v := range c.header_ {
  1204. reqHeaders[k] = v
  1205. }
  1206. reqHeaders.Set("User-Agent", c.s.userAgent())
  1207. if c.ifNoneMatch_ != "" {
  1208. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1209. }
  1210. var body io.Reader = nil
  1211. c.urlParams_.Set("alt", alt)
  1212. c.urlParams_.Set("prettyPrint", "false")
  1213. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1214. urls += "?" + c.urlParams_.Encode()
  1215. req, err := http.NewRequest("GET", urls, body)
  1216. if err != nil {
  1217. return nil, err
  1218. }
  1219. req.Header = reqHeaders
  1220. googleapi.Expand(req.URL, map[string]string{
  1221. "name": c.name,
  1222. })
  1223. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1224. }
  1225. // Do executes the "cloudasset.folders.operations.get" call.
  1226. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1227. // status code is an error. Response headers are in either
  1228. // *Operation.ServerResponse.Header or (if a response was returned at
  1229. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1230. // to check whether the returned error was because
  1231. // http.StatusNotModified was returned.
  1232. func (c *FoldersOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1233. gensupport.SetOptions(c.urlParams_, opts...)
  1234. res, err := c.doRequest("json")
  1235. if res != nil && res.StatusCode == http.StatusNotModified {
  1236. if res.Body != nil {
  1237. res.Body.Close()
  1238. }
  1239. return nil, &googleapi.Error{
  1240. Code: res.StatusCode,
  1241. Header: res.Header,
  1242. }
  1243. }
  1244. if err != nil {
  1245. return nil, err
  1246. }
  1247. defer googleapi.CloseBody(res)
  1248. if err := googleapi.CheckResponse(res); err != nil {
  1249. return nil, err
  1250. }
  1251. ret := &Operation{
  1252. ServerResponse: googleapi.ServerResponse{
  1253. Header: res.Header,
  1254. HTTPStatusCode: res.StatusCode,
  1255. },
  1256. }
  1257. target := &ret
  1258. if err := gensupport.DecodeResponse(target, res); err != nil {
  1259. return nil, err
  1260. }
  1261. return ret, nil
  1262. // {
  1263. // "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.",
  1264. // "flatPath": "v1beta1/folders/{foldersId}/operations/{operationsId}/{operationsId1}",
  1265. // "httpMethod": "GET",
  1266. // "id": "cloudasset.folders.operations.get",
  1267. // "parameterOrder": [
  1268. // "name"
  1269. // ],
  1270. // "parameters": {
  1271. // "name": {
  1272. // "description": "The name of the operation resource.",
  1273. // "location": "path",
  1274. // "pattern": "^folders/[^/]+/operations/[^/]+/.+$",
  1275. // "required": true,
  1276. // "type": "string"
  1277. // }
  1278. // },
  1279. // "path": "v1beta1/{+name}",
  1280. // "response": {
  1281. // "$ref": "Operation"
  1282. // },
  1283. // "scopes": [
  1284. // "https://www.googleapis.com/auth/cloud-platform"
  1285. // ]
  1286. // }
  1287. }
  1288. // method id "cloudasset.organizations.batchGetAssetsHistory":
  1289. type OrganizationsBatchGetAssetsHistoryCall struct {
  1290. s *Service
  1291. parent string
  1292. urlParams_ gensupport.URLParams
  1293. ifNoneMatch_ string
  1294. ctx_ context.Context
  1295. header_ http.Header
  1296. }
  1297. // BatchGetAssetsHistory: Batch gets the update history of assets that
  1298. // overlap a time window.
  1299. // For RESOURCE content, this API outputs history with asset in
  1300. // both
  1301. // non-delete or deleted status.
  1302. // For IAM_POLICY content, this API outputs history when the asset and
  1303. // its
  1304. // attached IAM POLICY both exist. This can create gaps in the output
  1305. // history.
  1306. // If a specified asset does not exist, this API returns an
  1307. // INVALID_ARGUMENT
  1308. // error.
  1309. func (r *OrganizationsService) BatchGetAssetsHistory(parent string) *OrganizationsBatchGetAssetsHistoryCall {
  1310. c := &OrganizationsBatchGetAssetsHistoryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1311. c.parent = parent
  1312. return c
  1313. }
  1314. // AssetNames sets the optional parameter "assetNames": A list of the
  1315. // full names of the assets. For
  1316. // example:
  1317. // `//compute.googleapis.com/projects/my_project_123/zones/zone1
  1318. // /instances/instance1`.
  1319. // See
  1320. // [Resource
  1321. // Names](https://cloud.google.com/apis/design/resource_names#f
  1322. // ull_resource_name)
  1323. // for more info.
  1324. //
  1325. // The request becomes a no-op if the asset name list is empty, and the
  1326. // max
  1327. // size of the asset name list is 100 in one request.
  1328. func (c *OrganizationsBatchGetAssetsHistoryCall) AssetNames(assetNames ...string) *OrganizationsBatchGetAssetsHistoryCall {
  1329. c.urlParams_.SetMulti("assetNames", append([]string{}, assetNames...))
  1330. return c
  1331. }
  1332. // ContentType sets the optional parameter "contentType": Required. The
  1333. // content type.
  1334. //
  1335. // Possible values:
  1336. // "CONTENT_TYPE_UNSPECIFIED"
  1337. // "RESOURCE"
  1338. // "IAM_POLICY"
  1339. func (c *OrganizationsBatchGetAssetsHistoryCall) ContentType(contentType string) *OrganizationsBatchGetAssetsHistoryCall {
  1340. c.urlParams_.Set("contentType", contentType)
  1341. return c
  1342. }
  1343. // ReadTimeWindowEndTime sets the optional parameter
  1344. // "readTimeWindow.endTime": End time of the time window
  1345. // (inclusive).
  1346. // Current timestamp if not specified.
  1347. func (c *OrganizationsBatchGetAssetsHistoryCall) ReadTimeWindowEndTime(readTimeWindowEndTime string) *OrganizationsBatchGetAssetsHistoryCall {
  1348. c.urlParams_.Set("readTimeWindow.endTime", readTimeWindowEndTime)
  1349. return c
  1350. }
  1351. // ReadTimeWindowStartTime sets the optional parameter
  1352. // "readTimeWindow.startTime": Start time of the time window
  1353. // (exclusive).
  1354. func (c *OrganizationsBatchGetAssetsHistoryCall) ReadTimeWindowStartTime(readTimeWindowStartTime string) *OrganizationsBatchGetAssetsHistoryCall {
  1355. c.urlParams_.Set("readTimeWindow.startTime", readTimeWindowStartTime)
  1356. return c
  1357. }
  1358. // Fields allows partial responses to be retrieved. See
  1359. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1360. // for more information.
  1361. func (c *OrganizationsBatchGetAssetsHistoryCall) Fields(s ...googleapi.Field) *OrganizationsBatchGetAssetsHistoryCall {
  1362. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1363. return c
  1364. }
  1365. // IfNoneMatch sets the optional parameter which makes the operation
  1366. // fail if the object's ETag matches the given value. This is useful for
  1367. // getting updates only after the object has changed since the last
  1368. // request. Use googleapi.IsNotModified to check whether the response
  1369. // error from Do is the result of In-None-Match.
  1370. func (c *OrganizationsBatchGetAssetsHistoryCall) IfNoneMatch(entityTag string) *OrganizationsBatchGetAssetsHistoryCall {
  1371. c.ifNoneMatch_ = entityTag
  1372. return c
  1373. }
  1374. // Context sets the context to be used in this call's Do method. Any
  1375. // pending HTTP request will be aborted if the provided context is
  1376. // canceled.
  1377. func (c *OrganizationsBatchGetAssetsHistoryCall) Context(ctx context.Context) *OrganizationsBatchGetAssetsHistoryCall {
  1378. c.ctx_ = ctx
  1379. return c
  1380. }
  1381. // Header returns an http.Header that can be modified by the caller to
  1382. // add HTTP headers to the request.
  1383. func (c *OrganizationsBatchGetAssetsHistoryCall) Header() http.Header {
  1384. if c.header_ == nil {
  1385. c.header_ = make(http.Header)
  1386. }
  1387. return c.header_
  1388. }
  1389. func (c *OrganizationsBatchGetAssetsHistoryCall) doRequest(alt string) (*http.Response, error) {
  1390. reqHeaders := make(http.Header)
  1391. for k, v := range c.header_ {
  1392. reqHeaders[k] = v
  1393. }
  1394. reqHeaders.Set("User-Agent", c.s.userAgent())
  1395. if c.ifNoneMatch_ != "" {
  1396. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1397. }
  1398. var body io.Reader = nil
  1399. c.urlParams_.Set("alt", alt)
  1400. c.urlParams_.Set("prettyPrint", "false")
  1401. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}:batchGetAssetsHistory")
  1402. urls += "?" + c.urlParams_.Encode()
  1403. req, err := http.NewRequest("GET", urls, body)
  1404. if err != nil {
  1405. return nil, err
  1406. }
  1407. req.Header = reqHeaders
  1408. googleapi.Expand(req.URL, map[string]string{
  1409. "parent": c.parent,
  1410. })
  1411. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1412. }
  1413. // Do executes the "cloudasset.organizations.batchGetAssetsHistory" call.
  1414. // Exactly one of *BatchGetAssetsHistoryResponse or error will be
  1415. // non-nil. Any non-2xx status code is an error. Response headers are in
  1416. // either *BatchGetAssetsHistoryResponse.ServerResponse.Header or (if a
  1417. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1418. // googleapi.IsNotModified to check whether the returned error was
  1419. // because http.StatusNotModified was returned.
  1420. func (c *OrganizationsBatchGetAssetsHistoryCall) Do(opts ...googleapi.CallOption) (*BatchGetAssetsHistoryResponse, error) {
  1421. gensupport.SetOptions(c.urlParams_, opts...)
  1422. res, err := c.doRequest("json")
  1423. if res != nil && res.StatusCode == http.StatusNotModified {
  1424. if res.Body != nil {
  1425. res.Body.Close()
  1426. }
  1427. return nil, &googleapi.Error{
  1428. Code: res.StatusCode,
  1429. Header: res.Header,
  1430. }
  1431. }
  1432. if err != nil {
  1433. return nil, err
  1434. }
  1435. defer googleapi.CloseBody(res)
  1436. if err := googleapi.CheckResponse(res); err != nil {
  1437. return nil, err
  1438. }
  1439. ret := &BatchGetAssetsHistoryResponse{
  1440. ServerResponse: googleapi.ServerResponse{
  1441. Header: res.Header,
  1442. HTTPStatusCode: res.StatusCode,
  1443. },
  1444. }
  1445. target := &ret
  1446. if err := gensupport.DecodeResponse(target, res); err != nil {
  1447. return nil, err
  1448. }
  1449. return ret, nil
  1450. // {
  1451. // "description": "Batch gets the update history of assets that overlap a time window.\nFor RESOURCE content, this API outputs history with asset in both\nnon-delete or deleted status.\nFor IAM_POLICY content, this API outputs history when the asset and its\nattached IAM POLICY both exist. This can create gaps in the output history.\nIf a specified asset does not exist, this API returns an INVALID_ARGUMENT\nerror.",
  1452. // "flatPath": "v1beta1/organizations/{organizationsId}:batchGetAssetsHistory",
  1453. // "httpMethod": "GET",
  1454. // "id": "cloudasset.organizations.batchGetAssetsHistory",
  1455. // "parameterOrder": [
  1456. // "parent"
  1457. // ],
  1458. // "parameters": {
  1459. // "assetNames": {
  1460. // "description": "A list of the full names of the assets. For example:\n`//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.\nSee [Resource\nNames](https://cloud.google.com/apis/design/resource_names#full_resource_name)\nfor more info.\n\nThe request becomes a no-op if the asset name list is empty, and the max\nsize of the asset name list is 100 in one request.",
  1461. // "location": "query",
  1462. // "repeated": true,
  1463. // "type": "string"
  1464. // },
  1465. // "contentType": {
  1466. // "description": "Required. The content type.",
  1467. // "enum": [
  1468. // "CONTENT_TYPE_UNSPECIFIED",
  1469. // "RESOURCE",
  1470. // "IAM_POLICY"
  1471. // ],
  1472. // "location": "query",
  1473. // "type": "string"
  1474. // },
  1475. // "parent": {
  1476. // "description": "Required. The relative name of the root asset. It can only be an\norganization number (such as \"organizations/123\"), a project ID (such as\n\"projects/my-project-id\")\", or a project number (such as \"projects/12345\").",
  1477. // "location": "path",
  1478. // "pattern": "^organizations/[^/]+$",
  1479. // "required": true,
  1480. // "type": "string"
  1481. // },
  1482. // "readTimeWindow.endTime": {
  1483. // "description": "End time of the time window (inclusive).\nCurrent timestamp if not specified.",
  1484. // "format": "google-datetime",
  1485. // "location": "query",
  1486. // "type": "string"
  1487. // },
  1488. // "readTimeWindow.startTime": {
  1489. // "description": "Start time of the time window (exclusive).",
  1490. // "format": "google-datetime",
  1491. // "location": "query",
  1492. // "type": "string"
  1493. // }
  1494. // },
  1495. // "path": "v1beta1/{+parent}:batchGetAssetsHistory",
  1496. // "response": {
  1497. // "$ref": "BatchGetAssetsHistoryResponse"
  1498. // },
  1499. // "scopes": [
  1500. // "https://www.googleapis.com/auth/cloud-platform"
  1501. // ]
  1502. // }
  1503. }
  1504. // method id "cloudasset.organizations.exportAssets":
  1505. type OrganizationsExportAssetsCall struct {
  1506. s *Service
  1507. parent string
  1508. exportassetsrequest *ExportAssetsRequest
  1509. urlParams_ gensupport.URLParams
  1510. ctx_ context.Context
  1511. header_ http.Header
  1512. }
  1513. // ExportAssets: Exports assets with time and resource types to a given
  1514. // Cloud Storage
  1515. // location. The output format is newline-delimited JSON.
  1516. // This API implements the google.longrunning.Operation API allowing
  1517. // you
  1518. // to keep track of the export.
  1519. func (r *OrganizationsService) ExportAssets(parent string, exportassetsrequest *ExportAssetsRequest) *OrganizationsExportAssetsCall {
  1520. c := &OrganizationsExportAssetsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1521. c.parent = parent
  1522. c.exportassetsrequest = exportassetsrequest
  1523. return c
  1524. }
  1525. // Fields allows partial responses to be retrieved. See
  1526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1527. // for more information.
  1528. func (c *OrganizationsExportAssetsCall) Fields(s ...googleapi.Field) *OrganizationsExportAssetsCall {
  1529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1530. return c
  1531. }
  1532. // Context sets the context to be used in this call's Do method. Any
  1533. // pending HTTP request will be aborted if the provided context is
  1534. // canceled.
  1535. func (c *OrganizationsExportAssetsCall) Context(ctx context.Context) *OrganizationsExportAssetsCall {
  1536. c.ctx_ = ctx
  1537. return c
  1538. }
  1539. // Header returns an http.Header that can be modified by the caller to
  1540. // add HTTP headers to the request.
  1541. func (c *OrganizationsExportAssetsCall) Header() http.Header {
  1542. if c.header_ == nil {
  1543. c.header_ = make(http.Header)
  1544. }
  1545. return c.header_
  1546. }
  1547. func (c *OrganizationsExportAssetsCall) doRequest(alt string) (*http.Response, error) {
  1548. reqHeaders := make(http.Header)
  1549. for k, v := range c.header_ {
  1550. reqHeaders[k] = v
  1551. }
  1552. reqHeaders.Set("User-Agent", c.s.userAgent())
  1553. var body io.Reader = nil
  1554. body, err := googleapi.WithoutDataWrapper.JSONReader(c.exportassetsrequest)
  1555. if err != nil {
  1556. return nil, err
  1557. }
  1558. reqHeaders.Set("Content-Type", "application/json")
  1559. c.urlParams_.Set("alt", alt)
  1560. c.urlParams_.Set("prettyPrint", "false")
  1561. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}:exportAssets")
  1562. urls += "?" + c.urlParams_.Encode()
  1563. req, err := http.NewRequest("POST", urls, body)
  1564. if err != nil {
  1565. return nil, err
  1566. }
  1567. req.Header = reqHeaders
  1568. googleapi.Expand(req.URL, map[string]string{
  1569. "parent": c.parent,
  1570. })
  1571. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1572. }
  1573. // Do executes the "cloudasset.organizations.exportAssets" call.
  1574. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1575. // status code is an error. Response headers are in either
  1576. // *Operation.ServerResponse.Header or (if a response was returned at
  1577. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1578. // to check whether the returned error was because
  1579. // http.StatusNotModified was returned.
  1580. func (c *OrganizationsExportAssetsCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1581. gensupport.SetOptions(c.urlParams_, opts...)
  1582. res, err := c.doRequest("json")
  1583. if res != nil && res.StatusCode == http.StatusNotModified {
  1584. if res.Body != nil {
  1585. res.Body.Close()
  1586. }
  1587. return nil, &googleapi.Error{
  1588. Code: res.StatusCode,
  1589. Header: res.Header,
  1590. }
  1591. }
  1592. if err != nil {
  1593. return nil, err
  1594. }
  1595. defer googleapi.CloseBody(res)
  1596. if err := googleapi.CheckResponse(res); err != nil {
  1597. return nil, err
  1598. }
  1599. ret := &Operation{
  1600. ServerResponse: googleapi.ServerResponse{
  1601. Header: res.Header,
  1602. HTTPStatusCode: res.StatusCode,
  1603. },
  1604. }
  1605. target := &ret
  1606. if err := gensupport.DecodeResponse(target, res); err != nil {
  1607. return nil, err
  1608. }
  1609. return ret, nil
  1610. // {
  1611. // "description": "Exports assets with time and resource types to a given Cloud Storage\nlocation. The output format is newline-delimited JSON.\nThis API implements the google.longrunning.Operation API allowing you\nto keep track of the export.",
  1612. // "flatPath": "v1beta1/organizations/{organizationsId}:exportAssets",
  1613. // "httpMethod": "POST",
  1614. // "id": "cloudasset.organizations.exportAssets",
  1615. // "parameterOrder": [
  1616. // "parent"
  1617. // ],
  1618. // "parameters": {
  1619. // "parent": {
  1620. // "description": "Required. The relative name of the root asset. This can only be an\norganization number (such as \"organizations/123\"), a project ID (such as\n\"projects/my-project-id\"), a project number (such as \"projects/12345\"), or\na folder number (such as \"folders/123\").",
  1621. // "location": "path",
  1622. // "pattern": "^organizations/[^/]+$",
  1623. // "required": true,
  1624. // "type": "string"
  1625. // }
  1626. // },
  1627. // "path": "v1beta1/{+parent}:exportAssets",
  1628. // "request": {
  1629. // "$ref": "ExportAssetsRequest"
  1630. // },
  1631. // "response": {
  1632. // "$ref": "Operation"
  1633. // },
  1634. // "scopes": [
  1635. // "https://www.googleapis.com/auth/cloud-platform"
  1636. // ]
  1637. // }
  1638. }
  1639. // method id "cloudasset.organizations.operations.get":
  1640. type OrganizationsOperationsGetCall struct {
  1641. s *Service
  1642. name string
  1643. urlParams_ gensupport.URLParams
  1644. ifNoneMatch_ string
  1645. ctx_ context.Context
  1646. header_ http.Header
  1647. }
  1648. // Get: Gets the latest state of a long-running operation. Clients can
  1649. // use this
  1650. // method to poll the operation result at intervals as recommended by
  1651. // the API
  1652. // service.
  1653. func (r *OrganizationsOperationsService) Get(name string) *OrganizationsOperationsGetCall {
  1654. c := &OrganizationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1655. c.name = name
  1656. return c
  1657. }
  1658. // Fields allows partial responses to be retrieved. See
  1659. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1660. // for more information.
  1661. func (c *OrganizationsOperationsGetCall) Fields(s ...googleapi.Field) *OrganizationsOperationsGetCall {
  1662. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1663. return c
  1664. }
  1665. // IfNoneMatch sets the optional parameter which makes the operation
  1666. // fail if the object's ETag matches the given value. This is useful for
  1667. // getting updates only after the object has changed since the last
  1668. // request. Use googleapi.IsNotModified to check whether the response
  1669. // error from Do is the result of In-None-Match.
  1670. func (c *OrganizationsOperationsGetCall) IfNoneMatch(entityTag string) *OrganizationsOperationsGetCall {
  1671. c.ifNoneMatch_ = entityTag
  1672. return c
  1673. }
  1674. // Context sets the context to be used in this call's Do method. Any
  1675. // pending HTTP request will be aborted if the provided context is
  1676. // canceled.
  1677. func (c *OrganizationsOperationsGetCall) Context(ctx context.Context) *OrganizationsOperationsGetCall {
  1678. c.ctx_ = ctx
  1679. return c
  1680. }
  1681. // Header returns an http.Header that can be modified by the caller to
  1682. // add HTTP headers to the request.
  1683. func (c *OrganizationsOperationsGetCall) Header() http.Header {
  1684. if c.header_ == nil {
  1685. c.header_ = make(http.Header)
  1686. }
  1687. return c.header_
  1688. }
  1689. func (c *OrganizationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  1690. reqHeaders := make(http.Header)
  1691. for k, v := range c.header_ {
  1692. reqHeaders[k] = v
  1693. }
  1694. reqHeaders.Set("User-Agent", c.s.userAgent())
  1695. if c.ifNoneMatch_ != "" {
  1696. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1697. }
  1698. var body io.Reader = nil
  1699. c.urlParams_.Set("alt", alt)
  1700. c.urlParams_.Set("prettyPrint", "false")
  1701. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1702. urls += "?" + c.urlParams_.Encode()
  1703. req, err := http.NewRequest("GET", urls, body)
  1704. if err != nil {
  1705. return nil, err
  1706. }
  1707. req.Header = reqHeaders
  1708. googleapi.Expand(req.URL, map[string]string{
  1709. "name": c.name,
  1710. })
  1711. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1712. }
  1713. // Do executes the "cloudasset.organizations.operations.get" call.
  1714. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1715. // status code is an error. Response headers are in either
  1716. // *Operation.ServerResponse.Header or (if a response was returned at
  1717. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1718. // to check whether the returned error was because
  1719. // http.StatusNotModified was returned.
  1720. func (c *OrganizationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1721. gensupport.SetOptions(c.urlParams_, opts...)
  1722. res, err := c.doRequest("json")
  1723. if res != nil && res.StatusCode == http.StatusNotModified {
  1724. if res.Body != nil {
  1725. res.Body.Close()
  1726. }
  1727. return nil, &googleapi.Error{
  1728. Code: res.StatusCode,
  1729. Header: res.Header,
  1730. }
  1731. }
  1732. if err != nil {
  1733. return nil, err
  1734. }
  1735. defer googleapi.CloseBody(res)
  1736. if err := googleapi.CheckResponse(res); err != nil {
  1737. return nil, err
  1738. }
  1739. ret := &Operation{
  1740. ServerResponse: googleapi.ServerResponse{
  1741. Header: res.Header,
  1742. HTTPStatusCode: res.StatusCode,
  1743. },
  1744. }
  1745. target := &ret
  1746. if err := gensupport.DecodeResponse(target, res); err != nil {
  1747. return nil, err
  1748. }
  1749. return ret, nil
  1750. // {
  1751. // "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.",
  1752. // "flatPath": "v1beta1/organizations/{organizationsId}/operations/{operationsId}/{operationsId1}",
  1753. // "httpMethod": "GET",
  1754. // "id": "cloudasset.organizations.operations.get",
  1755. // "parameterOrder": [
  1756. // "name"
  1757. // ],
  1758. // "parameters": {
  1759. // "name": {
  1760. // "description": "The name of the operation resource.",
  1761. // "location": "path",
  1762. // "pattern": "^organizations/[^/]+/operations/[^/]+/.+$",
  1763. // "required": true,
  1764. // "type": "string"
  1765. // }
  1766. // },
  1767. // "path": "v1beta1/{+name}",
  1768. // "response": {
  1769. // "$ref": "Operation"
  1770. // },
  1771. // "scopes": [
  1772. // "https://www.googleapis.com/auth/cloud-platform"
  1773. // ]
  1774. // }
  1775. }
  1776. // method id "cloudasset.projects.batchGetAssetsHistory":
  1777. type ProjectsBatchGetAssetsHistoryCall struct {
  1778. s *Service
  1779. parent string
  1780. urlParams_ gensupport.URLParams
  1781. ifNoneMatch_ string
  1782. ctx_ context.Context
  1783. header_ http.Header
  1784. }
  1785. // BatchGetAssetsHistory: Batch gets the update history of assets that
  1786. // overlap a time window.
  1787. // For RESOURCE content, this API outputs history with asset in
  1788. // both
  1789. // non-delete or deleted status.
  1790. // For IAM_POLICY content, this API outputs history when the asset and
  1791. // its
  1792. // attached IAM POLICY both exist. This can create gaps in the output
  1793. // history.
  1794. // If a specified asset does not exist, this API returns an
  1795. // INVALID_ARGUMENT
  1796. // error.
  1797. func (r *ProjectsService) BatchGetAssetsHistory(parent string) *ProjectsBatchGetAssetsHistoryCall {
  1798. c := &ProjectsBatchGetAssetsHistoryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1799. c.parent = parent
  1800. return c
  1801. }
  1802. // AssetNames sets the optional parameter "assetNames": A list of the
  1803. // full names of the assets. For
  1804. // example:
  1805. // `//compute.googleapis.com/projects/my_project_123/zones/zone1
  1806. // /instances/instance1`.
  1807. // See
  1808. // [Resource
  1809. // Names](https://cloud.google.com/apis/design/resource_names#f
  1810. // ull_resource_name)
  1811. // for more info.
  1812. //
  1813. // The request becomes a no-op if the asset name list is empty, and the
  1814. // max
  1815. // size of the asset name list is 100 in one request.
  1816. func (c *ProjectsBatchGetAssetsHistoryCall) AssetNames(assetNames ...string) *ProjectsBatchGetAssetsHistoryCall {
  1817. c.urlParams_.SetMulti("assetNames", append([]string{}, assetNames...))
  1818. return c
  1819. }
  1820. // ContentType sets the optional parameter "contentType": Required. The
  1821. // content type.
  1822. //
  1823. // Possible values:
  1824. // "CONTENT_TYPE_UNSPECIFIED"
  1825. // "RESOURCE"
  1826. // "IAM_POLICY"
  1827. func (c *ProjectsBatchGetAssetsHistoryCall) ContentType(contentType string) *ProjectsBatchGetAssetsHistoryCall {
  1828. c.urlParams_.Set("contentType", contentType)
  1829. return c
  1830. }
  1831. // ReadTimeWindowEndTime sets the optional parameter
  1832. // "readTimeWindow.endTime": End time of the time window
  1833. // (inclusive).
  1834. // Current timestamp if not specified.
  1835. func (c *ProjectsBatchGetAssetsHistoryCall) ReadTimeWindowEndTime(readTimeWindowEndTime string) *ProjectsBatchGetAssetsHistoryCall {
  1836. c.urlParams_.Set("readTimeWindow.endTime", readTimeWindowEndTime)
  1837. return c
  1838. }
  1839. // ReadTimeWindowStartTime sets the optional parameter
  1840. // "readTimeWindow.startTime": Start time of the time window
  1841. // (exclusive).
  1842. func (c *ProjectsBatchGetAssetsHistoryCall) ReadTimeWindowStartTime(readTimeWindowStartTime string) *ProjectsBatchGetAssetsHistoryCall {
  1843. c.urlParams_.Set("readTimeWindow.startTime", readTimeWindowStartTime)
  1844. return c
  1845. }
  1846. // Fields allows partial responses to be retrieved. See
  1847. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1848. // for more information.
  1849. func (c *ProjectsBatchGetAssetsHistoryCall) Fields(s ...googleapi.Field) *ProjectsBatchGetAssetsHistoryCall {
  1850. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1851. return c
  1852. }
  1853. // IfNoneMatch sets the optional parameter which makes the operation
  1854. // fail if the object's ETag matches the given value. This is useful for
  1855. // getting updates only after the object has changed since the last
  1856. // request. Use googleapi.IsNotModified to check whether the response
  1857. // error from Do is the result of In-None-Match.
  1858. func (c *ProjectsBatchGetAssetsHistoryCall) IfNoneMatch(entityTag string) *ProjectsBatchGetAssetsHistoryCall {
  1859. c.ifNoneMatch_ = entityTag
  1860. return c
  1861. }
  1862. // Context sets the context to be used in this call's Do method. Any
  1863. // pending HTTP request will be aborted if the provided context is
  1864. // canceled.
  1865. func (c *ProjectsBatchGetAssetsHistoryCall) Context(ctx context.Context) *ProjectsBatchGetAssetsHistoryCall {
  1866. c.ctx_ = ctx
  1867. return c
  1868. }
  1869. // Header returns an http.Header that can be modified by the caller to
  1870. // add HTTP headers to the request.
  1871. func (c *ProjectsBatchGetAssetsHistoryCall) Header() http.Header {
  1872. if c.header_ == nil {
  1873. c.header_ = make(http.Header)
  1874. }
  1875. return c.header_
  1876. }
  1877. func (c *ProjectsBatchGetAssetsHistoryCall) doRequest(alt string) (*http.Response, error) {
  1878. reqHeaders := make(http.Header)
  1879. for k, v := range c.header_ {
  1880. reqHeaders[k] = v
  1881. }
  1882. reqHeaders.Set("User-Agent", c.s.userAgent())
  1883. if c.ifNoneMatch_ != "" {
  1884. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1885. }
  1886. var body io.Reader = nil
  1887. c.urlParams_.Set("alt", alt)
  1888. c.urlParams_.Set("prettyPrint", "false")
  1889. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}:batchGetAssetsHistory")
  1890. urls += "?" + c.urlParams_.Encode()
  1891. req, err := http.NewRequest("GET", urls, body)
  1892. if err != nil {
  1893. return nil, err
  1894. }
  1895. req.Header = reqHeaders
  1896. googleapi.Expand(req.URL, map[string]string{
  1897. "parent": c.parent,
  1898. })
  1899. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1900. }
  1901. // Do executes the "cloudasset.projects.batchGetAssetsHistory" call.
  1902. // Exactly one of *BatchGetAssetsHistoryResponse or error will be
  1903. // non-nil. Any non-2xx status code is an error. Response headers are in
  1904. // either *BatchGetAssetsHistoryResponse.ServerResponse.Header or (if a
  1905. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1906. // googleapi.IsNotModified to check whether the returned error was
  1907. // because http.StatusNotModified was returned.
  1908. func (c *ProjectsBatchGetAssetsHistoryCall) Do(opts ...googleapi.CallOption) (*BatchGetAssetsHistoryResponse, error) {
  1909. gensupport.SetOptions(c.urlParams_, opts...)
  1910. res, err := c.doRequest("json")
  1911. if res != nil && res.StatusCode == http.StatusNotModified {
  1912. if res.Body != nil {
  1913. res.Body.Close()
  1914. }
  1915. return nil, &googleapi.Error{
  1916. Code: res.StatusCode,
  1917. Header: res.Header,
  1918. }
  1919. }
  1920. if err != nil {
  1921. return nil, err
  1922. }
  1923. defer googleapi.CloseBody(res)
  1924. if err := googleapi.CheckResponse(res); err != nil {
  1925. return nil, err
  1926. }
  1927. ret := &BatchGetAssetsHistoryResponse{
  1928. ServerResponse: googleapi.ServerResponse{
  1929. Header: res.Header,
  1930. HTTPStatusCode: res.StatusCode,
  1931. },
  1932. }
  1933. target := &ret
  1934. if err := gensupport.DecodeResponse(target, res); err != nil {
  1935. return nil, err
  1936. }
  1937. return ret, nil
  1938. // {
  1939. // "description": "Batch gets the update history of assets that overlap a time window.\nFor RESOURCE content, this API outputs history with asset in both\nnon-delete or deleted status.\nFor IAM_POLICY content, this API outputs history when the asset and its\nattached IAM POLICY both exist. This can create gaps in the output history.\nIf a specified asset does not exist, this API returns an INVALID_ARGUMENT\nerror.",
  1940. // "flatPath": "v1beta1/projects/{projectsId}:batchGetAssetsHistory",
  1941. // "httpMethod": "GET",
  1942. // "id": "cloudasset.projects.batchGetAssetsHistory",
  1943. // "parameterOrder": [
  1944. // "parent"
  1945. // ],
  1946. // "parameters": {
  1947. // "assetNames": {
  1948. // "description": "A list of the full names of the assets. For example:\n`//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.\nSee [Resource\nNames](https://cloud.google.com/apis/design/resource_names#full_resource_name)\nfor more info.\n\nThe request becomes a no-op if the asset name list is empty, and the max\nsize of the asset name list is 100 in one request.",
  1949. // "location": "query",
  1950. // "repeated": true,
  1951. // "type": "string"
  1952. // },
  1953. // "contentType": {
  1954. // "description": "Required. The content type.",
  1955. // "enum": [
  1956. // "CONTENT_TYPE_UNSPECIFIED",
  1957. // "RESOURCE",
  1958. // "IAM_POLICY"
  1959. // ],
  1960. // "location": "query",
  1961. // "type": "string"
  1962. // },
  1963. // "parent": {
  1964. // "description": "Required. The relative name of the root asset. It can only be an\norganization number (such as \"organizations/123\"), a project ID (such as\n\"projects/my-project-id\")\", or a project number (such as \"projects/12345\").",
  1965. // "location": "path",
  1966. // "pattern": "^projects/[^/]+$",
  1967. // "required": true,
  1968. // "type": "string"
  1969. // },
  1970. // "readTimeWindow.endTime": {
  1971. // "description": "End time of the time window (inclusive).\nCurrent timestamp if not specified.",
  1972. // "format": "google-datetime",
  1973. // "location": "query",
  1974. // "type": "string"
  1975. // },
  1976. // "readTimeWindow.startTime": {
  1977. // "description": "Start time of the time window (exclusive).",
  1978. // "format": "google-datetime",
  1979. // "location": "query",
  1980. // "type": "string"
  1981. // }
  1982. // },
  1983. // "path": "v1beta1/{+parent}:batchGetAssetsHistory",
  1984. // "response": {
  1985. // "$ref": "BatchGetAssetsHistoryResponse"
  1986. // },
  1987. // "scopes": [
  1988. // "https://www.googleapis.com/auth/cloud-platform"
  1989. // ]
  1990. // }
  1991. }
  1992. // method id "cloudasset.projects.exportAssets":
  1993. type ProjectsExportAssetsCall struct {
  1994. s *Service
  1995. parent string
  1996. exportassetsrequest *ExportAssetsRequest
  1997. urlParams_ gensupport.URLParams
  1998. ctx_ context.Context
  1999. header_ http.Header
  2000. }
  2001. // ExportAssets: Exports assets with time and resource types to a given
  2002. // Cloud Storage
  2003. // location. The output format is newline-delimited JSON.
  2004. // This API implements the google.longrunning.Operation API allowing
  2005. // you
  2006. // to keep track of the export.
  2007. func (r *ProjectsService) ExportAssets(parent string, exportassetsrequest *ExportAssetsRequest) *ProjectsExportAssetsCall {
  2008. c := &ProjectsExportAssetsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2009. c.parent = parent
  2010. c.exportassetsrequest = exportassetsrequest
  2011. return c
  2012. }
  2013. // Fields allows partial responses to be retrieved. See
  2014. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2015. // for more information.
  2016. func (c *ProjectsExportAssetsCall) Fields(s ...googleapi.Field) *ProjectsExportAssetsCall {
  2017. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2018. return c
  2019. }
  2020. // Context sets the context to be used in this call's Do method. Any
  2021. // pending HTTP request will be aborted if the provided context is
  2022. // canceled.
  2023. func (c *ProjectsExportAssetsCall) Context(ctx context.Context) *ProjectsExportAssetsCall {
  2024. c.ctx_ = ctx
  2025. return c
  2026. }
  2027. // Header returns an http.Header that can be modified by the caller to
  2028. // add HTTP headers to the request.
  2029. func (c *ProjectsExportAssetsCall) Header() http.Header {
  2030. if c.header_ == nil {
  2031. c.header_ = make(http.Header)
  2032. }
  2033. return c.header_
  2034. }
  2035. func (c *ProjectsExportAssetsCall) doRequest(alt string) (*http.Response, error) {
  2036. reqHeaders := make(http.Header)
  2037. for k, v := range c.header_ {
  2038. reqHeaders[k] = v
  2039. }
  2040. reqHeaders.Set("User-Agent", c.s.userAgent())
  2041. var body io.Reader = nil
  2042. body, err := googleapi.WithoutDataWrapper.JSONReader(c.exportassetsrequest)
  2043. if err != nil {
  2044. return nil, err
  2045. }
  2046. reqHeaders.Set("Content-Type", "application/json")
  2047. c.urlParams_.Set("alt", alt)
  2048. c.urlParams_.Set("prettyPrint", "false")
  2049. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}:exportAssets")
  2050. urls += "?" + c.urlParams_.Encode()
  2051. req, err := http.NewRequest("POST", urls, body)
  2052. if err != nil {
  2053. return nil, err
  2054. }
  2055. req.Header = reqHeaders
  2056. googleapi.Expand(req.URL, map[string]string{
  2057. "parent": c.parent,
  2058. })
  2059. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2060. }
  2061. // Do executes the "cloudasset.projects.exportAssets" call.
  2062. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2063. // status code is an error. Response headers are in either
  2064. // *Operation.ServerResponse.Header or (if a response was returned at
  2065. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2066. // to check whether the returned error was because
  2067. // http.StatusNotModified was returned.
  2068. func (c *ProjectsExportAssetsCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2069. gensupport.SetOptions(c.urlParams_, opts...)
  2070. res, err := c.doRequest("json")
  2071. if res != nil && res.StatusCode == http.StatusNotModified {
  2072. if res.Body != nil {
  2073. res.Body.Close()
  2074. }
  2075. return nil, &googleapi.Error{
  2076. Code: res.StatusCode,
  2077. Header: res.Header,
  2078. }
  2079. }
  2080. if err != nil {
  2081. return nil, err
  2082. }
  2083. defer googleapi.CloseBody(res)
  2084. if err := googleapi.CheckResponse(res); err != nil {
  2085. return nil, err
  2086. }
  2087. ret := &Operation{
  2088. ServerResponse: googleapi.ServerResponse{
  2089. Header: res.Header,
  2090. HTTPStatusCode: res.StatusCode,
  2091. },
  2092. }
  2093. target := &ret
  2094. if err := gensupport.DecodeResponse(target, res); err != nil {
  2095. return nil, err
  2096. }
  2097. return ret, nil
  2098. // {
  2099. // "description": "Exports assets with time and resource types to a given Cloud Storage\nlocation. The output format is newline-delimited JSON.\nThis API implements the google.longrunning.Operation API allowing you\nto keep track of the export.",
  2100. // "flatPath": "v1beta1/projects/{projectsId}:exportAssets",
  2101. // "httpMethod": "POST",
  2102. // "id": "cloudasset.projects.exportAssets",
  2103. // "parameterOrder": [
  2104. // "parent"
  2105. // ],
  2106. // "parameters": {
  2107. // "parent": {
  2108. // "description": "Required. The relative name of the root asset. This can only be an\norganization number (such as \"organizations/123\"), a project ID (such as\n\"projects/my-project-id\"), a project number (such as \"projects/12345\"), or\na folder number (such as \"folders/123\").",
  2109. // "location": "path",
  2110. // "pattern": "^projects/[^/]+$",
  2111. // "required": true,
  2112. // "type": "string"
  2113. // }
  2114. // },
  2115. // "path": "v1beta1/{+parent}:exportAssets",
  2116. // "request": {
  2117. // "$ref": "ExportAssetsRequest"
  2118. // },
  2119. // "response": {
  2120. // "$ref": "Operation"
  2121. // },
  2122. // "scopes": [
  2123. // "https://www.googleapis.com/auth/cloud-platform"
  2124. // ]
  2125. // }
  2126. }
  2127. // method id "cloudasset.projects.operations.get":
  2128. type ProjectsOperationsGetCall struct {
  2129. s *Service
  2130. name string
  2131. urlParams_ gensupport.URLParams
  2132. ifNoneMatch_ string
  2133. ctx_ context.Context
  2134. header_ http.Header
  2135. }
  2136. // Get: Gets the latest state of a long-running operation. Clients can
  2137. // use this
  2138. // method to poll the operation result at intervals as recommended by
  2139. // the API
  2140. // service.
  2141. func (r *ProjectsOperationsService) Get(name string) *ProjectsOperationsGetCall {
  2142. c := &ProjectsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2143. c.name = name
  2144. return c
  2145. }
  2146. // Fields allows partial responses to be retrieved. See
  2147. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2148. // for more information.
  2149. func (c *ProjectsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsOperationsGetCall {
  2150. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2151. return c
  2152. }
  2153. // IfNoneMatch sets the optional parameter which makes the operation
  2154. // fail if the object's ETag matches the given value. This is useful for
  2155. // getting updates only after the object has changed since the last
  2156. // request. Use googleapi.IsNotModified to check whether the response
  2157. // error from Do is the result of In-None-Match.
  2158. func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {
  2159. c.ifNoneMatch_ = entityTag
  2160. return c
  2161. }
  2162. // Context sets the context to be used in this call's Do method. Any
  2163. // pending HTTP request will be aborted if the provided context is
  2164. // canceled.
  2165. func (c *ProjectsOperationsGetCall) Context(ctx context.Context) *ProjectsOperationsGetCall {
  2166. c.ctx_ = ctx
  2167. return c
  2168. }
  2169. // Header returns an http.Header that can be modified by the caller to
  2170. // add HTTP headers to the request.
  2171. func (c *ProjectsOperationsGetCall) Header() http.Header {
  2172. if c.header_ == nil {
  2173. c.header_ = make(http.Header)
  2174. }
  2175. return c.header_
  2176. }
  2177. func (c *ProjectsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  2178. reqHeaders := make(http.Header)
  2179. for k, v := range c.header_ {
  2180. reqHeaders[k] = v
  2181. }
  2182. reqHeaders.Set("User-Agent", c.s.userAgent())
  2183. if c.ifNoneMatch_ != "" {
  2184. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2185. }
  2186. var body io.Reader = nil
  2187. c.urlParams_.Set("alt", alt)
  2188. c.urlParams_.Set("prettyPrint", "false")
  2189. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  2190. urls += "?" + c.urlParams_.Encode()
  2191. req, err := http.NewRequest("GET", urls, body)
  2192. if err != nil {
  2193. return nil, err
  2194. }
  2195. req.Header = reqHeaders
  2196. googleapi.Expand(req.URL, map[string]string{
  2197. "name": c.name,
  2198. })
  2199. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2200. }
  2201. // Do executes the "cloudasset.projects.operations.get" call.
  2202. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2203. // status code is an error. Response headers are in either
  2204. // *Operation.ServerResponse.Header or (if a response was returned at
  2205. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2206. // to check whether the returned error was because
  2207. // http.StatusNotModified was returned.
  2208. func (c *ProjectsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2209. gensupport.SetOptions(c.urlParams_, opts...)
  2210. res, err := c.doRequest("json")
  2211. if res != nil && res.StatusCode == http.StatusNotModified {
  2212. if res.Body != nil {
  2213. res.Body.Close()
  2214. }
  2215. return nil, &googleapi.Error{
  2216. Code: res.StatusCode,
  2217. Header: res.Header,
  2218. }
  2219. }
  2220. if err != nil {
  2221. return nil, err
  2222. }
  2223. defer googleapi.CloseBody(res)
  2224. if err := googleapi.CheckResponse(res); err != nil {
  2225. return nil, err
  2226. }
  2227. ret := &Operation{
  2228. ServerResponse: googleapi.ServerResponse{
  2229. Header: res.Header,
  2230. HTTPStatusCode: res.StatusCode,
  2231. },
  2232. }
  2233. target := &ret
  2234. if err := gensupport.DecodeResponse(target, res); err != nil {
  2235. return nil, err
  2236. }
  2237. return ret, nil
  2238. // {
  2239. // "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.",
  2240. // "flatPath": "v1beta1/projects/{projectsId}/operations/{operationsId}/{operationsId1}",
  2241. // "httpMethod": "GET",
  2242. // "id": "cloudasset.projects.operations.get",
  2243. // "parameterOrder": [
  2244. // "name"
  2245. // ],
  2246. // "parameters": {
  2247. // "name": {
  2248. // "description": "The name of the operation resource.",
  2249. // "location": "path",
  2250. // "pattern": "^projects/[^/]+/operations/[^/]+/.+$",
  2251. // "required": true,
  2252. // "type": "string"
  2253. // }
  2254. // },
  2255. // "path": "v1beta1/{+name}",
  2256. // "response": {
  2257. // "$ref": "Operation"
  2258. // },
  2259. // "scopes": [
  2260. // "https://www.googleapis.com/auth/cloud-platform"
  2261. // ]
  2262. // }
  2263. }