Interface ResourceManager (1.32.0)

public interface ResourceManager extends Service<ResourceManagerOptions>

Deprecated. v3 GAPIC client of ResourceManager is now available

An interface for Google Cloud Resource Manager. See Also: Google Cloud Resource Manager

Implements

com.google.cloud.Service<com.google.cloud.resourcemanager.ResourceManagerOptions>

Static Fields

DEFAULT_CONTENT_TYPE (deprecated)

public static final String DEFAULT_CONTENT_TYPE
Field Value
TypeDescription
String

Methods

clearOrgPolicy(String resource, OrgPolicyInfo orgPolicy) (deprecated)

public abstract void clearOrgPolicy(String resource, OrgPolicyInfo orgPolicy)

Clears a Policy from a resource. See Also: Resource Manager clearOrgPolicy

Parameters
NameDescription
resourceString
orgPolicyOrgPolicyInfo

create(ProjectInfo project) (deprecated)

public abstract Project create(ProjectInfo project)

Deprecated. Please use com.google.cloud.resourcemanager.v3.ProjectsClient#create(ProjectsSettings) instead

Creates a new project.

Initially, the project resource is owned by its creator exclusively. The creator can later grant permission to others to read or update the project. Several APIs are activated automatically for the project, including Google Cloud Storage. See Also: Cloud Resource Manager create

Parameter
NameDescription
projectProjectInfo
Returns
TypeDescription
Project

Project object representing the new project's metadata. The returned object will include the following read-only fields supplied by the server: project number, lifecycle state, and creation time.

delete(String projectId) (deprecated)

public abstract void delete(String projectId)

Deprecated. Please use com.google.cloud.resourcemanager.v3.ProjectsClient#deleteProjectAsync(ProjectName) instead

Marks the project identified by the specified project ID for deletion.

This method will only affect the project if the following criteria are met:

  • The project does not have a billing account associated with it.
  • The project has a lifecycle state of ProjectInfo.State#ACTIVE.

This method changes the project's lifecycle state from 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, and the project remains visible to ResourceManager#list. However, you cannot update the project. After the deletion completes, the project is not retrievable by the ResourceManager#get and ResourceManager#list methods. The caller must have modify permissions for this project. See Also: Cloud Resource Manager delete

Parameter
NameDescription
projectIdString

get(String projectId, ResourceManager.ProjectGetOption[] options) (deprecated)

public abstract Project get(String projectId, ResourceManager.ProjectGetOption[] options)

Deprecated. Please use com.google.cloud.resourcemanager.v3.ProjectsClient#getProject(GetProjectRequest) instead

Retrieves the project identified by the specified project ID.

Returns null if the project is not found or if the user doesn't have read permissions for the project. See Also: Cloud Resource Manager get

Parameters
NameDescription
projectIdString
optionsProjectGetOption[]
Returns
TypeDescription
Project

getEffectiveOrgPolicy(String resource, String constraint) (deprecated)

public abstract OrgPolicyInfo getEffectiveOrgPolicy(String resource, String constraint)

Deprecated.

Gets the effective Policy on a resource.

This is the result of merging Policies in the resource hierarchy. The returned Policy will not have an etag set because it is a computed Policy across multiple resources. Subtrees of Resource Manager resource hierarchy with 'under:' prefix are not expanded. See Also: Resource Manager getEffectiveOrgPolicy

Parameters
NameDescription
resourceString
constraintString
Returns
TypeDescription
OrgPolicyInfo

getOrgPolicy(String resource, String constraint) (deprecated)

public abstract OrgPolicyInfo getOrgPolicy(String resource, String constraint)

Gets the Policy on a resource.

If no Policy is set on the resource, a Policy is returned with default values including POLICY_TYPE_NOT_SET for the policy_type one of. The etag value can be used with projects.setOrgPolicy() to create or update a Policy during read-modify-write. See Also: Resource Manager getOrgPolicy

Parameters
NameDescription
resourceString
constraintString
Returns
TypeDescription
OrgPolicyInfo

getPolicy(String projectId) (deprecated)

public abstract Policy getPolicy(String projectId)

Deprecated. Please use com.google.cloud.resourcemanager.v3.ProjectsClient#getIamPolicy(GetIamPolicyRequest) instead

Returns the IAM access control policy for the specified project. Returns null if the resource does not exist or if you do not have adequate permission to view the project or get the policy. See Also: Resource Manager getIamPolicy

Parameter
NameDescription
projectIdString
Returns
TypeDescription
com.google.cloud.Policy

list(ResourceManager.ProjectListOption[] options) (deprecated)

public abstract Page<Project> list(ResourceManager.ProjectListOption[] options)

Deprecated. Please use com.google.cloud.resourcemanager.v3.ProjectsClient#listProjects(ListProjectsRequest) instead

Lists the projects visible to the current user.

This method returns projects in an unspecified order. New projects do not necessarily appear at the end of the list. Use ProjectListOption to filter this list, set page size, and set page tokens. See Also: Cloud Resource Manager list

Parameter
NameDescription
optionsProjectListOption[]
Returns
TypeDescription
Page<Project>

Page<Project>, a page of projects

listAvailableOrgPolicyConstraints(String resource, ResourceManager.ListOption[] options) (deprecated)

public abstract Page<ConstraintInfo> listAvailableOrgPolicyConstraints(String resource, ResourceManager.ListOption[] options)

Deprecated.

Lists the Constraints that could be applied on the specified resource. See Also: Resource Manager listAvailableOrgPolicyConstraints

Parameters
NameDescription
resourceString
optionsListOption[]
Returns
TypeDescription
Page<ConstraintInfo>

listOrgPolicies(String resource, ResourceManager.ListOption[] options) (deprecated)

public abstract Page<OrgPolicyInfo> listOrgPolicies(String resource, ResourceManager.ListOption[] options)

Deprecated.

Lists the Policies set for a particular resource. See Also: Resource Manager listOrgPolicies

Parameters
NameDescription
resourceString
optionsListOption[]
Returns
TypeDescription
Page<OrgPolicyInfo>

replace(ProjectInfo newProject) (deprecated)

public abstract Project replace(ProjectInfo newProject)

Deprecated. Please use com.google.cloud.resourcemanager.v3.ProjectsClient#updateProjectAsync(UpdateProjectRequest) instead

Replaces the attributes of the project.

The caller must have modify permissions for this project. See Also: Cloud Resource Manager update

Parameter
NameDescription
newProjectProjectInfo
Returns
TypeDescription
Project

the Project representing the new project metadata

replaceOrgPolicy(String resource, OrgPolicyInfo orgPolicy) (deprecated)

public abstract OrgPolicyInfo replaceOrgPolicy(String resource, OrgPolicyInfo orgPolicy)

Deprecated.

Updates the specified Policy on the resource. Creates a new Policy for that Constraint on the resource if one does not exist.

Not supplying an etag on the request Policy results in an unconditional write of the Policy. See Also: Resource Manager setOrgPolicy

Parameters
NameDescription
resourceString
orgPolicyOrgPolicyInfo
Returns
TypeDescription
OrgPolicyInfo

replacePolicy(String projectId, Policy newPolicy) (deprecated)

public abstract Policy replacePolicy(String projectId, Policy newPolicy)

Deprecated.

Sets the IAM access control policy for the specified project. Replaces any existing policy. The following constraints apply:

  • Projects currently support only user:{emailid} and serviceAccount:{emailid} members in a binding of a policy.
  • To be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation.
  • Members cannot be added to more than one role in the same policy.
  • There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. An attempt to set a policy that removes the last ToS-accepted owner from the policy will fail.
  • Calling this method requires enabling the App Engine Admin API.

Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles.

It is recommended that you use the read-modify-write pattern. This pattern entails reading the project's current policy, updating it locally, and then sending the modified policy for writing. Cloud IAM solves the problem of conflicting processes simultaneously attempting to modify a policy by using the etag property. This property is used to verify whether the policy has changed since the last request. When you make a request to Cloud IAM with an etag value, Cloud IAM compares the etag value in the request with the existing etag value associated with the policy. It writes the policy only if the etag values match. If the etags don't match, a ResourceManagerException is thrown, denoting that the server aborted update. If an etag is not provided, the policy is overwritten blindly.

An example of using the read-write-modify pattern is as follows:


 Policy currentPolicy = resourceManager.getPolicy("my-project-id");
 Policy modifiedPolicy = current.toBuilder()
     .removeIdentity(Role.viewer(), Identity.user("user@gmail.com"))
     .build();
 Policy newPolicy = resourceManager.replacePolicy("my-project-id", modified);
 

See Also: Resource Manager setIamPolicy

Parameters
NameDescription
projectIdString
newPolicycom.google.cloud.Policy
Returns
TypeDescription
com.google.cloud.Policy

testOrgPermissions(String resource, List<String> permissions) (deprecated)

public abstract Map<String,Boolean> testOrgPermissions(String resource, List<String> permissions)

Deprecated.

Returns the permissions and their results representing whether the caller has the permissions on the specified Organization. See Also: Resource Manager testIamPermissions

Parameters
NameDescription
resourceString

the organization's resource name, e.g. "organizations/123"

permissionsList<String>

the set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed.

Returns
TypeDescription
Map<String,Boolean>

the permissions and their results representing whether the caller has the permissions on the specified Organization.

testPermissions(String projectId, List<String> permissions) (deprecated)

public abstract List<Boolean> testPermissions(String projectId, List<String> permissions)

Deprecated. com.google.cloud.resourcemanager.v3.ProjectsClient#testIamPermissions(TestIamPermissionsRequest)

Returns the permissions that a caller has on the specified project. You typically don't call this method if you're using Google Cloud Platform directly to manage permissions. This method is intended for integration with your proprietary software, such as a customized graphical user interface. For example, the Cloud Platform Console tests IAM permissions internally to determine which UI should be available to the logged-in user. Each service that supports IAM lists the possible permissions; see the Supported Cloud Platform services page below for links to these lists. See Also: Supported Cloud Platform Services, Resource Manager testIamPermissions

Parameters
NameDescription
projectIdString
permissionsList<String>
Returns
TypeDescription
List<Boolean>

A list of booleans representing whether the caller has the permissions specified (in the order of the given permissions)

undelete(String projectId) (deprecated)

public abstract void undelete(String projectId)

Deprecated. Please use com.google.cloud.resourcemanager.v3.ProjectsClient#undeleteProjectAsync(UndeleteProjectRequest) instead

Restores the project identified by the specified project ID.

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. See Also: Cloud Resource Manager undelete

Parameter
NameDescription
projectIdString