This document outlines how to search for and view Secure Source Manager
repositories by full or partial repository ID.

## Required roles


To get the permissions that
you need to search repositories,

ask your administrator to grant you the
following IAM roles:

- [Secure Source Manager Instance Accessor](https://docs.cloud.google.com/iam/docs/roles-permissions/securesourcemanager.md.txt#securesourcemanager.instanceAccessor) (`roles/securesourcemanager.instanceAccessor`) on the Secure Source Manager instance
- [Secure Source Manager Repo Reader](https://docs.cloud.google.com/iam/docs/roles-permissions/securesourcemanager.md.txt#securesourcemanager.repoReader) (`roles/securesourcemanager.repoReader`) on repositories that you want to search for


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


You might also be able to get
the required permissions through [custom
roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or other [predefined
roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

> [!NOTE]
> **Note:** [IAM basic
> roles](https://docs.cloud.google.com/iam/docs/roles-overview#basic) might also contain permissions to search repositories. You shouldn't grant basic roles in a production environment, but you can grant them in a development or test environment.

For information on granting Secure Source Manager roles,
see [Access control with IAM](https://docs.cloud.google.com/secure-source-manager/docs/access-control.md.txt) and
[Grant users instance access](https://docs.cloud.google.com/secure-source-manager/docs/grant-users-instance-access.md.txt).

## List repositories

### web interface

To access the Secure Source Manager instance through its web interface, copy the following URL
into your browser address bar.


    INSTANCE_ID-PROJECT_NUMBER.LOCATION.sourcemanager.dev

<br />


Replace the following:


- <var translate="no">INSTANCE_ID</var> with the instance name.
- <var translate="no">PROJECT_NUMBER</var> with the instance's Google Cloud project number. For information on identifying projects, see [Identifying projects](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#identifying_projects).
- <var translate="no">LOCATION</var> with the instance's region.

<br />

The **My repositories** tab displays all repositories you have access to
view.

### API

To list details for all repositories in a given region for your instance, use
the following HTTP method and URL.


Before using any of the request data,
make the following replacements:

- <var class="edit" scope="PROJECT_ID" translate="no">PROJECT_ID</var>: the [project ID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) of the Google Cloud project where Secure Source Manager is running.
- <var class="edit" scope="INSTANCE_ID" translate="no">INSTANCE_ID</var>: the instance ID.
- <var class="edit" scope="LOCATION" translate="no">LOCATION</var>: the region where your instance is located. For information on supported locations, see [Locations](https://cloud.google.com/secure-source-manager/docs/locations).


HTTP method and URL:

```
GET https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories?instance=projects/PROJECT_ID/locations/LOCATION/instances/INSTANCE_ID
```

To send your request, expand one of these options:

#### curl (Linux, macOS, or Cloud Shell)

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X GET \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories?instance=projects/PROJECT_ID/locations/LOCATION/instances/INSTANCE_ID"
```

#### PowerShell (Windows)

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories?instance=projects/PROJECT_ID/locations/LOCATION/instances/INSTANCE_ID" | Select-Object -Expand Content
```

You should receive a JSON response similar to the following:

```
{
    "repositories" : [
          {
            "createTime" : "2023-08-09T19:32:15Z",
            "instance" : "projects/012345678901/locations/us-central1/instances/my-instance",
            "name" : "projects/my-project/locations/us-central1/repositories/my-repo",
            "uris" : {
                "api" : "https://my-instance-012345678901-api.us-central1.sourcemanager.dev/v1/projects/my-project/locations/us-central1/repositories/my-repo",
                "gitHttps" : "https://my-instance-012345678901-git.us-central1.sourcemanager.dev/my-project/my-repo.git",
                "html" : "https://my-instance-012345678901.us-central1.sourcemanager.dev/my-project/my-repo"
            }
          }
    ]
}
```

<br />

## View details for a specific repository

To list details for a single repository, use the following HTTP method and URL.


Before using any of the request data,
make the following replacements:

- <var class="edit" scope="PROJECT_ID" translate="no">PROJECT_ID</var>: the [project ID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) of the Google Cloud project where Secure Source Manager is running.
- <var class="edit" scope="LOCATION" translate="no">LOCATION</var>: the region where your instance is located. For information on supported locations, see [Locations](https://cloud.google.com/secure-source-manager/docs/locations).
- <var class="edit" scope="REPOSITORY_ID" translate="no">REPOSITORY_ID</var>: the repository ID.


HTTP method and URL:

```
GET https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories/REPOSITORY_ID
```

To send your request, expand one of these options:

#### curl (Linux, macOS, or Cloud Shell)

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) , or by using [Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
curl -X GET \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories/REPOSITORY_ID"
```

#### PowerShell (Windows)

> [!NOTE]
> **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](https://docs.cloud.google.com/sdk/gcloud/reference/init) or [`gcloud auth login`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) . You can check the currently active account by running [`gcloud auth list`](https://docs.cloud.google.com/sdk/gcloud/reference/auth/list.md.txt).


Execute the following command:

```
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://securesourcemanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/repositories/REPOSITORY_ID" | Select-Object -Expand Content
```

You should receive a JSON response similar to the following:

```
    {
      "createTime" : "2023-08-09T19:32:15Z",
      "instance" : "projects/012345678901/locations/us-central1/instances/my-instance",
      "name" : "projects/my-project/locations/us-central1/repositories/my-repo",
      "uris" : {
          "api" : "https://my-instance-012345678901-api.us-central1.sourcemanager.dev/v1/projects/my-project/locations/us-central1/repositories/my-repo",
          "gitHttps" : "https://my-instance-012345678901-git.us-central1.sourcemanager.dev/my-project/my-repo.git",
          "html" : "https://my-instance-012345678901.us-central1.sourcemanager.dev/my-project/my-repo"
      }
    }
```

## View repositories in the web interface

You can search for repositories within the **My repositories** tab by keyword.

1. In the Secure Source Manager web interface, enter your search keyword in
   the **Search repository names** search bar.

   The search results include all repositories that include your keyword in
   their repository ID.
2. Select the repository you want to view.

   The repository page opens.

## What's next

- [Create a repository](https://docs.cloud.google.com/secure-source-manager/docs/create-repository.md.txt).
- [Grant repository-level roles](https://docs.cloud.google.com/secure-source-manager/docs/grant-repository-roles).
- [Delete a repository](https://docs.cloud.google.com/secure-source-manager/docs/delete-repository.md.txt).