25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3647 lines
128 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/v1beta1"
  8. // ...
  9. // cloudresourcemanagerService, err := cloudresourcemanager.New(oauthHttpClient)
  10. package cloudresourcemanager // import "google.golang.org/api/cloudresourcemanager/v1beta1"
  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:v1beta1"
  41. const apiName = "cloudresourcemanager"
  42. const apiVersion = "v1beta1"
  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.Organizations = NewOrganizationsService(s)
  57. s.Projects = NewProjectsService(s)
  58. return s, nil
  59. }
  60. type Service struct {
  61. client *http.Client
  62. BasePath string // API endpoint base URL
  63. UserAgent string // optional additional User-Agent fragment
  64. Organizations *OrganizationsService
  65. Projects *ProjectsService
  66. }
  67. func (s *Service) userAgent() string {
  68. if s.UserAgent == "" {
  69. return googleapi.UserAgent
  70. }
  71. return googleapi.UserAgent + " " + s.UserAgent
  72. }
  73. func NewOrganizationsService(s *Service) *OrganizationsService {
  74. rs := &OrganizationsService{s: s}
  75. return rs
  76. }
  77. type OrganizationsService struct {
  78. s *Service
  79. }
  80. func NewProjectsService(s *Service) *ProjectsService {
  81. rs := &ProjectsService{s: s}
  82. return rs
  83. }
  84. type ProjectsService struct {
  85. s *Service
  86. }
  87. // Ancestor: Identifying information for a single ancestor of a project.
  88. type Ancestor struct {
  89. // ResourceId: Resource id of the ancestor.
  90. ResourceId *ResourceId `json:"resourceId,omitempty"`
  91. // ForceSendFields is a list of field names (e.g. "ResourceId") to
  92. // unconditionally include in API requests. By default, fields with
  93. // empty values are omitted from API requests. However, any non-pointer,
  94. // non-interface field appearing in ForceSendFields will be sent to the
  95. // server regardless of whether the field is empty or not. This may be
  96. // used to include empty fields in Patch requests.
  97. ForceSendFields []string `json:"-"`
  98. // NullFields is a list of field names (e.g. "ResourceId") to include in
  99. // API requests with the JSON null value. By default, fields with empty
  100. // values are omitted from API requests. However, any field with an
  101. // empty value appearing in NullFields will be sent to the server as
  102. // null. It is an error if a field in this list has a non-empty value.
  103. // This may be used to include null fields in Patch requests.
  104. NullFields []string `json:"-"`
  105. }
  106. func (s *Ancestor) MarshalJSON() ([]byte, error) {
  107. type NoMethod Ancestor
  108. raw := NoMethod(*s)
  109. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  110. }
  111. // AuditConfig: Specifies the audit configuration for a service.
  112. // The configuration determines which permission types are logged, and
  113. // what
  114. // identities, if any, are exempted from logging.
  115. // An AuditConfig must have one or more AuditLogConfigs.
  116. //
  117. // If there are AuditConfigs for both `allServices` and a specific
  118. // service,
  119. // the union of the two AuditConfigs is used for that service: the
  120. // log_types
  121. // specified in each AuditConfig are enabled, and the exempted_members
  122. // in each
  123. // AuditLogConfig are exempted.
  124. //
  125. // Example Policy with multiple AuditConfigs:
  126. //
  127. // {
  128. // "audit_configs": [
  129. // {
  130. // "service": "allServices"
  131. // "audit_log_configs": [
  132. // {
  133. // "log_type": "DATA_READ",
  134. // "exempted_members": [
  135. // "user:foo@gmail.com"
  136. // ]
  137. // },
  138. // {
  139. // "log_type": "DATA_WRITE",
  140. // },
  141. // {
  142. // "log_type": "ADMIN_READ",
  143. // }
  144. // ]
  145. // },
  146. // {
  147. // "service": "fooservice.googleapis.com"
  148. // "audit_log_configs": [
  149. // {
  150. // "log_type": "DATA_READ",
  151. // },
  152. // {
  153. // "log_type": "DATA_WRITE",
  154. // "exempted_members": [
  155. // "user:bar@gmail.com"
  156. // ]
  157. // }
  158. // ]
  159. // }
  160. // ]
  161. // }
  162. //
  163. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  164. // ADMIN_READ
  165. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  166. // and
  167. // bar@gmail.com from DATA_WRITE logging.
  168. type AuditConfig struct {
  169. // AuditLogConfigs: The configuration for logging of each type of
  170. // permission.
  171. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  172. // Service: Specifies a service that will be enabled for audit
  173. // logging.
  174. // For example, `storage.googleapis.com`,
  175. // `cloudsql.googleapis.com`.
  176. // `allServices` is a special value that covers all services.
  177. Service string `json:"service,omitempty"`
  178. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  179. // unconditionally include in API requests. By default, fields with
  180. // empty values are omitted from API requests. However, any non-pointer,
  181. // non-interface field appearing in ForceSendFields will be sent to the
  182. // server regardless of whether the field is empty or not. This may be
  183. // used to include empty fields in Patch requests.
  184. ForceSendFields []string `json:"-"`
  185. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  186. // include in API requests with the JSON null value. By default, fields
  187. // with empty values are omitted from API requests. However, any field
  188. // with an empty value appearing in NullFields will be sent to the
  189. // server as null. It is an error if a field in this list has a
  190. // non-empty value. This may be used to include null fields in Patch
  191. // requests.
  192. NullFields []string `json:"-"`
  193. }
  194. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  195. type NoMethod AuditConfig
  196. raw := NoMethod(*s)
  197. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  198. }
  199. // AuditLogConfig: Provides the configuration for logging a type of
  200. // permissions.
  201. // Example:
  202. //
  203. // {
  204. // "audit_log_configs": [
  205. // {
  206. // "log_type": "DATA_READ",
  207. // "exempted_members": [
  208. // "user:foo@gmail.com"
  209. // ]
  210. // },
  211. // {
  212. // "log_type": "DATA_WRITE",
  213. // }
  214. // ]
  215. // }
  216. //
  217. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  218. // exempting
  219. // foo@gmail.com from DATA_READ logging.
  220. type AuditLogConfig struct {
  221. // ExemptedMembers: Specifies the identities that do not cause logging
  222. // for this type of
  223. // permission.
  224. // Follows the same format of Binding.members.
  225. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  226. // LogType: The log type that this config enables.
  227. //
  228. // Possible values:
  229. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  230. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  231. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  232. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  233. LogType string `json:"logType,omitempty"`
  234. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  235. // unconditionally include in API requests. By default, fields with
  236. // empty values are omitted from API requests. However, any non-pointer,
  237. // non-interface field appearing in ForceSendFields will be sent to the
  238. // server regardless of whether the field is empty or not. This may be
  239. // used to include empty fields in Patch requests.
  240. ForceSendFields []string `json:"-"`
  241. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  242. // include in API requests with the JSON null value. By default, fields
  243. // with empty values are omitted from API requests. However, any field
  244. // with an empty value appearing in NullFields will be sent to the
  245. // server as null. It is an error if a field in this list has a
  246. // non-empty value. This may be used to include null fields in Patch
  247. // requests.
  248. NullFields []string `json:"-"`
  249. }
  250. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  251. type NoMethod AuditLogConfig
  252. raw := NoMethod(*s)
  253. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  254. }
  255. // Binding: Associates `members` with a `role`.
  256. type Binding struct {
  257. // Members: Specifies the identities requesting access for a Cloud
  258. // Platform resource.
  259. // `members` can have the following values:
  260. //
  261. // * `allUsers`: A special identifier that represents anyone who is
  262. // on the internet; with or without a Google account.
  263. //
  264. // * `allAuthenticatedUsers`: A special identifier that represents
  265. // anyone
  266. // who is authenticated with a Google account or a service
  267. // account.
  268. //
  269. // * `user:{emailid}`: An email address that represents a specific
  270. // Google
  271. // account. For example, `alice@gmail.com` .
  272. //
  273. //
  274. // * `serviceAccount:{emailid}`: An email address that represents a
  275. // service
  276. // account. For example,
  277. // `my-other-app@appspot.gserviceaccount.com`.
  278. //
  279. // * `group:{emailid}`: An email address that represents a Google
  280. // group.
  281. // For example, `admins@example.com`.
  282. //
  283. //
  284. // * `domain:{domain}`: A Google Apps domain name that represents all
  285. // the
  286. // users of that domain. For example, `google.com` or
  287. // `example.com`.
  288. //
  289. //
  290. Members []string `json:"members,omitempty"`
  291. // Role: Role that is assigned to `members`.
  292. // For example, `roles/viewer`, `roles/editor`, or
  293. // `roles/owner`.
  294. // Required
  295. Role string `json:"role,omitempty"`
  296. // ForceSendFields is a list of field names (e.g. "Members") to
  297. // unconditionally include in API requests. By default, fields with
  298. // empty values are omitted from API requests. However, any non-pointer,
  299. // non-interface field appearing in ForceSendFields will be sent to the
  300. // server regardless of whether the field is empty or not. This may be
  301. // used to include empty fields in Patch requests.
  302. ForceSendFields []string `json:"-"`
  303. // NullFields is a list of field names (e.g. "Members") to include in
  304. // API requests with the JSON null value. By default, fields with empty
  305. // values are omitted from API requests. However, any field with an
  306. // empty value appearing in NullFields will be sent to the server as
  307. // null. It is an error if a field in this list has a non-empty value.
  308. // This may be used to include null fields in Patch requests.
  309. NullFields []string `json:"-"`
  310. }
  311. func (s *Binding) MarshalJSON() ([]byte, error) {
  312. type NoMethod Binding
  313. raw := NoMethod(*s)
  314. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  315. }
  316. // Empty: A generic empty message that you can re-use to avoid defining
  317. // duplicated
  318. // empty messages in your APIs. A typical example is to use it as the
  319. // request
  320. // or the response type of an API method. For instance:
  321. //
  322. // service Foo {
  323. // rpc Bar(google.protobuf.Empty) returns
  324. // (google.protobuf.Empty);
  325. // }
  326. //
  327. // The JSON representation for `Empty` is empty JSON object `{}`.
  328. type Empty struct {
  329. // ServerResponse contains the HTTP response code and headers from the
  330. // server.
  331. googleapi.ServerResponse `json:"-"`
  332. }
  333. // FolderOperation: Metadata describing a long running folder operation
  334. type FolderOperation struct {
  335. // DestinationParent: The resource name of the folder or organization we
  336. // are either creating
  337. // the folder under or moving the folder to.
  338. DestinationParent string `json:"destinationParent,omitempty"`
  339. // DisplayName: The display name of the folder.
  340. DisplayName string `json:"displayName,omitempty"`
  341. // OperationType: The type of this operation.
  342. //
  343. // Possible values:
  344. // "OPERATION_TYPE_UNSPECIFIED" - Operation type not specified.
  345. // "CREATE" - A create folder operation.
  346. // "MOVE" - A move folder operation.
  347. OperationType string `json:"operationType,omitempty"`
  348. // SourceParent: The resource name of the folder's parent.
  349. // Only applicable when the operation_type is MOVE.
  350. SourceParent string `json:"sourceParent,omitempty"`
  351. // ForceSendFields is a list of field names (e.g. "DestinationParent")
  352. // to unconditionally include in API requests. By default, fields with
  353. // empty values are omitted from API requests. However, any non-pointer,
  354. // non-interface field appearing in ForceSendFields will be sent to the
  355. // server regardless of whether the field is empty or not. This may be
  356. // used to include empty fields in Patch requests.
  357. ForceSendFields []string `json:"-"`
  358. // NullFields is a list of field names (e.g. "DestinationParent") to
  359. // include in API requests with the JSON null value. By default, fields
  360. // with empty values are omitted from API requests. However, any field
  361. // with an empty value appearing in NullFields will be sent to the
  362. // server as null. It is an error if a field in this list has a
  363. // non-empty value. This may be used to include null fields in Patch
  364. // requests.
  365. NullFields []string `json:"-"`
  366. }
  367. func (s *FolderOperation) MarshalJSON() ([]byte, error) {
  368. type NoMethod FolderOperation
  369. raw := NoMethod(*s)
  370. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  371. }
  372. // FolderOperationError: A classification of the Folder Operation error.
  373. type FolderOperationError struct {
  374. // ErrorMessageId: The type of operation error experienced.
  375. //
  376. // Possible values:
  377. // "ERROR_TYPE_UNSPECIFIED" - The error type was unrecognized or
  378. // unspecified.
  379. // "ACTIVE_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  380. // violate the max folder depth constraint.
  381. // "MAX_CHILD_FOLDERS_VIOLATION" - The attempted action would violate
  382. // the max child folders constraint.
  383. // "FOLDER_NAME_UNIQUENESS_VIOLATION" - The attempted action would
  384. // violate the locally-unique folder
  385. // display_name constraint.
  386. // "RESOURCE_DELETED_VIOLATION" - The resource being moved has been
  387. // deleted.
  388. // "PARENT_DELETED_VIOLATION" - The resource a folder was being added
  389. // to has been deleted.
  390. // "CYCLE_INTRODUCED_VIOLATION" - The attempted action would introduce
  391. // cycle in resource path.
  392. // "FOLDER_BEING_MOVED_VIOLATION" - The attempted action would move a
  393. // folder that is already being moved.
  394. // "FOLDER_TO_DELETE_NON_EMPTY_VIOLATION" - The folder the caller is
  395. // trying to delete contains active resources.
  396. // "DELETED_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  397. // violate the max deleted folder depth
  398. // constraint.
  399. ErrorMessageId string `json:"errorMessageId,omitempty"`
  400. // ForceSendFields is a list of field names (e.g. "ErrorMessageId") to
  401. // unconditionally include in API requests. By default, fields with
  402. // empty values are omitted from API requests. However, any non-pointer,
  403. // non-interface field appearing in ForceSendFields will be sent to the
  404. // server regardless of whether the field is empty or not. This may be
  405. // used to include empty fields in Patch requests.
  406. ForceSendFields []string `json:"-"`
  407. // NullFields is a list of field names (e.g. "ErrorMessageId") to
  408. // include in API requests with the JSON null value. By default, fields
  409. // with empty values are omitted from API requests. However, any field
  410. // with an empty value appearing in NullFields will be sent to the
  411. // server as null. It is an error if a field in this list has a
  412. // non-empty value. This may be used to include null fields in Patch
  413. // requests.
  414. NullFields []string `json:"-"`
  415. }
  416. func (s *FolderOperationError) MarshalJSON() ([]byte, error) {
  417. type NoMethod FolderOperationError
  418. raw := NoMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  420. }
  421. // GetAncestryRequest: The request sent to the
  422. // GetAncestry
  423. // method.
  424. type GetAncestryRequest struct {
  425. }
  426. // GetAncestryResponse: Response from the GetAncestry method.
  427. type GetAncestryResponse struct {
  428. // Ancestor: Ancestors are ordered from bottom to top of the resource
  429. // hierarchy. The
  430. // first ancestor is the project itself, followed by the project's
  431. // parent,
  432. // etc.
  433. Ancestor []*Ancestor `json:"ancestor,omitempty"`
  434. // ServerResponse contains the HTTP response code and headers from the
  435. // server.
  436. googleapi.ServerResponse `json:"-"`
  437. // ForceSendFields is a list of field names (e.g. "Ancestor") to
  438. // unconditionally include in API requests. By default, fields with
  439. // empty values are omitted from API requests. However, any non-pointer,
  440. // non-interface field appearing in ForceSendFields will be sent to the
  441. // server regardless of whether the field is empty or not. This may be
  442. // used to include empty fields in Patch requests.
  443. ForceSendFields []string `json:"-"`
  444. // NullFields is a list of field names (e.g. "Ancestor") to include in
  445. // API requests with the JSON null value. By default, fields with empty
  446. // values are omitted from API requests. However, any field with an
  447. // empty value appearing in NullFields will be sent to the server as
  448. // null. It is an error if a field in this list has a non-empty value.
  449. // This may be used to include null fields in Patch requests.
  450. NullFields []string `json:"-"`
  451. }
  452. func (s *GetAncestryResponse) MarshalJSON() ([]byte, error) {
  453. type NoMethod GetAncestryResponse
  454. raw := NoMethod(*s)
  455. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  456. }
  457. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  458. type GetIamPolicyRequest struct {
  459. }
  460. // ListOrganizationsResponse: The response returned from the
  461. // `ListOrganizations` method.
  462. type ListOrganizationsResponse struct {
  463. // NextPageToken: A pagination token to be used to retrieve the next
  464. // page of results. If the
  465. // result is too large to fit within the page size specified in the
  466. // request,
  467. // this field will be set with a token that can be used to fetch the
  468. // next page
  469. // of results. If this field is empty, it indicates that this
  470. // response
  471. // contains the last page of results.
  472. NextPageToken string `json:"nextPageToken,omitempty"`
  473. // Organizations: The list of Organizations that matched the list query,
  474. // possibly paginated.
  475. Organizations []*Organization `json:"organizations,omitempty"`
  476. // ServerResponse contains the HTTP response code and headers from the
  477. // server.
  478. googleapi.ServerResponse `json:"-"`
  479. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  480. // unconditionally include in API requests. By default, fields with
  481. // empty values are omitted from API requests. However, any non-pointer,
  482. // non-interface field appearing in ForceSendFields will be sent to the
  483. // server regardless of whether the field is empty or not. This may be
  484. // used to include empty fields in Patch requests.
  485. ForceSendFields []string `json:"-"`
  486. // NullFields is a list of field names (e.g. "NextPageToken") to include
  487. // in API requests with the JSON null value. By default, fields with
  488. // empty values are omitted from API requests. However, any field with
  489. // an empty value appearing in NullFields will be sent to the server as
  490. // null. It is an error if a field in this list has a non-empty value.
  491. // This may be used to include null fields in Patch requests.
  492. NullFields []string `json:"-"`
  493. }
  494. func (s *ListOrganizationsResponse) MarshalJSON() ([]byte, error) {
  495. type NoMethod ListOrganizationsResponse
  496. raw := NoMethod(*s)
  497. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  498. }
  499. // ListProjectsResponse: A page of the response received from
  500. // the
  501. // ListProjects
  502. // method.
  503. //
  504. // A paginated response where more pages are available
  505. // has
  506. // `next_page_token` set. This token can be used in a subsequent request
  507. // to
  508. // retrieve the next request page.
  509. type ListProjectsResponse struct {
  510. // NextPageToken: Pagination token.
  511. //
  512. // If the result set is too large to fit in a single response, this
  513. // token
  514. // is returned. It encodes the position of the current result
  515. // cursor.
  516. // Feeding this value into a new list request with the `page_token`
  517. // parameter
  518. // gives the next page of the results.
  519. //
  520. // When `next_page_token` is not filled in, there is no next page
  521. // and
  522. // the list returned is the last page in the result set.
  523. //
  524. // Pagination tokens have a limited lifetime.
  525. NextPageToken string `json:"nextPageToken,omitempty"`
  526. // Projects: The list of Projects that matched the list filter. This
  527. // list can
  528. // be paginated.
  529. Projects []*Project `json:"projects,omitempty"`
  530. // ServerResponse contains the HTTP response code and headers from the
  531. // server.
  532. googleapi.ServerResponse `json:"-"`
  533. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  534. // unconditionally include in API requests. By default, fields with
  535. // empty values are omitted from API requests. However, any non-pointer,
  536. // non-interface field appearing in ForceSendFields will be sent to the
  537. // server regardless of whether the field is empty or not. This may be
  538. // used to include empty fields in Patch requests.
  539. ForceSendFields []string `json:"-"`
  540. // NullFields is a list of field names (e.g. "NextPageToken") to include
  541. // in API requests with the JSON null value. By default, fields with
  542. // empty values are omitted from API requests. However, any field with
  543. // an empty value appearing in NullFields will be sent to the server as
  544. // null. It is an error if a field in this list has a non-empty value.
  545. // This may be used to include null fields in Patch requests.
  546. NullFields []string `json:"-"`
  547. }
  548. func (s *ListProjectsResponse) MarshalJSON() ([]byte, error) {
  549. type NoMethod ListProjectsResponse
  550. raw := NoMethod(*s)
  551. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  552. }
  553. // Organization: The root node in the resource hierarchy to which a
  554. // particular entity's
  555. // (e.g., company) resources belong.
  556. type Organization struct {
  557. // CreationTime: Timestamp when the Organization was created. Assigned
  558. // by the server.
  559. // @OutputOnly
  560. CreationTime string `json:"creationTime,omitempty"`
  561. // DisplayName: A human-readable string that refers to the Organization
  562. // in the
  563. // GCP Console UI. This string is set by the server and cannot
  564. // be
  565. // changed. The string will be set to the primary domain (for
  566. // example,
  567. // "google.com") of the G Suite customer that owns the
  568. // organization.
  569. // @OutputOnly
  570. DisplayName string `json:"displayName,omitempty"`
  571. // LifecycleState: The organization's current lifecycle state. Assigned
  572. // by the server.
  573. // @OutputOnly
  574. //
  575. // Possible values:
  576. // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only
  577. // useful for distinguishing unset values.
  578. // "ACTIVE" - The normal and active state.
  579. // "DELETE_REQUESTED" - The organization has been marked for deletion
  580. // by the user.
  581. LifecycleState string `json:"lifecycleState,omitempty"`
  582. // Name: Output Only. The resource name of the organization. This is
  583. // the
  584. // organization's relative path in the API. Its format
  585. // is
  586. // "organizations/[organization_id]". For example, "organizations/1234".
  587. Name string `json:"name,omitempty"`
  588. // OrganizationId: An immutable id for the Organization that is assigned
  589. // on creation. This
  590. // should be omitted when creating a new Organization.
  591. // This field is read-only.
  592. OrganizationId string `json:"organizationId,omitempty"`
  593. // Owner: The owner of this Organization. The owner should be specified
  594. // on
  595. // creation. Once set, it cannot be changed.
  596. // This field is required.
  597. Owner *OrganizationOwner `json:"owner,omitempty"`
  598. // ServerResponse contains the HTTP response code and headers from the
  599. // server.
  600. googleapi.ServerResponse `json:"-"`
  601. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  602. // unconditionally include in API requests. By default, fields with
  603. // empty values are omitted from API requests. However, any non-pointer,
  604. // non-interface field appearing in ForceSendFields will be sent to the
  605. // server regardless of whether the field is empty or not. This may be
  606. // used to include empty fields in Patch requests.
  607. ForceSendFields []string `json:"-"`
  608. // NullFields is a list of field names (e.g. "CreationTime") to include
  609. // in API requests with the JSON null value. By default, fields with
  610. // empty values are omitted from API requests. However, any field with
  611. // an empty value appearing in NullFields will be sent to the server as
  612. // null. It is an error if a field in this list has a non-empty value.
  613. // This may be used to include null fields in Patch requests.
  614. NullFields []string `json:"-"`
  615. }
  616. func (s *Organization) MarshalJSON() ([]byte, error) {
  617. type NoMethod Organization
  618. raw := NoMethod(*s)
  619. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  620. }
  621. // OrganizationOwner: The entity that owns an Organization. The lifetime
  622. // of the Organization and
  623. // all of its descendants are bound to the `OrganizationOwner`. If
  624. // the
  625. // `OrganizationOwner` is deleted, the Organization and all its
  626. // descendants will
  627. // be deleted.
  628. type OrganizationOwner struct {
  629. // DirectoryCustomerId: The G Suite customer id used in the Directory
  630. // API.
  631. DirectoryCustomerId string `json:"directoryCustomerId,omitempty"`
  632. // ForceSendFields is a list of field names (e.g. "DirectoryCustomerId")
  633. // to unconditionally include in API requests. By default, fields with
  634. // empty values are omitted from API requests. However, any non-pointer,
  635. // non-interface field appearing in ForceSendFields will be sent to the
  636. // server regardless of whether the field is empty or not. This may be
  637. // used to include empty fields in Patch requests.
  638. ForceSendFields []string `json:"-"`
  639. // NullFields is a list of field names (e.g. "DirectoryCustomerId") to
  640. // include in API requests with the JSON null value. By default, fields
  641. // with empty values are omitted from API requests. However, any field
  642. // with an empty value appearing in NullFields will be sent to the
  643. // server as null. It is an error if a field in this list has a
  644. // non-empty value. This may be used to include null fields in Patch
  645. // requests.
  646. NullFields []string `json:"-"`
  647. }
  648. func (s *OrganizationOwner) MarshalJSON() ([]byte, error) {
  649. type NoMethod OrganizationOwner
  650. raw := NoMethod(*s)
  651. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  652. }
  653. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  654. // used to
  655. // specify access control policies for Cloud Platform resources.
  656. //
  657. //
  658. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  659. // of
  660. // `members` to a `role`, where the members can be user accounts, Google
  661. // groups,
  662. // Google domains, and service accounts. A `role` is a named list of
  663. // permissions
  664. // defined by IAM.
  665. //
  666. // **JSON Example**
  667. //
  668. // {
  669. // "bindings": [
  670. // {
  671. // "role": "roles/owner",
  672. // "members": [
  673. // "user:mike@example.com",
  674. // "group:admins@example.com",
  675. // "domain:google.com",
  676. //
  677. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  678. // ]
  679. // },
  680. // {
  681. // "role": "roles/viewer",
  682. // "members": ["user:sean@example.com"]
  683. // }
  684. // ]
  685. // }
  686. //
  687. // **YAML Example**
  688. //
  689. // bindings:
  690. // - members:
  691. // - user:mike@example.com
  692. // - group:admins@example.com
  693. // - domain:google.com
  694. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  695. // role: roles/owner
  696. // - members:
  697. // - user:sean@example.com
  698. // role: roles/viewer
  699. //
  700. //
  701. // For a description of IAM and its features, see the
  702. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  703. type Policy struct {
  704. // AuditConfigs: Specifies cloud audit logging configuration for this
  705. // policy.
  706. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  707. // Bindings: Associates a list of `members` to a `role`.
  708. // `bindings` with no members will result in an error.
  709. Bindings []*Binding `json:"bindings,omitempty"`
  710. // Etag: `etag` is used for optimistic concurrency control as a way to
  711. // help
  712. // prevent simultaneous updates of a policy from overwriting each
  713. // other.
  714. // It is strongly suggested that systems make use of the `etag` in
  715. // the
  716. // read-modify-write cycle to perform policy updates in order to avoid
  717. // race
  718. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  719. // and
  720. // systems are expected to put that etag in the request to
  721. // `setIamPolicy` to
  722. // ensure that their change will be applied to the same version of the
  723. // policy.
  724. //
  725. // If no `etag` is provided in the call to `setIamPolicy`, then the
  726. // existing
  727. // policy is overwritten blindly.
  728. Etag string `json:"etag,omitempty"`
  729. // Version: Deprecated.
  730. Version int64 `json:"version,omitempty"`
  731. // ServerResponse contains the HTTP response code and headers from the
  732. // server.
  733. googleapi.ServerResponse `json:"-"`
  734. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  735. // unconditionally include in API requests. By default, fields with
  736. // empty values are omitted from API requests. However, any non-pointer,
  737. // non-interface field appearing in ForceSendFields will be sent to the
  738. // server regardless of whether the field is empty or not. This may be
  739. // used to include empty fields in Patch requests.
  740. ForceSendFields []string `json:"-"`
  741. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  742. // in API requests with the JSON null value. By default, fields with
  743. // empty values are omitted from API requests. However, any field with
  744. // an empty value appearing in NullFields will be sent to the server as
  745. // null. It is an error if a field in this list has a non-empty value.
  746. // This may be used to include null fields in Patch requests.
  747. NullFields []string `json:"-"`
  748. }
  749. func (s *Policy) MarshalJSON() ([]byte, error) {
  750. type NoMethod Policy
  751. raw := NoMethod(*s)
  752. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  753. }
  754. // Project: A Project is a high-level Google Cloud Platform entity. It
  755. // is a
  756. // container for ACLs, APIs, App Engine Apps, VMs, and other
  757. // Google Cloud Platform resources.
  758. type Project struct {
  759. // CreateTime: Creation time.
  760. //
  761. // Read-only.
  762. CreateTime string `json:"createTime,omitempty"`
  763. // Labels: The labels associated with this Project.
  764. //
  765. // Label keys must be between 1 and 63 characters long and must
  766. // conform
  767. // to the following regular expression:
  768. // \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?.
  769. //
  770. // Label values must be between 0 and 63 characters long and must
  771. // conform
  772. // to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?.
  773. //
  774. // No more than 256 labels can be associated with a given
  775. // resource.
  776. //
  777. // Clients should store labels in a representation such as JSON that
  778. // does not
  779. // depend on specific characters being disallowed.
  780. //
  781. // Example: <code>"environment" : "dev"</code>
  782. // Read-write.
  783. Labels map[string]string `json:"labels,omitempty"`
  784. // LifecycleState: The Project lifecycle state.
  785. //
  786. // Read-only.
  787. //
  788. // Possible values:
  789. // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only
  790. // used/useful for distinguishing
  791. // unset values.
  792. // "ACTIVE" - The normal and active state.
  793. // "DELETE_REQUESTED" - The project has been marked for deletion by
  794. // the user
  795. // (by invoking DeleteProject)
  796. // or by the system (Google Cloud Platform).
  797. // This can generally be reversed by invoking UndeleteProject.
  798. // "DELETE_IN_PROGRESS" - This lifecycle state is no longer used and
  799. // is not returned by the API.
  800. LifecycleState string `json:"lifecycleState,omitempty"`
  801. // Name: The user-assigned display name of the Project.
  802. // It must be 4 to 30 characters.
  803. // Allowed characters are: lowercase and uppercase letters,
  804. // numbers,
  805. // hyphen, single-quote, double-quote, space, and exclamation
  806. // point.
  807. //
  808. // Example: <code>My Project</code>
  809. // Read-write.
  810. Name string `json:"name,omitempty"`
  811. // Parent: An optional reference to a parent Resource.
  812. //
  813. // Supported parent types include "organization" and "folder". Once set,
  814. // the
  815. // parent cannot be cleared. The `parent` can be set on creation or
  816. // using the
  817. // `UpdateProject` method; the end user must have
  818. // the
  819. // `resourcemanager.projects.create` permission on the
  820. // parent.
  821. //
  822. // Read-write.
  823. Parent *ResourceId `json:"parent,omitempty"`
  824. // ProjectId: The unique, user-assigned ID of the Project.
  825. // It must be 6 to 30 lowercase letters, digits, or hyphens.
  826. // It must start with a letter.
  827. // Trailing hyphens are prohibited.
  828. //
  829. // Example: <code>tokyo-rain-123</code>
  830. // Read-only after creation.
  831. ProjectId string `json:"projectId,omitempty"`
  832. // ProjectNumber: The number uniquely identifying the project.
  833. //
  834. // Example: <code>415104041262</code>
  835. // Read-only.
  836. ProjectNumber int64 `json:"projectNumber,omitempty,string"`
  837. // ServerResponse contains the HTTP response code and headers from the
  838. // server.
  839. googleapi.ServerResponse `json:"-"`
  840. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  841. // unconditionally include in API requests. By default, fields with
  842. // empty values are omitted from API requests. However, any non-pointer,
  843. // non-interface field appearing in ForceSendFields will be sent to the
  844. // server regardless of whether the field is empty or not. This may be
  845. // used to include empty fields in Patch requests.
  846. ForceSendFields []string `json:"-"`
  847. // NullFields is a list of field names (e.g. "CreateTime") to include in
  848. // API requests with the JSON null value. By default, fields with empty
  849. // values are omitted from API requests. However, any field with an
  850. // empty value appearing in NullFields will be sent to the server as
  851. // null. It is an error if a field in this list has a non-empty value.
  852. // This may be used to include null fields in Patch requests.
  853. NullFields []string `json:"-"`
  854. }
  855. func (s *Project) MarshalJSON() ([]byte, error) {
  856. type NoMethod Project
  857. raw := NoMethod(*s)
  858. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  859. }
  860. // ProjectCreationStatus: A status object which is used as the
  861. // `metadata` field for the Operation
  862. // returned by CreateProject. It provides insight for when significant
  863. // phases of
  864. // Project creation have completed.
  865. type ProjectCreationStatus struct {
  866. // CreateTime: Creation time of the project creation workflow.
  867. CreateTime string `json:"createTime,omitempty"`
  868. // Gettable: True if the project can be retrieved using GetProject. No
  869. // other operations
  870. // on the project are guaranteed to work until the project creation
  871. // is
  872. // complete.
  873. Gettable bool `json:"gettable,omitempty"`
  874. // Ready: True if the project creation process is complete.
  875. Ready bool `json:"ready,omitempty"`
  876. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  877. // unconditionally include in API requests. By default, fields with
  878. // empty values are omitted from API requests. However, any non-pointer,
  879. // non-interface field appearing in ForceSendFields will be sent to the
  880. // server regardless of whether the field is empty or not. This may be
  881. // used to include empty fields in Patch requests.
  882. ForceSendFields []string `json:"-"`
  883. // NullFields is a list of field names (e.g. "CreateTime") to include in
  884. // API requests with the JSON null value. By default, fields with empty
  885. // values are omitted from API requests. However, any field with an
  886. // empty value appearing in NullFields will be sent to the server as
  887. // null. It is an error if a field in this list has a non-empty value.
  888. // This may be used to include null fields in Patch requests.
  889. NullFields []string `json:"-"`
  890. }
  891. func (s *ProjectCreationStatus) MarshalJSON() ([]byte, error) {
  892. type NoMethod ProjectCreationStatus
  893. raw := NoMethod(*s)
  894. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  895. }
  896. // ResourceId: A container to reference an id for any resource type. A
  897. // `resource` in Google
  898. // Cloud Platform is a generic term for something you (a developer) may
  899. // want to
  900. // interact with through one of our API's. Some examples are an App
  901. // Engine app,
  902. // a Compute Engine instance, a Cloud SQL database, and so on.
  903. type ResourceId struct {
  904. // Id: Required field for the type-specific id. This should correspond
  905. // to the id
  906. // used in the type-specific API's.
  907. Id string `json:"id,omitempty"`
  908. // Type: Required field representing the resource type this id is
  909. // for.
  910. // At present, the valid types are "project", "folder", and
  911. // "organization".
  912. Type string `json:"type,omitempty"`
  913. // ForceSendFields is a list of field names (e.g. "Id") to
  914. // unconditionally include in API requests. By default, fields with
  915. // empty values are omitted from API requests. However, any non-pointer,
  916. // non-interface field appearing in ForceSendFields will be sent to the
  917. // server regardless of whether the field is empty or not. This may be
  918. // used to include empty fields in Patch requests.
  919. ForceSendFields []string `json:"-"`
  920. // NullFields is a list of field names (e.g. "Id") to include in API
  921. // requests with the JSON null value. By default, fields with empty
  922. // values are omitted from API requests. However, any field with an
  923. // empty value appearing in NullFields will be sent to the server as
  924. // null. It is an error if a field in this list has a non-empty value.
  925. // This may be used to include null fields in Patch requests.
  926. NullFields []string `json:"-"`
  927. }
  928. func (s *ResourceId) MarshalJSON() ([]byte, error) {
  929. type NoMethod ResourceId
  930. raw := NoMethod(*s)
  931. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  932. }
  933. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  934. type SetIamPolicyRequest struct {
  935. // Policy: REQUIRED: The complete policy to be applied to the
  936. // `resource`. The size of
  937. // the policy is limited to a few 10s of KB. An empty policy is a
  938. // valid policy but certain Cloud Platform services (such as
  939. // Projects)
  940. // might reject them.
  941. Policy *Policy `json:"policy,omitempty"`
  942. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  943. // policy to modify. Only
  944. // the fields in the mask will be modified. If no mask is provided,
  945. // the
  946. // following default mask is used:
  947. // paths: "bindings, etag"
  948. // This field is only used by Cloud IAM.
  949. UpdateMask string `json:"updateMask,omitempty"`
  950. // ForceSendFields is a list of field names (e.g. "Policy") to
  951. // unconditionally include in API requests. By default, fields with
  952. // empty values are omitted from API requests. However, any non-pointer,
  953. // non-interface field appearing in ForceSendFields will be sent to the
  954. // server regardless of whether the field is empty or not. This may be
  955. // used to include empty fields in Patch requests.
  956. ForceSendFields []string `json:"-"`
  957. // NullFields is a list of field names (e.g. "Policy") to include in API
  958. // requests with the JSON null value. By default, fields with empty
  959. // values are omitted from API requests. However, any field with an
  960. // empty value appearing in NullFields will be sent to the server as
  961. // null. It is an error if a field in this list has a non-empty value.
  962. // This may be used to include null fields in Patch requests.
  963. NullFields []string `json:"-"`
  964. }
  965. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  966. type NoMethod SetIamPolicyRequest
  967. raw := NoMethod(*s)
  968. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  969. }
  970. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  971. // method.
  972. type TestIamPermissionsRequest struct {
  973. // Permissions: The set of permissions to check for the `resource`.
  974. // Permissions with
  975. // wildcards (such as '*' or 'storage.*') are not allowed. For
  976. // more
  977. // information see
  978. // [IAM
  979. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  980. Permissions []string `json:"permissions,omitempty"`
  981. // ForceSendFields is a list of field names (e.g. "Permissions") to
  982. // unconditionally include in API requests. By default, fields with
  983. // empty values are omitted from API requests. However, any non-pointer,
  984. // non-interface field appearing in ForceSendFields will be sent to the
  985. // server regardless of whether the field is empty or not. This may be
  986. // used to include empty fields in Patch requests.
  987. ForceSendFields []string `json:"-"`
  988. // NullFields is a list of field names (e.g. "Permissions") to include
  989. // in API requests with the JSON null value. By default, fields with
  990. // empty values are omitted from API requests. However, any field with
  991. // an empty value appearing in NullFields will be sent to the server as
  992. // null. It is an error if a field in this list has a non-empty value.
  993. // This may be used to include null fields in Patch requests.
  994. NullFields []string `json:"-"`
  995. }
  996. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  997. type NoMethod TestIamPermissionsRequest
  998. raw := NoMethod(*s)
  999. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1000. }
  1001. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1002. // method.
  1003. type TestIamPermissionsResponse struct {
  1004. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1005. // the caller is
  1006. // allowed.
  1007. Permissions []string `json:"permissions,omitempty"`
  1008. // ServerResponse contains the HTTP response code and headers from the
  1009. // server.
  1010. googleapi.ServerResponse `json:"-"`
  1011. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1012. // unconditionally include in API requests. By default, fields with
  1013. // empty values are omitted from API requests. However, any non-pointer,
  1014. // non-interface field appearing in ForceSendFields will be sent to the
  1015. // server regardless of whether the field is empty or not. This may be
  1016. // used to include empty fields in Patch requests.
  1017. ForceSendFields []string `json:"-"`
  1018. // NullFields is a list of field names (e.g. "Permissions") to include
  1019. // in API requests with the JSON null value. By default, fields with
  1020. // empty values are omitted from API requests. However, any field with
  1021. // an empty value appearing in NullFields will be sent to the server as
  1022. // null. It is an error if a field in this list has a non-empty value.
  1023. // This may be used to include null fields in Patch requests.
  1024. NullFields []string `json:"-"`
  1025. }
  1026. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1027. type NoMethod TestIamPermissionsResponse
  1028. raw := NoMethod(*s)
  1029. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1030. }
  1031. // UndeleteProjectRequest: The request sent to the
  1032. // UndeleteProject
  1033. // method.
  1034. type UndeleteProjectRequest struct {
  1035. }
  1036. // method id "cloudresourcemanager.organizations.get":
  1037. type OrganizationsGetCall struct {
  1038. s *Service
  1039. name string
  1040. urlParams_ gensupport.URLParams
  1041. ifNoneMatch_ string
  1042. ctx_ context.Context
  1043. header_ http.Header
  1044. }
  1045. // Get: Fetches an Organization resource identified by the specified
  1046. // resource name.
  1047. func (r *OrganizationsService) Get(name string) *OrganizationsGetCall {
  1048. c := &OrganizationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1049. c.name = name
  1050. return c
  1051. }
  1052. // OrganizationId sets the optional parameter "organizationId": The id
  1053. // of the Organization resource to fetch.
  1054. // This field is deprecated and will be removed in v1. Use name instead.
  1055. func (c *OrganizationsGetCall) OrganizationId(organizationId string) *OrganizationsGetCall {
  1056. c.urlParams_.Set("organizationId", organizationId)
  1057. return c
  1058. }
  1059. // Fields allows partial responses to be retrieved. See
  1060. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1061. // for more information.
  1062. func (c *OrganizationsGetCall) Fields(s ...googleapi.Field) *OrganizationsGetCall {
  1063. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1064. return c
  1065. }
  1066. // IfNoneMatch sets the optional parameter which makes the operation
  1067. // fail if the object's ETag matches the given value. This is useful for
  1068. // getting updates only after the object has changed since the last
  1069. // request. Use googleapi.IsNotModified to check whether the response
  1070. // error from Do is the result of In-None-Match.
  1071. func (c *OrganizationsGetCall) IfNoneMatch(entityTag string) *OrganizationsGetCall {
  1072. c.ifNoneMatch_ = entityTag
  1073. return c
  1074. }
  1075. // Context sets the context to be used in this call's Do method. Any
  1076. // pending HTTP request will be aborted if the provided context is
  1077. // canceled.
  1078. func (c *OrganizationsGetCall) Context(ctx context.Context) *OrganizationsGetCall {
  1079. c.ctx_ = ctx
  1080. return c
  1081. }
  1082. // Header returns an http.Header that can be modified by the caller to
  1083. // add HTTP headers to the request.
  1084. func (c *OrganizationsGetCall) Header() http.Header {
  1085. if c.header_ == nil {
  1086. c.header_ = make(http.Header)
  1087. }
  1088. return c.header_
  1089. }
  1090. func (c *OrganizationsGetCall) doRequest(alt string) (*http.Response, error) {
  1091. reqHeaders := make(http.Header)
  1092. for k, v := range c.header_ {
  1093. reqHeaders[k] = v
  1094. }
  1095. reqHeaders.Set("User-Agent", c.s.userAgent())
  1096. if c.ifNoneMatch_ != "" {
  1097. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1098. }
  1099. var body io.Reader = nil
  1100. c.urlParams_.Set("alt", alt)
  1101. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1102. urls += "?" + c.urlParams_.Encode()
  1103. req, _ := http.NewRequest("GET", urls, body)
  1104. req.Header = reqHeaders
  1105. googleapi.Expand(req.URL, map[string]string{
  1106. "name": c.name,
  1107. })
  1108. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1109. }
  1110. // Do executes the "cloudresourcemanager.organizations.get" call.
  1111. // Exactly one of *Organization or error will be non-nil. Any non-2xx
  1112. // status code is an error. Response headers are in either
  1113. // *Organization.ServerResponse.Header or (if a response was returned at
  1114. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1115. // to check whether the returned error was because
  1116. // http.StatusNotModified was returned.
  1117. func (c *OrganizationsGetCall) Do(opts ...googleapi.CallOption) (*Organization, error) {
  1118. gensupport.SetOptions(c.urlParams_, opts...)
  1119. res, err := c.doRequest("json")
  1120. if res != nil && res.StatusCode == http.StatusNotModified {
  1121. if res.Body != nil {
  1122. res.Body.Close()
  1123. }
  1124. return nil, &googleapi.Error{
  1125. Code: res.StatusCode,
  1126. Header: res.Header,
  1127. }
  1128. }
  1129. if err != nil {
  1130. return nil, err
  1131. }
  1132. defer googleapi.CloseBody(res)
  1133. if err := googleapi.CheckResponse(res); err != nil {
  1134. return nil, err
  1135. }
  1136. ret := &Organization{
  1137. ServerResponse: googleapi.ServerResponse{
  1138. Header: res.Header,
  1139. HTTPStatusCode: res.StatusCode,
  1140. },
  1141. }
  1142. target := &ret
  1143. if err := gensupport.DecodeResponse(target, res); err != nil {
  1144. return nil, err
  1145. }
  1146. return ret, nil
  1147. // {
  1148. // "description": "Fetches an Organization resource identified by the specified resource name.",
  1149. // "flatPath": "v1beta1/organizations/{organizationsId}",
  1150. // "httpMethod": "GET",
  1151. // "id": "cloudresourcemanager.organizations.get",
  1152. // "parameterOrder": [
  1153. // "name"
  1154. // ],
  1155. // "parameters": {
  1156. // "name": {
  1157. // "description": "The resource name of the Organization to fetch, e.g. \"organizations/1234\".",
  1158. // "location": "path",
  1159. // "pattern": "^organizations/[^/]+$",
  1160. // "required": true,
  1161. // "type": "string"
  1162. // },
  1163. // "organizationId": {
  1164. // "description": "The id of the Organization resource to fetch.\nThis field is deprecated and will be removed in v1. Use name instead.",
  1165. // "location": "query",
  1166. // "type": "string"
  1167. // }
  1168. // },
  1169. // "path": "v1beta1/{+name}",
  1170. // "response": {
  1171. // "$ref": "Organization"
  1172. // },
  1173. // "scopes": [
  1174. // "https://www.googleapis.com/auth/cloud-platform",
  1175. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1176. // ]
  1177. // }
  1178. }
  1179. // method id "cloudresourcemanager.organizations.getIamPolicy":
  1180. type OrganizationsGetIamPolicyCall struct {
  1181. s *Service
  1182. resource string
  1183. getiampolicyrequest *GetIamPolicyRequest
  1184. urlParams_ gensupport.URLParams
  1185. ctx_ context.Context
  1186. header_ http.Header
  1187. }
  1188. // GetIamPolicy: Gets the access control policy for an Organization
  1189. // resource. May be empty
  1190. // if no such policy or resource exists. The `resource` field should be
  1191. // the
  1192. // organization's resource name, e.g. "organizations/123".
  1193. func (r *OrganizationsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *OrganizationsGetIamPolicyCall {
  1194. c := &OrganizationsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1195. c.resource = resource
  1196. c.getiampolicyrequest = getiampolicyrequest
  1197. return c
  1198. }
  1199. // Fields allows partial responses to be retrieved. See
  1200. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1201. // for more information.
  1202. func (c *OrganizationsGetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetIamPolicyCall {
  1203. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1204. return c
  1205. }
  1206. // Context sets the context to be used in this call's Do method. Any
  1207. // pending HTTP request will be aborted if the provided context is
  1208. // canceled.
  1209. func (c *OrganizationsGetIamPolicyCall) Context(ctx context.Context) *OrganizationsGetIamPolicyCall {
  1210. c.ctx_ = ctx
  1211. return c
  1212. }
  1213. // Header returns an http.Header that can be modified by the caller to
  1214. // add HTTP headers to the request.
  1215. func (c *OrganizationsGetIamPolicyCall) Header() http.Header {
  1216. if c.header_ == nil {
  1217. c.header_ = make(http.Header)
  1218. }
  1219. return c.header_
  1220. }
  1221. func (c *OrganizationsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1222. reqHeaders := make(http.Header)
  1223. for k, v := range c.header_ {
  1224. reqHeaders[k] = v
  1225. }
  1226. reqHeaders.Set("User-Agent", c.s.userAgent())
  1227. var body io.Reader = nil
  1228. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  1229. if err != nil {
  1230. return nil, err
  1231. }
  1232. reqHeaders.Set("Content-Type", "application/json")
  1233. c.urlParams_.Set("alt", alt)
  1234. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:getIamPolicy")
  1235. urls += "?" + c.urlParams_.Encode()
  1236. req, _ := http.NewRequest("POST", urls, body)
  1237. req.Header = reqHeaders
  1238. googleapi.Expand(req.URL, map[string]string{
  1239. "resource": c.resource,
  1240. })
  1241. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1242. }
  1243. // Do executes the "cloudresourcemanager.organizations.getIamPolicy" call.
  1244. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1245. // code is an error. Response headers are in either
  1246. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1247. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1248. // check whether the returned error was because http.StatusNotModified
  1249. // was returned.
  1250. func (c *OrganizationsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1251. gensupport.SetOptions(c.urlParams_, opts...)
  1252. res, err := c.doRequest("json")
  1253. if res != nil && res.StatusCode == http.StatusNotModified {
  1254. if res.Body != nil {
  1255. res.Body.Close()
  1256. }
  1257. return nil, &googleapi.Error{
  1258. Code: res.StatusCode,
  1259. Header: res.Header,
  1260. }
  1261. }
  1262. if err != nil {
  1263. return nil, err
  1264. }
  1265. defer googleapi.CloseBody(res)
  1266. if err := googleapi.CheckResponse(res); err != nil {
  1267. return nil, err
  1268. }
  1269. ret := &Policy{
  1270. ServerResponse: googleapi.ServerResponse{
  1271. Header: res.Header,
  1272. HTTPStatusCode: res.StatusCode,
  1273. },
  1274. }
  1275. target := &ret
  1276. if err := gensupport.DecodeResponse(target, res); err != nil {
  1277. return nil, err
  1278. }
  1279. return ret, nil
  1280. // {
  1281. // "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\".",
  1282. // "flatPath": "v1beta1/organizations/{organizationsId}:getIamPolicy",
  1283. // "httpMethod": "POST",
  1284. // "id": "cloudresourcemanager.organizations.getIamPolicy",
  1285. // "parameterOrder": [
  1286. // "resource"
  1287. // ],
  1288. // "parameters": {
  1289. // "resource": {
  1290. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1291. // "location": "path",
  1292. // "pattern": "^organizations/[^/]+$",
  1293. // "required": true,
  1294. // "type": "string"
  1295. // }
  1296. // },
  1297. // "path": "v1beta1/{+resource}:getIamPolicy",
  1298. // "request": {
  1299. // "$ref": "GetIamPolicyRequest"
  1300. // },
  1301. // "response": {
  1302. // "$ref": "Policy"
  1303. // },
  1304. // "scopes": [
  1305. // "https://www.googleapis.com/auth/cloud-platform",
  1306. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1307. // ]
  1308. // }
  1309. }
  1310. // method id "cloudresourcemanager.organizations.list":
  1311. type OrganizationsListCall struct {
  1312. s *Service
  1313. urlParams_ gensupport.URLParams
  1314. ifNoneMatch_ string
  1315. ctx_ context.Context
  1316. header_ http.Header
  1317. }
  1318. // List: Lists Organization resources that are visible to the user and
  1319. // satisfy
  1320. // the specified filter. This method returns Organizations in an
  1321. // unspecified
  1322. // order. New Organizations do not necessarily appear at the end of the
  1323. // list.
  1324. func (r *OrganizationsService) List() *OrganizationsListCall {
  1325. c := &OrganizationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1326. return c
  1327. }
  1328. // Filter sets the optional parameter "filter": An optional query string
  1329. // used to filter the Organizations to return in
  1330. // the response. Filter rules are case-insensitive.
  1331. //
  1332. //
  1333. // Organizations may be filtered by `owner.directoryCustomerId` or
  1334. // by
  1335. // `domain`, where the domain is a G Suite domain, for
  1336. // example:
  1337. //
  1338. // |Filter|Description|
  1339. // |------|-----------|
  1340. // |owner.directorycu
  1341. // stomerid:123456789|Organizations with `owner.directory_customer_id`
  1342. // equal to `123456789`.|
  1343. // |domain:google.com|Organizations corresponding to the domain
  1344. // `google.com`.|
  1345. //
  1346. // This field is optional.
  1347. func (c *OrganizationsListCall) Filter(filter string) *OrganizationsListCall {
  1348. c.urlParams_.Set("filter", filter)
  1349. return c
  1350. }
  1351. // PageSize sets the optional parameter "pageSize": The maximum number
  1352. // of Organizations to return in the response.
  1353. // This field is optional.
  1354. func (c *OrganizationsListCall) PageSize(pageSize int64) *OrganizationsListCall {
  1355. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1356. return c
  1357. }
  1358. // PageToken sets the optional parameter "pageToken": A pagination token
  1359. // returned from a previous call to `ListOrganizations`
  1360. // that indicates from where listing should continue.
  1361. // This field is optional.
  1362. func (c *OrganizationsListCall) PageToken(pageToken string) *OrganizationsListCall {
  1363. c.urlParams_.Set("pageToken", pageToken)
  1364. return c
  1365. }
  1366. // Fields allows partial responses to be retrieved. See
  1367. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1368. // for more information.
  1369. func (c *OrganizationsListCall) Fields(s ...googleapi.Field) *OrganizationsListCall {
  1370. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1371. return c
  1372. }
  1373. // IfNoneMatch sets the optional parameter which makes the operation
  1374. // fail if the object's ETag matches the given value. This is useful for
  1375. // getting updates only after the object has changed since the last
  1376. // request. Use googleapi.IsNotModified to check whether the response
  1377. // error from Do is the result of In-None-Match.
  1378. func (c *OrganizationsListCall) IfNoneMatch(entityTag string) *OrganizationsListCall {
  1379. c.ifNoneMatch_ = entityTag
  1380. return c
  1381. }
  1382. // Context sets the context to be used in this call's Do method. Any
  1383. // pending HTTP request will be aborted if the provided context is
  1384. // canceled.
  1385. func (c *OrganizationsListCall) Context(ctx context.Context) *OrganizationsListCall {
  1386. c.ctx_ = ctx
  1387. return c
  1388. }
  1389. // Header returns an http.Header that can be modified by the caller to
  1390. // add HTTP headers to the request.
  1391. func (c *OrganizationsListCall) Header() http.Header {
  1392. if c.header_ == nil {
  1393. c.header_ = make(http.Header)
  1394. }
  1395. return c.header_
  1396. }
  1397. func (c *OrganizationsListCall) doRequest(alt string) (*http.Response, error) {
  1398. reqHeaders := make(http.Header)
  1399. for k, v := range c.header_ {
  1400. reqHeaders[k] = v
  1401. }
  1402. reqHeaders.Set("User-Agent", c.s.userAgent())
  1403. if c.ifNoneMatch_ != "" {
  1404. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1405. }
  1406. var body io.Reader = nil
  1407. c.urlParams_.Set("alt", alt)
  1408. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/organizations")
  1409. urls += "?" + c.urlParams_.Encode()
  1410. req, _ := http.NewRequest("GET", urls, body)
  1411. req.Header = reqHeaders
  1412. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1413. }
  1414. // Do executes the "cloudresourcemanager.organizations.list" call.
  1415. // Exactly one of *ListOrganizationsResponse or error will be non-nil.
  1416. // Any non-2xx status code is an error. Response headers are in either
  1417. // *ListOrganizationsResponse.ServerResponse.Header or (if a response
  1418. // was returned at all) in error.(*googleapi.Error).Header. Use
  1419. // googleapi.IsNotModified to check whether the returned error was
  1420. // because http.StatusNotModified was returned.
  1421. func (c *OrganizationsListCall) Do(opts ...googleapi.CallOption) (*ListOrganizationsResponse, error) {
  1422. gensupport.SetOptions(c.urlParams_, opts...)
  1423. res, err := c.doRequest("json")
  1424. if res != nil && res.StatusCode == http.StatusNotModified {
  1425. if res.Body != nil {
  1426. res.Body.Close()
  1427. }
  1428. return nil, &googleapi.Error{
  1429. Code: res.StatusCode,
  1430. Header: res.Header,
  1431. }
  1432. }
  1433. if err != nil {
  1434. return nil, err
  1435. }
  1436. defer googleapi.CloseBody(res)
  1437. if err := googleapi.CheckResponse(res); err != nil {
  1438. return nil, err
  1439. }
  1440. ret := &ListOrganizationsResponse{
  1441. ServerResponse: googleapi.ServerResponse{
  1442. Header: res.Header,
  1443. HTTPStatusCode: res.StatusCode,
  1444. },
  1445. }
  1446. target := &ret
  1447. if err := gensupport.DecodeResponse(target, res); err != nil {
  1448. return nil, err
  1449. }
  1450. return ret, nil
  1451. // {
  1452. // "description": "Lists 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 list.",
  1453. // "flatPath": "v1beta1/organizations",
  1454. // "httpMethod": "GET",
  1455. // "id": "cloudresourcemanager.organizations.list",
  1456. // "parameterOrder": [],
  1457. // "parameters": {
  1458. // "filter": {
  1459. // "description": "An optional query string used to filter the Organizations to return in\nthe response. Filter rules are case-insensitive.\n\n\nOrganizations may be filtered by `owner.directoryCustomerId` or by\n`domain`, where the domain is a G Suite domain, for example:\n\n|Filter|Description|\n|------|-----------|\n|owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.|\n|domain:google.com|Organizations corresponding to the domain `google.com`.|\n\nThis field is optional.",
  1460. // "location": "query",
  1461. // "type": "string"
  1462. // },
  1463. // "pageSize": {
  1464. // "description": "The maximum number of Organizations to return in the response.\nThis field is optional.",
  1465. // "format": "int32",
  1466. // "location": "query",
  1467. // "type": "integer"
  1468. // },
  1469. // "pageToken": {
  1470. // "description": "A pagination token returned from a previous call to `ListOrganizations`\nthat indicates from where listing should continue.\nThis field is optional.",
  1471. // "location": "query",
  1472. // "type": "string"
  1473. // }
  1474. // },
  1475. // "path": "v1beta1/organizations",
  1476. // "response": {
  1477. // "$ref": "ListOrganizationsResponse"
  1478. // },
  1479. // "scopes": [
  1480. // "https://www.googleapis.com/auth/cloud-platform",
  1481. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1482. // ]
  1483. // }
  1484. }
  1485. // Pages invokes f for each page of results.
  1486. // A non-nil error returned from f will halt the iteration.
  1487. // The provided context supersedes any context provided to the Context method.
  1488. func (c *OrganizationsListCall) Pages(ctx context.Context, f func(*ListOrganizationsResponse) error) error {
  1489. c.ctx_ = ctx
  1490. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1491. for {
  1492. x, err := c.Do()
  1493. if err != nil {
  1494. return err
  1495. }
  1496. if err := f(x); err != nil {
  1497. return err
  1498. }
  1499. if x.NextPageToken == "" {
  1500. return nil
  1501. }
  1502. c.PageToken(x.NextPageToken)
  1503. }
  1504. }
  1505. // method id "cloudresourcemanager.organizations.setIamPolicy":
  1506. type OrganizationsSetIamPolicyCall struct {
  1507. s *Service
  1508. resource string
  1509. setiampolicyrequest *SetIamPolicyRequest
  1510. urlParams_ gensupport.URLParams
  1511. ctx_ context.Context
  1512. header_ http.Header
  1513. }
  1514. // SetIamPolicy: Sets the access control policy on an Organization
  1515. // resource. Replaces any
  1516. // existing policy. The `resource` field should be the organization's
  1517. // resource
  1518. // name, e.g. "organizations/123".
  1519. func (r *OrganizationsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *OrganizationsSetIamPolicyCall {
  1520. c := &OrganizationsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1521. c.resource = resource
  1522. c.setiampolicyrequest = setiampolicyrequest
  1523. return c
  1524. }
  1525. // Fields allows partial responses to be retrieved. See
  1526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1527. // for more information.
  1528. func (c *OrganizationsSetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsSetIamPolicyCall {
  1529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1530. return c
  1531. }
  1532. // Context sets the context to be used in this call's Do method. Any
  1533. // pending HTTP request will be aborted if the provided context is
  1534. // canceled.
  1535. func (c *OrganizationsSetIamPolicyCall) Context(ctx context.Context) *OrganizationsSetIamPolicyCall {
  1536. c.ctx_ = ctx
  1537. return c
  1538. }
  1539. // Header returns an http.Header that can be modified by the caller to
  1540. // add HTTP headers to the request.
  1541. func (c *OrganizationsSetIamPolicyCall) Header() http.Header {
  1542. if c.header_ == nil {
  1543. c.header_ = make(http.Header)
  1544. }
  1545. return c.header_
  1546. }
  1547. func (c *OrganizationsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1548. reqHeaders := make(http.Header)
  1549. for k, v := range c.header_ {
  1550. reqHeaders[k] = v
  1551. }
  1552. reqHeaders.Set("User-Agent", c.s.userAgent())
  1553. var body io.Reader = nil
  1554. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  1555. if err != nil {
  1556. return nil, err
  1557. }
  1558. reqHeaders.Set("Content-Type", "application/json")
  1559. c.urlParams_.Set("alt", alt)
  1560. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:setIamPolicy")
  1561. urls += "?" + c.urlParams_.Encode()
  1562. req, _ := http.NewRequest("POST", urls, body)
  1563. req.Header = reqHeaders
  1564. googleapi.Expand(req.URL, map[string]string{
  1565. "resource": c.resource,
  1566. })
  1567. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1568. }
  1569. // Do executes the "cloudresourcemanager.organizations.setIamPolicy" call.
  1570. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1571. // code is an error. Response headers are in either
  1572. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1573. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1574. // check whether the returned error was because http.StatusNotModified
  1575. // was returned.
  1576. func (c *OrganizationsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1577. gensupport.SetOptions(c.urlParams_, opts...)
  1578. res, err := c.doRequest("json")
  1579. if res != nil && res.StatusCode == http.StatusNotModified {
  1580. if res.Body != nil {
  1581. res.Body.Close()
  1582. }
  1583. return nil, &googleapi.Error{
  1584. Code: res.StatusCode,
  1585. Header: res.Header,
  1586. }
  1587. }
  1588. if err != nil {
  1589. return nil, err
  1590. }
  1591. defer googleapi.CloseBody(res)
  1592. if err := googleapi.CheckResponse(res); err != nil {
  1593. return nil, err
  1594. }
  1595. ret := &Policy{
  1596. ServerResponse: googleapi.ServerResponse{
  1597. Header: res.Header,
  1598. HTTPStatusCode: res.StatusCode,
  1599. },
  1600. }
  1601. target := &ret
  1602. if err := gensupport.DecodeResponse(target, res); err != nil {
  1603. return nil, err
  1604. }
  1605. return ret, nil
  1606. // {
  1607. // "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\".",
  1608. // "flatPath": "v1beta1/organizations/{organizationsId}:setIamPolicy",
  1609. // "httpMethod": "POST",
  1610. // "id": "cloudresourcemanager.organizations.setIamPolicy",
  1611. // "parameterOrder": [
  1612. // "resource"
  1613. // ],
  1614. // "parameters": {
  1615. // "resource": {
  1616. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  1617. // "location": "path",
  1618. // "pattern": "^organizations/[^/]+$",
  1619. // "required": true,
  1620. // "type": "string"
  1621. // }
  1622. // },
  1623. // "path": "v1beta1/{+resource}:setIamPolicy",
  1624. // "request": {
  1625. // "$ref": "SetIamPolicyRequest"
  1626. // },
  1627. // "response": {
  1628. // "$ref": "Policy"
  1629. // },
  1630. // "scopes": [
  1631. // "https://www.googleapis.com/auth/cloud-platform"
  1632. // ]
  1633. // }
  1634. }
  1635. // method id "cloudresourcemanager.organizations.testIamPermissions":
  1636. type OrganizationsTestIamPermissionsCall struct {
  1637. s *Service
  1638. resource string
  1639. testiampermissionsrequest *TestIamPermissionsRequest
  1640. urlParams_ gensupport.URLParams
  1641. ctx_ context.Context
  1642. header_ http.Header
  1643. }
  1644. // TestIamPermissions: Returns permissions that a caller has on the
  1645. // specified Organization.
  1646. // The `resource` field should be the organization's resource name,
  1647. // e.g. "organizations/123".
  1648. func (r *OrganizationsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *OrganizationsTestIamPermissionsCall {
  1649. c := &OrganizationsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1650. c.resource = resource
  1651. c.testiampermissionsrequest = testiampermissionsrequest
  1652. return c
  1653. }
  1654. // Fields allows partial responses to be retrieved. See
  1655. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1656. // for more information.
  1657. func (c *OrganizationsTestIamPermissionsCall) Fields(s ...googleapi.Field) *OrganizationsTestIamPermissionsCall {
  1658. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1659. return c
  1660. }
  1661. // Context sets the context to be used in this call's Do method. Any
  1662. // pending HTTP request will be aborted if the provided context is
  1663. // canceled.
  1664. func (c *OrganizationsTestIamPermissionsCall) Context(ctx context.Context) *OrganizationsTestIamPermissionsCall {
  1665. c.ctx_ = ctx
  1666. return c
  1667. }
  1668. // Header returns an http.Header that can be modified by the caller to
  1669. // add HTTP headers to the request.
  1670. func (c *OrganizationsTestIamPermissionsCall) Header() http.Header {
  1671. if c.header_ == nil {
  1672. c.header_ = make(http.Header)
  1673. }
  1674. return c.header_
  1675. }
  1676. func (c *OrganizationsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  1677. reqHeaders := make(http.Header)
  1678. for k, v := range c.header_ {
  1679. reqHeaders[k] = v
  1680. }
  1681. reqHeaders.Set("User-Agent", c.s.userAgent())
  1682. var body io.Reader = nil
  1683. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  1684. if err != nil {
  1685. return nil, err
  1686. }
  1687. reqHeaders.Set("Content-Type", "application/json")
  1688. c.urlParams_.Set("alt", alt)
  1689. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:testIamPermissions")
  1690. urls += "?" + c.urlParams_.Encode()
  1691. req, _ := http.NewRequest("POST", urls, body)
  1692. req.Header = reqHeaders
  1693. googleapi.Expand(req.URL, map[string]string{
  1694. "resource": c.resource,
  1695. })
  1696. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1697. }
  1698. // Do executes the "cloudresourcemanager.organizations.testIamPermissions" call.
  1699. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  1700. // Any non-2xx status code is an error. Response headers are in either
  1701. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  1702. // was returned at all) in error.(*googleapi.Error).Header. Use
  1703. // googleapi.IsNotModified to check whether the returned error was
  1704. // because http.StatusNotModified was returned.
  1705. func (c *OrganizationsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  1706. gensupport.SetOptions(c.urlParams_, opts...)
  1707. res, err := c.doRequest("json")
  1708. if res != nil && res.StatusCode == http.StatusNotModified {
  1709. if res.Body != nil {
  1710. res.Body.Close()
  1711. }
  1712. return nil, &googleapi.Error{
  1713. Code: res.StatusCode,
  1714. Header: res.Header,
  1715. }
  1716. }
  1717. if err != nil {
  1718. return nil, err
  1719. }
  1720. defer googleapi.CloseBody(res)
  1721. if err := googleapi.CheckResponse(res); err != nil {
  1722. return nil, err
  1723. }
  1724. ret := &TestIamPermissionsResponse{
  1725. ServerResponse: googleapi.ServerResponse{
  1726. Header: res.Header,
  1727. HTTPStatusCode: res.StatusCode,
  1728. },
  1729. }
  1730. target := &ret
  1731. if err := gensupport.DecodeResponse(target, res); err != nil {
  1732. return nil, err
  1733. }
  1734. return ret, nil
  1735. // {
  1736. // "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\".",
  1737. // "flatPath": "v1beta1/organizations/{organizationsId}:testIamPermissions",
  1738. // "httpMethod": "POST",
  1739. // "id": "cloudresourcemanager.organizations.testIamPermissions",
  1740. // "parameterOrder": [
  1741. // "resource"
  1742. // ],
  1743. // "parameters": {
  1744. // "resource": {
  1745. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1746. // "location": "path",
  1747. // "pattern": "^organizations/[^/]+$",
  1748. // "required": true,
  1749. // "type": "string"
  1750. // }
  1751. // },
  1752. // "path": "v1beta1/{+resource}:testIamPermissions",
  1753. // "request": {
  1754. // "$ref": "TestIamPermissionsRequest"
  1755. // },
  1756. // "response": {
  1757. // "$ref": "TestIamPermissionsResponse"
  1758. // },
  1759. // "scopes": [
  1760. // "https://www.googleapis.com/auth/cloud-platform",
  1761. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1762. // ]
  1763. // }
  1764. }
  1765. // method id "cloudresourcemanager.organizations.update":
  1766. type OrganizationsUpdateCall struct {
  1767. s *Service
  1768. name string
  1769. organization *Organization
  1770. urlParams_ gensupport.URLParams
  1771. ctx_ context.Context
  1772. header_ http.Header
  1773. }
  1774. // Update: Updates an Organization resource identified by the specified
  1775. // resource name.
  1776. func (r *OrganizationsService) Update(name string, organization *Organization) *OrganizationsUpdateCall {
  1777. c := &OrganizationsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1778. c.name = name
  1779. c.organization = organization
  1780. return c
  1781. }
  1782. // Fields allows partial responses to be retrieved. See
  1783. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1784. // for more information.
  1785. func (c *OrganizationsUpdateCall) Fields(s ...googleapi.Field) *OrganizationsUpdateCall {
  1786. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1787. return c
  1788. }
  1789. // Context sets the context to be used in this call's Do method. Any
  1790. // pending HTTP request will be aborted if the provided context is
  1791. // canceled.
  1792. func (c *OrganizationsUpdateCall) Context(ctx context.Context) *OrganizationsUpdateCall {
  1793. c.ctx_ = ctx
  1794. return c
  1795. }
  1796. // Header returns an http.Header that can be modified by the caller to
  1797. // add HTTP headers to the request.
  1798. func (c *OrganizationsUpdateCall) Header() http.Header {
  1799. if c.header_ == nil {
  1800. c.header_ = make(http.Header)
  1801. }
  1802. return c.header_
  1803. }
  1804. func (c *OrganizationsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1805. reqHeaders := make(http.Header)
  1806. for k, v := range c.header_ {
  1807. reqHeaders[k] = v
  1808. }
  1809. reqHeaders.Set("User-Agent", c.s.userAgent())
  1810. var body io.Reader = nil
  1811. body, err := googleapi.WithoutDataWrapper.JSONReader(c.organization)
  1812. if err != nil {
  1813. return nil, err
  1814. }
  1815. reqHeaders.Set("Content-Type", "application/json")
  1816. c.urlParams_.Set("alt", alt)
  1817. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1818. urls += "?" + c.urlParams_.Encode()
  1819. req, _ := http.NewRequest("PUT", urls, body)
  1820. req.Header = reqHeaders
  1821. googleapi.Expand(req.URL, map[string]string{
  1822. "name": c.name,
  1823. })
  1824. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1825. }
  1826. // Do executes the "cloudresourcemanager.organizations.update" call.
  1827. // Exactly one of *Organization or error will be non-nil. Any non-2xx
  1828. // status code is an error. Response headers are in either
  1829. // *Organization.ServerResponse.Header or (if a response was returned at
  1830. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1831. // to check whether the returned error was because
  1832. // http.StatusNotModified was returned.
  1833. func (c *OrganizationsUpdateCall) Do(opts ...googleapi.CallOption) (*Organization, error) {
  1834. gensupport.SetOptions(c.urlParams_, opts...)
  1835. res, err := c.doRequest("json")
  1836. if res != nil && res.StatusCode == http.StatusNotModified {
  1837. if res.Body != nil {
  1838. res.Body.Close()
  1839. }
  1840. return nil, &googleapi.Error{
  1841. Code: res.StatusCode,
  1842. Header: res.Header,
  1843. }
  1844. }
  1845. if err != nil {
  1846. return nil, err
  1847. }
  1848. defer googleapi.CloseBody(res)
  1849. if err := googleapi.CheckResponse(res); err != nil {
  1850. return nil, err
  1851. }
  1852. ret := &Organization{
  1853. ServerResponse: googleapi.ServerResponse{
  1854. Header: res.Header,
  1855. HTTPStatusCode: res.StatusCode,
  1856. },
  1857. }
  1858. target := &ret
  1859. if err := gensupport.DecodeResponse(target, res); err != nil {
  1860. return nil, err
  1861. }
  1862. return ret, nil
  1863. // {
  1864. // "description": "Updates an Organization resource identified by the specified resource name.",
  1865. // "flatPath": "v1beta1/organizations/{organizationsId}",
  1866. // "httpMethod": "PUT",
  1867. // "id": "cloudresourcemanager.organizations.update",
  1868. // "parameterOrder": [
  1869. // "name"
  1870. // ],
  1871. // "parameters": {
  1872. // "name": {
  1873. // "description": "Output Only. The resource name of the organization. This is the\norganization's relative path in the API. Its format is\n\"organizations/[organization_id]\". For example, \"organizations/1234\".",
  1874. // "location": "path",
  1875. // "pattern": "^organizations/[^/]+$",
  1876. // "required": true,
  1877. // "type": "string"
  1878. // }
  1879. // },
  1880. // "path": "v1beta1/{+name}",
  1881. // "request": {
  1882. // "$ref": "Organization"
  1883. // },
  1884. // "response": {
  1885. // "$ref": "Organization"
  1886. // },
  1887. // "scopes": [
  1888. // "https://www.googleapis.com/auth/cloud-platform"
  1889. // ]
  1890. // }
  1891. }
  1892. // method id "cloudresourcemanager.projects.create":
  1893. type ProjectsCreateCall struct {
  1894. s *Service
  1895. project *Project
  1896. urlParams_ gensupport.URLParams
  1897. ctx_ context.Context
  1898. header_ http.Header
  1899. }
  1900. // Create: Creates a Project resource.
  1901. //
  1902. // Initially, the Project resource is owned by its creator
  1903. // exclusively.
  1904. // The creator can later grant permission to others to read or update
  1905. // the
  1906. // Project.
  1907. //
  1908. // Several APIs are activated automatically for the Project,
  1909. // including
  1910. // Google Cloud Storage. The parent is identified by a
  1911. // specified
  1912. // ResourceId, which must include both an ID and a type, such
  1913. // as
  1914. // project, folder, or organization.
  1915. //
  1916. // This method does not associate the new project with a billing
  1917. // account.
  1918. // You can set or update the billing account associated with a project
  1919. // using
  1920. // the
  1921. // [`projects.updateBillingInfo`]
  1922. // (/billing/reference/rest/v1/projects/up
  1923. // dateBillingInfo) method.
  1924. func (r *ProjectsService) Create(project *Project) *ProjectsCreateCall {
  1925. c := &ProjectsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1926. c.project = project
  1927. return c
  1928. }
  1929. // UseLegacyStack sets the optional parameter "useLegacyStack": A safety
  1930. // hatch to opt out of the new reliable project creation process.
  1931. func (c *ProjectsCreateCall) UseLegacyStack(useLegacyStack bool) *ProjectsCreateCall {
  1932. c.urlParams_.Set("useLegacyStack", fmt.Sprint(useLegacyStack))
  1933. return c
  1934. }
  1935. // Fields allows partial responses to be retrieved. See
  1936. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1937. // for more information.
  1938. func (c *ProjectsCreateCall) Fields(s ...googleapi.Field) *ProjectsCreateCall {
  1939. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1940. return c
  1941. }
  1942. // Context sets the context to be used in this call's Do method. Any
  1943. // pending HTTP request will be aborted if the provided context is
  1944. // canceled.
  1945. func (c *ProjectsCreateCall) Context(ctx context.Context) *ProjectsCreateCall {
  1946. c.ctx_ = ctx
  1947. return c
  1948. }
  1949. // Header returns an http.Header that can be modified by the caller to
  1950. // add HTTP headers to the request.
  1951. func (c *ProjectsCreateCall) Header() http.Header {
  1952. if c.header_ == nil {
  1953. c.header_ = make(http.Header)
  1954. }
  1955. return c.header_
  1956. }
  1957. func (c *ProjectsCreateCall) doRequest(alt string) (*http.Response, error) {
  1958. reqHeaders := make(http.Header)
  1959. for k, v := range c.header_ {
  1960. reqHeaders[k] = v
  1961. }
  1962. reqHeaders.Set("User-Agent", c.s.userAgent())
  1963. var body io.Reader = nil
  1964. body, err := googleapi.WithoutDataWrapper.JSONReader(c.project)
  1965. if err != nil {
  1966. return nil, err
  1967. }
  1968. reqHeaders.Set("Content-Type", "application/json")
  1969. c.urlParams_.Set("alt", alt)
  1970. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects")
  1971. urls += "?" + c.urlParams_.Encode()
  1972. req, _ := http.NewRequest("POST", urls, body)
  1973. req.Header = reqHeaders
  1974. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1975. }
  1976. // Do executes the "cloudresourcemanager.projects.create" call.
  1977. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  1978. // code is an error. Response headers are in either
  1979. // *Project.ServerResponse.Header or (if a response was returned at all)
  1980. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1981. // check whether the returned error was because http.StatusNotModified
  1982. // was returned.
  1983. func (c *ProjectsCreateCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  1984. gensupport.SetOptions(c.urlParams_, opts...)
  1985. res, err := c.doRequest("json")
  1986. if res != nil && res.StatusCode == http.StatusNotModified {
  1987. if res.Body != nil {
  1988. res.Body.Close()
  1989. }
  1990. return nil, &googleapi.Error{
  1991. Code: res.StatusCode,
  1992. Header: res.Header,
  1993. }
  1994. }
  1995. if err != nil {
  1996. return nil, err
  1997. }
  1998. defer googleapi.CloseBody(res)
  1999. if err := googleapi.CheckResponse(res); err != nil {
  2000. return nil, err
  2001. }
  2002. ret := &Project{
  2003. ServerResponse: googleapi.ServerResponse{
  2004. Header: res.Header,
  2005. HTTPStatusCode: res.StatusCode,
  2006. },
  2007. }
  2008. target := &ret
  2009. if err := gensupport.DecodeResponse(target, res); err != nil {
  2010. return nil, err
  2011. }
  2012. return ret, nil
  2013. // {
  2014. // "description": "Creates a Project resource.\n\nInitially, the Project resource is owned by its creator exclusively.\nThe creator can later grant permission to others to read or update the\nProject.\n\nSeveral APIs are activated automatically for the Project, including\nGoogle Cloud Storage. The parent is identified by a specified\nResourceId, which must include both an ID and a type, such as\nproject, folder, or 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.",
  2015. // "flatPath": "v1beta1/projects",
  2016. // "httpMethod": "POST",
  2017. // "id": "cloudresourcemanager.projects.create",
  2018. // "parameterOrder": [],
  2019. // "parameters": {
  2020. // "useLegacyStack": {
  2021. // "description": "A safety hatch to opt out of the new reliable project creation process.",
  2022. // "location": "query",
  2023. // "type": "boolean"
  2024. // }
  2025. // },
  2026. // "path": "v1beta1/projects",
  2027. // "request": {
  2028. // "$ref": "Project"
  2029. // },
  2030. // "response": {
  2031. // "$ref": "Project"
  2032. // },
  2033. // "scopes": [
  2034. // "https://www.googleapis.com/auth/cloud-platform"
  2035. // ]
  2036. // }
  2037. }
  2038. // method id "cloudresourcemanager.projects.delete":
  2039. type ProjectsDeleteCall struct {
  2040. s *Service
  2041. projectId string
  2042. urlParams_ gensupport.URLParams
  2043. ctx_ context.Context
  2044. header_ http.Header
  2045. }
  2046. // Delete: Marks the Project identified by the specified
  2047. // `project_id` (for example, `my-project-123`) for deletion.
  2048. // This method will only affect the Project if it has a lifecycle state
  2049. // of
  2050. // ACTIVE.
  2051. //
  2052. // This method changes the Project's lifecycle state from
  2053. // ACTIVE
  2054. // to DELETE_REQUESTED.
  2055. // The deletion starts at an unspecified time, at which point the
  2056. // project is
  2057. // no longer accessible.
  2058. //
  2059. // Until the deletion completes, you can check the lifecycle
  2060. // state
  2061. // checked by retrieving the Project with GetProject,
  2062. // and the Project remains visible to ListProjects.
  2063. // However, you cannot update the project.
  2064. //
  2065. // After the deletion completes, the Project is not retrievable by
  2066. // the GetProject and
  2067. // ListProjects methods.
  2068. //
  2069. // The caller must have modify permissions for this Project.
  2070. func (r *ProjectsService) Delete(projectId string) *ProjectsDeleteCall {
  2071. c := &ProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2072. c.projectId = projectId
  2073. return c
  2074. }
  2075. // Fields allows partial responses to be retrieved. See
  2076. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2077. // for more information.
  2078. func (c *ProjectsDeleteCall) Fields(s ...googleapi.Field) *ProjectsDeleteCall {
  2079. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2080. return c
  2081. }
  2082. // Context sets the context to be used in this call's Do method. Any
  2083. // pending HTTP request will be aborted if the provided context is
  2084. // canceled.
  2085. func (c *ProjectsDeleteCall) Context(ctx context.Context) *ProjectsDeleteCall {
  2086. c.ctx_ = ctx
  2087. return c
  2088. }
  2089. // Header returns an http.Header that can be modified by the caller to
  2090. // add HTTP headers to the request.
  2091. func (c *ProjectsDeleteCall) Header() http.Header {
  2092. if c.header_ == nil {
  2093. c.header_ = make(http.Header)
  2094. }
  2095. return c.header_
  2096. }
  2097. func (c *ProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2098. reqHeaders := make(http.Header)
  2099. for k, v := range c.header_ {
  2100. reqHeaders[k] = v
  2101. }
  2102. reqHeaders.Set("User-Agent", c.s.userAgent())
  2103. var body io.Reader = nil
  2104. c.urlParams_.Set("alt", alt)
  2105. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}")
  2106. urls += "?" + c.urlParams_.Encode()
  2107. req, _ := http.NewRequest("DELETE", urls, body)
  2108. req.Header = reqHeaders
  2109. googleapi.Expand(req.URL, map[string]string{
  2110. "projectId": c.projectId,
  2111. })
  2112. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2113. }
  2114. // Do executes the "cloudresourcemanager.projects.delete" call.
  2115. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2116. // code is an error. Response headers are in either
  2117. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2118. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2119. // check whether the returned error was because http.StatusNotModified
  2120. // was returned.
  2121. func (c *ProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2122. gensupport.SetOptions(c.urlParams_, opts...)
  2123. res, err := c.doRequest("json")
  2124. if res != nil && res.StatusCode == http.StatusNotModified {
  2125. if res.Body != nil {
  2126. res.Body.Close()
  2127. }
  2128. return nil, &googleapi.Error{
  2129. Code: res.StatusCode,
  2130. Header: res.Header,
  2131. }
  2132. }
  2133. if err != nil {
  2134. return nil, err
  2135. }
  2136. defer googleapi.CloseBody(res)
  2137. if err := googleapi.CheckResponse(res); err != nil {
  2138. return nil, err
  2139. }
  2140. ret := &Empty{
  2141. ServerResponse: googleapi.ServerResponse{
  2142. Header: res.Header,
  2143. HTTPStatusCode: res.StatusCode,
  2144. },
  2145. }
  2146. target := &ret
  2147. if err := gensupport.DecodeResponse(target, res); err != nil {
  2148. return nil, err
  2149. }
  2150. return ret, nil
  2151. // {
  2152. // "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, at which point the project is\nno 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.",
  2153. // "flatPath": "v1beta1/projects/{projectId}",
  2154. // "httpMethod": "DELETE",
  2155. // "id": "cloudresourcemanager.projects.delete",
  2156. // "parameterOrder": [
  2157. // "projectId"
  2158. // ],
  2159. // "parameters": {
  2160. // "projectId": {
  2161. // "description": "The Project ID (for example, `foo-bar-123`).\n\nRequired.",
  2162. // "location": "path",
  2163. // "required": true,
  2164. // "type": "string"
  2165. // }
  2166. // },
  2167. // "path": "v1beta1/projects/{projectId}",
  2168. // "response": {
  2169. // "$ref": "Empty"
  2170. // },
  2171. // "scopes": [
  2172. // "https://www.googleapis.com/auth/cloud-platform"
  2173. // ]
  2174. // }
  2175. }
  2176. // method id "cloudresourcemanager.projects.get":
  2177. type ProjectsGetCall struct {
  2178. s *Service
  2179. projectId string
  2180. urlParams_ gensupport.URLParams
  2181. ifNoneMatch_ string
  2182. ctx_ context.Context
  2183. header_ http.Header
  2184. }
  2185. // Get: Retrieves the Project identified by the specified
  2186. // `project_id` (for example, `my-project-123`).
  2187. //
  2188. // The caller must have read permissions for this Project.
  2189. func (r *ProjectsService) Get(projectId string) *ProjectsGetCall {
  2190. c := &ProjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2191. c.projectId = projectId
  2192. return c
  2193. }
  2194. // Fields allows partial responses to be retrieved. See
  2195. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2196. // for more information.
  2197. func (c *ProjectsGetCall) Fields(s ...googleapi.Field) *ProjectsGetCall {
  2198. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2199. return c
  2200. }
  2201. // IfNoneMatch sets the optional parameter which makes the operation
  2202. // fail if the object's ETag matches the given value. This is useful for
  2203. // getting updates only after the object has changed since the last
  2204. // request. Use googleapi.IsNotModified to check whether the response
  2205. // error from Do is the result of In-None-Match.
  2206. func (c *ProjectsGetCall) IfNoneMatch(entityTag string) *ProjectsGetCall {
  2207. c.ifNoneMatch_ = entityTag
  2208. return c
  2209. }
  2210. // Context sets the context to be used in this call's Do method. Any
  2211. // pending HTTP request will be aborted if the provided context is
  2212. // canceled.
  2213. func (c *ProjectsGetCall) Context(ctx context.Context) *ProjectsGetCall {
  2214. c.ctx_ = ctx
  2215. return c
  2216. }
  2217. // Header returns an http.Header that can be modified by the caller to
  2218. // add HTTP headers to the request.
  2219. func (c *ProjectsGetCall) Header() http.Header {
  2220. if c.header_ == nil {
  2221. c.header_ = make(http.Header)
  2222. }
  2223. return c.header_
  2224. }
  2225. func (c *ProjectsGetCall) doRequest(alt string) (*http.Response, error) {
  2226. reqHeaders := make(http.Header)
  2227. for k, v := range c.header_ {
  2228. reqHeaders[k] = v
  2229. }
  2230. reqHeaders.Set("User-Agent", c.s.userAgent())
  2231. if c.ifNoneMatch_ != "" {
  2232. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2233. }
  2234. var body io.Reader = nil
  2235. c.urlParams_.Set("alt", alt)
  2236. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}")
  2237. urls += "?" + c.urlParams_.Encode()
  2238. req, _ := http.NewRequest("GET", urls, body)
  2239. req.Header = reqHeaders
  2240. googleapi.Expand(req.URL, map[string]string{
  2241. "projectId": c.projectId,
  2242. })
  2243. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2244. }
  2245. // Do executes the "cloudresourcemanager.projects.get" call.
  2246. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  2247. // code is an error. Response headers are in either
  2248. // *Project.ServerResponse.Header or (if a response was returned at all)
  2249. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2250. // check whether the returned error was because http.StatusNotModified
  2251. // was returned.
  2252. func (c *ProjectsGetCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  2253. gensupport.SetOptions(c.urlParams_, opts...)
  2254. res, err := c.doRequest("json")
  2255. if res != nil && res.StatusCode == http.StatusNotModified {
  2256. if res.Body != nil {
  2257. res.Body.Close()
  2258. }
  2259. return nil, &googleapi.Error{
  2260. Code: res.StatusCode,
  2261. Header: res.Header,
  2262. }
  2263. }
  2264. if err != nil {
  2265. return nil, err
  2266. }
  2267. defer googleapi.CloseBody(res)
  2268. if err := googleapi.CheckResponse(res); err != nil {
  2269. return nil, err
  2270. }
  2271. ret := &Project{
  2272. ServerResponse: googleapi.ServerResponse{
  2273. Header: res.Header,
  2274. HTTPStatusCode: res.StatusCode,
  2275. },
  2276. }
  2277. target := &ret
  2278. if err := gensupport.DecodeResponse(target, res); err != nil {
  2279. return nil, err
  2280. }
  2281. return ret, nil
  2282. // {
  2283. // "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.",
  2284. // "flatPath": "v1beta1/projects/{projectId}",
  2285. // "httpMethod": "GET",
  2286. // "id": "cloudresourcemanager.projects.get",
  2287. // "parameterOrder": [
  2288. // "projectId"
  2289. // ],
  2290. // "parameters": {
  2291. // "projectId": {
  2292. // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.",
  2293. // "location": "path",
  2294. // "required": true,
  2295. // "type": "string"
  2296. // }
  2297. // },
  2298. // "path": "v1beta1/projects/{projectId}",
  2299. // "response": {
  2300. // "$ref": "Project"
  2301. // },
  2302. // "scopes": [
  2303. // "https://www.googleapis.com/auth/cloud-platform",
  2304. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2305. // ]
  2306. // }
  2307. }
  2308. // method id "cloudresourcemanager.projects.getAncestry":
  2309. type ProjectsGetAncestryCall struct {
  2310. s *Service
  2311. projectId string
  2312. getancestryrequest *GetAncestryRequest
  2313. urlParams_ gensupport.URLParams
  2314. ctx_ context.Context
  2315. header_ http.Header
  2316. }
  2317. // GetAncestry: Gets a list of ancestors in the resource hierarchy for
  2318. // the Project
  2319. // identified by the specified `project_id` (for example,
  2320. // `my-project-123`).
  2321. //
  2322. // The caller must have read permissions for this Project.
  2323. func (r *ProjectsService) GetAncestry(projectId string, getancestryrequest *GetAncestryRequest) *ProjectsGetAncestryCall {
  2324. c := &ProjectsGetAncestryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2325. c.projectId = projectId
  2326. c.getancestryrequest = getancestryrequest
  2327. return c
  2328. }
  2329. // Fields allows partial responses to be retrieved. See
  2330. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2331. // for more information.
  2332. func (c *ProjectsGetAncestryCall) Fields(s ...googleapi.Field) *ProjectsGetAncestryCall {
  2333. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2334. return c
  2335. }
  2336. // Context sets the context to be used in this call's Do method. Any
  2337. // pending HTTP request will be aborted if the provided context is
  2338. // canceled.
  2339. func (c *ProjectsGetAncestryCall) Context(ctx context.Context) *ProjectsGetAncestryCall {
  2340. c.ctx_ = ctx
  2341. return c
  2342. }
  2343. // Header returns an http.Header that can be modified by the caller to
  2344. // add HTTP headers to the request.
  2345. func (c *ProjectsGetAncestryCall) Header() http.Header {
  2346. if c.header_ == nil {
  2347. c.header_ = make(http.Header)
  2348. }
  2349. return c.header_
  2350. }
  2351. func (c *ProjectsGetAncestryCall) doRequest(alt string) (*http.Response, error) {
  2352. reqHeaders := make(http.Header)
  2353. for k, v := range c.header_ {
  2354. reqHeaders[k] = v
  2355. }
  2356. reqHeaders.Set("User-Agent", c.s.userAgent())
  2357. var body io.Reader = nil
  2358. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getancestryrequest)
  2359. if err != nil {
  2360. return nil, err
  2361. }
  2362. reqHeaders.Set("Content-Type", "application/json")
  2363. c.urlParams_.Set("alt", alt)
  2364. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}:getAncestry")
  2365. urls += "?" + c.urlParams_.Encode()
  2366. req, _ := http.NewRequest("POST", urls, body)
  2367. req.Header = reqHeaders
  2368. googleapi.Expand(req.URL, map[string]string{
  2369. "projectId": c.projectId,
  2370. })
  2371. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2372. }
  2373. // Do executes the "cloudresourcemanager.projects.getAncestry" call.
  2374. // Exactly one of *GetAncestryResponse or error will be non-nil. Any
  2375. // non-2xx status code is an error. Response headers are in either
  2376. // *GetAncestryResponse.ServerResponse.Header or (if a response was
  2377. // returned at all) in error.(*googleapi.Error).Header. Use
  2378. // googleapi.IsNotModified to check whether the returned error was
  2379. // because http.StatusNotModified was returned.
  2380. func (c *ProjectsGetAncestryCall) Do(opts ...googleapi.CallOption) (*GetAncestryResponse, error) {
  2381. gensupport.SetOptions(c.urlParams_, opts...)
  2382. res, err := c.doRequest("json")
  2383. if res != nil && res.StatusCode == http.StatusNotModified {
  2384. if res.Body != nil {
  2385. res.Body.Close()
  2386. }
  2387. return nil, &googleapi.Error{
  2388. Code: res.StatusCode,
  2389. Header: res.Header,
  2390. }
  2391. }
  2392. if err != nil {
  2393. return nil, err
  2394. }
  2395. defer googleapi.CloseBody(res)
  2396. if err := googleapi.CheckResponse(res); err != nil {
  2397. return nil, err
  2398. }
  2399. ret := &GetAncestryResponse{
  2400. ServerResponse: googleapi.ServerResponse{
  2401. Header: res.Header,
  2402. HTTPStatusCode: res.StatusCode,
  2403. },
  2404. }
  2405. target := &ret
  2406. if err := gensupport.DecodeResponse(target, res); err != nil {
  2407. return nil, err
  2408. }
  2409. return ret, nil
  2410. // {
  2411. // "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.",
  2412. // "flatPath": "v1beta1/projects/{projectId}:getAncestry",
  2413. // "httpMethod": "POST",
  2414. // "id": "cloudresourcemanager.projects.getAncestry",
  2415. // "parameterOrder": [
  2416. // "projectId"
  2417. // ],
  2418. // "parameters": {
  2419. // "projectId": {
  2420. // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.",
  2421. // "location": "path",
  2422. // "required": true,
  2423. // "type": "string"
  2424. // }
  2425. // },
  2426. // "path": "v1beta1/projects/{projectId}:getAncestry",
  2427. // "request": {
  2428. // "$ref": "GetAncestryRequest"
  2429. // },
  2430. // "response": {
  2431. // "$ref": "GetAncestryResponse"
  2432. // },
  2433. // "scopes": [
  2434. // "https://www.googleapis.com/auth/cloud-platform",
  2435. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2436. // ]
  2437. // }
  2438. }
  2439. // method id "cloudresourcemanager.projects.getIamPolicy":
  2440. type ProjectsGetIamPolicyCall struct {
  2441. s *Service
  2442. resource string
  2443. getiampolicyrequest *GetIamPolicyRequest
  2444. urlParams_ gensupport.URLParams
  2445. ctx_ context.Context
  2446. header_ http.Header
  2447. }
  2448. // GetIamPolicy: Returns the IAM access control policy for the specified
  2449. // Project.
  2450. // Permission is denied if the policy or the resource does not
  2451. // exist.
  2452. //
  2453. // For additional information about resource structure and
  2454. // identification,
  2455. // see [Resource Names](/apis/design/resource_names).
  2456. func (r *ProjectsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsGetIamPolicyCall {
  2457. c := &ProjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2458. c.resource = resource
  2459. c.getiampolicyrequest = getiampolicyrequest
  2460. return c
  2461. }
  2462. // Fields allows partial responses to be retrieved. See
  2463. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2464. // for more information.
  2465. func (c *ProjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetIamPolicyCall {
  2466. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2467. return c
  2468. }
  2469. // Context sets the context to be used in this call's Do method. Any
  2470. // pending HTTP request will be aborted if the provided context is
  2471. // canceled.
  2472. func (c *ProjectsGetIamPolicyCall) Context(ctx context.Context) *ProjectsGetIamPolicyCall {
  2473. c.ctx_ = ctx
  2474. return c
  2475. }
  2476. // Header returns an http.Header that can be modified by the caller to
  2477. // add HTTP headers to the request.
  2478. func (c *ProjectsGetIamPolicyCall) Header() http.Header {
  2479. if c.header_ == nil {
  2480. c.header_ = make(http.Header)
  2481. }
  2482. return c.header_
  2483. }
  2484. func (c *ProjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2485. reqHeaders := make(http.Header)
  2486. for k, v := range c.header_ {
  2487. reqHeaders[k] = v
  2488. }
  2489. reqHeaders.Set("User-Agent", c.s.userAgent())
  2490. var body io.Reader = nil
  2491. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  2492. if err != nil {
  2493. return nil, err
  2494. }
  2495. reqHeaders.Set("Content-Type", "application/json")
  2496. c.urlParams_.Set("alt", alt)
  2497. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{resource}:getIamPolicy")
  2498. urls += "?" + c.urlParams_.Encode()
  2499. req, _ := http.NewRequest("POST", urls, body)
  2500. req.Header = reqHeaders
  2501. googleapi.Expand(req.URL, map[string]string{
  2502. "resource": c.resource,
  2503. })
  2504. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2505. }
  2506. // Do executes the "cloudresourcemanager.projects.getIamPolicy" call.
  2507. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2508. // code is an error. Response headers are in either
  2509. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2510. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2511. // check whether the returned error was because http.StatusNotModified
  2512. // was returned.
  2513. func (c *ProjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2514. gensupport.SetOptions(c.urlParams_, opts...)
  2515. res, err := c.doRequest("json")
  2516. if res != nil && res.StatusCode == http.StatusNotModified {
  2517. if res.Body != nil {
  2518. res.Body.Close()
  2519. }
  2520. return nil, &googleapi.Error{
  2521. Code: res.StatusCode,
  2522. Header: res.Header,
  2523. }
  2524. }
  2525. if err != nil {
  2526. return nil, err
  2527. }
  2528. defer googleapi.CloseBody(res)
  2529. if err := googleapi.CheckResponse(res); err != nil {
  2530. return nil, err
  2531. }
  2532. ret := &Policy{
  2533. ServerResponse: googleapi.ServerResponse{
  2534. Header: res.Header,
  2535. HTTPStatusCode: res.StatusCode,
  2536. },
  2537. }
  2538. target := &ret
  2539. if err := gensupport.DecodeResponse(target, res); err != nil {
  2540. return nil, err
  2541. }
  2542. return ret, nil
  2543. // {
  2544. // "description": "Returns the IAM access control policy for the specified Project.\nPermission is denied if the policy or the resource does not exist.\n\nFor additional information about resource structure and identification,\nsee [Resource Names](/apis/design/resource_names).",
  2545. // "flatPath": "v1beta1/projects/{resource}:getIamPolicy",
  2546. // "httpMethod": "POST",
  2547. // "id": "cloudresourcemanager.projects.getIamPolicy",
  2548. // "parameterOrder": [
  2549. // "resource"
  2550. // ],
  2551. // "parameters": {
  2552. // "resource": {
  2553. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2554. // "location": "path",
  2555. // "required": true,
  2556. // "type": "string"
  2557. // }
  2558. // },
  2559. // "path": "v1beta1/projects/{resource}:getIamPolicy",
  2560. // "request": {
  2561. // "$ref": "GetIamPolicyRequest"
  2562. // },
  2563. // "response": {
  2564. // "$ref": "Policy"
  2565. // },
  2566. // "scopes": [
  2567. // "https://www.googleapis.com/auth/cloud-platform",
  2568. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2569. // ]
  2570. // }
  2571. }
  2572. // method id "cloudresourcemanager.projects.list":
  2573. type ProjectsListCall struct {
  2574. s *Service
  2575. urlParams_ gensupport.URLParams
  2576. ifNoneMatch_ string
  2577. ctx_ context.Context
  2578. header_ http.Header
  2579. }
  2580. // List: Lists Projects that are visible to the user and satisfy
  2581. // the
  2582. // specified filter. This method returns Projects in an unspecified
  2583. // order.
  2584. // This method is eventually consistent with project mutations; this
  2585. // means
  2586. // that a newly created project may not appear in the results or
  2587. // recent
  2588. // updates to an existing project may not be reflected in the results.
  2589. // To
  2590. // retrieve the latest state of a project, use the GetProjectmethod.
  2591. func (r *ProjectsService) List() *ProjectsListCall {
  2592. c := &ProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2593. return c
  2594. }
  2595. // Filter sets the optional parameter "filter": An expression for
  2596. // filtering the results of the request. Filter rules are
  2597. // case insensitive. The fields eligible for filtering are:
  2598. //
  2599. // + `name`
  2600. // + `id`
  2601. // + <code>labels.<em>key</em></code> where *key* is the name of a
  2602. // label
  2603. //
  2604. // Some examples of using labels as
  2605. // filters:
  2606. //
  2607. // |Filter|Description|
  2608. // |------|-----------|
  2609. // |name:how*|The project's name starts with "how".|
  2610. // |name:Howl|The project's name is `Howl` or
  2611. // `howl`.|
  2612. // |name:HOWL|Equivalent to above.|
  2613. // |NAME:howl|Equivalent to above.|
  2614. // |labels.color:*|The project has the label
  2615. // `color`.|
  2616. // |labels.color:red|The project's label `color` has the value
  2617. // `red`.|
  2618. // |labels.color:red&nbsp;labels.size:big|The project's label `color`
  2619. // has the value `red` and its label `size` has the value `big`.
  2620. //
  2621. // If you specify a filter that has both `parent.type` and `parent.id`,
  2622. // then
  2623. // the `resourcemanager.projects.list` permission is checked on the
  2624. // parent.
  2625. // If the user has this permission, all projects under the parent will
  2626. // be
  2627. // returned after remaining filters have been applied. If the user lacks
  2628. // this
  2629. // permission, then all projects for which the user has
  2630. // the
  2631. // `resourcemanager.projects.get` permission will be returned after
  2632. // remaining
  2633. // filters have been applied. If no filter is specified, the call will
  2634. // return
  2635. // projects for which the user has `resourcemanager.projects.get`
  2636. // permissions.
  2637. func (c *ProjectsListCall) Filter(filter string) *ProjectsListCall {
  2638. c.urlParams_.Set("filter", filter)
  2639. return c
  2640. }
  2641. // PageSize sets the optional parameter "pageSize": The maximum number
  2642. // of Projects to return in the response.
  2643. // The server can return fewer Projects than requested.
  2644. // If unspecified, server picks an appropriate default.
  2645. func (c *ProjectsListCall) PageSize(pageSize int64) *ProjectsListCall {
  2646. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2647. return c
  2648. }
  2649. // PageToken sets the optional parameter "pageToken": A pagination token
  2650. // returned from a previous call to ListProjects
  2651. // that indicates from where listing should continue.
  2652. func (c *ProjectsListCall) PageToken(pageToken string) *ProjectsListCall {
  2653. c.urlParams_.Set("pageToken", pageToken)
  2654. return c
  2655. }
  2656. // Fields allows partial responses to be retrieved. See
  2657. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2658. // for more information.
  2659. func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {
  2660. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2661. return c
  2662. }
  2663. // IfNoneMatch sets the optional parameter which makes the operation
  2664. // fail if the object's ETag matches the given value. This is useful for
  2665. // getting updates only after the object has changed since the last
  2666. // request. Use googleapi.IsNotModified to check whether the response
  2667. // error from Do is the result of In-None-Match.
  2668. func (c *ProjectsListCall) IfNoneMatch(entityTag string) *ProjectsListCall {
  2669. c.ifNoneMatch_ = entityTag
  2670. return c
  2671. }
  2672. // Context sets the context to be used in this call's Do method. Any
  2673. // pending HTTP request will be aborted if the provided context is
  2674. // canceled.
  2675. func (c *ProjectsListCall) Context(ctx context.Context) *ProjectsListCall {
  2676. c.ctx_ = ctx
  2677. return c
  2678. }
  2679. // Header returns an http.Header that can be modified by the caller to
  2680. // add HTTP headers to the request.
  2681. func (c *ProjectsListCall) Header() http.Header {
  2682. if c.header_ == nil {
  2683. c.header_ = make(http.Header)
  2684. }
  2685. return c.header_
  2686. }
  2687. func (c *ProjectsListCall) doRequest(alt string) (*http.Response, error) {
  2688. reqHeaders := make(http.Header)
  2689. for k, v := range c.header_ {
  2690. reqHeaders[k] = v
  2691. }
  2692. reqHeaders.Set("User-Agent", c.s.userAgent())
  2693. if c.ifNoneMatch_ != "" {
  2694. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2695. }
  2696. var body io.Reader = nil
  2697. c.urlParams_.Set("alt", alt)
  2698. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects")
  2699. urls += "?" + c.urlParams_.Encode()
  2700. req, _ := http.NewRequest("GET", urls, body)
  2701. req.Header = reqHeaders
  2702. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2703. }
  2704. // Do executes the "cloudresourcemanager.projects.list" call.
  2705. // Exactly one of *ListProjectsResponse or error will be non-nil. Any
  2706. // non-2xx status code is an error. Response headers are in either
  2707. // *ListProjectsResponse.ServerResponse.Header or (if a response was
  2708. // returned at all) in error.(*googleapi.Error).Header. Use
  2709. // googleapi.IsNotModified to check whether the returned error was
  2710. // because http.StatusNotModified was returned.
  2711. func (c *ProjectsListCall) Do(opts ...googleapi.CallOption) (*ListProjectsResponse, error) {
  2712. gensupport.SetOptions(c.urlParams_, opts...)
  2713. res, err := c.doRequest("json")
  2714. if res != nil && res.StatusCode == http.StatusNotModified {
  2715. if res.Body != nil {
  2716. res.Body.Close()
  2717. }
  2718. return nil, &googleapi.Error{
  2719. Code: res.StatusCode,
  2720. Header: res.Header,
  2721. }
  2722. }
  2723. if err != nil {
  2724. return nil, err
  2725. }
  2726. defer googleapi.CloseBody(res)
  2727. if err := googleapi.CheckResponse(res); err != nil {
  2728. return nil, err
  2729. }
  2730. ret := &ListProjectsResponse{
  2731. ServerResponse: googleapi.ServerResponse{
  2732. Header: res.Header,
  2733. HTTPStatusCode: res.StatusCode,
  2734. },
  2735. }
  2736. target := &ret
  2737. if err := gensupport.DecodeResponse(target, res); err != nil {
  2738. return nil, err
  2739. }
  2740. return ret, nil
  2741. // {
  2742. // "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 GetProjectmethod.",
  2743. // "flatPath": "v1beta1/projects",
  2744. // "httpMethod": "GET",
  2745. // "id": "cloudresourcemanager.projects.list",
  2746. // "parameterOrder": [],
  2747. // "parameters": {
  2748. // "filter": {
  2749. // "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.",
  2750. // "location": "query",
  2751. // "type": "string"
  2752. // },
  2753. // "pageSize": {
  2754. // "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.",
  2755. // "format": "int32",
  2756. // "location": "query",
  2757. // "type": "integer"
  2758. // },
  2759. // "pageToken": {
  2760. // "description": "A pagination token returned from a previous call to ListProjects\nthat indicates from where listing should continue.\n\nOptional.",
  2761. // "location": "query",
  2762. // "type": "string"
  2763. // }
  2764. // },
  2765. // "path": "v1beta1/projects",
  2766. // "response": {
  2767. // "$ref": "ListProjectsResponse"
  2768. // },
  2769. // "scopes": [
  2770. // "https://www.googleapis.com/auth/cloud-platform",
  2771. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2772. // ]
  2773. // }
  2774. }
  2775. // Pages invokes f for each page of results.
  2776. // A non-nil error returned from f will halt the iteration.
  2777. // The provided context supersedes any context provided to the Context method.
  2778. func (c *ProjectsListCall) Pages(ctx context.Context, f func(*ListProjectsResponse) error) error {
  2779. c.ctx_ = ctx
  2780. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2781. for {
  2782. x, err := c.Do()
  2783. if err != nil {
  2784. return err
  2785. }
  2786. if err := f(x); err != nil {
  2787. return err
  2788. }
  2789. if x.NextPageToken == "" {
  2790. return nil
  2791. }
  2792. c.PageToken(x.NextPageToken)
  2793. }
  2794. }
  2795. // method id "cloudresourcemanager.projects.setIamPolicy":
  2796. type ProjectsSetIamPolicyCall struct {
  2797. s *Service
  2798. resource string
  2799. setiampolicyrequest *SetIamPolicyRequest
  2800. urlParams_ gensupport.URLParams
  2801. ctx_ context.Context
  2802. header_ http.Header
  2803. }
  2804. // SetIamPolicy: Sets the IAM access control policy for the specified
  2805. // Project. Overwrites
  2806. // any existing policy.
  2807. //
  2808. // The following constraints apply when using `setIamPolicy()`:
  2809. //
  2810. // + Project does not support `allUsers` and `allAuthenticatedUsers`
  2811. // as
  2812. // `members` in a `Binding` of a `Policy`.
  2813. //
  2814. // + The owner role can be granted only to `user` and
  2815. // `serviceAccount`.
  2816. //
  2817. // + Service accounts can be made owners of a project directly
  2818. // without any restrictions. However, to be added as an owner, a user
  2819. // must be
  2820. // invited via Cloud Platform console and must accept the invitation.
  2821. //
  2822. // + A user cannot be granted the owner role using `setIamPolicy()`. The
  2823. // user
  2824. // must be granted the owner role using the Cloud Platform Console and
  2825. // must
  2826. // explicitly accept the invitation.
  2827. //
  2828. // + Invitations to grant the owner role cannot be sent
  2829. // using
  2830. // `setIamPolicy()`; they must be sent only using the Cloud Platform
  2831. // Console.
  2832. //
  2833. // + Membership changes that leave the project without any owners that
  2834. // have
  2835. // accepted the Terms of Service (ToS) will be rejected.
  2836. //
  2837. // + If the project is not part of an organization, there must be at
  2838. // least
  2839. // one owner who has accepted the Terms of Service (ToS) agreement in
  2840. // the
  2841. // policy. Calling `setIamPolicy()` to remove the last ToS-accepted
  2842. // owner
  2843. // from the policy will fail. This restriction also applies to
  2844. // legacy
  2845. // projects that no longer have owners who have accepted the ToS. Edits
  2846. // to
  2847. // IAM policies will be rejected until the lack of a ToS-accepting owner
  2848. // is
  2849. // rectified.
  2850. //
  2851. // + This method will replace the existing policy, and cannot be used
  2852. // to
  2853. // append additional IAM settings.
  2854. //
  2855. // Note: Removing service accounts from policies or changing their
  2856. // roles
  2857. // can render services completely inoperable. It is important to
  2858. // understand
  2859. // how the service account is being used before removing or updating
  2860. // its
  2861. // roles.
  2862. func (r *ProjectsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSetIamPolicyCall {
  2863. c := &ProjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2864. c.resource = resource
  2865. c.setiampolicyrequest = setiampolicyrequest
  2866. return c
  2867. }
  2868. // Fields allows partial responses to be retrieved. See
  2869. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2870. // for more information.
  2871. func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall {
  2872. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2873. return c
  2874. }
  2875. // Context sets the context to be used in this call's Do method. Any
  2876. // pending HTTP request will be aborted if the provided context is
  2877. // canceled.
  2878. func (c *ProjectsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSetIamPolicyCall {
  2879. c.ctx_ = ctx
  2880. return c
  2881. }
  2882. // Header returns an http.Header that can be modified by the caller to
  2883. // add HTTP headers to the request.
  2884. func (c *ProjectsSetIamPolicyCall) Header() http.Header {
  2885. if c.header_ == nil {
  2886. c.header_ = make(http.Header)
  2887. }
  2888. return c.header_
  2889. }
  2890. func (c *ProjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2891. reqHeaders := make(http.Header)
  2892. for k, v := range c.header_ {
  2893. reqHeaders[k] = v
  2894. }
  2895. reqHeaders.Set("User-Agent", c.s.userAgent())
  2896. var body io.Reader = nil
  2897. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2898. if err != nil {
  2899. return nil, err
  2900. }
  2901. reqHeaders.Set("Content-Type", "application/json")
  2902. c.urlParams_.Set("alt", alt)
  2903. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{resource}:setIamPolicy")
  2904. urls += "?" + c.urlParams_.Encode()
  2905. req, _ := http.NewRequest("POST", urls, body)
  2906. req.Header = reqHeaders
  2907. googleapi.Expand(req.URL, map[string]string{
  2908. "resource": c.resource,
  2909. })
  2910. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2911. }
  2912. // Do executes the "cloudresourcemanager.projects.setIamPolicy" call.
  2913. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2914. // code is an error. Response headers are in either
  2915. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2916. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2917. // check whether the returned error was because http.StatusNotModified
  2918. // was returned.
  2919. func (c *ProjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2920. gensupport.SetOptions(c.urlParams_, opts...)
  2921. res, err := c.doRequest("json")
  2922. if res != nil && res.StatusCode == http.StatusNotModified {
  2923. if res.Body != nil {
  2924. res.Body.Close()
  2925. }
  2926. return nil, &googleapi.Error{
  2927. Code: res.StatusCode,
  2928. Header: res.Header,
  2929. }
  2930. }
  2931. if err != nil {
  2932. return nil, err
  2933. }
  2934. defer googleapi.CloseBody(res)
  2935. if err := googleapi.CheckResponse(res); err != nil {
  2936. return nil, err
  2937. }
  2938. ret := &Policy{
  2939. ServerResponse: googleapi.ServerResponse{
  2940. Header: res.Header,
  2941. HTTPStatusCode: res.StatusCode,
  2942. },
  2943. }
  2944. target := &ret
  2945. if err := gensupport.DecodeResponse(target, res); err != nil {
  2946. return nil, err
  2947. }
  2948. return ret, nil
  2949. // {
  2950. // "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+ Invitations to grant the owner role cannot be sent using\n`setIamPolicy()`; they must be sent only using the Cloud Platform Console.\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.",
  2951. // "flatPath": "v1beta1/projects/{resource}:setIamPolicy",
  2952. // "httpMethod": "POST",
  2953. // "id": "cloudresourcemanager.projects.setIamPolicy",
  2954. // "parameterOrder": [
  2955. // "resource"
  2956. // ],
  2957. // "parameters": {
  2958. // "resource": {
  2959. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2960. // "location": "path",
  2961. // "required": true,
  2962. // "type": "string"
  2963. // }
  2964. // },
  2965. // "path": "v1beta1/projects/{resource}:setIamPolicy",
  2966. // "request": {
  2967. // "$ref": "SetIamPolicyRequest"
  2968. // },
  2969. // "response": {
  2970. // "$ref": "Policy"
  2971. // },
  2972. // "scopes": [
  2973. // "https://www.googleapis.com/auth/cloud-platform"
  2974. // ]
  2975. // }
  2976. }
  2977. // method id "cloudresourcemanager.projects.testIamPermissions":
  2978. type ProjectsTestIamPermissionsCall struct {
  2979. s *Service
  2980. resource string
  2981. testiampermissionsrequest *TestIamPermissionsRequest
  2982. urlParams_ gensupport.URLParams
  2983. ctx_ context.Context
  2984. header_ http.Header
  2985. }
  2986. // TestIamPermissions: Returns permissions that a caller has on the
  2987. // specified Project.
  2988. func (r *ProjectsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTestIamPermissionsCall {
  2989. c := &ProjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2990. c.resource = resource
  2991. c.testiampermissionsrequest = testiampermissionsrequest
  2992. return c
  2993. }
  2994. // Fields allows partial responses to be retrieved. See
  2995. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2996. // for more information.
  2997. func (c *ProjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTestIamPermissionsCall {
  2998. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2999. return c
  3000. }
  3001. // Context sets the context to be used in this call's Do method. Any
  3002. // pending HTTP request will be aborted if the provided context is
  3003. // canceled.
  3004. func (c *ProjectsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTestIamPermissionsCall {
  3005. c.ctx_ = ctx
  3006. return c
  3007. }
  3008. // Header returns an http.Header that can be modified by the caller to
  3009. // add HTTP headers to the request.
  3010. func (c *ProjectsTestIamPermissionsCall) Header() http.Header {
  3011. if c.header_ == nil {
  3012. c.header_ = make(http.Header)
  3013. }
  3014. return c.header_
  3015. }
  3016. func (c *ProjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  3017. reqHeaders := make(http.Header)
  3018. for k, v := range c.header_ {
  3019. reqHeaders[k] = v
  3020. }
  3021. reqHeaders.Set("User-Agent", c.s.userAgent())
  3022. var body io.Reader = nil
  3023. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  3024. if err != nil {
  3025. return nil, err
  3026. }
  3027. reqHeaders.Set("Content-Type", "application/json")
  3028. c.urlParams_.Set("alt", alt)
  3029. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{resource}:testIamPermissions")
  3030. urls += "?" + c.urlParams_.Encode()
  3031. req, _ := http.NewRequest("POST", urls, body)
  3032. req.Header = reqHeaders
  3033. googleapi.Expand(req.URL, map[string]string{
  3034. "resource": c.resource,
  3035. })
  3036. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3037. }
  3038. // Do executes the "cloudresourcemanager.projects.testIamPermissions" call.
  3039. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  3040. // Any non-2xx status code is an error. Response headers are in either
  3041. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  3042. // was returned at all) in error.(*googleapi.Error).Header. Use
  3043. // googleapi.IsNotModified to check whether the returned error was
  3044. // because http.StatusNotModified was returned.
  3045. func (c *ProjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  3046. gensupport.SetOptions(c.urlParams_, opts...)
  3047. res, err := c.doRequest("json")
  3048. if res != nil && res.StatusCode == http.StatusNotModified {
  3049. if res.Body != nil {
  3050. res.Body.Close()
  3051. }
  3052. return nil, &googleapi.Error{
  3053. Code: res.StatusCode,
  3054. Header: res.Header,
  3055. }
  3056. }
  3057. if err != nil {
  3058. return nil, err
  3059. }
  3060. defer googleapi.CloseBody(res)
  3061. if err := googleapi.CheckResponse(res); err != nil {
  3062. return nil, err
  3063. }
  3064. ret := &TestIamPermissionsResponse{
  3065. ServerResponse: googleapi.ServerResponse{
  3066. Header: res.Header,
  3067. HTTPStatusCode: res.StatusCode,
  3068. },
  3069. }
  3070. target := &ret
  3071. if err := gensupport.DecodeResponse(target, res); err != nil {
  3072. return nil, err
  3073. }
  3074. return ret, nil
  3075. // {
  3076. // "description": "Returns permissions that a caller has on the specified Project.",
  3077. // "flatPath": "v1beta1/projects/{resource}:testIamPermissions",
  3078. // "httpMethod": "POST",
  3079. // "id": "cloudresourcemanager.projects.testIamPermissions",
  3080. // "parameterOrder": [
  3081. // "resource"
  3082. // ],
  3083. // "parameters": {
  3084. // "resource": {
  3085. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  3086. // "location": "path",
  3087. // "required": true,
  3088. // "type": "string"
  3089. // }
  3090. // },
  3091. // "path": "v1beta1/projects/{resource}:testIamPermissions",
  3092. // "request": {
  3093. // "$ref": "TestIamPermissionsRequest"
  3094. // },
  3095. // "response": {
  3096. // "$ref": "TestIamPermissionsResponse"
  3097. // },
  3098. // "scopes": [
  3099. // "https://www.googleapis.com/auth/cloud-platform",
  3100. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3101. // ]
  3102. // }
  3103. }
  3104. // method id "cloudresourcemanager.projects.undelete":
  3105. type ProjectsUndeleteCall struct {
  3106. s *Service
  3107. projectId string
  3108. undeleteprojectrequest *UndeleteProjectRequest
  3109. urlParams_ gensupport.URLParams
  3110. ctx_ context.Context
  3111. header_ http.Header
  3112. }
  3113. // Undelete: Restores the Project identified by the
  3114. // specified
  3115. // `project_id` (for example, `my-project-123`).
  3116. // You can only use this method for a Project that has a lifecycle state
  3117. // of
  3118. // DELETE_REQUESTED.
  3119. // After deletion starts, the Project cannot be restored.
  3120. //
  3121. // The caller must have modify permissions for this Project.
  3122. func (r *ProjectsService) Undelete(projectId string, undeleteprojectrequest *UndeleteProjectRequest) *ProjectsUndeleteCall {
  3123. c := &ProjectsUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3124. c.projectId = projectId
  3125. c.undeleteprojectrequest = undeleteprojectrequest
  3126. return c
  3127. }
  3128. // Fields allows partial responses to be retrieved. See
  3129. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3130. // for more information.
  3131. func (c *ProjectsUndeleteCall) Fields(s ...googleapi.Field) *ProjectsUndeleteCall {
  3132. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3133. return c
  3134. }
  3135. // Context sets the context to be used in this call's Do method. Any
  3136. // pending HTTP request will be aborted if the provided context is
  3137. // canceled.
  3138. func (c *ProjectsUndeleteCall) Context(ctx context.Context) *ProjectsUndeleteCall {
  3139. c.ctx_ = ctx
  3140. return c
  3141. }
  3142. // Header returns an http.Header that can be modified by the caller to
  3143. // add HTTP headers to the request.
  3144. func (c *ProjectsUndeleteCall) Header() http.Header {
  3145. if c.header_ == nil {
  3146. c.header_ = make(http.Header)
  3147. }
  3148. return c.header_
  3149. }
  3150. func (c *ProjectsUndeleteCall) doRequest(alt string) (*http.Response, error) {
  3151. reqHeaders := make(http.Header)
  3152. for k, v := range c.header_ {
  3153. reqHeaders[k] = v
  3154. }
  3155. reqHeaders.Set("User-Agent", c.s.userAgent())
  3156. var body io.Reader = nil
  3157. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleteprojectrequest)
  3158. if err != nil {
  3159. return nil, err
  3160. }
  3161. reqHeaders.Set("Content-Type", "application/json")
  3162. c.urlParams_.Set("alt", alt)
  3163. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}:undelete")
  3164. urls += "?" + c.urlParams_.Encode()
  3165. req, _ := http.NewRequest("POST", urls, body)
  3166. req.Header = reqHeaders
  3167. googleapi.Expand(req.URL, map[string]string{
  3168. "projectId": c.projectId,
  3169. })
  3170. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3171. }
  3172. // Do executes the "cloudresourcemanager.projects.undelete" call.
  3173. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3174. // code is an error. Response headers are in either
  3175. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3176. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3177. // check whether the returned error was because http.StatusNotModified
  3178. // was returned.
  3179. func (c *ProjectsUndeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3180. gensupport.SetOptions(c.urlParams_, opts...)
  3181. res, err := c.doRequest("json")
  3182. if res != nil && res.StatusCode == http.StatusNotModified {
  3183. if res.Body != nil {
  3184. res.Body.Close()
  3185. }
  3186. return nil, &googleapi.Error{
  3187. Code: res.StatusCode,
  3188. Header: res.Header,
  3189. }
  3190. }
  3191. if err != nil {
  3192. return nil, err
  3193. }
  3194. defer googleapi.CloseBody(res)
  3195. if err := googleapi.CheckResponse(res); err != nil {
  3196. return nil, err
  3197. }
  3198. ret := &Empty{
  3199. ServerResponse: googleapi.ServerResponse{
  3200. Header: res.Header,
  3201. HTTPStatusCode: res.StatusCode,
  3202. },
  3203. }
  3204. target := &ret
  3205. if err := gensupport.DecodeResponse(target, res); err != nil {
  3206. return nil, err
  3207. }
  3208. return ret, nil
  3209. // {
  3210. // "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.",
  3211. // "flatPath": "v1beta1/projects/{projectId}:undelete",
  3212. // "httpMethod": "POST",
  3213. // "id": "cloudresourcemanager.projects.undelete",
  3214. // "parameterOrder": [
  3215. // "projectId"
  3216. // ],
  3217. // "parameters": {
  3218. // "projectId": {
  3219. // "description": "The project ID (for example, `foo-bar-123`).\n\nRequired.",
  3220. // "location": "path",
  3221. // "required": true,
  3222. // "type": "string"
  3223. // }
  3224. // },
  3225. // "path": "v1beta1/projects/{projectId}:undelete",
  3226. // "request": {
  3227. // "$ref": "UndeleteProjectRequest"
  3228. // },
  3229. // "response": {
  3230. // "$ref": "Empty"
  3231. // },
  3232. // "scopes": [
  3233. // "https://www.googleapis.com/auth/cloud-platform"
  3234. // ]
  3235. // }
  3236. }
  3237. // method id "cloudresourcemanager.projects.update":
  3238. type ProjectsUpdateCall struct {
  3239. s *Service
  3240. projectId string
  3241. project *Project
  3242. urlParams_ gensupport.URLParams
  3243. ctx_ context.Context
  3244. header_ http.Header
  3245. }
  3246. // Update: Updates the attributes of the Project identified by the
  3247. // specified
  3248. // `project_id` (for example, `my-project-123`).
  3249. //
  3250. // The caller must have modify permissions for this Project.
  3251. func (r *ProjectsService) Update(projectId string, project *Project) *ProjectsUpdateCall {
  3252. c := &ProjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3253. c.projectId = projectId
  3254. c.project = project
  3255. return c
  3256. }
  3257. // Fields allows partial responses to be retrieved. See
  3258. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3259. // for more information.
  3260. func (c *ProjectsUpdateCall) Fields(s ...googleapi.Field) *ProjectsUpdateCall {
  3261. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3262. return c
  3263. }
  3264. // Context sets the context to be used in this call's Do method. Any
  3265. // pending HTTP request will be aborted if the provided context is
  3266. // canceled.
  3267. func (c *ProjectsUpdateCall) Context(ctx context.Context) *ProjectsUpdateCall {
  3268. c.ctx_ = ctx
  3269. return c
  3270. }
  3271. // Header returns an http.Header that can be modified by the caller to
  3272. // add HTTP headers to the request.
  3273. func (c *ProjectsUpdateCall) Header() http.Header {
  3274. if c.header_ == nil {
  3275. c.header_ = make(http.Header)
  3276. }
  3277. return c.header_
  3278. }
  3279. func (c *ProjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3280. reqHeaders := make(http.Header)
  3281. for k, v := range c.header_ {
  3282. reqHeaders[k] = v
  3283. }
  3284. reqHeaders.Set("User-Agent", c.s.userAgent())
  3285. var body io.Reader = nil
  3286. body, err := googleapi.WithoutDataWrapper.JSONReader(c.project)
  3287. if err != nil {
  3288. return nil, err
  3289. }
  3290. reqHeaders.Set("Content-Type", "application/json")
  3291. c.urlParams_.Set("alt", alt)
  3292. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}")
  3293. urls += "?" + c.urlParams_.Encode()
  3294. req, _ := http.NewRequest("PUT", urls, body)
  3295. req.Header = reqHeaders
  3296. googleapi.Expand(req.URL, map[string]string{
  3297. "projectId": c.projectId,
  3298. })
  3299. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3300. }
  3301. // Do executes the "cloudresourcemanager.projects.update" call.
  3302. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  3303. // code is an error. Response headers are in either
  3304. // *Project.ServerResponse.Header or (if a response was returned at all)
  3305. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3306. // check whether the returned error was because http.StatusNotModified
  3307. // was returned.
  3308. func (c *ProjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  3309. gensupport.SetOptions(c.urlParams_, opts...)
  3310. res, err := c.doRequest("json")
  3311. if res != nil && res.StatusCode == http.StatusNotModified {
  3312. if res.Body != nil {
  3313. res.Body.Close()
  3314. }
  3315. return nil, &googleapi.Error{
  3316. Code: res.StatusCode,
  3317. Header: res.Header,
  3318. }
  3319. }
  3320. if err != nil {
  3321. return nil, err
  3322. }
  3323. defer googleapi.CloseBody(res)
  3324. if err := googleapi.CheckResponse(res); err != nil {
  3325. return nil, err
  3326. }
  3327. ret := &Project{
  3328. ServerResponse: googleapi.ServerResponse{
  3329. Header: res.Header,
  3330. HTTPStatusCode: res.StatusCode,
  3331. },
  3332. }
  3333. target := &ret
  3334. if err := gensupport.DecodeResponse(target, res); err != nil {
  3335. return nil, err
  3336. }
  3337. return ret, nil
  3338. // {
  3339. // "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.",
  3340. // "flatPath": "v1beta1/projects/{projectId}",
  3341. // "httpMethod": "PUT",
  3342. // "id": "cloudresourcemanager.projects.update",
  3343. // "parameterOrder": [
  3344. // "projectId"
  3345. // ],
  3346. // "parameters": {
  3347. // "projectId": {
  3348. // "description": "The project ID (for example, `my-project-123`).\n\nRequired.",
  3349. // "location": "path",
  3350. // "required": true,
  3351. // "type": "string"
  3352. // }
  3353. // },
  3354. // "path": "v1beta1/projects/{projectId}",
  3355. // "request": {
  3356. // "$ref": "Project"
  3357. // },
  3358. // "response": {
  3359. // "$ref": "Project"
  3360. // },
  3361. // "scopes": [
  3362. // "https://www.googleapis.com/auth/cloud-platform"
  3363. // ]
  3364. // }
  3365. }