Retrieve a pool configuration resource.

## Code sample

### Go


To learn how to install and use the client library for Live Stream API, see
[Live Stream API client libraries](https://docs.cloud.google.com/livestream/docs/reference/libraries.md.txt).


For more information, see the
[Live Stream API Go API
reference documentation](https://pkg.go.dev/cloud.google.com/go/video/livestream).


To authenticate to Live Stream API, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```go

import (
	"context"
	"fmt"
	"io"

	livestream "cloud.google.com/go/video/livestream/apiv1"
	livestreampb "cloud.google.com/go/video/livestream/apiv1/livestreampb"
)

// getPool retrieves a pool configuration resource.
func getPool(ctx context.Context, w io.Writer, projectID string, locationID string, poolID string) error {
	name := fmt.Sprintf("projects/%s/locations/%s/pools/%s", projectID, locationID, poolID)

	client, err := livestream.NewClient(ctx)
	if err != nil {
		return fmt.Errorf("livestream.NewClient: %w", err)
	}
	defer client.Close()

	req := &livestreampb.GetPoolRequest{
		Name: name,
	}

	response, err := client.GetPool(ctx, req)
	if err != nil {
		return fmt.Errorf("client.GetPool: %w", err)
	}

	fmt.Fprintf(w, "Pool: %s\n", response.GetName())

	return nil
}
```

### Java


To learn how to install and use the client library for Live Stream API, see
[Live Stream API client libraries](https://docs.cloud.google.com/livestream/docs/reference/libraries.md.txt).


For more information, see the
[Live Stream API Java API
reference documentation](https://docs.cloud.google.com/java/docs/reference/google-cloud-live-stream/latest/overview).


To authenticate to Live Stream API, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```java
import com.google.cloud.video.livestream.v1.LivestreamServiceClient;
import com.google.cloud.video.livestream.v1.Pool;
import com.google.cloud.video.livestream.v1.PoolName;
import java.io.IOException;

public class GetPool {

  public static void main(String[] args) throws IOException {
    String projectId = "example-project-id";
    String locationId = "us-central1";
    String poolId = "example-pool-id";
    getPool(projectId, locationId, poolId);
  }

  public static void getPool(String projectId, String locationId, String poolId)
      throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests.
    try (LivestreamServiceClient client = LivestreamServiceClient.create()) {
      String name = PoolName.of(projectId, locationId, poolId).toString();
      Pool response = client.getPool(name);
      System.out.println("Retrieved pool: " + response.getName());
    }
  }
}
```

### Node.js


To learn how to install and use the client library for Live Stream API, see
[Live Stream API client libraries](https://docs.cloud.google.com/livestream/docs/reference/libraries.md.txt).


For more information, see the
[Live Stream API Node.js API
reference documentation](https://cloud.google.com/nodejs/docs/reference/livestream/latest).


To authenticate to Live Stream API, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```javascript
'use strict';

const {LivestreamServiceClient} = require('@google-cloud/livestream');
const {status} = require('@grpc/grpc-js');

const client = new LivestreamServiceClient();

/**
 * Retrieves details of a specific pool.
 *
 * @param {string} projectId - The Google Cloud project ID (for example, 'example-project-id').
 * @param {string} locationId - The Google Cloud region where the pool is located (for example, 'us-central1').
 * @param {string} poolId - The ID of the pool resource (for example, 'default').
 */
async function getPool(projectId, locationId, poolId) {
  try {
    const name = `projects/${projectId}/locations/${locationId}/pools/${poolId}`;
    const [pool] = await client.getPool({name});

    console.log(`Pool name: ${pool.name}`);
    console.log(`Network: ${pool.network}`);
    return pool;
  } catch (err) {
    if (err.code === status.NOT_FOUND) {
      console.error(`Pool not found: projects/${projectId}/locations/${locationId}/pools/${poolId}`);
    } else {
      console.error(`Error retrieving pool: ${err.message}`);
    }
  }
}

module.exports = { getPool };
```

### Python


To learn how to install and use the client library for Live Stream API, see
[Live Stream API client libraries](https://docs.cloud.google.com/livestream/docs/reference/libraries.md.txt).


For more information, see the
[Live Stream API Python API
reference documentation](https://docs.cloud.google.com/python/docs/reference/livestream/latest).


To authenticate to Live Stream API, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```python
import google.api_core.exceptions
from google.cloud.video import live_stream_v1


def get_pool(project_id: str, location_id: str, pool_id: str) -> None:
    """Retrieves details of a pool in the Live Stream API.

    Args:
        project_id: The Google Cloud project ID.
        location_id: The Google Cloud region where the Live Stream pool is located (for example, 'us-central1').
        pool_id: The ID of the pool resource (typically 'default').
    """
    client = live_stream_v1.LivestreamServiceClient()

    name = f"projects/{project_id}/locations/{location_id}/pools/{pool_id}"

    request = live_stream_v1.GetPoolRequest(name=name)

    try:
        response = client.get_pool(request=request)
        print(f"Pool retrieved: {response.name}")
    except google.api_core.exceptions.GoogleAPICallError as e:
        print(f"Failed to get pool: {e}")
```

## What's next


To search and filter code samples for other Google Cloud products, see the
[Google Cloud sample browser](https://docs.cloud.google.com/docs/samples.md.txt?product=livestreamapi).