Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

8081 linhas
280 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/v1"
  8. // ...
  9. // cloudresourcemanagerService, err := cloudresourcemanager.New(oauthHttpClient)
  10. package cloudresourcemanager // import "google.golang.org/api/cloudresourcemanager/v1"
  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:v1"
  41. const apiName = "cloudresourcemanager"
  42. const apiVersion = "v1"
  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. s.Liens = NewLiensService(s)
  58. s.Operations = NewOperationsService(s)
  59. s.Organizations = NewOrganizationsService(s)
  60. s.Projects = NewProjectsService(s)
  61. return s, nil
  62. }
  63. type Service struct {
  64. client *http.Client
  65. BasePath string // API endpoint base URL
  66. UserAgent string // optional additional User-Agent fragment
  67. Folders *FoldersService
  68. Liens *LiensService
  69. Operations *OperationsService
  70. Organizations *OrganizationsService
  71. Projects *ProjectsService
  72. }
  73. func (s *Service) userAgent() string {
  74. if s.UserAgent == "" {
  75. return googleapi.UserAgent
  76. }
  77. return googleapi.UserAgent + " " + s.UserAgent
  78. }
  79. func NewFoldersService(s *Service) *FoldersService {
  80. rs := &FoldersService{s: s}
  81. return rs
  82. }
  83. type FoldersService struct {
  84. s *Service
  85. }
  86. func NewLiensService(s *Service) *LiensService {
  87. rs := &LiensService{s: s}
  88. return rs
  89. }
  90. type LiensService struct {
  91. s *Service
  92. }
  93. func NewOperationsService(s *Service) *OperationsService {
  94. rs := &OperationsService{s: s}
  95. return rs
  96. }
  97. type OperationsService struct {
  98. s *Service
  99. }
  100. func NewOrganizationsService(s *Service) *OrganizationsService {
  101. rs := &OrganizationsService{s: s}
  102. return rs
  103. }
  104. type OrganizationsService struct {
  105. s *Service
  106. }
  107. func NewProjectsService(s *Service) *ProjectsService {
  108. rs := &ProjectsService{s: s}
  109. return rs
  110. }
  111. type ProjectsService struct {
  112. s *Service
  113. }
  114. // Ancestor: Identifying information for a single ancestor of a project.
  115. type Ancestor struct {
  116. // ResourceId: Resource id of the ancestor.
  117. ResourceId *ResourceId `json:"resourceId,omitempty"`
  118. // ForceSendFields is a list of field names (e.g. "ResourceId") to
  119. // unconditionally include in API requests. By default, fields with
  120. // empty values are omitted from API requests. However, any non-pointer,
  121. // non-interface field appearing in ForceSendFields will be sent to the
  122. // server regardless of whether the field is empty or not. This may be
  123. // used to include empty fields in Patch requests.
  124. ForceSendFields []string `json:"-"`
  125. // NullFields is a list of field names (e.g. "ResourceId") to include in
  126. // API requests with the JSON null value. By default, fields with empty
  127. // values are omitted from API requests. However, any field with an
  128. // empty value appearing in NullFields will be sent to the server as
  129. // null. It is an error if a field in this list has a non-empty value.
  130. // This may be used to include null fields in Patch requests.
  131. NullFields []string `json:"-"`
  132. }
  133. func (s *Ancestor) MarshalJSON() ([]byte, error) {
  134. type NoMethod Ancestor
  135. raw := NoMethod(*s)
  136. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  137. }
  138. // AuditConfig: Specifies the audit configuration for a service.
  139. // The configuration determines which permission types are logged, and
  140. // what
  141. // identities, if any, are exempted from logging.
  142. // An AuditConfig must have one or more AuditLogConfigs.
  143. //
  144. // If there are AuditConfigs for both `allServices` and a specific
  145. // service,
  146. // the union of the two AuditConfigs is used for that service: the
  147. // log_types
  148. // specified in each AuditConfig are enabled, and the exempted_members
  149. // in each
  150. // AuditLogConfig are exempted.
  151. //
  152. // Example Policy with multiple AuditConfigs:
  153. //
  154. // {
  155. // "audit_configs": [
  156. // {
  157. // "service": "allServices"
  158. // "audit_log_configs": [
  159. // {
  160. // "log_type": "DATA_READ",
  161. // "exempted_members": [
  162. // "user:foo@gmail.com"
  163. // ]
  164. // },
  165. // {
  166. // "log_type": "DATA_WRITE",
  167. // },
  168. // {
  169. // "log_type": "ADMIN_READ",
  170. // }
  171. // ]
  172. // },
  173. // {
  174. // "service": "fooservice.googleapis.com"
  175. // "audit_log_configs": [
  176. // {
  177. // "log_type": "DATA_READ",
  178. // },
  179. // {
  180. // "log_type": "DATA_WRITE",
  181. // "exempted_members": [
  182. // "user:bar@gmail.com"
  183. // ]
  184. // }
  185. // ]
  186. // }
  187. // ]
  188. // }
  189. //
  190. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  191. // ADMIN_READ
  192. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  193. // and
  194. // bar@gmail.com from DATA_WRITE logging.
  195. type AuditConfig struct {
  196. // AuditLogConfigs: The configuration for logging of each type of
  197. // permission.
  198. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  199. // Service: Specifies a service that will be enabled for audit
  200. // logging.
  201. // For example, `storage.googleapis.com`,
  202. // `cloudsql.googleapis.com`.
  203. // `allServices` is a special value that covers all services.
  204. Service string `json:"service,omitempty"`
  205. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  206. // unconditionally include in API requests. By default, fields with
  207. // empty values are omitted from API requests. However, any non-pointer,
  208. // non-interface field appearing in ForceSendFields will be sent to the
  209. // server regardless of whether the field is empty or not. This may be
  210. // used to include empty fields in Patch requests.
  211. ForceSendFields []string `json:"-"`
  212. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  213. // include in API requests with the JSON null value. By default, fields
  214. // with empty values are omitted from API requests. However, any field
  215. // with an empty value appearing in NullFields will be sent to the
  216. // server as null. It is an error if a field in this list has a
  217. // non-empty value. This may be used to include null fields in Patch
  218. // requests.
  219. NullFields []string `json:"-"`
  220. }
  221. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  222. type NoMethod AuditConfig
  223. raw := NoMethod(*s)
  224. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  225. }
  226. // AuditLogConfig: Provides the configuration for logging a type of
  227. // permissions.
  228. // Example:
  229. //
  230. // {
  231. // "audit_log_configs": [
  232. // {
  233. // "log_type": "DATA_READ",
  234. // "exempted_members": [
  235. // "user:foo@gmail.com"
  236. // ]
  237. // },
  238. // {
  239. // "log_type": "DATA_WRITE",
  240. // }
  241. // ]
  242. // }
  243. //
  244. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  245. // exempting
  246. // foo@gmail.com from DATA_READ logging.
  247. type AuditLogConfig struct {
  248. // ExemptedMembers: Specifies the identities that do not cause logging
  249. // for this type of
  250. // permission.
  251. // Follows the same format of Binding.members.
  252. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  253. // LogType: The log type that this config enables.
  254. //
  255. // Possible values:
  256. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  257. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  258. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  259. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  260. LogType string `json:"logType,omitempty"`
  261. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  262. // unconditionally include in API requests. By default, fields with
  263. // empty values are omitted from API requests. However, any non-pointer,
  264. // non-interface field appearing in ForceSendFields will be sent to the
  265. // server regardless of whether the field is empty or not. This may be
  266. // used to include empty fields in Patch requests.
  267. ForceSendFields []string `json:"-"`
  268. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  269. // include in API requests with the JSON null value. By default, fields
  270. // with empty values are omitted from API requests. However, any field
  271. // with an empty value appearing in NullFields will be sent to the
  272. // server as null. It is an error if a field in this list has a
  273. // non-empty value. This may be used to include null fields in Patch
  274. // requests.
  275. NullFields []string `json:"-"`
  276. }
  277. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  278. type NoMethod AuditLogConfig
  279. raw := NoMethod(*s)
  280. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  281. }
  282. // Binding: Associates `members` with a `role`.
  283. type Binding struct {
  284. // Members: Specifies the identities requesting access for a Cloud
  285. // Platform resource.
  286. // `members` can have the following values:
  287. //
  288. // * `allUsers`: A special identifier that represents anyone who is
  289. // on the internet; with or without a Google account.
  290. //
  291. // * `allAuthenticatedUsers`: A special identifier that represents
  292. // anyone
  293. // who is authenticated with a Google account or a service
  294. // account.
  295. //
  296. // * `user:{emailid}`: An email address that represents a specific
  297. // Google
  298. // account. For example, `alice@gmail.com` .
  299. //
  300. //
  301. // * `serviceAccount:{emailid}`: An email address that represents a
  302. // service
  303. // account. For example,
  304. // `my-other-app@appspot.gserviceaccount.com`.
  305. //
  306. // * `group:{emailid}`: An email address that represents a Google
  307. // group.
  308. // For example, `admins@example.com`.
  309. //
  310. //
  311. // * `domain:{domain}`: A Google Apps domain name that represents all
  312. // the
  313. // users of that domain. For example, `google.com` or
  314. // `example.com`.
  315. //
  316. //
  317. Members []string `json:"members,omitempty"`
  318. // Role: Role that is assigned to `members`.
  319. // For example, `roles/viewer`, `roles/editor`, or
  320. // `roles/owner`.
  321. // Required
  322. Role string `json:"role,omitempty"`
  323. // ForceSendFields is a list of field names (e.g. "Members") to
  324. // unconditionally include in API requests. By default, fields with
  325. // empty values are omitted from API requests. However, any non-pointer,
  326. // non-interface field appearing in ForceSendFields will be sent to the
  327. // server regardless of whether the field is empty or not. This may be
  328. // used to include empty fields in Patch requests.
  329. ForceSendFields []string `json:"-"`
  330. // NullFields is a list of field names (e.g. "Members") to include in
  331. // API requests with the JSON null value. By default, fields with empty
  332. // values are omitted from API requests. However, any field with an
  333. // empty value appearing in NullFields will be sent to the server as
  334. // null. It is an error if a field in this list has a non-empty value.
  335. // This may be used to include null fields in Patch requests.
  336. NullFields []string `json:"-"`
  337. }
  338. func (s *Binding) MarshalJSON() ([]byte, error) {
  339. type NoMethod Binding
  340. raw := NoMethod(*s)
  341. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  342. }
  343. // BooleanConstraint: A `Constraint` that is either enforced or
  344. // not.
  345. //
  346. // For example a constraint
  347. // `constraints/compute.disableSerialPortAccess`.
  348. // If it is enforced on a VM instance, serial port connections will not
  349. // be
  350. // opened to that instance.
  351. type BooleanConstraint struct {
  352. }
  353. // BooleanPolicy: Used in `policy_type` to specify how `boolean_policy`
  354. // will behave at this
  355. // resource.
  356. type BooleanPolicy struct {
  357. // Enforced: If `true`, then the `Policy` is enforced. If `false`, then
  358. // any
  359. // configuration is acceptable.
  360. //
  361. // Suppose you have a `Constraint`
  362. // `constraints/compute.disableSerialPortAccess`
  363. // with `constraint_default` set to `ALLOW`. A `Policy` for
  364. // that
  365. // `Constraint` exhibits the following behavior:
  366. // - If the `Policy` at this resource has enforced set to `false`,
  367. // serial
  368. // port connection attempts will be allowed.
  369. // - If the `Policy` at this resource has enforced set to `true`,
  370. // serial
  371. // port connection attempts will be refused.
  372. // - If the `Policy` at this resource is `RestoreDefault`, serial
  373. // port
  374. // connection attempts will be allowed.
  375. // - If no `Policy` is set at this resource or anywhere higher in the
  376. // resource hierarchy, serial port connection attempts will be
  377. // allowed.
  378. // - If no `Policy` is set at this resource, but one exists higher in
  379. // the
  380. // resource hierarchy, the behavior is as if the`Policy` were set
  381. // at
  382. // this resource.
  383. //
  384. // The following examples demonstrate the different possible
  385. // layerings:
  386. //
  387. // Example 1 (nearest `Constraint` wins):
  388. // `organizations/foo` has a `Policy` with:
  389. // {enforced: false}
  390. // `projects/bar` has no `Policy` set.
  391. // The constraint at `projects/bar` and `organizations/foo` will not
  392. // be
  393. // enforced.
  394. //
  395. // Example 2 (enforcement gets replaced):
  396. // `organizations/foo` has a `Policy` with:
  397. // {enforced: false}
  398. // `projects/bar` has a `Policy` with:
  399. // {enforced: true}
  400. // The constraint at `organizations/foo` is not enforced.
  401. // The constraint at `projects/bar` is enforced.
  402. //
  403. // Example 3 (RestoreDefault):
  404. // `organizations/foo` has a `Policy` with:
  405. // {enforced: true}
  406. // `projects/bar` has a `Policy` with:
  407. // {RestoreDefault: {}}
  408. // The constraint at `organizations/foo` is enforced.
  409. // The constraint at `projects/bar` is not enforced,
  410. // because
  411. // `constraint_default` for the `Constraint` is `ALLOW`.
  412. Enforced bool `json:"enforced,omitempty"`
  413. // ForceSendFields is a list of field names (e.g. "Enforced") to
  414. // unconditionally include in API requests. By default, fields with
  415. // empty values are omitted from API requests. However, any non-pointer,
  416. // non-interface field appearing in ForceSendFields will be sent to the
  417. // server regardless of whether the field is empty or not. This may be
  418. // used to include empty fields in Patch requests.
  419. ForceSendFields []string `json:"-"`
  420. // NullFields is a list of field names (e.g. "Enforced") to include in
  421. // API requests with the JSON null value. By default, fields with empty
  422. // values are omitted from API requests. However, any field with an
  423. // empty value appearing in NullFields will be sent to the server as
  424. // null. It is an error if a field in this list has a non-empty value.
  425. // This may be used to include null fields in Patch requests.
  426. NullFields []string `json:"-"`
  427. }
  428. func (s *BooleanPolicy) MarshalJSON() ([]byte, error) {
  429. type NoMethod BooleanPolicy
  430. raw := NoMethod(*s)
  431. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  432. }
  433. // ClearOrgPolicyRequest: The request sent to the ClearOrgPolicy method.
  434. type ClearOrgPolicyRequest struct {
  435. // Constraint: Name of the `Constraint` of the `Policy` to clear.
  436. Constraint string `json:"constraint,omitempty"`
  437. // Etag: The current version, for concurrency control. Not sending an
  438. // `etag`
  439. // will cause the `Policy` to be cleared blindly.
  440. Etag string `json:"etag,omitempty"`
  441. // ForceSendFields is a list of field names (e.g. "Constraint") to
  442. // unconditionally include in API requests. By default, fields with
  443. // empty values are omitted from API requests. However, any non-pointer,
  444. // non-interface field appearing in ForceSendFields will be sent to the
  445. // server regardless of whether the field is empty or not. This may be
  446. // used to include empty fields in Patch requests.
  447. ForceSendFields []string `json:"-"`
  448. // NullFields is a list of field names (e.g. "Constraint") to include in
  449. // API requests with the JSON null value. By default, fields with empty
  450. // values are omitted from API requests. However, any field with an
  451. // empty value appearing in NullFields will be sent to the server as
  452. // null. It is an error if a field in this list has a non-empty value.
  453. // This may be used to include null fields in Patch requests.
  454. NullFields []string `json:"-"`
  455. }
  456. func (s *ClearOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  457. type NoMethod ClearOrgPolicyRequest
  458. raw := NoMethod(*s)
  459. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  460. }
  461. // Constraint: A `Constraint` describes a way in which a resource's
  462. // configuration can be
  463. // restricted. For example, it controls which cloud services can be
  464. // activated
  465. // across an organization, or whether a Compute Engine instance can
  466. // have
  467. // serial port connections established. `Constraints` can be configured
  468. // by the
  469. // organization's policy adminstrator to fit the needs of the
  470. // organzation by
  471. // setting Policies for `Constraints` at different locations in
  472. // the
  473. // organization's resource hierarchy. Policies are inherited down the
  474. // resource
  475. // hierarchy from higher levels, but can also be overridden. For details
  476. // about
  477. // the inheritance rules please read about
  478. // Policies.
  479. //
  480. // `Constraints` have a default behavior determined by the
  481. // `constraint_default`
  482. // field, which is the enforcement behavior that is used in the absence
  483. // of a
  484. // `Policy` being defined or inherited for the resource in question.
  485. type Constraint struct {
  486. // BooleanConstraint: Defines this constraint as being a
  487. // BooleanConstraint.
  488. BooleanConstraint *BooleanConstraint `json:"booleanConstraint,omitempty"`
  489. // ConstraintDefault: The evaluation behavior of this constraint in the
  490. // absense of 'Policy'.
  491. //
  492. // Possible values:
  493. // "CONSTRAINT_DEFAULT_UNSPECIFIED" - This is only used for
  494. // distinguishing unset values and should never be
  495. // used.
  496. // "ALLOW" - Indicate that all values are allowed for list
  497. // constraints.
  498. // Indicate that enforcement is off for boolean constraints.
  499. // "DENY" - Indicate that all values are denied for list
  500. // constraints.
  501. // Indicate that enforcement is on for boolean constraints.
  502. ConstraintDefault string `json:"constraintDefault,omitempty"`
  503. // Description: Detailed description of what this `Constraint` controls
  504. // as well as how and
  505. // where it is enforced.
  506. //
  507. // Mutable.
  508. Description string `json:"description,omitempty"`
  509. // DisplayName: The human readable name.
  510. //
  511. // Mutable.
  512. DisplayName string `json:"displayName,omitempty"`
  513. // ListConstraint: Defines this constraint as being a ListConstraint.
  514. ListConstraint *ListConstraint `json:"listConstraint,omitempty"`
  515. // Name: Immutable value, required to globally be unique. For
  516. // example,
  517. // `constraints/serviceuser.services`
  518. Name string `json:"name,omitempty"`
  519. // Version: Version of the `Constraint`. Default version is 0;
  520. Version int64 `json:"version,omitempty"`
  521. // ForceSendFields is a list of field names (e.g. "BooleanConstraint")
  522. // to unconditionally include in API requests. By default, fields with
  523. // empty values are omitted from API requests. However, any non-pointer,
  524. // non-interface field appearing in ForceSendFields will be sent to the
  525. // server regardless of whether the field is empty or not. This may be
  526. // used to include empty fields in Patch requests.
  527. ForceSendFields []string `json:"-"`
  528. // NullFields is a list of field names (e.g. "BooleanConstraint") to
  529. // include in API requests with the JSON null value. By default, fields
  530. // with empty values are omitted from API requests. However, any field
  531. // with an empty value appearing in NullFields will be sent to the
  532. // server as null. It is an error if a field in this list has a
  533. // non-empty value. This may be used to include null fields in Patch
  534. // requests.
  535. NullFields []string `json:"-"`
  536. }
  537. func (s *Constraint) MarshalJSON() ([]byte, error) {
  538. type NoMethod Constraint
  539. raw := NoMethod(*s)
  540. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  541. }
  542. // Empty: A generic empty message that you can re-use to avoid defining
  543. // duplicated
  544. // empty messages in your APIs. A typical example is to use it as the
  545. // request
  546. // or the response type of an API method. For instance:
  547. //
  548. // service Foo {
  549. // rpc Bar(google.protobuf.Empty) returns
  550. // (google.protobuf.Empty);
  551. // }
  552. //
  553. // The JSON representation for `Empty` is empty JSON object `{}`.
  554. type Empty struct {
  555. // ServerResponse contains the HTTP response code and headers from the
  556. // server.
  557. googleapi.ServerResponse `json:"-"`
  558. }
  559. // FolderOperation: Metadata describing a long running folder operation
  560. type FolderOperation struct {
  561. // DestinationParent: The resource name of the folder or organization we
  562. // are either creating
  563. // the folder under or moving the folder to.
  564. DestinationParent string `json:"destinationParent,omitempty"`
  565. // DisplayName: The display name of the folder.
  566. DisplayName string `json:"displayName,omitempty"`
  567. // OperationType: The type of this operation.
  568. //
  569. // Possible values:
  570. // "OPERATION_TYPE_UNSPECIFIED" - Operation type not specified.
  571. // "CREATE" - A create folder operation.
  572. // "MOVE" - A move folder operation.
  573. OperationType string `json:"operationType,omitempty"`
  574. // SourceParent: The resource name of the folder's parent.
  575. // Only applicable when the operation_type is MOVE.
  576. SourceParent string `json:"sourceParent,omitempty"`
  577. // ForceSendFields is a list of field names (e.g. "DestinationParent")
  578. // to unconditionally include in API requests. By default, fields with
  579. // empty values are omitted from API requests. However, any non-pointer,
  580. // non-interface field appearing in ForceSendFields will be sent to the
  581. // server regardless of whether the field is empty or not. This may be
  582. // used to include empty fields in Patch requests.
  583. ForceSendFields []string `json:"-"`
  584. // NullFields is a list of field names (e.g. "DestinationParent") to
  585. // include in API requests with the JSON null value. By default, fields
  586. // with empty values are omitted from API requests. However, any field
  587. // with an empty value appearing in NullFields will be sent to the
  588. // server as null. It is an error if a field in this list has a
  589. // non-empty value. This may be used to include null fields in Patch
  590. // requests.
  591. NullFields []string `json:"-"`
  592. }
  593. func (s *FolderOperation) MarshalJSON() ([]byte, error) {
  594. type NoMethod FolderOperation
  595. raw := NoMethod(*s)
  596. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  597. }
  598. // FolderOperationError: A classification of the Folder Operation error.
  599. type FolderOperationError struct {
  600. // ErrorMessageId: The type of operation error experienced.
  601. //
  602. // Possible values:
  603. // "ERROR_TYPE_UNSPECIFIED" - The error type was unrecognized or
  604. // unspecified.
  605. // "ACTIVE_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  606. // violate the max folder depth constraint.
  607. // "MAX_CHILD_FOLDERS_VIOLATION" - The attempted action would violate
  608. // the max child folders constraint.
  609. // "FOLDER_NAME_UNIQUENESS_VIOLATION" - The attempted action would
  610. // violate the locally-unique folder
  611. // display_name constraint.
  612. // "RESOURCE_DELETED_VIOLATION" - The resource being moved has been
  613. // deleted.
  614. // "PARENT_DELETED_VIOLATION" - The resource a folder was being added
  615. // to has been deleted.
  616. // "CYCLE_INTRODUCED_VIOLATION" - The attempted action would introduce
  617. // cycle in resource path.
  618. // "FOLDER_BEING_MOVED_VIOLATION" - The attempted action would move a
  619. // folder that is already being moved.
  620. // "FOLDER_TO_DELETE_NON_EMPTY_VIOLATION" - The folder the caller is
  621. // trying to delete contains active resources.
  622. // "DELETED_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  623. // violate the max deleted folder depth
  624. // constraint.
  625. ErrorMessageId string `json:"errorMessageId,omitempty"`
  626. // ForceSendFields is a list of field names (e.g. "ErrorMessageId") to
  627. // unconditionally include in API requests. By default, fields with
  628. // empty values are omitted from API requests. However, any non-pointer,
  629. // non-interface field appearing in ForceSendFields will be sent to the
  630. // server regardless of whether the field is empty or not. This may be
  631. // used to include empty fields in Patch requests.
  632. ForceSendFields []string `json:"-"`
  633. // NullFields is a list of field names (e.g. "ErrorMessageId") to
  634. // include in API requests with the JSON null value. By default, fields
  635. // with empty values are omitted from API requests. However, any field
  636. // with an empty value appearing in NullFields will be sent to the
  637. // server as null. It is an error if a field in this list has a
  638. // non-empty value. This may be used to include null fields in Patch
  639. // requests.
  640. NullFields []string `json:"-"`
  641. }
  642. func (s *FolderOperationError) MarshalJSON() ([]byte, error) {
  643. type NoMethod FolderOperationError
  644. raw := NoMethod(*s)
  645. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  646. }
  647. // GetAncestryRequest: The request sent to the
  648. // GetAncestry
  649. // method.
  650. type GetAncestryRequest struct {
  651. }
  652. // GetAncestryResponse: Response from the GetAncestry method.
  653. type GetAncestryResponse struct {
  654. // Ancestor: Ancestors are ordered from bottom to top of the resource
  655. // hierarchy. The
  656. // first ancestor is the project itself, followed by the project's
  657. // parent,
  658. // etc..
  659. Ancestor []*Ancestor `json:"ancestor,omitempty"`
  660. // ServerResponse contains the HTTP response code and headers from the
  661. // server.
  662. googleapi.ServerResponse `json:"-"`
  663. // ForceSendFields is a list of field names (e.g. "Ancestor") to
  664. // unconditionally include in API requests. By default, fields with
  665. // empty values are omitted from API requests. However, any non-pointer,
  666. // non-interface field appearing in ForceSendFields will be sent to the
  667. // server regardless of whether the field is empty or not. This may be
  668. // used to include empty fields in Patch requests.
  669. ForceSendFields []string `json:"-"`
  670. // NullFields is a list of field names (e.g. "Ancestor") to include in
  671. // API requests with the JSON null value. By default, fields with empty
  672. // values are omitted from API requests. However, any field with an
  673. // empty value appearing in NullFields will be sent to the server as
  674. // null. It is an error if a field in this list has a non-empty value.
  675. // This may be used to include null fields in Patch requests.
  676. NullFields []string `json:"-"`
  677. }
  678. func (s *GetAncestryResponse) MarshalJSON() ([]byte, error) {
  679. type NoMethod GetAncestryResponse
  680. raw := NoMethod(*s)
  681. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  682. }
  683. // GetEffectiveOrgPolicyRequest: The request sent to the
  684. // GetEffectiveOrgPolicy method.
  685. type GetEffectiveOrgPolicyRequest struct {
  686. // Constraint: The name of the `Constraint` to compute the effective
  687. // `Policy`.
  688. Constraint string `json:"constraint,omitempty"`
  689. // ForceSendFields is a list of field names (e.g. "Constraint") to
  690. // unconditionally include in API requests. By default, fields with
  691. // empty values are omitted from API requests. However, any non-pointer,
  692. // non-interface field appearing in ForceSendFields will be sent to the
  693. // server regardless of whether the field is empty or not. This may be
  694. // used to include empty fields in Patch requests.
  695. ForceSendFields []string `json:"-"`
  696. // NullFields is a list of field names (e.g. "Constraint") to include in
  697. // API requests with the JSON null value. By default, fields with empty
  698. // values are omitted from API requests. However, any field with an
  699. // empty value appearing in NullFields will be sent to the server as
  700. // null. It is an error if a field in this list has a non-empty value.
  701. // This may be used to include null fields in Patch requests.
  702. NullFields []string `json:"-"`
  703. }
  704. func (s *GetEffectiveOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  705. type NoMethod GetEffectiveOrgPolicyRequest
  706. raw := NoMethod(*s)
  707. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  708. }
  709. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  710. type GetIamPolicyRequest struct {
  711. }
  712. // GetOrgPolicyRequest: The request sent to the GetOrgPolicy method.
  713. type GetOrgPolicyRequest struct {
  714. // Constraint: Name of the `Constraint` to get the `Policy`.
  715. Constraint string `json:"constraint,omitempty"`
  716. // ForceSendFields is a list of field names (e.g. "Constraint") to
  717. // unconditionally include in API requests. By default, fields with
  718. // empty values are omitted from API requests. However, any non-pointer,
  719. // non-interface field appearing in ForceSendFields will be sent to the
  720. // server regardless of whether the field is empty or not. This may be
  721. // used to include empty fields in Patch requests.
  722. ForceSendFields []string `json:"-"`
  723. // NullFields is a list of field names (e.g. "Constraint") to include in
  724. // API requests with the JSON null value. By default, fields with empty
  725. // values are omitted from API requests. However, any field with an
  726. // empty value appearing in NullFields will be sent to the server as
  727. // null. It is an error if a field in this list has a non-empty value.
  728. // This may be used to include null fields in Patch requests.
  729. NullFields []string `json:"-"`
  730. }
  731. func (s *GetOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  732. type NoMethod GetOrgPolicyRequest
  733. raw := NoMethod(*s)
  734. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  735. }
  736. // Lien: A Lien represents an encumbrance on the actions that can be
  737. // performed on a
  738. // resource.
  739. type Lien struct {
  740. // CreateTime: The creation time of this Lien.
  741. CreateTime string `json:"createTime,omitempty"`
  742. // Name: A system-generated unique identifier for this Lien.
  743. //
  744. // Example: `liens/1234abcd`
  745. Name string `json:"name,omitempty"`
  746. // Origin: A stable, user-visible/meaningful string identifying the
  747. // origin of the
  748. // Lien, intended to be inspected programmatically. Maximum length of
  749. // 200
  750. // characters.
  751. //
  752. // Example: 'compute.googleapis.com'
  753. Origin string `json:"origin,omitempty"`
  754. // Parent: A reference to the resource this Lien is attached to. The
  755. // server will
  756. // validate the parent against those for which Liens are
  757. // supported.
  758. //
  759. // Example: `projects/1234`
  760. Parent string `json:"parent,omitempty"`
  761. // Reason: Concise user-visible strings indicating why an action cannot
  762. // be performed
  763. // on a resource. Maximum length of 200 characters.
  764. //
  765. // Example: 'Holds production API key'
  766. Reason string `json:"reason,omitempty"`
  767. // Restrictions: The types of operations which should be blocked as a
  768. // result of this Lien.
  769. // Each value should correspond to an IAM permission. The server
  770. // will
  771. // validate the permissions against those for which Liens are
  772. // supported.
  773. //
  774. // An empty list is meaningless and will be rejected.
  775. //
  776. // Example: ['resourcemanager.projects.delete']
  777. Restrictions []string `json:"restrictions,omitempty"`
  778. // ServerResponse contains the HTTP response code and headers from the
  779. // server.
  780. googleapi.ServerResponse `json:"-"`
  781. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  782. // unconditionally include in API requests. By default, fields with
  783. // empty values are omitted from API requests. However, any non-pointer,
  784. // non-interface field appearing in ForceSendFields will be sent to the
  785. // server regardless of whether the field is empty or not. This may be
  786. // used to include empty fields in Patch requests.
  787. ForceSendFields []string `json:"-"`
  788. // NullFields is a list of field names (e.g. "CreateTime") to include in
  789. // API requests with the JSON null value. By default, fields with empty
  790. // values are omitted from API requests. However, any field with an
  791. // empty value appearing in NullFields will be sent to the server as
  792. // null. It is an error if a field in this list has a non-empty value.
  793. // This may be used to include null fields in Patch requests.
  794. NullFields []string `json:"-"`
  795. }
  796. func (s *Lien) MarshalJSON() ([]byte, error) {
  797. type NoMethod Lien
  798. raw := NoMethod(*s)
  799. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  800. }
  801. // ListAvailableOrgPolicyConstraintsRequest: The request sent to the
  802. // [ListAvailableOrgPolicyConstraints]
  803. // google.cloud.OrgPolicy.v1.ListAvai
  804. // lableOrgPolicyConstraints] method.
  805. type ListAvailableOrgPolicyConstraintsRequest struct {
  806. // PageSize: Size of the pages to be returned. This is currently
  807. // unsupported and will
  808. // be ignored. The server may at any point start using this field to
  809. // limit
  810. // page size.
  811. PageSize int64 `json:"pageSize,omitempty"`
  812. // PageToken: Page token used to retrieve the next page. This is
  813. // currently unsupported
  814. // and will be ignored. The server may at any point start using this
  815. // field.
  816. PageToken string `json:"pageToken,omitempty"`
  817. // ForceSendFields is a list of field names (e.g. "PageSize") to
  818. // unconditionally include in API requests. By default, fields with
  819. // empty values are omitted from API requests. However, any non-pointer,
  820. // non-interface field appearing in ForceSendFields will be sent to the
  821. // server regardless of whether the field is empty or not. This may be
  822. // used to include empty fields in Patch requests.
  823. ForceSendFields []string `json:"-"`
  824. // NullFields is a list of field names (e.g. "PageSize") to include in
  825. // API requests with the JSON null value. By default, fields with empty
  826. // values are omitted from API requests. However, any field with an
  827. // empty value appearing in NullFields will be sent to the server as
  828. // null. It is an error if a field in this list has a non-empty value.
  829. // This may be used to include null fields in Patch requests.
  830. NullFields []string `json:"-"`
  831. }
  832. func (s *ListAvailableOrgPolicyConstraintsRequest) MarshalJSON() ([]byte, error) {
  833. type NoMethod ListAvailableOrgPolicyConstraintsRequest
  834. raw := NoMethod(*s)
  835. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  836. }
  837. // ListAvailableOrgPolicyConstraintsResponse: The response returned from
  838. // the ListAvailableOrgPolicyConstraints method.
  839. // Returns all `Constraints` that could be set at this level of the
  840. // hierarchy
  841. // (contrast with the response from `ListPolicies`, which returns all
  842. // policies
  843. // which are set).
  844. type ListAvailableOrgPolicyConstraintsResponse struct {
  845. // Constraints: The collection of constraints that are settable on the
  846. // request resource.
  847. Constraints []*Constraint `json:"constraints,omitempty"`
  848. // NextPageToken: Page token used to retrieve the next page. This is
  849. // currently not used.
  850. NextPageToken string `json:"nextPageToken,omitempty"`
  851. // ServerResponse contains the HTTP response code and headers from the
  852. // server.
  853. googleapi.ServerResponse `json:"-"`
  854. // ForceSendFields is a list of field names (e.g. "Constraints") to
  855. // unconditionally include in API requests. By default, fields with
  856. // empty values are omitted from API requests. However, any non-pointer,
  857. // non-interface field appearing in ForceSendFields will be sent to the
  858. // server regardless of whether the field is empty or not. This may be
  859. // used to include empty fields in Patch requests.
  860. ForceSendFields []string `json:"-"`
  861. // NullFields is a list of field names (e.g. "Constraints") to include
  862. // in API requests with the JSON null value. By default, fields with
  863. // empty values are omitted from API requests. However, any field with
  864. // an empty value appearing in NullFields will be sent to the server as
  865. // null. It is an error if a field in this list has a non-empty value.
  866. // This may be used to include null fields in Patch requests.
  867. NullFields []string `json:"-"`
  868. }
  869. func (s *ListAvailableOrgPolicyConstraintsResponse) MarshalJSON() ([]byte, error) {
  870. type NoMethod ListAvailableOrgPolicyConstraintsResponse
  871. raw := NoMethod(*s)
  872. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  873. }
  874. // ListConstraint: A `Constraint` that allows or disallows a list of
  875. // string values, which are
  876. // configured by an Organization's policy administrator with a `Policy`.
  877. type ListConstraint struct {
  878. // SuggestedValue: Optional. The Google Cloud Console will try to
  879. // default to a configuration
  880. // that matches the value specified in this `Constraint`.
  881. SuggestedValue string `json:"suggestedValue,omitempty"`
  882. // SupportsUnder: Indicates whether subtrees of Cloud Resource Manager
  883. // resource hierarchy
  884. // can be used in `Policy.allowed_values` and `Policy.denied_values`.
  885. // For
  886. // example, "under:folders/123" would match any resource under
  887. // the
  888. // 'folders/123' folder.
  889. SupportsUnder bool `json:"supportsUnder,omitempty"`
  890. // ForceSendFields is a list of field names (e.g. "SuggestedValue") to
  891. // unconditionally include in API requests. By default, fields with
  892. // empty values are omitted from API requests. However, any non-pointer,
  893. // non-interface field appearing in ForceSendFields will be sent to the
  894. // server regardless of whether the field is empty or not. This may be
  895. // used to include empty fields in Patch requests.
  896. ForceSendFields []string `json:"-"`
  897. // NullFields is a list of field names (e.g. "SuggestedValue") to
  898. // include in API requests with the JSON null value. By default, fields
  899. // with empty values are omitted from API requests. However, any field
  900. // with an empty value appearing in NullFields will be sent to the
  901. // server as null. It is an error if a field in this list has a
  902. // non-empty value. This may be used to include null fields in Patch
  903. // requests.
  904. NullFields []string `json:"-"`
  905. }
  906. func (s *ListConstraint) MarshalJSON() ([]byte, error) {
  907. type NoMethod ListConstraint
  908. raw := NoMethod(*s)
  909. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  910. }
  911. // ListLiensResponse: The response message for Liens.ListLiens.
  912. type ListLiensResponse struct {
  913. // Liens: A list of Liens.
  914. Liens []*Lien `json:"liens,omitempty"`
  915. // NextPageToken: Token to retrieve the next page of results, or empty
  916. // if there are no more
  917. // results in the list.
  918. NextPageToken string `json:"nextPageToken,omitempty"`
  919. // ServerResponse contains the HTTP response code and headers from the
  920. // server.
  921. googleapi.ServerResponse `json:"-"`
  922. // ForceSendFields is a list of field names (e.g. "Liens") to
  923. // unconditionally include in API requests. By default, fields with
  924. // empty values are omitted from API requests. However, any non-pointer,
  925. // non-interface field appearing in ForceSendFields will be sent to the
  926. // server regardless of whether the field is empty or not. This may be
  927. // used to include empty fields in Patch requests.
  928. ForceSendFields []string `json:"-"`
  929. // NullFields is a list of field names (e.g. "Liens") to include in API
  930. // requests with the JSON null value. By default, fields with empty
  931. // values are omitted from API requests. However, any field with an
  932. // empty value appearing in NullFields will be sent to the server as
  933. // null. It is an error if a field in this list has a non-empty value.
  934. // This may be used to include null fields in Patch requests.
  935. NullFields []string `json:"-"`
  936. }
  937. func (s *ListLiensResponse) MarshalJSON() ([]byte, error) {
  938. type NoMethod ListLiensResponse
  939. raw := NoMethod(*s)
  940. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  941. }
  942. // ListOrgPoliciesRequest: The request sent to the ListOrgPolicies
  943. // method.
  944. type ListOrgPoliciesRequest struct {
  945. // PageSize: Size of the pages to be returned. This is currently
  946. // unsupported and will
  947. // be ignored. The server may at any point start using this field to
  948. // limit
  949. // page size.
  950. PageSize int64 `json:"pageSize,omitempty"`
  951. // PageToken: Page token used to retrieve the next page. This is
  952. // currently unsupported
  953. // and will be ignored. The server may at any point start using this
  954. // field.
  955. PageToken string `json:"pageToken,omitempty"`
  956. // ForceSendFields is a list of field names (e.g. "PageSize") to
  957. // unconditionally include in API requests. By default, fields with
  958. // empty values are omitted from API requests. However, any non-pointer,
  959. // non-interface field appearing in ForceSendFields will be sent to the
  960. // server regardless of whether the field is empty or not. This may be
  961. // used to include empty fields in Patch requests.
  962. ForceSendFields []string `json:"-"`
  963. // NullFields is a list of field names (e.g. "PageSize") to include in
  964. // API requests with the JSON null value. By default, fields with empty
  965. // values are omitted from API requests. However, any field with an
  966. // empty value appearing in NullFields will be sent to the server as
  967. // null. It is an error if a field in this list has a non-empty value.
  968. // This may be used to include null fields in Patch requests.
  969. NullFields []string `json:"-"`
  970. }
  971. func (s *ListOrgPoliciesRequest) MarshalJSON() ([]byte, error) {
  972. type NoMethod ListOrgPoliciesRequest
  973. raw := NoMethod(*s)
  974. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  975. }
  976. // ListOrgPoliciesResponse: The response returned from the
  977. // ListOrgPolicies method. It will be empty
  978. // if no `Policies` are set on the resource.
  979. type ListOrgPoliciesResponse struct {
  980. // NextPageToken: Page token used to retrieve the next page. This is
  981. // currently not used, but
  982. // the server may at any point start supplying a valid token.
  983. NextPageToken string `json:"nextPageToken,omitempty"`
  984. // Policies: The `Policies` that are set on the resource. It will be
  985. // empty if no
  986. // `Policies` are set.
  987. Policies []*OrgPolicy `json:"policies,omitempty"`
  988. // ServerResponse contains the HTTP response code and headers from the
  989. // server.
  990. googleapi.ServerResponse `json:"-"`
  991. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  992. // unconditionally include in API requests. By default, fields with
  993. // empty values are omitted from API requests. However, any non-pointer,
  994. // non-interface field appearing in ForceSendFields will be sent to the
  995. // server regardless of whether the field is empty or not. This may be
  996. // used to include empty fields in Patch requests.
  997. ForceSendFields []string `json:"-"`
  998. // NullFields is a list of field names (e.g. "NextPageToken") to include
  999. // in API requests with the JSON null value. By default, fields with
  1000. // empty values are omitted from API requests. However, any field with
  1001. // an empty value appearing in NullFields will be sent to the server as
  1002. // null. It is an error if a field in this list has a non-empty value.
  1003. // This may be used to include null fields in Patch requests.
  1004. NullFields []string `json:"-"`
  1005. }
  1006. func (s *ListOrgPoliciesResponse) MarshalJSON() ([]byte, error) {
  1007. type NoMethod ListOrgPoliciesResponse
  1008. raw := NoMethod(*s)
  1009. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1010. }
  1011. // ListPolicy: Used in `policy_type` to specify how `list_policy`
  1012. // behaves at this
  1013. // resource.
  1014. //
  1015. // `ListPolicy` can define specific values and subtrees of Cloud
  1016. // Resource
  1017. // Manager resource hierarchy (`Organizations`, `Folders`, `Projects`)
  1018. // that
  1019. // are allowed or denied by setting the `allowed_values` and
  1020. // `denied_values`
  1021. // fields. This is achieved by using the `under:` and optional `is:`
  1022. // prefixes.
  1023. // The `under:` prefix is used to denote resource subtree values.
  1024. // The `is:` prefix is used to denote specific values, and is required
  1025. // only
  1026. // if the value contains a ":". Values prefixed with "is:" are treated
  1027. // the
  1028. // same as values with no prefix.
  1029. // Ancestry subtrees must be in one of the following formats:
  1030. // - “projects/<project-id>”, e.g.
  1031. // “projects/tokyo-rain-123”
  1032. // - “folders/<folder-id>”, e.g. “folders/1234”
  1033. // - “organizations/<organization-id>”, e.g.
  1034. // “organizations/1234”
  1035. // The `supports_under` field of the associated `Constraint` defines
  1036. // whether
  1037. // ancestry prefixes can be used. You can set `allowed_values`
  1038. // and
  1039. // `denied_values` in the same `Policy` if `all_values`
  1040. // is
  1041. // `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny
  1042. // all
  1043. // values. If `all_values` is set to either `ALLOW` or
  1044. // `DENY`,
  1045. // `allowed_values` and `denied_values` must be unset.
  1046. type ListPolicy struct {
  1047. // AllValues: The policy all_values state.
  1048. //
  1049. // Possible values:
  1050. // "ALL_VALUES_UNSPECIFIED" - Indicates that allowed_values or
  1051. // denied_values must be set.
  1052. // "ALLOW" - A policy with this set allows all values.
  1053. // "DENY" - A policy with this set denies all values.
  1054. AllValues string `json:"allValues,omitempty"`
  1055. // AllowedValues: List of values allowed at this resource. Can only be
  1056. // set if `all_values`
  1057. // is set to `ALL_VALUES_UNSPECIFIED`.
  1058. AllowedValues []string `json:"allowedValues,omitempty"`
  1059. // DeniedValues: List of values denied at this resource. Can only be set
  1060. // if `all_values`
  1061. // is set to `ALL_VALUES_UNSPECIFIED`.
  1062. DeniedValues []string `json:"deniedValues,omitempty"`
  1063. // InheritFromParent: Determines the inheritance behavior for this
  1064. // `Policy`.
  1065. //
  1066. // By default, a `ListPolicy` set at a resource supercedes any `Policy`
  1067. // set
  1068. // anywhere up the resource hierarchy. However, if `inherit_from_parent`
  1069. // is
  1070. // set to `true`, then the values from the effective `Policy` of the
  1071. // parent
  1072. // resource are inherited, meaning the values set in this `Policy`
  1073. // are
  1074. // added to the values inherited up the hierarchy.
  1075. //
  1076. // Setting `Policy` hierarchies that inherit both allowed values and
  1077. // denied
  1078. // values isn't recommended in most circumstances to keep the
  1079. // configuration
  1080. // simple and understandable. However, it is possible to set a `Policy`
  1081. // with
  1082. // `allowed_values` set that inherits a `Policy` with `denied_values`
  1083. // set.
  1084. // In this case, the values that are allowed must be in `allowed_values`
  1085. // and
  1086. // not present in `denied_values`.
  1087. //
  1088. // For example, suppose you have a
  1089. // `Constraint`
  1090. // `constraints/serviceuser.services`, which has a `constraint_type`
  1091. // of
  1092. // `list_constraint`, and with `constraint_default` set to
  1093. // `ALLOW`.
  1094. // Suppose that at the Organization level, a `Policy` is applied
  1095. // that
  1096. // restricts the allowed API activations to {`E1`, `E2`}. Then, if
  1097. // a
  1098. // `Policy` is applied to a project below the Organization that
  1099. // has
  1100. // `inherit_from_parent` set to `false` and field all_values set to
  1101. // DENY,
  1102. // then an attempt to activate any API will be denied.
  1103. //
  1104. // The following examples demonstrate different possible layerings
  1105. // for
  1106. // `projects/bar` parented by `organizations/foo`:
  1107. //
  1108. // Example 1 (no inherited values):
  1109. // `organizations/foo` has a `Policy` with values:
  1110. // {allowed_values: “E1” allowed_values:”E2”}
  1111. // `projects/bar` has `inherit_from_parent` `false` and values:
  1112. // {allowed_values: "E3" allowed_values: "E4"}
  1113. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1114. // The accepted values at `projects/bar` are `E3`, and `E4`.
  1115. //
  1116. // Example 2 (inherited values):
  1117. // `organizations/foo` has a `Policy` with values:
  1118. // {allowed_values: “E1” allowed_values:”E2”}
  1119. // `projects/bar` has a `Policy` with values:
  1120. // {value: “E3” value: ”E4” inherit_from_parent: true}
  1121. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1122. // The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and
  1123. // `E4`.
  1124. //
  1125. // Example 3 (inheriting both allowed and denied values):
  1126. // `organizations/foo` has a `Policy` with values:
  1127. // {allowed_values: "E1" allowed_values: "E2"}
  1128. // `projects/bar` has a `Policy` with:
  1129. // {denied_values: "E1"}
  1130. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1131. // The value accepted at `projects/bar` is `E2`.
  1132. //
  1133. // Example 4 (RestoreDefault):
  1134. // `organizations/foo` has a `Policy` with values:
  1135. // {allowed_values: “E1” allowed_values:”E2”}
  1136. // `projects/bar` has a `Policy` with values:
  1137. // {RestoreDefault: {}}
  1138. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1139. // The accepted values at `projects/bar` are either all or none
  1140. // depending on
  1141. // the value of `constraint_default` (if `ALLOW`, all; if
  1142. // `DENY`, none).
  1143. //
  1144. // Example 5 (no policy inherits parent policy):
  1145. // `organizations/foo` has no `Policy` set.
  1146. // `projects/bar` has no `Policy` set.
  1147. // The accepted values at both levels are either all or none depending
  1148. // on
  1149. // the value of `constraint_default` (if `ALLOW`, all; if
  1150. // `DENY`, none).
  1151. //
  1152. // Example 6 (ListConstraint allowing all):
  1153. // `organizations/foo` has a `Policy` with values:
  1154. // {allowed_values: “E1” allowed_values: ”E2”}
  1155. // `projects/bar` has a `Policy` with:
  1156. // {all: ALLOW}
  1157. // The accepted values at `organizations/foo` are `E1`, E2`.
  1158. // Any value is accepted at `projects/bar`.
  1159. //
  1160. // Example 7 (ListConstraint allowing none):
  1161. // `organizations/foo` has a `Policy` with values:
  1162. // {allowed_values: “E1” allowed_values: ”E2”}
  1163. // `projects/bar` has a `Policy` with:
  1164. // {all: DENY}
  1165. // The accepted values at `organizations/foo` are `E1`, E2`.
  1166. // No value is accepted at `projects/bar`.
  1167. //
  1168. // Example 10 (allowed and denied subtrees of Resource Manager
  1169. // hierarchy):
  1170. // Given the following resource hierarchy
  1171. // O1->{F1, F2}; F1->{P1}; F2->{P2, P3},
  1172. // `organizations/foo` has a `Policy` with values:
  1173. // {allowed_values: "under:organizations/O1"}
  1174. // `projects/bar` has a `Policy` with:
  1175. // {allowed_values: "under:projects/P3"}
  1176. // {denied_values: "under:folders/F2"}
  1177. // The accepted values at `organizations/foo` are `organizations/O1`,
  1178. // `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`,
  1179. // `projects/P3`.
  1180. // The accepted values at `projects/bar` are `organizations/O1`,
  1181. // `folders/F1`, `projects/P1`.
  1182. InheritFromParent bool `json:"inheritFromParent,omitempty"`
  1183. // SuggestedValue: Optional. The Google Cloud Console will try to
  1184. // default to a configuration
  1185. // that matches the value specified in this `Policy`. If
  1186. // `suggested_value`
  1187. // is not set, it will inherit the value specified higher in the
  1188. // hierarchy,
  1189. // unless `inherit_from_parent` is `false`.
  1190. SuggestedValue string `json:"suggestedValue,omitempty"`
  1191. // ForceSendFields is a list of field names (e.g. "AllValues") to
  1192. // unconditionally include in API requests. By default, fields with
  1193. // empty values are omitted from API requests. However, any non-pointer,
  1194. // non-interface field appearing in ForceSendFields will be sent to the
  1195. // server regardless of whether the field is empty or not. This may be
  1196. // used to include empty fields in Patch requests.
  1197. ForceSendFields []string `json:"-"`
  1198. // NullFields is a list of field names (e.g. "AllValues") to include in
  1199. // API requests with the JSON null value. By default, fields with empty
  1200. // values are omitted from API requests. However, any field with an
  1201. // empty value appearing in NullFields will be sent to the server as
  1202. // null. It is an error if a field in this list has a non-empty value.
  1203. // This may be used to include null fields in Patch requests.
  1204. NullFields []string `json:"-"`
  1205. }
  1206. func (s *ListPolicy) MarshalJSON() ([]byte, error) {
  1207. type NoMethod ListPolicy
  1208. raw := NoMethod(*s)
  1209. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1210. }
  1211. // ListProjectsResponse: A page of the response received from
  1212. // the
  1213. // ListProjects
  1214. // method.
  1215. //
  1216. // A paginated response where more pages are available
  1217. // has
  1218. // `next_page_token` set. This token can be used in a subsequent request
  1219. // to
  1220. // retrieve the next request page.
  1221. type ListProjectsResponse struct {
  1222. // NextPageToken: Pagination token.
  1223. //
  1224. // If the result set is too large to fit in a single response, this
  1225. // token
  1226. // is returned. It encodes the position of the current result
  1227. // cursor.
  1228. // Feeding this value into a new list request with the `page_token`
  1229. // parameter
  1230. // gives the next page of the results.
  1231. //
  1232. // When `next_page_token` is not filled in, there is no next page
  1233. // and
  1234. // the list returned is the last page in the result set.
  1235. //
  1236. // Pagination tokens have a limited lifetime.
  1237. NextPageToken string `json:"nextPageToken,omitempty"`
  1238. // Projects: The list of Projects that matched the list filter. This
  1239. // list can
  1240. // be paginated.
  1241. Projects []*Project `json:"projects,omitempty"`
  1242. // ServerResponse contains the HTTP response code and headers from the
  1243. // server.
  1244. googleapi.ServerResponse `json:"-"`
  1245. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1246. // unconditionally include in API requests. By default, fields with
  1247. // empty values are omitted from API requests. However, any non-pointer,
  1248. // non-interface field appearing in ForceSendFields will be sent to the
  1249. // server regardless of whether the field is empty or not. This may be
  1250. // used to include empty fields in Patch requests.
  1251. ForceSendFields []string `json:"-"`
  1252. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1253. // in API requests with the JSON null value. By default, fields with
  1254. // empty values are omitted from API requests. However, any field with
  1255. // an empty value appearing in NullFields will be sent to the server as
  1256. // null. It is an error if a field in this list has a non-empty value.
  1257. // This may be used to include null fields in Patch requests.
  1258. NullFields []string `json:"-"`
  1259. }
  1260. func (s *ListProjectsResponse) MarshalJSON() ([]byte, error) {
  1261. type NoMethod ListProjectsResponse
  1262. raw := NoMethod(*s)
  1263. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1264. }
  1265. // Operation: This resource represents a long-running operation that is
  1266. // the result of a
  1267. // network API call.
  1268. type Operation struct {
  1269. // Done: If the value is `false`, it means the operation is still in
  1270. // progress.
  1271. // If `true`, the operation is completed, and either `error` or
  1272. // `response` is
  1273. // available.
  1274. Done bool `json:"done,omitempty"`
  1275. // Error: The error result of the operation in case of failure or
  1276. // cancellation.
  1277. Error *Status `json:"error,omitempty"`
  1278. // Metadata: Service-specific metadata associated with the operation.
  1279. // It typically
  1280. // contains progress information and common metadata such as create
  1281. // time.
  1282. // Some services might not provide such metadata. Any method that
  1283. // returns a
  1284. // long-running operation should document the metadata type, if any.
  1285. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1286. // Name: The server-assigned name, which is only unique within the same
  1287. // service that
  1288. // originally returns it. If you use the default HTTP mapping,
  1289. // the
  1290. // `name` should have the format of `operations/some/unique/name`.
  1291. Name string `json:"name,omitempty"`
  1292. // Response: The normal response of the operation in case of success.
  1293. // If the original
  1294. // method returns no data on success, such as `Delete`, the response
  1295. // is
  1296. // `google.protobuf.Empty`. If the original method is
  1297. // standard
  1298. // `Get`/`Create`/`Update`, the response should be the resource. For
  1299. // other
  1300. // methods, the response should have the type `XxxResponse`, where
  1301. // `Xxx`
  1302. // is the original method name. For example, if the original method
  1303. // name
  1304. // is `TakeSnapshot()`, the inferred response type
  1305. // is
  1306. // `TakeSnapshotResponse`.
  1307. Response googleapi.RawMessage `json:"response,omitempty"`
  1308. // ServerResponse contains the HTTP response code and headers from the
  1309. // server.
  1310. googleapi.ServerResponse `json:"-"`
  1311. // ForceSendFields is a list of field names (e.g. "Done") to
  1312. // unconditionally include in API requests. By default, fields with
  1313. // empty values are omitted from API requests. However, any non-pointer,
  1314. // non-interface field appearing in ForceSendFields will be sent to the
  1315. // server regardless of whether the field is empty or not. This may be
  1316. // used to include empty fields in Patch requests.
  1317. ForceSendFields []string `json:"-"`
  1318. // NullFields is a list of field names (e.g. "Done") to include in API
  1319. // requests with the JSON null value. By default, fields with empty
  1320. // values are omitted from API requests. However, any field with an
  1321. // empty value appearing in NullFields will be sent to the server as
  1322. // null. It is an error if a field in this list has a non-empty value.
  1323. // This may be used to include null fields in Patch requests.
  1324. NullFields []string `json:"-"`
  1325. }
  1326. func (s *Operation) MarshalJSON() ([]byte, error) {
  1327. type NoMethod Operation
  1328. raw := NoMethod(*s)
  1329. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1330. }
  1331. // OrgPolicy: Defines a Cloud Organization `Policy` which is used to
  1332. // specify `Constraints`
  1333. // for configurations of Cloud Platform resources.
  1334. type OrgPolicy struct {
  1335. // BooleanPolicy: For boolean `Constraints`, whether to enforce the
  1336. // `Constraint` or not.
  1337. BooleanPolicy *BooleanPolicy `json:"booleanPolicy,omitempty"`
  1338. // Constraint: The name of the `Constraint` the `Policy` is configuring,
  1339. // for example,
  1340. // `constraints/serviceuser.services`.
  1341. //
  1342. // Immutable after creation.
  1343. Constraint string `json:"constraint,omitempty"`
  1344. // Etag: An opaque tag indicating the current version of the `Policy`,
  1345. // used for
  1346. // concurrency control.
  1347. //
  1348. // When the `Policy` is returned from either a `GetPolicy` or
  1349. // a
  1350. // `ListOrgPolicy` request, this `etag` indicates the version of the
  1351. // current
  1352. // `Policy` to use when executing a read-modify-write loop.
  1353. //
  1354. // When the `Policy` is returned from a `GetEffectivePolicy` request,
  1355. // the
  1356. // `etag` will be unset.
  1357. //
  1358. // When the `Policy` is used in a `SetOrgPolicy` method, use the `etag`
  1359. // value
  1360. // that was returned from a `GetOrgPolicy` request as part of
  1361. // a
  1362. // read-modify-write loop for concurrency control. Not setting the
  1363. // `etag`in a
  1364. // `SetOrgPolicy` request will result in an unconditional write of
  1365. // the
  1366. // `Policy`.
  1367. Etag string `json:"etag,omitempty"`
  1368. // ListPolicy: List of values either allowed or disallowed.
  1369. ListPolicy *ListPolicy `json:"listPolicy,omitempty"`
  1370. // RestoreDefault: Restores the default behavior of the constraint;
  1371. // independent of
  1372. // `Constraint` type.
  1373. RestoreDefault *RestoreDefault `json:"restoreDefault,omitempty"`
  1374. // UpdateTime: The time stamp the `Policy` was previously updated. This
  1375. // is set by the
  1376. // server, not specified by the caller, and represents the last time a
  1377. // call to
  1378. // `SetOrgPolicy` was made for that `Policy`. Any value set by the
  1379. // client will
  1380. // be ignored.
  1381. UpdateTime string `json:"updateTime,omitempty"`
  1382. // Version: Version of the `Policy`. Default version is 0;
  1383. Version int64 `json:"version,omitempty"`
  1384. // ServerResponse contains the HTTP response code and headers from the
  1385. // server.
  1386. googleapi.ServerResponse `json:"-"`
  1387. // ForceSendFields is a list of field names (e.g. "BooleanPolicy") to
  1388. // unconditionally include in API requests. By default, fields with
  1389. // empty values are omitted from API requests. However, any non-pointer,
  1390. // non-interface field appearing in ForceSendFields will be sent to the
  1391. // server regardless of whether the field is empty or not. This may be
  1392. // used to include empty fields in Patch requests.
  1393. ForceSendFields []string `json:"-"`
  1394. // NullFields is a list of field names (e.g. "BooleanPolicy") to include
  1395. // in API requests with the JSON null value. By default, fields with
  1396. // empty values are omitted from API requests. However, any field with
  1397. // an empty value appearing in NullFields will be sent to the server as
  1398. // null. It is an error if a field in this list has a non-empty value.
  1399. // This may be used to include null fields in Patch requests.
  1400. NullFields []string `json:"-"`
  1401. }
  1402. func (s *OrgPolicy) MarshalJSON() ([]byte, error) {
  1403. type NoMethod OrgPolicy
  1404. raw := NoMethod(*s)
  1405. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1406. }
  1407. // Organization: The root node in the resource hierarchy to which a
  1408. // particular entity's
  1409. // (e.g., company) resources belong.
  1410. type Organization struct {
  1411. // CreationTime: Timestamp when the Organization was created. Assigned
  1412. // by the server.
  1413. // @OutputOnly
  1414. CreationTime string `json:"creationTime,omitempty"`
  1415. // DisplayName: A human-readable string that refers to the Organization
  1416. // in the
  1417. // GCP Console UI. This string is set by the server and cannot
  1418. // be
  1419. // changed. The string will be set to the primary domain (for
  1420. // example,
  1421. // "google.com") of the G Suite customer that owns the
  1422. // organization.
  1423. // @OutputOnly
  1424. DisplayName string `json:"displayName,omitempty"`
  1425. // LifecycleState: The organization's current lifecycle state. Assigned
  1426. // by the server.
  1427. // @OutputOnly
  1428. //
  1429. // Possible values:
  1430. // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only
  1431. // useful for distinguishing unset values.
  1432. // "ACTIVE" - The normal and active state.
  1433. // "DELETE_REQUESTED" - The organization has been marked for deletion
  1434. // by the user.
  1435. LifecycleState string `json:"lifecycleState,omitempty"`
  1436. // Name: Output Only. The resource name of the organization. This is
  1437. // the
  1438. // organization's relative path in the API. Its format
  1439. // is
  1440. // "organizations/[organization_id]". For example, "organizations/1234".
  1441. Name string `json:"name,omitempty"`
  1442. // Owner: The owner of this Organization. The owner should be specified
  1443. // on
  1444. // creation. Once set, it cannot be changed.
  1445. // This field is required.
  1446. Owner *OrganizationOwner `json:"owner,omitempty"`
  1447. // ServerResponse contains the HTTP response code and headers from the
  1448. // server.
  1449. googleapi.ServerResponse `json:"-"`
  1450. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1451. // unconditionally include in API requests. By default, fields with
  1452. // empty values are omitted from API requests. However, any non-pointer,
  1453. // non-interface field appearing in ForceSendFields will be sent to the
  1454. // server regardless of whether the field is empty or not. This may be
  1455. // used to include empty fields in Patch requests.
  1456. ForceSendFields []string `json:"-"`
  1457. // NullFields is a list of field names (e.g. "CreationTime") to include
  1458. // in API requests with the JSON null value. By default, fields with
  1459. // empty values are omitted from API requests. However, any field with
  1460. // an empty value appearing in NullFields will be sent to the server as
  1461. // null. It is an error if a field in this list has a non-empty value.
  1462. // This may be used to include null fields in Patch requests.
  1463. NullFields []string `json:"-"`
  1464. }
  1465. func (s *Organization) MarshalJSON() ([]byte, error) {
  1466. type NoMethod Organization
  1467. raw := NoMethod(*s)
  1468. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1469. }
  1470. // OrganizationOwner: The entity that owns an Organization. The lifetime
  1471. // of the Organization and
  1472. // all of its descendants are bound to the `OrganizationOwner`. If
  1473. // the
  1474. // `OrganizationOwner` is deleted, the Organization and all its
  1475. // descendants will
  1476. // be deleted.
  1477. type OrganizationOwner struct {
  1478. // DirectoryCustomerId: The G Suite customer id used in the Directory
  1479. // API.
  1480. DirectoryCustomerId string `json:"directoryCustomerId,omitempty"`
  1481. // ForceSendFields is a list of field names (e.g. "DirectoryCustomerId")
  1482. // to unconditionally include in API requests. By default, fields with
  1483. // empty values are omitted from API requests. However, any non-pointer,
  1484. // non-interface field appearing in ForceSendFields will be sent to the
  1485. // server regardless of whether the field is empty or not. This may be
  1486. // used to include empty fields in Patch requests.
  1487. ForceSendFields []string `json:"-"`
  1488. // NullFields is a list of field names (e.g. "DirectoryCustomerId") to
  1489. // include in API requests with the JSON null value. By default, fields
  1490. // with empty values are omitted from API requests. However, any field
  1491. // with an empty value appearing in NullFields will be sent to the
  1492. // server as null. It is an error if a field in this list has a
  1493. // non-empty value. This may be used to include null fields in Patch
  1494. // requests.
  1495. NullFields []string `json:"-"`
  1496. }
  1497. func (s *OrganizationOwner) MarshalJSON() ([]byte, error) {
  1498. type NoMethod OrganizationOwner
  1499. raw := NoMethod(*s)
  1500. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1501. }
  1502. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1503. // used to
  1504. // specify access control policies for Cloud Platform resources.
  1505. //
  1506. //
  1507. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1508. // of
  1509. // `members` to a `role`, where the members can be user accounts, Google
  1510. // groups,
  1511. // Google domains, and service accounts. A `role` is a named list of
  1512. // permissions
  1513. // defined by IAM.
  1514. //
  1515. // **JSON Example**
  1516. //
  1517. // {
  1518. // "bindings": [
  1519. // {
  1520. // "role": "roles/owner",
  1521. // "members": [
  1522. // "user:mike@example.com",
  1523. // "group:admins@example.com",
  1524. // "domain:google.com",
  1525. //
  1526. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1527. // ]
  1528. // },
  1529. // {
  1530. // "role": "roles/viewer",
  1531. // "members": ["user:sean@example.com"]
  1532. // }
  1533. // ]
  1534. // }
  1535. //
  1536. // **YAML Example**
  1537. //
  1538. // bindings:
  1539. // - members:
  1540. // - user:mike@example.com
  1541. // - group:admins@example.com
  1542. // - domain:google.com
  1543. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1544. // role: roles/owner
  1545. // - members:
  1546. // - user:sean@example.com
  1547. // role: roles/viewer
  1548. //
  1549. //
  1550. // For a description of IAM and its features, see the
  1551. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1552. type Policy struct {
  1553. // AuditConfigs: Specifies cloud audit logging configuration for this
  1554. // policy.
  1555. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  1556. // Bindings: Associates a list of `members` to a `role`.
  1557. // `bindings` with no members will result in an error.
  1558. Bindings []*Binding `json:"bindings,omitempty"`
  1559. // Etag: `etag` is used for optimistic concurrency control as a way to
  1560. // help
  1561. // prevent simultaneous updates of a policy from overwriting each
  1562. // other.
  1563. // It is strongly suggested that systems make use of the `etag` in
  1564. // the
  1565. // read-modify-write cycle to perform policy updates in order to avoid
  1566. // race
  1567. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1568. // and
  1569. // systems are expected to put that etag in the request to
  1570. // `setIamPolicy` to
  1571. // ensure that their change will be applied to the same version of the
  1572. // policy.
  1573. //
  1574. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1575. // existing
  1576. // policy is overwritten blindly.
  1577. Etag string `json:"etag,omitempty"`
  1578. // Version: Deprecated.
  1579. Version int64 `json:"version,omitempty"`
  1580. // ServerResponse contains the HTTP response code and headers from the
  1581. // server.
  1582. googleapi.ServerResponse `json:"-"`
  1583. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  1584. // unconditionally include in API requests. By default, fields with
  1585. // empty values are omitted from API requests. However, any non-pointer,
  1586. // non-interface field appearing in ForceSendFields will be sent to the
  1587. // server regardless of whether the field is empty or not. This may be
  1588. // used to include empty fields in Patch requests.
  1589. ForceSendFields []string `json:"-"`
  1590. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  1591. // in API requests with the JSON null value. By default, fields with
  1592. // empty values are omitted from API requests. However, any field with
  1593. // an empty value appearing in NullFields will be sent to the server as
  1594. // null. It is an error if a field in this list has a non-empty value.
  1595. // This may be used to include null fields in Patch requests.
  1596. NullFields []string `json:"-"`
  1597. }
  1598. func (s *Policy) MarshalJSON() ([]byte, error) {
  1599. type NoMethod Policy
  1600. raw := NoMethod(*s)
  1601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1602. }
  1603. // Project: A Project is a high-level Google Cloud Platform entity. It
  1604. // is a
  1605. // container for ACLs, APIs, App Engine Apps, VMs, and other
  1606. // Google Cloud Platform resources.
  1607. type Project struct {
  1608. // CreateTime: Creation time.
  1609. //
  1610. // Read-only.
  1611. CreateTime string `json:"createTime,omitempty"`
  1612. // Labels: The labels associated with this Project.
  1613. //
  1614. // Label keys must be between 1 and 63 characters long and must
  1615. // conform
  1616. // to the following regular expression:
  1617. // \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?.
  1618. //
  1619. // Label values must be between 0 and 63 characters long and must
  1620. // conform
  1621. // to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?.
  1622. //
  1623. // No more than 256 labels can be associated with a given
  1624. // resource.
  1625. //
  1626. // Clients should store labels in a representation such as JSON that
  1627. // does not
  1628. // depend on specific characters being disallowed.
  1629. //
  1630. // Example: <code>"environment" : "dev"</code>
  1631. // Read-write.
  1632. Labels map[string]string `json:"labels,omitempty"`
  1633. // LifecycleState: The Project lifecycle state.
  1634. //
  1635. // Read-only.
  1636. //
  1637. // Possible values:
  1638. // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only
  1639. // used/useful for distinguishing
  1640. // unset values.
  1641. // "ACTIVE" - The normal and active state.
  1642. // "DELETE_REQUESTED" - The project has been marked for deletion by
  1643. // the user
  1644. // (by invoking
  1645. // DeleteProject)
  1646. // or by the system (Google Cloud Platform).
  1647. // This can generally be reversed by invoking UndeleteProject.
  1648. // "DELETE_IN_PROGRESS" - This lifecycle state is no longer used and
  1649. // not returned by the API.
  1650. LifecycleState string `json:"lifecycleState,omitempty"`
  1651. // Name: The user-assigned display name of the Project.
  1652. // It must be 4 to 30 characters.
  1653. // Allowed characters are: lowercase and uppercase letters,
  1654. // numbers,
  1655. // hyphen, single-quote, double-quote, space, and exclamation
  1656. // point.
  1657. //
  1658. // Example: <code>My Project</code>
  1659. // Read-write.
  1660. Name string `json:"name,omitempty"`
  1661. // Parent: An optional reference to a parent Resource.
  1662. //
  1663. // Supported parent types include "organization" and "folder". Once set,
  1664. // the
  1665. // parent cannot be cleared. The `parent` can be set on creation or
  1666. // using the
  1667. // `UpdateProject` method; the end user must have
  1668. // the
  1669. // `resourcemanager.projects.create` permission on the
  1670. // parent.
  1671. //
  1672. // Read-write.
  1673. Parent *ResourceId `json:"parent,omitempty"`
  1674. // ProjectId: The unique, user-assigned ID of the Project.
  1675. // It must be 6 to 30 lowercase letters, digits, or hyphens.
  1676. // It must start with a letter.
  1677. // Trailing hyphens are prohibited.
  1678. //
  1679. // Example: <code>tokyo-rain-123</code>
  1680. // Read-only after creation.
  1681. ProjectId string `json:"projectId,omitempty"`
  1682. // ProjectNumber: The number uniquely identifying the project.
  1683. //
  1684. // Example: <code>415104041262</code>
  1685. // Read-only.
  1686. ProjectNumber int64 `json:"projectNumber,omitempty,string"`
  1687. // ServerResponse contains the HTTP response code and headers from the
  1688. // server.
  1689. googleapi.ServerResponse `json:"-"`
  1690. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1691. // unconditionally include in API requests. By default, fields with
  1692. // empty values are omitted from API requests. However, any non-pointer,
  1693. // non-interface field appearing in ForceSendFields will be sent to the
  1694. // server regardless of whether the field is empty or not. This may be
  1695. // used to include empty fields in Patch requests.
  1696. ForceSendFields []string `json:"-"`
  1697. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1698. // API requests with the JSON null value. By default, fields with empty
  1699. // values are omitted from API requests. However, any field with an
  1700. // empty value appearing in NullFields will be sent to the server as
  1701. // null. It is an error if a field in this list has a non-empty value.
  1702. // This may be used to include null fields in Patch requests.
  1703. NullFields []string `json:"-"`
  1704. }
  1705. func (s *Project) MarshalJSON() ([]byte, error) {
  1706. type NoMethod Project
  1707. raw := NoMethod(*s)
  1708. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1709. }
  1710. // ProjectCreationStatus: A status object which is used as the
  1711. // `metadata` field for the Operation
  1712. // returned by CreateProject. It provides insight for when significant
  1713. // phases of
  1714. // Project creation have completed.
  1715. type ProjectCreationStatus struct {
  1716. // CreateTime: Creation time of the project creation workflow.
  1717. CreateTime string `json:"createTime,omitempty"`
  1718. // Gettable: True if the project can be retrieved using GetProject. No
  1719. // other operations
  1720. // on the project are guaranteed to work until the project creation
  1721. // is
  1722. // complete.
  1723. Gettable bool `json:"gettable,omitempty"`
  1724. // Ready: True if the project creation process is complete.
  1725. Ready bool `json:"ready,omitempty"`
  1726. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1727. // unconditionally include in API requests. By default, fields with
  1728. // empty values are omitted from API requests. However, any non-pointer,
  1729. // non-interface field appearing in ForceSendFields will be sent to the
  1730. // server regardless of whether the field is empty or not. This may be
  1731. // used to include empty fields in Patch requests.
  1732. ForceSendFields []string `json:"-"`
  1733. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1734. // API requests with the JSON null value. By default, fields with empty
  1735. // values are omitted from API requests. However, any field with an
  1736. // empty value appearing in NullFields will be sent to the server as
  1737. // null. It is an error if a field in this list has a non-empty value.
  1738. // This may be used to include null fields in Patch requests.
  1739. NullFields []string `json:"-"`
  1740. }
  1741. func (s *ProjectCreationStatus) MarshalJSON() ([]byte, error) {
  1742. type NoMethod ProjectCreationStatus
  1743. raw := NoMethod(*s)
  1744. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1745. }
  1746. // ResourceId: A container to reference an id for any resource type. A
  1747. // `resource` in Google
  1748. // Cloud Platform is a generic term for something you (a developer) may
  1749. // want to
  1750. // interact with through one of our API's. Some examples are an App
  1751. // Engine app,
  1752. // a Compute Engine instance, a Cloud SQL database, and so on.
  1753. type ResourceId struct {
  1754. // Id: Required field for the type-specific id. This should correspond
  1755. // to the id
  1756. // used in the type-specific API's.
  1757. Id string `json:"id,omitempty"`
  1758. // Type: Required field representing the resource type this id is
  1759. // for.
  1760. // At present, the valid types are: "organization"
  1761. Type string `json:"type,omitempty"`
  1762. // ForceSendFields is a list of field names (e.g. "Id") to
  1763. // unconditionally include in API requests. By default, fields with
  1764. // empty values are omitted from API requests. However, any non-pointer,
  1765. // non-interface field appearing in ForceSendFields will be sent to the
  1766. // server regardless of whether the field is empty or not. This may be
  1767. // used to include empty fields in Patch requests.
  1768. ForceSendFields []string `json:"-"`
  1769. // NullFields is a list of field names (e.g. "Id") to include in API
  1770. // requests with the JSON null value. By default, fields with empty
  1771. // values are omitted from API requests. However, any field with an
  1772. // empty value appearing in NullFields will be sent to the server as
  1773. // null. It is an error if a field in this list has a non-empty value.
  1774. // This may be used to include null fields in Patch requests.
  1775. NullFields []string `json:"-"`
  1776. }
  1777. func (s *ResourceId) MarshalJSON() ([]byte, error) {
  1778. type NoMethod ResourceId
  1779. raw := NoMethod(*s)
  1780. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1781. }
  1782. // RestoreDefault: Ignores policies set above this resource and restores
  1783. // the
  1784. // `constraint_default` enforcement behavior of the specific
  1785. // `Constraint` at
  1786. // this resource.
  1787. //
  1788. // Suppose that `constraint_default` is set to `ALLOW` for
  1789. // the
  1790. // `Constraint` `constraints/serviceuser.services`. Suppose that
  1791. // organization
  1792. // foo.com sets a `Policy` at their Organization resource node that
  1793. // restricts
  1794. // the allowed service activations to deny all service activations.
  1795. // They
  1796. // could then set a `Policy` with the `policy_type` `restore_default`
  1797. // on
  1798. // several experimental projects, restoring the
  1799. // `constraint_default`
  1800. // enforcement of the `Constraint` for only those projects, allowing
  1801. // those
  1802. // projects to have all services activated.
  1803. type RestoreDefault struct {
  1804. }
  1805. // SearchOrganizationsRequest: The request sent to the
  1806. // `SearchOrganizations` method.
  1807. type SearchOrganizationsRequest struct {
  1808. // Filter: An optional query string used to filter the Organizations to
  1809. // return in
  1810. // the response. Filter rules are case-insensitive.
  1811. //
  1812. //
  1813. // Organizations may be filtered by `owner.directoryCustomerId` or
  1814. // by
  1815. // `domain`, where the domain is a G Suite domain, for
  1816. // example:
  1817. //
  1818. // |Filter|Description|
  1819. // |------|-----------|
  1820. // |owner.directorycu
  1821. // stomerid:123456789|Organizations with
  1822. // `owner.directory_customer_id` equal to
  1823. // `123456789`.|
  1824. // |domain:google.com|Organizations corresponding to the domain
  1825. // `google.com`.|
  1826. //
  1827. // This field is optional.
  1828. Filter string `json:"filter,omitempty"`
  1829. // PageSize: The maximum number of Organizations to return in the
  1830. // response.
  1831. // This field is optional.
  1832. PageSize int64 `json:"pageSize,omitempty"`
  1833. // PageToken: A pagination token returned from a previous call to
  1834. // `SearchOrganizations`
  1835. // that indicates from where listing should continue.
  1836. // This field is optional.
  1837. PageToken string `json:"pageToken,omitempty"`
  1838. // ForceSendFields is a list of field names (e.g. "Filter") to
  1839. // unconditionally include in API requests. By default, fields with
  1840. // empty values are omitted from API requests. However, any non-pointer,
  1841. // non-interface field appearing in ForceSendFields will be sent to the
  1842. // server regardless of whether the field is empty or not. This may be
  1843. // used to include empty fields in Patch requests.
  1844. ForceSendFields []string `json:"-"`
  1845. // NullFields is a list of field names (e.g. "Filter") to include in API
  1846. // requests with the JSON null value. By default, fields with empty
  1847. // values are omitted from API requests. However, any field with an
  1848. // empty value appearing in NullFields will be sent to the server as
  1849. // null. It is an error if a field in this list has a non-empty value.
  1850. // This may be used to include null fields in Patch requests.
  1851. NullFields []string `json:"-"`
  1852. }
  1853. func (s *SearchOrganizationsRequest) MarshalJSON() ([]byte, error) {
  1854. type NoMethod SearchOrganizationsRequest
  1855. raw := NoMethod(*s)
  1856. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1857. }
  1858. // SearchOrganizationsResponse: The response returned from the
  1859. // `SearchOrganizations` method.
  1860. type SearchOrganizationsResponse struct {
  1861. // NextPageToken: A pagination token to be used to retrieve the next
  1862. // page of results. If the
  1863. // result is too large to fit within the page size specified in the
  1864. // request,
  1865. // this field will be set with a token that can be used to fetch the
  1866. // next page
  1867. // of results. If this field is empty, it indicates that this
  1868. // response
  1869. // contains the last page of results.
  1870. NextPageToken string `json:"nextPageToken,omitempty"`
  1871. // Organizations: The list of Organizations that matched the search
  1872. // query, possibly
  1873. // paginated.
  1874. Organizations []*Organization `json:"organizations,omitempty"`
  1875. // ServerResponse contains the HTTP response code and headers from the
  1876. // server.
  1877. googleapi.ServerResponse `json:"-"`
  1878. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1879. // unconditionally include in API requests. By default, fields with
  1880. // empty values are omitted from API requests. However, any non-pointer,
  1881. // non-interface field appearing in ForceSendFields will be sent to the
  1882. // server regardless of whether the field is empty or not. This may be
  1883. // used to include empty fields in Patch requests.
  1884. ForceSendFields []string `json:"-"`
  1885. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1886. // in API requests with the JSON null value. By default, fields with
  1887. // empty values are omitted from API requests. However, any field with
  1888. // an empty value appearing in NullFields will be sent to the server as
  1889. // null. It is an error if a field in this list has a non-empty value.
  1890. // This may be used to include null fields in Patch requests.
  1891. NullFields []string `json:"-"`
  1892. }
  1893. func (s *SearchOrganizationsResponse) MarshalJSON() ([]byte, error) {
  1894. type NoMethod SearchOrganizationsResponse
  1895. raw := NoMethod(*s)
  1896. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1897. }
  1898. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1899. type SetIamPolicyRequest struct {
  1900. // Policy: REQUIRED: The complete policy to be applied to the
  1901. // `resource`. The size of
  1902. // the policy is limited to a few 10s of KB. An empty policy is a
  1903. // valid policy but certain Cloud Platform services (such as
  1904. // Projects)
  1905. // might reject them.
  1906. Policy *Policy `json:"policy,omitempty"`
  1907. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  1908. // policy to modify. Only
  1909. // the fields in the mask will be modified. If no mask is provided,
  1910. // the
  1911. // following default mask is used:
  1912. // paths: "bindings, etag"
  1913. // This field is only used by Cloud IAM.
  1914. UpdateMask string `json:"updateMask,omitempty"`
  1915. // ForceSendFields is a list of field names (e.g. "Policy") to
  1916. // unconditionally include in API requests. By default, fields with
  1917. // empty values are omitted from API requests. However, any non-pointer,
  1918. // non-interface field appearing in ForceSendFields will be sent to the
  1919. // server regardless of whether the field is empty or not. This may be
  1920. // used to include empty fields in Patch requests.
  1921. ForceSendFields []string `json:"-"`
  1922. // NullFields is a list of field names (e.g. "Policy") to include in API
  1923. // requests with the JSON null value. By default, fields with empty
  1924. // values are omitted from API requests. However, any field with an
  1925. // empty value appearing in NullFields will be sent to the server as
  1926. // null. It is an error if a field in this list has a non-empty value.
  1927. // This may be used to include null fields in Patch requests.
  1928. NullFields []string `json:"-"`
  1929. }
  1930. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1931. type NoMethod SetIamPolicyRequest
  1932. raw := NoMethod(*s)
  1933. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1934. }
  1935. // SetOrgPolicyRequest: The request sent to the SetOrgPolicyRequest
  1936. // method.
  1937. type SetOrgPolicyRequest struct {
  1938. // Policy: `Policy` to set on the resource.
  1939. Policy *OrgPolicy `json:"policy,omitempty"`
  1940. // ForceSendFields is a list of field names (e.g. "Policy") to
  1941. // unconditionally include in API requests. By default, fields with
  1942. // empty values are omitted from API requests. However, any non-pointer,
  1943. // non-interface field appearing in ForceSendFields will be sent to the
  1944. // server regardless of whether the field is empty or not. This may be
  1945. // used to include empty fields in Patch requests.
  1946. ForceSendFields []string `json:"-"`
  1947. // NullFields is a list of field names (e.g. "Policy") to include in API
  1948. // requests with the JSON null value. By default, fields with empty
  1949. // values are omitted from API requests. However, any field with an
  1950. // empty value appearing in NullFields will be sent to the server as
  1951. // null. It is an error if a field in this list has a non-empty value.
  1952. // This may be used to include null fields in Patch requests.
  1953. NullFields []string `json:"-"`
  1954. }
  1955. func (s *SetOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  1956. type NoMethod SetOrgPolicyRequest
  1957. raw := NoMethod(*s)
  1958. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1959. }
  1960. // Status: The `Status` type defines a logical error model that is
  1961. // suitable for different
  1962. // programming environments, including REST APIs and RPC APIs. It is
  1963. // used by
  1964. // [gRPC](https://github.com/grpc). The error model is designed to
  1965. // be:
  1966. //
  1967. // - Simple to use and understand for most users
  1968. // - Flexible enough to meet unexpected needs
  1969. //
  1970. // # Overview
  1971. //
  1972. // The `Status` message contains three pieces of data: error code, error
  1973. // message,
  1974. // and error details. The error code should be an enum value
  1975. // of
  1976. // google.rpc.Code, but it may accept additional error codes if needed.
  1977. // The
  1978. // error message should be a developer-facing English message that
  1979. // helps
  1980. // developers *understand* and *resolve* the error. If a localized
  1981. // user-facing
  1982. // error message is needed, put the localized message in the error
  1983. // details or
  1984. // localize it in the client. The optional error details may contain
  1985. // arbitrary
  1986. // information about the error. There is a predefined set of error
  1987. // detail types
  1988. // in the package `google.rpc` that can be used for common error
  1989. // conditions.
  1990. //
  1991. // # Language mapping
  1992. //
  1993. // The `Status` message is the logical representation of the error
  1994. // model, but it
  1995. // is not necessarily the actual wire format. When the `Status` message
  1996. // is
  1997. // exposed in different client libraries and different wire protocols,
  1998. // it can be
  1999. // mapped differently. For example, it will likely be mapped to some
  2000. // exceptions
  2001. // in Java, but more likely mapped to some error codes in C.
  2002. //
  2003. // # Other uses
  2004. //
  2005. // The error model and the `Status` message can be used in a variety
  2006. // of
  2007. // environments, either with or without APIs, to provide a
  2008. // consistent developer experience across different
  2009. // environments.
  2010. //
  2011. // Example uses of this error model include:
  2012. //
  2013. // - Partial errors. If a service needs to return partial errors to the
  2014. // client,
  2015. // it may embed the `Status` in the normal response to indicate the
  2016. // partial
  2017. // errors.
  2018. //
  2019. // - Workflow errors. A typical workflow has multiple steps. Each step
  2020. // may
  2021. // have a `Status` message for error reporting.
  2022. //
  2023. // - Batch operations. If a client uses batch request and batch
  2024. // response, the
  2025. // `Status` message should be used directly inside batch response,
  2026. // one for
  2027. // each error sub-response.
  2028. //
  2029. // - Asynchronous operations. If an API call embeds asynchronous
  2030. // operation
  2031. // results in its response, the status of those operations should
  2032. // be
  2033. // represented directly using the `Status` message.
  2034. //
  2035. // - Logging. If some API errors are stored in logs, the message
  2036. // `Status` could
  2037. // be used directly after any stripping needed for security/privacy
  2038. // reasons.
  2039. type Status struct {
  2040. // Code: The status code, which should be an enum value of
  2041. // google.rpc.Code.
  2042. Code int64 `json:"code,omitempty"`
  2043. // Details: A list of messages that carry the error details. There is a
  2044. // common set of
  2045. // message types for APIs to use.
  2046. Details []googleapi.RawMessage `json:"details,omitempty"`
  2047. // Message: A developer-facing error message, which should be in
  2048. // English. Any
  2049. // user-facing error message should be localized and sent in
  2050. // the
  2051. // google.rpc.Status.details field, or localized by the client.
  2052. Message string `json:"message,omitempty"`
  2053. // ForceSendFields is a list of field names (e.g. "Code") to
  2054. // unconditionally include in API requests. By default, fields with
  2055. // empty values are omitted from API requests. However, any non-pointer,
  2056. // non-interface field appearing in ForceSendFields will be sent to the
  2057. // server regardless of whether the field is empty or not. This may be
  2058. // used to include empty fields in Patch requests.
  2059. ForceSendFields []string `json:"-"`
  2060. // NullFields is a list of field names (e.g. "Code") to include in API
  2061. // requests with the JSON null value. By default, fields with empty
  2062. // values are omitted from API requests. However, any field with an
  2063. // empty value appearing in NullFields will be sent to the server as
  2064. // null. It is an error if a field in this list has a non-empty value.
  2065. // This may be used to include null fields in Patch requests.
  2066. NullFields []string `json:"-"`
  2067. }
  2068. func (s *Status) MarshalJSON() ([]byte, error) {
  2069. type NoMethod Status
  2070. raw := NoMethod(*s)
  2071. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2072. }
  2073. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  2074. // method.
  2075. type TestIamPermissionsRequest struct {
  2076. // Permissions: The set of permissions to check for the `resource`.
  2077. // Permissions with
  2078. // wildcards (such as '*' or 'storage.*') are not allowed. For
  2079. // more
  2080. // information see
  2081. // [IAM
  2082. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  2083. Permissions []string `json:"permissions,omitempty"`
  2084. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2085. // unconditionally include in API requests. By default, fields with
  2086. // empty values are omitted from API requests. However, any non-pointer,
  2087. // non-interface field appearing in ForceSendFields will be sent to the
  2088. // server regardless of whether the field is empty or not. This may be
  2089. // used to include empty fields in Patch requests.
  2090. ForceSendFields []string `json:"-"`
  2091. // NullFields is a list of field names (e.g. "Permissions") to include
  2092. // in API requests with the JSON null value. By default, fields with
  2093. // empty values are omitted from API requests. However, any field with
  2094. // an empty value appearing in NullFields will be sent to the server as
  2095. // null. It is an error if a field in this list has a non-empty value.
  2096. // This may be used to include null fields in Patch requests.
  2097. NullFields []string `json:"-"`
  2098. }
  2099. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  2100. type NoMethod TestIamPermissionsRequest
  2101. raw := NoMethod(*s)
  2102. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2103. }
  2104. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  2105. // method.
  2106. type TestIamPermissionsResponse struct {
  2107. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  2108. // the caller is
  2109. // allowed.
  2110. Permissions []string `json:"permissions,omitempty"`
  2111. // ServerResponse contains the HTTP response code and headers from the
  2112. // server.
  2113. googleapi.ServerResponse `json:"-"`
  2114. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2115. // unconditionally include in API requests. By default, fields with
  2116. // empty values are omitted from API requests. However, any non-pointer,
  2117. // non-interface field appearing in ForceSendFields will be sent to the
  2118. // server regardless of whether the field is empty or not. This may be
  2119. // used to include empty fields in Patch requests.
  2120. ForceSendFields []string `json:"-"`
  2121. // NullFields is a list of field names (e.g. "Permissions") to include
  2122. // in API requests with the JSON null value. By default, fields with
  2123. // empty values are omitted from API requests. However, any field with
  2124. // an empty value appearing in NullFields will be sent to the server as
  2125. // null. It is an error if a field in this list has a non-empty value.
  2126. // This may be used to include null fields in Patch requests.
  2127. NullFields []string `json:"-"`
  2128. }
  2129. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  2130. type NoMethod TestIamPermissionsResponse
  2131. raw := NoMethod(*s)
  2132. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2133. }
  2134. // UndeleteProjectRequest: The request sent to the
  2135. // UndeleteProject
  2136. // method.
  2137. type UndeleteProjectRequest struct {
  2138. }
  2139. // method id "cloudresourcemanager.folders.clearOrgPolicy":
  2140. type FoldersClearOrgPolicyCall struct {
  2141. s *Service
  2142. resource string
  2143. clearorgpolicyrequest *ClearOrgPolicyRequest
  2144. urlParams_ gensupport.URLParams
  2145. ctx_ context.Context
  2146. header_ http.Header
  2147. }
  2148. // ClearOrgPolicy: Clears a `Policy` from a resource.
  2149. func (r *FoldersService) ClearOrgPolicy(resource string, clearorgpolicyrequest *ClearOrgPolicyRequest) *FoldersClearOrgPolicyCall {
  2150. c := &FoldersClearOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2151. c.resource = resource
  2152. c.clearorgpolicyrequest = clearorgpolicyrequest
  2153. return c
  2154. }
  2155. // Fields allows partial responses to be retrieved. See
  2156. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2157. // for more information.
  2158. func (c *FoldersClearOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersClearOrgPolicyCall {
  2159. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2160. return c
  2161. }
  2162. // Context sets the context to be used in this call's Do method. Any
  2163. // pending HTTP request will be aborted if the provided context is
  2164. // canceled.
  2165. func (c *FoldersClearOrgPolicyCall) Context(ctx context.Context) *FoldersClearOrgPolicyCall {
  2166. c.ctx_ = ctx
  2167. return c
  2168. }
  2169. // Header returns an http.Header that can be modified by the caller to
  2170. // add HTTP headers to the request.
  2171. func (c *FoldersClearOrgPolicyCall) Header() http.Header {
  2172. if c.header_ == nil {
  2173. c.header_ = make(http.Header)
  2174. }
  2175. return c.header_
  2176. }
  2177. func (c *FoldersClearOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  2178. reqHeaders := make(http.Header)
  2179. for k, v := range c.header_ {
  2180. reqHeaders[k] = v
  2181. }
  2182. reqHeaders.Set("User-Agent", c.s.userAgent())
  2183. var body io.Reader = nil
  2184. body, err := googleapi.WithoutDataWrapper.JSONReader(c.clearorgpolicyrequest)
  2185. if err != nil {
  2186. return nil, err
  2187. }
  2188. reqHeaders.Set("Content-Type", "application/json")
  2189. c.urlParams_.Set("alt", alt)
  2190. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:clearOrgPolicy")
  2191. urls += "?" + c.urlParams_.Encode()
  2192. req, _ := http.NewRequest("POST", urls, body)
  2193. req.Header = reqHeaders
  2194. googleapi.Expand(req.URL, map[string]string{
  2195. "resource": c.resource,
  2196. })
  2197. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2198. }
  2199. // Do executes the "cloudresourcemanager.folders.clearOrgPolicy" call.
  2200. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2201. // code is an error. Response headers are in either
  2202. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2203. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2204. // check whether the returned error was because http.StatusNotModified
  2205. // was returned.
  2206. func (c *FoldersClearOrgPolicyCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2207. gensupport.SetOptions(c.urlParams_, opts...)
  2208. res, err := c.doRequest("json")
  2209. if res != nil && res.StatusCode == http.StatusNotModified {
  2210. if res.Body != nil {
  2211. res.Body.Close()
  2212. }
  2213. return nil, &googleapi.Error{
  2214. Code: res.StatusCode,
  2215. Header: res.Header,
  2216. }
  2217. }
  2218. if err != nil {
  2219. return nil, err
  2220. }
  2221. defer googleapi.CloseBody(res)
  2222. if err := googleapi.CheckResponse(res); err != nil {
  2223. return nil, err
  2224. }
  2225. ret := &Empty{
  2226. ServerResponse: googleapi.ServerResponse{
  2227. Header: res.Header,
  2228. HTTPStatusCode: res.StatusCode,
  2229. },
  2230. }
  2231. target := &ret
  2232. if err := gensupport.DecodeResponse(target, res); err != nil {
  2233. return nil, err
  2234. }
  2235. return ret, nil
  2236. // {
  2237. // "description": "Clears a `Policy` from a resource.",
  2238. // "flatPath": "v1/folders/{foldersId}:clearOrgPolicy",
  2239. // "httpMethod": "POST",
  2240. // "id": "cloudresourcemanager.folders.clearOrgPolicy",
  2241. // "parameterOrder": [
  2242. // "resource"
  2243. // ],
  2244. // "parameters": {
  2245. // "resource": {
  2246. // "description": "Name of the resource for the `Policy` to clear.",
  2247. // "location": "path",
  2248. // "pattern": "^folders/[^/]+$",
  2249. // "required": true,
  2250. // "type": "string"
  2251. // }
  2252. // },
  2253. // "path": "v1/{+resource}:clearOrgPolicy",
  2254. // "request": {
  2255. // "$ref": "ClearOrgPolicyRequest"
  2256. // },
  2257. // "response": {
  2258. // "$ref": "Empty"
  2259. // },
  2260. // "scopes": [
  2261. // "https://www.googleapis.com/auth/cloud-platform"
  2262. // ]
  2263. // }
  2264. }
  2265. // method id "cloudresourcemanager.folders.getEffectiveOrgPolicy":
  2266. type FoldersGetEffectiveOrgPolicyCall struct {
  2267. s *Service
  2268. resource string
  2269. geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest
  2270. urlParams_ gensupport.URLParams
  2271. ctx_ context.Context
  2272. header_ http.Header
  2273. }
  2274. // GetEffectiveOrgPolicy: Gets the effective `Policy` on a resource.
  2275. // This is the result of merging
  2276. // `Policies` in the resource hierarchy. The returned `Policy` will not
  2277. // have
  2278. // an `etag`set because it is a computed `Policy` across multiple
  2279. // resources.
  2280. // Subtrees of Resource Manager resource hierarchy with 'under:' prefix
  2281. // will
  2282. // not be expanded.
  2283. func (r *FoldersService) GetEffectiveOrgPolicy(resource string, geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest) *FoldersGetEffectiveOrgPolicyCall {
  2284. c := &FoldersGetEffectiveOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2285. c.resource = resource
  2286. c.geteffectiveorgpolicyrequest = geteffectiveorgpolicyrequest
  2287. return c
  2288. }
  2289. // Fields allows partial responses to be retrieved. See
  2290. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2291. // for more information.
  2292. func (c *FoldersGetEffectiveOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersGetEffectiveOrgPolicyCall {
  2293. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2294. return c
  2295. }
  2296. // Context sets the context to be used in this call's Do method. Any
  2297. // pending HTTP request will be aborted if the provided context is
  2298. // canceled.
  2299. func (c *FoldersGetEffectiveOrgPolicyCall) Context(ctx context.Context) *FoldersGetEffectiveOrgPolicyCall {
  2300. c.ctx_ = ctx
  2301. return c
  2302. }
  2303. // Header returns an http.Header that can be modified by the caller to
  2304. // add HTTP headers to the request.
  2305. func (c *FoldersGetEffectiveOrgPolicyCall) Header() http.Header {
  2306. if c.header_ == nil {
  2307. c.header_ = make(http.Header)
  2308. }
  2309. return c.header_
  2310. }
  2311. func (c *FoldersGetEffectiveOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  2312. reqHeaders := make(http.Header)
  2313. for k, v := range c.header_ {
  2314. reqHeaders[k] = v
  2315. }
  2316. reqHeaders.Set("User-Agent", c.s.userAgent())
  2317. var body io.Reader = nil
  2318. body, err := googleapi.WithoutDataWrapper.JSONReader(c.geteffectiveorgpolicyrequest)
  2319. if err != nil {
  2320. return nil, err
  2321. }
  2322. reqHeaders.Set("Content-Type", "application/json")
  2323. c.urlParams_.Set("alt", alt)
  2324. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getEffectiveOrgPolicy")
  2325. urls += "?" + c.urlParams_.Encode()
  2326. req, _ := http.NewRequest("POST", urls, body)
  2327. req.Header = reqHeaders
  2328. googleapi.Expand(req.URL, map[string]string{
  2329. "resource": c.resource,
  2330. })
  2331. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2332. }
  2333. // Do executes the "cloudresourcemanager.folders.getEffectiveOrgPolicy" call.
  2334. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  2335. // status code is an error. Response headers are in either
  2336. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  2337. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2338. // to check whether the returned error was because
  2339. // http.StatusNotModified was returned.
  2340. func (c *FoldersGetEffectiveOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  2341. gensupport.SetOptions(c.urlParams_, opts...)
  2342. res, err := c.doRequest("json")
  2343. if res != nil && res.StatusCode == http.StatusNotModified {
  2344. if res.Body != nil {
  2345. res.Body.Close()
  2346. }
  2347. return nil, &googleapi.Error{
  2348. Code: res.StatusCode,
  2349. Header: res.Header,
  2350. }
  2351. }
  2352. if err != nil {
  2353. return nil, err
  2354. }
  2355. defer googleapi.CloseBody(res)
  2356. if err := googleapi.CheckResponse(res); err != nil {
  2357. return nil, err
  2358. }
  2359. ret := &OrgPolicy{
  2360. ServerResponse: googleapi.ServerResponse{
  2361. Header: res.Header,
  2362. HTTPStatusCode: res.StatusCode,
  2363. },
  2364. }
  2365. target := &ret
  2366. if err := gensupport.DecodeResponse(target, res); err != nil {
  2367. return nil, err
  2368. }
  2369. return ret, nil
  2370. // {
  2371. // "description": "Gets the effective `Policy` on a resource. This is the result of merging\n`Policies` in the resource hierarchy. The returned `Policy` will not have\nan `etag`set because it is a computed `Policy` across multiple resources.\nSubtrees of Resource Manager resource hierarchy with 'under:' prefix will\nnot be expanded.",
  2372. // "flatPath": "v1/folders/{foldersId}:getEffectiveOrgPolicy",
  2373. // "httpMethod": "POST",
  2374. // "id": "cloudresourcemanager.folders.getEffectiveOrgPolicy",
  2375. // "parameterOrder": [
  2376. // "resource"
  2377. // ],
  2378. // "parameters": {
  2379. // "resource": {
  2380. // "description": "The name of the resource to start computing the effective `Policy`.",
  2381. // "location": "path",
  2382. // "pattern": "^folders/[^/]+$",
  2383. // "required": true,
  2384. // "type": "string"
  2385. // }
  2386. // },
  2387. // "path": "v1/{+resource}:getEffectiveOrgPolicy",
  2388. // "request": {
  2389. // "$ref": "GetEffectiveOrgPolicyRequest"
  2390. // },
  2391. // "response": {
  2392. // "$ref": "OrgPolicy"
  2393. // },
  2394. // "scopes": [
  2395. // "https://www.googleapis.com/auth/cloud-platform",
  2396. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2397. // ]
  2398. // }
  2399. }
  2400. // method id "cloudresourcemanager.folders.getOrgPolicy":
  2401. type FoldersGetOrgPolicyCall struct {
  2402. s *Service
  2403. resource string
  2404. getorgpolicyrequest *GetOrgPolicyRequest
  2405. urlParams_ gensupport.URLParams
  2406. ctx_ context.Context
  2407. header_ http.Header
  2408. }
  2409. // GetOrgPolicy: Gets a `Policy` on a resource.
  2410. //
  2411. // If no `Policy` is set on the resource, a `Policy` is returned with
  2412. // default
  2413. // values including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`.
  2414. // The
  2415. // `etag` value can be used with `SetOrgPolicy()` to create or update
  2416. // a
  2417. // `Policy` during read-modify-write.
  2418. func (r *FoldersService) GetOrgPolicy(resource string, getorgpolicyrequest *GetOrgPolicyRequest) *FoldersGetOrgPolicyCall {
  2419. c := &FoldersGetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2420. c.resource = resource
  2421. c.getorgpolicyrequest = getorgpolicyrequest
  2422. return c
  2423. }
  2424. // Fields allows partial responses to be retrieved. See
  2425. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2426. // for more information.
  2427. func (c *FoldersGetOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersGetOrgPolicyCall {
  2428. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2429. return c
  2430. }
  2431. // Context sets the context to be used in this call's Do method. Any
  2432. // pending HTTP request will be aborted if the provided context is
  2433. // canceled.
  2434. func (c *FoldersGetOrgPolicyCall) Context(ctx context.Context) *FoldersGetOrgPolicyCall {
  2435. c.ctx_ = ctx
  2436. return c
  2437. }
  2438. // Header returns an http.Header that can be modified by the caller to
  2439. // add HTTP headers to the request.
  2440. func (c *FoldersGetOrgPolicyCall) Header() http.Header {
  2441. if c.header_ == nil {
  2442. c.header_ = make(http.Header)
  2443. }
  2444. return c.header_
  2445. }
  2446. func (c *FoldersGetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  2447. reqHeaders := make(http.Header)
  2448. for k, v := range c.header_ {
  2449. reqHeaders[k] = v
  2450. }
  2451. reqHeaders.Set("User-Agent", c.s.userAgent())
  2452. var body io.Reader = nil
  2453. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getorgpolicyrequest)
  2454. if err != nil {
  2455. return nil, err
  2456. }
  2457. reqHeaders.Set("Content-Type", "application/json")
  2458. c.urlParams_.Set("alt", alt)
  2459. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getOrgPolicy")
  2460. urls += "?" + c.urlParams_.Encode()
  2461. req, _ := http.NewRequest("POST", urls, body)
  2462. req.Header = reqHeaders
  2463. googleapi.Expand(req.URL, map[string]string{
  2464. "resource": c.resource,
  2465. })
  2466. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2467. }
  2468. // Do executes the "cloudresourcemanager.folders.getOrgPolicy" call.
  2469. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  2470. // status code is an error. Response headers are in either
  2471. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  2472. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2473. // to check whether the returned error was because
  2474. // http.StatusNotModified was returned.
  2475. func (c *FoldersGetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  2476. gensupport.SetOptions(c.urlParams_, opts...)
  2477. res, err := c.doRequest("json")
  2478. if res != nil && res.StatusCode == http.StatusNotModified {
  2479. if res.Body != nil {
  2480. res.Body.Close()
  2481. }
  2482. return nil, &googleapi.Error{
  2483. Code: res.StatusCode,
  2484. Header: res.Header,
  2485. }
  2486. }
  2487. if err != nil {
  2488. return nil, err
  2489. }
  2490. defer googleapi.CloseBody(res)
  2491. if err := googleapi.CheckResponse(res); err != nil {
  2492. return nil, err
  2493. }
  2494. ret := &OrgPolicy{
  2495. ServerResponse: googleapi.ServerResponse{
  2496. Header: res.Header,
  2497. HTTPStatusCode: res.StatusCode,
  2498. },
  2499. }
  2500. target := &ret
  2501. if err := gensupport.DecodeResponse(target, res); err != nil {
  2502. return nil, err
  2503. }
  2504. return ret, nil
  2505. // {
  2506. // "description": "Gets a `Policy` on a resource.\n\nIf no `Policy` is set on the resource, a `Policy` is returned with default\nvalues including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`. The\n`etag` value can be used with `SetOrgPolicy()` to create or update a\n`Policy` during read-modify-write.",
  2507. // "flatPath": "v1/folders/{foldersId}:getOrgPolicy",
  2508. // "httpMethod": "POST",
  2509. // "id": "cloudresourcemanager.folders.getOrgPolicy",
  2510. // "parameterOrder": [
  2511. // "resource"
  2512. // ],
  2513. // "parameters": {
  2514. // "resource": {
  2515. // "description": "Name of the resource the `Policy` is set on.",
  2516. // "location": "path",
  2517. // "pattern": "^folders/[^/]+$",
  2518. // "required": true,
  2519. // "type": "string"
  2520. // }
  2521. // },
  2522. // "path": "v1/{+resource}:getOrgPolicy",
  2523. // "request": {
  2524. // "$ref": "GetOrgPolicyRequest"
  2525. // },
  2526. // "response": {
  2527. // "$ref": "OrgPolicy"
  2528. // },
  2529. // "scopes": [
  2530. // "https://www.googleapis.com/auth/cloud-platform",
  2531. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2532. // ]
  2533. // }
  2534. }
  2535. // method id "cloudresourcemanager.folders.listAvailableOrgPolicyConstraints":
  2536. type FoldersListAvailableOrgPolicyConstraintsCall struct {
  2537. s *Service
  2538. resource string
  2539. listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest
  2540. urlParams_ gensupport.URLParams
  2541. ctx_ context.Context
  2542. header_ http.Header
  2543. }
  2544. // ListAvailableOrgPolicyConstraints: Lists `Constraints` that could be
  2545. // applied on the specified resource.
  2546. func (r *FoldersService) ListAvailableOrgPolicyConstraints(resource string, listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest) *FoldersListAvailableOrgPolicyConstraintsCall {
  2547. c := &FoldersListAvailableOrgPolicyConstraintsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2548. c.resource = resource
  2549. c.listavailableorgpolicyconstraintsrequest = listavailableorgpolicyconstraintsrequest
  2550. return c
  2551. }
  2552. // Fields allows partial responses to be retrieved. See
  2553. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2554. // for more information.
  2555. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Fields(s ...googleapi.Field) *FoldersListAvailableOrgPolicyConstraintsCall {
  2556. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2557. return c
  2558. }
  2559. // Context sets the context to be used in this call's Do method. Any
  2560. // pending HTTP request will be aborted if the provided context is
  2561. // canceled.
  2562. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Context(ctx context.Context) *FoldersListAvailableOrgPolicyConstraintsCall {
  2563. c.ctx_ = ctx
  2564. return c
  2565. }
  2566. // Header returns an http.Header that can be modified by the caller to
  2567. // add HTTP headers to the request.
  2568. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Header() http.Header {
  2569. if c.header_ == nil {
  2570. c.header_ = make(http.Header)
  2571. }
  2572. return c.header_
  2573. }
  2574. func (c *FoldersListAvailableOrgPolicyConstraintsCall) doRequest(alt string) (*http.Response, error) {
  2575. reqHeaders := make(http.Header)
  2576. for k, v := range c.header_ {
  2577. reqHeaders[k] = v
  2578. }
  2579. reqHeaders.Set("User-Agent", c.s.userAgent())
  2580. var body io.Reader = nil
  2581. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listavailableorgpolicyconstraintsrequest)
  2582. if err != nil {
  2583. return nil, err
  2584. }
  2585. reqHeaders.Set("Content-Type", "application/json")
  2586. c.urlParams_.Set("alt", alt)
  2587. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listAvailableOrgPolicyConstraints")
  2588. urls += "?" + c.urlParams_.Encode()
  2589. req, _ := http.NewRequest("POST", urls, body)
  2590. req.Header = reqHeaders
  2591. googleapi.Expand(req.URL, map[string]string{
  2592. "resource": c.resource,
  2593. })
  2594. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2595. }
  2596. // Do executes the "cloudresourcemanager.folders.listAvailableOrgPolicyConstraints" call.
  2597. // Exactly one of *ListAvailableOrgPolicyConstraintsResponse or error
  2598. // will be non-nil. Any non-2xx status code is an error. Response
  2599. // headers are in either
  2600. // *ListAvailableOrgPolicyConstraintsResponse.ServerResponse.Header or
  2601. // (if a response was returned at all) in
  2602. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2603. // whether the returned error was because http.StatusNotModified was
  2604. // returned.
  2605. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Do(opts ...googleapi.CallOption) (*ListAvailableOrgPolicyConstraintsResponse, error) {
  2606. gensupport.SetOptions(c.urlParams_, opts...)
  2607. res, err := c.doRequest("json")
  2608. if res != nil && res.StatusCode == http.StatusNotModified {
  2609. if res.Body != nil {
  2610. res.Body.Close()
  2611. }
  2612. return nil, &googleapi.Error{
  2613. Code: res.StatusCode,
  2614. Header: res.Header,
  2615. }
  2616. }
  2617. if err != nil {
  2618. return nil, err
  2619. }
  2620. defer googleapi.CloseBody(res)
  2621. if err := googleapi.CheckResponse(res); err != nil {
  2622. return nil, err
  2623. }
  2624. ret := &ListAvailableOrgPolicyConstraintsResponse{
  2625. ServerResponse: googleapi.ServerResponse{
  2626. Header: res.Header,
  2627. HTTPStatusCode: res.StatusCode,
  2628. },
  2629. }
  2630. target := &ret
  2631. if err := gensupport.DecodeResponse(target, res); err != nil {
  2632. return nil, err
  2633. }
  2634. return ret, nil
  2635. // {
  2636. // "description": "Lists `Constraints` that could be applied on the specified resource.",
  2637. // "flatPath": "v1/folders/{foldersId}:listAvailableOrgPolicyConstraints",
  2638. // "httpMethod": "POST",
  2639. // "id": "cloudresourcemanager.folders.listAvailableOrgPolicyConstraints",
  2640. // "parameterOrder": [
  2641. // "resource"
  2642. // ],
  2643. // "parameters": {
  2644. // "resource": {
  2645. // "description": "Name of the resource to list `Constraints` for.",
  2646. // "location": "path",
  2647. // "pattern": "^folders/[^/]+$",
  2648. // "required": true,
  2649. // "type": "string"
  2650. // }
  2651. // },
  2652. // "path": "v1/{+resource}:listAvailableOrgPolicyConstraints",
  2653. // "request": {
  2654. // "$ref": "ListAvailableOrgPolicyConstraintsRequest"
  2655. // },
  2656. // "response": {
  2657. // "$ref": "ListAvailableOrgPolicyConstraintsResponse"
  2658. // },
  2659. // "scopes": [
  2660. // "https://www.googleapis.com/auth/cloud-platform",
  2661. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2662. // ]
  2663. // }
  2664. }
  2665. // Pages invokes f for each page of results.
  2666. // A non-nil error returned from f will halt the iteration.
  2667. // The provided context supersedes any context provided to the Context method.
  2668. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Pages(ctx context.Context, f func(*ListAvailableOrgPolicyConstraintsResponse) error) error {
  2669. c.ctx_ = ctx
  2670. defer func(pt string) { c.listavailableorgpolicyconstraintsrequest.PageToken = pt }(c.listavailableorgpolicyconstraintsrequest.PageToken) // reset paging to original point
  2671. for {
  2672. x, err := c.Do()
  2673. if err != nil {
  2674. return err
  2675. }
  2676. if err := f(x); err != nil {
  2677. return err
  2678. }
  2679. if x.NextPageToken == "" {
  2680. return nil
  2681. }
  2682. c.listavailableorgpolicyconstraintsrequest.PageToken = x.NextPageToken
  2683. }
  2684. }
  2685. // method id "cloudresourcemanager.folders.listOrgPolicies":
  2686. type FoldersListOrgPoliciesCall struct {
  2687. s *Service
  2688. resource string
  2689. listorgpoliciesrequest *ListOrgPoliciesRequest
  2690. urlParams_ gensupport.URLParams
  2691. ctx_ context.Context
  2692. header_ http.Header
  2693. }
  2694. // ListOrgPolicies: Lists all the `Policies` set for a particular
  2695. // resource.
  2696. func (r *FoldersService) ListOrgPolicies(resource string, listorgpoliciesrequest *ListOrgPoliciesRequest) *FoldersListOrgPoliciesCall {
  2697. c := &FoldersListOrgPoliciesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2698. c.resource = resource
  2699. c.listorgpoliciesrequest = listorgpoliciesrequest
  2700. return c
  2701. }
  2702. // Fields allows partial responses to be retrieved. See
  2703. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2704. // for more information.
  2705. func (c *FoldersListOrgPoliciesCall) Fields(s ...googleapi.Field) *FoldersListOrgPoliciesCall {
  2706. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2707. return c
  2708. }
  2709. // Context sets the context to be used in this call's Do method. Any
  2710. // pending HTTP request will be aborted if the provided context is
  2711. // canceled.
  2712. func (c *FoldersListOrgPoliciesCall) Context(ctx context.Context) *FoldersListOrgPoliciesCall {
  2713. c.ctx_ = ctx
  2714. return c
  2715. }
  2716. // Header returns an http.Header that can be modified by the caller to
  2717. // add HTTP headers to the request.
  2718. func (c *FoldersListOrgPoliciesCall) Header() http.Header {
  2719. if c.header_ == nil {
  2720. c.header_ = make(http.Header)
  2721. }
  2722. return c.header_
  2723. }
  2724. func (c *FoldersListOrgPoliciesCall) doRequest(alt string) (*http.Response, error) {
  2725. reqHeaders := make(http.Header)
  2726. for k, v := range c.header_ {
  2727. reqHeaders[k] = v
  2728. }
  2729. reqHeaders.Set("User-Agent", c.s.userAgent())
  2730. var body io.Reader = nil
  2731. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listorgpoliciesrequest)
  2732. if err != nil {
  2733. return nil, err
  2734. }
  2735. reqHeaders.Set("Content-Type", "application/json")
  2736. c.urlParams_.Set("alt", alt)
  2737. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listOrgPolicies")
  2738. urls += "?" + c.urlParams_.Encode()
  2739. req, _ := http.NewRequest("POST", urls, body)
  2740. req.Header = reqHeaders
  2741. googleapi.Expand(req.URL, map[string]string{
  2742. "resource": c.resource,
  2743. })
  2744. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2745. }
  2746. // Do executes the "cloudresourcemanager.folders.listOrgPolicies" call.
  2747. // Exactly one of *ListOrgPoliciesResponse or error will be non-nil. Any
  2748. // non-2xx status code is an error. Response headers are in either
  2749. // *ListOrgPoliciesResponse.ServerResponse.Header or (if a response was
  2750. // returned at all) in error.(*googleapi.Error).Header. Use
  2751. // googleapi.IsNotModified to check whether the returned error was
  2752. // because http.StatusNotModified was returned.
  2753. func (c *FoldersListOrgPoliciesCall) Do(opts ...googleapi.CallOption) (*ListOrgPoliciesResponse, error) {
  2754. gensupport.SetOptions(c.urlParams_, opts...)
  2755. res, err := c.doRequest("json")
  2756. if res != nil && res.StatusCode == http.StatusNotModified {
  2757. if res.Body != nil {
  2758. res.Body.Close()
  2759. }
  2760. return nil, &googleapi.Error{
  2761. Code: res.StatusCode,
  2762. Header: res.Header,
  2763. }
  2764. }
  2765. if err != nil {
  2766. return nil, err
  2767. }
  2768. defer googleapi.CloseBody(res)
  2769. if err := googleapi.CheckResponse(res); err != nil {
  2770. return nil, err
  2771. }
  2772. ret := &ListOrgPoliciesResponse{
  2773. ServerResponse: googleapi.ServerResponse{
  2774. Header: res.Header,
  2775. HTTPStatusCode: res.StatusCode,
  2776. },
  2777. }
  2778. target := &ret
  2779. if err := gensupport.DecodeResponse(target, res); err != nil {
  2780. return nil, err
  2781. }
  2782. return ret, nil
  2783. // {
  2784. // "description": "Lists all the `Policies` set for a particular resource.",
  2785. // "flatPath": "v1/folders/{foldersId}:listOrgPolicies",
  2786. // "httpMethod": "POST",
  2787. // "id": "cloudresourcemanager.folders.listOrgPolicies",
  2788. // "parameterOrder": [
  2789. // "resource"
  2790. // ],
  2791. // "parameters": {
  2792. // "resource": {
  2793. // "description": "Name of the resource to list Policies for.",
  2794. // "location": "path",
  2795. // "pattern": "^folders/[^/]+$",
  2796. // "required": true,
  2797. // "type": "string"
  2798. // }
  2799. // },
  2800. // "path": "v1/{+resource}:listOrgPolicies",
  2801. // "request": {
  2802. // "$ref": "ListOrgPoliciesRequest"
  2803. // },
  2804. // "response": {
  2805. // "$ref": "ListOrgPoliciesResponse"
  2806. // },
  2807. // "scopes": [
  2808. // "https://www.googleapis.com/auth/cloud-platform",
  2809. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2810. // ]
  2811. // }
  2812. }
  2813. // Pages invokes f for each page of results.
  2814. // A non-nil error returned from f will halt the iteration.
  2815. // The provided context supersedes any context provided to the Context method.
  2816. func (c *FoldersListOrgPoliciesCall) Pages(ctx context.Context, f func(*ListOrgPoliciesResponse) error) error {
  2817. c.ctx_ = ctx
  2818. defer func(pt string) { c.listorgpoliciesrequest.PageToken = pt }(c.listorgpoliciesrequest.PageToken) // reset paging to original point
  2819. for {
  2820. x, err := c.Do()
  2821. if err != nil {
  2822. return err
  2823. }
  2824. if err := f(x); err != nil {
  2825. return err
  2826. }
  2827. if x.NextPageToken == "" {
  2828. return nil
  2829. }
  2830. c.listorgpoliciesrequest.PageToken = x.NextPageToken
  2831. }
  2832. }
  2833. // method id "cloudresourcemanager.folders.setOrgPolicy":
  2834. type FoldersSetOrgPolicyCall struct {
  2835. s *Service
  2836. resource string
  2837. setorgpolicyrequest *SetOrgPolicyRequest
  2838. urlParams_ gensupport.URLParams
  2839. ctx_ context.Context
  2840. header_ http.Header
  2841. }
  2842. // SetOrgPolicy: Updates the specified `Policy` on the resource. Creates
  2843. // a new `Policy` for
  2844. // that `Constraint` on the resource if one does not exist.
  2845. //
  2846. // Not supplying an `etag` on the request `Policy` results in an
  2847. // unconditional
  2848. // write of the `Policy`.
  2849. func (r *FoldersService) SetOrgPolicy(resource string, setorgpolicyrequest *SetOrgPolicyRequest) *FoldersSetOrgPolicyCall {
  2850. c := &FoldersSetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2851. c.resource = resource
  2852. c.setorgpolicyrequest = setorgpolicyrequest
  2853. return c
  2854. }
  2855. // Fields allows partial responses to be retrieved. See
  2856. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2857. // for more information.
  2858. func (c *FoldersSetOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersSetOrgPolicyCall {
  2859. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2860. return c
  2861. }
  2862. // Context sets the context to be used in this call's Do method. Any
  2863. // pending HTTP request will be aborted if the provided context is
  2864. // canceled.
  2865. func (c *FoldersSetOrgPolicyCall) Context(ctx context.Context) *FoldersSetOrgPolicyCall {
  2866. c.ctx_ = ctx
  2867. return c
  2868. }
  2869. // Header returns an http.Header that can be modified by the caller to
  2870. // add HTTP headers to the request.
  2871. func (c *FoldersSetOrgPolicyCall) Header() http.Header {
  2872. if c.header_ == nil {
  2873. c.header_ = make(http.Header)
  2874. }
  2875. return c.header_
  2876. }
  2877. func (c *FoldersSetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  2878. reqHeaders := make(http.Header)
  2879. for k, v := range c.header_ {
  2880. reqHeaders[k] = v
  2881. }
  2882. reqHeaders.Set("User-Agent", c.s.userAgent())
  2883. var body io.Reader = nil
  2884. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setorgpolicyrequest)
  2885. if err != nil {
  2886. return nil, err
  2887. }
  2888. reqHeaders.Set("Content-Type", "application/json")
  2889. c.urlParams_.Set("alt", alt)
  2890. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setOrgPolicy")
  2891. urls += "?" + c.urlParams_.Encode()
  2892. req, _ := http.NewRequest("POST", urls, body)
  2893. req.Header = reqHeaders
  2894. googleapi.Expand(req.URL, map[string]string{
  2895. "resource": c.resource,
  2896. })
  2897. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2898. }
  2899. // Do executes the "cloudresourcemanager.folders.setOrgPolicy" call.
  2900. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  2901. // status code is an error. Response headers are in either
  2902. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  2903. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2904. // to check whether the returned error was because
  2905. // http.StatusNotModified was returned.
  2906. func (c *FoldersSetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  2907. gensupport.SetOptions(c.urlParams_, opts...)
  2908. res, err := c.doRequest("json")
  2909. if res != nil && res.StatusCode == http.StatusNotModified {
  2910. if res.Body != nil {
  2911. res.Body.Close()
  2912. }
  2913. return nil, &googleapi.Error{
  2914. Code: res.StatusCode,
  2915. Header: res.Header,
  2916. }
  2917. }
  2918. if err != nil {
  2919. return nil, err
  2920. }
  2921. defer googleapi.CloseBody(res)
  2922. if err := googleapi.CheckResponse(res); err != nil {
  2923. return nil, err
  2924. }
  2925. ret := &OrgPolicy{
  2926. ServerResponse: googleapi.ServerResponse{
  2927. Header: res.Header,
  2928. HTTPStatusCode: res.StatusCode,
  2929. },
  2930. }
  2931. target := &ret
  2932. if err := gensupport.DecodeResponse(target, res); err != nil {
  2933. return nil, err
  2934. }
  2935. return ret, nil
  2936. // {
  2937. // "description": "Updates the specified `Policy` on the resource. Creates a new `Policy` for\nthat `Constraint` on the resource if one does not exist.\n\nNot supplying an `etag` on the request `Policy` results in an unconditional\nwrite of the `Policy`.",
  2938. // "flatPath": "v1/folders/{foldersId}:setOrgPolicy",
  2939. // "httpMethod": "POST",
  2940. // "id": "cloudresourcemanager.folders.setOrgPolicy",
  2941. // "parameterOrder": [
  2942. // "resource"
  2943. // ],
  2944. // "parameters": {
  2945. // "resource": {
  2946. // "description": "Resource name of the resource to attach the `Policy`.",
  2947. // "location": "path",
  2948. // "pattern": "^folders/[^/]+$",
  2949. // "required": true,
  2950. // "type": "string"
  2951. // }
  2952. // },
  2953. // "path": "v1/{+resource}:setOrgPolicy",
  2954. // "request": {
  2955. // "$ref": "SetOrgPolicyRequest"
  2956. // },
  2957. // "response": {
  2958. // "$ref": "OrgPolicy"
  2959. // },
  2960. // "scopes": [
  2961. // "https://www.googleapis.com/auth/cloud-platform"
  2962. // ]
  2963. // }
  2964. }
  2965. // method id "cloudresourcemanager.liens.create":
  2966. type LiensCreateCall struct {
  2967. s *Service
  2968. lien *Lien
  2969. urlParams_ gensupport.URLParams
  2970. ctx_ context.Context
  2971. header_ http.Header
  2972. }
  2973. // Create: Create a Lien which applies to the resource denoted by the
  2974. // `parent` field.
  2975. //
  2976. // Callers of this method will require permission on the `parent`
  2977. // resource.
  2978. // For example, applying to `projects/1234` requires
  2979. // permission
  2980. // `resourcemanager.projects.updateLiens`.
  2981. //
  2982. // NOTE: Some resources may limit the number of Liens which may be
  2983. // applied.
  2984. func (r *LiensService) Create(lien *Lien) *LiensCreateCall {
  2985. c := &LiensCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2986. c.lien = lien
  2987. return c
  2988. }
  2989. // Fields allows partial responses to be retrieved. See
  2990. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2991. // for more information.
  2992. func (c *LiensCreateCall) Fields(s ...googleapi.Field) *LiensCreateCall {
  2993. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2994. return c
  2995. }
  2996. // Context sets the context to be used in this call's Do method. Any
  2997. // pending HTTP request will be aborted if the provided context is
  2998. // canceled.
  2999. func (c *LiensCreateCall) Context(ctx context.Context) *LiensCreateCall {
  3000. c.ctx_ = ctx
  3001. return c
  3002. }
  3003. // Header returns an http.Header that can be modified by the caller to
  3004. // add HTTP headers to the request.
  3005. func (c *LiensCreateCall) Header() http.Header {
  3006. if c.header_ == nil {
  3007. c.header_ = make(http.Header)
  3008. }
  3009. return c.header_
  3010. }
  3011. func (c *LiensCreateCall) doRequest(alt string) (*http.Response, error) {
  3012. reqHeaders := make(http.Header)
  3013. for k, v := range c.header_ {
  3014. reqHeaders[k] = v
  3015. }
  3016. reqHeaders.Set("User-Agent", c.s.userAgent())
  3017. var body io.Reader = nil
  3018. body, err := googleapi.WithoutDataWrapper.JSONReader(c.lien)
  3019. if err != nil {
  3020. return nil, err
  3021. }
  3022. reqHeaders.Set("Content-Type", "application/json")
  3023. c.urlParams_.Set("alt", alt)
  3024. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/liens")
  3025. urls += "?" + c.urlParams_.Encode()
  3026. req, _ := http.NewRequest("POST", urls, body)
  3027. req.Header = reqHeaders
  3028. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3029. }
  3030. // Do executes the "cloudresourcemanager.liens.create" call.
  3031. // Exactly one of *Lien or error will be non-nil. Any non-2xx status
  3032. // code is an error. Response headers are in either
  3033. // *Lien.ServerResponse.Header or (if a response was returned at all) in
  3034. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3035. // whether the returned error was because http.StatusNotModified was
  3036. // returned.
  3037. func (c *LiensCreateCall) Do(opts ...googleapi.CallOption) (*Lien, error) {
  3038. gensupport.SetOptions(c.urlParams_, opts...)
  3039. res, err := c.doRequest("json")
  3040. if res != nil && res.StatusCode == http.StatusNotModified {
  3041. if res.Body != nil {
  3042. res.Body.Close()
  3043. }
  3044. return nil, &googleapi.Error{
  3045. Code: res.StatusCode,
  3046. Header: res.Header,
  3047. }
  3048. }
  3049. if err != nil {
  3050. return nil, err
  3051. }
  3052. defer googleapi.CloseBody(res)
  3053. if err := googleapi.CheckResponse(res); err != nil {
  3054. return nil, err
  3055. }
  3056. ret := &Lien{
  3057. ServerResponse: googleapi.ServerResponse{
  3058. Header: res.Header,
  3059. HTTPStatusCode: res.StatusCode,
  3060. },
  3061. }
  3062. target := &ret
  3063. if err := gensupport.DecodeResponse(target, res); err != nil {
  3064. return nil, err
  3065. }
  3066. return ret, nil
  3067. // {
  3068. // "description": "Create a Lien which applies to the resource denoted by the `parent` field.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, applying to `projects/1234` requires permission\n`resourcemanager.projects.updateLiens`.\n\nNOTE: Some resources may limit the number of Liens which may be applied.",
  3069. // "flatPath": "v1/liens",
  3070. // "httpMethod": "POST",
  3071. // "id": "cloudresourcemanager.liens.create",
  3072. // "parameterOrder": [],
  3073. // "parameters": {},
  3074. // "path": "v1/liens",
  3075. // "request": {
  3076. // "$ref": "Lien"
  3077. // },
  3078. // "response": {
  3079. // "$ref": "Lien"
  3080. // },
  3081. // "scopes": [
  3082. // "https://www.googleapis.com/auth/cloud-platform",
  3083. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3084. // ]
  3085. // }
  3086. }
  3087. // method id "cloudresourcemanager.liens.delete":
  3088. type LiensDeleteCall struct {
  3089. s *Service
  3090. nameid string
  3091. urlParams_ gensupport.URLParams
  3092. ctx_ context.Context
  3093. header_ http.Header
  3094. }
  3095. // Delete: Delete a Lien by `name`.
  3096. //
  3097. // Callers of this method will require permission on the `parent`
  3098. // resource.
  3099. // For example, a Lien with a `parent` of `projects/1234` requires
  3100. // permission
  3101. // `resourcemanager.projects.updateLiens`.
  3102. func (r *LiensService) Delete(nameid string) *LiensDeleteCall {
  3103. c := &LiensDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3104. c.nameid = nameid
  3105. return c
  3106. }
  3107. // Fields allows partial responses to be retrieved. See
  3108. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3109. // for more information.
  3110. func (c *LiensDeleteCall) Fields(s ...googleapi.Field) *LiensDeleteCall {
  3111. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3112. return c
  3113. }
  3114. // Context sets the context to be used in this call's Do method. Any
  3115. // pending HTTP request will be aborted if the provided context is
  3116. // canceled.
  3117. func (c *LiensDeleteCall) Context(ctx context.Context) *LiensDeleteCall {
  3118. c.ctx_ = ctx
  3119. return c
  3120. }
  3121. // Header returns an http.Header that can be modified by the caller to
  3122. // add HTTP headers to the request.
  3123. func (c *LiensDeleteCall) Header() http.Header {
  3124. if c.header_ == nil {
  3125. c.header_ = make(http.Header)
  3126. }
  3127. return c.header_
  3128. }
  3129. func (c *LiensDeleteCall) doRequest(alt string) (*http.Response, error) {
  3130. reqHeaders := make(http.Header)
  3131. for k, v := range c.header_ {
  3132. reqHeaders[k] = v
  3133. }
  3134. reqHeaders.Set("User-Agent", c.s.userAgent())
  3135. var body io.Reader = nil
  3136. c.urlParams_.Set("alt", alt)
  3137. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3138. urls += "?" + c.urlParams_.Encode()
  3139. req, _ := http.NewRequest("DELETE", urls, body)
  3140. req.Header = reqHeaders
  3141. googleapi.Expand(req.URL, map[string]string{
  3142. "name": c.nameid,
  3143. })
  3144. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3145. }
  3146. // Do executes the "cloudresourcemanager.liens.delete" call.
  3147. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3148. // code is an error. Response headers are in either
  3149. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3150. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3151. // check whether the returned error was because http.StatusNotModified
  3152. // was returned.
  3153. func (c *LiensDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3154. gensupport.SetOptions(c.urlParams_, opts...)
  3155. res, err := c.doRequest("json")
  3156. if res != nil && res.StatusCode == http.StatusNotModified {
  3157. if res.Body != nil {
  3158. res.Body.Close()
  3159. }
  3160. return nil, &googleapi.Error{
  3161. Code: res.StatusCode,
  3162. Header: res.Header,
  3163. }
  3164. }
  3165. if err != nil {
  3166. return nil, err
  3167. }
  3168. defer googleapi.CloseBody(res)
  3169. if err := googleapi.CheckResponse(res); err != nil {
  3170. return nil, err
  3171. }
  3172. ret := &Empty{
  3173. ServerResponse: googleapi.ServerResponse{
  3174. Header: res.Header,
  3175. HTTPStatusCode: res.StatusCode,
  3176. },
  3177. }
  3178. target := &ret
  3179. if err := gensupport.DecodeResponse(target, res); err != nil {
  3180. return nil, err
  3181. }
  3182. return ret, nil
  3183. // {
  3184. // "description": "Delete a Lien by `name`.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, a Lien with a `parent` of `projects/1234` requires permission\n`resourcemanager.projects.updateLiens`.",
  3185. // "flatPath": "v1/liens/{liensId}",
  3186. // "httpMethod": "DELETE",
  3187. // "id": "cloudresourcemanager.liens.delete",
  3188. // "parameterOrder": [
  3189. // "name"
  3190. // ],
  3191. // "parameters": {
  3192. // "name": {
  3193. // "description": "The name/identifier of the Lien to delete.",
  3194. // "location": "path",
  3195. // "pattern": "^liens/.+$",
  3196. // "required": true,
  3197. // "type": "string"
  3198. // }
  3199. // },
  3200. // "path": "v1/{+name}",
  3201. // "response": {
  3202. // "$ref": "Empty"
  3203. // },
  3204. // "scopes": [
  3205. // "https://www.googleapis.com/auth/cloud-platform",
  3206. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3207. // ]
  3208. // }
  3209. }
  3210. // method id "cloudresourcemanager.liens.get":
  3211. type LiensGetCall struct {
  3212. s *Service
  3213. nameid string
  3214. urlParams_ gensupport.URLParams
  3215. ifNoneMatch_ string
  3216. ctx_ context.Context
  3217. header_ http.Header
  3218. }
  3219. // Get: Retrieve a Lien by `name`.
  3220. //
  3221. // Callers of this method will require permission on the `parent`
  3222. // resource.
  3223. // For example, a Lien with a `parent` of `projects/1234` requires
  3224. // permission
  3225. // requires permission `resourcemanager.projects.get`
  3226. // or
  3227. // `resourcemanager.projects.updateLiens`.
  3228. func (r *LiensService) Get(nameid string) *LiensGetCall {
  3229. c := &LiensGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3230. c.nameid = nameid
  3231. return c
  3232. }
  3233. // Fields allows partial responses to be retrieved. See
  3234. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3235. // for more information.
  3236. func (c *LiensGetCall) Fields(s ...googleapi.Field) *LiensGetCall {
  3237. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3238. return c
  3239. }
  3240. // IfNoneMatch sets the optional parameter which makes the operation
  3241. // fail if the object's ETag matches the given value. This is useful for
  3242. // getting updates only after the object has changed since the last
  3243. // request. Use googleapi.IsNotModified to check whether the response
  3244. // error from Do is the result of In-None-Match.
  3245. func (c *LiensGetCall) IfNoneMatch(entityTag string) *LiensGetCall {
  3246. c.ifNoneMatch_ = entityTag
  3247. return c
  3248. }
  3249. // Context sets the context to be used in this call's Do method. Any
  3250. // pending HTTP request will be aborted if the provided context is
  3251. // canceled.
  3252. func (c *LiensGetCall) Context(ctx context.Context) *LiensGetCall {
  3253. c.ctx_ = ctx
  3254. return c
  3255. }
  3256. // Header returns an http.Header that can be modified by the caller to
  3257. // add HTTP headers to the request.
  3258. func (c *LiensGetCall) Header() http.Header {
  3259. if c.header_ == nil {
  3260. c.header_ = make(http.Header)
  3261. }
  3262. return c.header_
  3263. }
  3264. func (c *LiensGetCall) doRequest(alt string) (*http.Response, error) {
  3265. reqHeaders := make(http.Header)
  3266. for k, v := range c.header_ {
  3267. reqHeaders[k] = v
  3268. }
  3269. reqHeaders.Set("User-Agent", c.s.userAgent())
  3270. if c.ifNoneMatch_ != "" {
  3271. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3272. }
  3273. var body io.Reader = nil
  3274. c.urlParams_.Set("alt", alt)
  3275. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3276. urls += "?" + c.urlParams_.Encode()
  3277. req, _ := http.NewRequest("GET", urls, body)
  3278. req.Header = reqHeaders
  3279. googleapi.Expand(req.URL, map[string]string{
  3280. "name": c.nameid,
  3281. })
  3282. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3283. }
  3284. // Do executes the "cloudresourcemanager.liens.get" call.
  3285. // Exactly one of *Lien or error will be non-nil. Any non-2xx status
  3286. // code is an error. Response headers are in either
  3287. // *Lien.ServerResponse.Header or (if a response was returned at all) in
  3288. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3289. // whether the returned error was because http.StatusNotModified was
  3290. // returned.
  3291. func (c *LiensGetCall) Do(opts ...googleapi.CallOption) (*Lien, error) {
  3292. gensupport.SetOptions(c.urlParams_, opts...)
  3293. res, err := c.doRequest("json")
  3294. if res != nil && res.StatusCode == http.StatusNotModified {
  3295. if res.Body != nil {
  3296. res.Body.Close()
  3297. }
  3298. return nil, &googleapi.Error{
  3299. Code: res.StatusCode,
  3300. Header: res.Header,
  3301. }
  3302. }
  3303. if err != nil {
  3304. return nil, err
  3305. }
  3306. defer googleapi.CloseBody(res)
  3307. if err := googleapi.CheckResponse(res); err != nil {
  3308. return nil, err
  3309. }
  3310. ret := &Lien{
  3311. ServerResponse: googleapi.ServerResponse{
  3312. Header: res.Header,
  3313. HTTPStatusCode: res.StatusCode,
  3314. },
  3315. }
  3316. target := &ret
  3317. if err := gensupport.DecodeResponse(target, res); err != nil {
  3318. return nil, err
  3319. }
  3320. return ret, nil
  3321. // {
  3322. // "description": "Retrieve a Lien by `name`.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, a Lien with a `parent` of `projects/1234` requires permission\nrequires permission `resourcemanager.projects.get` or\n`resourcemanager.projects.updateLiens`.",
  3323. // "flatPath": "v1/liens/{liensId}",
  3324. // "httpMethod": "GET",
  3325. // "id": "cloudresourcemanager.liens.get",
  3326. // "parameterOrder": [
  3327. // "name"
  3328. // ],
  3329. // "parameters": {
  3330. // "name": {
  3331. // "description": "The name/identifier of the Lien.",
  3332. // "location": "path",
  3333. // "pattern": "^liens/.+$",
  3334. // "required": true,
  3335. // "type": "string"
  3336. // }
  3337. // },
  3338. // "path": "v1/{+name}",
  3339. // "response": {
  3340. // "$ref": "Lien"
  3341. // },
  3342. // "scopes": [
  3343. // "https://www.googleapis.com/auth/cloud-platform",
  3344. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3345. // ]
  3346. // }
  3347. }
  3348. // method id "cloudresourcemanager.liens.list":
  3349. type LiensListCall struct {
  3350. s *Service
  3351. urlParams_ gensupport.URLParams
  3352. ifNoneMatch_ string
  3353. ctx_ context.Context
  3354. header_ http.Header
  3355. }
  3356. // List: List all Liens applied to the `parent` resource.
  3357. //
  3358. // Callers of this method will require permission on the `parent`
  3359. // resource.
  3360. // For example, a Lien with a `parent` of `projects/1234` requires
  3361. // permission
  3362. // `resourcemanager.projects.get`.
  3363. func (r *LiensService) List() *LiensListCall {
  3364. c := &LiensListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3365. return c
  3366. }
  3367. // PageSize sets the optional parameter "pageSize": The maximum number
  3368. // of items to return. This is a suggestion for the server.
  3369. func (c *LiensListCall) PageSize(pageSize int64) *LiensListCall {
  3370. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3371. return c
  3372. }
  3373. // PageToken sets the optional parameter "pageToken": The
  3374. // `next_page_token` value returned from a previous List request, if
  3375. // any.
  3376. func (c *LiensListCall) PageToken(pageToken string) *LiensListCall {
  3377. c.urlParams_.Set("pageToken", pageToken)
  3378. return c
  3379. }
  3380. // Parent sets the optional parameter "parent": The name of the resource
  3381. // to list all attached Liens.
  3382. // For example, `projects/1234`.
  3383. func (c *LiensListCall) Parent(parent string) *LiensListCall {
  3384. c.urlParams_.Set("parent", parent)
  3385. return c
  3386. }
  3387. // Fields allows partial responses to be retrieved. See
  3388. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3389. // for more information.
  3390. func (c *LiensListCall) Fields(s ...googleapi.Field) *LiensListCall {
  3391. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3392. return c
  3393. }
  3394. // IfNoneMatch sets the optional parameter which makes the operation
  3395. // fail if the object's ETag matches the given value. This is useful for
  3396. // getting updates only after the object has changed since the last
  3397. // request. Use googleapi.IsNotModified to check whether the response
  3398. // error from Do is the result of In-None-Match.
  3399. func (c *LiensListCall) IfNoneMatch(entityTag string) *LiensListCall {
  3400. c.ifNoneMatch_ = entityTag
  3401. return c
  3402. }
  3403. // Context sets the context to be used in this call's Do method. Any
  3404. // pending HTTP request will be aborted if the provided context is
  3405. // canceled.
  3406. func (c *LiensListCall) Context(ctx context.Context) *LiensListCall {
  3407. c.ctx_ = ctx
  3408. return c
  3409. }
  3410. // Header returns an http.Header that can be modified by the caller to
  3411. // add HTTP headers to the request.
  3412. func (c *LiensListCall) Header() http.Header {
  3413. if c.header_ == nil {
  3414. c.header_ = make(http.Header)
  3415. }
  3416. return c.header_
  3417. }
  3418. func (c *LiensListCall) doRequest(alt string) (*http.Response, error) {
  3419. reqHeaders := make(http.Header)
  3420. for k, v := range c.header_ {
  3421. reqHeaders[k] = v
  3422. }
  3423. reqHeaders.Set("User-Agent", c.s.userAgent())
  3424. if c.ifNoneMatch_ != "" {
  3425. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3426. }
  3427. var body io.Reader = nil
  3428. c.urlParams_.Set("alt", alt)
  3429. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/liens")
  3430. urls += "?" + c.urlParams_.Encode()
  3431. req, _ := http.NewRequest("GET", urls, body)
  3432. req.Header = reqHeaders
  3433. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3434. }
  3435. // Do executes the "cloudresourcemanager.liens.list" call.
  3436. // Exactly one of *ListLiensResponse or error will be non-nil. Any
  3437. // non-2xx status code is an error. Response headers are in either
  3438. // *ListLiensResponse.ServerResponse.Header or (if a response was
  3439. // returned at all) in error.(*googleapi.Error).Header. Use
  3440. // googleapi.IsNotModified to check whether the returned error was
  3441. // because http.StatusNotModified was returned.
  3442. func (c *LiensListCall) Do(opts ...googleapi.CallOption) (*ListLiensResponse, error) {
  3443. gensupport.SetOptions(c.urlParams_, opts...)
  3444. res, err := c.doRequest("json")
  3445. if res != nil && res.StatusCode == http.StatusNotModified {
  3446. if res.Body != nil {
  3447. res.Body.Close()
  3448. }
  3449. return nil, &googleapi.Error{
  3450. Code: res.StatusCode,
  3451. Header: res.Header,
  3452. }
  3453. }
  3454. if err != nil {
  3455. return nil, err
  3456. }
  3457. defer googleapi.CloseBody(res)
  3458. if err := googleapi.CheckResponse(res); err != nil {
  3459. return nil, err
  3460. }
  3461. ret := &ListLiensResponse{
  3462. ServerResponse: googleapi.ServerResponse{
  3463. Header: res.Header,
  3464. HTTPStatusCode: res.StatusCode,
  3465. },
  3466. }
  3467. target := &ret
  3468. if err := gensupport.DecodeResponse(target, res); err != nil {
  3469. return nil, err
  3470. }
  3471. return ret, nil
  3472. // {
  3473. // "description": "List all Liens applied to the `parent` resource.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, a Lien with a `parent` of `projects/1234` requires permission\n`resourcemanager.projects.get`.",
  3474. // "flatPath": "v1/liens",
  3475. // "httpMethod": "GET",
  3476. // "id": "cloudresourcemanager.liens.list",
  3477. // "parameterOrder": [],
  3478. // "parameters": {
  3479. // "pageSize": {
  3480. // "description": "The maximum number of items to return. This is a suggestion for the server.",
  3481. // "format": "int32",
  3482. // "location": "query",
  3483. // "type": "integer"
  3484. // },
  3485. // "pageToken": {
  3486. // "description": "The `next_page_token` value returned from a previous List request, if any.",
  3487. // "location": "query",
  3488. // "type": "string"
  3489. // },
  3490. // "parent": {
  3491. // "description": "The name of the resource to list all attached Liens.\nFor example, `projects/1234`.",
  3492. // "location": "query",
  3493. // "type": "string"
  3494. // }
  3495. // },
  3496. // "path": "v1/liens",
  3497. // "response": {
  3498. // "$ref": "ListLiensResponse"
  3499. // },
  3500. // "scopes": [
  3501. // "https://www.googleapis.com/auth/cloud-platform",
  3502. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3503. // ]
  3504. // }
  3505. }
  3506. // Pages invokes f for each page of results.
  3507. // A non-nil error returned from f will halt the iteration.
  3508. // The provided context supersedes any context provided to the Context method.
  3509. func (c *LiensListCall) Pages(ctx context.Context, f func(*ListLiensResponse) error) error {
  3510. c.ctx_ = ctx
  3511. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3512. for {
  3513. x, err := c.Do()
  3514. if err != nil {
  3515. return err
  3516. }
  3517. if err := f(x); err != nil {
  3518. return err
  3519. }
  3520. if x.NextPageToken == "" {
  3521. return nil
  3522. }
  3523. c.PageToken(x.NextPageToken)
  3524. }
  3525. }
  3526. // method id "cloudresourcemanager.operations.get":
  3527. type OperationsGetCall struct {
  3528. s *Service
  3529. name string
  3530. urlParams_ gensupport.URLParams
  3531. ifNoneMatch_ string
  3532. ctx_ context.Context
  3533. header_ http.Header
  3534. }
  3535. // Get: Gets the latest state of a long-running operation. Clients can
  3536. // use this
  3537. // method to poll the operation result at intervals as recommended by
  3538. // the API
  3539. // service.
  3540. func (r *OperationsService) Get(name string) *OperationsGetCall {
  3541. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3542. c.name = name
  3543. return c
  3544. }
  3545. // Fields allows partial responses to be retrieved. See
  3546. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3547. // for more information.
  3548. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  3549. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3550. return c
  3551. }
  3552. // IfNoneMatch sets the optional parameter which makes the operation
  3553. // fail if the object's ETag matches the given value. This is useful for
  3554. // getting updates only after the object has changed since the last
  3555. // request. Use googleapi.IsNotModified to check whether the response
  3556. // error from Do is the result of In-None-Match.
  3557. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  3558. c.ifNoneMatch_ = entityTag
  3559. return c
  3560. }
  3561. // Context sets the context to be used in this call's Do method. Any
  3562. // pending HTTP request will be aborted if the provided context is
  3563. // canceled.
  3564. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  3565. c.ctx_ = ctx
  3566. return c
  3567. }
  3568. // Header returns an http.Header that can be modified by the caller to
  3569. // add HTTP headers to the request.
  3570. func (c *OperationsGetCall) Header() http.Header {
  3571. if c.header_ == nil {
  3572. c.header_ = make(http.Header)
  3573. }
  3574. return c.header_
  3575. }
  3576. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  3577. reqHeaders := make(http.Header)
  3578. for k, v := range c.header_ {
  3579. reqHeaders[k] = v
  3580. }
  3581. reqHeaders.Set("User-Agent", c.s.userAgent())
  3582. if c.ifNoneMatch_ != "" {
  3583. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3584. }
  3585. var body io.Reader = nil
  3586. c.urlParams_.Set("alt", alt)
  3587. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3588. urls += "?" + c.urlParams_.Encode()
  3589. req, _ := http.NewRequest("GET", urls, body)
  3590. req.Header = reqHeaders
  3591. googleapi.Expand(req.URL, map[string]string{
  3592. "name": c.name,
  3593. })
  3594. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3595. }
  3596. // Do executes the "cloudresourcemanager.operations.get" call.
  3597. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3598. // status code is an error. Response headers are in either
  3599. // *Operation.ServerResponse.Header or (if a response was returned at
  3600. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3601. // to check whether the returned error was because
  3602. // http.StatusNotModified was returned.
  3603. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3604. gensupport.SetOptions(c.urlParams_, opts...)
  3605. res, err := c.doRequest("json")
  3606. if res != nil && res.StatusCode == http.StatusNotModified {
  3607. if res.Body != nil {
  3608. res.Body.Close()
  3609. }
  3610. return nil, &googleapi.Error{
  3611. Code: res.StatusCode,
  3612. Header: res.Header,
  3613. }
  3614. }
  3615. if err != nil {
  3616. return nil, err
  3617. }
  3618. defer googleapi.CloseBody(res)
  3619. if err := googleapi.CheckResponse(res); err != nil {
  3620. return nil, err
  3621. }
  3622. ret := &Operation{
  3623. ServerResponse: googleapi.ServerResponse{
  3624. Header: res.Header,
  3625. HTTPStatusCode: res.StatusCode,
  3626. },
  3627. }
  3628. target := &ret
  3629. if err := gensupport.DecodeResponse(target, res); err != nil {
  3630. return nil, err
  3631. }
  3632. return ret, nil
  3633. // {
  3634. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  3635. // "flatPath": "v1/operations/{operationsId}",
  3636. // "httpMethod": "GET",
  3637. // "id": "cloudresourcemanager.operations.get",
  3638. // "parameterOrder": [
  3639. // "name"
  3640. // ],
  3641. // "parameters": {
  3642. // "name": {
  3643. // "description": "The name of the operation resource.",
  3644. // "location": "path",
  3645. // "pattern": "^operations/.+$",
  3646. // "required": true,
  3647. // "type": "string"
  3648. // }
  3649. // },
  3650. // "path": "v1/{+name}",
  3651. // "response": {
  3652. // "$ref": "Operation"
  3653. // },
  3654. // "scopes": [
  3655. // "https://www.googleapis.com/auth/cloud-platform",
  3656. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3657. // ]
  3658. // }
  3659. }
  3660. // method id "cloudresourcemanager.organizations.clearOrgPolicy":
  3661. type OrganizationsClearOrgPolicyCall struct {
  3662. s *Service
  3663. resource string
  3664. clearorgpolicyrequest *ClearOrgPolicyRequest
  3665. urlParams_ gensupport.URLParams
  3666. ctx_ context.Context
  3667. header_ http.Header
  3668. }
  3669. // ClearOrgPolicy: Clears a `Policy` from a resource.
  3670. func (r *OrganizationsService) ClearOrgPolicy(resource string, clearorgpolicyrequest *ClearOrgPolicyRequest) *OrganizationsClearOrgPolicyCall {
  3671. c := &OrganizationsClearOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3672. c.resource = resource
  3673. c.clearorgpolicyrequest = clearorgpolicyrequest
  3674. return c
  3675. }
  3676. // Fields allows partial responses to be retrieved. See
  3677. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3678. // for more information.
  3679. func (c *OrganizationsClearOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsClearOrgPolicyCall {
  3680. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3681. return c
  3682. }
  3683. // Context sets the context to be used in this call's Do method. Any
  3684. // pending HTTP request will be aborted if the provided context is
  3685. // canceled.
  3686. func (c *OrganizationsClearOrgPolicyCall) Context(ctx context.Context) *OrganizationsClearOrgPolicyCall {
  3687. c.ctx_ = ctx
  3688. return c
  3689. }
  3690. // Header returns an http.Header that can be modified by the caller to
  3691. // add HTTP headers to the request.
  3692. func (c *OrganizationsClearOrgPolicyCall) Header() http.Header {
  3693. if c.header_ == nil {
  3694. c.header_ = make(http.Header)
  3695. }
  3696. return c.header_
  3697. }
  3698. func (c *OrganizationsClearOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  3699. reqHeaders := make(http.Header)
  3700. for k, v := range c.header_ {
  3701. reqHeaders[k] = v
  3702. }
  3703. reqHeaders.Set("User-Agent", c.s.userAgent())
  3704. var body io.Reader = nil
  3705. body, err := googleapi.WithoutDataWrapper.JSONReader(c.clearorgpolicyrequest)
  3706. if err != nil {
  3707. return nil, err
  3708. }
  3709. reqHeaders.Set("Content-Type", "application/json")
  3710. c.urlParams_.Set("alt", alt)
  3711. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:clearOrgPolicy")
  3712. urls += "?" + c.urlParams_.Encode()
  3713. req, _ := http.NewRequest("POST", urls, body)
  3714. req.Header = reqHeaders
  3715. googleapi.Expand(req.URL, map[string]string{
  3716. "resource": c.resource,
  3717. })
  3718. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3719. }
  3720. // Do executes the "cloudresourcemanager.organizations.clearOrgPolicy" call.
  3721. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3722. // code is an error. Response headers are in either
  3723. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3724. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3725. // check whether the returned error was because http.StatusNotModified
  3726. // was returned.
  3727. func (c *OrganizationsClearOrgPolicyCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3728. gensupport.SetOptions(c.urlParams_, opts...)
  3729. res, err := c.doRequest("json")
  3730. if res != nil && res.StatusCode == http.StatusNotModified {
  3731. if res.Body != nil {
  3732. res.Body.Close()
  3733. }
  3734. return nil, &googleapi.Error{
  3735. Code: res.StatusCode,
  3736. Header: res.Header,
  3737. }
  3738. }
  3739. if err != nil {
  3740. return nil, err
  3741. }
  3742. defer googleapi.CloseBody(res)
  3743. if err := googleapi.CheckResponse(res); err != nil {
  3744. return nil, err
  3745. }
  3746. ret := &Empty{
  3747. ServerResponse: googleapi.ServerResponse{
  3748. Header: res.Header,
  3749. HTTPStatusCode: res.StatusCode,
  3750. },
  3751. }
  3752. target := &ret
  3753. if err := gensupport.DecodeResponse(target, res); err != nil {
  3754. return nil, err
  3755. }
  3756. return ret, nil
  3757. // {
  3758. // "description": "Clears a `Policy` from a resource.",
  3759. // "flatPath": "v1/organizations/{organizationsId}:clearOrgPolicy",
  3760. // "httpMethod": "POST",
  3761. // "id": "cloudresourcemanager.organizations.clearOrgPolicy",
  3762. // "parameterOrder": [
  3763. // "resource"
  3764. // ],
  3765. // "parameters": {
  3766. // "resource": {
  3767. // "description": "Name of the resource for the `Policy` to clear.",
  3768. // "location": "path",
  3769. // "pattern": "^organizations/[^/]+$",
  3770. // "required": true,
  3771. // "type": "string"
  3772. // }
  3773. // },
  3774. // "path": "v1/{+resource}:clearOrgPolicy",
  3775. // "request": {
  3776. // "$ref": "ClearOrgPolicyRequest"
  3777. // },
  3778. // "response": {
  3779. // "$ref": "Empty"
  3780. // },
  3781. // "scopes": [
  3782. // "https://www.googleapis.com/auth/cloud-platform"
  3783. // ]
  3784. // }
  3785. }
  3786. // method id "cloudresourcemanager.organizations.get":
  3787. type OrganizationsGetCall struct {
  3788. s *Service
  3789. name string
  3790. urlParams_ gensupport.URLParams
  3791. ifNoneMatch_ string
  3792. ctx_ context.Context
  3793. header_ http.Header
  3794. }
  3795. // Get: Fetches an Organization resource identified by the specified
  3796. // resource name.
  3797. func (r *OrganizationsService) Get(name string) *OrganizationsGetCall {
  3798. c := &OrganizationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3799. c.name = name
  3800. return c
  3801. }
  3802. // Fields allows partial responses to be retrieved. See
  3803. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3804. // for more information.
  3805. func (c *OrganizationsGetCall) Fields(s ...googleapi.Field) *OrganizationsGetCall {
  3806. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3807. return c
  3808. }
  3809. // IfNoneMatch sets the optional parameter which makes the operation
  3810. // fail if the object's ETag matches the given value. This is useful for
  3811. // getting updates only after the object has changed since the last
  3812. // request. Use googleapi.IsNotModified to check whether the response
  3813. // error from Do is the result of In-None-Match.
  3814. func (c *OrganizationsGetCall) IfNoneMatch(entityTag string) *OrganizationsGetCall {
  3815. c.ifNoneMatch_ = entityTag
  3816. return c
  3817. }
  3818. // Context sets the context to be used in this call's Do method. Any
  3819. // pending HTTP request will be aborted if the provided context is
  3820. // canceled.
  3821. func (c *OrganizationsGetCall) Context(ctx context.Context) *OrganizationsGetCall {
  3822. c.ctx_ = ctx
  3823. return c
  3824. }
  3825. // Header returns an http.Header that can be modified by the caller to
  3826. // add HTTP headers to the request.
  3827. func (c *OrganizationsGetCall) Header() http.Header {
  3828. if c.header_ == nil {
  3829. c.header_ = make(http.Header)
  3830. }
  3831. return c.header_
  3832. }
  3833. func (c *OrganizationsGetCall) doRequest(alt string) (*http.Response, error) {
  3834. reqHeaders := make(http.Header)
  3835. for k, v := range c.header_ {
  3836. reqHeaders[k] = v
  3837. }
  3838. reqHeaders.Set("User-Agent", c.s.userAgent())
  3839. if c.ifNoneMatch_ != "" {
  3840. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3841. }
  3842. var body io.Reader = nil
  3843. c.urlParams_.Set("alt", alt)
  3844. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3845. urls += "?" + c.urlParams_.Encode()
  3846. req, _ := http.NewRequest("GET", urls, body)
  3847. req.Header = reqHeaders
  3848. googleapi.Expand(req.URL, map[string]string{
  3849. "name": c.name,
  3850. })
  3851. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3852. }
  3853. // Do executes the "cloudresourcemanager.organizations.get" call.
  3854. // Exactly one of *Organization or error will be non-nil. Any non-2xx
  3855. // status code is an error. Response headers are in either
  3856. // *Organization.ServerResponse.Header or (if a response was returned at
  3857. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3858. // to check whether the returned error was because
  3859. // http.StatusNotModified was returned.
  3860. func (c *OrganizationsGetCall) Do(opts ...googleapi.CallOption) (*Organization, error) {
  3861. gensupport.SetOptions(c.urlParams_, opts...)
  3862. res, err := c.doRequest("json")
  3863. if res != nil && res.StatusCode == http.StatusNotModified {
  3864. if res.Body != nil {
  3865. res.Body.Close()
  3866. }
  3867. return nil, &googleapi.Error{
  3868. Code: res.StatusCode,
  3869. Header: res.Header,
  3870. }
  3871. }
  3872. if err != nil {
  3873. return nil, err
  3874. }
  3875. defer googleapi.CloseBody(res)
  3876. if err := googleapi.CheckResponse(res); err != nil {
  3877. return nil, err
  3878. }
  3879. ret := &Organization{
  3880. ServerResponse: googleapi.ServerResponse{
  3881. Header: res.Header,
  3882. HTTPStatusCode: res.StatusCode,
  3883. },
  3884. }
  3885. target := &ret
  3886. if err := gensupport.DecodeResponse(target, res); err != nil {
  3887. return nil, err
  3888. }
  3889. return ret, nil
  3890. // {
  3891. // "description": "Fetches an Organization resource identified by the specified resource name.",
  3892. // "flatPath": "v1/organizations/{organizationsId}",
  3893. // "httpMethod": "GET",
  3894. // "id": "cloudresourcemanager.organizations.get",
  3895. // "parameterOrder": [
  3896. // "name"
  3897. // ],
  3898. // "parameters": {
  3899. // "name": {
  3900. // "description": "The resource name of the Organization to fetch, e.g. \"organizations/1234\".",
  3901. // "location": "path",
  3902. // "pattern": "^organizations/[^/]+$",
  3903. // "required": true,
  3904. // "type": "string"
  3905. // }
  3906. // },
  3907. // "path": "v1/{+name}",
  3908. // "response": {
  3909. // "$ref": "Organization"
  3910. // },
  3911. // "scopes": [
  3912. // "https://www.googleapis.com/auth/cloud-platform",
  3913. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3914. // ]
  3915. // }
  3916. }
  3917. // method id "cloudresourcemanager.organizations.getEffectiveOrgPolicy":
  3918. type OrganizationsGetEffectiveOrgPolicyCall struct {
  3919. s *Service
  3920. resource string
  3921. geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest
  3922. urlParams_ gensupport.URLParams
  3923. ctx_ context.Context
  3924. header_ http.Header
  3925. }
  3926. // GetEffectiveOrgPolicy: Gets the effective `Policy` on a resource.
  3927. // This is the result of merging
  3928. // `Policies` in the resource hierarchy. The returned `Policy` will not
  3929. // have
  3930. // an `etag`set because it is a computed `Policy` across multiple
  3931. // resources.
  3932. // Subtrees of Resource Manager resource hierarchy with 'under:' prefix
  3933. // will
  3934. // not be expanded.
  3935. func (r *OrganizationsService) GetEffectiveOrgPolicy(resource string, geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest) *OrganizationsGetEffectiveOrgPolicyCall {
  3936. c := &OrganizationsGetEffectiveOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3937. c.resource = resource
  3938. c.geteffectiveorgpolicyrequest = geteffectiveorgpolicyrequest
  3939. return c
  3940. }
  3941. // Fields allows partial responses to be retrieved. See
  3942. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3943. // for more information.
  3944. func (c *OrganizationsGetEffectiveOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetEffectiveOrgPolicyCall {
  3945. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3946. return c
  3947. }
  3948. // Context sets the context to be used in this call's Do method. Any
  3949. // pending HTTP request will be aborted if the provided context is
  3950. // canceled.
  3951. func (c *OrganizationsGetEffectiveOrgPolicyCall) Context(ctx context.Context) *OrganizationsGetEffectiveOrgPolicyCall {
  3952. c.ctx_ = ctx
  3953. return c
  3954. }
  3955. // Header returns an http.Header that can be modified by the caller to
  3956. // add HTTP headers to the request.
  3957. func (c *OrganizationsGetEffectiveOrgPolicyCall) Header() http.Header {
  3958. if c.header_ == nil {
  3959. c.header_ = make(http.Header)
  3960. }
  3961. return c.header_
  3962. }
  3963. func (c *OrganizationsGetEffectiveOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  3964. reqHeaders := make(http.Header)
  3965. for k, v := range c.header_ {
  3966. reqHeaders[k] = v
  3967. }
  3968. reqHeaders.Set("User-Agent", c.s.userAgent())
  3969. var body io.Reader = nil
  3970. body, err := googleapi.WithoutDataWrapper.JSONReader(c.geteffectiveorgpolicyrequest)
  3971. if err != nil {
  3972. return nil, err
  3973. }
  3974. reqHeaders.Set("Content-Type", "application/json")
  3975. c.urlParams_.Set("alt", alt)
  3976. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getEffectiveOrgPolicy")
  3977. urls += "?" + c.urlParams_.Encode()
  3978. req, _ := http.NewRequest("POST", urls, body)
  3979. req.Header = reqHeaders
  3980. googleapi.Expand(req.URL, map[string]string{
  3981. "resource": c.resource,
  3982. })
  3983. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3984. }
  3985. // Do executes the "cloudresourcemanager.organizations.getEffectiveOrgPolicy" call.
  3986. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  3987. // status code is an error. Response headers are in either
  3988. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  3989. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3990. // to check whether the returned error was because
  3991. // http.StatusNotModified was returned.
  3992. func (c *OrganizationsGetEffectiveOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  3993. gensupport.SetOptions(c.urlParams_, opts...)
  3994. res, err := c.doRequest("json")
  3995. if res != nil && res.StatusCode == http.StatusNotModified {
  3996. if res.Body != nil {
  3997. res.Body.Close()
  3998. }
  3999. return nil, &googleapi.Error{
  4000. Code: res.StatusCode,
  4001. Header: res.Header,
  4002. }
  4003. }
  4004. if err != nil {
  4005. return nil, err
  4006. }
  4007. defer googleapi.CloseBody(res)
  4008. if err := googleapi.CheckResponse(res); err != nil {
  4009. return nil, err
  4010. }
  4011. ret := &OrgPolicy{
  4012. ServerResponse: googleapi.ServerResponse{
  4013. Header: res.Header,
  4014. HTTPStatusCode: res.StatusCode,
  4015. },
  4016. }
  4017. target := &ret
  4018. if err := gensupport.DecodeResponse(target, res); err != nil {
  4019. return nil, err
  4020. }
  4021. return ret, nil
  4022. // {
  4023. // "description": "Gets the effective `Policy` on a resource. This is the result of merging\n`Policies` in the resource hierarchy. The returned `Policy` will not have\nan `etag`set because it is a computed `Policy` across multiple resources.\nSubtrees of Resource Manager resource hierarchy with 'under:' prefix will\nnot be expanded.",
  4024. // "flatPath": "v1/organizations/{organizationsId}:getEffectiveOrgPolicy",
  4025. // "httpMethod": "POST",
  4026. // "id": "cloudresourcemanager.organizations.getEffectiveOrgPolicy",
  4027. // "parameterOrder": [
  4028. // "resource"
  4029. // ],
  4030. // "parameters": {
  4031. // "resource": {
  4032. // "description": "The name of the resource to start computing the effective `Policy`.",
  4033. // "location": "path",
  4034. // "pattern": "^organizations/[^/]+$",
  4035. // "required": true,
  4036. // "type": "string"
  4037. // }
  4038. // },
  4039. // "path": "v1/{+resource}:getEffectiveOrgPolicy",
  4040. // "request": {
  4041. // "$ref": "GetEffectiveOrgPolicyRequest"
  4042. // },
  4043. // "response": {
  4044. // "$ref": "OrgPolicy"
  4045. // },
  4046. // "scopes": [
  4047. // "https://www.googleapis.com/auth/cloud-platform",
  4048. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4049. // ]
  4050. // }
  4051. }
  4052. // method id "cloudresourcemanager.organizations.getIamPolicy":
  4053. type OrganizationsGetIamPolicyCall struct {
  4054. s *Service
  4055. resource string
  4056. getiampolicyrequest *GetIamPolicyRequest
  4057. urlParams_ gensupport.URLParams
  4058. ctx_ context.Context
  4059. header_ http.Header
  4060. }
  4061. // GetIamPolicy: Gets the access control policy for an Organization
  4062. // resource. May be empty
  4063. // if no such policy or resource exists. The `resource` field should be
  4064. // the
  4065. // organization's resource name, e.g.
  4066. // "organizations/123".
  4067. //
  4068. // Authorization requires the Google IAM
  4069. // permission
  4070. // `resourcemanager.organizations.getIamPolicy` on the specified
  4071. // organization
  4072. func (r *OrganizationsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *OrganizationsGetIamPolicyCall {
  4073. c := &OrganizationsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4074. c.resource = resource
  4075. c.getiampolicyrequest = getiampolicyrequest
  4076. return c
  4077. }
  4078. // Fields allows partial responses to be retrieved. See
  4079. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4080. // for more information.
  4081. func (c *OrganizationsGetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetIamPolicyCall {
  4082. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4083. return c
  4084. }
  4085. // Context sets the context to be used in this call's Do method. Any
  4086. // pending HTTP request will be aborted if the provided context is
  4087. // canceled.
  4088. func (c *OrganizationsGetIamPolicyCall) Context(ctx context.Context) *OrganizationsGetIamPolicyCall {
  4089. c.ctx_ = ctx
  4090. return c
  4091. }
  4092. // Header returns an http.Header that can be modified by the caller to
  4093. // add HTTP headers to the request.
  4094. func (c *OrganizationsGetIamPolicyCall) Header() http.Header {
  4095. if c.header_ == nil {
  4096. c.header_ = make(http.Header)
  4097. }
  4098. return c.header_
  4099. }
  4100. func (c *OrganizationsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4101. reqHeaders := make(http.Header)
  4102. for k, v := range c.header_ {
  4103. reqHeaders[k] = v
  4104. }
  4105. reqHeaders.Set("User-Agent", c.s.userAgent())
  4106. var body io.Reader = nil
  4107. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  4108. if err != nil {
  4109. return nil, err
  4110. }
  4111. reqHeaders.Set("Content-Type", "application/json")
  4112. c.urlParams_.Set("alt", alt)
  4113. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  4114. urls += "?" + c.urlParams_.Encode()
  4115. req, _ := http.NewRequest("POST", urls, body)
  4116. req.Header = reqHeaders
  4117. googleapi.Expand(req.URL, map[string]string{
  4118. "resource": c.resource,
  4119. })
  4120. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4121. }
  4122. // Do executes the "cloudresourcemanager.organizations.getIamPolicy" call.
  4123. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4124. // code is an error. Response headers are in either
  4125. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4126. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4127. // check whether the returned error was because http.StatusNotModified
  4128. // was returned.
  4129. func (c *OrganizationsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4130. gensupport.SetOptions(c.urlParams_, opts...)
  4131. res, err := c.doRequest("json")
  4132. if res != nil && res.StatusCode == http.StatusNotModified {
  4133. if res.Body != nil {
  4134. res.Body.Close()
  4135. }
  4136. return nil, &googleapi.Error{
  4137. Code: res.StatusCode,
  4138. Header: res.Header,
  4139. }
  4140. }
  4141. if err != nil {
  4142. return nil, err
  4143. }
  4144. defer googleapi.CloseBody(res)
  4145. if err := googleapi.CheckResponse(res); err != nil {
  4146. return nil, err
  4147. }
  4148. ret := &Policy{
  4149. ServerResponse: googleapi.ServerResponse{
  4150. Header: res.Header,
  4151. HTTPStatusCode: res.StatusCode,
  4152. },
  4153. }
  4154. target := &ret
  4155. if err := gensupport.DecodeResponse(target, res); err != nil {
  4156. return nil, err
  4157. }
  4158. return ret, nil
  4159. // {
  4160. // "description": "Gets the access control policy for an Organization resource. May be empty\nif no such policy or resource exists. The `resource` field should be the\norganization's resource name, e.g. \"organizations/123\".\n\nAuthorization requires the Google IAM permission\n`resourcemanager.organizations.getIamPolicy` on the specified organization",
  4161. // "flatPath": "v1/organizations/{organizationsId}:getIamPolicy",
  4162. // "httpMethod": "POST",
  4163. // "id": "cloudresourcemanager.organizations.getIamPolicy",
  4164. // "parameterOrder": [
  4165. // "resource"
  4166. // ],
  4167. // "parameters": {
  4168. // "resource": {
  4169. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4170. // "location": "path",
  4171. // "pattern": "^organizations/[^/]+$",
  4172. // "required": true,
  4173. // "type": "string"
  4174. // }
  4175. // },
  4176. // "path": "v1/{+resource}:getIamPolicy",
  4177. // "request": {
  4178. // "$ref": "GetIamPolicyRequest"
  4179. // },
  4180. // "response": {
  4181. // "$ref": "Policy"
  4182. // },
  4183. // "scopes": [
  4184. // "https://www.googleapis.com/auth/cloud-platform",
  4185. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4186. // ]
  4187. // }
  4188. }
  4189. // method id "cloudresourcemanager.organizations.getOrgPolicy":
  4190. type OrganizationsGetOrgPolicyCall struct {
  4191. s *Service
  4192. resource string
  4193. getorgpolicyrequest *GetOrgPolicyRequest
  4194. urlParams_ gensupport.URLParams
  4195. ctx_ context.Context
  4196. header_ http.Header
  4197. }
  4198. // GetOrgPolicy: Gets a `Policy` on a resource.
  4199. //
  4200. // If no `Policy` is set on the resource, a `Policy` is returned with
  4201. // default
  4202. // values including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`.
  4203. // The
  4204. // `etag` value can be used with `SetOrgPolicy()` to create or update
  4205. // a
  4206. // `Policy` during read-modify-write.
  4207. func (r *OrganizationsService) GetOrgPolicy(resource string, getorgpolicyrequest *GetOrgPolicyRequest) *OrganizationsGetOrgPolicyCall {
  4208. c := &OrganizationsGetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4209. c.resource = resource
  4210. c.getorgpolicyrequest = getorgpolicyrequest
  4211. return c
  4212. }
  4213. // Fields allows partial responses to be retrieved. See
  4214. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4215. // for more information.
  4216. func (c *OrganizationsGetOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetOrgPolicyCall {
  4217. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4218. return c
  4219. }
  4220. // Context sets the context to be used in this call's Do method. Any
  4221. // pending HTTP request will be aborted if the provided context is
  4222. // canceled.
  4223. func (c *OrganizationsGetOrgPolicyCall) Context(ctx context.Context) *OrganizationsGetOrgPolicyCall {
  4224. c.ctx_ = ctx
  4225. return c
  4226. }
  4227. // Header returns an http.Header that can be modified by the caller to
  4228. // add HTTP headers to the request.
  4229. func (c *OrganizationsGetOrgPolicyCall) Header() http.Header {
  4230. if c.header_ == nil {
  4231. c.header_ = make(http.Header)
  4232. }
  4233. return c.header_
  4234. }
  4235. func (c *OrganizationsGetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  4236. reqHeaders := make(http.Header)
  4237. for k, v := range c.header_ {
  4238. reqHeaders[k] = v
  4239. }
  4240. reqHeaders.Set("User-Agent", c.s.userAgent())
  4241. var body io.Reader = nil
  4242. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getorgpolicyrequest)
  4243. if err != nil {
  4244. return nil, err
  4245. }
  4246. reqHeaders.Set("Content-Type", "application/json")
  4247. c.urlParams_.Set("alt", alt)
  4248. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getOrgPolicy")
  4249. urls += "?" + c.urlParams_.Encode()
  4250. req, _ := http.NewRequest("POST", urls, body)
  4251. req.Header = reqHeaders
  4252. googleapi.Expand(req.URL, map[string]string{
  4253. "resource": c.resource,
  4254. })
  4255. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4256. }
  4257. // Do executes the "cloudresourcemanager.organizations.getOrgPolicy" call.
  4258. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  4259. // status code is an error. Response headers are in either
  4260. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  4261. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4262. // to check whether the returned error was because
  4263. // http.StatusNotModified was returned.
  4264. func (c *OrganizationsGetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  4265. gensupport.SetOptions(c.urlParams_, opts...)
  4266. res, err := c.doRequest("json")
  4267. if res != nil && res.StatusCode == http.StatusNotModified {
  4268. if res.Body != nil {
  4269. res.Body.Close()
  4270. }
  4271. return nil, &googleapi.Error{
  4272. Code: res.StatusCode,
  4273. Header: res.Header,
  4274. }
  4275. }
  4276. if err != nil {
  4277. return nil, err
  4278. }
  4279. defer googleapi.CloseBody(res)
  4280. if err := googleapi.CheckResponse(res); err != nil {
  4281. return nil, err
  4282. }
  4283. ret := &OrgPolicy{
  4284. ServerResponse: googleapi.ServerResponse{
  4285. Header: res.Header,
  4286. HTTPStatusCode: res.StatusCode,
  4287. },
  4288. }
  4289. target := &ret
  4290. if err := gensupport.DecodeResponse(target, res); err != nil {
  4291. return nil, err
  4292. }
  4293. return ret, nil
  4294. // {
  4295. // "description": "Gets a `Policy` on a resource.\n\nIf no `Policy` is set on the resource, a `Policy` is returned with default\nvalues including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`. The\n`etag` value can be used with `SetOrgPolicy()` to create or update a\n`Policy` during read-modify-write.",
  4296. // "flatPath": "v1/organizations/{organizationsId}:getOrgPolicy",
  4297. // "httpMethod": "POST",
  4298. // "id": "cloudresourcemanager.organizations.getOrgPolicy",
  4299. // "parameterOrder": [
  4300. // "resource"
  4301. // ],
  4302. // "parameters": {
  4303. // "resource": {
  4304. // "description": "Name of the resource the `Policy` is set on.",
  4305. // "location": "path",
  4306. // "pattern": "^organizations/[^/]+$",
  4307. // "required": true,
  4308. // "type": "string"
  4309. // }
  4310. // },
  4311. // "path": "v1/{+resource}:getOrgPolicy",
  4312. // "request": {
  4313. // "$ref": "GetOrgPolicyRequest"
  4314. // },
  4315. // "response": {
  4316. // "$ref": "OrgPolicy"
  4317. // },
  4318. // "scopes": [
  4319. // "https://www.googleapis.com/auth/cloud-platform",
  4320. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4321. // ]
  4322. // }
  4323. }
  4324. // method id "cloudresourcemanager.organizations.listAvailableOrgPolicyConstraints":
  4325. type OrganizationsListAvailableOrgPolicyConstraintsCall struct {
  4326. s *Service
  4327. resource string
  4328. listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest
  4329. urlParams_ gensupport.URLParams
  4330. ctx_ context.Context
  4331. header_ http.Header
  4332. }
  4333. // ListAvailableOrgPolicyConstraints: Lists `Constraints` that could be
  4334. // applied on the specified resource.
  4335. func (r *OrganizationsService) ListAvailableOrgPolicyConstraints(resource string, listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest) *OrganizationsListAvailableOrgPolicyConstraintsCall {
  4336. c := &OrganizationsListAvailableOrgPolicyConstraintsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4337. c.resource = resource
  4338. c.listavailableorgpolicyconstraintsrequest = listavailableorgpolicyconstraintsrequest
  4339. return c
  4340. }
  4341. // Fields allows partial responses to be retrieved. See
  4342. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4343. // for more information.
  4344. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Fields(s ...googleapi.Field) *OrganizationsListAvailableOrgPolicyConstraintsCall {
  4345. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4346. return c
  4347. }
  4348. // Context sets the context to be used in this call's Do method. Any
  4349. // pending HTTP request will be aborted if the provided context is
  4350. // canceled.
  4351. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Context(ctx context.Context) *OrganizationsListAvailableOrgPolicyConstraintsCall {
  4352. c.ctx_ = ctx
  4353. return c
  4354. }
  4355. // Header returns an http.Header that can be modified by the caller to
  4356. // add HTTP headers to the request.
  4357. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Header() http.Header {
  4358. if c.header_ == nil {
  4359. c.header_ = make(http.Header)
  4360. }
  4361. return c.header_
  4362. }
  4363. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) doRequest(alt string) (*http.Response, error) {
  4364. reqHeaders := make(http.Header)
  4365. for k, v := range c.header_ {
  4366. reqHeaders[k] = v
  4367. }
  4368. reqHeaders.Set("User-Agent", c.s.userAgent())
  4369. var body io.Reader = nil
  4370. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listavailableorgpolicyconstraintsrequest)
  4371. if err != nil {
  4372. return nil, err
  4373. }
  4374. reqHeaders.Set("Content-Type", "application/json")
  4375. c.urlParams_.Set("alt", alt)
  4376. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listAvailableOrgPolicyConstraints")
  4377. urls += "?" + c.urlParams_.Encode()
  4378. req, _ := http.NewRequest("POST", urls, body)
  4379. req.Header = reqHeaders
  4380. googleapi.Expand(req.URL, map[string]string{
  4381. "resource": c.resource,
  4382. })
  4383. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4384. }
  4385. // Do executes the "cloudresourcemanager.organizations.listAvailableOrgPolicyConstraints" call.
  4386. // Exactly one of *ListAvailableOrgPolicyConstraintsResponse or error
  4387. // will be non-nil. Any non-2xx status code is an error. Response
  4388. // headers are in either
  4389. // *ListAvailableOrgPolicyConstraintsResponse.ServerResponse.Header or
  4390. // (if a response was returned at all) in
  4391. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4392. // whether the returned error was because http.StatusNotModified was
  4393. // returned.
  4394. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Do(opts ...googleapi.CallOption) (*ListAvailableOrgPolicyConstraintsResponse, error) {
  4395. gensupport.SetOptions(c.urlParams_, opts...)
  4396. res, err := c.doRequest("json")
  4397. if res != nil && res.StatusCode == http.StatusNotModified {
  4398. if res.Body != nil {
  4399. res.Body.Close()
  4400. }
  4401. return nil, &googleapi.Error{
  4402. Code: res.StatusCode,
  4403. Header: res.Header,
  4404. }
  4405. }
  4406. if err != nil {
  4407. return nil, err
  4408. }
  4409. defer googleapi.CloseBody(res)
  4410. if err := googleapi.CheckResponse(res); err != nil {
  4411. return nil, err
  4412. }
  4413. ret := &ListAvailableOrgPolicyConstraintsResponse{
  4414. ServerResponse: googleapi.ServerResponse{
  4415. Header: res.Header,
  4416. HTTPStatusCode: res.StatusCode,
  4417. },
  4418. }
  4419. target := &ret
  4420. if err := gensupport.DecodeResponse(target, res); err != nil {
  4421. return nil, err
  4422. }
  4423. return ret, nil
  4424. // {
  4425. // "description": "Lists `Constraints` that could be applied on the specified resource.",
  4426. // "flatPath": "v1/organizations/{organizationsId}:listAvailableOrgPolicyConstraints",
  4427. // "httpMethod": "POST",
  4428. // "id": "cloudresourcemanager.organizations.listAvailableOrgPolicyConstraints",
  4429. // "parameterOrder": [
  4430. // "resource"
  4431. // ],
  4432. // "parameters": {
  4433. // "resource": {
  4434. // "description": "Name of the resource to list `Constraints` for.",
  4435. // "location": "path",
  4436. // "pattern": "^organizations/[^/]+$",
  4437. // "required": true,
  4438. // "type": "string"
  4439. // }
  4440. // },
  4441. // "path": "v1/{+resource}:listAvailableOrgPolicyConstraints",
  4442. // "request": {
  4443. // "$ref": "ListAvailableOrgPolicyConstraintsRequest"
  4444. // },
  4445. // "response": {
  4446. // "$ref": "ListAvailableOrgPolicyConstraintsResponse"
  4447. // },
  4448. // "scopes": [
  4449. // "https://www.googleapis.com/auth/cloud-platform",
  4450. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4451. // ]
  4452. // }
  4453. }
  4454. // Pages invokes f for each page of results.
  4455. // A non-nil error returned from f will halt the iteration.
  4456. // The provided context supersedes any context provided to the Context method.
  4457. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Pages(ctx context.Context, f func(*ListAvailableOrgPolicyConstraintsResponse) error) error {
  4458. c.ctx_ = ctx
  4459. defer func(pt string) { c.listavailableorgpolicyconstraintsrequest.PageToken = pt }(c.listavailableorgpolicyconstraintsrequest.PageToken) // reset paging to original point
  4460. for {
  4461. x, err := c.Do()
  4462. if err != nil {
  4463. return err
  4464. }
  4465. if err := f(x); err != nil {
  4466. return err
  4467. }
  4468. if x.NextPageToken == "" {
  4469. return nil
  4470. }
  4471. c.listavailableorgpolicyconstraintsrequest.PageToken = x.NextPageToken
  4472. }
  4473. }
  4474. // method id "cloudresourcemanager.organizations.listOrgPolicies":
  4475. type OrganizationsListOrgPoliciesCall struct {
  4476. s *Service
  4477. resource string
  4478. listorgpoliciesrequest *ListOrgPoliciesRequest
  4479. urlParams_ gensupport.URLParams
  4480. ctx_ context.Context
  4481. header_ http.Header
  4482. }
  4483. // ListOrgPolicies: Lists all the `Policies` set for a particular
  4484. // resource.
  4485. func (r *OrganizationsService) ListOrgPolicies(resource string, listorgpoliciesrequest *ListOrgPoliciesRequest) *OrganizationsListOrgPoliciesCall {
  4486. c := &OrganizationsListOrgPoliciesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4487. c.resource = resource
  4488. c.listorgpoliciesrequest = listorgpoliciesrequest
  4489. return c
  4490. }
  4491. // Fields allows partial responses to be retrieved. See
  4492. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4493. // for more information.
  4494. func (c *OrganizationsListOrgPoliciesCall) Fields(s ...googleapi.Field) *OrganizationsListOrgPoliciesCall {
  4495. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4496. return c
  4497. }
  4498. // Context sets the context to be used in this call's Do method. Any
  4499. // pending HTTP request will be aborted if the provided context is
  4500. // canceled.
  4501. func (c *OrganizationsListOrgPoliciesCall) Context(ctx context.Context) *OrganizationsListOrgPoliciesCall {
  4502. c.ctx_ = ctx
  4503. return c
  4504. }
  4505. // Header returns an http.Header that can be modified by the caller to
  4506. // add HTTP headers to the request.
  4507. func (c *OrganizationsListOrgPoliciesCall) Header() http.Header {
  4508. if c.header_ == nil {
  4509. c.header_ = make(http.Header)
  4510. }
  4511. return c.header_
  4512. }
  4513. func (c *OrganizationsListOrgPoliciesCall) doRequest(alt string) (*http.Response, error) {
  4514. reqHeaders := make(http.Header)
  4515. for k, v := range c.header_ {
  4516. reqHeaders[k] = v
  4517. }
  4518. reqHeaders.Set("User-Agent", c.s.userAgent())
  4519. var body io.Reader = nil
  4520. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listorgpoliciesrequest)
  4521. if err != nil {
  4522. return nil, err
  4523. }
  4524. reqHeaders.Set("Content-Type", "application/json")
  4525. c.urlParams_.Set("alt", alt)
  4526. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listOrgPolicies")
  4527. urls += "?" + c.urlParams_.Encode()
  4528. req, _ := http.NewRequest("POST", urls, body)
  4529. req.Header = reqHeaders
  4530. googleapi.Expand(req.URL, map[string]string{
  4531. "resource": c.resource,
  4532. })
  4533. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4534. }
  4535. // Do executes the "cloudresourcemanager.organizations.listOrgPolicies" call.
  4536. // Exactly one of *ListOrgPoliciesResponse or error will be non-nil. Any
  4537. // non-2xx status code is an error. Response headers are in either
  4538. // *ListOrgPoliciesResponse.ServerResponse.Header or (if a response was
  4539. // returned at all) in error.(*googleapi.Error).Header. Use
  4540. // googleapi.IsNotModified to check whether the returned error was
  4541. // because http.StatusNotModified was returned.
  4542. func (c *OrganizationsListOrgPoliciesCall) Do(opts ...googleapi.CallOption) (*ListOrgPoliciesResponse, error) {
  4543. gensupport.SetOptions(c.urlParams_, opts...)
  4544. res, err := c.doRequest("json")
  4545. if res != nil && res.StatusCode == http.StatusNotModified {
  4546. if res.Body != nil {
  4547. res.Body.Close()
  4548. }
  4549. return nil, &googleapi.Error{
  4550. Code: res.StatusCode,
  4551. Header: res.Header,
  4552. }
  4553. }
  4554. if err != nil {
  4555. return nil, err
  4556. }
  4557. defer googleapi.CloseBody(res)
  4558. if err := googleapi.CheckResponse(res); err != nil {
  4559. return nil, err
  4560. }
  4561. ret := &ListOrgPoliciesResponse{
  4562. ServerResponse: googleapi.ServerResponse{
  4563. Header: res.Header,
  4564. HTTPStatusCode: res.StatusCode,
  4565. },
  4566. }
  4567. target := &ret
  4568. if err := gensupport.DecodeResponse(target, res); err != nil {
  4569. return nil, err
  4570. }
  4571. return ret, nil
  4572. // {
  4573. // "description": "Lists all the `Policies` set for a particular resource.",
  4574. // "flatPath": "v1/organizations/{organizationsId}:listOrgPolicies",
  4575. // "httpMethod": "POST",
  4576. // "id": "cloudresourcemanager.organizations.listOrgPolicies",
  4577. // "parameterOrder": [
  4578. // "resource"
  4579. // ],
  4580. // "parameters": {
  4581. // "resource": {
  4582. // "description": "Name of the resource to list Policies for.",
  4583. // "location": "path",
  4584. // "pattern": "^organizations/[^/]+$",
  4585. // "required": true,
  4586. // "type": "string"
  4587. // }
  4588. // },
  4589. // "path": "v1/{+resource}:listOrgPolicies",
  4590. // "request": {
  4591. // "$ref": "ListOrgPoliciesRequest"
  4592. // },
  4593. // "response": {
  4594. // "$ref": "ListOrgPoliciesResponse"
  4595. // },
  4596. // "scopes": [
  4597. // "https://www.googleapis.com/auth/cloud-platform",
  4598. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4599. // ]
  4600. // }
  4601. }
  4602. // Pages invokes f for each page of results.
  4603. // A non-nil error returned from f will halt the iteration.
  4604. // The provided context supersedes any context provided to the Context method.
  4605. func (c *OrganizationsListOrgPoliciesCall) Pages(ctx context.Context, f func(*ListOrgPoliciesResponse) error) error {
  4606. c.ctx_ = ctx
  4607. defer func(pt string) { c.listorgpoliciesrequest.PageToken = pt }(c.listorgpoliciesrequest.PageToken) // reset paging to original point
  4608. for {
  4609. x, err := c.Do()
  4610. if err != nil {
  4611. return err
  4612. }
  4613. if err := f(x); err != nil {
  4614. return err
  4615. }
  4616. if x.NextPageToken == "" {
  4617. return nil
  4618. }
  4619. c.listorgpoliciesrequest.PageToken = x.NextPageToken
  4620. }
  4621. }
  4622. // method id "cloudresourcemanager.organizations.search":
  4623. type OrganizationsSearchCall struct {
  4624. s *Service
  4625. searchorganizationsrequest *SearchOrganizationsRequest
  4626. urlParams_ gensupport.URLParams
  4627. ctx_ context.Context
  4628. header_ http.Header
  4629. }
  4630. // Search: Searches Organization resources that are visible to the user
  4631. // and satisfy
  4632. // the specified filter. This method returns Organizations in an
  4633. // unspecified
  4634. // order. New Organizations do not necessarily appear at the end of
  4635. // the
  4636. // results.
  4637. //
  4638. // Search will only return organizations on which the user has the
  4639. // permission
  4640. // `resourcemanager.organizations.get`
  4641. func (r *OrganizationsService) Search(searchorganizationsrequest *SearchOrganizationsRequest) *OrganizationsSearchCall {
  4642. c := &OrganizationsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4643. c.searchorganizationsrequest = searchorganizationsrequest
  4644. return c
  4645. }
  4646. // Fields allows partial responses to be retrieved. See
  4647. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4648. // for more information.
  4649. func (c *OrganizationsSearchCall) Fields(s ...googleapi.Field) *OrganizationsSearchCall {
  4650. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4651. return c
  4652. }
  4653. // Context sets the context to be used in this call's Do method. Any
  4654. // pending HTTP request will be aborted if the provided context is
  4655. // canceled.
  4656. func (c *OrganizationsSearchCall) Context(ctx context.Context) *OrganizationsSearchCall {
  4657. c.ctx_ = ctx
  4658. return c
  4659. }
  4660. // Header returns an http.Header that can be modified by the caller to
  4661. // add HTTP headers to the request.
  4662. func (c *OrganizationsSearchCall) Header() http.Header {
  4663. if c.header_ == nil {
  4664. c.header_ = make(http.Header)
  4665. }
  4666. return c.header_
  4667. }
  4668. func (c *OrganizationsSearchCall) doRequest(alt string) (*http.Response, error) {
  4669. reqHeaders := make(http.Header)
  4670. for k, v := range c.header_ {
  4671. reqHeaders[k] = v
  4672. }
  4673. reqHeaders.Set("User-Agent", c.s.userAgent())
  4674. var body io.Reader = nil
  4675. body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchorganizationsrequest)
  4676. if err != nil {
  4677. return nil, err
  4678. }
  4679. reqHeaders.Set("Content-Type", "application/json")
  4680. c.urlParams_.Set("alt", alt)
  4681. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/organizations:search")
  4682. urls += "?" + c.urlParams_.Encode()
  4683. req, _ := http.NewRequest("POST", urls, body)
  4684. req.Header = reqHeaders
  4685. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4686. }
  4687. // Do executes the "cloudresourcemanager.organizations.search" call.
  4688. // Exactly one of *SearchOrganizationsResponse or error will be non-nil.
  4689. // Any non-2xx status code is an error. Response headers are in either
  4690. // *SearchOrganizationsResponse.ServerResponse.Header or (if a response
  4691. // was returned at all) in error.(*googleapi.Error).Header. Use
  4692. // googleapi.IsNotModified to check whether the returned error was
  4693. // because http.StatusNotModified was returned.
  4694. func (c *OrganizationsSearchCall) Do(opts ...googleapi.CallOption) (*SearchOrganizationsResponse, error) {
  4695. gensupport.SetOptions(c.urlParams_, opts...)
  4696. res, err := c.doRequest("json")
  4697. if res != nil && res.StatusCode == http.StatusNotModified {
  4698. if res.Body != nil {
  4699. res.Body.Close()
  4700. }
  4701. return nil, &googleapi.Error{
  4702. Code: res.StatusCode,
  4703. Header: res.Header,
  4704. }
  4705. }
  4706. if err != nil {
  4707. return nil, err
  4708. }
  4709. defer googleapi.CloseBody(res)
  4710. if err := googleapi.CheckResponse(res); err != nil {
  4711. return nil, err
  4712. }
  4713. ret := &SearchOrganizationsResponse{
  4714. ServerResponse: googleapi.ServerResponse{
  4715. Header: res.Header,
  4716. HTTPStatusCode: res.StatusCode,
  4717. },
  4718. }
  4719. target := &ret
  4720. if err := gensupport.DecodeResponse(target, res); err != nil {
  4721. return nil, err
  4722. }
  4723. return ret, nil
  4724. // {
  4725. // "description": "Searches Organization resources that are visible to the user and satisfy\nthe specified filter. This method returns Organizations in an unspecified\norder. New Organizations do not necessarily appear at the end of the\nresults.\n\nSearch will only return organizations on which the user has the permission\n`resourcemanager.organizations.get`",
  4726. // "flatPath": "v1/organizations:search",
  4727. // "httpMethod": "POST",
  4728. // "id": "cloudresourcemanager.organizations.search",
  4729. // "parameterOrder": [],
  4730. // "parameters": {},
  4731. // "path": "v1/organizations:search",
  4732. // "request": {
  4733. // "$ref": "SearchOrganizationsRequest"
  4734. // },
  4735. // "response": {
  4736. // "$ref": "SearchOrganizationsResponse"
  4737. // },
  4738. // "scopes": [
  4739. // "https://www.googleapis.com/auth/cloud-platform",
  4740. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4741. // ]
  4742. // }
  4743. }
  4744. // Pages invokes f for each page of results.
  4745. // A non-nil error returned from f will halt the iteration.
  4746. // The provided context supersedes any context provided to the Context method.
  4747. func (c *OrganizationsSearchCall) Pages(ctx context.Context, f func(*SearchOrganizationsResponse) error) error {
  4748. c.ctx_ = ctx
  4749. defer func(pt string) { c.searchorganizationsrequest.PageToken = pt }(c.searchorganizationsrequest.PageToken) // reset paging to original point
  4750. for {
  4751. x, err := c.Do()
  4752. if err != nil {
  4753. return err
  4754. }
  4755. if err := f(x); err != nil {
  4756. return err
  4757. }
  4758. if x.NextPageToken == "" {
  4759. return nil
  4760. }
  4761. c.searchorganizationsrequest.PageToken = x.NextPageToken
  4762. }
  4763. }
  4764. // method id "cloudresourcemanager.organizations.setIamPolicy":
  4765. type OrganizationsSetIamPolicyCall struct {
  4766. s *Service
  4767. resource string
  4768. setiampolicyrequest *SetIamPolicyRequest
  4769. urlParams_ gensupport.URLParams
  4770. ctx_ context.Context
  4771. header_ http.Header
  4772. }
  4773. // SetIamPolicy: Sets the access control policy on an Organization
  4774. // resource. Replaces any
  4775. // existing policy. The `resource` field should be the organization's
  4776. // resource
  4777. // name, e.g. "organizations/123".
  4778. //
  4779. // Authorization requires the Google IAM
  4780. // permission
  4781. // `resourcemanager.organizations.setIamPolicy` on the specified
  4782. // organization
  4783. func (r *OrganizationsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *OrganizationsSetIamPolicyCall {
  4784. c := &OrganizationsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4785. c.resource = resource
  4786. c.setiampolicyrequest = setiampolicyrequest
  4787. return c
  4788. }
  4789. // Fields allows partial responses to be retrieved. See
  4790. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4791. // for more information.
  4792. func (c *OrganizationsSetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsSetIamPolicyCall {
  4793. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4794. return c
  4795. }
  4796. // Context sets the context to be used in this call's Do method. Any
  4797. // pending HTTP request will be aborted if the provided context is
  4798. // canceled.
  4799. func (c *OrganizationsSetIamPolicyCall) Context(ctx context.Context) *OrganizationsSetIamPolicyCall {
  4800. c.ctx_ = ctx
  4801. return c
  4802. }
  4803. // Header returns an http.Header that can be modified by the caller to
  4804. // add HTTP headers to the request.
  4805. func (c *OrganizationsSetIamPolicyCall) Header() http.Header {
  4806. if c.header_ == nil {
  4807. c.header_ = make(http.Header)
  4808. }
  4809. return c.header_
  4810. }
  4811. func (c *OrganizationsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4812. reqHeaders := make(http.Header)
  4813. for k, v := range c.header_ {
  4814. reqHeaders[k] = v
  4815. }
  4816. reqHeaders.Set("User-Agent", c.s.userAgent())
  4817. var body io.Reader = nil
  4818. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  4819. if err != nil {
  4820. return nil, err
  4821. }
  4822. reqHeaders.Set("Content-Type", "application/json")
  4823. c.urlParams_.Set("alt", alt)
  4824. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  4825. urls += "?" + c.urlParams_.Encode()
  4826. req, _ := http.NewRequest("POST", urls, body)
  4827. req.Header = reqHeaders
  4828. googleapi.Expand(req.URL, map[string]string{
  4829. "resource": c.resource,
  4830. })
  4831. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4832. }
  4833. // Do executes the "cloudresourcemanager.organizations.setIamPolicy" call.
  4834. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4835. // code is an error. Response headers are in either
  4836. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4837. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4838. // check whether the returned error was because http.StatusNotModified
  4839. // was returned.
  4840. func (c *OrganizationsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4841. gensupport.SetOptions(c.urlParams_, opts...)
  4842. res, err := c.doRequest("json")
  4843. if res != nil && res.StatusCode == http.StatusNotModified {
  4844. if res.Body != nil {
  4845. res.Body.Close()
  4846. }
  4847. return nil, &googleapi.Error{
  4848. Code: res.StatusCode,
  4849. Header: res.Header,
  4850. }
  4851. }
  4852. if err != nil {
  4853. return nil, err
  4854. }
  4855. defer googleapi.CloseBody(res)
  4856. if err := googleapi.CheckResponse(res); err != nil {
  4857. return nil, err
  4858. }
  4859. ret := &Policy{
  4860. ServerResponse: googleapi.ServerResponse{
  4861. Header: res.Header,
  4862. HTTPStatusCode: res.StatusCode,
  4863. },
  4864. }
  4865. target := &ret
  4866. if err := gensupport.DecodeResponse(target, res); err != nil {
  4867. return nil, err
  4868. }
  4869. return ret, nil
  4870. // {
  4871. // "description": "Sets the access control policy on an Organization resource. Replaces any\nexisting policy. The `resource` field should be the organization's resource\nname, e.g. \"organizations/123\".\n\nAuthorization requires the Google IAM permission\n`resourcemanager.organizations.setIamPolicy` on the specified organization",
  4872. // "flatPath": "v1/organizations/{organizationsId}:setIamPolicy",
  4873. // "httpMethod": "POST",
  4874. // "id": "cloudresourcemanager.organizations.setIamPolicy",
  4875. // "parameterOrder": [
  4876. // "resource"
  4877. // ],
  4878. // "parameters": {
  4879. // "resource": {
  4880. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  4881. // "location": "path",
  4882. // "pattern": "^organizations/[^/]+$",
  4883. // "required": true,
  4884. // "type": "string"
  4885. // }
  4886. // },
  4887. // "path": "v1/{+resource}:setIamPolicy",
  4888. // "request": {
  4889. // "$ref": "SetIamPolicyRequest"
  4890. // },
  4891. // "response": {
  4892. // "$ref": "Policy"
  4893. // },
  4894. // "scopes": [
  4895. // "https://www.googleapis.com/auth/cloud-platform"
  4896. // ]
  4897. // }
  4898. }
  4899. // method id "cloudresourcemanager.organizations.setOrgPolicy":
  4900. type OrganizationsSetOrgPolicyCall struct {
  4901. s *Service
  4902. resource string
  4903. setorgpolicyrequest *SetOrgPolicyRequest
  4904. urlParams_ gensupport.URLParams
  4905. ctx_ context.Context
  4906. header_ http.Header
  4907. }
  4908. // SetOrgPolicy: Updates the specified `Policy` on the resource. Creates
  4909. // a new `Policy` for
  4910. // that `Constraint` on the resource if one does not exist.
  4911. //
  4912. // Not supplying an `etag` on the request `Policy` results in an
  4913. // unconditional
  4914. // write of the `Policy`.
  4915. func (r *OrganizationsService) SetOrgPolicy(resource string, setorgpolicyrequest *SetOrgPolicyRequest) *OrganizationsSetOrgPolicyCall {
  4916. c := &OrganizationsSetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4917. c.resource = resource
  4918. c.setorgpolicyrequest = setorgpolicyrequest
  4919. return c
  4920. }
  4921. // Fields allows partial responses to be retrieved. See
  4922. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4923. // for more information.
  4924. func (c *OrganizationsSetOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsSetOrgPolicyCall {
  4925. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4926. return c
  4927. }
  4928. // Context sets the context to be used in this call's Do method. Any
  4929. // pending HTTP request will be aborted if the provided context is
  4930. // canceled.
  4931. func (c *OrganizationsSetOrgPolicyCall) Context(ctx context.Context) *OrganizationsSetOrgPolicyCall {
  4932. c.ctx_ = ctx
  4933. return c
  4934. }
  4935. // Header returns an http.Header that can be modified by the caller to
  4936. // add HTTP headers to the request.
  4937. func (c *OrganizationsSetOrgPolicyCall) Header() http.Header {
  4938. if c.header_ == nil {
  4939. c.header_ = make(http.Header)
  4940. }
  4941. return c.header_
  4942. }
  4943. func (c *OrganizationsSetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  4944. reqHeaders := make(http.Header)
  4945. for k, v := range c.header_ {
  4946. reqHeaders[k] = v
  4947. }
  4948. reqHeaders.Set("User-Agent", c.s.userAgent())
  4949. var body io.Reader = nil
  4950. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setorgpolicyrequest)
  4951. if err != nil {
  4952. return nil, err
  4953. }
  4954. reqHeaders.Set("Content-Type", "application/json")
  4955. c.urlParams_.Set("alt", alt)
  4956. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setOrgPolicy")
  4957. urls += "?" + c.urlParams_.Encode()
  4958. req, _ := http.NewRequest("POST", urls, body)
  4959. req.Header = reqHeaders
  4960. googleapi.Expand(req.URL, map[string]string{
  4961. "resource": c.resource,
  4962. })
  4963. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4964. }
  4965. // Do executes the "cloudresourcemanager.organizations.setOrgPolicy" call.
  4966. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  4967. // status code is an error. Response headers are in either
  4968. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  4969. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4970. // to check whether the returned error was because
  4971. // http.StatusNotModified was returned.
  4972. func (c *OrganizationsSetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  4973. gensupport.SetOptions(c.urlParams_, opts...)
  4974. res, err := c.doRequest("json")
  4975. if res != nil && res.StatusCode == http.StatusNotModified {
  4976. if res.Body != nil {
  4977. res.Body.Close()
  4978. }
  4979. return nil, &googleapi.Error{
  4980. Code: res.StatusCode,
  4981. Header: res.Header,
  4982. }
  4983. }
  4984. if err != nil {
  4985. return nil, err
  4986. }
  4987. defer googleapi.CloseBody(res)
  4988. if err := googleapi.CheckResponse(res); err != nil {
  4989. return nil, err
  4990. }
  4991. ret := &OrgPolicy{
  4992. ServerResponse: googleapi.ServerResponse{
  4993. Header: res.Header,
  4994. HTTPStatusCode: res.StatusCode,
  4995. },
  4996. }
  4997. target := &ret
  4998. if err := gensupport.DecodeResponse(target, res); err != nil {
  4999. return nil, err
  5000. }
  5001. return ret, nil
  5002. // {
  5003. // "description": "Updates the specified `Policy` on the resource. Creates a new `Policy` for\nthat `Constraint` on the resource if one does not exist.\n\nNot supplying an `etag` on the request `Policy` results in an unconditional\nwrite of the `Policy`.",
  5004. // "flatPath": "v1/organizations/{organizationsId}:setOrgPolicy",
  5005. // "httpMethod": "POST",
  5006. // "id": "cloudresourcemanager.organizations.setOrgPolicy",
  5007. // "parameterOrder": [
  5008. // "resource"
  5009. // ],
  5010. // "parameters": {
  5011. // "resource": {
  5012. // "description": "Resource name of the resource to attach the `Policy`.",
  5013. // "location": "path",
  5014. // "pattern": "^organizations/[^/]+$",
  5015. // "required": true,
  5016. // "type": "string"
  5017. // }
  5018. // },
  5019. // "path": "v1/{+resource}:setOrgPolicy",
  5020. // "request": {
  5021. // "$ref": "SetOrgPolicyRequest"
  5022. // },
  5023. // "response": {
  5024. // "$ref": "OrgPolicy"
  5025. // },
  5026. // "scopes": [
  5027. // "https://www.googleapis.com/auth/cloud-platform"
  5028. // ]
  5029. // }
  5030. }
  5031. // method id "cloudresourcemanager.organizations.testIamPermissions":
  5032. type OrganizationsTestIamPermissionsCall struct {
  5033. s *Service
  5034. resource string
  5035. testiampermissionsrequest *TestIamPermissionsRequest
  5036. urlParams_ gensupport.URLParams
  5037. ctx_ context.Context
  5038. header_ http.Header
  5039. }
  5040. // TestIamPermissions: Returns permissions that a caller has on the
  5041. // specified Organization.
  5042. // The `resource` field should be the organization's resource name,
  5043. // e.g. "organizations/123".
  5044. //
  5045. // There are no permissions required for making this API call.
  5046. func (r *OrganizationsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *OrganizationsTestIamPermissionsCall {
  5047. c := &OrganizationsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5048. c.resource = resource
  5049. c.testiampermissionsrequest = testiampermissionsrequest
  5050. return c
  5051. }
  5052. // Fields allows partial responses to be retrieved. See
  5053. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5054. // for more information.
  5055. func (c *OrganizationsTestIamPermissionsCall) Fields(s ...googleapi.Field) *OrganizationsTestIamPermissionsCall {
  5056. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5057. return c
  5058. }
  5059. // Context sets the context to be used in this call's Do method. Any
  5060. // pending HTTP request will be aborted if the provided context is
  5061. // canceled.
  5062. func (c *OrganizationsTestIamPermissionsCall) Context(ctx context.Context) *OrganizationsTestIamPermissionsCall {
  5063. c.ctx_ = ctx
  5064. return c
  5065. }
  5066. // Header returns an http.Header that can be modified by the caller to
  5067. // add HTTP headers to the request.
  5068. func (c *OrganizationsTestIamPermissionsCall) Header() http.Header {
  5069. if c.header_ == nil {
  5070. c.header_ = make(http.Header)
  5071. }
  5072. return c.header_
  5073. }
  5074. func (c *OrganizationsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  5075. reqHeaders := make(http.Header)
  5076. for k, v := range c.header_ {
  5077. reqHeaders[k] = v
  5078. }
  5079. reqHeaders.Set("User-Agent", c.s.userAgent())
  5080. var body io.Reader = nil
  5081. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  5082. if err != nil {
  5083. return nil, err
  5084. }
  5085. reqHeaders.Set("Content-Type", "application/json")
  5086. c.urlParams_.Set("alt", alt)
  5087. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  5088. urls += "?" + c.urlParams_.Encode()
  5089. req, _ := http.NewRequest("POST", urls, body)
  5090. req.Header = reqHeaders
  5091. googleapi.Expand(req.URL, map[string]string{
  5092. "resource": c.resource,
  5093. })
  5094. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5095. }
  5096. // Do executes the "cloudresourcemanager.organizations.testIamPermissions" call.
  5097. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  5098. // Any non-2xx status code is an error. Response headers are in either
  5099. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  5100. // was returned at all) in error.(*googleapi.Error).Header. Use
  5101. // googleapi.IsNotModified to check whether the returned error was
  5102. // because http.StatusNotModified was returned.
  5103. func (c *OrganizationsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  5104. gensupport.SetOptions(c.urlParams_, opts...)
  5105. res, err := c.doRequest("json")
  5106. if res != nil && res.StatusCode == http.StatusNotModified {
  5107. if res.Body != nil {
  5108. res.Body.Close()
  5109. }
  5110. return nil, &googleapi.Error{
  5111. Code: res.StatusCode,
  5112. Header: res.Header,
  5113. }
  5114. }
  5115. if err != nil {
  5116. return nil, err
  5117. }
  5118. defer googleapi.CloseBody(res)
  5119. if err := googleapi.CheckResponse(res); err != nil {
  5120. return nil, err
  5121. }
  5122. ret := &TestIamPermissionsResponse{
  5123. ServerResponse: googleapi.ServerResponse{
  5124. Header: res.Header,
  5125. HTTPStatusCode: res.StatusCode,
  5126. },
  5127. }
  5128. target := &ret
  5129. if err := gensupport.DecodeResponse(target, res); err != nil {
  5130. return nil, err
  5131. }
  5132. return ret, nil
  5133. // {
  5134. // "description": "Returns permissions that a caller has on the specified Organization.\nThe `resource` field should be the organization's resource name,\ne.g. \"organizations/123\".\n\nThere are no permissions required for making this API call.",
  5135. // "flatPath": "v1/organizations/{organizationsId}:testIamPermissions",
  5136. // "httpMethod": "POST",
  5137. // "id": "cloudresourcemanager.organizations.testIamPermissions",
  5138. // "parameterOrder": [
  5139. // "resource"
  5140. // ],
  5141. // "parameters": {
  5142. // "resource": {
  5143. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5144. // "location": "path",
  5145. // "pattern": "^organizations/[^/]+$",
  5146. // "required": true,
  5147. // "type": "string"
  5148. // }
  5149. // },
  5150. // "path": "v1/{+resource}:testIamPermissions",
  5151. // "request": {
  5152. // "$ref": "TestIamPermissionsRequest"
  5153. // },
  5154. // "response": {
  5155. // "$ref": "TestIamPermissionsResponse"
  5156. // },
  5157. // "scopes": [
  5158. // "https://www.googleapis.com/auth/cloud-platform",
  5159. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5160. // ]
  5161. // }
  5162. }
  5163. // method id "cloudresourcemanager.projects.clearOrgPolicy":
  5164. type ProjectsClearOrgPolicyCall struct {
  5165. s *Service
  5166. resource string
  5167. clearorgpolicyrequest *ClearOrgPolicyRequest
  5168. urlParams_ gensupport.URLParams
  5169. ctx_ context.Context
  5170. header_ http.Header
  5171. }
  5172. // ClearOrgPolicy: Clears a `Policy` from a resource.
  5173. func (r *ProjectsService) ClearOrgPolicy(resource string, clearorgpolicyrequest *ClearOrgPolicyRequest) *ProjectsClearOrgPolicyCall {
  5174. c := &ProjectsClearOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5175. c.resource = resource
  5176. c.clearorgpolicyrequest = clearorgpolicyrequest
  5177. return c
  5178. }
  5179. // Fields allows partial responses to be retrieved. See
  5180. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5181. // for more information.
  5182. func (c *ProjectsClearOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsClearOrgPolicyCall {
  5183. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5184. return c
  5185. }
  5186. // Context sets the context to be used in this call's Do method. Any
  5187. // pending HTTP request will be aborted if the provided context is
  5188. // canceled.
  5189. func (c *ProjectsClearOrgPolicyCall) Context(ctx context.Context) *ProjectsClearOrgPolicyCall {
  5190. c.ctx_ = ctx
  5191. return c
  5192. }
  5193. // Header returns an http.Header that can be modified by the caller to
  5194. // add HTTP headers to the request.
  5195. func (c *ProjectsClearOrgPolicyCall) Header() http.Header {
  5196. if c.header_ == nil {
  5197. c.header_ = make(http.Header)
  5198. }
  5199. return c.header_
  5200. }
  5201. func (c *ProjectsClearOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  5202. reqHeaders := make(http.Header)
  5203. for k, v := range c.header_ {
  5204. reqHeaders[k] = v
  5205. }
  5206. reqHeaders.Set("User-Agent", c.s.userAgent())
  5207. var body io.Reader = nil
  5208. body, err := googleapi.WithoutDataWrapper.JSONReader(c.clearorgpolicyrequest)
  5209. if err != nil {
  5210. return nil, err
  5211. }
  5212. reqHeaders.Set("Content-Type", "application/json")
  5213. c.urlParams_.Set("alt", alt)
  5214. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:clearOrgPolicy")
  5215. urls += "?" + c.urlParams_.Encode()
  5216. req, _ := http.NewRequest("POST", urls, body)
  5217. req.Header = reqHeaders
  5218. googleapi.Expand(req.URL, map[string]string{
  5219. "resource": c.resource,
  5220. })
  5221. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5222. }
  5223. // Do executes the "cloudresourcemanager.projects.clearOrgPolicy" call.
  5224. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5225. // code is an error. Response headers are in either
  5226. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5227. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5228. // check whether the returned error was because http.StatusNotModified
  5229. // was returned.
  5230. func (c *ProjectsClearOrgPolicyCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5231. gensupport.SetOptions(c.urlParams_, opts...)
  5232. res, err := c.doRequest("json")
  5233. if res != nil && res.StatusCode == http.StatusNotModified {
  5234. if res.Body != nil {
  5235. res.Body.Close()
  5236. }
  5237. return nil, &googleapi.Error{
  5238. Code: res.StatusCode,
  5239. Header: res.Header,
  5240. }
  5241. }
  5242. if err != nil {
  5243. return nil, err
  5244. }
  5245. defer googleapi.CloseBody(res)
  5246. if err := googleapi.CheckResponse(res); err != nil {
  5247. return nil, err
  5248. }
  5249. ret := &Empty{
  5250. ServerResponse: googleapi.ServerResponse{
  5251. Header: res.Header,
  5252. HTTPStatusCode: res.StatusCode,
  5253. },
  5254. }
  5255. target := &ret
  5256. if err := gensupport.DecodeResponse(target, res); err != nil {
  5257. return nil, err
  5258. }
  5259. return ret, nil
  5260. // {
  5261. // "description": "Clears a `Policy` from a resource.",
  5262. // "flatPath": "v1/projects/{projectsId}:clearOrgPolicy",
  5263. // "httpMethod": "POST",
  5264. // "id": "cloudresourcemanager.projects.clearOrgPolicy",
  5265. // "parameterOrder": [
  5266. // "resource"
  5267. // ],
  5268. // "parameters": {
  5269. // "resource": {
  5270. // "description": "Name of the resource for the `Policy` to clear.",
  5271. // "location": "path",
  5272. // "pattern": "^projects/[^/]+$",
  5273. // "required": true,
  5274. // "type": "string"
  5275. // }
  5276. // },
  5277. // "path": "v1/{+resource}:clearOrgPolicy",
  5278. // "request": {
  5279. // "$ref": "ClearOrgPolicyRequest"
  5280. // },
  5281. // "response": {
  5282. // "$ref": "Empty"
  5283. // },
  5284. // "scopes": [
  5285. // "https://www.googleapis.com/auth/cloud-platform"
  5286. // ]
  5287. // }
  5288. }
  5289. // method id "cloudresourcemanager.projects.create":
  5290. type ProjectsCreateCall struct {
  5291. s *Service
  5292. project *Project
  5293. urlParams_ gensupport.URLParams
  5294. ctx_ context.Context
  5295. header_ http.Header
  5296. }
  5297. // Create: Request that a new Project be created. The result is an
  5298. // Operation which
  5299. // can be used to track the creation process. It is automatically
  5300. // deleted
  5301. // after a few hours, so there is no need to call DeleteOperation.
  5302. //
  5303. // Our SLO permits Project creation to take up to 30 seconds at the
  5304. // 90th
  5305. // percentile. As of 2016-08-29, we are observing 6 seconds 50th
  5306. // percentile
  5307. // latency. 95th percentile latency is around 11 seconds. We
  5308. // recommend
  5309. // polling at the 5th second with an exponential backoff.
  5310. //
  5311. // Authorization requires the Google IAM
  5312. // permission
  5313. // `resourcemanager.projects.create` on the specified parent for the
  5314. // new
  5315. // project. The parent is identified by a specified ResourceId,
  5316. // which must include both an ID and a type, such as organization.
  5317. //
  5318. // This method does not associate the new project with a billing
  5319. // account.
  5320. // You can set or update the billing account associated with a project
  5321. // using
  5322. // the
  5323. // [`projects.updateBillingInfo`]
  5324. // (/billing/reference/rest/v1/projects/up
  5325. // dateBillingInfo) method.
  5326. func (r *ProjectsService) Create(project *Project) *ProjectsCreateCall {
  5327. c := &ProjectsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5328. c.project = project
  5329. return c
  5330. }
  5331. // Fields allows partial responses to be retrieved. See
  5332. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5333. // for more information.
  5334. func (c *ProjectsCreateCall) Fields(s ...googleapi.Field) *ProjectsCreateCall {
  5335. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5336. return c
  5337. }
  5338. // Context sets the context to be used in this call's Do method. Any
  5339. // pending HTTP request will be aborted if the provided context is
  5340. // canceled.
  5341. func (c *ProjectsCreateCall) Context(ctx context.Context) *ProjectsCreateCall {
  5342. c.ctx_ = ctx
  5343. return c
  5344. }
  5345. // Header returns an http.Header that can be modified by the caller to
  5346. // add HTTP headers to the request.
  5347. func (c *ProjectsCreateCall) Header() http.Header {
  5348. if c.header_ == nil {
  5349. c.header_ = make(http.Header)
  5350. }
  5351. return c.header_
  5352. }
  5353. func (c *ProjectsCreateCall) doRequest(alt string) (*http.Response, error) {
  5354. reqHeaders := make(http.Header)
  5355. for k, v := range c.header_ {
  5356. reqHeaders[k] = v
  5357. }
  5358. reqHeaders.Set("User-Agent", c.s.userAgent())
  5359. var body io.Reader = nil
  5360. body, err := googleapi.WithoutDataWrapper.JSONReader(c.project)
  5361. if err != nil {
  5362. return nil, err
  5363. }
  5364. reqHeaders.Set("Content-Type", "application/json")
  5365. c.urlParams_.Set("alt", alt)
  5366. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects")
  5367. urls += "?" + c.urlParams_.Encode()
  5368. req, _ := http.NewRequest("POST", urls, body)
  5369. req.Header = reqHeaders
  5370. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5371. }
  5372. // Do executes the "cloudresourcemanager.projects.create" call.
  5373. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  5374. // status code is an error. Response headers are in either
  5375. // *Operation.ServerResponse.Header or (if a response was returned at
  5376. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5377. // to check whether the returned error was because
  5378. // http.StatusNotModified was returned.
  5379. func (c *ProjectsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  5380. gensupport.SetOptions(c.urlParams_, opts...)
  5381. res, err := c.doRequest("json")
  5382. if res != nil && res.StatusCode == http.StatusNotModified {
  5383. if res.Body != nil {
  5384. res.Body.Close()
  5385. }
  5386. return nil, &googleapi.Error{
  5387. Code: res.StatusCode,
  5388. Header: res.Header,
  5389. }
  5390. }
  5391. if err != nil {
  5392. return nil, err
  5393. }
  5394. defer googleapi.CloseBody(res)
  5395. if err := googleapi.CheckResponse(res); err != nil {
  5396. return nil, err
  5397. }
  5398. ret := &Operation{
  5399. ServerResponse: googleapi.ServerResponse{
  5400. Header: res.Header,
  5401. HTTPStatusCode: res.StatusCode,
  5402. },
  5403. }
  5404. target := &ret
  5405. if err := gensupport.DecodeResponse(target, res); err != nil {
  5406. return nil, err
  5407. }
  5408. return ret, nil
  5409. // {
  5410. // "description": "Request that a new Project be created. The result is an Operation which\ncan be used to track the creation process. It is automatically deleted\nafter a few hours, so there is no need to call DeleteOperation.\n\nOur SLO permits Project creation to take up to 30 seconds at the 90th\npercentile. As of 2016-08-29, we are observing 6 seconds 50th percentile\nlatency. 95th percentile latency is around 11 seconds. We recommend\npolling at the 5th second with an exponential backoff.\n\nAuthorization requires the Google IAM permission\n`resourcemanager.projects.create` on the specified parent for the new\nproject. The parent is identified by a specified ResourceId,\nwhich must include both an ID and a type, such as organization.\n\nThis method does not associate the new project with a billing account.\nYou can set or update the billing account associated with a project using\nthe [`projects.updateBillingInfo`]\n(/billing/reference/rest/v1/projects/updateBillingInfo) method.",
  5411. // "flatPath": "v1/projects",
  5412. // "httpMethod": "POST",
  5413. // "id": "cloudresourcemanager.projects.create",
  5414. // "parameterOrder": [],
  5415. // "parameters": {},
  5416. // "path": "v1/projects",
  5417. // "request": {
  5418. // "$ref": "Project"
  5419. // },
  5420. // "response": {
  5421. // "$ref": "Operation"
  5422. // },
  5423. // "scopes": [
  5424. // "https://www.googleapis.com/auth/cloud-platform"
  5425. // ]
  5426. // }
  5427. }
  5428. // method id "cloudresourcemanager.projects.delete":
  5429. type ProjectsDeleteCall struct {
  5430. s *Service
  5431. projectId string
  5432. urlParams_ gensupport.URLParams
  5433. ctx_ context.Context
  5434. header_ http.Header
  5435. }
  5436. // Delete: Marks the Project identified by the specified
  5437. // `project_id` (for example, `my-project-123`) for deletion.
  5438. // This method will only affect the Project if it has a lifecycle state
  5439. // of
  5440. // ACTIVE.
  5441. //
  5442. // This method changes the Project's lifecycle state from
  5443. // ACTIVE
  5444. // to DELETE_REQUESTED.
  5445. // The deletion starts at an unspecified time,
  5446. // at which point the Project is no longer accessible.
  5447. //
  5448. // Until the deletion completes, you can check the lifecycle
  5449. // state
  5450. // checked by retrieving the Project with GetProject,
  5451. // and the Project remains visible to ListProjects.
  5452. // However, you cannot update the project.
  5453. //
  5454. // After the deletion completes, the Project is not retrievable by
  5455. // the GetProject and
  5456. // ListProjects methods.
  5457. //
  5458. // The caller must have modify permissions for this Project.
  5459. func (r *ProjectsService) Delete(projectId string) *ProjectsDeleteCall {
  5460. c := &ProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5461. c.projectId = projectId
  5462. return c
  5463. }
  5464. // Fields allows partial responses to be retrieved. See
  5465. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5466. // for more information.
  5467. func (c *ProjectsDeleteCall) Fields(s ...googleapi.Field) *ProjectsDeleteCall {
  5468. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5469. return c
  5470. }
  5471. // Context sets the context to be used in this call's Do method. Any
  5472. // pending HTTP request will be aborted if the provided context is
  5473. // canceled.
  5474. func (c *ProjectsDeleteCall) Context(ctx context.Context) *ProjectsDeleteCall {
  5475. c.ctx_ = ctx
  5476. return c
  5477. }
  5478. // Header returns an http.Header that can be modified by the caller to
  5479. // add HTTP headers to the request.
  5480. func (c *ProjectsDeleteCall) Header() http.Header {
  5481. if c.header_ == nil {
  5482. c.header_ = make(http.Header)
  5483. }
  5484. return c.header_
  5485. }
  5486. func (c *ProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5487. reqHeaders := make(http.Header)
  5488. for k, v := range c.header_ {
  5489. reqHeaders[k] = v
  5490. }
  5491. reqHeaders.Set("User-Agent", c.s.userAgent())
  5492. var body io.Reader = nil
  5493. c.urlParams_.Set("alt", alt)
  5494. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}")
  5495. urls += "?" + c.urlParams_.Encode()
  5496. req, _ := http.NewRequest("DELETE", urls, body)
  5497. req.Header = reqHeaders
  5498. googleapi.Expand(req.URL, map[string]string{
  5499. "projectId": c.projectId,
  5500. })
  5501. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5502. }
  5503. // Do executes the "cloudresourcemanager.projects.delete" call.
  5504. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5505. // code is an error. Response headers are in either
  5506. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5507. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5508. // check whether the returned error was because http.StatusNotModified
  5509. // was returned.
  5510. func (c *ProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5511. gensupport.SetOptions(c.urlParams_, opts...)
  5512. res, err := c.doRequest("json")
  5513. if res != nil && res.StatusCode == http.StatusNotModified {
  5514. if res.Body != nil {
  5515. res.Body.Close()
  5516. }
  5517. return nil, &googleapi.Error{
  5518. Code: res.StatusCode,
  5519. Header: res.Header,
  5520. }
  5521. }
  5522. if err != nil {
  5523. return nil, err
  5524. }
  5525. defer googleapi.CloseBody(res)
  5526. if err := googleapi.CheckResponse(res); err != nil {
  5527. return nil, err
  5528. }
  5529. ret := &Empty{
  5530. ServerResponse: googleapi.ServerResponse{
  5531. Header: res.Header,
  5532. HTTPStatusCode: res.StatusCode,
  5533. },
  5534. }
  5535. target := &ret
  5536. if err := gensupport.DecodeResponse(target, res); err != nil {
  5537. return nil, err
  5538. }
  5539. return ret, nil
  5540. // {
  5541. // "description": "Marks the Project identified by the specified\n`project_id` (for example, `my-project-123`) for deletion.\nThis method will only affect the Project if it has a lifecycle state of\nACTIVE.\n\nThis method changes the Project's lifecycle state from\nACTIVE\nto DELETE_REQUESTED.\nThe deletion starts at an unspecified time,\nat which point the Project is no longer accessible.\n\nUntil the deletion completes, you can check the lifecycle state\nchecked by retrieving the Project with GetProject,\nand the Project remains visible to ListProjects.\nHowever, you cannot update the project.\n\nAfter the deletion completes, the Project is not retrievable by\nthe GetProject and\nListProjects methods.\n\nThe caller must have modify permissions for this Project.",
  5542. // "flatPath": "v1/projects/{projectId}",
  5543. // "httpMethod": "DELETE",
  5544. // "id": "cloudresourcemanager.projects.delete",
  5545. // "parameterOrder": [
  5546. // "projectId"
  5547. // ],
  5548. // "parameters": {
  5549. // "projectId": {
  5550. // "description": "The Project ID (for example, `foo-bar-123`).\n\nRequired.",
  5551. // "location": "path",
  5552. // "required": true,
  5553. // "type": "string"
  5554. // }
  5555. // },
  5556. // "path": "v1/projects/{projectId}",
  5557. // "response": {
  5558. // "$ref": "Empty"
  5559. // },
  5560. // "scopes": [
  5561. // "https://www.googleapis.com/auth/cloud-platform"
  5562. // ]
  5563. // }
  5564. }
  5565. // method id "cloudresourcemanager.projects.get":
  5566. type ProjectsGetCall struct {
  5567. s *Service
  5568. projectId string
  5569. urlParams_ gensupport.URLParams
  5570. ifNoneMatch_ string
  5571. ctx_ context.Context
  5572. header_ http.Header
  5573. }
  5574. // Get: Retrieves the Project identified by the specified
  5575. // `project_id` (for example, `my-project-123`).
  5576. //
  5577. // The caller must have read permissions for this Project.
  5578. func (r *ProjectsService) Get(projectId string) *ProjectsGetCall {
  5579. c := &ProjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5580. c.projectId = projectId
  5581. return c
  5582. }
  5583. // Fields allows partial responses to be retrieved. See
  5584. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5585. // for more information.
  5586. func (c *ProjectsGetCall) Fields(s ...googleapi.Field) *ProjectsGetCall {
  5587. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5588. return c
  5589. }
  5590. // IfNoneMatch sets the optional parameter which makes the operation
  5591. // fail if the object's ETag matches the given value. This is useful for
  5592. // getting updates only after the object has changed since the last
  5593. // request. Use googleapi.IsNotModified to check whether the response
  5594. // error from Do is the result of In-None-Match.
  5595. func (c *ProjectsGetCall) IfNoneMatch(entityTag string) *ProjectsGetCall {
  5596. c.ifNoneMatch_ = entityTag
  5597. return c
  5598. }
  5599. // Context sets the context to be used in this call's Do method. Any
  5600. // pending HTTP request will be aborted if the provided context is
  5601. // canceled.
  5602. func (c *ProjectsGetCall) Context(ctx context.Context) *ProjectsGetCall {
  5603. c.ctx_ = ctx
  5604. return c
  5605. }
  5606. // Header returns an http.Header that can be modified by the caller to
  5607. // add HTTP headers to the request.
  5608. func (c *ProjectsGetCall) Header() http.Header {
  5609. if c.header_ == nil {
  5610. c.header_ = make(http.Header)
  5611. }
  5612. return c.header_
  5613. }
  5614. func (c *ProjectsGetCall) doRequest(alt string) (*http.Response, error) {
  5615. reqHeaders := make(http.Header)
  5616. for k, v := range c.header_ {
  5617. reqHeaders[k] = v
  5618. }
  5619. reqHeaders.Set("User-Agent", c.s.userAgent())
  5620. if c.ifNoneMatch_ != "" {
  5621. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5622. }
  5623. var body io.Reader = nil
  5624. c.urlParams_.Set("alt", alt)
  5625. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}")
  5626. urls += "?" + c.urlParams_.Encode()
  5627. req, _ := http.NewRequest("GET", urls, body)
  5628. req.Header = reqHeaders
  5629. googleapi.Expand(req.URL, map[string]string{
  5630. "projectId": c.projectId,
  5631. })
  5632. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5633. }
  5634. // Do executes the "cloudresourcemanager.projects.get" call.
  5635. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  5636. // code is an error. Response headers are in either
  5637. // *Project.ServerResponse.Header or (if a response was returned at all)
  5638. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5639. // check whether the returned error was because http.StatusNotModified
  5640. // was returned.
  5641. func (c *ProjectsGetCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  5642. gensupport.SetOptions(c.urlParams_, opts...)
  5643. res, err := c.doRequest("json")
  5644. if res != nil && res.StatusCode == http.StatusNotModified {
  5645. if res.Body != nil {
  5646. res.Body.Close()
  5647. }
  5648. return nil, &googleapi.Error{
  5649. Code: res.StatusCode,
  5650. Header: res.Header,
  5651. }
  5652. }
  5653. if err != nil {
  5654. return nil, err
  5655. }
  5656. defer googleapi.CloseBody(res)
  5657. if err := googleapi.CheckResponse(res); err != nil {
  5658. return nil, err
  5659. }
  5660. ret := &Project{
  5661. ServerResponse: googleapi.ServerResponse{
  5662. Header: res.Header,
  5663. HTTPStatusCode: res.StatusCode,
  5664. },
  5665. }
  5666. target := &ret
  5667. if err := gensupport.DecodeResponse(target, res); err != nil {
  5668. return nil, err
  5669. }
  5670. return ret, nil
  5671. // {
  5672. // "description": "Retrieves the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.",
  5673. // "flatPath": "v1/projects/{projectId}",
  5674. // "httpMethod": "GET",
  5675. // "id": "cloudresourcemanager.projects.get",
  5676. // "parameterOrder": [
  5677. // "projectId"
  5678. // ],
  5679. // "parameters": {
  5680. // "projectId": {
  5681. // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.",
  5682. // "location": "path",
  5683. // "required": true,
  5684. // "type": "string"
  5685. // }
  5686. // },
  5687. // "path": "v1/projects/{projectId}",
  5688. // "response": {
  5689. // "$ref": "Project"
  5690. // },
  5691. // "scopes": [
  5692. // "https://www.googleapis.com/auth/cloud-platform",
  5693. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5694. // ]
  5695. // }
  5696. }
  5697. // method id "cloudresourcemanager.projects.getAncestry":
  5698. type ProjectsGetAncestryCall struct {
  5699. s *Service
  5700. projectId string
  5701. getancestryrequest *GetAncestryRequest
  5702. urlParams_ gensupport.URLParams
  5703. ctx_ context.Context
  5704. header_ http.Header
  5705. }
  5706. // GetAncestry: Gets a list of ancestors in the resource hierarchy for
  5707. // the Project
  5708. // identified by the specified `project_id` (for example,
  5709. // `my-project-123`).
  5710. //
  5711. // The caller must have read permissions for this Project.
  5712. func (r *ProjectsService) GetAncestry(projectId string, getancestryrequest *GetAncestryRequest) *ProjectsGetAncestryCall {
  5713. c := &ProjectsGetAncestryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5714. c.projectId = projectId
  5715. c.getancestryrequest = getancestryrequest
  5716. return c
  5717. }
  5718. // Fields allows partial responses to be retrieved. See
  5719. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5720. // for more information.
  5721. func (c *ProjectsGetAncestryCall) Fields(s ...googleapi.Field) *ProjectsGetAncestryCall {
  5722. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5723. return c
  5724. }
  5725. // Context sets the context to be used in this call's Do method. Any
  5726. // pending HTTP request will be aborted if the provided context is
  5727. // canceled.
  5728. func (c *ProjectsGetAncestryCall) Context(ctx context.Context) *ProjectsGetAncestryCall {
  5729. c.ctx_ = ctx
  5730. return c
  5731. }
  5732. // Header returns an http.Header that can be modified by the caller to
  5733. // add HTTP headers to the request.
  5734. func (c *ProjectsGetAncestryCall) Header() http.Header {
  5735. if c.header_ == nil {
  5736. c.header_ = make(http.Header)
  5737. }
  5738. return c.header_
  5739. }
  5740. func (c *ProjectsGetAncestryCall) doRequest(alt string) (*http.Response, error) {
  5741. reqHeaders := make(http.Header)
  5742. for k, v := range c.header_ {
  5743. reqHeaders[k] = v
  5744. }
  5745. reqHeaders.Set("User-Agent", c.s.userAgent())
  5746. var body io.Reader = nil
  5747. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getancestryrequest)
  5748. if err != nil {
  5749. return nil, err
  5750. }
  5751. reqHeaders.Set("Content-Type", "application/json")
  5752. c.urlParams_.Set("alt", alt)
  5753. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}:getAncestry")
  5754. urls += "?" + c.urlParams_.Encode()
  5755. req, _ := http.NewRequest("POST", urls, body)
  5756. req.Header = reqHeaders
  5757. googleapi.Expand(req.URL, map[string]string{
  5758. "projectId": c.projectId,
  5759. })
  5760. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5761. }
  5762. // Do executes the "cloudresourcemanager.projects.getAncestry" call.
  5763. // Exactly one of *GetAncestryResponse or error will be non-nil. Any
  5764. // non-2xx status code is an error. Response headers are in either
  5765. // *GetAncestryResponse.ServerResponse.Header or (if a response was
  5766. // returned at all) in error.(*googleapi.Error).Header. Use
  5767. // googleapi.IsNotModified to check whether the returned error was
  5768. // because http.StatusNotModified was returned.
  5769. func (c *ProjectsGetAncestryCall) Do(opts ...googleapi.CallOption) (*GetAncestryResponse, error) {
  5770. gensupport.SetOptions(c.urlParams_, opts...)
  5771. res, err := c.doRequest("json")
  5772. if res != nil && res.StatusCode == http.StatusNotModified {
  5773. if res.Body != nil {
  5774. res.Body.Close()
  5775. }
  5776. return nil, &googleapi.Error{
  5777. Code: res.StatusCode,
  5778. Header: res.Header,
  5779. }
  5780. }
  5781. if err != nil {
  5782. return nil, err
  5783. }
  5784. defer googleapi.CloseBody(res)
  5785. if err := googleapi.CheckResponse(res); err != nil {
  5786. return nil, err
  5787. }
  5788. ret := &GetAncestryResponse{
  5789. ServerResponse: googleapi.ServerResponse{
  5790. Header: res.Header,
  5791. HTTPStatusCode: res.StatusCode,
  5792. },
  5793. }
  5794. target := &ret
  5795. if err := gensupport.DecodeResponse(target, res); err != nil {
  5796. return nil, err
  5797. }
  5798. return ret, nil
  5799. // {
  5800. // "description": "Gets a list of ancestors in the resource hierarchy for the Project\nidentified by the specified `project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.",
  5801. // "flatPath": "v1/projects/{projectId}:getAncestry",
  5802. // "httpMethod": "POST",
  5803. // "id": "cloudresourcemanager.projects.getAncestry",
  5804. // "parameterOrder": [
  5805. // "projectId"
  5806. // ],
  5807. // "parameters": {
  5808. // "projectId": {
  5809. // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.",
  5810. // "location": "path",
  5811. // "required": true,
  5812. // "type": "string"
  5813. // }
  5814. // },
  5815. // "path": "v1/projects/{projectId}:getAncestry",
  5816. // "request": {
  5817. // "$ref": "GetAncestryRequest"
  5818. // },
  5819. // "response": {
  5820. // "$ref": "GetAncestryResponse"
  5821. // },
  5822. // "scopes": [
  5823. // "https://www.googleapis.com/auth/cloud-platform",
  5824. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5825. // ]
  5826. // }
  5827. }
  5828. // method id "cloudresourcemanager.projects.getEffectiveOrgPolicy":
  5829. type ProjectsGetEffectiveOrgPolicyCall struct {
  5830. s *Service
  5831. resource string
  5832. geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest
  5833. urlParams_ gensupport.URLParams
  5834. ctx_ context.Context
  5835. header_ http.Header
  5836. }
  5837. // GetEffectiveOrgPolicy: Gets the effective `Policy` on a resource.
  5838. // This is the result of merging
  5839. // `Policies` in the resource hierarchy. The returned `Policy` will not
  5840. // have
  5841. // an `etag`set because it is a computed `Policy` across multiple
  5842. // resources.
  5843. // Subtrees of Resource Manager resource hierarchy with 'under:' prefix
  5844. // will
  5845. // not be expanded.
  5846. func (r *ProjectsService) GetEffectiveOrgPolicy(resource string, geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest) *ProjectsGetEffectiveOrgPolicyCall {
  5847. c := &ProjectsGetEffectiveOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5848. c.resource = resource
  5849. c.geteffectiveorgpolicyrequest = geteffectiveorgpolicyrequest
  5850. return c
  5851. }
  5852. // Fields allows partial responses to be retrieved. See
  5853. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5854. // for more information.
  5855. func (c *ProjectsGetEffectiveOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetEffectiveOrgPolicyCall {
  5856. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5857. return c
  5858. }
  5859. // Context sets the context to be used in this call's Do method. Any
  5860. // pending HTTP request will be aborted if the provided context is
  5861. // canceled.
  5862. func (c *ProjectsGetEffectiveOrgPolicyCall) Context(ctx context.Context) *ProjectsGetEffectiveOrgPolicyCall {
  5863. c.ctx_ = ctx
  5864. return c
  5865. }
  5866. // Header returns an http.Header that can be modified by the caller to
  5867. // add HTTP headers to the request.
  5868. func (c *ProjectsGetEffectiveOrgPolicyCall) Header() http.Header {
  5869. if c.header_ == nil {
  5870. c.header_ = make(http.Header)
  5871. }
  5872. return c.header_
  5873. }
  5874. func (c *ProjectsGetEffectiveOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  5875. reqHeaders := make(http.Header)
  5876. for k, v := range c.header_ {
  5877. reqHeaders[k] = v
  5878. }
  5879. reqHeaders.Set("User-Agent", c.s.userAgent())
  5880. var body io.Reader = nil
  5881. body, err := googleapi.WithoutDataWrapper.JSONReader(c.geteffectiveorgpolicyrequest)
  5882. if err != nil {
  5883. return nil, err
  5884. }
  5885. reqHeaders.Set("Content-Type", "application/json")
  5886. c.urlParams_.Set("alt", alt)
  5887. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getEffectiveOrgPolicy")
  5888. urls += "?" + c.urlParams_.Encode()
  5889. req, _ := http.NewRequest("POST", urls, body)
  5890. req.Header = reqHeaders
  5891. googleapi.Expand(req.URL, map[string]string{
  5892. "resource": c.resource,
  5893. })
  5894. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5895. }
  5896. // Do executes the "cloudresourcemanager.projects.getEffectiveOrgPolicy" call.
  5897. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  5898. // status code is an error. Response headers are in either
  5899. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  5900. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5901. // to check whether the returned error was because
  5902. // http.StatusNotModified was returned.
  5903. func (c *ProjectsGetEffectiveOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  5904. gensupport.SetOptions(c.urlParams_, opts...)
  5905. res, err := c.doRequest("json")
  5906. if res != nil && res.StatusCode == http.StatusNotModified {
  5907. if res.Body != nil {
  5908. res.Body.Close()
  5909. }
  5910. return nil, &googleapi.Error{
  5911. Code: res.StatusCode,
  5912. Header: res.Header,
  5913. }
  5914. }
  5915. if err != nil {
  5916. return nil, err
  5917. }
  5918. defer googleapi.CloseBody(res)
  5919. if err := googleapi.CheckResponse(res); err != nil {
  5920. return nil, err
  5921. }
  5922. ret := &OrgPolicy{
  5923. ServerResponse: googleapi.ServerResponse{
  5924. Header: res.Header,
  5925. HTTPStatusCode: res.StatusCode,
  5926. },
  5927. }
  5928. target := &ret
  5929. if err := gensupport.DecodeResponse(target, res); err != nil {
  5930. return nil, err
  5931. }
  5932. return ret, nil
  5933. // {
  5934. // "description": "Gets the effective `Policy` on a resource. This is the result of merging\n`Policies` in the resource hierarchy. The returned `Policy` will not have\nan `etag`set because it is a computed `Policy` across multiple resources.\nSubtrees of Resource Manager resource hierarchy with 'under:' prefix will\nnot be expanded.",
  5935. // "flatPath": "v1/projects/{projectsId}:getEffectiveOrgPolicy",
  5936. // "httpMethod": "POST",
  5937. // "id": "cloudresourcemanager.projects.getEffectiveOrgPolicy",
  5938. // "parameterOrder": [
  5939. // "resource"
  5940. // ],
  5941. // "parameters": {
  5942. // "resource": {
  5943. // "description": "The name of the resource to start computing the effective `Policy`.",
  5944. // "location": "path",
  5945. // "pattern": "^projects/[^/]+$",
  5946. // "required": true,
  5947. // "type": "string"
  5948. // }
  5949. // },
  5950. // "path": "v1/{+resource}:getEffectiveOrgPolicy",
  5951. // "request": {
  5952. // "$ref": "GetEffectiveOrgPolicyRequest"
  5953. // },
  5954. // "response": {
  5955. // "$ref": "OrgPolicy"
  5956. // },
  5957. // "scopes": [
  5958. // "https://www.googleapis.com/auth/cloud-platform",
  5959. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5960. // ]
  5961. // }
  5962. }
  5963. // method id "cloudresourcemanager.projects.getIamPolicy":
  5964. type ProjectsGetIamPolicyCall struct {
  5965. s *Service
  5966. resource string
  5967. getiampolicyrequest *GetIamPolicyRequest
  5968. urlParams_ gensupport.URLParams
  5969. ctx_ context.Context
  5970. header_ http.Header
  5971. }
  5972. // GetIamPolicy: Returns the IAM access control policy for the specified
  5973. // Project.
  5974. // Permission is denied if the policy or the resource does not
  5975. // exist.
  5976. //
  5977. // Authorization requires the Google IAM
  5978. // permission
  5979. // `resourcemanager.projects.getIamPolicy` on the project.
  5980. //
  5981. // For additional information about resource structure and
  5982. // identification,
  5983. // see [Resource Names](/apis/design/resource_names).
  5984. func (r *ProjectsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsGetIamPolicyCall {
  5985. c := &ProjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5986. c.resource = resource
  5987. c.getiampolicyrequest = getiampolicyrequest
  5988. return c
  5989. }
  5990. // Fields allows partial responses to be retrieved. See
  5991. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5992. // for more information.
  5993. func (c *ProjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetIamPolicyCall {
  5994. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5995. return c
  5996. }
  5997. // Context sets the context to be used in this call's Do method. Any
  5998. // pending HTTP request will be aborted if the provided context is
  5999. // canceled.
  6000. func (c *ProjectsGetIamPolicyCall) Context(ctx context.Context) *ProjectsGetIamPolicyCall {
  6001. c.ctx_ = ctx
  6002. return c
  6003. }
  6004. // Header returns an http.Header that can be modified by the caller to
  6005. // add HTTP headers to the request.
  6006. func (c *ProjectsGetIamPolicyCall) Header() http.Header {
  6007. if c.header_ == nil {
  6008. c.header_ = make(http.Header)
  6009. }
  6010. return c.header_
  6011. }
  6012. func (c *ProjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  6013. reqHeaders := make(http.Header)
  6014. for k, v := range c.header_ {
  6015. reqHeaders[k] = v
  6016. }
  6017. reqHeaders.Set("User-Agent", c.s.userAgent())
  6018. var body io.Reader = nil
  6019. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  6020. if err != nil {
  6021. return nil, err
  6022. }
  6023. reqHeaders.Set("Content-Type", "application/json")
  6024. c.urlParams_.Set("alt", alt)
  6025. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{resource}:getIamPolicy")
  6026. urls += "?" + c.urlParams_.Encode()
  6027. req, _ := http.NewRequest("POST", urls, body)
  6028. req.Header = reqHeaders
  6029. googleapi.Expand(req.URL, map[string]string{
  6030. "resource": c.resource,
  6031. })
  6032. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6033. }
  6034. // Do executes the "cloudresourcemanager.projects.getIamPolicy" call.
  6035. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  6036. // code is an error. Response headers are in either
  6037. // *Policy.ServerResponse.Header or (if a response was returned at all)
  6038. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6039. // check whether the returned error was because http.StatusNotModified
  6040. // was returned.
  6041. func (c *ProjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  6042. gensupport.SetOptions(c.urlParams_, opts...)
  6043. res, err := c.doRequest("json")
  6044. if res != nil && res.StatusCode == http.StatusNotModified {
  6045. if res.Body != nil {
  6046. res.Body.Close()
  6047. }
  6048. return nil, &googleapi.Error{
  6049. Code: res.StatusCode,
  6050. Header: res.Header,
  6051. }
  6052. }
  6053. if err != nil {
  6054. return nil, err
  6055. }
  6056. defer googleapi.CloseBody(res)
  6057. if err := googleapi.CheckResponse(res); err != nil {
  6058. return nil, err
  6059. }
  6060. ret := &Policy{
  6061. ServerResponse: googleapi.ServerResponse{
  6062. Header: res.Header,
  6063. HTTPStatusCode: res.StatusCode,
  6064. },
  6065. }
  6066. target := &ret
  6067. if err := gensupport.DecodeResponse(target, res); err != nil {
  6068. return nil, err
  6069. }
  6070. return ret, nil
  6071. // {
  6072. // "description": "Returns the IAM access control policy for the specified Project.\nPermission is denied if the policy or the resource does not exist.\n\nAuthorization requires the Google IAM permission\n`resourcemanager.projects.getIamPolicy` on the project.\n\nFor additional information about resource structure and identification,\nsee [Resource Names](/apis/design/resource_names).",
  6073. // "flatPath": "v1/projects/{resource}:getIamPolicy",
  6074. // "httpMethod": "POST",
  6075. // "id": "cloudresourcemanager.projects.getIamPolicy",
  6076. // "parameterOrder": [
  6077. // "resource"
  6078. // ],
  6079. // "parameters": {
  6080. // "resource": {
  6081. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  6082. // "location": "path",
  6083. // "required": true,
  6084. // "type": "string"
  6085. // }
  6086. // },
  6087. // "path": "v1/projects/{resource}:getIamPolicy",
  6088. // "request": {
  6089. // "$ref": "GetIamPolicyRequest"
  6090. // },
  6091. // "response": {
  6092. // "$ref": "Policy"
  6093. // },
  6094. // "scopes": [
  6095. // "https://www.googleapis.com/auth/cloud-platform",
  6096. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6097. // ]
  6098. // }
  6099. }
  6100. // method id "cloudresourcemanager.projects.getOrgPolicy":
  6101. type ProjectsGetOrgPolicyCall struct {
  6102. s *Service
  6103. resource string
  6104. getorgpolicyrequest *GetOrgPolicyRequest
  6105. urlParams_ gensupport.URLParams
  6106. ctx_ context.Context
  6107. header_ http.Header
  6108. }
  6109. // GetOrgPolicy: Gets a `Policy` on a resource.
  6110. //
  6111. // If no `Policy` is set on the resource, a `Policy` is returned with
  6112. // default
  6113. // values including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`.
  6114. // The
  6115. // `etag` value can be used with `SetOrgPolicy()` to create or update
  6116. // a
  6117. // `Policy` during read-modify-write.
  6118. func (r *ProjectsService) GetOrgPolicy(resource string, getorgpolicyrequest *GetOrgPolicyRequest) *ProjectsGetOrgPolicyCall {
  6119. c := &ProjectsGetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6120. c.resource = resource
  6121. c.getorgpolicyrequest = getorgpolicyrequest
  6122. return c
  6123. }
  6124. // Fields allows partial responses to be retrieved. See
  6125. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6126. // for more information.
  6127. func (c *ProjectsGetOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetOrgPolicyCall {
  6128. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6129. return c
  6130. }
  6131. // Context sets the context to be used in this call's Do method. Any
  6132. // pending HTTP request will be aborted if the provided context is
  6133. // canceled.
  6134. func (c *ProjectsGetOrgPolicyCall) Context(ctx context.Context) *ProjectsGetOrgPolicyCall {
  6135. c.ctx_ = ctx
  6136. return c
  6137. }
  6138. // Header returns an http.Header that can be modified by the caller to
  6139. // add HTTP headers to the request.
  6140. func (c *ProjectsGetOrgPolicyCall) Header() http.Header {
  6141. if c.header_ == nil {
  6142. c.header_ = make(http.Header)
  6143. }
  6144. return c.header_
  6145. }
  6146. func (c *ProjectsGetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  6147. reqHeaders := make(http.Header)
  6148. for k, v := range c.header_ {
  6149. reqHeaders[k] = v
  6150. }
  6151. reqHeaders.Set("User-Agent", c.s.userAgent())
  6152. var body io.Reader = nil
  6153. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getorgpolicyrequest)
  6154. if err != nil {
  6155. return nil, err
  6156. }
  6157. reqHeaders.Set("Content-Type", "application/json")
  6158. c.urlParams_.Set("alt", alt)
  6159. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getOrgPolicy")
  6160. urls += "?" + c.urlParams_.Encode()
  6161. req, _ := http.NewRequest("POST", urls, body)
  6162. req.Header = reqHeaders
  6163. googleapi.Expand(req.URL, map[string]string{
  6164. "resource": c.resource,
  6165. })
  6166. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6167. }
  6168. // Do executes the "cloudresourcemanager.projects.getOrgPolicy" call.
  6169. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  6170. // status code is an error. Response headers are in either
  6171. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  6172. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6173. // to check whether the returned error was because
  6174. // http.StatusNotModified was returned.
  6175. func (c *ProjectsGetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  6176. gensupport.SetOptions(c.urlParams_, opts...)
  6177. res, err := c.doRequest("json")
  6178. if res != nil && res.StatusCode == http.StatusNotModified {
  6179. if res.Body != nil {
  6180. res.Body.Close()
  6181. }
  6182. return nil, &googleapi.Error{
  6183. Code: res.StatusCode,
  6184. Header: res.Header,
  6185. }
  6186. }
  6187. if err != nil {
  6188. return nil, err
  6189. }
  6190. defer googleapi.CloseBody(res)
  6191. if err := googleapi.CheckResponse(res); err != nil {
  6192. return nil, err
  6193. }
  6194. ret := &OrgPolicy{
  6195. ServerResponse: googleapi.ServerResponse{
  6196. Header: res.Header,
  6197. HTTPStatusCode: res.StatusCode,
  6198. },
  6199. }
  6200. target := &ret
  6201. if err := gensupport.DecodeResponse(target, res); err != nil {
  6202. return nil, err
  6203. }
  6204. return ret, nil
  6205. // {
  6206. // "description": "Gets a `Policy` on a resource.\n\nIf no `Policy` is set on the resource, a `Policy` is returned with default\nvalues including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`. The\n`etag` value can be used with `SetOrgPolicy()` to create or update a\n`Policy` during read-modify-write.",
  6207. // "flatPath": "v1/projects/{projectsId}:getOrgPolicy",
  6208. // "httpMethod": "POST",
  6209. // "id": "cloudresourcemanager.projects.getOrgPolicy",
  6210. // "parameterOrder": [
  6211. // "resource"
  6212. // ],
  6213. // "parameters": {
  6214. // "resource": {
  6215. // "description": "Name of the resource the `Policy` is set on.",
  6216. // "location": "path",
  6217. // "pattern": "^projects/[^/]+$",
  6218. // "required": true,
  6219. // "type": "string"
  6220. // }
  6221. // },
  6222. // "path": "v1/{+resource}:getOrgPolicy",
  6223. // "request": {
  6224. // "$ref": "GetOrgPolicyRequest"
  6225. // },
  6226. // "response": {
  6227. // "$ref": "OrgPolicy"
  6228. // },
  6229. // "scopes": [
  6230. // "https://www.googleapis.com/auth/cloud-platform",
  6231. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6232. // ]
  6233. // }
  6234. }
  6235. // method id "cloudresourcemanager.projects.list":
  6236. type ProjectsListCall struct {
  6237. s *Service
  6238. urlParams_ gensupport.URLParams
  6239. ifNoneMatch_ string
  6240. ctx_ context.Context
  6241. header_ http.Header
  6242. }
  6243. // List: Lists Projects that are visible to the user and satisfy
  6244. // the
  6245. // specified filter. This method returns Projects in an unspecified
  6246. // order.
  6247. // This method is eventually consistent with project mutations; this
  6248. // means
  6249. // that a newly created project may not appear in the results or
  6250. // recent
  6251. // updates to an existing project may not be reflected in the results.
  6252. // To
  6253. // retrieve the latest state of a project, use the
  6254. // GetProject method.
  6255. func (r *ProjectsService) List() *ProjectsListCall {
  6256. c := &ProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6257. return c
  6258. }
  6259. // Filter sets the optional parameter "filter": An expression for
  6260. // filtering the results of the request. Filter rules are
  6261. // case insensitive. The fields eligible for filtering are:
  6262. //
  6263. // + `name`
  6264. // + `id`
  6265. // + <code>labels.<em>key</em></code> where *key* is the name of a
  6266. // label
  6267. //
  6268. // Some examples of using labels as
  6269. // filters:
  6270. //
  6271. // |Filter|Description|
  6272. // |------|-----------|
  6273. // |name:how*|The project's name starts with "how".|
  6274. // |name:Howl|The project's name is `Howl` or
  6275. // `howl`.|
  6276. // |name:HOWL|Equivalent to above.|
  6277. // |NAME:howl|Equivalent to above.|
  6278. // |labels.color:*|The project has the label
  6279. // `color`.|
  6280. // |labels.color:red|The project's label `color` has the value
  6281. // `red`.|
  6282. // |labels.color:red&nbsp;labels.size:big|The project's label `color`
  6283. // has the value `red` and its label `size` has the value `big`.
  6284. //
  6285. // If you specify a filter that has both `parent.type` and `parent.id`,
  6286. // then
  6287. // the `resourcemanager.projects.list` permission is checked on the
  6288. // parent.
  6289. // If the user has this permission, all projects under the parent will
  6290. // be
  6291. // returned after remaining filters have been applied. If the user lacks
  6292. // this
  6293. // permission, then all projects for which the user has
  6294. // the
  6295. // `resourcemanager.projects.get` permission will be returned after
  6296. // remaining
  6297. // filters have been applied. If no filter is specified, the call will
  6298. // return
  6299. // projects for which the user has `resourcemanager.projects.get`
  6300. // permissions.
  6301. func (c *ProjectsListCall) Filter(filter string) *ProjectsListCall {
  6302. c.urlParams_.Set("filter", filter)
  6303. return c
  6304. }
  6305. // PageSize sets the optional parameter "pageSize": The maximum number
  6306. // of Projects to return in the response.
  6307. // The server can return fewer Projects than requested.
  6308. // If unspecified, server picks an appropriate default.
  6309. func (c *ProjectsListCall) PageSize(pageSize int64) *ProjectsListCall {
  6310. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6311. return c
  6312. }
  6313. // PageToken sets the optional parameter "pageToken": A pagination token
  6314. // returned from a previous call to ListProjects
  6315. // that indicates from where listing should continue.
  6316. func (c *ProjectsListCall) PageToken(pageToken string) *ProjectsListCall {
  6317. c.urlParams_.Set("pageToken", pageToken)
  6318. return c
  6319. }
  6320. // Fields allows partial responses to be retrieved. See
  6321. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6322. // for more information.
  6323. func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {
  6324. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6325. return c
  6326. }
  6327. // IfNoneMatch sets the optional parameter which makes the operation
  6328. // fail if the object's ETag matches the given value. This is useful for
  6329. // getting updates only after the object has changed since the last
  6330. // request. Use googleapi.IsNotModified to check whether the response
  6331. // error from Do is the result of In-None-Match.
  6332. func (c *ProjectsListCall) IfNoneMatch(entityTag string) *ProjectsListCall {
  6333. c.ifNoneMatch_ = entityTag
  6334. return c
  6335. }
  6336. // Context sets the context to be used in this call's Do method. Any
  6337. // pending HTTP request will be aborted if the provided context is
  6338. // canceled.
  6339. func (c *ProjectsListCall) Context(ctx context.Context) *ProjectsListCall {
  6340. c.ctx_ = ctx
  6341. return c
  6342. }
  6343. // Header returns an http.Header that can be modified by the caller to
  6344. // add HTTP headers to the request.
  6345. func (c *ProjectsListCall) Header() http.Header {
  6346. if c.header_ == nil {
  6347. c.header_ = make(http.Header)
  6348. }
  6349. return c.header_
  6350. }
  6351. func (c *ProjectsListCall) doRequest(alt string) (*http.Response, error) {
  6352. reqHeaders := make(http.Header)
  6353. for k, v := range c.header_ {
  6354. reqHeaders[k] = v
  6355. }
  6356. reqHeaders.Set("User-Agent", c.s.userAgent())
  6357. if c.ifNoneMatch_ != "" {
  6358. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6359. }
  6360. var body io.Reader = nil
  6361. c.urlParams_.Set("alt", alt)
  6362. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects")
  6363. urls += "?" + c.urlParams_.Encode()
  6364. req, _ := http.NewRequest("GET", urls, body)
  6365. req.Header = reqHeaders
  6366. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6367. }
  6368. // Do executes the "cloudresourcemanager.projects.list" call.
  6369. // Exactly one of *ListProjectsResponse or error will be non-nil. Any
  6370. // non-2xx status code is an error. Response headers are in either
  6371. // *ListProjectsResponse.ServerResponse.Header or (if a response was
  6372. // returned at all) in error.(*googleapi.Error).Header. Use
  6373. // googleapi.IsNotModified to check whether the returned error was
  6374. // because http.StatusNotModified was returned.
  6375. func (c *ProjectsListCall) Do(opts ...googleapi.CallOption) (*ListProjectsResponse, error) {
  6376. gensupport.SetOptions(c.urlParams_, opts...)
  6377. res, err := c.doRequest("json")
  6378. if res != nil && res.StatusCode == http.StatusNotModified {
  6379. if res.Body != nil {
  6380. res.Body.Close()
  6381. }
  6382. return nil, &googleapi.Error{
  6383. Code: res.StatusCode,
  6384. Header: res.Header,
  6385. }
  6386. }
  6387. if err != nil {
  6388. return nil, err
  6389. }
  6390. defer googleapi.CloseBody(res)
  6391. if err := googleapi.CheckResponse(res); err != nil {
  6392. return nil, err
  6393. }
  6394. ret := &ListProjectsResponse{
  6395. ServerResponse: googleapi.ServerResponse{
  6396. Header: res.Header,
  6397. HTTPStatusCode: res.StatusCode,
  6398. },
  6399. }
  6400. target := &ret
  6401. if err := gensupport.DecodeResponse(target, res); err != nil {
  6402. return nil, err
  6403. }
  6404. return ret, nil
  6405. // {
  6406. // "description": "Lists Projects that are visible to the user and satisfy the\nspecified filter. This method returns Projects in an unspecified order.\nThis method is eventually consistent with project mutations; this means\nthat a newly created project may not appear in the results or recent\nupdates to an existing project may not be reflected in the results. To\nretrieve the latest state of a project, use the\nGetProject method.",
  6407. // "flatPath": "v1/projects",
  6408. // "httpMethod": "GET",
  6409. // "id": "cloudresourcemanager.projects.list",
  6410. // "parameterOrder": [],
  6411. // "parameters": {
  6412. // "filter": {
  6413. // "description": "An expression for filtering the results of the request. Filter rules are\ncase insensitive. The fields eligible for filtering are:\n\n+ `name`\n+ `id`\n+ \u003ccode\u003elabels.\u003cem\u003ekey\u003c/em\u003e\u003c/code\u003e where *key* is the name of a label\n\nSome examples of using labels as filters:\n\n|Filter|Description|\n|------|-----------|\n|name:how*|The project's name starts with \"how\".|\n|name:Howl|The project's name is `Howl` or `howl`.|\n|name:HOWL|Equivalent to above.|\n|NAME:howl|Equivalent to above.|\n|labels.color:*|The project has the label `color`.|\n|labels.color:red|The project's label `color` has the value `red`.|\n|labels.color:red\u0026nbsp;labels.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`.\n\nIf you specify a filter that has both `parent.type` and `parent.id`, then\nthe `resourcemanager.projects.list` permission is checked on the parent.\nIf the user has this permission, all projects under the parent will be\nreturned after remaining filters have been applied. If the user lacks this\npermission, then all projects for which the user has the\n`resourcemanager.projects.get` permission will be returned after remaining\nfilters have been applied. If no filter is specified, the call will return\nprojects for which the user has `resourcemanager.projects.get` permissions.\n\nOptional.",
  6414. // "location": "query",
  6415. // "type": "string"
  6416. // },
  6417. // "pageSize": {
  6418. // "description": "The maximum number of Projects to return in the response.\nThe server can return fewer Projects than requested.\nIf unspecified, server picks an appropriate default.\n\nOptional.",
  6419. // "format": "int32",
  6420. // "location": "query",
  6421. // "type": "integer"
  6422. // },
  6423. // "pageToken": {
  6424. // "description": "A pagination token returned from a previous call to ListProjects\nthat indicates from where listing should continue.\n\nOptional.",
  6425. // "location": "query",
  6426. // "type": "string"
  6427. // }
  6428. // },
  6429. // "path": "v1/projects",
  6430. // "response": {
  6431. // "$ref": "ListProjectsResponse"
  6432. // },
  6433. // "scopes": [
  6434. // "https://www.googleapis.com/auth/cloud-platform",
  6435. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6436. // ]
  6437. // }
  6438. }
  6439. // Pages invokes f for each page of results.
  6440. // A non-nil error returned from f will halt the iteration.
  6441. // The provided context supersedes any context provided to the Context method.
  6442. func (c *ProjectsListCall) Pages(ctx context.Context, f func(*ListProjectsResponse) error) error {
  6443. c.ctx_ = ctx
  6444. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6445. for {
  6446. x, err := c.Do()
  6447. if err != nil {
  6448. return err
  6449. }
  6450. if err := f(x); err != nil {
  6451. return err
  6452. }
  6453. if x.NextPageToken == "" {
  6454. return nil
  6455. }
  6456. c.PageToken(x.NextPageToken)
  6457. }
  6458. }
  6459. // method id "cloudresourcemanager.projects.listAvailableOrgPolicyConstraints":
  6460. type ProjectsListAvailableOrgPolicyConstraintsCall struct {
  6461. s *Service
  6462. resource string
  6463. listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest
  6464. urlParams_ gensupport.URLParams
  6465. ctx_ context.Context
  6466. header_ http.Header
  6467. }
  6468. // ListAvailableOrgPolicyConstraints: Lists `Constraints` that could be
  6469. // applied on the specified resource.
  6470. func (r *ProjectsService) ListAvailableOrgPolicyConstraints(resource string, listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest) *ProjectsListAvailableOrgPolicyConstraintsCall {
  6471. c := &ProjectsListAvailableOrgPolicyConstraintsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6472. c.resource = resource
  6473. c.listavailableorgpolicyconstraintsrequest = listavailableorgpolicyconstraintsrequest
  6474. return c
  6475. }
  6476. // Fields allows partial responses to be retrieved. See
  6477. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6478. // for more information.
  6479. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Fields(s ...googleapi.Field) *ProjectsListAvailableOrgPolicyConstraintsCall {
  6480. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6481. return c
  6482. }
  6483. // Context sets the context to be used in this call's Do method. Any
  6484. // pending HTTP request will be aborted if the provided context is
  6485. // canceled.
  6486. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Context(ctx context.Context) *ProjectsListAvailableOrgPolicyConstraintsCall {
  6487. c.ctx_ = ctx
  6488. return c
  6489. }
  6490. // Header returns an http.Header that can be modified by the caller to
  6491. // add HTTP headers to the request.
  6492. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Header() http.Header {
  6493. if c.header_ == nil {
  6494. c.header_ = make(http.Header)
  6495. }
  6496. return c.header_
  6497. }
  6498. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) doRequest(alt string) (*http.Response, error) {
  6499. reqHeaders := make(http.Header)
  6500. for k, v := range c.header_ {
  6501. reqHeaders[k] = v
  6502. }
  6503. reqHeaders.Set("User-Agent", c.s.userAgent())
  6504. var body io.Reader = nil
  6505. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listavailableorgpolicyconstraintsrequest)
  6506. if err != nil {
  6507. return nil, err
  6508. }
  6509. reqHeaders.Set("Content-Type", "application/json")
  6510. c.urlParams_.Set("alt", alt)
  6511. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listAvailableOrgPolicyConstraints")
  6512. urls += "?" + c.urlParams_.Encode()
  6513. req, _ := http.NewRequest("POST", urls, body)
  6514. req.Header = reqHeaders
  6515. googleapi.Expand(req.URL, map[string]string{
  6516. "resource": c.resource,
  6517. })
  6518. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6519. }
  6520. // Do executes the "cloudresourcemanager.projects.listAvailableOrgPolicyConstraints" call.
  6521. // Exactly one of *ListAvailableOrgPolicyConstraintsResponse or error
  6522. // will be non-nil. Any non-2xx status code is an error. Response
  6523. // headers are in either
  6524. // *ListAvailableOrgPolicyConstraintsResponse.ServerResponse.Header or
  6525. // (if a response was returned at all) in
  6526. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6527. // whether the returned error was because http.StatusNotModified was
  6528. // returned.
  6529. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Do(opts ...googleapi.CallOption) (*ListAvailableOrgPolicyConstraintsResponse, error) {
  6530. gensupport.SetOptions(c.urlParams_, opts...)
  6531. res, err := c.doRequest("json")
  6532. if res != nil && res.StatusCode == http.StatusNotModified {
  6533. if res.Body != nil {
  6534. res.Body.Close()
  6535. }
  6536. return nil, &googleapi.Error{
  6537. Code: res.StatusCode,
  6538. Header: res.Header,
  6539. }
  6540. }
  6541. if err != nil {
  6542. return nil, err
  6543. }
  6544. defer googleapi.CloseBody(res)
  6545. if err := googleapi.CheckResponse(res); err != nil {
  6546. return nil, err
  6547. }
  6548. ret := &ListAvailableOrgPolicyConstraintsResponse{
  6549. ServerResponse: googleapi.ServerResponse{
  6550. Header: res.Header,
  6551. HTTPStatusCode: res.StatusCode,
  6552. },
  6553. }
  6554. target := &ret
  6555. if err := gensupport.DecodeResponse(target, res); err != nil {
  6556. return nil, err
  6557. }
  6558. return ret, nil
  6559. // {
  6560. // "description": "Lists `Constraints` that could be applied on the specified resource.",
  6561. // "flatPath": "v1/projects/{projectsId}:listAvailableOrgPolicyConstraints",
  6562. // "httpMethod": "POST",
  6563. // "id": "cloudresourcemanager.projects.listAvailableOrgPolicyConstraints",
  6564. // "parameterOrder": [
  6565. // "resource"
  6566. // ],
  6567. // "parameters": {
  6568. // "resource": {
  6569. // "description": "Name of the resource to list `Constraints` for.",
  6570. // "location": "path",
  6571. // "pattern": "^projects/[^/]+$",
  6572. // "required": true,
  6573. // "type": "string"
  6574. // }
  6575. // },
  6576. // "path": "v1/{+resource}:listAvailableOrgPolicyConstraints",
  6577. // "request": {
  6578. // "$ref": "ListAvailableOrgPolicyConstraintsRequest"
  6579. // },
  6580. // "response": {
  6581. // "$ref": "ListAvailableOrgPolicyConstraintsResponse"
  6582. // },
  6583. // "scopes": [
  6584. // "https://www.googleapis.com/auth/cloud-platform",
  6585. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6586. // ]
  6587. // }
  6588. }
  6589. // Pages invokes f for each page of results.
  6590. // A non-nil error returned from f will halt the iteration.
  6591. // The provided context supersedes any context provided to the Context method.
  6592. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Pages(ctx context.Context, f func(*ListAvailableOrgPolicyConstraintsResponse) error) error {
  6593. c.ctx_ = ctx
  6594. defer func(pt string) { c.listavailableorgpolicyconstraintsrequest.PageToken = pt }(c.listavailableorgpolicyconstraintsrequest.PageToken) // reset paging to original point
  6595. for {
  6596. x, err := c.Do()
  6597. if err != nil {
  6598. return err
  6599. }
  6600. if err := f(x); err != nil {
  6601. return err
  6602. }
  6603. if x.NextPageToken == "" {
  6604. return nil
  6605. }
  6606. c.listavailableorgpolicyconstraintsrequest.PageToken = x.NextPageToken
  6607. }
  6608. }
  6609. // method id "cloudresourcemanager.projects.listOrgPolicies":
  6610. type ProjectsListOrgPoliciesCall struct {
  6611. s *Service
  6612. resource string
  6613. listorgpoliciesrequest *ListOrgPoliciesRequest
  6614. urlParams_ gensupport.URLParams
  6615. ctx_ context.Context
  6616. header_ http.Header
  6617. }
  6618. // ListOrgPolicies: Lists all the `Policies` set for a particular
  6619. // resource.
  6620. func (r *ProjectsService) ListOrgPolicies(resource string, listorgpoliciesrequest *ListOrgPoliciesRequest) *ProjectsListOrgPoliciesCall {
  6621. c := &ProjectsListOrgPoliciesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6622. c.resource = resource
  6623. c.listorgpoliciesrequest = listorgpoliciesrequest
  6624. return c
  6625. }
  6626. // Fields allows partial responses to be retrieved. See
  6627. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6628. // for more information.
  6629. func (c *ProjectsListOrgPoliciesCall) Fields(s ...googleapi.Field) *ProjectsListOrgPoliciesCall {
  6630. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6631. return c
  6632. }
  6633. // Context sets the context to be used in this call's Do method. Any
  6634. // pending HTTP request will be aborted if the provided context is
  6635. // canceled.
  6636. func (c *ProjectsListOrgPoliciesCall) Context(ctx context.Context) *ProjectsListOrgPoliciesCall {
  6637. c.ctx_ = ctx
  6638. return c
  6639. }
  6640. // Header returns an http.Header that can be modified by the caller to
  6641. // add HTTP headers to the request.
  6642. func (c *ProjectsListOrgPoliciesCall) Header() http.Header {
  6643. if c.header_ == nil {
  6644. c.header_ = make(http.Header)
  6645. }
  6646. return c.header_
  6647. }
  6648. func (c *ProjectsListOrgPoliciesCall) doRequest(alt string) (*http.Response, error) {
  6649. reqHeaders := make(http.Header)
  6650. for k, v := range c.header_ {
  6651. reqHeaders[k] = v
  6652. }
  6653. reqHeaders.Set("User-Agent", c.s.userAgent())
  6654. var body io.Reader = nil
  6655. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listorgpoliciesrequest)
  6656. if err != nil {
  6657. return nil, err
  6658. }
  6659. reqHeaders.Set("Content-Type", "application/json")
  6660. c.urlParams_.Set("alt", alt)
  6661. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listOrgPolicies")
  6662. urls += "?" + c.urlParams_.Encode()
  6663. req, _ := http.NewRequest("POST", urls, body)
  6664. req.Header = reqHeaders
  6665. googleapi.Expand(req.URL, map[string]string{
  6666. "resource": c.resource,
  6667. })
  6668. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6669. }
  6670. // Do executes the "cloudresourcemanager.projects.listOrgPolicies" call.
  6671. // Exactly one of *ListOrgPoliciesResponse or error will be non-nil. Any
  6672. // non-2xx status code is an error. Response headers are in either
  6673. // *ListOrgPoliciesResponse.ServerResponse.Header or (if a response was
  6674. // returned at all) in error.(*googleapi.Error).Header. Use
  6675. // googleapi.IsNotModified to check whether the returned error was
  6676. // because http.StatusNotModified was returned.
  6677. func (c *ProjectsListOrgPoliciesCall) Do(opts ...googleapi.CallOption) (*ListOrgPoliciesResponse, error) {
  6678. gensupport.SetOptions(c.urlParams_, opts...)
  6679. res, err := c.doRequest("json")
  6680. if res != nil && res.StatusCode == http.StatusNotModified {
  6681. if res.Body != nil {
  6682. res.Body.Close()
  6683. }
  6684. return nil, &googleapi.Error{
  6685. Code: res.StatusCode,
  6686. Header: res.Header,
  6687. }
  6688. }
  6689. if err != nil {
  6690. return nil, err
  6691. }
  6692. defer googleapi.CloseBody(res)
  6693. if err := googleapi.CheckResponse(res); err != nil {
  6694. return nil, err
  6695. }
  6696. ret := &ListOrgPoliciesResponse{
  6697. ServerResponse: googleapi.ServerResponse{
  6698. Header: res.Header,
  6699. HTTPStatusCode: res.StatusCode,
  6700. },
  6701. }
  6702. target := &ret
  6703. if err := gensupport.DecodeResponse(target, res); err != nil {
  6704. return nil, err
  6705. }
  6706. return ret, nil
  6707. // {
  6708. // "description": "Lists all the `Policies` set for a particular resource.",
  6709. // "flatPath": "v1/projects/{projectsId}:listOrgPolicies",
  6710. // "httpMethod": "POST",
  6711. // "id": "cloudresourcemanager.projects.listOrgPolicies",
  6712. // "parameterOrder": [
  6713. // "resource"
  6714. // ],
  6715. // "parameters": {
  6716. // "resource": {
  6717. // "description": "Name of the resource to list Policies for.",
  6718. // "location": "path",
  6719. // "pattern": "^projects/[^/]+$",
  6720. // "required": true,
  6721. // "type": "string"
  6722. // }
  6723. // },
  6724. // "path": "v1/{+resource}:listOrgPolicies",
  6725. // "request": {
  6726. // "$ref": "ListOrgPoliciesRequest"
  6727. // },
  6728. // "response": {
  6729. // "$ref": "ListOrgPoliciesResponse"
  6730. // },
  6731. // "scopes": [
  6732. // "https://www.googleapis.com/auth/cloud-platform",
  6733. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6734. // ]
  6735. // }
  6736. }
  6737. // Pages invokes f for each page of results.
  6738. // A non-nil error returned from f will halt the iteration.
  6739. // The provided context supersedes any context provided to the Context method.
  6740. func (c *ProjectsListOrgPoliciesCall) Pages(ctx context.Context, f func(*ListOrgPoliciesResponse) error) error {
  6741. c.ctx_ = ctx
  6742. defer func(pt string) { c.listorgpoliciesrequest.PageToken = pt }(c.listorgpoliciesrequest.PageToken) // reset paging to original point
  6743. for {
  6744. x, err := c.Do()
  6745. if err != nil {
  6746. return err
  6747. }
  6748. if err := f(x); err != nil {
  6749. return err
  6750. }
  6751. if x.NextPageToken == "" {
  6752. return nil
  6753. }
  6754. c.listorgpoliciesrequest.PageToken = x.NextPageToken
  6755. }
  6756. }
  6757. // method id "cloudresourcemanager.projects.setIamPolicy":
  6758. type ProjectsSetIamPolicyCall struct {
  6759. s *Service
  6760. resource string
  6761. setiampolicyrequest *SetIamPolicyRequest
  6762. urlParams_ gensupport.URLParams
  6763. ctx_ context.Context
  6764. header_ http.Header
  6765. }
  6766. // SetIamPolicy: Sets the IAM access control policy for the specified
  6767. // Project. Overwrites
  6768. // any existing policy.
  6769. //
  6770. // The following constraints apply when using `setIamPolicy()`:
  6771. //
  6772. // + Project does not support `allUsers` and `allAuthenticatedUsers`
  6773. // as
  6774. // `members` in a `Binding` of a `Policy`.
  6775. //
  6776. // + The owner role can be granted only to `user` and
  6777. // `serviceAccount`.
  6778. //
  6779. // + Service accounts can be made owners of a project directly
  6780. // without any restrictions. However, to be added as an owner, a user
  6781. // must be
  6782. // invited via Cloud Platform console and must accept the invitation.
  6783. //
  6784. // + A user cannot be granted the owner role using `setIamPolicy()`. The
  6785. // user
  6786. // must be granted the owner role using the Cloud Platform Console and
  6787. // must
  6788. // explicitly accept the invitation.
  6789. //
  6790. // + You can only grant ownership of a project to a member by using
  6791. // the
  6792. // GCP Console. Inviting a member will deliver an invitation email
  6793. // that
  6794. // they must accept. An invitation email is not generated if you
  6795. // are
  6796. // granting a role other than owner, or if both the member you are
  6797. // inviting
  6798. // and the project are part of your organization.
  6799. //
  6800. // + Membership changes that leave the project without any owners that
  6801. // have
  6802. // accepted the Terms of Service (ToS) will be rejected.
  6803. //
  6804. // + If the project is not part of an organization, there must be at
  6805. // least
  6806. // one owner who has accepted the Terms of Service (ToS) agreement in
  6807. // the
  6808. // policy. Calling `setIamPolicy()` to remove the last ToS-accepted
  6809. // owner
  6810. // from the policy will fail. This restriction also applies to
  6811. // legacy
  6812. // projects that no longer have owners who have accepted the ToS. Edits
  6813. // to
  6814. // IAM policies will be rejected until the lack of a ToS-accepting owner
  6815. // is
  6816. // rectified.
  6817. //
  6818. // + This method will replace the existing policy, and cannot be used
  6819. // to
  6820. // append additional IAM settings.
  6821. //
  6822. // Note: Removing service accounts from policies or changing their
  6823. // roles
  6824. // can render services completely inoperable. It is important to
  6825. // understand
  6826. // how the service account is being used before removing or updating
  6827. // its
  6828. // roles.
  6829. //
  6830. // Authorization requires the Google IAM
  6831. // permission
  6832. // `resourcemanager.projects.setIamPolicy` on the project
  6833. func (r *ProjectsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSetIamPolicyCall {
  6834. c := &ProjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6835. c.resource = resource
  6836. c.setiampolicyrequest = setiampolicyrequest
  6837. return c
  6838. }
  6839. // Fields allows partial responses to be retrieved. See
  6840. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6841. // for more information.
  6842. func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall {
  6843. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6844. return c
  6845. }
  6846. // Context sets the context to be used in this call's Do method. Any
  6847. // pending HTTP request will be aborted if the provided context is
  6848. // canceled.
  6849. func (c *ProjectsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSetIamPolicyCall {
  6850. c.ctx_ = ctx
  6851. return c
  6852. }
  6853. // Header returns an http.Header that can be modified by the caller to
  6854. // add HTTP headers to the request.
  6855. func (c *ProjectsSetIamPolicyCall) Header() http.Header {
  6856. if c.header_ == nil {
  6857. c.header_ = make(http.Header)
  6858. }
  6859. return c.header_
  6860. }
  6861. func (c *ProjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  6862. reqHeaders := make(http.Header)
  6863. for k, v := range c.header_ {
  6864. reqHeaders[k] = v
  6865. }
  6866. reqHeaders.Set("User-Agent", c.s.userAgent())
  6867. var body io.Reader = nil
  6868. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  6869. if err != nil {
  6870. return nil, err
  6871. }
  6872. reqHeaders.Set("Content-Type", "application/json")
  6873. c.urlParams_.Set("alt", alt)
  6874. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{resource}:setIamPolicy")
  6875. urls += "?" + c.urlParams_.Encode()
  6876. req, _ := http.NewRequest("POST", urls, body)
  6877. req.Header = reqHeaders
  6878. googleapi.Expand(req.URL, map[string]string{
  6879. "resource": c.resource,
  6880. })
  6881. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6882. }
  6883. // Do executes the "cloudresourcemanager.projects.setIamPolicy" call.
  6884. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  6885. // code is an error. Response headers are in either
  6886. // *Policy.ServerResponse.Header or (if a response was returned at all)
  6887. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6888. // check whether the returned error was because http.StatusNotModified
  6889. // was returned.
  6890. func (c *ProjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  6891. gensupport.SetOptions(c.urlParams_, opts...)
  6892. res, err := c.doRequest("json")
  6893. if res != nil && res.StatusCode == http.StatusNotModified {
  6894. if res.Body != nil {
  6895. res.Body.Close()
  6896. }
  6897. return nil, &googleapi.Error{
  6898. Code: res.StatusCode,
  6899. Header: res.Header,
  6900. }
  6901. }
  6902. if err != nil {
  6903. return nil, err
  6904. }
  6905. defer googleapi.CloseBody(res)
  6906. if err := googleapi.CheckResponse(res); err != nil {
  6907. return nil, err
  6908. }
  6909. ret := &Policy{
  6910. ServerResponse: googleapi.ServerResponse{
  6911. Header: res.Header,
  6912. HTTPStatusCode: res.StatusCode,
  6913. },
  6914. }
  6915. target := &ret
  6916. if err := gensupport.DecodeResponse(target, res); err != nil {
  6917. return nil, err
  6918. }
  6919. return ret, nil
  6920. // {
  6921. // "description": "Sets the IAM access control policy for the specified Project. Overwrites\nany existing policy.\n\nThe following constraints apply when using `setIamPolicy()`:\n\n+ Project does not support `allUsers` and `allAuthenticatedUsers` as\n`members` in a `Binding` of a `Policy`.\n\n+ The owner role can be granted only to `user` and `serviceAccount`.\n\n+ Service accounts can be made owners of a project directly\nwithout any restrictions. However, to be added as an owner, a user must be\ninvited via Cloud Platform console and must accept the invitation.\n\n+ A user cannot be granted the owner role using `setIamPolicy()`. The user\nmust be granted the owner role using the Cloud Platform Console and must\nexplicitly accept the invitation.\n\n+ You can only grant ownership of a project to a member by using the\nGCP Console. Inviting a member will deliver an invitation email that\nthey must accept. An invitation email is not generated if you are\ngranting a role other than owner, or if both the member you are inviting\nand the project are part of your organization.\n\n+ Membership changes that leave the project without any owners that have\naccepted the Terms of Service (ToS) will be rejected.\n\n+ If the project is not part of an organization, there must be at least\none owner who has accepted the Terms of Service (ToS) agreement in the\npolicy. Calling `setIamPolicy()` to remove the last ToS-accepted owner\nfrom the policy will fail. This restriction also applies to legacy\nprojects that no longer have owners who have accepted the ToS. Edits to\nIAM policies will be rejected until the lack of a ToS-accepting owner is\nrectified.\n\n+ This method will replace the existing policy, and cannot be used to\nappend additional IAM settings.\n\nNote: Removing service accounts from policies or changing their roles\ncan render services completely inoperable. It is important to understand\nhow the service account is being used before removing or updating its\nroles.\n\nAuthorization requires the Google IAM permission\n`resourcemanager.projects.setIamPolicy` on the project",
  6922. // "flatPath": "v1/projects/{resource}:setIamPolicy",
  6923. // "httpMethod": "POST",
  6924. // "id": "cloudresourcemanager.projects.setIamPolicy",
  6925. // "parameterOrder": [
  6926. // "resource"
  6927. // ],
  6928. // "parameters": {
  6929. // "resource": {
  6930. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  6931. // "location": "path",
  6932. // "required": true,
  6933. // "type": "string"
  6934. // }
  6935. // },
  6936. // "path": "v1/projects/{resource}:setIamPolicy",
  6937. // "request": {
  6938. // "$ref": "SetIamPolicyRequest"
  6939. // },
  6940. // "response": {
  6941. // "$ref": "Policy"
  6942. // },
  6943. // "scopes": [
  6944. // "https://www.googleapis.com/auth/cloud-platform"
  6945. // ]
  6946. // }
  6947. }
  6948. // method id "cloudresourcemanager.projects.setOrgPolicy":
  6949. type ProjectsSetOrgPolicyCall struct {
  6950. s *Service
  6951. resource string
  6952. setorgpolicyrequest *SetOrgPolicyRequest
  6953. urlParams_ gensupport.URLParams
  6954. ctx_ context.Context
  6955. header_ http.Header
  6956. }
  6957. // SetOrgPolicy: Updates the specified `Policy` on the resource. Creates
  6958. // a new `Policy` for
  6959. // that `Constraint` on the resource if one does not exist.
  6960. //
  6961. // Not supplying an `etag` on the request `Policy` results in an
  6962. // unconditional
  6963. // write of the `Policy`.
  6964. func (r *ProjectsService) SetOrgPolicy(resource string, setorgpolicyrequest *SetOrgPolicyRequest) *ProjectsSetOrgPolicyCall {
  6965. c := &ProjectsSetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6966. c.resource = resource
  6967. c.setorgpolicyrequest = setorgpolicyrequest
  6968. return c
  6969. }
  6970. // Fields allows partial responses to be retrieved. See
  6971. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6972. // for more information.
  6973. func (c *ProjectsSetOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetOrgPolicyCall {
  6974. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6975. return c
  6976. }
  6977. // Context sets the context to be used in this call's Do method. Any
  6978. // pending HTTP request will be aborted if the provided context is
  6979. // canceled.
  6980. func (c *ProjectsSetOrgPolicyCall) Context(ctx context.Context) *ProjectsSetOrgPolicyCall {
  6981. c.ctx_ = ctx
  6982. return c
  6983. }
  6984. // Header returns an http.Header that can be modified by the caller to
  6985. // add HTTP headers to the request.
  6986. func (c *ProjectsSetOrgPolicyCall) Header() http.Header {
  6987. if c.header_ == nil {
  6988. c.header_ = make(http.Header)
  6989. }
  6990. return c.header_
  6991. }
  6992. func (c *ProjectsSetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  6993. reqHeaders := make(http.Header)
  6994. for k, v := range c.header_ {
  6995. reqHeaders[k] = v
  6996. }
  6997. reqHeaders.Set("User-Agent", c.s.userAgent())
  6998. var body io.Reader = nil
  6999. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setorgpolicyrequest)
  7000. if err != nil {
  7001. return nil, err
  7002. }
  7003. reqHeaders.Set("Content-Type", "application/json")
  7004. c.urlParams_.Set("alt", alt)
  7005. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setOrgPolicy")
  7006. urls += "?" + c.urlParams_.Encode()
  7007. req, _ := http.NewRequest("POST", urls, body)
  7008. req.Header = reqHeaders
  7009. googleapi.Expand(req.URL, map[string]string{
  7010. "resource": c.resource,
  7011. })
  7012. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7013. }
  7014. // Do executes the "cloudresourcemanager.projects.setOrgPolicy" call.
  7015. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  7016. // status code is an error. Response headers are in either
  7017. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  7018. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7019. // to check whether the returned error was because
  7020. // http.StatusNotModified was returned.
  7021. func (c *ProjectsSetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  7022. gensupport.SetOptions(c.urlParams_, opts...)
  7023. res, err := c.doRequest("json")
  7024. if res != nil && res.StatusCode == http.StatusNotModified {
  7025. if res.Body != nil {
  7026. res.Body.Close()
  7027. }
  7028. return nil, &googleapi.Error{
  7029. Code: res.StatusCode,
  7030. Header: res.Header,
  7031. }
  7032. }
  7033. if err != nil {
  7034. return nil, err
  7035. }
  7036. defer googleapi.CloseBody(res)
  7037. if err := googleapi.CheckResponse(res); err != nil {
  7038. return nil, err
  7039. }
  7040. ret := &OrgPolicy{
  7041. ServerResponse: googleapi.ServerResponse{
  7042. Header: res.Header,
  7043. HTTPStatusCode: res.StatusCode,
  7044. },
  7045. }
  7046. target := &ret
  7047. if err := gensupport.DecodeResponse(target, res); err != nil {
  7048. return nil, err
  7049. }
  7050. return ret, nil
  7051. // {
  7052. // "description": "Updates the specified `Policy` on the resource. Creates a new `Policy` for\nthat `Constraint` on the resource if one does not exist.\n\nNot supplying an `etag` on the request `Policy` results in an unconditional\nwrite of the `Policy`.",
  7053. // "flatPath": "v1/projects/{projectsId}:setOrgPolicy",
  7054. // "httpMethod": "POST",
  7055. // "id": "cloudresourcemanager.projects.setOrgPolicy",
  7056. // "parameterOrder": [
  7057. // "resource"
  7058. // ],
  7059. // "parameters": {
  7060. // "resource": {
  7061. // "description": "Resource name of the resource to attach the `Policy`.",
  7062. // "location": "path",
  7063. // "pattern": "^projects/[^/]+$",
  7064. // "required": true,
  7065. // "type": "string"
  7066. // }
  7067. // },
  7068. // "path": "v1/{+resource}:setOrgPolicy",
  7069. // "request": {
  7070. // "$ref": "SetOrgPolicyRequest"
  7071. // },
  7072. // "response": {
  7073. // "$ref": "OrgPolicy"
  7074. // },
  7075. // "scopes": [
  7076. // "https://www.googleapis.com/auth/cloud-platform"
  7077. // ]
  7078. // }
  7079. }
  7080. // method id "cloudresourcemanager.projects.testIamPermissions":
  7081. type ProjectsTestIamPermissionsCall struct {
  7082. s *Service
  7083. resource string
  7084. testiampermissionsrequest *TestIamPermissionsRequest
  7085. urlParams_ gensupport.URLParams
  7086. ctx_ context.Context
  7087. header_ http.Header
  7088. }
  7089. // TestIamPermissions: Returns permissions that a caller has on the
  7090. // specified Project.
  7091. //
  7092. // There are no permissions required for making this API call.
  7093. func (r *ProjectsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTestIamPermissionsCall {
  7094. c := &ProjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7095. c.resource = resource
  7096. c.testiampermissionsrequest = testiampermissionsrequest
  7097. return c
  7098. }
  7099. // Fields allows partial responses to be retrieved. See
  7100. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7101. // for more information.
  7102. func (c *ProjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTestIamPermissionsCall {
  7103. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7104. return c
  7105. }
  7106. // Context sets the context to be used in this call's Do method. Any
  7107. // pending HTTP request will be aborted if the provided context is
  7108. // canceled.
  7109. func (c *ProjectsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTestIamPermissionsCall {
  7110. c.ctx_ = ctx
  7111. return c
  7112. }
  7113. // Header returns an http.Header that can be modified by the caller to
  7114. // add HTTP headers to the request.
  7115. func (c *ProjectsTestIamPermissionsCall) Header() http.Header {
  7116. if c.header_ == nil {
  7117. c.header_ = make(http.Header)
  7118. }
  7119. return c.header_
  7120. }
  7121. func (c *ProjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  7122. reqHeaders := make(http.Header)
  7123. for k, v := range c.header_ {
  7124. reqHeaders[k] = v
  7125. }
  7126. reqHeaders.Set("User-Agent", c.s.userAgent())
  7127. var body io.Reader = nil
  7128. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  7129. if err != nil {
  7130. return nil, err
  7131. }
  7132. reqHeaders.Set("Content-Type", "application/json")
  7133. c.urlParams_.Set("alt", alt)
  7134. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{resource}:testIamPermissions")
  7135. urls += "?" + c.urlParams_.Encode()
  7136. req, _ := http.NewRequest("POST", urls, body)
  7137. req.Header = reqHeaders
  7138. googleapi.Expand(req.URL, map[string]string{
  7139. "resource": c.resource,
  7140. })
  7141. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7142. }
  7143. // Do executes the "cloudresourcemanager.projects.testIamPermissions" call.
  7144. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  7145. // Any non-2xx status code is an error. Response headers are in either
  7146. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  7147. // was returned at all) in error.(*googleapi.Error).Header. Use
  7148. // googleapi.IsNotModified to check whether the returned error was
  7149. // because http.StatusNotModified was returned.
  7150. func (c *ProjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  7151. gensupport.SetOptions(c.urlParams_, opts...)
  7152. res, err := c.doRequest("json")
  7153. if res != nil && res.StatusCode == http.StatusNotModified {
  7154. if res.Body != nil {
  7155. res.Body.Close()
  7156. }
  7157. return nil, &googleapi.Error{
  7158. Code: res.StatusCode,
  7159. Header: res.Header,
  7160. }
  7161. }
  7162. if err != nil {
  7163. return nil, err
  7164. }
  7165. defer googleapi.CloseBody(res)
  7166. if err := googleapi.CheckResponse(res); err != nil {
  7167. return nil, err
  7168. }
  7169. ret := &TestIamPermissionsResponse{
  7170. ServerResponse: googleapi.ServerResponse{
  7171. Header: res.Header,
  7172. HTTPStatusCode: res.StatusCode,
  7173. },
  7174. }
  7175. target := &ret
  7176. if err := gensupport.DecodeResponse(target, res); err != nil {
  7177. return nil, err
  7178. }
  7179. return ret, nil
  7180. // {
  7181. // "description": "Returns permissions that a caller has on the specified Project.\n\nThere are no permissions required for making this API call.",
  7182. // "flatPath": "v1/projects/{resource}:testIamPermissions",
  7183. // "httpMethod": "POST",
  7184. // "id": "cloudresourcemanager.projects.testIamPermissions",
  7185. // "parameterOrder": [
  7186. // "resource"
  7187. // ],
  7188. // "parameters": {
  7189. // "resource": {
  7190. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  7191. // "location": "path",
  7192. // "required": true,
  7193. // "type": "string"
  7194. // }
  7195. // },
  7196. // "path": "v1/projects/{resource}:testIamPermissions",
  7197. // "request": {
  7198. // "$ref": "TestIamPermissionsRequest"
  7199. // },
  7200. // "response": {
  7201. // "$ref": "TestIamPermissionsResponse"
  7202. // },
  7203. // "scopes": [
  7204. // "https://www.googleapis.com/auth/cloud-platform",
  7205. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  7206. // ]
  7207. // }
  7208. }
  7209. // method id "cloudresourcemanager.projects.undelete":
  7210. type ProjectsUndeleteCall struct {
  7211. s *Service
  7212. projectId string
  7213. undeleteprojectrequest *UndeleteProjectRequest
  7214. urlParams_ gensupport.URLParams
  7215. ctx_ context.Context
  7216. header_ http.Header
  7217. }
  7218. // Undelete: Restores the Project identified by the
  7219. // specified
  7220. // `project_id` (for example, `my-project-123`).
  7221. // You can only use this method for a Project that has a lifecycle state
  7222. // of
  7223. // DELETE_REQUESTED.
  7224. // After deletion starts, the Project cannot be restored.
  7225. //
  7226. // The caller must have modify permissions for this Project.
  7227. func (r *ProjectsService) Undelete(projectId string, undeleteprojectrequest *UndeleteProjectRequest) *ProjectsUndeleteCall {
  7228. c := &ProjectsUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7229. c.projectId = projectId
  7230. c.undeleteprojectrequest = undeleteprojectrequest
  7231. return c
  7232. }
  7233. // Fields allows partial responses to be retrieved. See
  7234. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7235. // for more information.
  7236. func (c *ProjectsUndeleteCall) Fields(s ...googleapi.Field) *ProjectsUndeleteCall {
  7237. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7238. return c
  7239. }
  7240. // Context sets the context to be used in this call's Do method. Any
  7241. // pending HTTP request will be aborted if the provided context is
  7242. // canceled.
  7243. func (c *ProjectsUndeleteCall) Context(ctx context.Context) *ProjectsUndeleteCall {
  7244. c.ctx_ = ctx
  7245. return c
  7246. }
  7247. // Header returns an http.Header that can be modified by the caller to
  7248. // add HTTP headers to the request.
  7249. func (c *ProjectsUndeleteCall) Header() http.Header {
  7250. if c.header_ == nil {
  7251. c.header_ = make(http.Header)
  7252. }
  7253. return c.header_
  7254. }
  7255. func (c *ProjectsUndeleteCall) doRequest(alt string) (*http.Response, error) {
  7256. reqHeaders := make(http.Header)
  7257. for k, v := range c.header_ {
  7258. reqHeaders[k] = v
  7259. }
  7260. reqHeaders.Set("User-Agent", c.s.userAgent())
  7261. var body io.Reader = nil
  7262. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleteprojectrequest)
  7263. if err != nil {
  7264. return nil, err
  7265. }
  7266. reqHeaders.Set("Content-Type", "application/json")
  7267. c.urlParams_.Set("alt", alt)
  7268. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}:undelete")
  7269. urls += "?" + c.urlParams_.Encode()
  7270. req, _ := http.NewRequest("POST", urls, body)
  7271. req.Header = reqHeaders
  7272. googleapi.Expand(req.URL, map[string]string{
  7273. "projectId": c.projectId,
  7274. })
  7275. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7276. }
  7277. // Do executes the "cloudresourcemanager.projects.undelete" call.
  7278. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7279. // code is an error. Response headers are in either
  7280. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7281. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7282. // check whether the returned error was because http.StatusNotModified
  7283. // was returned.
  7284. func (c *ProjectsUndeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7285. gensupport.SetOptions(c.urlParams_, opts...)
  7286. res, err := c.doRequest("json")
  7287. if res != nil && res.StatusCode == http.StatusNotModified {
  7288. if res.Body != nil {
  7289. res.Body.Close()
  7290. }
  7291. return nil, &googleapi.Error{
  7292. Code: res.StatusCode,
  7293. Header: res.Header,
  7294. }
  7295. }
  7296. if err != nil {
  7297. return nil, err
  7298. }
  7299. defer googleapi.CloseBody(res)
  7300. if err := googleapi.CheckResponse(res); err != nil {
  7301. return nil, err
  7302. }
  7303. ret := &Empty{
  7304. ServerResponse: googleapi.ServerResponse{
  7305. Header: res.Header,
  7306. HTTPStatusCode: res.StatusCode,
  7307. },
  7308. }
  7309. target := &ret
  7310. if err := gensupport.DecodeResponse(target, res); err != nil {
  7311. return nil, err
  7312. }
  7313. return ret, nil
  7314. // {
  7315. // "description": "Restores the Project identified by the specified\n`project_id` (for example, `my-project-123`).\nYou can only use this method for a Project that has a lifecycle state of\nDELETE_REQUESTED.\nAfter deletion starts, the Project cannot be restored.\n\nThe caller must have modify permissions for this Project.",
  7316. // "flatPath": "v1/projects/{projectId}:undelete",
  7317. // "httpMethod": "POST",
  7318. // "id": "cloudresourcemanager.projects.undelete",
  7319. // "parameterOrder": [
  7320. // "projectId"
  7321. // ],
  7322. // "parameters": {
  7323. // "projectId": {
  7324. // "description": "The project ID (for example, `foo-bar-123`).\n\nRequired.",
  7325. // "location": "path",
  7326. // "required": true,
  7327. // "type": "string"
  7328. // }
  7329. // },
  7330. // "path": "v1/projects/{projectId}:undelete",
  7331. // "request": {
  7332. // "$ref": "UndeleteProjectRequest"
  7333. // },
  7334. // "response": {
  7335. // "$ref": "Empty"
  7336. // },
  7337. // "scopes": [
  7338. // "https://www.googleapis.com/auth/cloud-platform"
  7339. // ]
  7340. // }
  7341. }
  7342. // method id "cloudresourcemanager.projects.update":
  7343. type ProjectsUpdateCall struct {
  7344. s *Service
  7345. projectId string
  7346. project *Project
  7347. urlParams_ gensupport.URLParams
  7348. ctx_ context.Context
  7349. header_ http.Header
  7350. }
  7351. // Update: Updates the attributes of the Project identified by the
  7352. // specified
  7353. // `project_id` (for example, `my-project-123`).
  7354. //
  7355. // The caller must have modify permissions for this Project.
  7356. func (r *ProjectsService) Update(projectId string, project *Project) *ProjectsUpdateCall {
  7357. c := &ProjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7358. c.projectId = projectId
  7359. c.project = project
  7360. return c
  7361. }
  7362. // Fields allows partial responses to be retrieved. See
  7363. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7364. // for more information.
  7365. func (c *ProjectsUpdateCall) Fields(s ...googleapi.Field) *ProjectsUpdateCall {
  7366. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7367. return c
  7368. }
  7369. // Context sets the context to be used in this call's Do method. Any
  7370. // pending HTTP request will be aborted if the provided context is
  7371. // canceled.
  7372. func (c *ProjectsUpdateCall) Context(ctx context.Context) *ProjectsUpdateCall {
  7373. c.ctx_ = ctx
  7374. return c
  7375. }
  7376. // Header returns an http.Header that can be modified by the caller to
  7377. // add HTTP headers to the request.
  7378. func (c *ProjectsUpdateCall) Header() http.Header {
  7379. if c.header_ == nil {
  7380. c.header_ = make(http.Header)
  7381. }
  7382. return c.header_
  7383. }
  7384. func (c *ProjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  7385. reqHeaders := make(http.Header)
  7386. for k, v := range c.header_ {
  7387. reqHeaders[k] = v
  7388. }
  7389. reqHeaders.Set("User-Agent", c.s.userAgent())
  7390. var body io.Reader = nil
  7391. body, err := googleapi.WithoutDataWrapper.JSONReader(c.project)
  7392. if err != nil {
  7393. return nil, err
  7394. }
  7395. reqHeaders.Set("Content-Type", "application/json")
  7396. c.urlParams_.Set("alt", alt)
  7397. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}")
  7398. urls += "?" + c.urlParams_.Encode()
  7399. req, _ := http.NewRequest("PUT", urls, body)
  7400. req.Header = reqHeaders
  7401. googleapi.Expand(req.URL, map[string]string{
  7402. "projectId": c.projectId,
  7403. })
  7404. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7405. }
  7406. // Do executes the "cloudresourcemanager.projects.update" call.
  7407. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  7408. // code is an error. Response headers are in either
  7409. // *Project.ServerResponse.Header or (if a response was returned at all)
  7410. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7411. // check whether the returned error was because http.StatusNotModified
  7412. // was returned.
  7413. func (c *ProjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  7414. gensupport.SetOptions(c.urlParams_, opts...)
  7415. res, err := c.doRequest("json")
  7416. if res != nil && res.StatusCode == http.StatusNotModified {
  7417. if res.Body != nil {
  7418. res.Body.Close()
  7419. }
  7420. return nil, &googleapi.Error{
  7421. Code: res.StatusCode,
  7422. Header: res.Header,
  7423. }
  7424. }
  7425. if err != nil {
  7426. return nil, err
  7427. }
  7428. defer googleapi.CloseBody(res)
  7429. if err := googleapi.CheckResponse(res); err != nil {
  7430. return nil, err
  7431. }
  7432. ret := &Project{
  7433. ServerResponse: googleapi.ServerResponse{
  7434. Header: res.Header,
  7435. HTTPStatusCode: res.StatusCode,
  7436. },
  7437. }
  7438. target := &ret
  7439. if err := gensupport.DecodeResponse(target, res); err != nil {
  7440. return nil, err
  7441. }
  7442. return ret, nil
  7443. // {
  7444. // "description": "Updates the attributes of the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have modify permissions for this Project.",
  7445. // "flatPath": "v1/projects/{projectId}",
  7446. // "httpMethod": "PUT",
  7447. // "id": "cloudresourcemanager.projects.update",
  7448. // "parameterOrder": [
  7449. // "projectId"
  7450. // ],
  7451. // "parameters": {
  7452. // "projectId": {
  7453. // "description": "The project ID (for example, `my-project-123`).\n\nRequired.",
  7454. // "location": "path",
  7455. // "required": true,
  7456. // "type": "string"
  7457. // }
  7458. // },
  7459. // "path": "v1/projects/{projectId}",
  7460. // "request": {
  7461. // "$ref": "Project"
  7462. // },
  7463. // "response": {
  7464. // "$ref": "Project"
  7465. // },
  7466. // "scopes": [
  7467. // "https://www.googleapis.com/auth/cloud-platform"
  7468. // ]
  7469. // }
  7470. }