# resource project

The OLP CLI supports the following commands:

• list all the projects that are either the home project for a resource or projects to which the resource is linked.
• add the specified project as a home project for resources (catalogs and schemas) originally created outside of a project.
• remove the specified project as a home from the resource. This is only available for catalogs and schemas originally created outside of a project.

## resource project list

For schemas and catalogs, list all projects that are either the home project or projects to which it is linked, or show that it does not belong to a project.


olp resource project list  [command parameters]


### Required parameters:

• <resource HRN> Specifies the HRN of the resource.

### Optional parameters:

• --relation <home|reference> The relation of resources to the project. home denotes a resource located within a project while reference denotes a resource linked to the project.
• --cross-realm Includes projects from different realms if there is a valid cross-realm trust established between the home project/realm and those other realms.
• --limit <max number of projects> Specifies the maximum number of projects returned in the result (100 by default).
• --credentials <path to credentials file> Specifies the name of a credentials file to use with the command. Credentials files are downloaded separately from the platform portal.
• --profile <profile name> Specifies the name of the credentials profile to use from the olpcli.ini file.
• --json Displays the command's result in JSON format.
• --quiet Displays the project HRNs, each on a new line.

Example:


olp resource project list hrn:here:data::myrealm:my-catalog --json


Output:


{
"projects":
[
{
"id": "my-project-0000",
"hrn": "hrn:here:authorization::myrealm:project/my-project-0000",
"name": "My Project 0",
"description": "This is my demo Project",
"relation": "home"
},
{
"id": "my-project-0001",
"hrn": "hrn:here:authorization::myrealm:project/my-project-0001",
"name": "My Project 1",
"description": "This is my demo Project",
"relation": "reference",
"allowedActions": [
]
}
]
}


Add a specified project as a home project for a resource (catalog/schema). This is true for those resources that were originally created outside of projects. That way, you can take advantage of platform project management features, including tracking of usage/cost and access management at project level. Note that each resource can only have one home project. Also note that this command is not supported for pipelines, which can be moved into a home project using the olp pipeline move command.


olp resource project add   [command parameters]


### Required parameters:

• <resource HRN> The HRN of the resource, where the resource is either a schema or a catalog.
• <project HRN> The HRN of the project to add as resource home.

### Optional parameters:

• --credentials <path to credentials file> Specifies the name of a credentials file to use with the command. Credentials files are downloaded separately from the platform portal.
• --profile <profile name> Specifies the name of the credentials profile to use from the olpcli.ini file.
• --json Displays the command's result in JSON format.
• --quiet Displays an empty output without additional information.

Example:


olp resource project add hrn:here:data::myrealm:my-catalog hrn:here:authorization::myrealm:project/my-project-0000


Output:


Resource hrn:here:data::myrealm:my-catalog has been added to the project hrn:here:authorization::myrealm:project/my-project-0000.


#### Note:

This operation is only supported for catalogs and schemas that were created outside the context of a project.

This command does not remove existing permissions on the catalog for use outside the context of a project. In order to remove permissions on the catalog outside of the project, use the olp catalog permission list and olp catalog permission revoke commands on a catalog.

Once a catalog is added to a project, the platform portal treats it like it only exists in that project. This means the Sharing tab in the Data section of the portal is no longer displayed and access management happens through the Projects Manager. Make sure at least one app has manage access to your input and output catalogs before you add the catalogs to projects. That way, you can continue to manage access outside of projects through the CLI, which requires an app to authenticate. In addition, you can no longer mark a catalog that's been added to a project as Marketplace Ready. Do not use this command for catalogs that you need to add to Marketplace Subscriptions.

For more information on migrating resources created outside of a project into a project, see the Migration guide.

## resource project remove

Remove the specified project as a home from the resource. You can use this command to undo the addition of a home project for a catalog created outside of projects with the above command.


olp resource project remove   [command parameters]


### Required parameters:

• <resource HRN> The HRN of the resource, where the resource is either a schema or a catalog.
• <project HRN> The HRN of the project to remove as resource home.

### Optional parameters:

• --credentials <path to credentials file> Specifies the name of a credentials file to use with the command. Credentials files are downloaded separately from the platform portal.
• --profile <profile name> Specifies the name of the credentials profile to use from the olpcli.ini file.
• --quiet Displays an empty output without additional information.

Example:


olp resource project remove hrn:here:data::myrealm:my-catalog hrn:here:authorization::myrealm:project/my-project-0000


Output:


Resource hrn:here:data::myrealm:my-catalog has been removed from the project hrn:here:authorization::myrealm:project/my-project-0000.


#### Note:

This operation is only supported for catalogs and schemas that were created outside the context of a project.

If the catalog is linked to other projects before it is removed from a project, this action revokes the availability of the resource in the project.