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.
 
 
 

3176 lines
110 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 cloudresourcemanager provides access to the Cloud Resource Manager API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/resource-manager
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudresourcemanager/v2beta1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudresourcemanagerService, err := cloudresourcemanager.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. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithScopes(cloudresourcemanager.CloudPlatformReadOnlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package cloudresourcemanager // import "google.golang.org/api/cloudresourcemanager/v2beta1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "cloudresourcemanager:v2beta1"
  71. const apiName = "cloudresourcemanager"
  72. const apiVersion = "v2beta1"
  73. const basePath = "https://cloudresourcemanager.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage your data across Google Cloud Platform services
  77. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  78. // View your data across Google Cloud Platform services
  79. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/cloud-platform",
  85. "https://www.googleapis.com/auth/cloud-platform.read-only",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Folders = NewFoldersService(s)
  113. s.Operations = NewOperationsService(s)
  114. return s, nil
  115. }
  116. type Service struct {
  117. client *http.Client
  118. BasePath string // API endpoint base URL
  119. UserAgent string // optional additional User-Agent fragment
  120. Folders *FoldersService
  121. Operations *OperationsService
  122. }
  123. func (s *Service) userAgent() string {
  124. if s.UserAgent == "" {
  125. return googleapi.UserAgent
  126. }
  127. return googleapi.UserAgent + " " + s.UserAgent
  128. }
  129. func NewFoldersService(s *Service) *FoldersService {
  130. rs := &FoldersService{s: s}
  131. return rs
  132. }
  133. type FoldersService struct {
  134. s *Service
  135. }
  136. func NewOperationsService(s *Service) *OperationsService {
  137. rs := &OperationsService{s: s}
  138. return rs
  139. }
  140. type OperationsService struct {
  141. s *Service
  142. }
  143. // AuditConfig: Specifies the audit configuration for a service.
  144. // The configuration determines which permission types are logged, and
  145. // what
  146. // identities, if any, are exempted from logging.
  147. // An AuditConfig must have one or more AuditLogConfigs.
  148. //
  149. // If there are AuditConfigs for both `allServices` and a specific
  150. // service,
  151. // the union of the two AuditConfigs is used for that service: the
  152. // log_types
  153. // specified in each AuditConfig are enabled, and the exempted_members
  154. // in each
  155. // AuditLogConfig are exempted.
  156. //
  157. // Example Policy with multiple AuditConfigs:
  158. //
  159. // {
  160. // "audit_configs": [
  161. // {
  162. // "service": "allServices"
  163. // "audit_log_configs": [
  164. // {
  165. // "log_type": "DATA_READ",
  166. // "exempted_members": [
  167. // "user:foo@gmail.com"
  168. // ]
  169. // },
  170. // {
  171. // "log_type": "DATA_WRITE",
  172. // },
  173. // {
  174. // "log_type": "ADMIN_READ",
  175. // }
  176. // ]
  177. // },
  178. // {
  179. // "service": "fooservice.googleapis.com"
  180. // "audit_log_configs": [
  181. // {
  182. // "log_type": "DATA_READ",
  183. // },
  184. // {
  185. // "log_type": "DATA_WRITE",
  186. // "exempted_members": [
  187. // "user:bar@gmail.com"
  188. // ]
  189. // }
  190. // ]
  191. // }
  192. // ]
  193. // }
  194. //
  195. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  196. // ADMIN_READ
  197. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  198. // and
  199. // bar@gmail.com from DATA_WRITE logging.
  200. type AuditConfig struct {
  201. // AuditLogConfigs: The configuration for logging of each type of
  202. // permission.
  203. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  204. // Service: Specifies a service that will be enabled for audit
  205. // logging.
  206. // For example, `storage.googleapis.com`,
  207. // `cloudsql.googleapis.com`.
  208. // `allServices` is a special value that covers all services.
  209. Service string `json:"service,omitempty"`
  210. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  211. // unconditionally include in API requests. By default, fields with
  212. // empty values are omitted from API requests. However, any non-pointer,
  213. // non-interface field appearing in ForceSendFields will be sent to the
  214. // server regardless of whether the field is empty or not. This may be
  215. // used to include empty fields in Patch requests.
  216. ForceSendFields []string `json:"-"`
  217. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  218. // include in API requests with the JSON null value. By default, fields
  219. // with empty values are omitted from API requests. However, any field
  220. // with an empty value appearing in NullFields will be sent to the
  221. // server as null. It is an error if a field in this list has a
  222. // non-empty value. This may be used to include null fields in Patch
  223. // requests.
  224. NullFields []string `json:"-"`
  225. }
  226. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  227. type NoMethod AuditConfig
  228. raw := NoMethod(*s)
  229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  230. }
  231. // AuditLogConfig: Provides the configuration for logging a type of
  232. // permissions.
  233. // Example:
  234. //
  235. // {
  236. // "audit_log_configs": [
  237. // {
  238. // "log_type": "DATA_READ",
  239. // "exempted_members": [
  240. // "user:foo@gmail.com"
  241. // ]
  242. // },
  243. // {
  244. // "log_type": "DATA_WRITE",
  245. // }
  246. // ]
  247. // }
  248. //
  249. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  250. // exempting
  251. // foo@gmail.com from DATA_READ logging.
  252. type AuditLogConfig struct {
  253. // ExemptedMembers: Specifies the identities that do not cause logging
  254. // for this type of
  255. // permission.
  256. // Follows the same format of Binding.members.
  257. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  258. // LogType: The log type that this config enables.
  259. //
  260. // Possible values:
  261. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  262. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  263. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  264. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  265. LogType string `json:"logType,omitempty"`
  266. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  267. // unconditionally include in API requests. By default, fields with
  268. // empty values are omitted from API requests. However, any non-pointer,
  269. // non-interface field appearing in ForceSendFields will be sent to the
  270. // server regardless of whether the field is empty or not. This may be
  271. // used to include empty fields in Patch requests.
  272. ForceSendFields []string `json:"-"`
  273. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  274. // include in API requests with the JSON null value. By default, fields
  275. // with empty values are omitted from API requests. However, any field
  276. // with an empty value appearing in NullFields will be sent to the
  277. // server as null. It is an error if a field in this list has a
  278. // non-empty value. This may be used to include null fields in Patch
  279. // requests.
  280. NullFields []string `json:"-"`
  281. }
  282. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  283. type NoMethod AuditLogConfig
  284. raw := NoMethod(*s)
  285. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  286. }
  287. // Binding: Associates `members` with a `role`.
  288. type Binding struct {
  289. // Condition: Unimplemented. The condition that is associated with this
  290. // binding.
  291. // NOTE: an unsatisfied condition will not allow user access via
  292. // current
  293. // binding. Different bindings, including their conditions, are
  294. // examined
  295. // independently.
  296. Condition *Expr `json:"condition,omitempty"`
  297. // Members: Specifies the identities requesting access for a Cloud
  298. // Platform resource.
  299. // `members` can have the following values:
  300. //
  301. // * `allUsers`: A special identifier that represents anyone who is
  302. // on the internet; with or without a Google account.
  303. //
  304. // * `allAuthenticatedUsers`: A special identifier that represents
  305. // anyone
  306. // who is authenticated with a Google account or a service
  307. // account.
  308. //
  309. // * `user:{emailid}`: An email address that represents a specific
  310. // Google
  311. // account. For example, `alice@gmail.com` .
  312. //
  313. //
  314. // * `serviceAccount:{emailid}`: An email address that represents a
  315. // service
  316. // account. For example,
  317. // `my-other-app@appspot.gserviceaccount.com`.
  318. //
  319. // * `group:{emailid}`: An email address that represents a Google
  320. // group.
  321. // For example, `admins@example.com`.
  322. //
  323. //
  324. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  325. // the
  326. // users of that domain. For example, `google.com` or
  327. // `example.com`.
  328. //
  329. //
  330. Members []string `json:"members,omitempty"`
  331. // Role: Role that is assigned to `members`.
  332. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  333. Role string `json:"role,omitempty"`
  334. // ForceSendFields is a list of field names (e.g. "Condition") to
  335. // unconditionally include in API requests. By default, fields with
  336. // empty values are omitted from API requests. However, any non-pointer,
  337. // non-interface field appearing in ForceSendFields will be sent to the
  338. // server regardless of whether the field is empty or not. This may be
  339. // used to include empty fields in Patch requests.
  340. ForceSendFields []string `json:"-"`
  341. // NullFields is a list of field names (e.g. "Condition") to include in
  342. // API requests with the JSON null value. By default, fields with empty
  343. // values are omitted from API requests. However, any field with an
  344. // empty value appearing in NullFields will be sent to the server as
  345. // null. It is an error if a field in this list has a non-empty value.
  346. // This may be used to include null fields in Patch requests.
  347. NullFields []string `json:"-"`
  348. }
  349. func (s *Binding) MarshalJSON() ([]byte, error) {
  350. type NoMethod Binding
  351. raw := NoMethod(*s)
  352. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  353. }
  354. // Expr: Represents an expression text. Example:
  355. //
  356. // title: "User account presence"
  357. // description: "Determines whether the request has a user account"
  358. // expression: "size(request.user) > 0"
  359. type Expr struct {
  360. // Description: An optional description of the expression. This is a
  361. // longer text which
  362. // describes the expression, e.g. when hovered over it in a UI.
  363. Description string `json:"description,omitempty"`
  364. // Expression: Textual representation of an expression in
  365. // Common Expression Language syntax.
  366. //
  367. // The application context of the containing message determines
  368. // which
  369. // well-known feature set of CEL is supported.
  370. Expression string `json:"expression,omitempty"`
  371. // Location: An optional string indicating the location of the
  372. // expression for error
  373. // reporting, e.g. a file name and a position in the file.
  374. Location string `json:"location,omitempty"`
  375. // Title: An optional title for the expression, i.e. a short string
  376. // describing
  377. // its purpose. This can be used e.g. in UIs which allow to enter
  378. // the
  379. // expression.
  380. Title string `json:"title,omitempty"`
  381. // ForceSendFields is a list of field names (e.g. "Description") to
  382. // unconditionally include in API requests. By default, fields with
  383. // empty values are omitted from API requests. However, any non-pointer,
  384. // non-interface field appearing in ForceSendFields will be sent to the
  385. // server regardless of whether the field is empty or not. This may be
  386. // used to include empty fields in Patch requests.
  387. ForceSendFields []string `json:"-"`
  388. // NullFields is a list of field names (e.g. "Description") to include
  389. // in API requests with the JSON null value. By default, fields with
  390. // empty values are omitted from API requests. However, any field with
  391. // an empty value appearing in NullFields will be sent to the server as
  392. // null. It is an error if a field in this list has a non-empty value.
  393. // This may be used to include null fields in Patch requests.
  394. NullFields []string `json:"-"`
  395. }
  396. func (s *Expr) MarshalJSON() ([]byte, error) {
  397. type NoMethod Expr
  398. raw := NoMethod(*s)
  399. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  400. }
  401. // Folder: A Folder in an Organization's resource hierarchy, used
  402. // to
  403. // organize that Organization's resources.
  404. type Folder struct {
  405. // CreateTime: Output only. Timestamp when the Folder was created.
  406. // Assigned by the server.
  407. CreateTime string `json:"createTime,omitempty"`
  408. // DisplayName: The folder’s display name.
  409. // A folder’s display name must be unique amongst its siblings,
  410. // e.g.
  411. // no two folders with the same parent can share the same display
  412. // name.
  413. // The display name must start and end with a letter or digit, may
  414. // contain
  415. // letters, digits, spaces, hyphens and underscores and can be no
  416. // longer
  417. // than 30 characters. This is captured by the regular
  418. // expression:
  419. // [\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?.
  420. DisplayName string `json:"displayName,omitempty"`
  421. // LifecycleState: Output only. The lifecycle state of the
  422. // folder.
  423. // Updates to the lifecycle_state must be performed via
  424. // DeleteFolder and
  425. // UndeleteFolder.
  426. //
  427. // Possible values:
  428. // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state.
  429. // "ACTIVE" - The normal and active state.
  430. // "DELETE_REQUESTED" - The folder has been marked for deletion by the
  431. // user.
  432. LifecycleState string `json:"lifecycleState,omitempty"`
  433. // Name: Output only. The resource name of the Folder.
  434. // Its format is `folders/{folder_id}`, for example: "folders/1234".
  435. Name string `json:"name,omitempty"`
  436. // Parent: The Folder’s parent's resource name.
  437. // Updates to the folder's parent must be performed via
  438. // MoveFolder.
  439. Parent string `json:"parent,omitempty"`
  440. // ServerResponse contains the HTTP response code and headers from the
  441. // server.
  442. googleapi.ServerResponse `json:"-"`
  443. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  444. // unconditionally include in API requests. By default, fields with
  445. // empty values are omitted from API requests. However, any non-pointer,
  446. // non-interface field appearing in ForceSendFields will be sent to the
  447. // server regardless of whether the field is empty or not. This may be
  448. // used to include empty fields in Patch requests.
  449. ForceSendFields []string `json:"-"`
  450. // NullFields is a list of field names (e.g. "CreateTime") to include in
  451. // API requests with the JSON null value. By default, fields with empty
  452. // values are omitted from API requests. However, any field with an
  453. // empty value appearing in NullFields will be sent to the server as
  454. // null. It is an error if a field in this list has a non-empty value.
  455. // This may be used to include null fields in Patch requests.
  456. NullFields []string `json:"-"`
  457. }
  458. func (s *Folder) MarshalJSON() ([]byte, error) {
  459. type NoMethod Folder
  460. raw := NoMethod(*s)
  461. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  462. }
  463. // FolderOperation: Metadata describing a long running folder operation
  464. type FolderOperation struct {
  465. // DestinationParent: The resource name of the folder or organization we
  466. // are either creating
  467. // the folder under or moving the folder to.
  468. DestinationParent string `json:"destinationParent,omitempty"`
  469. // DisplayName: The display name of the folder.
  470. DisplayName string `json:"displayName,omitempty"`
  471. // OperationType: The type of this operation.
  472. //
  473. // Possible values:
  474. // "OPERATION_TYPE_UNSPECIFIED" - Operation type not specified.
  475. // "CREATE" - A create folder operation.
  476. // "MOVE" - A move folder operation.
  477. OperationType string `json:"operationType,omitempty"`
  478. // SourceParent: The resource name of the folder's parent.
  479. // Only applicable when the operation_type is MOVE.
  480. SourceParent string `json:"sourceParent,omitempty"`
  481. // ForceSendFields is a list of field names (e.g. "DestinationParent")
  482. // to unconditionally include in API requests. By default, fields with
  483. // empty values are omitted from API requests. However, any non-pointer,
  484. // non-interface field appearing in ForceSendFields will be sent to the
  485. // server regardless of whether the field is empty or not. This may be
  486. // used to include empty fields in Patch requests.
  487. ForceSendFields []string `json:"-"`
  488. // NullFields is a list of field names (e.g. "DestinationParent") to
  489. // include in API requests with the JSON null value. By default, fields
  490. // with empty values are omitted from API requests. However, any field
  491. // with an empty value appearing in NullFields will be sent to the
  492. // server as null. It is an error if a field in this list has a
  493. // non-empty value. This may be used to include null fields in Patch
  494. // requests.
  495. NullFields []string `json:"-"`
  496. }
  497. func (s *FolderOperation) MarshalJSON() ([]byte, error) {
  498. type NoMethod FolderOperation
  499. raw := NoMethod(*s)
  500. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  501. }
  502. // FolderOperationError: A classification of the Folder Operation error.
  503. type FolderOperationError struct {
  504. // ErrorMessageId: The type of operation error experienced.
  505. //
  506. // Possible values:
  507. // "ERROR_TYPE_UNSPECIFIED" - The error type was unrecognized or
  508. // unspecified.
  509. // "ACTIVE_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  510. // violate the max folder depth constraint.
  511. // "MAX_CHILD_FOLDERS_VIOLATION" - The attempted action would violate
  512. // the max child folders constraint.
  513. // "FOLDER_NAME_UNIQUENESS_VIOLATION" - The attempted action would
  514. // violate the locally-unique folder
  515. // display_name constraint.
  516. // "RESOURCE_DELETED_VIOLATION" - The resource being moved has been
  517. // deleted.
  518. // "PARENT_DELETED_VIOLATION" - The resource a folder was being added
  519. // to has been deleted.
  520. // "CYCLE_INTRODUCED_VIOLATION" - The attempted action would introduce
  521. // cycle in resource path.
  522. // "FOLDER_BEING_MOVED_VIOLATION" - The attempted action would move a
  523. // folder that is already being moved.
  524. // "FOLDER_TO_DELETE_NON_EMPTY_VIOLATION" - The folder the caller is
  525. // trying to delete contains active resources.
  526. // "DELETED_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  527. // violate the max deleted folder depth
  528. // constraint.
  529. ErrorMessageId string `json:"errorMessageId,omitempty"`
  530. // ForceSendFields is a list of field names (e.g. "ErrorMessageId") to
  531. // unconditionally include in API requests. By default, fields with
  532. // empty values are omitted from API requests. However, any non-pointer,
  533. // non-interface field appearing in ForceSendFields will be sent to the
  534. // server regardless of whether the field is empty or not. This may be
  535. // used to include empty fields in Patch requests.
  536. ForceSendFields []string `json:"-"`
  537. // NullFields is a list of field names (e.g. "ErrorMessageId") to
  538. // include in API requests with the JSON null value. By default, fields
  539. // with empty values are omitted from API requests. However, any field
  540. // with an empty value appearing in NullFields will be sent to the
  541. // server as null. It is an error if a field in this list has a
  542. // non-empty value. This may be used to include null fields in Patch
  543. // requests.
  544. NullFields []string `json:"-"`
  545. }
  546. func (s *FolderOperationError) MarshalJSON() ([]byte, error) {
  547. type NoMethod FolderOperationError
  548. raw := NoMethod(*s)
  549. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  550. }
  551. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  552. type GetIamPolicyRequest struct {
  553. }
  554. // ListFoldersResponse: The ListFolders response message.
  555. type ListFoldersResponse struct {
  556. // Folders: A possibly paginated list of Folders that are direct
  557. // descendants of
  558. // the specified parent resource.
  559. Folders []*Folder `json:"folders,omitempty"`
  560. // NextPageToken: A pagination token returned from a previous call to
  561. // `ListFolders`
  562. // that indicates from where listing should continue.
  563. // This field is optional.
  564. NextPageToken string `json:"nextPageToken,omitempty"`
  565. // ServerResponse contains the HTTP response code and headers from the
  566. // server.
  567. googleapi.ServerResponse `json:"-"`
  568. // ForceSendFields is a list of field names (e.g. "Folders") to
  569. // unconditionally include in API requests. By default, fields with
  570. // empty values are omitted from API requests. However, any non-pointer,
  571. // non-interface field appearing in ForceSendFields will be sent to the
  572. // server regardless of whether the field is empty or not. This may be
  573. // used to include empty fields in Patch requests.
  574. ForceSendFields []string `json:"-"`
  575. // NullFields is a list of field names (e.g. "Folders") to include in
  576. // API requests with the JSON null value. By default, fields with empty
  577. // values are omitted from API requests. However, any field with an
  578. // empty value appearing in NullFields will be sent to the server as
  579. // null. It is an error if a field in this list has a non-empty value.
  580. // This may be used to include null fields in Patch requests.
  581. NullFields []string `json:"-"`
  582. }
  583. func (s *ListFoldersResponse) MarshalJSON() ([]byte, error) {
  584. type NoMethod ListFoldersResponse
  585. raw := NoMethod(*s)
  586. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  587. }
  588. // MoveFolderRequest: The MoveFolder request message.
  589. type MoveFolderRequest struct {
  590. // DestinationParent: The resource name of the Folder or Organization to
  591. // reparent
  592. // the folder under.
  593. // Must be of the form `folders/{folder_id}` or
  594. // `organizations/{org_id}`.
  595. DestinationParent string `json:"destinationParent,omitempty"`
  596. // ForceSendFields is a list of field names (e.g. "DestinationParent")
  597. // to unconditionally include in API requests. By default, fields with
  598. // empty values are omitted from API requests. However, any non-pointer,
  599. // non-interface field appearing in ForceSendFields will be sent to the
  600. // server regardless of whether the field is empty or not. This may be
  601. // used to include empty fields in Patch requests.
  602. ForceSendFields []string `json:"-"`
  603. // NullFields is a list of field names (e.g. "DestinationParent") to
  604. // include in API requests with the JSON null value. By default, fields
  605. // with empty values are omitted from API requests. However, any field
  606. // with an empty value appearing in NullFields will be sent to the
  607. // server as null. It is an error if a field in this list has a
  608. // non-empty value. This may be used to include null fields in Patch
  609. // requests.
  610. NullFields []string `json:"-"`
  611. }
  612. func (s *MoveFolderRequest) MarshalJSON() ([]byte, error) {
  613. type NoMethod MoveFolderRequest
  614. raw := NoMethod(*s)
  615. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  616. }
  617. // Operation: This resource represents a long-running operation that is
  618. // the result of a
  619. // network API call.
  620. type Operation struct {
  621. // Done: If the value is `false`, it means the operation is still in
  622. // progress.
  623. // If `true`, the operation is completed, and either `error` or
  624. // `response` is
  625. // available.
  626. Done bool `json:"done,omitempty"`
  627. // Error: The error result of the operation in case of failure or
  628. // cancellation.
  629. Error *Status `json:"error,omitempty"`
  630. // Metadata: Service-specific metadata associated with the operation.
  631. // It typically
  632. // contains progress information and common metadata such as create
  633. // time.
  634. // Some services might not provide such metadata. Any method that
  635. // returns a
  636. // long-running operation should document the metadata type, if any.
  637. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  638. // Name: The server-assigned name, which is only unique within the same
  639. // service that
  640. // originally returns it. If you use the default HTTP mapping,
  641. // the
  642. // `name` should have the format of `operations/some/unique/name`.
  643. Name string `json:"name,omitempty"`
  644. // Response: The normal response of the operation in case of success.
  645. // If the original
  646. // method returns no data on success, such as `Delete`, the response
  647. // is
  648. // `google.protobuf.Empty`. If the original method is
  649. // standard
  650. // `Get`/`Create`/`Update`, the response should be the resource. For
  651. // other
  652. // methods, the response should have the type `XxxResponse`, where
  653. // `Xxx`
  654. // is the original method name. For example, if the original method
  655. // name
  656. // is `TakeSnapshot()`, the inferred response type
  657. // is
  658. // `TakeSnapshotResponse`.
  659. Response googleapi.RawMessage `json:"response,omitempty"`
  660. // ServerResponse contains the HTTP response code and headers from the
  661. // server.
  662. googleapi.ServerResponse `json:"-"`
  663. // ForceSendFields is a list of field names (e.g. "Done") to
  664. // unconditionally include in API requests. By default, fields with
  665. // empty values are omitted from API requests. However, any non-pointer,
  666. // non-interface field appearing in ForceSendFields will be sent to the
  667. // server regardless of whether the field is empty or not. This may be
  668. // used to include empty fields in Patch requests.
  669. ForceSendFields []string `json:"-"`
  670. // NullFields is a list of field names (e.g. "Done") to include in API
  671. // requests with the JSON null value. By default, fields with empty
  672. // values are omitted from API requests. However, any field with an
  673. // empty value appearing in NullFields will be sent to the server as
  674. // null. It is an error if a field in this list has a non-empty value.
  675. // This may be used to include null fields in Patch requests.
  676. NullFields []string `json:"-"`
  677. }
  678. func (s *Operation) MarshalJSON() ([]byte, error) {
  679. type NoMethod Operation
  680. raw := NoMethod(*s)
  681. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  682. }
  683. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  684. // used to
  685. // specify access control policies for Cloud Platform resources.
  686. //
  687. //
  688. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  689. // of
  690. // `members` to a `role`, where the members can be user accounts, Google
  691. // groups,
  692. // Google domains, and service accounts. A `role` is a named list of
  693. // permissions
  694. // defined by IAM.
  695. //
  696. // **JSON Example**
  697. //
  698. // {
  699. // "bindings": [
  700. // {
  701. // "role": "roles/owner",
  702. // "members": [
  703. // "user:mike@example.com",
  704. // "group:admins@example.com",
  705. // "domain:google.com",
  706. //
  707. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  708. // ]
  709. // },
  710. // {
  711. // "role": "roles/viewer",
  712. // "members": ["user:sean@example.com"]
  713. // }
  714. // ]
  715. // }
  716. //
  717. // **YAML Example**
  718. //
  719. // bindings:
  720. // - members:
  721. // - user:mike@example.com
  722. // - group:admins@example.com
  723. // - domain:google.com
  724. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  725. // role: roles/owner
  726. // - members:
  727. // - user:sean@example.com
  728. // role: roles/viewer
  729. //
  730. //
  731. // For a description of IAM and its features, see the
  732. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  733. type Policy struct {
  734. // AuditConfigs: Specifies cloud audit logging configuration for this
  735. // policy.
  736. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  737. // Bindings: Associates a list of `members` to a `role`.
  738. // `bindings` with no members will result in an error.
  739. Bindings []*Binding `json:"bindings,omitempty"`
  740. // Etag: `etag` is used for optimistic concurrency control as a way to
  741. // help
  742. // prevent simultaneous updates of a policy from overwriting each
  743. // other.
  744. // It is strongly suggested that systems make use of the `etag` in
  745. // the
  746. // read-modify-write cycle to perform policy updates in order to avoid
  747. // race
  748. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  749. // and
  750. // systems are expected to put that etag in the request to
  751. // `setIamPolicy` to
  752. // ensure that their change will be applied to the same version of the
  753. // policy.
  754. //
  755. // If no `etag` is provided in the call to `setIamPolicy`, then the
  756. // existing
  757. // policy is overwritten blindly.
  758. Etag string `json:"etag,omitempty"`
  759. // Version: Deprecated.
  760. Version int64 `json:"version,omitempty"`
  761. // ServerResponse contains the HTTP response code and headers from the
  762. // server.
  763. googleapi.ServerResponse `json:"-"`
  764. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  765. // unconditionally include in API requests. By default, fields with
  766. // empty values are omitted from API requests. However, any non-pointer,
  767. // non-interface field appearing in ForceSendFields will be sent to the
  768. // server regardless of whether the field is empty or not. This may be
  769. // used to include empty fields in Patch requests.
  770. ForceSendFields []string `json:"-"`
  771. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  772. // in API requests with the JSON null value. By default, fields with
  773. // empty values are omitted from API requests. However, any field with
  774. // an empty value appearing in NullFields will be sent to the server as
  775. // null. It is an error if a field in this list has a non-empty value.
  776. // This may be used to include null fields in Patch requests.
  777. NullFields []string `json:"-"`
  778. }
  779. func (s *Policy) MarshalJSON() ([]byte, error) {
  780. type NoMethod Policy
  781. raw := NoMethod(*s)
  782. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  783. }
  784. // ProjectCreationStatus: A status object which is used as the
  785. // `metadata` field for the Operation
  786. // returned by CreateProject. It provides insight for when significant
  787. // phases of
  788. // Project creation have completed.
  789. type ProjectCreationStatus struct {
  790. // CreateTime: Creation time of the project creation workflow.
  791. CreateTime string `json:"createTime,omitempty"`
  792. // Gettable: True if the project can be retrieved using GetProject. No
  793. // other operations
  794. // on the project are guaranteed to work until the project creation
  795. // is
  796. // complete.
  797. Gettable bool `json:"gettable,omitempty"`
  798. // Ready: True if the project creation process is complete.
  799. Ready bool `json:"ready,omitempty"`
  800. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  801. // unconditionally include in API requests. By default, fields with
  802. // empty values are omitted from API requests. However, any non-pointer,
  803. // non-interface field appearing in ForceSendFields will be sent to the
  804. // server regardless of whether the field is empty or not. This may be
  805. // used to include empty fields in Patch requests.
  806. ForceSendFields []string `json:"-"`
  807. // NullFields is a list of field names (e.g. "CreateTime") to include in
  808. // API requests with the JSON null value. By default, fields with empty
  809. // values are omitted from API requests. However, any field with an
  810. // empty value appearing in NullFields will be sent to the server as
  811. // null. It is an error if a field in this list has a non-empty value.
  812. // This may be used to include null fields in Patch requests.
  813. NullFields []string `json:"-"`
  814. }
  815. func (s *ProjectCreationStatus) MarshalJSON() ([]byte, error) {
  816. type NoMethod ProjectCreationStatus
  817. raw := NoMethod(*s)
  818. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  819. }
  820. // SearchFoldersRequest: The request message for searching folders.
  821. type SearchFoldersRequest struct {
  822. // PageSize: The maximum number of folders to return in the
  823. // response.
  824. // This field is optional.
  825. PageSize int64 `json:"pageSize,omitempty"`
  826. // PageToken: A pagination token returned from a previous call to
  827. // `SearchFolders`
  828. // that indicates from where search should continue.
  829. // This field is optional.
  830. PageToken string `json:"pageToken,omitempty"`
  831. // Query: Search criteria used to select the Folders to return.
  832. // If no search criteria is specified then all accessible folders will
  833. // be
  834. // returned.
  835. //
  836. // Query expressions can be used to restrict results based upon
  837. // displayName,
  838. // lifecycleState and parent, where the operators `=`, `NOT`, `AND` and
  839. // `OR`
  840. // can be used along with the suffix wildcard symbol `*`.
  841. //
  842. // The displayName field in a query expression should use escaped
  843. // quotes
  844. // for values that include whitespace to prevent unexpected
  845. // behavior.
  846. //
  847. // Some example queries are:
  848. //
  849. // |Query | Description|
  850. // |----- | -----------|
  851. // |displayName=Test* | Folders whose display name starts with
  852. // "Test".|
  853. // |lifecycleState=ACTIVE | Folders whose lifecycleState is
  854. // ACTIVE.|
  855. // |parent=folders/123 | Folders whose parent is
  856. // "folders/123".|
  857. // |parent=folders/123 AND lifecycleState=ACTIVE | Active folders whose
  858. // parent is "folders/123".|
  859. // |displayName=\\"Test String\\"|Folders whose display name includes
  860. // both "Test" and "String".|
  861. Query string `json:"query,omitempty"`
  862. // ForceSendFields is a list of field names (e.g. "PageSize") to
  863. // unconditionally include in API requests. By default, fields with
  864. // empty values are omitted from API requests. However, any non-pointer,
  865. // non-interface field appearing in ForceSendFields will be sent to the
  866. // server regardless of whether the field is empty or not. This may be
  867. // used to include empty fields in Patch requests.
  868. ForceSendFields []string `json:"-"`
  869. // NullFields is a list of field names (e.g. "PageSize") to include in
  870. // API requests with the JSON null value. By default, fields with empty
  871. // values are omitted from API requests. However, any field with an
  872. // empty value appearing in NullFields will be sent to the server as
  873. // null. It is an error if a field in this list has a non-empty value.
  874. // This may be used to include null fields in Patch requests.
  875. NullFields []string `json:"-"`
  876. }
  877. func (s *SearchFoldersRequest) MarshalJSON() ([]byte, error) {
  878. type NoMethod SearchFoldersRequest
  879. raw := NoMethod(*s)
  880. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  881. }
  882. // SearchFoldersResponse: The response message for searching folders.
  883. type SearchFoldersResponse struct {
  884. // Folders: A possibly paginated folder search results.
  885. // the specified parent resource.
  886. Folders []*Folder `json:"folders,omitempty"`
  887. // NextPageToken: A pagination token returned from a previous call to
  888. // `SearchFolders`
  889. // that indicates from where searching should continue.
  890. // This field is optional.
  891. NextPageToken string `json:"nextPageToken,omitempty"`
  892. // ServerResponse contains the HTTP response code and headers from the
  893. // server.
  894. googleapi.ServerResponse `json:"-"`
  895. // ForceSendFields is a list of field names (e.g. "Folders") to
  896. // unconditionally include in API requests. By default, fields with
  897. // empty values are omitted from API requests. However, any non-pointer,
  898. // non-interface field appearing in ForceSendFields will be sent to the
  899. // server regardless of whether the field is empty or not. This may be
  900. // used to include empty fields in Patch requests.
  901. ForceSendFields []string `json:"-"`
  902. // NullFields is a list of field names (e.g. "Folders") to include in
  903. // API requests with the JSON null value. By default, fields with empty
  904. // values are omitted from API requests. However, any field with an
  905. // empty value appearing in NullFields will be sent to the server as
  906. // null. It is an error if a field in this list has a non-empty value.
  907. // This may be used to include null fields in Patch requests.
  908. NullFields []string `json:"-"`
  909. }
  910. func (s *SearchFoldersResponse) MarshalJSON() ([]byte, error) {
  911. type NoMethod SearchFoldersResponse
  912. raw := NoMethod(*s)
  913. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  914. }
  915. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  916. type SetIamPolicyRequest struct {
  917. // Policy: REQUIRED: The complete policy to be applied to the
  918. // `resource`. The size of
  919. // the policy is limited to a few 10s of KB. An empty policy is a
  920. // valid policy but certain Cloud Platform services (such as
  921. // Projects)
  922. // might reject them.
  923. Policy *Policy `json:"policy,omitempty"`
  924. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  925. // policy to modify. Only
  926. // the fields in the mask will be modified. If no mask is provided,
  927. // the
  928. // following default mask is used:
  929. // paths: "bindings, etag"
  930. // This field is only used by Cloud IAM.
  931. UpdateMask string `json:"updateMask,omitempty"`
  932. // ForceSendFields is a list of field names (e.g. "Policy") to
  933. // unconditionally include in API requests. By default, fields with
  934. // empty values are omitted from API requests. However, any non-pointer,
  935. // non-interface field appearing in ForceSendFields will be sent to the
  936. // server regardless of whether the field is empty or not. This may be
  937. // used to include empty fields in Patch requests.
  938. ForceSendFields []string `json:"-"`
  939. // NullFields is a list of field names (e.g. "Policy") to include in API
  940. // requests with the JSON null value. By default, fields with empty
  941. // values are omitted from API requests. However, any field with an
  942. // empty value appearing in NullFields will be sent to the server as
  943. // null. It is an error if a field in this list has a non-empty value.
  944. // This may be used to include null fields in Patch requests.
  945. NullFields []string `json:"-"`
  946. }
  947. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  948. type NoMethod SetIamPolicyRequest
  949. raw := NoMethod(*s)
  950. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  951. }
  952. // Status: The `Status` type defines a logical error model that is
  953. // suitable for different
  954. // programming environments, including REST APIs and RPC APIs. It is
  955. // used by
  956. // [gRPC](https://github.com/grpc). The error model is designed to
  957. // be:
  958. //
  959. // - Simple to use and understand for most users
  960. // - Flexible enough to meet unexpected needs
  961. //
  962. // # Overview
  963. //
  964. // The `Status` message contains three pieces of data: error code, error
  965. // message,
  966. // and error details. The error code should be an enum value
  967. // of
  968. // google.rpc.Code, but it may accept additional error codes if needed.
  969. // The
  970. // error message should be a developer-facing English message that
  971. // helps
  972. // developers *understand* and *resolve* the error. If a localized
  973. // user-facing
  974. // error message is needed, put the localized message in the error
  975. // details or
  976. // localize it in the client. The optional error details may contain
  977. // arbitrary
  978. // information about the error. There is a predefined set of error
  979. // detail types
  980. // in the package `google.rpc` that can be used for common error
  981. // conditions.
  982. //
  983. // # Language mapping
  984. //
  985. // The `Status` message is the logical representation of the error
  986. // model, but it
  987. // is not necessarily the actual wire format. When the `Status` message
  988. // is
  989. // exposed in different client libraries and different wire protocols,
  990. // it can be
  991. // mapped differently. For example, it will likely be mapped to some
  992. // exceptions
  993. // in Java, but more likely mapped to some error codes in C.
  994. //
  995. // # Other uses
  996. //
  997. // The error model and the `Status` message can be used in a variety
  998. // of
  999. // environments, either with or without APIs, to provide a
  1000. // consistent developer experience across different
  1001. // environments.
  1002. //
  1003. // Example uses of this error model include:
  1004. //
  1005. // - Partial errors. If a service needs to return partial errors to the
  1006. // client,
  1007. // it may embed the `Status` in the normal response to indicate the
  1008. // partial
  1009. // errors.
  1010. //
  1011. // - Workflow errors. A typical workflow has multiple steps. Each step
  1012. // may
  1013. // have a `Status` message for error reporting.
  1014. //
  1015. // - Batch operations. If a client uses batch request and batch
  1016. // response, the
  1017. // `Status` message should be used directly inside batch response,
  1018. // one for
  1019. // each error sub-response.
  1020. //
  1021. // - Asynchronous operations. If an API call embeds asynchronous
  1022. // operation
  1023. // results in its response, the status of those operations should
  1024. // be
  1025. // represented directly using the `Status` message.
  1026. //
  1027. // - Logging. If some API errors are stored in logs, the message
  1028. // `Status` could
  1029. // be used directly after any stripping needed for security/privacy
  1030. // reasons.
  1031. type Status struct {
  1032. // Code: The status code, which should be an enum value of
  1033. // google.rpc.Code.
  1034. Code int64 `json:"code,omitempty"`
  1035. // Details: A list of messages that carry the error details. There is a
  1036. // common set of
  1037. // message types for APIs to use.
  1038. Details []googleapi.RawMessage `json:"details,omitempty"`
  1039. // Message: A developer-facing error message, which should be in
  1040. // English. Any
  1041. // user-facing error message should be localized and sent in
  1042. // the
  1043. // google.rpc.Status.details field, or localized by the client.
  1044. Message string `json:"message,omitempty"`
  1045. // ForceSendFields is a list of field names (e.g. "Code") to
  1046. // unconditionally include in API requests. By default, fields with
  1047. // empty values are omitted from API requests. However, any non-pointer,
  1048. // non-interface field appearing in ForceSendFields will be sent to the
  1049. // server regardless of whether the field is empty or not. This may be
  1050. // used to include empty fields in Patch requests.
  1051. ForceSendFields []string `json:"-"`
  1052. // NullFields is a list of field names (e.g. "Code") to include in API
  1053. // requests with the JSON null value. By default, fields with empty
  1054. // values are omitted from API requests. However, any field with an
  1055. // empty value appearing in NullFields will be sent to the server as
  1056. // null. It is an error if a field in this list has a non-empty value.
  1057. // This may be used to include null fields in Patch requests.
  1058. NullFields []string `json:"-"`
  1059. }
  1060. func (s *Status) MarshalJSON() ([]byte, error) {
  1061. type NoMethod Status
  1062. raw := NoMethod(*s)
  1063. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1064. }
  1065. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1066. // method.
  1067. type TestIamPermissionsRequest struct {
  1068. // Permissions: The set of permissions to check for the `resource`.
  1069. // Permissions with
  1070. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1071. // more
  1072. // information see
  1073. // [IAM
  1074. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1075. Permissions []string `json:"permissions,omitempty"`
  1076. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1077. // unconditionally include in API requests. By default, fields with
  1078. // empty values are omitted from API requests. However, any non-pointer,
  1079. // non-interface field appearing in ForceSendFields will be sent to the
  1080. // server regardless of whether the field is empty or not. This may be
  1081. // used to include empty fields in Patch requests.
  1082. ForceSendFields []string `json:"-"`
  1083. // NullFields is a list of field names (e.g. "Permissions") to include
  1084. // in API requests with the JSON null value. By default, fields with
  1085. // empty values are omitted from API requests. However, any field with
  1086. // an empty value appearing in NullFields will be sent to the server as
  1087. // null. It is an error if a field in this list has a non-empty value.
  1088. // This may be used to include null fields in Patch requests.
  1089. NullFields []string `json:"-"`
  1090. }
  1091. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1092. type NoMethod TestIamPermissionsRequest
  1093. raw := NoMethod(*s)
  1094. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1095. }
  1096. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1097. // method.
  1098. type TestIamPermissionsResponse struct {
  1099. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1100. // the caller is
  1101. // allowed.
  1102. Permissions []string `json:"permissions,omitempty"`
  1103. // ServerResponse contains the HTTP response code and headers from the
  1104. // server.
  1105. googleapi.ServerResponse `json:"-"`
  1106. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1107. // unconditionally include in API requests. By default, fields with
  1108. // empty values are omitted from API requests. However, any non-pointer,
  1109. // non-interface field appearing in ForceSendFields will be sent to the
  1110. // server regardless of whether the field is empty or not. This may be
  1111. // used to include empty fields in Patch requests.
  1112. ForceSendFields []string `json:"-"`
  1113. // NullFields is a list of field names (e.g. "Permissions") to include
  1114. // in API requests with the JSON null value. By default, fields with
  1115. // empty values are omitted from API requests. However, any field with
  1116. // an empty value appearing in NullFields will be sent to the server as
  1117. // null. It is an error if a field in this list has a non-empty value.
  1118. // This may be used to include null fields in Patch requests.
  1119. NullFields []string `json:"-"`
  1120. }
  1121. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1122. type NoMethod TestIamPermissionsResponse
  1123. raw := NoMethod(*s)
  1124. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1125. }
  1126. // UndeleteFolderRequest: The UndeleteFolder request message.
  1127. type UndeleteFolderRequest struct {
  1128. }
  1129. // method id "cloudresourcemanager.folders.create":
  1130. type FoldersCreateCall struct {
  1131. s *Service
  1132. folder *Folder
  1133. urlParams_ gensupport.URLParams
  1134. ctx_ context.Context
  1135. header_ http.Header
  1136. }
  1137. // Create: Creates a Folder in the resource hierarchy.
  1138. // Returns an Operation which can be used to track the progress of
  1139. // the
  1140. // folder creation workflow.
  1141. // Upon success the Operation.response field will be populated with
  1142. // the
  1143. // created Folder.
  1144. //
  1145. // In order to succeed, the addition of this new Folder must not
  1146. // violate
  1147. // the Folder naming, height or fanout constraints.
  1148. //
  1149. // + The Folder's display_name must be distinct from all other Folder's
  1150. // that
  1151. // share its parent.
  1152. // + The addition of the Folder must not cause the active Folder
  1153. // hierarchy
  1154. // to exceed a height of 4. Note, the full active + deleted Folder
  1155. // hierarchy
  1156. // is allowed to reach a height of 8; this provides additional headroom
  1157. // when
  1158. // moving folders that contain deleted folders.
  1159. // + The addition of the Folder must not cause the total number of
  1160. // Folders
  1161. // under its parent to exceed 100.
  1162. //
  1163. // If the operation fails due to a folder constraint violation, some
  1164. // errors
  1165. // may be returned by the CreateFolder request, with status
  1166. // code
  1167. // FAILED_PRECONDITION and an error description. Other folder
  1168. // constraint
  1169. // violations will be communicated in the Operation, with the
  1170. // specific
  1171. // PreconditionFailure returned via the details list in the
  1172. // Operation.error
  1173. // field.
  1174. //
  1175. // The caller must have `resourcemanager.folders.create` permission on
  1176. // the
  1177. // identified parent.
  1178. func (r *FoldersService) Create(folder *Folder) *FoldersCreateCall {
  1179. c := &FoldersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1180. c.folder = folder
  1181. return c
  1182. }
  1183. // Parent sets the optional parameter "parent": The resource name of the
  1184. // new Folder's parent.
  1185. // Must be of the form `folders/{folder_id}` or
  1186. // `organizations/{org_id}`.
  1187. func (c *FoldersCreateCall) Parent(parent string) *FoldersCreateCall {
  1188. c.urlParams_.Set("parent", parent)
  1189. return c
  1190. }
  1191. // Fields allows partial responses to be retrieved. See
  1192. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1193. // for more information.
  1194. func (c *FoldersCreateCall) Fields(s ...googleapi.Field) *FoldersCreateCall {
  1195. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1196. return c
  1197. }
  1198. // Context sets the context to be used in this call's Do method. Any
  1199. // pending HTTP request will be aborted if the provided context is
  1200. // canceled.
  1201. func (c *FoldersCreateCall) Context(ctx context.Context) *FoldersCreateCall {
  1202. c.ctx_ = ctx
  1203. return c
  1204. }
  1205. // Header returns an http.Header that can be modified by the caller to
  1206. // add HTTP headers to the request.
  1207. func (c *FoldersCreateCall) Header() http.Header {
  1208. if c.header_ == nil {
  1209. c.header_ = make(http.Header)
  1210. }
  1211. return c.header_
  1212. }
  1213. func (c *FoldersCreateCall) doRequest(alt string) (*http.Response, error) {
  1214. reqHeaders := make(http.Header)
  1215. for k, v := range c.header_ {
  1216. reqHeaders[k] = v
  1217. }
  1218. reqHeaders.Set("User-Agent", c.s.userAgent())
  1219. var body io.Reader = nil
  1220. body, err := googleapi.WithoutDataWrapper.JSONReader(c.folder)
  1221. if err != nil {
  1222. return nil, err
  1223. }
  1224. reqHeaders.Set("Content-Type", "application/json")
  1225. c.urlParams_.Set("alt", alt)
  1226. c.urlParams_.Set("prettyPrint", "false")
  1227. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders")
  1228. urls += "?" + c.urlParams_.Encode()
  1229. req, err := http.NewRequest("POST", urls, body)
  1230. if err != nil {
  1231. return nil, err
  1232. }
  1233. req.Header = reqHeaders
  1234. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1235. }
  1236. // Do executes the "cloudresourcemanager.folders.create" call.
  1237. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1238. // status code is an error. Response headers are in either
  1239. // *Operation.ServerResponse.Header or (if a response was returned at
  1240. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1241. // to check whether the returned error was because
  1242. // http.StatusNotModified was returned.
  1243. func (c *FoldersCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1244. gensupport.SetOptions(c.urlParams_, opts...)
  1245. res, err := c.doRequest("json")
  1246. if res != nil && res.StatusCode == http.StatusNotModified {
  1247. if res.Body != nil {
  1248. res.Body.Close()
  1249. }
  1250. return nil, &googleapi.Error{
  1251. Code: res.StatusCode,
  1252. Header: res.Header,
  1253. }
  1254. }
  1255. if err != nil {
  1256. return nil, err
  1257. }
  1258. defer googleapi.CloseBody(res)
  1259. if err := googleapi.CheckResponse(res); err != nil {
  1260. return nil, err
  1261. }
  1262. ret := &Operation{
  1263. ServerResponse: googleapi.ServerResponse{
  1264. Header: res.Header,
  1265. HTTPStatusCode: res.StatusCode,
  1266. },
  1267. }
  1268. target := &ret
  1269. if err := gensupport.DecodeResponse(target, res); err != nil {
  1270. return nil, err
  1271. }
  1272. return ret, nil
  1273. // {
  1274. // "description": "Creates a Folder in the resource hierarchy.\nReturns an Operation which can be used to track the progress of the\nfolder creation workflow.\nUpon success the Operation.response field will be populated with the\ncreated Folder.\n\nIn order to succeed, the addition of this new Folder must not violate\nthe Folder naming, height or fanout constraints.\n\n+ The Folder's display_name must be distinct from all other Folder's that\nshare its parent.\n+ The addition of the Folder must not cause the active Folder hierarchy\nto exceed a height of 4. Note, the full active + deleted Folder hierarchy\nis allowed to reach a height of 8; this provides additional headroom when\nmoving folders that contain deleted folders.\n+ The addition of the Folder must not cause the total number of Folders\nunder its parent to exceed 100.\n\nIf the operation fails due to a folder constraint violation, some errors\nmay be returned by the CreateFolder request, with status code\nFAILED_PRECONDITION and an error description. Other folder constraint\nviolations will be communicated in the Operation, with the specific\nPreconditionFailure returned via the details list in the Operation.error\nfield.\n\nThe caller must have `resourcemanager.folders.create` permission on the\nidentified parent.",
  1275. // "flatPath": "v2/folders",
  1276. // "httpMethod": "POST",
  1277. // "id": "cloudresourcemanager.folders.create",
  1278. // "parameterOrder": [],
  1279. // "parameters": {
  1280. // "parent": {
  1281. // "description": "The resource name of the new Folder's parent.\nMust be of the form `folders/{folder_id}` or `organizations/{org_id}`.",
  1282. // "location": "query",
  1283. // "type": "string"
  1284. // }
  1285. // },
  1286. // "path": "v2/folders",
  1287. // "request": {
  1288. // "$ref": "Folder"
  1289. // },
  1290. // "response": {
  1291. // "$ref": "Operation"
  1292. // },
  1293. // "scopes": [
  1294. // "https://www.googleapis.com/auth/cloud-platform"
  1295. // ]
  1296. // }
  1297. }
  1298. // method id "cloudresourcemanager.folders.delete":
  1299. type FoldersDeleteCall struct {
  1300. s *Service
  1301. name string
  1302. urlParams_ gensupport.URLParams
  1303. ctx_ context.Context
  1304. header_ http.Header
  1305. }
  1306. // Delete: Requests deletion of a Folder. The Folder is moved into
  1307. // the
  1308. // DELETE_REQUESTED state
  1309. // immediately, and is deleted approximately 30 days later. This method
  1310. // may
  1311. // only be called on an empty Folder in the
  1312. // ACTIVE state, where a Folder is empty if
  1313. // it doesn't contain any Folders or Projects in the
  1314. // ACTIVE state.
  1315. // The caller must have `resourcemanager.folders.delete` permission on
  1316. // the
  1317. // identified folder.
  1318. func (r *FoldersService) Delete(name string) *FoldersDeleteCall {
  1319. c := &FoldersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1320. c.name = name
  1321. return c
  1322. }
  1323. // Fields allows partial responses to be retrieved. See
  1324. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1325. // for more information.
  1326. func (c *FoldersDeleteCall) Fields(s ...googleapi.Field) *FoldersDeleteCall {
  1327. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1328. return c
  1329. }
  1330. // Context sets the context to be used in this call's Do method. Any
  1331. // pending HTTP request will be aborted if the provided context is
  1332. // canceled.
  1333. func (c *FoldersDeleteCall) Context(ctx context.Context) *FoldersDeleteCall {
  1334. c.ctx_ = ctx
  1335. return c
  1336. }
  1337. // Header returns an http.Header that can be modified by the caller to
  1338. // add HTTP headers to the request.
  1339. func (c *FoldersDeleteCall) Header() http.Header {
  1340. if c.header_ == nil {
  1341. c.header_ = make(http.Header)
  1342. }
  1343. return c.header_
  1344. }
  1345. func (c *FoldersDeleteCall) doRequest(alt string) (*http.Response, error) {
  1346. reqHeaders := make(http.Header)
  1347. for k, v := range c.header_ {
  1348. reqHeaders[k] = v
  1349. }
  1350. reqHeaders.Set("User-Agent", c.s.userAgent())
  1351. var body io.Reader = nil
  1352. c.urlParams_.Set("alt", alt)
  1353. c.urlParams_.Set("prettyPrint", "false")
  1354. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  1355. urls += "?" + c.urlParams_.Encode()
  1356. req, err := http.NewRequest("DELETE", urls, body)
  1357. if err != nil {
  1358. return nil, err
  1359. }
  1360. req.Header = reqHeaders
  1361. googleapi.Expand(req.URL, map[string]string{
  1362. "name": c.name,
  1363. })
  1364. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1365. }
  1366. // Do executes the "cloudresourcemanager.folders.delete" call.
  1367. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  1368. // code is an error. Response headers are in either
  1369. // *Folder.ServerResponse.Header or (if a response was returned at all)
  1370. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1371. // check whether the returned error was because http.StatusNotModified
  1372. // was returned.
  1373. func (c *FoldersDeleteCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  1374. gensupport.SetOptions(c.urlParams_, opts...)
  1375. res, err := c.doRequest("json")
  1376. if res != nil && res.StatusCode == http.StatusNotModified {
  1377. if res.Body != nil {
  1378. res.Body.Close()
  1379. }
  1380. return nil, &googleapi.Error{
  1381. Code: res.StatusCode,
  1382. Header: res.Header,
  1383. }
  1384. }
  1385. if err != nil {
  1386. return nil, err
  1387. }
  1388. defer googleapi.CloseBody(res)
  1389. if err := googleapi.CheckResponse(res); err != nil {
  1390. return nil, err
  1391. }
  1392. ret := &Folder{
  1393. ServerResponse: googleapi.ServerResponse{
  1394. Header: res.Header,
  1395. HTTPStatusCode: res.StatusCode,
  1396. },
  1397. }
  1398. target := &ret
  1399. if err := gensupport.DecodeResponse(target, res); err != nil {
  1400. return nil, err
  1401. }
  1402. return ret, nil
  1403. // {
  1404. // "description": "Requests deletion of a Folder. The Folder is moved into the\nDELETE_REQUESTED state\nimmediately, and is deleted approximately 30 days later. This method may\nonly be called on an empty Folder in the\nACTIVE state, where a Folder is empty if\nit doesn't contain any Folders or Projects in the\nACTIVE state.\nThe caller must have `resourcemanager.folders.delete` permission on the\nidentified folder.",
  1405. // "flatPath": "v2/folders/{foldersId}",
  1406. // "httpMethod": "DELETE",
  1407. // "id": "cloudresourcemanager.folders.delete",
  1408. // "parameterOrder": [
  1409. // "name"
  1410. // ],
  1411. // "parameters": {
  1412. // "name": {
  1413. // "description": "the resource name of the Folder to be deleted.\nMust be of the form `folders/{folder_id}`.",
  1414. // "location": "path",
  1415. // "pattern": "^folders/[^/]+$",
  1416. // "required": true,
  1417. // "type": "string"
  1418. // }
  1419. // },
  1420. // "path": "v2/{+name}",
  1421. // "response": {
  1422. // "$ref": "Folder"
  1423. // },
  1424. // "scopes": [
  1425. // "https://www.googleapis.com/auth/cloud-platform"
  1426. // ]
  1427. // }
  1428. }
  1429. // method id "cloudresourcemanager.folders.get":
  1430. type FoldersGetCall struct {
  1431. s *Service
  1432. name string
  1433. urlParams_ gensupport.URLParams
  1434. ifNoneMatch_ string
  1435. ctx_ context.Context
  1436. header_ http.Header
  1437. }
  1438. // Get: Retrieves a Folder identified by the supplied resource
  1439. // name.
  1440. // Valid Folder resource names have the format
  1441. // `folders/{folder_id}`
  1442. // (for example, `folders/1234`).
  1443. // The caller must have `resourcemanager.folders.get` permission on
  1444. // the
  1445. // identified folder.
  1446. func (r *FoldersService) Get(name string) *FoldersGetCall {
  1447. c := &FoldersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1448. c.name = name
  1449. return c
  1450. }
  1451. // Fields allows partial responses to be retrieved. See
  1452. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1453. // for more information.
  1454. func (c *FoldersGetCall) Fields(s ...googleapi.Field) *FoldersGetCall {
  1455. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1456. return c
  1457. }
  1458. // IfNoneMatch sets the optional parameter which makes the operation
  1459. // fail if the object's ETag matches the given value. This is useful for
  1460. // getting updates only after the object has changed since the last
  1461. // request. Use googleapi.IsNotModified to check whether the response
  1462. // error from Do is the result of In-None-Match.
  1463. func (c *FoldersGetCall) IfNoneMatch(entityTag string) *FoldersGetCall {
  1464. c.ifNoneMatch_ = entityTag
  1465. return c
  1466. }
  1467. // Context sets the context to be used in this call's Do method. Any
  1468. // pending HTTP request will be aborted if the provided context is
  1469. // canceled.
  1470. func (c *FoldersGetCall) Context(ctx context.Context) *FoldersGetCall {
  1471. c.ctx_ = ctx
  1472. return c
  1473. }
  1474. // Header returns an http.Header that can be modified by the caller to
  1475. // add HTTP headers to the request.
  1476. func (c *FoldersGetCall) Header() http.Header {
  1477. if c.header_ == nil {
  1478. c.header_ = make(http.Header)
  1479. }
  1480. return c.header_
  1481. }
  1482. func (c *FoldersGetCall) doRequest(alt string) (*http.Response, error) {
  1483. reqHeaders := make(http.Header)
  1484. for k, v := range c.header_ {
  1485. reqHeaders[k] = v
  1486. }
  1487. reqHeaders.Set("User-Agent", c.s.userAgent())
  1488. if c.ifNoneMatch_ != "" {
  1489. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1490. }
  1491. var body io.Reader = nil
  1492. c.urlParams_.Set("alt", alt)
  1493. c.urlParams_.Set("prettyPrint", "false")
  1494. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  1495. urls += "?" + c.urlParams_.Encode()
  1496. req, err := http.NewRequest("GET", urls, body)
  1497. if err != nil {
  1498. return nil, err
  1499. }
  1500. req.Header = reqHeaders
  1501. googleapi.Expand(req.URL, map[string]string{
  1502. "name": c.name,
  1503. })
  1504. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1505. }
  1506. // Do executes the "cloudresourcemanager.folders.get" call.
  1507. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  1508. // code is an error. Response headers are in either
  1509. // *Folder.ServerResponse.Header or (if a response was returned at all)
  1510. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1511. // check whether the returned error was because http.StatusNotModified
  1512. // was returned.
  1513. func (c *FoldersGetCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  1514. gensupport.SetOptions(c.urlParams_, opts...)
  1515. res, err := c.doRequest("json")
  1516. if res != nil && res.StatusCode == http.StatusNotModified {
  1517. if res.Body != nil {
  1518. res.Body.Close()
  1519. }
  1520. return nil, &googleapi.Error{
  1521. Code: res.StatusCode,
  1522. Header: res.Header,
  1523. }
  1524. }
  1525. if err != nil {
  1526. return nil, err
  1527. }
  1528. defer googleapi.CloseBody(res)
  1529. if err := googleapi.CheckResponse(res); err != nil {
  1530. return nil, err
  1531. }
  1532. ret := &Folder{
  1533. ServerResponse: googleapi.ServerResponse{
  1534. Header: res.Header,
  1535. HTTPStatusCode: res.StatusCode,
  1536. },
  1537. }
  1538. target := &ret
  1539. if err := gensupport.DecodeResponse(target, res); err != nil {
  1540. return nil, err
  1541. }
  1542. return ret, nil
  1543. // {
  1544. // "description": "Retrieves a Folder identified by the supplied resource name.\nValid Folder resource names have the format `folders/{folder_id}`\n(for example, `folders/1234`).\nThe caller must have `resourcemanager.folders.get` permission on the\nidentified folder.",
  1545. // "flatPath": "v2/folders/{foldersId}",
  1546. // "httpMethod": "GET",
  1547. // "id": "cloudresourcemanager.folders.get",
  1548. // "parameterOrder": [
  1549. // "name"
  1550. // ],
  1551. // "parameters": {
  1552. // "name": {
  1553. // "description": "The resource name of the Folder to retrieve.\nMust be of the form `folders/{folder_id}`.",
  1554. // "location": "path",
  1555. // "pattern": "^folders/[^/]+$",
  1556. // "required": true,
  1557. // "type": "string"
  1558. // }
  1559. // },
  1560. // "path": "v2/{+name}",
  1561. // "response": {
  1562. // "$ref": "Folder"
  1563. // },
  1564. // "scopes": [
  1565. // "https://www.googleapis.com/auth/cloud-platform",
  1566. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1567. // ]
  1568. // }
  1569. }
  1570. // method id "cloudresourcemanager.folders.getIamPolicy":
  1571. type FoldersGetIamPolicyCall struct {
  1572. s *Service
  1573. resource string
  1574. getiampolicyrequest *GetIamPolicyRequest
  1575. urlParams_ gensupport.URLParams
  1576. ctx_ context.Context
  1577. header_ http.Header
  1578. }
  1579. // GetIamPolicy: Gets the access control policy for a Folder. The
  1580. // returned policy may be
  1581. // empty if no such policy or resource exists. The `resource` field
  1582. // should
  1583. // be the Folder's resource name, e.g. "folders/1234".
  1584. // The caller must have `resourcemanager.folders.getIamPolicy`
  1585. // permission
  1586. // on the identified folder.
  1587. func (r *FoldersService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *FoldersGetIamPolicyCall {
  1588. c := &FoldersGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1589. c.resource = resource
  1590. c.getiampolicyrequest = getiampolicyrequest
  1591. return c
  1592. }
  1593. // Fields allows partial responses to be retrieved. See
  1594. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1595. // for more information.
  1596. func (c *FoldersGetIamPolicyCall) Fields(s ...googleapi.Field) *FoldersGetIamPolicyCall {
  1597. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1598. return c
  1599. }
  1600. // Context sets the context to be used in this call's Do method. Any
  1601. // pending HTTP request will be aborted if the provided context is
  1602. // canceled.
  1603. func (c *FoldersGetIamPolicyCall) Context(ctx context.Context) *FoldersGetIamPolicyCall {
  1604. c.ctx_ = ctx
  1605. return c
  1606. }
  1607. // Header returns an http.Header that can be modified by the caller to
  1608. // add HTTP headers to the request.
  1609. func (c *FoldersGetIamPolicyCall) Header() http.Header {
  1610. if c.header_ == nil {
  1611. c.header_ = make(http.Header)
  1612. }
  1613. return c.header_
  1614. }
  1615. func (c *FoldersGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1616. reqHeaders := make(http.Header)
  1617. for k, v := range c.header_ {
  1618. reqHeaders[k] = v
  1619. }
  1620. reqHeaders.Set("User-Agent", c.s.userAgent())
  1621. var body io.Reader = nil
  1622. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  1623. if err != nil {
  1624. return nil, err
  1625. }
  1626. reqHeaders.Set("Content-Type", "application/json")
  1627. c.urlParams_.Set("alt", alt)
  1628. c.urlParams_.Set("prettyPrint", "false")
  1629. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:getIamPolicy")
  1630. urls += "?" + c.urlParams_.Encode()
  1631. req, err := http.NewRequest("POST", urls, body)
  1632. if err != nil {
  1633. return nil, err
  1634. }
  1635. req.Header = reqHeaders
  1636. googleapi.Expand(req.URL, map[string]string{
  1637. "resource": c.resource,
  1638. })
  1639. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1640. }
  1641. // Do executes the "cloudresourcemanager.folders.getIamPolicy" call.
  1642. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1643. // code is an error. Response headers are in either
  1644. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1645. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1646. // check whether the returned error was because http.StatusNotModified
  1647. // was returned.
  1648. func (c *FoldersGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1649. gensupport.SetOptions(c.urlParams_, opts...)
  1650. res, err := c.doRequest("json")
  1651. if res != nil && res.StatusCode == http.StatusNotModified {
  1652. if res.Body != nil {
  1653. res.Body.Close()
  1654. }
  1655. return nil, &googleapi.Error{
  1656. Code: res.StatusCode,
  1657. Header: res.Header,
  1658. }
  1659. }
  1660. if err != nil {
  1661. return nil, err
  1662. }
  1663. defer googleapi.CloseBody(res)
  1664. if err := googleapi.CheckResponse(res); err != nil {
  1665. return nil, err
  1666. }
  1667. ret := &Policy{
  1668. ServerResponse: googleapi.ServerResponse{
  1669. Header: res.Header,
  1670. HTTPStatusCode: res.StatusCode,
  1671. },
  1672. }
  1673. target := &ret
  1674. if err := gensupport.DecodeResponse(target, res); err != nil {
  1675. return nil, err
  1676. }
  1677. return ret, nil
  1678. // {
  1679. // "description": "Gets the access control policy for a Folder. The returned policy may be\nempty if no such policy or resource exists. The `resource` field should\nbe the Folder's resource name, e.g. \"folders/1234\".\nThe caller must have `resourcemanager.folders.getIamPolicy` permission\non the identified folder.",
  1680. // "flatPath": "v2/folders/{foldersId}:getIamPolicy",
  1681. // "httpMethod": "POST",
  1682. // "id": "cloudresourcemanager.folders.getIamPolicy",
  1683. // "parameterOrder": [
  1684. // "resource"
  1685. // ],
  1686. // "parameters": {
  1687. // "resource": {
  1688. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1689. // "location": "path",
  1690. // "pattern": "^folders/[^/]+$",
  1691. // "required": true,
  1692. // "type": "string"
  1693. // }
  1694. // },
  1695. // "path": "v2/{+resource}:getIamPolicy",
  1696. // "request": {
  1697. // "$ref": "GetIamPolicyRequest"
  1698. // },
  1699. // "response": {
  1700. // "$ref": "Policy"
  1701. // },
  1702. // "scopes": [
  1703. // "https://www.googleapis.com/auth/cloud-platform",
  1704. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1705. // ]
  1706. // }
  1707. }
  1708. // method id "cloudresourcemanager.folders.list":
  1709. type FoldersListCall struct {
  1710. s *Service
  1711. urlParams_ gensupport.URLParams
  1712. ifNoneMatch_ string
  1713. ctx_ context.Context
  1714. header_ http.Header
  1715. }
  1716. // List: Lists the Folders that are direct descendants of supplied
  1717. // parent resource.
  1718. // List provides a strongly consistent view of the Folders
  1719. // underneath
  1720. // the specified parent resource.
  1721. // List returns Folders sorted based upon the (ascending) lexical
  1722. // ordering
  1723. // of their display_name.
  1724. // The caller must have `resourcemanager.folders.list` permission on
  1725. // the
  1726. // identified parent.
  1727. func (r *FoldersService) List() *FoldersListCall {
  1728. c := &FoldersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1729. return c
  1730. }
  1731. // PageSize sets the optional parameter "pageSize": The maximum number
  1732. // of Folders to return in the response.
  1733. // This field is optional.
  1734. func (c *FoldersListCall) PageSize(pageSize int64) *FoldersListCall {
  1735. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1736. return c
  1737. }
  1738. // PageToken sets the optional parameter "pageToken": A pagination token
  1739. // returned from a previous call to `ListFolders`
  1740. // that indicates where this listing should continue from.
  1741. // This field is optional.
  1742. func (c *FoldersListCall) PageToken(pageToken string) *FoldersListCall {
  1743. c.urlParams_.Set("pageToken", pageToken)
  1744. return c
  1745. }
  1746. // Parent sets the optional parameter "parent": The resource name of the
  1747. // Organization or Folder whose Folders are
  1748. // being listed.
  1749. // Must be of the form `folders/{folder_id}` or
  1750. // `organizations/{org_id}`.
  1751. // Access to this method is controlled by checking
  1752. // the
  1753. // `resourcemanager.folders.list` permission on the `parent`.
  1754. func (c *FoldersListCall) Parent(parent string) *FoldersListCall {
  1755. c.urlParams_.Set("parent", parent)
  1756. return c
  1757. }
  1758. // ShowDeleted sets the optional parameter "showDeleted": Controls
  1759. // whether Folders in the
  1760. // DELETE_REQUESTED
  1761. // state should be returned. Defaults to false. This field is optional.
  1762. func (c *FoldersListCall) ShowDeleted(showDeleted bool) *FoldersListCall {
  1763. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  1764. return c
  1765. }
  1766. // Fields allows partial responses to be retrieved. See
  1767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1768. // for more information.
  1769. func (c *FoldersListCall) Fields(s ...googleapi.Field) *FoldersListCall {
  1770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1771. return c
  1772. }
  1773. // IfNoneMatch sets the optional parameter which makes the operation
  1774. // fail if the object's ETag matches the given value. This is useful for
  1775. // getting updates only after the object has changed since the last
  1776. // request. Use googleapi.IsNotModified to check whether the response
  1777. // error from Do is the result of In-None-Match.
  1778. func (c *FoldersListCall) IfNoneMatch(entityTag string) *FoldersListCall {
  1779. c.ifNoneMatch_ = entityTag
  1780. return c
  1781. }
  1782. // Context sets the context to be used in this call's Do method. Any
  1783. // pending HTTP request will be aborted if the provided context is
  1784. // canceled.
  1785. func (c *FoldersListCall) Context(ctx context.Context) *FoldersListCall {
  1786. c.ctx_ = ctx
  1787. return c
  1788. }
  1789. // Header returns an http.Header that can be modified by the caller to
  1790. // add HTTP headers to the request.
  1791. func (c *FoldersListCall) Header() http.Header {
  1792. if c.header_ == nil {
  1793. c.header_ = make(http.Header)
  1794. }
  1795. return c.header_
  1796. }
  1797. func (c *FoldersListCall) doRequest(alt string) (*http.Response, error) {
  1798. reqHeaders := make(http.Header)
  1799. for k, v := range c.header_ {
  1800. reqHeaders[k] = v
  1801. }
  1802. reqHeaders.Set("User-Agent", c.s.userAgent())
  1803. if c.ifNoneMatch_ != "" {
  1804. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1805. }
  1806. var body io.Reader = nil
  1807. c.urlParams_.Set("alt", alt)
  1808. c.urlParams_.Set("prettyPrint", "false")
  1809. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders")
  1810. urls += "?" + c.urlParams_.Encode()
  1811. req, err := http.NewRequest("GET", urls, body)
  1812. if err != nil {
  1813. return nil, err
  1814. }
  1815. req.Header = reqHeaders
  1816. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1817. }
  1818. // Do executes the "cloudresourcemanager.folders.list" call.
  1819. // Exactly one of *ListFoldersResponse or error will be non-nil. Any
  1820. // non-2xx status code is an error. Response headers are in either
  1821. // *ListFoldersResponse.ServerResponse.Header or (if a response was
  1822. // returned at all) in error.(*googleapi.Error).Header. Use
  1823. // googleapi.IsNotModified to check whether the returned error was
  1824. // because http.StatusNotModified was returned.
  1825. func (c *FoldersListCall) Do(opts ...googleapi.CallOption) (*ListFoldersResponse, error) {
  1826. gensupport.SetOptions(c.urlParams_, opts...)
  1827. res, err := c.doRequest("json")
  1828. if res != nil && res.StatusCode == http.StatusNotModified {
  1829. if res.Body != nil {
  1830. res.Body.Close()
  1831. }
  1832. return nil, &googleapi.Error{
  1833. Code: res.StatusCode,
  1834. Header: res.Header,
  1835. }
  1836. }
  1837. if err != nil {
  1838. return nil, err
  1839. }
  1840. defer googleapi.CloseBody(res)
  1841. if err := googleapi.CheckResponse(res); err != nil {
  1842. return nil, err
  1843. }
  1844. ret := &ListFoldersResponse{
  1845. ServerResponse: googleapi.ServerResponse{
  1846. Header: res.Header,
  1847. HTTPStatusCode: res.StatusCode,
  1848. },
  1849. }
  1850. target := &ret
  1851. if err := gensupport.DecodeResponse(target, res); err != nil {
  1852. return nil, err
  1853. }
  1854. return ret, nil
  1855. // {
  1856. // "description": "Lists the Folders that are direct descendants of supplied parent resource.\nList provides a strongly consistent view of the Folders underneath\nthe specified parent resource.\nList returns Folders sorted based upon the (ascending) lexical ordering\nof their display_name.\nThe caller must have `resourcemanager.folders.list` permission on the\nidentified parent.",
  1857. // "flatPath": "v2/folders",
  1858. // "httpMethod": "GET",
  1859. // "id": "cloudresourcemanager.folders.list",
  1860. // "parameterOrder": [],
  1861. // "parameters": {
  1862. // "pageSize": {
  1863. // "description": "The maximum number of Folders to return in the response.\nThis field is optional.",
  1864. // "format": "int32",
  1865. // "location": "query",
  1866. // "type": "integer"
  1867. // },
  1868. // "pageToken": {
  1869. // "description": "A pagination token returned from a previous call to `ListFolders`\nthat indicates where this listing should continue from.\nThis field is optional.",
  1870. // "location": "query",
  1871. // "type": "string"
  1872. // },
  1873. // "parent": {
  1874. // "description": "The resource name of the Organization or Folder whose Folders are\nbeing listed.\nMust be of the form `folders/{folder_id}` or `organizations/{org_id}`.\nAccess to this method is controlled by checking the\n`resourcemanager.folders.list` permission on the `parent`.",
  1875. // "location": "query",
  1876. // "type": "string"
  1877. // },
  1878. // "showDeleted": {
  1879. // "description": "Controls whether Folders in the\nDELETE_REQUESTED\nstate should be returned. Defaults to false. This field is optional.",
  1880. // "location": "query",
  1881. // "type": "boolean"
  1882. // }
  1883. // },
  1884. // "path": "v2/folders",
  1885. // "response": {
  1886. // "$ref": "ListFoldersResponse"
  1887. // },
  1888. // "scopes": [
  1889. // "https://www.googleapis.com/auth/cloud-platform",
  1890. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1891. // ]
  1892. // }
  1893. }
  1894. // Pages invokes f for each page of results.
  1895. // A non-nil error returned from f will halt the iteration.
  1896. // The provided context supersedes any context provided to the Context method.
  1897. func (c *FoldersListCall) Pages(ctx context.Context, f func(*ListFoldersResponse) error) error {
  1898. c.ctx_ = ctx
  1899. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1900. for {
  1901. x, err := c.Do()
  1902. if err != nil {
  1903. return err
  1904. }
  1905. if err := f(x); err != nil {
  1906. return err
  1907. }
  1908. if x.NextPageToken == "" {
  1909. return nil
  1910. }
  1911. c.PageToken(x.NextPageToken)
  1912. }
  1913. }
  1914. // method id "cloudresourcemanager.folders.move":
  1915. type FoldersMoveCall struct {
  1916. s *Service
  1917. name string
  1918. movefolderrequest *MoveFolderRequest
  1919. urlParams_ gensupport.URLParams
  1920. ctx_ context.Context
  1921. header_ http.Header
  1922. }
  1923. // Move: Moves a Folder under a new resource parent.
  1924. // Returns an Operation which can be used to track the progress of
  1925. // the
  1926. // folder move workflow.
  1927. // Upon success the Operation.response field will be populated with
  1928. // the
  1929. // moved Folder.
  1930. // Upon failure, a FolderOperationError categorizing the failure cause
  1931. // will
  1932. // be returned - if the failure occurs synchronously then
  1933. // the
  1934. // FolderOperationError will be returned via the Status.details
  1935. // field
  1936. // and if it occurs asynchronously then the FolderOperation will be
  1937. // returned
  1938. // via the Operation.error field.
  1939. // In addition, the Operation.metadata field will be populated with
  1940. // a
  1941. // FolderOperation message as an aid to stateless clients.
  1942. // Folder moves will be rejected if they violate either the naming,
  1943. // height
  1944. // or fanout constraints described in the
  1945. // CreateFolder documentation.
  1946. // The caller must have `resourcemanager.folders.move` permission on
  1947. // the
  1948. // folder's current and proposed new parent.
  1949. func (r *FoldersService) Move(name string, movefolderrequest *MoveFolderRequest) *FoldersMoveCall {
  1950. c := &FoldersMoveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1951. c.name = name
  1952. c.movefolderrequest = movefolderrequest
  1953. return c
  1954. }
  1955. // Fields allows partial responses to be retrieved. See
  1956. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1957. // for more information.
  1958. func (c *FoldersMoveCall) Fields(s ...googleapi.Field) *FoldersMoveCall {
  1959. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1960. return c
  1961. }
  1962. // Context sets the context to be used in this call's Do method. Any
  1963. // pending HTTP request will be aborted if the provided context is
  1964. // canceled.
  1965. func (c *FoldersMoveCall) Context(ctx context.Context) *FoldersMoveCall {
  1966. c.ctx_ = ctx
  1967. return c
  1968. }
  1969. // Header returns an http.Header that can be modified by the caller to
  1970. // add HTTP headers to the request.
  1971. func (c *FoldersMoveCall) Header() http.Header {
  1972. if c.header_ == nil {
  1973. c.header_ = make(http.Header)
  1974. }
  1975. return c.header_
  1976. }
  1977. func (c *FoldersMoveCall) doRequest(alt string) (*http.Response, error) {
  1978. reqHeaders := make(http.Header)
  1979. for k, v := range c.header_ {
  1980. reqHeaders[k] = v
  1981. }
  1982. reqHeaders.Set("User-Agent", c.s.userAgent())
  1983. var body io.Reader = nil
  1984. body, err := googleapi.WithoutDataWrapper.JSONReader(c.movefolderrequest)
  1985. if err != nil {
  1986. return nil, err
  1987. }
  1988. reqHeaders.Set("Content-Type", "application/json")
  1989. c.urlParams_.Set("alt", alt)
  1990. c.urlParams_.Set("prettyPrint", "false")
  1991. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:move")
  1992. urls += "?" + c.urlParams_.Encode()
  1993. req, err := http.NewRequest("POST", urls, body)
  1994. if err != nil {
  1995. return nil, err
  1996. }
  1997. req.Header = reqHeaders
  1998. googleapi.Expand(req.URL, map[string]string{
  1999. "name": c.name,
  2000. })
  2001. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2002. }
  2003. // Do executes the "cloudresourcemanager.folders.move" call.
  2004. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2005. // status code is an error. Response headers are in either
  2006. // *Operation.ServerResponse.Header or (if a response was returned at
  2007. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2008. // to check whether the returned error was because
  2009. // http.StatusNotModified was returned.
  2010. func (c *FoldersMoveCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2011. gensupport.SetOptions(c.urlParams_, opts...)
  2012. res, err := c.doRequest("json")
  2013. if res != nil && res.StatusCode == http.StatusNotModified {
  2014. if res.Body != nil {
  2015. res.Body.Close()
  2016. }
  2017. return nil, &googleapi.Error{
  2018. Code: res.StatusCode,
  2019. Header: res.Header,
  2020. }
  2021. }
  2022. if err != nil {
  2023. return nil, err
  2024. }
  2025. defer googleapi.CloseBody(res)
  2026. if err := googleapi.CheckResponse(res); err != nil {
  2027. return nil, err
  2028. }
  2029. ret := &Operation{
  2030. ServerResponse: googleapi.ServerResponse{
  2031. Header: res.Header,
  2032. HTTPStatusCode: res.StatusCode,
  2033. },
  2034. }
  2035. target := &ret
  2036. if err := gensupport.DecodeResponse(target, res); err != nil {
  2037. return nil, err
  2038. }
  2039. return ret, nil
  2040. // {
  2041. // "description": "Moves a Folder under a new resource parent.\nReturns an Operation which can be used to track the progress of the\nfolder move workflow.\nUpon success the Operation.response field will be populated with the\nmoved Folder.\nUpon failure, a FolderOperationError categorizing the failure cause will\nbe returned - if the failure occurs synchronously then the\nFolderOperationError will be returned via the Status.details field\nand if it occurs asynchronously then the FolderOperation will be returned\nvia the Operation.error field.\nIn addition, the Operation.metadata field will be populated with a\nFolderOperation message as an aid to stateless clients.\nFolder moves will be rejected if they violate either the naming, height\nor fanout constraints described in the\nCreateFolder documentation.\nThe caller must have `resourcemanager.folders.move` permission on the\nfolder's current and proposed new parent.",
  2042. // "flatPath": "v2/folders/{foldersId}:move",
  2043. // "httpMethod": "POST",
  2044. // "id": "cloudresourcemanager.folders.move",
  2045. // "parameterOrder": [
  2046. // "name"
  2047. // ],
  2048. // "parameters": {
  2049. // "name": {
  2050. // "description": "The resource name of the Folder to move.\nMust be of the form folders/{folder_id}",
  2051. // "location": "path",
  2052. // "pattern": "^folders/[^/]+$",
  2053. // "required": true,
  2054. // "type": "string"
  2055. // }
  2056. // },
  2057. // "path": "v2/{+name}:move",
  2058. // "request": {
  2059. // "$ref": "MoveFolderRequest"
  2060. // },
  2061. // "response": {
  2062. // "$ref": "Operation"
  2063. // },
  2064. // "scopes": [
  2065. // "https://www.googleapis.com/auth/cloud-platform"
  2066. // ]
  2067. // }
  2068. }
  2069. // method id "cloudresourcemanager.folders.patch":
  2070. type FoldersPatchCall struct {
  2071. s *Service
  2072. name string
  2073. folder *Folder
  2074. urlParams_ gensupport.URLParams
  2075. ctx_ context.Context
  2076. header_ http.Header
  2077. }
  2078. // Patch: Updates a Folder, changing its display_name.
  2079. // Changes to the folder display_name will be rejected if they violate
  2080. // either
  2081. // the display_name formatting rules or naming constraints described
  2082. // in
  2083. // the CreateFolder documentation.
  2084. //
  2085. // The Folder's display name must start and end with a letter or
  2086. // digit,
  2087. // may contain letters, digits, spaces, hyphens and underscores and can
  2088. // be
  2089. // no longer than 30 characters. This is captured by the regular
  2090. // expression:
  2091. // [\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?.
  2092. // The caller must have `resourcemanager.folders.update` permission on
  2093. // the
  2094. // identified folder.
  2095. //
  2096. // If the update fails due to the unique name constraint then
  2097. // a
  2098. // PreconditionFailure explaining this violation will be returned
  2099. // in the Status.details field.
  2100. func (r *FoldersService) Patch(name string, folder *Folder) *FoldersPatchCall {
  2101. c := &FoldersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2102. c.name = name
  2103. c.folder = folder
  2104. return c
  2105. }
  2106. // UpdateMask sets the optional parameter "updateMask": Fields to be
  2107. // updated.
  2108. // Only the `display_name` can be updated.
  2109. func (c *FoldersPatchCall) UpdateMask(updateMask string) *FoldersPatchCall {
  2110. c.urlParams_.Set("updateMask", updateMask)
  2111. return c
  2112. }
  2113. // Fields allows partial responses to be retrieved. See
  2114. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2115. // for more information.
  2116. func (c *FoldersPatchCall) Fields(s ...googleapi.Field) *FoldersPatchCall {
  2117. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2118. return c
  2119. }
  2120. // Context sets the context to be used in this call's Do method. Any
  2121. // pending HTTP request will be aborted if the provided context is
  2122. // canceled.
  2123. func (c *FoldersPatchCall) Context(ctx context.Context) *FoldersPatchCall {
  2124. c.ctx_ = ctx
  2125. return c
  2126. }
  2127. // Header returns an http.Header that can be modified by the caller to
  2128. // add HTTP headers to the request.
  2129. func (c *FoldersPatchCall) Header() http.Header {
  2130. if c.header_ == nil {
  2131. c.header_ = make(http.Header)
  2132. }
  2133. return c.header_
  2134. }
  2135. func (c *FoldersPatchCall) doRequest(alt string) (*http.Response, error) {
  2136. reqHeaders := make(http.Header)
  2137. for k, v := range c.header_ {
  2138. reqHeaders[k] = v
  2139. }
  2140. reqHeaders.Set("User-Agent", c.s.userAgent())
  2141. var body io.Reader = nil
  2142. body, err := googleapi.WithoutDataWrapper.JSONReader(c.folder)
  2143. if err != nil {
  2144. return nil, err
  2145. }
  2146. reqHeaders.Set("Content-Type", "application/json")
  2147. c.urlParams_.Set("alt", alt)
  2148. c.urlParams_.Set("prettyPrint", "false")
  2149. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2150. urls += "?" + c.urlParams_.Encode()
  2151. req, err := http.NewRequest("PATCH", urls, body)
  2152. if err != nil {
  2153. return nil, err
  2154. }
  2155. req.Header = reqHeaders
  2156. googleapi.Expand(req.URL, map[string]string{
  2157. "name": c.name,
  2158. })
  2159. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2160. }
  2161. // Do executes the "cloudresourcemanager.folders.patch" call.
  2162. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  2163. // code is an error. Response headers are in either
  2164. // *Folder.ServerResponse.Header or (if a response was returned at all)
  2165. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2166. // check whether the returned error was because http.StatusNotModified
  2167. // was returned.
  2168. func (c *FoldersPatchCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  2169. gensupport.SetOptions(c.urlParams_, opts...)
  2170. res, err := c.doRequest("json")
  2171. if res != nil && res.StatusCode == http.StatusNotModified {
  2172. if res.Body != nil {
  2173. res.Body.Close()
  2174. }
  2175. return nil, &googleapi.Error{
  2176. Code: res.StatusCode,
  2177. Header: res.Header,
  2178. }
  2179. }
  2180. if err != nil {
  2181. return nil, err
  2182. }
  2183. defer googleapi.CloseBody(res)
  2184. if err := googleapi.CheckResponse(res); err != nil {
  2185. return nil, err
  2186. }
  2187. ret := &Folder{
  2188. ServerResponse: googleapi.ServerResponse{
  2189. Header: res.Header,
  2190. HTTPStatusCode: res.StatusCode,
  2191. },
  2192. }
  2193. target := &ret
  2194. if err := gensupport.DecodeResponse(target, res); err != nil {
  2195. return nil, err
  2196. }
  2197. return ret, nil
  2198. // {
  2199. // "description": "Updates a Folder, changing its display_name.\nChanges to the folder display_name will be rejected if they violate either\nthe display_name formatting rules or naming constraints described in\nthe CreateFolder documentation.\n\nThe Folder's display name must start and end with a letter or digit,\nmay contain letters, digits, spaces, hyphens and underscores and can be\nno longer than 30 characters. This is captured by the regular expression:\n[\\p{L}\\p{N}]([\\p{L}\\p{N}_- ]{0,28}[\\p{L}\\p{N}])?.\nThe caller must have `resourcemanager.folders.update` permission on the\nidentified folder.\n\nIf the update fails due to the unique name constraint then a\nPreconditionFailure explaining this violation will be returned\nin the Status.details field.",
  2200. // "flatPath": "v2/folders/{foldersId}",
  2201. // "httpMethod": "PATCH",
  2202. // "id": "cloudresourcemanager.folders.patch",
  2203. // "parameterOrder": [
  2204. // "name"
  2205. // ],
  2206. // "parameters": {
  2207. // "name": {
  2208. // "description": "Output only. The resource name of the Folder.\nIts format is `folders/{folder_id}`, for example: \"folders/1234\".",
  2209. // "location": "path",
  2210. // "pattern": "^folders/[^/]+$",
  2211. // "required": true,
  2212. // "type": "string"
  2213. // },
  2214. // "updateMask": {
  2215. // "description": "Fields to be updated.\nOnly the `display_name` can be updated.",
  2216. // "format": "google-fieldmask",
  2217. // "location": "query",
  2218. // "type": "string"
  2219. // }
  2220. // },
  2221. // "path": "v2/{+name}",
  2222. // "request": {
  2223. // "$ref": "Folder"
  2224. // },
  2225. // "response": {
  2226. // "$ref": "Folder"
  2227. // },
  2228. // "scopes": [
  2229. // "https://www.googleapis.com/auth/cloud-platform"
  2230. // ]
  2231. // }
  2232. }
  2233. // method id "cloudresourcemanager.folders.search":
  2234. type FoldersSearchCall struct {
  2235. s *Service
  2236. searchfoldersrequest *SearchFoldersRequest
  2237. urlParams_ gensupport.URLParams
  2238. ctx_ context.Context
  2239. header_ http.Header
  2240. }
  2241. // Search: Search for folders that match specific filter
  2242. // criteria.
  2243. // Search provides an eventually consistent view of the folders a user
  2244. // has
  2245. // access to which meet the specified filter criteria.
  2246. //
  2247. // This will only return folders on which the caller has the
  2248. // permission `resourcemanager.folders.get`.
  2249. func (r *FoldersService) Search(searchfoldersrequest *SearchFoldersRequest) *FoldersSearchCall {
  2250. c := &FoldersSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2251. c.searchfoldersrequest = searchfoldersrequest
  2252. return c
  2253. }
  2254. // Fields allows partial responses to be retrieved. See
  2255. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2256. // for more information.
  2257. func (c *FoldersSearchCall) Fields(s ...googleapi.Field) *FoldersSearchCall {
  2258. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2259. return c
  2260. }
  2261. // Context sets the context to be used in this call's Do method. Any
  2262. // pending HTTP request will be aborted if the provided context is
  2263. // canceled.
  2264. func (c *FoldersSearchCall) Context(ctx context.Context) *FoldersSearchCall {
  2265. c.ctx_ = ctx
  2266. return c
  2267. }
  2268. // Header returns an http.Header that can be modified by the caller to
  2269. // add HTTP headers to the request.
  2270. func (c *FoldersSearchCall) Header() http.Header {
  2271. if c.header_ == nil {
  2272. c.header_ = make(http.Header)
  2273. }
  2274. return c.header_
  2275. }
  2276. func (c *FoldersSearchCall) doRequest(alt string) (*http.Response, error) {
  2277. reqHeaders := make(http.Header)
  2278. for k, v := range c.header_ {
  2279. reqHeaders[k] = v
  2280. }
  2281. reqHeaders.Set("User-Agent", c.s.userAgent())
  2282. var body io.Reader = nil
  2283. body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchfoldersrequest)
  2284. if err != nil {
  2285. return nil, err
  2286. }
  2287. reqHeaders.Set("Content-Type", "application/json")
  2288. c.urlParams_.Set("alt", alt)
  2289. c.urlParams_.Set("prettyPrint", "false")
  2290. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders:search")
  2291. urls += "?" + c.urlParams_.Encode()
  2292. req, err := http.NewRequest("POST", urls, body)
  2293. if err != nil {
  2294. return nil, err
  2295. }
  2296. req.Header = reqHeaders
  2297. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2298. }
  2299. // Do executes the "cloudresourcemanager.folders.search" call.
  2300. // Exactly one of *SearchFoldersResponse or error will be non-nil. Any
  2301. // non-2xx status code is an error. Response headers are in either
  2302. // *SearchFoldersResponse.ServerResponse.Header or (if a response was
  2303. // returned at all) in error.(*googleapi.Error).Header. Use
  2304. // googleapi.IsNotModified to check whether the returned error was
  2305. // because http.StatusNotModified was returned.
  2306. func (c *FoldersSearchCall) Do(opts ...googleapi.CallOption) (*SearchFoldersResponse, error) {
  2307. gensupport.SetOptions(c.urlParams_, opts...)
  2308. res, err := c.doRequest("json")
  2309. if res != nil && res.StatusCode == http.StatusNotModified {
  2310. if res.Body != nil {
  2311. res.Body.Close()
  2312. }
  2313. return nil, &googleapi.Error{
  2314. Code: res.StatusCode,
  2315. Header: res.Header,
  2316. }
  2317. }
  2318. if err != nil {
  2319. return nil, err
  2320. }
  2321. defer googleapi.CloseBody(res)
  2322. if err := googleapi.CheckResponse(res); err != nil {
  2323. return nil, err
  2324. }
  2325. ret := &SearchFoldersResponse{
  2326. ServerResponse: googleapi.ServerResponse{
  2327. Header: res.Header,
  2328. HTTPStatusCode: res.StatusCode,
  2329. },
  2330. }
  2331. target := &ret
  2332. if err := gensupport.DecodeResponse(target, res); err != nil {
  2333. return nil, err
  2334. }
  2335. return ret, nil
  2336. // {
  2337. // "description": "Search for folders that match specific filter criteria.\nSearch provides an eventually consistent view of the folders a user has\naccess to which meet the specified filter criteria.\n\nThis will only return folders on which the caller has the\npermission `resourcemanager.folders.get`.",
  2338. // "flatPath": "v2/folders:search",
  2339. // "httpMethod": "POST",
  2340. // "id": "cloudresourcemanager.folders.search",
  2341. // "parameterOrder": [],
  2342. // "parameters": {},
  2343. // "path": "v2/folders:search",
  2344. // "request": {
  2345. // "$ref": "SearchFoldersRequest"
  2346. // },
  2347. // "response": {
  2348. // "$ref": "SearchFoldersResponse"
  2349. // },
  2350. // "scopes": [
  2351. // "https://www.googleapis.com/auth/cloud-platform",
  2352. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2353. // ]
  2354. // }
  2355. }
  2356. // Pages invokes f for each page of results.
  2357. // A non-nil error returned from f will halt the iteration.
  2358. // The provided context supersedes any context provided to the Context method.
  2359. func (c *FoldersSearchCall) Pages(ctx context.Context, f func(*SearchFoldersResponse) error) error {
  2360. c.ctx_ = ctx
  2361. defer func(pt string) { c.searchfoldersrequest.PageToken = pt }(c.searchfoldersrequest.PageToken) // reset paging to original point
  2362. for {
  2363. x, err := c.Do()
  2364. if err != nil {
  2365. return err
  2366. }
  2367. if err := f(x); err != nil {
  2368. return err
  2369. }
  2370. if x.NextPageToken == "" {
  2371. return nil
  2372. }
  2373. c.searchfoldersrequest.PageToken = x.NextPageToken
  2374. }
  2375. }
  2376. // method id "cloudresourcemanager.folders.setIamPolicy":
  2377. type FoldersSetIamPolicyCall struct {
  2378. s *Service
  2379. resource string
  2380. setiampolicyrequest *SetIamPolicyRequest
  2381. urlParams_ gensupport.URLParams
  2382. ctx_ context.Context
  2383. header_ http.Header
  2384. }
  2385. // SetIamPolicy: Sets the access control policy on a Folder, replacing
  2386. // any existing policy.
  2387. // The `resource` field should be the Folder's resource name,
  2388. // e.g.
  2389. // "folders/1234".
  2390. // The caller must have `resourcemanager.folders.setIamPolicy`
  2391. // permission
  2392. // on the identified folder.
  2393. func (r *FoldersService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *FoldersSetIamPolicyCall {
  2394. c := &FoldersSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2395. c.resource = resource
  2396. c.setiampolicyrequest = setiampolicyrequest
  2397. return c
  2398. }
  2399. // Fields allows partial responses to be retrieved. See
  2400. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2401. // for more information.
  2402. func (c *FoldersSetIamPolicyCall) Fields(s ...googleapi.Field) *FoldersSetIamPolicyCall {
  2403. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2404. return c
  2405. }
  2406. // Context sets the context to be used in this call's Do method. Any
  2407. // pending HTTP request will be aborted if the provided context is
  2408. // canceled.
  2409. func (c *FoldersSetIamPolicyCall) Context(ctx context.Context) *FoldersSetIamPolicyCall {
  2410. c.ctx_ = ctx
  2411. return c
  2412. }
  2413. // Header returns an http.Header that can be modified by the caller to
  2414. // add HTTP headers to the request.
  2415. func (c *FoldersSetIamPolicyCall) Header() http.Header {
  2416. if c.header_ == nil {
  2417. c.header_ = make(http.Header)
  2418. }
  2419. return c.header_
  2420. }
  2421. func (c *FoldersSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2422. reqHeaders := make(http.Header)
  2423. for k, v := range c.header_ {
  2424. reqHeaders[k] = v
  2425. }
  2426. reqHeaders.Set("User-Agent", c.s.userAgent())
  2427. var body io.Reader = nil
  2428. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2429. if err != nil {
  2430. return nil, err
  2431. }
  2432. reqHeaders.Set("Content-Type", "application/json")
  2433. c.urlParams_.Set("alt", alt)
  2434. c.urlParams_.Set("prettyPrint", "false")
  2435. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:setIamPolicy")
  2436. urls += "?" + c.urlParams_.Encode()
  2437. req, err := http.NewRequest("POST", urls, body)
  2438. if err != nil {
  2439. return nil, err
  2440. }
  2441. req.Header = reqHeaders
  2442. googleapi.Expand(req.URL, map[string]string{
  2443. "resource": c.resource,
  2444. })
  2445. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2446. }
  2447. // Do executes the "cloudresourcemanager.folders.setIamPolicy" call.
  2448. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2449. // code is an error. Response headers are in either
  2450. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2451. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2452. // check whether the returned error was because http.StatusNotModified
  2453. // was returned.
  2454. func (c *FoldersSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2455. gensupport.SetOptions(c.urlParams_, opts...)
  2456. res, err := c.doRequest("json")
  2457. if res != nil && res.StatusCode == http.StatusNotModified {
  2458. if res.Body != nil {
  2459. res.Body.Close()
  2460. }
  2461. return nil, &googleapi.Error{
  2462. Code: res.StatusCode,
  2463. Header: res.Header,
  2464. }
  2465. }
  2466. if err != nil {
  2467. return nil, err
  2468. }
  2469. defer googleapi.CloseBody(res)
  2470. if err := googleapi.CheckResponse(res); err != nil {
  2471. return nil, err
  2472. }
  2473. ret := &Policy{
  2474. ServerResponse: googleapi.ServerResponse{
  2475. Header: res.Header,
  2476. HTTPStatusCode: res.StatusCode,
  2477. },
  2478. }
  2479. target := &ret
  2480. if err := gensupport.DecodeResponse(target, res); err != nil {
  2481. return nil, err
  2482. }
  2483. return ret, nil
  2484. // {
  2485. // "description": "Sets the access control policy on a Folder, replacing any existing policy.\nThe `resource` field should be the Folder's resource name, e.g.\n\"folders/1234\".\nThe caller must have `resourcemanager.folders.setIamPolicy` permission\non the identified folder.",
  2486. // "flatPath": "v2/folders/{foldersId}:setIamPolicy",
  2487. // "httpMethod": "POST",
  2488. // "id": "cloudresourcemanager.folders.setIamPolicy",
  2489. // "parameterOrder": [
  2490. // "resource"
  2491. // ],
  2492. // "parameters": {
  2493. // "resource": {
  2494. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2495. // "location": "path",
  2496. // "pattern": "^folders/[^/]+$",
  2497. // "required": true,
  2498. // "type": "string"
  2499. // }
  2500. // },
  2501. // "path": "v2/{+resource}:setIamPolicy",
  2502. // "request": {
  2503. // "$ref": "SetIamPolicyRequest"
  2504. // },
  2505. // "response": {
  2506. // "$ref": "Policy"
  2507. // },
  2508. // "scopes": [
  2509. // "https://www.googleapis.com/auth/cloud-platform"
  2510. // ]
  2511. // }
  2512. }
  2513. // method id "cloudresourcemanager.folders.testIamPermissions":
  2514. type FoldersTestIamPermissionsCall struct {
  2515. s *Service
  2516. resource string
  2517. testiampermissionsrequest *TestIamPermissionsRequest
  2518. urlParams_ gensupport.URLParams
  2519. ctx_ context.Context
  2520. header_ http.Header
  2521. }
  2522. // TestIamPermissions: Returns permissions that a caller has on the
  2523. // specified Folder.
  2524. // The `resource` field should be the Folder's resource name,
  2525. // e.g. "folders/1234".
  2526. //
  2527. // There are no permissions required for making this API call.
  2528. func (r *FoldersService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *FoldersTestIamPermissionsCall {
  2529. c := &FoldersTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2530. c.resource = resource
  2531. c.testiampermissionsrequest = testiampermissionsrequest
  2532. return c
  2533. }
  2534. // Fields allows partial responses to be retrieved. See
  2535. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2536. // for more information.
  2537. func (c *FoldersTestIamPermissionsCall) Fields(s ...googleapi.Field) *FoldersTestIamPermissionsCall {
  2538. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2539. return c
  2540. }
  2541. // Context sets the context to be used in this call's Do method. Any
  2542. // pending HTTP request will be aborted if the provided context is
  2543. // canceled.
  2544. func (c *FoldersTestIamPermissionsCall) Context(ctx context.Context) *FoldersTestIamPermissionsCall {
  2545. c.ctx_ = ctx
  2546. return c
  2547. }
  2548. // Header returns an http.Header that can be modified by the caller to
  2549. // add HTTP headers to the request.
  2550. func (c *FoldersTestIamPermissionsCall) Header() http.Header {
  2551. if c.header_ == nil {
  2552. c.header_ = make(http.Header)
  2553. }
  2554. return c.header_
  2555. }
  2556. func (c *FoldersTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2557. reqHeaders := make(http.Header)
  2558. for k, v := range c.header_ {
  2559. reqHeaders[k] = v
  2560. }
  2561. reqHeaders.Set("User-Agent", c.s.userAgent())
  2562. var body io.Reader = nil
  2563. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2564. if err != nil {
  2565. return nil, err
  2566. }
  2567. reqHeaders.Set("Content-Type", "application/json")
  2568. c.urlParams_.Set("alt", alt)
  2569. c.urlParams_.Set("prettyPrint", "false")
  2570. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:testIamPermissions")
  2571. urls += "?" + c.urlParams_.Encode()
  2572. req, err := http.NewRequest("POST", urls, body)
  2573. if err != nil {
  2574. return nil, err
  2575. }
  2576. req.Header = reqHeaders
  2577. googleapi.Expand(req.URL, map[string]string{
  2578. "resource": c.resource,
  2579. })
  2580. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2581. }
  2582. // Do executes the "cloudresourcemanager.folders.testIamPermissions" call.
  2583. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2584. // Any non-2xx status code is an error. Response headers are in either
  2585. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2586. // was returned at all) in error.(*googleapi.Error).Header. Use
  2587. // googleapi.IsNotModified to check whether the returned error was
  2588. // because http.StatusNotModified was returned.
  2589. func (c *FoldersTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2590. gensupport.SetOptions(c.urlParams_, opts...)
  2591. res, err := c.doRequest("json")
  2592. if res != nil && res.StatusCode == http.StatusNotModified {
  2593. if res.Body != nil {
  2594. res.Body.Close()
  2595. }
  2596. return nil, &googleapi.Error{
  2597. Code: res.StatusCode,
  2598. Header: res.Header,
  2599. }
  2600. }
  2601. if err != nil {
  2602. return nil, err
  2603. }
  2604. defer googleapi.CloseBody(res)
  2605. if err := googleapi.CheckResponse(res); err != nil {
  2606. return nil, err
  2607. }
  2608. ret := &TestIamPermissionsResponse{
  2609. ServerResponse: googleapi.ServerResponse{
  2610. Header: res.Header,
  2611. HTTPStatusCode: res.StatusCode,
  2612. },
  2613. }
  2614. target := &ret
  2615. if err := gensupport.DecodeResponse(target, res); err != nil {
  2616. return nil, err
  2617. }
  2618. return ret, nil
  2619. // {
  2620. // "description": "Returns permissions that a caller has on the specified Folder.\nThe `resource` field should be the Folder's resource name,\ne.g. \"folders/1234\".\n\nThere are no permissions required for making this API call.",
  2621. // "flatPath": "v2/folders/{foldersId}:testIamPermissions",
  2622. // "httpMethod": "POST",
  2623. // "id": "cloudresourcemanager.folders.testIamPermissions",
  2624. // "parameterOrder": [
  2625. // "resource"
  2626. // ],
  2627. // "parameters": {
  2628. // "resource": {
  2629. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2630. // "location": "path",
  2631. // "pattern": "^folders/[^/]+$",
  2632. // "required": true,
  2633. // "type": "string"
  2634. // }
  2635. // },
  2636. // "path": "v2/{+resource}:testIamPermissions",
  2637. // "request": {
  2638. // "$ref": "TestIamPermissionsRequest"
  2639. // },
  2640. // "response": {
  2641. // "$ref": "TestIamPermissionsResponse"
  2642. // },
  2643. // "scopes": [
  2644. // "https://www.googleapis.com/auth/cloud-platform"
  2645. // ]
  2646. // }
  2647. }
  2648. // method id "cloudresourcemanager.folders.undelete":
  2649. type FoldersUndeleteCall struct {
  2650. s *Service
  2651. name string
  2652. undeletefolderrequest *UndeleteFolderRequest
  2653. urlParams_ gensupport.URLParams
  2654. ctx_ context.Context
  2655. header_ http.Header
  2656. }
  2657. // Undelete: Cancels the deletion request for a Folder. This method may
  2658. // only be
  2659. // called on a Folder in the
  2660. // DELETE_REQUESTED state.
  2661. // In order to succeed, the Folder's parent must be in the
  2662. // ACTIVE state.
  2663. // In addition, reintroducing the folder into the tree must not
  2664. // violate
  2665. // folder naming, height and fanout constraints described in
  2666. // the
  2667. // CreateFolder documentation.
  2668. // The caller must have `resourcemanager.folders.undelete` permission on
  2669. // the
  2670. // identified folder.
  2671. func (r *FoldersService) Undelete(name string, undeletefolderrequest *UndeleteFolderRequest) *FoldersUndeleteCall {
  2672. c := &FoldersUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2673. c.name = name
  2674. c.undeletefolderrequest = undeletefolderrequest
  2675. return c
  2676. }
  2677. // Fields allows partial responses to be retrieved. See
  2678. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2679. // for more information.
  2680. func (c *FoldersUndeleteCall) Fields(s ...googleapi.Field) *FoldersUndeleteCall {
  2681. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2682. return c
  2683. }
  2684. // Context sets the context to be used in this call's Do method. Any
  2685. // pending HTTP request will be aborted if the provided context is
  2686. // canceled.
  2687. func (c *FoldersUndeleteCall) Context(ctx context.Context) *FoldersUndeleteCall {
  2688. c.ctx_ = ctx
  2689. return c
  2690. }
  2691. // Header returns an http.Header that can be modified by the caller to
  2692. // add HTTP headers to the request.
  2693. func (c *FoldersUndeleteCall) Header() http.Header {
  2694. if c.header_ == nil {
  2695. c.header_ = make(http.Header)
  2696. }
  2697. return c.header_
  2698. }
  2699. func (c *FoldersUndeleteCall) doRequest(alt string) (*http.Response, error) {
  2700. reqHeaders := make(http.Header)
  2701. for k, v := range c.header_ {
  2702. reqHeaders[k] = v
  2703. }
  2704. reqHeaders.Set("User-Agent", c.s.userAgent())
  2705. var body io.Reader = nil
  2706. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeletefolderrequest)
  2707. if err != nil {
  2708. return nil, err
  2709. }
  2710. reqHeaders.Set("Content-Type", "application/json")
  2711. c.urlParams_.Set("alt", alt)
  2712. c.urlParams_.Set("prettyPrint", "false")
  2713. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:undelete")
  2714. urls += "?" + c.urlParams_.Encode()
  2715. req, err := http.NewRequest("POST", urls, body)
  2716. if err != nil {
  2717. return nil, err
  2718. }
  2719. req.Header = reqHeaders
  2720. googleapi.Expand(req.URL, map[string]string{
  2721. "name": c.name,
  2722. })
  2723. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2724. }
  2725. // Do executes the "cloudresourcemanager.folders.undelete" call.
  2726. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  2727. // code is an error. Response headers are in either
  2728. // *Folder.ServerResponse.Header or (if a response was returned at all)
  2729. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2730. // check whether the returned error was because http.StatusNotModified
  2731. // was returned.
  2732. func (c *FoldersUndeleteCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  2733. gensupport.SetOptions(c.urlParams_, opts...)
  2734. res, err := c.doRequest("json")
  2735. if res != nil && res.StatusCode == http.StatusNotModified {
  2736. if res.Body != nil {
  2737. res.Body.Close()
  2738. }
  2739. return nil, &googleapi.Error{
  2740. Code: res.StatusCode,
  2741. Header: res.Header,
  2742. }
  2743. }
  2744. if err != nil {
  2745. return nil, err
  2746. }
  2747. defer googleapi.CloseBody(res)
  2748. if err := googleapi.CheckResponse(res); err != nil {
  2749. return nil, err
  2750. }
  2751. ret := &Folder{
  2752. ServerResponse: googleapi.ServerResponse{
  2753. Header: res.Header,
  2754. HTTPStatusCode: res.StatusCode,
  2755. },
  2756. }
  2757. target := &ret
  2758. if err := gensupport.DecodeResponse(target, res); err != nil {
  2759. return nil, err
  2760. }
  2761. return ret, nil
  2762. // {
  2763. // "description": "Cancels the deletion request for a Folder. This method may only be\ncalled on a Folder in the\nDELETE_REQUESTED state.\nIn order to succeed, the Folder's parent must be in the\nACTIVE state.\nIn addition, reintroducing the folder into the tree must not violate\nfolder naming, height and fanout constraints described in the\nCreateFolder documentation.\nThe caller must have `resourcemanager.folders.undelete` permission on the\nidentified folder.",
  2764. // "flatPath": "v2/folders/{foldersId}:undelete",
  2765. // "httpMethod": "POST",
  2766. // "id": "cloudresourcemanager.folders.undelete",
  2767. // "parameterOrder": [
  2768. // "name"
  2769. // ],
  2770. // "parameters": {
  2771. // "name": {
  2772. // "description": "The resource name of the Folder to undelete.\nMust be of the form `folders/{folder_id}`.",
  2773. // "location": "path",
  2774. // "pattern": "^folders/[^/]+$",
  2775. // "required": true,
  2776. // "type": "string"
  2777. // }
  2778. // },
  2779. // "path": "v2/{+name}:undelete",
  2780. // "request": {
  2781. // "$ref": "UndeleteFolderRequest"
  2782. // },
  2783. // "response": {
  2784. // "$ref": "Folder"
  2785. // },
  2786. // "scopes": [
  2787. // "https://www.googleapis.com/auth/cloud-platform"
  2788. // ]
  2789. // }
  2790. }
  2791. // method id "cloudresourcemanager.operations.get":
  2792. type OperationsGetCall struct {
  2793. s *Service
  2794. name string
  2795. urlParams_ gensupport.URLParams
  2796. ifNoneMatch_ string
  2797. ctx_ context.Context
  2798. header_ http.Header
  2799. }
  2800. // Get: Gets the latest state of a long-running operation. Clients can
  2801. // use this
  2802. // method to poll the operation result at intervals as recommended by
  2803. // the API
  2804. // service.
  2805. func (r *OperationsService) Get(name string) *OperationsGetCall {
  2806. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2807. c.name = name
  2808. return c
  2809. }
  2810. // Fields allows partial responses to be retrieved. See
  2811. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2812. // for more information.
  2813. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  2814. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2815. return c
  2816. }
  2817. // IfNoneMatch sets the optional parameter which makes the operation
  2818. // fail if the object's ETag matches the given value. This is useful for
  2819. // getting updates only after the object has changed since the last
  2820. // request. Use googleapi.IsNotModified to check whether the response
  2821. // error from Do is the result of In-None-Match.
  2822. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  2823. c.ifNoneMatch_ = entityTag
  2824. return c
  2825. }
  2826. // Context sets the context to be used in this call's Do method. Any
  2827. // pending HTTP request will be aborted if the provided context is
  2828. // canceled.
  2829. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  2830. c.ctx_ = ctx
  2831. return c
  2832. }
  2833. // Header returns an http.Header that can be modified by the caller to
  2834. // add HTTP headers to the request.
  2835. func (c *OperationsGetCall) Header() http.Header {
  2836. if c.header_ == nil {
  2837. c.header_ = make(http.Header)
  2838. }
  2839. return c.header_
  2840. }
  2841. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  2842. reqHeaders := make(http.Header)
  2843. for k, v := range c.header_ {
  2844. reqHeaders[k] = v
  2845. }
  2846. reqHeaders.Set("User-Agent", c.s.userAgent())
  2847. if c.ifNoneMatch_ != "" {
  2848. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2849. }
  2850. var body io.Reader = nil
  2851. c.urlParams_.Set("alt", alt)
  2852. c.urlParams_.Set("prettyPrint", "false")
  2853. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2854. urls += "?" + c.urlParams_.Encode()
  2855. req, err := http.NewRequest("GET", urls, body)
  2856. if err != nil {
  2857. return nil, err
  2858. }
  2859. req.Header = reqHeaders
  2860. googleapi.Expand(req.URL, map[string]string{
  2861. "name": c.name,
  2862. })
  2863. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2864. }
  2865. // Do executes the "cloudresourcemanager.operations.get" call.
  2866. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2867. // status code is an error. Response headers are in either
  2868. // *Operation.ServerResponse.Header or (if a response was returned at
  2869. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2870. // to check whether the returned error was because
  2871. // http.StatusNotModified was returned.
  2872. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2873. gensupport.SetOptions(c.urlParams_, opts...)
  2874. res, err := c.doRequest("json")
  2875. if res != nil && res.StatusCode == http.StatusNotModified {
  2876. if res.Body != nil {
  2877. res.Body.Close()
  2878. }
  2879. return nil, &googleapi.Error{
  2880. Code: res.StatusCode,
  2881. Header: res.Header,
  2882. }
  2883. }
  2884. if err != nil {
  2885. return nil, err
  2886. }
  2887. defer googleapi.CloseBody(res)
  2888. if err := googleapi.CheckResponse(res); err != nil {
  2889. return nil, err
  2890. }
  2891. ret := &Operation{
  2892. ServerResponse: googleapi.ServerResponse{
  2893. Header: res.Header,
  2894. HTTPStatusCode: res.StatusCode,
  2895. },
  2896. }
  2897. target := &ret
  2898. if err := gensupport.DecodeResponse(target, res); err != nil {
  2899. return nil, err
  2900. }
  2901. return ret, nil
  2902. // {
  2903. // "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.",
  2904. // "flatPath": "v1/operations/{operationsId}",
  2905. // "httpMethod": "GET",
  2906. // "id": "cloudresourcemanager.operations.get",
  2907. // "parameterOrder": [
  2908. // "name"
  2909. // ],
  2910. // "parameters": {
  2911. // "name": {
  2912. // "description": "The name of the operation resource.",
  2913. // "location": "path",
  2914. // "pattern": "^operations/.+$",
  2915. // "required": true,
  2916. // "type": "string"
  2917. // }
  2918. // },
  2919. // "path": "v1/{+name}",
  2920. // "response": {
  2921. // "$ref": "Operation"
  2922. // },
  2923. // "scopes": [
  2924. // "https://www.googleapis.com/auth/cloud-platform",
  2925. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2926. // ]
  2927. // }
  2928. }