public class Project extends ProjectInfo
A Project is a high-level Google Cloud Platform entity. It is a container for ACLs, APIs,
AppEngine Apps, VMs, and other Google Cloud Platform resources. This class' member variables are
immutable. Methods that change or update the underlying Project information return a new Project
instance. Project
adds a layer of service-related functionality over ProjectInfo
.
Modifier and Type | Class and Description |
---|---|
static class |
Project.Builder
Builder for
Project . |
ProjectInfo.State
DATE_TIME_FORMATTER
Modifier and Type | Method and Description |
---|---|
void |
delete()
Marks the project identified by the specified project ID for deletion.
|
boolean |
equals(Object obj) |
Policy |
getPolicy()
Returns the IAM access control policy for this project.
|
ResourceManager |
getResourceManager()
Returns the
ResourceManager service object associated with this Project. |
int |
hashCode() |
Project |
reload()
Fetches the project's latest information.
|
Project |
replace()
Replaces the attributes of the project with the attributes of this project.
|
Policy |
replacePolicy(Policy newPolicy)
Sets the IAM access control policy for this project.
|
Project.Builder |
toBuilder() |
void |
undelete()
Restores the project identified by the specified project ID.
|
getCreateTimeMillis, getLabels, getName, getProjectId, getProjectNumber, getState, newBuilder
public ResourceManager getResourceManager()
ResourceManager
service object associated with this Project.public Project reload()
null
if the project does not exist.null
if not foundResourceManagerException
- upon failurepublic void delete()
This method will only affect the project if the following criteria are met:
ProjectInfo.State.ACTIVE
.
ProjectInfo.State.ACTIVE
to
ProjectInfo.State.DELETE_REQUESTED
. The deletion starts at an unspecified time, at
which point the lifecycle state changes to ProjectInfo.State.DELETE_IN_PROGRESS
. Until
the deletion completes, you can check the lifecycle state checked by retrieving the project
with ResourceManager.get(java.lang.String, com.google.cloud.resourcemanager.ResourceManager.ProjectGetOption...)
, and the project remains visible to ResourceManager.list(com.google.cloud.resourcemanager.ResourceManager.ProjectListOption...)
. However, you cannot update the project. After the deletion completes,
the project is not retrievable by the ResourceManager.get(java.lang.String, com.google.cloud.resourcemanager.ResourceManager.ProjectGetOption...)
and ResourceManager.list(com.google.cloud.resourcemanager.ResourceManager.ProjectListOption...)
methods. The caller must have modify permissions for this project.ResourceManagerException
- upon failurepublic void undelete()
You can only use this method for a project that has a lifecycle state of ProjectInfo.State.DELETE_REQUESTED
. After deletion starts, as indicated by a lifecycle state
of ProjectInfo.State.DELETE_IN_PROGRESS
, the project cannot be restored. The caller
must have modify permissions for this project.
ResourceManagerException
- upon failure (including when the project can't be restored)public Project replace()
The caller must have modify permissions for this project.
ResourceManagerException
- upon failurepublic Policy getPolicy()
null
if the resource
does not exist or if you do not have adequate permission to view the project or get the policy.ResourceManagerException
- upon failurepublic Policy replacePolicy(Policy newPolicy)
ResourceManager.replacePolicy(java.lang.String, com.google.cloud.Policy)
.ResourceManagerException
- upon failurepublic Project.Builder toBuilder()
toBuilder
in class ProjectInfo
public final boolean equals(Object obj)
equals
in class ProjectInfo
public final int hashCode()
hashCode
in class ProjectInfo
Copyright © 2019 Google LLC. All rights reserved.