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.
 
 
 

2847 lines
100 KiB

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