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.
 
 
 

2851 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/v2"
  8. // ...
  9. // cloudresourcemanagerService, err := cloudresourcemanager.New(oauthHttpClient)
  10. package cloudresourcemanager // import "google.golang.org/api/cloudresourcemanager/v2"
  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:v2"
  41. const apiName = "cloudresourcemanager"
  42. const apiVersion = "v2"
  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, some
  1046. // errors
  1047. // may be returned by the CreateFolder request, with status
  1048. // code
  1049. // FAILED_PRECONDITION and an error description. Other folder
  1050. // constraint
  1051. // violations will be communicated in the Operation, with the
  1052. // specific
  1053. // PreconditionFailure returned via the details list in the
  1054. // Operation.error
  1055. // field.
  1056. //
  1057. // The caller must have `resourcemanager.folders.create` permission on
  1058. // the
  1059. // identified parent.
  1060. func (r *FoldersService) Create(folder *Folder) *FoldersCreateCall {
  1061. c := &FoldersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1062. c.folder = folder
  1063. return c
  1064. }
  1065. // Parent sets the optional parameter "parent": The resource name of the
  1066. // new Folder's parent.
  1067. // Must be of the form `folders/{folder_id}` or
  1068. // `organizations/{org_id}`.
  1069. func (c *FoldersCreateCall) Parent(parent string) *FoldersCreateCall {
  1070. c.urlParams_.Set("parent", parent)
  1071. return c
  1072. }
  1073. // Fields allows partial responses to be retrieved. See
  1074. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1075. // for more information.
  1076. func (c *FoldersCreateCall) Fields(s ...googleapi.Field) *FoldersCreateCall {
  1077. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1078. return c
  1079. }
  1080. // Context sets the context to be used in this call's Do method. Any
  1081. // pending HTTP request will be aborted if the provided context is
  1082. // canceled.
  1083. func (c *FoldersCreateCall) Context(ctx context.Context) *FoldersCreateCall {
  1084. c.ctx_ = ctx
  1085. return c
  1086. }
  1087. // Header returns an http.Header that can be modified by the caller to
  1088. // add HTTP headers to the request.
  1089. func (c *FoldersCreateCall) Header() http.Header {
  1090. if c.header_ == nil {
  1091. c.header_ = make(http.Header)
  1092. }
  1093. return c.header_
  1094. }
  1095. func (c *FoldersCreateCall) doRequest(alt string) (*http.Response, error) {
  1096. reqHeaders := make(http.Header)
  1097. for k, v := range c.header_ {
  1098. reqHeaders[k] = v
  1099. }
  1100. reqHeaders.Set("User-Agent", c.s.userAgent())
  1101. var body io.Reader = nil
  1102. body, err := googleapi.WithoutDataWrapper.JSONReader(c.folder)
  1103. if err != nil {
  1104. return nil, err
  1105. }
  1106. reqHeaders.Set("Content-Type", "application/json")
  1107. c.urlParams_.Set("alt", alt)
  1108. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders")
  1109. urls += "?" + c.urlParams_.Encode()
  1110. req, _ := http.NewRequest("POST", urls, body)
  1111. req.Header = reqHeaders
  1112. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1113. }
  1114. // Do executes the "cloudresourcemanager.folders.create" call.
  1115. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1116. // status code is an error. Response headers are in either
  1117. // *Operation.ServerResponse.Header or (if a response was returned at
  1118. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1119. // to check whether the returned error was because
  1120. // http.StatusNotModified was returned.
  1121. func (c *FoldersCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1122. gensupport.SetOptions(c.urlParams_, opts...)
  1123. res, err := c.doRequest("json")
  1124. if res != nil && res.StatusCode == http.StatusNotModified {
  1125. if res.Body != nil {
  1126. res.Body.Close()
  1127. }
  1128. return nil, &googleapi.Error{
  1129. Code: res.StatusCode,
  1130. Header: res.Header,
  1131. }
  1132. }
  1133. if err != nil {
  1134. return nil, err
  1135. }
  1136. defer googleapi.CloseBody(res)
  1137. if err := googleapi.CheckResponse(res); err != nil {
  1138. return nil, err
  1139. }
  1140. ret := &Operation{
  1141. ServerResponse: googleapi.ServerResponse{
  1142. Header: res.Header,
  1143. HTTPStatusCode: res.StatusCode,
  1144. },
  1145. }
  1146. target := &ret
  1147. if err := gensupport.DecodeResponse(target, res); err != nil {
  1148. return nil, err
  1149. }
  1150. return ret, nil
  1151. // {
  1152. // "description": "Creates a Folder in the resource hierarchy.\nReturns an Operation which can be used to track the progress of the\nfolder creation workflow.\nUpon success the Operation.response field will be populated with the\ncreated Folder.\n\nIn order to succeed, the addition of this new Folder must not violate\nthe Folder naming, height or fanout constraints.\n\n+ The Folder's display_name must be distinct from all other Folder's that\nshare its parent.\n+ The addition of the Folder must not cause the active Folder hierarchy\nto exceed a height of 4. Note, the full active + deleted Folder hierarchy\nis allowed to reach a height of 8; this provides additional headroom when\nmoving folders that contain deleted folders.\n+ The addition of the Folder must not cause the total number of Folders\nunder its parent to exceed 100.\n\nIf the operation fails due to a folder constraint violation, some errors\nmay be returned by the CreateFolder request, with status code\nFAILED_PRECONDITION and an error description. Other folder constraint\nviolations will be communicated in the Operation, with the specific\nPreconditionFailure returned via the details list in the Operation.error\nfield.\n\nThe caller must have `resourcemanager.folders.create` permission on the\nidentified parent.",
  1153. // "flatPath": "v2/folders",
  1154. // "httpMethod": "POST",
  1155. // "id": "cloudresourcemanager.folders.create",
  1156. // "parameterOrder": [],
  1157. // "parameters": {
  1158. // "parent": {
  1159. // "description": "The resource name of the new Folder's parent.\nMust be of the form `folders/{folder_id}` or `organizations/{org_id}`.",
  1160. // "location": "query",
  1161. // "type": "string"
  1162. // }
  1163. // },
  1164. // "path": "v2/folders",
  1165. // "request": {
  1166. // "$ref": "Folder"
  1167. // },
  1168. // "response": {
  1169. // "$ref": "Operation"
  1170. // },
  1171. // "scopes": [
  1172. // "https://www.googleapis.com/auth/cloud-platform"
  1173. // ]
  1174. // }
  1175. }
  1176. // method id "cloudresourcemanager.folders.delete":
  1177. type FoldersDeleteCall struct {
  1178. s *Service
  1179. name string
  1180. urlParams_ gensupport.URLParams
  1181. ctx_ context.Context
  1182. header_ http.Header
  1183. }
  1184. // Delete: Requests deletion of a Folder. The Folder is moved into
  1185. // the
  1186. // DELETE_REQUESTED state
  1187. // immediately, and is deleted approximately 30 days later. This method
  1188. // may
  1189. // only be called on an empty Folder in the
  1190. // ACTIVE state, where a Folder is empty if
  1191. // it doesn't contain any Folders or Projects in the
  1192. // ACTIVE state.
  1193. // The caller must have `resourcemanager.folders.delete` permission on
  1194. // the
  1195. // identified folder.
  1196. func (r *FoldersService) Delete(name string) *FoldersDeleteCall {
  1197. c := &FoldersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1198. c.name = name
  1199. return c
  1200. }
  1201. // Fields allows partial responses to be retrieved. See
  1202. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1203. // for more information.
  1204. func (c *FoldersDeleteCall) Fields(s ...googleapi.Field) *FoldersDeleteCall {
  1205. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1206. return c
  1207. }
  1208. // Context sets the context to be used in this call's Do method. Any
  1209. // pending HTTP request will be aborted if the provided context is
  1210. // canceled.
  1211. func (c *FoldersDeleteCall) Context(ctx context.Context) *FoldersDeleteCall {
  1212. c.ctx_ = ctx
  1213. return c
  1214. }
  1215. // Header returns an http.Header that can be modified by the caller to
  1216. // add HTTP headers to the request.
  1217. func (c *FoldersDeleteCall) Header() http.Header {
  1218. if c.header_ == nil {
  1219. c.header_ = make(http.Header)
  1220. }
  1221. return c.header_
  1222. }
  1223. func (c *FoldersDeleteCall) doRequest(alt string) (*http.Response, error) {
  1224. reqHeaders := make(http.Header)
  1225. for k, v := range c.header_ {
  1226. reqHeaders[k] = v
  1227. }
  1228. reqHeaders.Set("User-Agent", c.s.userAgent())
  1229. var body io.Reader = nil
  1230. c.urlParams_.Set("alt", alt)
  1231. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  1232. urls += "?" + c.urlParams_.Encode()
  1233. req, _ := http.NewRequest("DELETE", urls, body)
  1234. req.Header = reqHeaders
  1235. googleapi.Expand(req.URL, map[string]string{
  1236. "name": c.name,
  1237. })
  1238. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1239. }
  1240. // Do executes the "cloudresourcemanager.folders.delete" call.
  1241. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  1242. // code is an error. Response headers are in either
  1243. // *Folder.ServerResponse.Header or (if a response was returned at all)
  1244. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1245. // check whether the returned error was because http.StatusNotModified
  1246. // was returned.
  1247. func (c *FoldersDeleteCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  1248. gensupport.SetOptions(c.urlParams_, opts...)
  1249. res, err := c.doRequest("json")
  1250. if res != nil && res.StatusCode == http.StatusNotModified {
  1251. if res.Body != nil {
  1252. res.Body.Close()
  1253. }
  1254. return nil, &googleapi.Error{
  1255. Code: res.StatusCode,
  1256. Header: res.Header,
  1257. }
  1258. }
  1259. if err != nil {
  1260. return nil, err
  1261. }
  1262. defer googleapi.CloseBody(res)
  1263. if err := googleapi.CheckResponse(res); err != nil {
  1264. return nil, err
  1265. }
  1266. ret := &Folder{
  1267. ServerResponse: googleapi.ServerResponse{
  1268. Header: res.Header,
  1269. HTTPStatusCode: res.StatusCode,
  1270. },
  1271. }
  1272. target := &ret
  1273. if err := gensupport.DecodeResponse(target, res); err != nil {
  1274. return nil, err
  1275. }
  1276. return ret, nil
  1277. // {
  1278. // "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.",
  1279. // "flatPath": "v2/folders/{foldersId}",
  1280. // "httpMethod": "DELETE",
  1281. // "id": "cloudresourcemanager.folders.delete",
  1282. // "parameterOrder": [
  1283. // "name"
  1284. // ],
  1285. // "parameters": {
  1286. // "name": {
  1287. // "description": "the resource name of the Folder to be deleted.\nMust be of the form `folders/{folder_id}`.",
  1288. // "location": "path",
  1289. // "pattern": "^folders/[^/]+$",
  1290. // "required": true,
  1291. // "type": "string"
  1292. // }
  1293. // },
  1294. // "path": "v2/{+name}",
  1295. // "response": {
  1296. // "$ref": "Folder"
  1297. // },
  1298. // "scopes": [
  1299. // "https://www.googleapis.com/auth/cloud-platform"
  1300. // ]
  1301. // }
  1302. }
  1303. // method id "cloudresourcemanager.folders.get":
  1304. type FoldersGetCall struct {
  1305. s *Service
  1306. name string
  1307. urlParams_ gensupport.URLParams
  1308. ifNoneMatch_ string
  1309. ctx_ context.Context
  1310. header_ http.Header
  1311. }
  1312. // Get: Retrieves a Folder identified by the supplied resource
  1313. // name.
  1314. // Valid Folder resource names have the format
  1315. // `folders/{folder_id}`
  1316. // (for example, `folders/1234`).
  1317. // The caller must have `resourcemanager.folders.get` permission on
  1318. // the
  1319. // identified folder.
  1320. func (r *FoldersService) Get(name string) *FoldersGetCall {
  1321. c := &FoldersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1322. c.name = name
  1323. return c
  1324. }
  1325. // Fields allows partial responses to be retrieved. See
  1326. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1327. // for more information.
  1328. func (c *FoldersGetCall) Fields(s ...googleapi.Field) *FoldersGetCall {
  1329. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1330. return c
  1331. }
  1332. // IfNoneMatch sets the optional parameter which makes the operation
  1333. // fail if the object's ETag matches the given value. This is useful for
  1334. // getting updates only after the object has changed since the last
  1335. // request. Use googleapi.IsNotModified to check whether the response
  1336. // error from Do is the result of In-None-Match.
  1337. func (c *FoldersGetCall) IfNoneMatch(entityTag string) *FoldersGetCall {
  1338. c.ifNoneMatch_ = entityTag
  1339. return c
  1340. }
  1341. // Context sets the context to be used in this call's Do method. Any
  1342. // pending HTTP request will be aborted if the provided context is
  1343. // canceled.
  1344. func (c *FoldersGetCall) Context(ctx context.Context) *FoldersGetCall {
  1345. c.ctx_ = ctx
  1346. return c
  1347. }
  1348. // Header returns an http.Header that can be modified by the caller to
  1349. // add HTTP headers to the request.
  1350. func (c *FoldersGetCall) Header() http.Header {
  1351. if c.header_ == nil {
  1352. c.header_ = make(http.Header)
  1353. }
  1354. return c.header_
  1355. }
  1356. func (c *FoldersGetCall) doRequest(alt string) (*http.Response, error) {
  1357. reqHeaders := make(http.Header)
  1358. for k, v := range c.header_ {
  1359. reqHeaders[k] = v
  1360. }
  1361. reqHeaders.Set("User-Agent", c.s.userAgent())
  1362. if c.ifNoneMatch_ != "" {
  1363. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1364. }
  1365. var body io.Reader = nil
  1366. c.urlParams_.Set("alt", alt)
  1367. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  1368. urls += "?" + c.urlParams_.Encode()
  1369. req, _ := http.NewRequest("GET", urls, body)
  1370. req.Header = reqHeaders
  1371. googleapi.Expand(req.URL, map[string]string{
  1372. "name": c.name,
  1373. })
  1374. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1375. }
  1376. // Do executes the "cloudresourcemanager.folders.get" call.
  1377. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  1378. // code is an error. Response headers are in either
  1379. // *Folder.ServerResponse.Header or (if a response was returned at all)
  1380. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1381. // check whether the returned error was because http.StatusNotModified
  1382. // was returned.
  1383. func (c *FoldersGetCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  1384. gensupport.SetOptions(c.urlParams_, opts...)
  1385. res, err := c.doRequest("json")
  1386. if res != nil && res.StatusCode == http.StatusNotModified {
  1387. if res.Body != nil {
  1388. res.Body.Close()
  1389. }
  1390. return nil, &googleapi.Error{
  1391. Code: res.StatusCode,
  1392. Header: res.Header,
  1393. }
  1394. }
  1395. if err != nil {
  1396. return nil, err
  1397. }
  1398. defer googleapi.CloseBody(res)
  1399. if err := googleapi.CheckResponse(res); err != nil {
  1400. return nil, err
  1401. }
  1402. ret := &Folder{
  1403. ServerResponse: googleapi.ServerResponse{
  1404. Header: res.Header,
  1405. HTTPStatusCode: res.StatusCode,
  1406. },
  1407. }
  1408. target := &ret
  1409. if err := gensupport.DecodeResponse(target, res); err != nil {
  1410. return nil, err
  1411. }
  1412. return ret, nil
  1413. // {
  1414. // "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.",
  1415. // "flatPath": "v2/folders/{foldersId}",
  1416. // "httpMethod": "GET",
  1417. // "id": "cloudresourcemanager.folders.get",
  1418. // "parameterOrder": [
  1419. // "name"
  1420. // ],
  1421. // "parameters": {
  1422. // "name": {
  1423. // "description": "The resource name of the Folder to retrieve.\nMust be of the form `folders/{folder_id}`.",
  1424. // "location": "path",
  1425. // "pattern": "^folders/[^/]+$",
  1426. // "required": true,
  1427. // "type": "string"
  1428. // }
  1429. // },
  1430. // "path": "v2/{+name}",
  1431. // "response": {
  1432. // "$ref": "Folder"
  1433. // },
  1434. // "scopes": [
  1435. // "https://www.googleapis.com/auth/cloud-platform",
  1436. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1437. // ]
  1438. // }
  1439. }
  1440. // method id "cloudresourcemanager.folders.getIamPolicy":
  1441. type FoldersGetIamPolicyCall struct {
  1442. s *Service
  1443. resource string
  1444. getiampolicyrequest *GetIamPolicyRequest
  1445. urlParams_ gensupport.URLParams
  1446. ctx_ context.Context
  1447. header_ http.Header
  1448. }
  1449. // GetIamPolicy: Gets the access control policy for a Folder. The
  1450. // returned policy may be
  1451. // empty if no such policy or resource exists. The `resource` field
  1452. // should
  1453. // be the Folder's resource name, e.g. "folders/1234".
  1454. // The caller must have `resourcemanager.folders.getIamPolicy`
  1455. // permission
  1456. // on the identified folder.
  1457. func (r *FoldersService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *FoldersGetIamPolicyCall {
  1458. c := &FoldersGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1459. c.resource = resource
  1460. c.getiampolicyrequest = getiampolicyrequest
  1461. return c
  1462. }
  1463. // Fields allows partial responses to be retrieved. See
  1464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1465. // for more information.
  1466. func (c *FoldersGetIamPolicyCall) Fields(s ...googleapi.Field) *FoldersGetIamPolicyCall {
  1467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1468. return c
  1469. }
  1470. // Context sets the context to be used in this call's Do method. Any
  1471. // pending HTTP request will be aborted if the provided context is
  1472. // canceled.
  1473. func (c *FoldersGetIamPolicyCall) Context(ctx context.Context) *FoldersGetIamPolicyCall {
  1474. c.ctx_ = ctx
  1475. return c
  1476. }
  1477. // Header returns an http.Header that can be modified by the caller to
  1478. // add HTTP headers to the request.
  1479. func (c *FoldersGetIamPolicyCall) Header() http.Header {
  1480. if c.header_ == nil {
  1481. c.header_ = make(http.Header)
  1482. }
  1483. return c.header_
  1484. }
  1485. func (c *FoldersGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1486. reqHeaders := make(http.Header)
  1487. for k, v := range c.header_ {
  1488. reqHeaders[k] = v
  1489. }
  1490. reqHeaders.Set("User-Agent", c.s.userAgent())
  1491. var body io.Reader = nil
  1492. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  1493. if err != nil {
  1494. return nil, err
  1495. }
  1496. reqHeaders.Set("Content-Type", "application/json")
  1497. c.urlParams_.Set("alt", alt)
  1498. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:getIamPolicy")
  1499. urls += "?" + c.urlParams_.Encode()
  1500. req, _ := http.NewRequest("POST", urls, body)
  1501. req.Header = reqHeaders
  1502. googleapi.Expand(req.URL, map[string]string{
  1503. "resource": c.resource,
  1504. })
  1505. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1506. }
  1507. // Do executes the "cloudresourcemanager.folders.getIamPolicy" call.
  1508. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1509. // code is an error. Response headers are in either
  1510. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1511. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1512. // check whether the returned error was because http.StatusNotModified
  1513. // was returned.
  1514. func (c *FoldersGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1515. gensupport.SetOptions(c.urlParams_, opts...)
  1516. res, err := c.doRequest("json")
  1517. if res != nil && res.StatusCode == http.StatusNotModified {
  1518. if res.Body != nil {
  1519. res.Body.Close()
  1520. }
  1521. return nil, &googleapi.Error{
  1522. Code: res.StatusCode,
  1523. Header: res.Header,
  1524. }
  1525. }
  1526. if err != nil {
  1527. return nil, err
  1528. }
  1529. defer googleapi.CloseBody(res)
  1530. if err := googleapi.CheckResponse(res); err != nil {
  1531. return nil, err
  1532. }
  1533. ret := &Policy{
  1534. ServerResponse: googleapi.ServerResponse{
  1535. Header: res.Header,
  1536. HTTPStatusCode: res.StatusCode,
  1537. },
  1538. }
  1539. target := &ret
  1540. if err := gensupport.DecodeResponse(target, res); err != nil {
  1541. return nil, err
  1542. }
  1543. return ret, nil
  1544. // {
  1545. // "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.",
  1546. // "flatPath": "v2/folders/{foldersId}:getIamPolicy",
  1547. // "httpMethod": "POST",
  1548. // "id": "cloudresourcemanager.folders.getIamPolicy",
  1549. // "parameterOrder": [
  1550. // "resource"
  1551. // ],
  1552. // "parameters": {
  1553. // "resource": {
  1554. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1555. // "location": "path",
  1556. // "pattern": "^folders/[^/]+$",
  1557. // "required": true,
  1558. // "type": "string"
  1559. // }
  1560. // },
  1561. // "path": "v2/{+resource}:getIamPolicy",
  1562. // "request": {
  1563. // "$ref": "GetIamPolicyRequest"
  1564. // },
  1565. // "response": {
  1566. // "$ref": "Policy"
  1567. // },
  1568. // "scopes": [
  1569. // "https://www.googleapis.com/auth/cloud-platform",
  1570. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1571. // ]
  1572. // }
  1573. }
  1574. // method id "cloudresourcemanager.folders.list":
  1575. type FoldersListCall struct {
  1576. s *Service
  1577. urlParams_ gensupport.URLParams
  1578. ifNoneMatch_ string
  1579. ctx_ context.Context
  1580. header_ http.Header
  1581. }
  1582. // List: Lists the Folders that are direct descendants of supplied
  1583. // parent resource.
  1584. // List provides a strongly consistent view of the Folders
  1585. // underneath
  1586. // the specified parent resource.
  1587. // List returns Folders sorted based upon the (ascending) lexical
  1588. // ordering
  1589. // of their display_name.
  1590. // The caller must have `resourcemanager.folders.list` permission on
  1591. // the
  1592. // identified parent.
  1593. func (r *FoldersService) List() *FoldersListCall {
  1594. c := &FoldersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1595. return c
  1596. }
  1597. // PageSize sets the optional parameter "pageSize": The maximum number
  1598. // of Folders to return in the response.
  1599. // This field is optional.
  1600. func (c *FoldersListCall) PageSize(pageSize int64) *FoldersListCall {
  1601. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1602. return c
  1603. }
  1604. // PageToken sets the optional parameter "pageToken": A pagination token
  1605. // returned from a previous call to `ListFolders`
  1606. // that indicates where this listing should continue from.
  1607. // This field is optional.
  1608. func (c *FoldersListCall) PageToken(pageToken string) *FoldersListCall {
  1609. c.urlParams_.Set("pageToken", pageToken)
  1610. return c
  1611. }
  1612. // Parent sets the optional parameter "parent": The resource name of the
  1613. // Organization or Folder whose Folders are
  1614. // being listed.
  1615. // Must be of the form `folders/{folder_id}` or
  1616. // `organizations/{org_id}`.
  1617. // Access to this method is controlled by checking
  1618. // the
  1619. // `resourcemanager.folders.list` permission on the `parent`.
  1620. func (c *FoldersListCall) Parent(parent string) *FoldersListCall {
  1621. c.urlParams_.Set("parent", parent)
  1622. return c
  1623. }
  1624. // ShowDeleted sets the optional parameter "showDeleted": Controls
  1625. // whether Folders in the
  1626. // DELETE_REQUESTED
  1627. // state should be returned. Defaults to false. This field is optional.
  1628. func (c *FoldersListCall) ShowDeleted(showDeleted bool) *FoldersListCall {
  1629. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  1630. return c
  1631. }
  1632. // Fields allows partial responses to be retrieved. See
  1633. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1634. // for more information.
  1635. func (c *FoldersListCall) Fields(s ...googleapi.Field) *FoldersListCall {
  1636. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1637. return c
  1638. }
  1639. // IfNoneMatch sets the optional parameter which makes the operation
  1640. // fail if the object's ETag matches the given value. This is useful for
  1641. // getting updates only after the object has changed since the last
  1642. // request. Use googleapi.IsNotModified to check whether the response
  1643. // error from Do is the result of In-None-Match.
  1644. func (c *FoldersListCall) IfNoneMatch(entityTag string) *FoldersListCall {
  1645. c.ifNoneMatch_ = entityTag
  1646. return c
  1647. }
  1648. // Context sets the context to be used in this call's Do method. Any
  1649. // pending HTTP request will be aborted if the provided context is
  1650. // canceled.
  1651. func (c *FoldersListCall) Context(ctx context.Context) *FoldersListCall {
  1652. c.ctx_ = ctx
  1653. return c
  1654. }
  1655. // Header returns an http.Header that can be modified by the caller to
  1656. // add HTTP headers to the request.
  1657. func (c *FoldersListCall) Header() http.Header {
  1658. if c.header_ == nil {
  1659. c.header_ = make(http.Header)
  1660. }
  1661. return c.header_
  1662. }
  1663. func (c *FoldersListCall) doRequest(alt string) (*http.Response, error) {
  1664. reqHeaders := make(http.Header)
  1665. for k, v := range c.header_ {
  1666. reqHeaders[k] = v
  1667. }
  1668. reqHeaders.Set("User-Agent", c.s.userAgent())
  1669. if c.ifNoneMatch_ != "" {
  1670. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1671. }
  1672. var body io.Reader = nil
  1673. c.urlParams_.Set("alt", alt)
  1674. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders")
  1675. urls += "?" + c.urlParams_.Encode()
  1676. req, _ := http.NewRequest("GET", urls, body)
  1677. req.Header = reqHeaders
  1678. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1679. }
  1680. // Do executes the "cloudresourcemanager.folders.list" call.
  1681. // Exactly one of *ListFoldersResponse or error will be non-nil. Any
  1682. // non-2xx status code is an error. Response headers are in either
  1683. // *ListFoldersResponse.ServerResponse.Header or (if a response was
  1684. // returned at all) in error.(*googleapi.Error).Header. Use
  1685. // googleapi.IsNotModified to check whether the returned error was
  1686. // because http.StatusNotModified was returned.
  1687. func (c *FoldersListCall) Do(opts ...googleapi.CallOption) (*ListFoldersResponse, error) {
  1688. gensupport.SetOptions(c.urlParams_, opts...)
  1689. res, err := c.doRequest("json")
  1690. if res != nil && res.StatusCode == http.StatusNotModified {
  1691. if res.Body != nil {
  1692. res.Body.Close()
  1693. }
  1694. return nil, &googleapi.Error{
  1695. Code: res.StatusCode,
  1696. Header: res.Header,
  1697. }
  1698. }
  1699. if err != nil {
  1700. return nil, err
  1701. }
  1702. defer googleapi.CloseBody(res)
  1703. if err := googleapi.CheckResponse(res); err != nil {
  1704. return nil, err
  1705. }
  1706. ret := &ListFoldersResponse{
  1707. ServerResponse: googleapi.ServerResponse{
  1708. Header: res.Header,
  1709. HTTPStatusCode: res.StatusCode,
  1710. },
  1711. }
  1712. target := &ret
  1713. if err := gensupport.DecodeResponse(target, res); err != nil {
  1714. return nil, err
  1715. }
  1716. return ret, nil
  1717. // {
  1718. // "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.",
  1719. // "flatPath": "v2/folders",
  1720. // "httpMethod": "GET",
  1721. // "id": "cloudresourcemanager.folders.list",
  1722. // "parameterOrder": [],
  1723. // "parameters": {
  1724. // "pageSize": {
  1725. // "description": "The maximum number of Folders to return in the response.\nThis field is optional.",
  1726. // "format": "int32",
  1727. // "location": "query",
  1728. // "type": "integer"
  1729. // },
  1730. // "pageToken": {
  1731. // "description": "A pagination token returned from a previous call to `ListFolders`\nthat indicates where this listing should continue from.\nThis field is optional.",
  1732. // "location": "query",
  1733. // "type": "string"
  1734. // },
  1735. // "parent": {
  1736. // "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`.",
  1737. // "location": "query",
  1738. // "type": "string"
  1739. // },
  1740. // "showDeleted": {
  1741. // "description": "Controls whether Folders in the\nDELETE_REQUESTED\nstate should be returned. Defaults to false. This field is optional.",
  1742. // "location": "query",
  1743. // "type": "boolean"
  1744. // }
  1745. // },
  1746. // "path": "v2/folders",
  1747. // "response": {
  1748. // "$ref": "ListFoldersResponse"
  1749. // },
  1750. // "scopes": [
  1751. // "https://www.googleapis.com/auth/cloud-platform",
  1752. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1753. // ]
  1754. // }
  1755. }
  1756. // Pages invokes f for each page of results.
  1757. // A non-nil error returned from f will halt the iteration.
  1758. // The provided context supersedes any context provided to the Context method.
  1759. func (c *FoldersListCall) Pages(ctx context.Context, f func(*ListFoldersResponse) error) error {
  1760. c.ctx_ = ctx
  1761. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1762. for {
  1763. x, err := c.Do()
  1764. if err != nil {
  1765. return err
  1766. }
  1767. if err := f(x); err != nil {
  1768. return err
  1769. }
  1770. if x.NextPageToken == "" {
  1771. return nil
  1772. }
  1773. c.PageToken(x.NextPageToken)
  1774. }
  1775. }
  1776. // method id "cloudresourcemanager.folders.move":
  1777. type FoldersMoveCall struct {
  1778. s *Service
  1779. name string
  1780. movefolderrequest *MoveFolderRequest
  1781. urlParams_ gensupport.URLParams
  1782. ctx_ context.Context
  1783. header_ http.Header
  1784. }
  1785. // Move: Moves a Folder under a new resource parent.
  1786. // Returns an Operation which can be used to track the progress of
  1787. // the
  1788. // folder move workflow.
  1789. // Upon success the Operation.response field will be populated with
  1790. // the
  1791. // moved Folder.
  1792. // Upon failure, a FolderOperationError categorizing the failure cause
  1793. // will
  1794. // be returned - if the failure occurs synchronously then
  1795. // the
  1796. // FolderOperationError will be returned via the Status.details
  1797. // field
  1798. // and if it occurs asynchronously then the FolderOperation will be
  1799. // returned
  1800. // via the the Operation.error field.
  1801. // In addition, the Operation.metadata field will be populated with
  1802. // a
  1803. // FolderOperation message as an aid to stateless clients.
  1804. // Folder moves will be rejected if they violate either the naming,
  1805. // height
  1806. // or fanout constraints described in the
  1807. // CreateFolder documentation.
  1808. // The caller must have `resourcemanager.folders.move` permission on
  1809. // the
  1810. // folder's current and proposed new parent.
  1811. func (r *FoldersService) Move(name string, movefolderrequest *MoveFolderRequest) *FoldersMoveCall {
  1812. c := &FoldersMoveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1813. c.name = name
  1814. c.movefolderrequest = movefolderrequest
  1815. return c
  1816. }
  1817. // Fields allows partial responses to be retrieved. See
  1818. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1819. // for more information.
  1820. func (c *FoldersMoveCall) Fields(s ...googleapi.Field) *FoldersMoveCall {
  1821. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1822. return c
  1823. }
  1824. // Context sets the context to be used in this call's Do method. Any
  1825. // pending HTTP request will be aborted if the provided context is
  1826. // canceled.
  1827. func (c *FoldersMoveCall) Context(ctx context.Context) *FoldersMoveCall {
  1828. c.ctx_ = ctx
  1829. return c
  1830. }
  1831. // Header returns an http.Header that can be modified by the caller to
  1832. // add HTTP headers to the request.
  1833. func (c *FoldersMoveCall) Header() http.Header {
  1834. if c.header_ == nil {
  1835. c.header_ = make(http.Header)
  1836. }
  1837. return c.header_
  1838. }
  1839. func (c *FoldersMoveCall) doRequest(alt string) (*http.Response, error) {
  1840. reqHeaders := make(http.Header)
  1841. for k, v := range c.header_ {
  1842. reqHeaders[k] = v
  1843. }
  1844. reqHeaders.Set("User-Agent", c.s.userAgent())
  1845. var body io.Reader = nil
  1846. body, err := googleapi.WithoutDataWrapper.JSONReader(c.movefolderrequest)
  1847. if err != nil {
  1848. return nil, err
  1849. }
  1850. reqHeaders.Set("Content-Type", "application/json")
  1851. c.urlParams_.Set("alt", alt)
  1852. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:move")
  1853. urls += "?" + c.urlParams_.Encode()
  1854. req, _ := http.NewRequest("POST", urls, body)
  1855. req.Header = reqHeaders
  1856. googleapi.Expand(req.URL, map[string]string{
  1857. "name": c.name,
  1858. })
  1859. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1860. }
  1861. // Do executes the "cloudresourcemanager.folders.move" call.
  1862. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1863. // status code is an error. Response headers are in either
  1864. // *Operation.ServerResponse.Header or (if a response was returned at
  1865. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1866. // to check whether the returned error was because
  1867. // http.StatusNotModified was returned.
  1868. func (c *FoldersMoveCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1869. gensupport.SetOptions(c.urlParams_, opts...)
  1870. res, err := c.doRequest("json")
  1871. if res != nil && res.StatusCode == http.StatusNotModified {
  1872. if res.Body != nil {
  1873. res.Body.Close()
  1874. }
  1875. return nil, &googleapi.Error{
  1876. Code: res.StatusCode,
  1877. Header: res.Header,
  1878. }
  1879. }
  1880. if err != nil {
  1881. return nil, err
  1882. }
  1883. defer googleapi.CloseBody(res)
  1884. if err := googleapi.CheckResponse(res); err != nil {
  1885. return nil, err
  1886. }
  1887. ret := &Operation{
  1888. ServerResponse: googleapi.ServerResponse{
  1889. Header: res.Header,
  1890. HTTPStatusCode: res.StatusCode,
  1891. },
  1892. }
  1893. target := &ret
  1894. if err := gensupport.DecodeResponse(target, res); err != nil {
  1895. return nil, err
  1896. }
  1897. return ret, nil
  1898. // {
  1899. // "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.",
  1900. // "flatPath": "v2/folders/{foldersId}:move",
  1901. // "httpMethod": "POST",
  1902. // "id": "cloudresourcemanager.folders.move",
  1903. // "parameterOrder": [
  1904. // "name"
  1905. // ],
  1906. // "parameters": {
  1907. // "name": {
  1908. // "description": "The resource name of the Folder to move.\nMust be of the form folders/{folder_id}",
  1909. // "location": "path",
  1910. // "pattern": "^folders/[^/]+$",
  1911. // "required": true,
  1912. // "type": "string"
  1913. // }
  1914. // },
  1915. // "path": "v2/{+name}:move",
  1916. // "request": {
  1917. // "$ref": "MoveFolderRequest"
  1918. // },
  1919. // "response": {
  1920. // "$ref": "Operation"
  1921. // },
  1922. // "scopes": [
  1923. // "https://www.googleapis.com/auth/cloud-platform"
  1924. // ]
  1925. // }
  1926. }
  1927. // method id "cloudresourcemanager.folders.patch":
  1928. type FoldersPatchCall struct {
  1929. s *Service
  1930. name string
  1931. folder *Folder
  1932. urlParams_ gensupport.URLParams
  1933. ctx_ context.Context
  1934. header_ http.Header
  1935. }
  1936. // Patch: Updates a Folder, changing its display_name.
  1937. // Changes to the folder display_name will be rejected if they violate
  1938. // either
  1939. // the display_name formatting rules or naming constraints described
  1940. // in
  1941. // the CreateFolder documentation.
  1942. //
  1943. // The Folder's display name must start and end with a letter or
  1944. // digit,
  1945. // may contain letters, digits, spaces, hyphens and underscores and can
  1946. // be
  1947. // no longer than 30 characters. This is captured by the regular
  1948. // expression:
  1949. // [\p{L}\p{N}]({\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?.
  1950. // The caller must have `resourcemanager.folders.update` permission on
  1951. // the
  1952. // identified folder.
  1953. //
  1954. // If the update fails due to the unique name constraint then
  1955. // a
  1956. // PreconditionFailure explaining this violation will be returned
  1957. // in the Status.details field.
  1958. func (r *FoldersService) Patch(name string, folder *Folder) *FoldersPatchCall {
  1959. c := &FoldersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1960. c.name = name
  1961. c.folder = folder
  1962. return c
  1963. }
  1964. // UpdateMask sets the optional parameter "updateMask": Fields to be
  1965. // updated.
  1966. // Only the `display_name` can be updated.
  1967. func (c *FoldersPatchCall) UpdateMask(updateMask string) *FoldersPatchCall {
  1968. c.urlParams_.Set("updateMask", updateMask)
  1969. return c
  1970. }
  1971. // Fields allows partial responses to be retrieved. See
  1972. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1973. // for more information.
  1974. func (c *FoldersPatchCall) Fields(s ...googleapi.Field) *FoldersPatchCall {
  1975. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1976. return c
  1977. }
  1978. // Context sets the context to be used in this call's Do method. Any
  1979. // pending HTTP request will be aborted if the provided context is
  1980. // canceled.
  1981. func (c *FoldersPatchCall) Context(ctx context.Context) *FoldersPatchCall {
  1982. c.ctx_ = ctx
  1983. return c
  1984. }
  1985. // Header returns an http.Header that can be modified by the caller to
  1986. // add HTTP headers to the request.
  1987. func (c *FoldersPatchCall) Header() http.Header {
  1988. if c.header_ == nil {
  1989. c.header_ = make(http.Header)
  1990. }
  1991. return c.header_
  1992. }
  1993. func (c *FoldersPatchCall) doRequest(alt string) (*http.Response, error) {
  1994. reqHeaders := make(http.Header)
  1995. for k, v := range c.header_ {
  1996. reqHeaders[k] = v
  1997. }
  1998. reqHeaders.Set("User-Agent", c.s.userAgent())
  1999. var body io.Reader = nil
  2000. body, err := googleapi.WithoutDataWrapper.JSONReader(c.folder)
  2001. if err != nil {
  2002. return nil, err
  2003. }
  2004. reqHeaders.Set("Content-Type", "application/json")
  2005. c.urlParams_.Set("alt", alt)
  2006. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  2007. urls += "?" + c.urlParams_.Encode()
  2008. req, _ := http.NewRequest("PATCH", urls, body)
  2009. req.Header = reqHeaders
  2010. googleapi.Expand(req.URL, map[string]string{
  2011. "name": c.name,
  2012. })
  2013. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2014. }
  2015. // Do executes the "cloudresourcemanager.folders.patch" call.
  2016. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  2017. // code is an error. Response headers are in either
  2018. // *Folder.ServerResponse.Header or (if a response was returned at all)
  2019. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2020. // check whether the returned error was because http.StatusNotModified
  2021. // was returned.
  2022. func (c *FoldersPatchCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  2023. gensupport.SetOptions(c.urlParams_, opts...)
  2024. res, err := c.doRequest("json")
  2025. if res != nil && res.StatusCode == http.StatusNotModified {
  2026. if res.Body != nil {
  2027. res.Body.Close()
  2028. }
  2029. return nil, &googleapi.Error{
  2030. Code: res.StatusCode,
  2031. Header: res.Header,
  2032. }
  2033. }
  2034. if err != nil {
  2035. return nil, err
  2036. }
  2037. defer googleapi.CloseBody(res)
  2038. if err := googleapi.CheckResponse(res); err != nil {
  2039. return nil, err
  2040. }
  2041. ret := &Folder{
  2042. ServerResponse: googleapi.ServerResponse{
  2043. Header: res.Header,
  2044. HTTPStatusCode: res.StatusCode,
  2045. },
  2046. }
  2047. target := &ret
  2048. if err := gensupport.DecodeResponse(target, res); err != nil {
  2049. return nil, err
  2050. }
  2051. return ret, nil
  2052. // {
  2053. // "description": "Updates a Folder, changing its display_name.\nChanges to the folder display_name will be rejected if they violate either\nthe display_name formatting rules or naming constraints described in\nthe CreateFolder documentation.\n\nThe Folder's display name must start and end with a letter or digit,\nmay contain letters, digits, spaces, hyphens and underscores and can be\nno longer than 30 characters. This is captured by the regular expression:\n[\\p{L}\\p{N}]({\\p{L}\\p{N}_- ]{0,28}[\\p{L}\\p{N}])?.\nThe caller must have `resourcemanager.folders.update` permission on the\nidentified folder.\n\nIf the update fails due to the unique name constraint then a\nPreconditionFailure explaining this violation will be returned\nin the Status.details field.",
  2054. // "flatPath": "v2/folders/{foldersId}",
  2055. // "httpMethod": "PATCH",
  2056. // "id": "cloudresourcemanager.folders.patch",
  2057. // "parameterOrder": [
  2058. // "name"
  2059. // ],
  2060. // "parameters": {
  2061. // "name": {
  2062. // "description": "Output only. The resource name of the Folder.\nIts format is `folders/{folder_id}`, for example: \"folders/1234\".",
  2063. // "location": "path",
  2064. // "pattern": "^folders/[^/]+$",
  2065. // "required": true,
  2066. // "type": "string"
  2067. // },
  2068. // "updateMask": {
  2069. // "description": "Fields to be updated.\nOnly the `display_name` can be updated.",
  2070. // "format": "google-fieldmask",
  2071. // "location": "query",
  2072. // "type": "string"
  2073. // }
  2074. // },
  2075. // "path": "v2/{+name}",
  2076. // "request": {
  2077. // "$ref": "Folder"
  2078. // },
  2079. // "response": {
  2080. // "$ref": "Folder"
  2081. // },
  2082. // "scopes": [
  2083. // "https://www.googleapis.com/auth/cloud-platform"
  2084. // ]
  2085. // }
  2086. }
  2087. // method id "cloudresourcemanager.folders.search":
  2088. type FoldersSearchCall struct {
  2089. s *Service
  2090. searchfoldersrequest *SearchFoldersRequest
  2091. urlParams_ gensupport.URLParams
  2092. ctx_ context.Context
  2093. header_ http.Header
  2094. }
  2095. // Search: Search for folders that match specific filter
  2096. // criteria.
  2097. // Search provides an eventually consistent view of the folders a user
  2098. // has
  2099. // access to which meet the specified filter criteria.
  2100. //
  2101. // This will only return folders on which the caller has the
  2102. // permission `resourcemanager.folders.get`.
  2103. func (r *FoldersService) Search(searchfoldersrequest *SearchFoldersRequest) *FoldersSearchCall {
  2104. c := &FoldersSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2105. c.searchfoldersrequest = searchfoldersrequest
  2106. return c
  2107. }
  2108. // Fields allows partial responses to be retrieved. See
  2109. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2110. // for more information.
  2111. func (c *FoldersSearchCall) Fields(s ...googleapi.Field) *FoldersSearchCall {
  2112. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2113. return c
  2114. }
  2115. // Context sets the context to be used in this call's Do method. Any
  2116. // pending HTTP request will be aborted if the provided context is
  2117. // canceled.
  2118. func (c *FoldersSearchCall) Context(ctx context.Context) *FoldersSearchCall {
  2119. c.ctx_ = ctx
  2120. return c
  2121. }
  2122. // Header returns an http.Header that can be modified by the caller to
  2123. // add HTTP headers to the request.
  2124. func (c *FoldersSearchCall) Header() http.Header {
  2125. if c.header_ == nil {
  2126. c.header_ = make(http.Header)
  2127. }
  2128. return c.header_
  2129. }
  2130. func (c *FoldersSearchCall) doRequest(alt string) (*http.Response, error) {
  2131. reqHeaders := make(http.Header)
  2132. for k, v := range c.header_ {
  2133. reqHeaders[k] = v
  2134. }
  2135. reqHeaders.Set("User-Agent", c.s.userAgent())
  2136. var body io.Reader = nil
  2137. body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchfoldersrequest)
  2138. if err != nil {
  2139. return nil, err
  2140. }
  2141. reqHeaders.Set("Content-Type", "application/json")
  2142. c.urlParams_.Set("alt", alt)
  2143. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders:search")
  2144. urls += "?" + c.urlParams_.Encode()
  2145. req, _ := http.NewRequest("POST", urls, body)
  2146. req.Header = reqHeaders
  2147. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2148. }
  2149. // Do executes the "cloudresourcemanager.folders.search" call.
  2150. // Exactly one of *SearchFoldersResponse or error will be non-nil. Any
  2151. // non-2xx status code is an error. Response headers are in either
  2152. // *SearchFoldersResponse.ServerResponse.Header or (if a response was
  2153. // returned at all) in error.(*googleapi.Error).Header. Use
  2154. // googleapi.IsNotModified to check whether the returned error was
  2155. // because http.StatusNotModified was returned.
  2156. func (c *FoldersSearchCall) Do(opts ...googleapi.CallOption) (*SearchFoldersResponse, error) {
  2157. gensupport.SetOptions(c.urlParams_, opts...)
  2158. res, err := c.doRequest("json")
  2159. if res != nil && res.StatusCode == http.StatusNotModified {
  2160. if res.Body != nil {
  2161. res.Body.Close()
  2162. }
  2163. return nil, &googleapi.Error{
  2164. Code: res.StatusCode,
  2165. Header: res.Header,
  2166. }
  2167. }
  2168. if err != nil {
  2169. return nil, err
  2170. }
  2171. defer googleapi.CloseBody(res)
  2172. if err := googleapi.CheckResponse(res); err != nil {
  2173. return nil, err
  2174. }
  2175. ret := &SearchFoldersResponse{
  2176. ServerResponse: googleapi.ServerResponse{
  2177. Header: res.Header,
  2178. HTTPStatusCode: res.StatusCode,
  2179. },
  2180. }
  2181. target := &ret
  2182. if err := gensupport.DecodeResponse(target, res); err != nil {
  2183. return nil, err
  2184. }
  2185. return ret, nil
  2186. // {
  2187. // "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`.",
  2188. // "flatPath": "v2/folders:search",
  2189. // "httpMethod": "POST",
  2190. // "id": "cloudresourcemanager.folders.search",
  2191. // "parameterOrder": [],
  2192. // "parameters": {},
  2193. // "path": "v2/folders:search",
  2194. // "request": {
  2195. // "$ref": "SearchFoldersRequest"
  2196. // },
  2197. // "response": {
  2198. // "$ref": "SearchFoldersResponse"
  2199. // },
  2200. // "scopes": [
  2201. // "https://www.googleapis.com/auth/cloud-platform",
  2202. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2203. // ]
  2204. // }
  2205. }
  2206. // Pages invokes f for each page of results.
  2207. // A non-nil error returned from f will halt the iteration.
  2208. // The provided context supersedes any context provided to the Context method.
  2209. func (c *FoldersSearchCall) Pages(ctx context.Context, f func(*SearchFoldersResponse) error) error {
  2210. c.ctx_ = ctx
  2211. defer func(pt string) { c.searchfoldersrequest.PageToken = pt }(c.searchfoldersrequest.PageToken) // reset paging to original point
  2212. for {
  2213. x, err := c.Do()
  2214. if err != nil {
  2215. return err
  2216. }
  2217. if err := f(x); err != nil {
  2218. return err
  2219. }
  2220. if x.NextPageToken == "" {
  2221. return nil
  2222. }
  2223. c.searchfoldersrequest.PageToken = x.NextPageToken
  2224. }
  2225. }
  2226. // method id "cloudresourcemanager.folders.setIamPolicy":
  2227. type FoldersSetIamPolicyCall struct {
  2228. s *Service
  2229. resource string
  2230. setiampolicyrequest *SetIamPolicyRequest
  2231. urlParams_ gensupport.URLParams
  2232. ctx_ context.Context
  2233. header_ http.Header
  2234. }
  2235. // SetIamPolicy: Sets the access control policy on a Folder, replacing
  2236. // any existing policy.
  2237. // The `resource` field should be the Folder's resource name,
  2238. // e.g.
  2239. // "folders/1234".
  2240. // The caller must have `resourcemanager.folders.setIamPolicy`
  2241. // permission
  2242. // on the identified folder.
  2243. func (r *FoldersService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *FoldersSetIamPolicyCall {
  2244. c := &FoldersSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2245. c.resource = resource
  2246. c.setiampolicyrequest = setiampolicyrequest
  2247. return c
  2248. }
  2249. // Fields allows partial responses to be retrieved. See
  2250. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2251. // for more information.
  2252. func (c *FoldersSetIamPolicyCall) Fields(s ...googleapi.Field) *FoldersSetIamPolicyCall {
  2253. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2254. return c
  2255. }
  2256. // Context sets the context to be used in this call's Do method. Any
  2257. // pending HTTP request will be aborted if the provided context is
  2258. // canceled.
  2259. func (c *FoldersSetIamPolicyCall) Context(ctx context.Context) *FoldersSetIamPolicyCall {
  2260. c.ctx_ = ctx
  2261. return c
  2262. }
  2263. // Header returns an http.Header that can be modified by the caller to
  2264. // add HTTP headers to the request.
  2265. func (c *FoldersSetIamPolicyCall) Header() http.Header {
  2266. if c.header_ == nil {
  2267. c.header_ = make(http.Header)
  2268. }
  2269. return c.header_
  2270. }
  2271. func (c *FoldersSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2272. reqHeaders := make(http.Header)
  2273. for k, v := range c.header_ {
  2274. reqHeaders[k] = v
  2275. }
  2276. reqHeaders.Set("User-Agent", c.s.userAgent())
  2277. var body io.Reader = nil
  2278. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2279. if err != nil {
  2280. return nil, err
  2281. }
  2282. reqHeaders.Set("Content-Type", "application/json")
  2283. c.urlParams_.Set("alt", alt)
  2284. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:setIamPolicy")
  2285. urls += "?" + c.urlParams_.Encode()
  2286. req, _ := http.NewRequest("POST", urls, body)
  2287. req.Header = reqHeaders
  2288. googleapi.Expand(req.URL, map[string]string{
  2289. "resource": c.resource,
  2290. })
  2291. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2292. }
  2293. // Do executes the "cloudresourcemanager.folders.setIamPolicy" call.
  2294. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2295. // code is an error. Response headers are in either
  2296. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2297. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2298. // check whether the returned error was because http.StatusNotModified
  2299. // was returned.
  2300. func (c *FoldersSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2301. gensupport.SetOptions(c.urlParams_, opts...)
  2302. res, err := c.doRequest("json")
  2303. if res != nil && res.StatusCode == http.StatusNotModified {
  2304. if res.Body != nil {
  2305. res.Body.Close()
  2306. }
  2307. return nil, &googleapi.Error{
  2308. Code: res.StatusCode,
  2309. Header: res.Header,
  2310. }
  2311. }
  2312. if err != nil {
  2313. return nil, err
  2314. }
  2315. defer googleapi.CloseBody(res)
  2316. if err := googleapi.CheckResponse(res); err != nil {
  2317. return nil, err
  2318. }
  2319. ret := &Policy{
  2320. ServerResponse: googleapi.ServerResponse{
  2321. Header: res.Header,
  2322. HTTPStatusCode: res.StatusCode,
  2323. },
  2324. }
  2325. target := &ret
  2326. if err := gensupport.DecodeResponse(target, res); err != nil {
  2327. return nil, err
  2328. }
  2329. return ret, nil
  2330. // {
  2331. // "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.",
  2332. // "flatPath": "v2/folders/{foldersId}:setIamPolicy",
  2333. // "httpMethod": "POST",
  2334. // "id": "cloudresourcemanager.folders.setIamPolicy",
  2335. // "parameterOrder": [
  2336. // "resource"
  2337. // ],
  2338. // "parameters": {
  2339. // "resource": {
  2340. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2341. // "location": "path",
  2342. // "pattern": "^folders/[^/]+$",
  2343. // "required": true,
  2344. // "type": "string"
  2345. // }
  2346. // },
  2347. // "path": "v2/{+resource}:setIamPolicy",
  2348. // "request": {
  2349. // "$ref": "SetIamPolicyRequest"
  2350. // },
  2351. // "response": {
  2352. // "$ref": "Policy"
  2353. // },
  2354. // "scopes": [
  2355. // "https://www.googleapis.com/auth/cloud-platform"
  2356. // ]
  2357. // }
  2358. }
  2359. // method id "cloudresourcemanager.folders.testIamPermissions":
  2360. type FoldersTestIamPermissionsCall struct {
  2361. s *Service
  2362. resource string
  2363. testiampermissionsrequest *TestIamPermissionsRequest
  2364. urlParams_ gensupport.URLParams
  2365. ctx_ context.Context
  2366. header_ http.Header
  2367. }
  2368. // TestIamPermissions: Returns permissions that a caller has on the
  2369. // specified Folder.
  2370. // The `resource` field should be the Folder's resource name,
  2371. // e.g. "folders/1234".
  2372. //
  2373. // There are no permissions required for making this API call.
  2374. func (r *FoldersService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *FoldersTestIamPermissionsCall {
  2375. c := &FoldersTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2376. c.resource = resource
  2377. c.testiampermissionsrequest = testiampermissionsrequest
  2378. return c
  2379. }
  2380. // Fields allows partial responses to be retrieved. See
  2381. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2382. // for more information.
  2383. func (c *FoldersTestIamPermissionsCall) Fields(s ...googleapi.Field) *FoldersTestIamPermissionsCall {
  2384. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2385. return c
  2386. }
  2387. // Context sets the context to be used in this call's Do method. Any
  2388. // pending HTTP request will be aborted if the provided context is
  2389. // canceled.
  2390. func (c *FoldersTestIamPermissionsCall) Context(ctx context.Context) *FoldersTestIamPermissionsCall {
  2391. c.ctx_ = ctx
  2392. return c
  2393. }
  2394. // Header returns an http.Header that can be modified by the caller to
  2395. // add HTTP headers to the request.
  2396. func (c *FoldersTestIamPermissionsCall) Header() http.Header {
  2397. if c.header_ == nil {
  2398. c.header_ = make(http.Header)
  2399. }
  2400. return c.header_
  2401. }
  2402. func (c *FoldersTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2403. reqHeaders := make(http.Header)
  2404. for k, v := range c.header_ {
  2405. reqHeaders[k] = v
  2406. }
  2407. reqHeaders.Set("User-Agent", c.s.userAgent())
  2408. var body io.Reader = nil
  2409. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2410. if err != nil {
  2411. return nil, err
  2412. }
  2413. reqHeaders.Set("Content-Type", "application/json")
  2414. c.urlParams_.Set("alt", alt)
  2415. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:testIamPermissions")
  2416. urls += "?" + c.urlParams_.Encode()
  2417. req, _ := http.NewRequest("POST", urls, body)
  2418. req.Header = reqHeaders
  2419. googleapi.Expand(req.URL, map[string]string{
  2420. "resource": c.resource,
  2421. })
  2422. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2423. }
  2424. // Do executes the "cloudresourcemanager.folders.testIamPermissions" call.
  2425. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2426. // Any non-2xx status code is an error. Response headers are in either
  2427. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2428. // was returned at all) in error.(*googleapi.Error).Header. Use
  2429. // googleapi.IsNotModified to check whether the returned error was
  2430. // because http.StatusNotModified was returned.
  2431. func (c *FoldersTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2432. gensupport.SetOptions(c.urlParams_, opts...)
  2433. res, err := c.doRequest("json")
  2434. if res != nil && res.StatusCode == http.StatusNotModified {
  2435. if res.Body != nil {
  2436. res.Body.Close()
  2437. }
  2438. return nil, &googleapi.Error{
  2439. Code: res.StatusCode,
  2440. Header: res.Header,
  2441. }
  2442. }
  2443. if err != nil {
  2444. return nil, err
  2445. }
  2446. defer googleapi.CloseBody(res)
  2447. if err := googleapi.CheckResponse(res); err != nil {
  2448. return nil, err
  2449. }
  2450. ret := &TestIamPermissionsResponse{
  2451. ServerResponse: googleapi.ServerResponse{
  2452. Header: res.Header,
  2453. HTTPStatusCode: res.StatusCode,
  2454. },
  2455. }
  2456. target := &ret
  2457. if err := gensupport.DecodeResponse(target, res); err != nil {
  2458. return nil, err
  2459. }
  2460. return ret, nil
  2461. // {
  2462. // "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.",
  2463. // "flatPath": "v2/folders/{foldersId}:testIamPermissions",
  2464. // "httpMethod": "POST",
  2465. // "id": "cloudresourcemanager.folders.testIamPermissions",
  2466. // "parameterOrder": [
  2467. // "resource"
  2468. // ],
  2469. // "parameters": {
  2470. // "resource": {
  2471. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2472. // "location": "path",
  2473. // "pattern": "^folders/[^/]+$",
  2474. // "required": true,
  2475. // "type": "string"
  2476. // }
  2477. // },
  2478. // "path": "v2/{+resource}:testIamPermissions",
  2479. // "request": {
  2480. // "$ref": "TestIamPermissionsRequest"
  2481. // },
  2482. // "response": {
  2483. // "$ref": "TestIamPermissionsResponse"
  2484. // },
  2485. // "scopes": [
  2486. // "https://www.googleapis.com/auth/cloud-platform"
  2487. // ]
  2488. // }
  2489. }
  2490. // method id "cloudresourcemanager.folders.undelete":
  2491. type FoldersUndeleteCall struct {
  2492. s *Service
  2493. name string
  2494. undeletefolderrequest *UndeleteFolderRequest
  2495. urlParams_ gensupport.URLParams
  2496. ctx_ context.Context
  2497. header_ http.Header
  2498. }
  2499. // Undelete: Cancels the deletion request for a Folder. This method may
  2500. // only be
  2501. // called on a Folder in the
  2502. // DELETE_REQUESTED state.
  2503. // In order to succeed, the Folder's parent must be in the
  2504. // ACTIVE state.
  2505. // In addition, reintroducing the folder into the tree must not
  2506. // violate
  2507. // folder naming, height and fanout constraints described in
  2508. // the
  2509. // CreateFolder documentation.
  2510. // The caller must have `resourcemanager.folders.undelete` permission on
  2511. // the
  2512. // identified folder.
  2513. func (r *FoldersService) Undelete(name string, undeletefolderrequest *UndeleteFolderRequest) *FoldersUndeleteCall {
  2514. c := &FoldersUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2515. c.name = name
  2516. c.undeletefolderrequest = undeletefolderrequest
  2517. return c
  2518. }
  2519. // Fields allows partial responses to be retrieved. See
  2520. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2521. // for more information.
  2522. func (c *FoldersUndeleteCall) Fields(s ...googleapi.Field) *FoldersUndeleteCall {
  2523. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2524. return c
  2525. }
  2526. // Context sets the context to be used in this call's Do method. Any
  2527. // pending HTTP request will be aborted if the provided context is
  2528. // canceled.
  2529. func (c *FoldersUndeleteCall) Context(ctx context.Context) *FoldersUndeleteCall {
  2530. c.ctx_ = ctx
  2531. return c
  2532. }
  2533. // Header returns an http.Header that can be modified by the caller to
  2534. // add HTTP headers to the request.
  2535. func (c *FoldersUndeleteCall) Header() http.Header {
  2536. if c.header_ == nil {
  2537. c.header_ = make(http.Header)
  2538. }
  2539. return c.header_
  2540. }
  2541. func (c *FoldersUndeleteCall) doRequest(alt string) (*http.Response, error) {
  2542. reqHeaders := make(http.Header)
  2543. for k, v := range c.header_ {
  2544. reqHeaders[k] = v
  2545. }
  2546. reqHeaders.Set("User-Agent", c.s.userAgent())
  2547. var body io.Reader = nil
  2548. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeletefolderrequest)
  2549. if err != nil {
  2550. return nil, err
  2551. }
  2552. reqHeaders.Set("Content-Type", "application/json")
  2553. c.urlParams_.Set("alt", alt)
  2554. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:undelete")
  2555. urls += "?" + c.urlParams_.Encode()
  2556. req, _ := http.NewRequest("POST", urls, body)
  2557. req.Header = reqHeaders
  2558. googleapi.Expand(req.URL, map[string]string{
  2559. "name": c.name,
  2560. })
  2561. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2562. }
  2563. // Do executes the "cloudresourcemanager.folders.undelete" call.
  2564. // Exactly one of *Folder or error will be non-nil. Any non-2xx status
  2565. // code is an error. Response headers are in either
  2566. // *Folder.ServerResponse.Header or (if a response was returned at all)
  2567. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2568. // check whether the returned error was because http.StatusNotModified
  2569. // was returned.
  2570. func (c *FoldersUndeleteCall) Do(opts ...googleapi.CallOption) (*Folder, error) {
  2571. gensupport.SetOptions(c.urlParams_, opts...)
  2572. res, err := c.doRequest("json")
  2573. if res != nil && res.StatusCode == http.StatusNotModified {
  2574. if res.Body != nil {
  2575. res.Body.Close()
  2576. }
  2577. return nil, &googleapi.Error{
  2578. Code: res.StatusCode,
  2579. Header: res.Header,
  2580. }
  2581. }
  2582. if err != nil {
  2583. return nil, err
  2584. }
  2585. defer googleapi.CloseBody(res)
  2586. if err := googleapi.CheckResponse(res); err != nil {
  2587. return nil, err
  2588. }
  2589. ret := &Folder{
  2590. ServerResponse: googleapi.ServerResponse{
  2591. Header: res.Header,
  2592. HTTPStatusCode: res.StatusCode,
  2593. },
  2594. }
  2595. target := &ret
  2596. if err := gensupport.DecodeResponse(target, res); err != nil {
  2597. return nil, err
  2598. }
  2599. return ret, nil
  2600. // {
  2601. // "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.",
  2602. // "flatPath": "v2/folders/{foldersId}:undelete",
  2603. // "httpMethod": "POST",
  2604. // "id": "cloudresourcemanager.folders.undelete",
  2605. // "parameterOrder": [
  2606. // "name"
  2607. // ],
  2608. // "parameters": {
  2609. // "name": {
  2610. // "description": "The resource name of the Folder to undelete.\nMust be of the form `folders/{folder_id}`.",
  2611. // "location": "path",
  2612. // "pattern": "^folders/[^/]+$",
  2613. // "required": true,
  2614. // "type": "string"
  2615. // }
  2616. // },
  2617. // "path": "v2/{+name}:undelete",
  2618. // "request": {
  2619. // "$ref": "UndeleteFolderRequest"
  2620. // },
  2621. // "response": {
  2622. // "$ref": "Folder"
  2623. // },
  2624. // "scopes": [
  2625. // "https://www.googleapis.com/auth/cloud-platform"
  2626. // ]
  2627. // }
  2628. }