You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3835 lines
134 KiB

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