## Get R2 catalog details `client.R2DataCatalog.Get(ctx, bucketName, query) (*R2DataCatalogGetResponse, error)` **get** `/accounts/{account_id}/r2-catalog/{bucket_name}` Retrieve detailed information about a specific R2 catalog by bucket name. Returns catalog status, maintenance configuration, and credential status. ### Parameters - `bucketName string` Specifies the R2 bucket name. - `query R2DataCatalogGetParams` - `AccountID param.Field[string]` Use this to identify the account. ### Returns - `type R2DataCatalogGetResponse struct{…}` Contains R2 Data Catalog information. - `ID string` Use this to uniquely identify the catalog. - `Bucket string` Specifies the associated R2 bucket name. - `Name string` Specifies the catalog name (generated from account and bucket name). - `Status R2DataCatalogGetResponseStatus` Indicates the status of the catalog. - `const R2DataCatalogGetResponseStatusActive R2DataCatalogGetResponseStatus = "active"` - `const R2DataCatalogGetResponseStatusInactive R2DataCatalogGetResponseStatus = "inactive"` - `CredentialStatus R2DataCatalogGetResponseCredentialStatus` Shows the credential configuration status. - `const R2DataCatalogGetResponseCredentialStatusPresent R2DataCatalogGetResponseCredentialStatus = "present"` - `const R2DataCatalogGetResponseCredentialStatusAbsent R2DataCatalogGetResponseCredentialStatus = "absent"` - `MaintenanceConfig R2DataCatalogGetResponseMaintenanceConfig` Configures maintenance for the catalog. - `Compaction R2DataCatalogGetResponseMaintenanceConfigCompaction` Configures compaction for catalog maintenance. - `State R2DataCatalogGetResponseMaintenanceConfigCompactionState` Specifies the state of maintenance operations. - `const R2DataCatalogGetResponseMaintenanceConfigCompactionStateEnabled R2DataCatalogGetResponseMaintenanceConfigCompactionState = "enabled"` - `const R2DataCatalogGetResponseMaintenanceConfigCompactionStateDisabled R2DataCatalogGetResponseMaintenanceConfigCompactionState = "disabled"` - `TargetSizeMB R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB` Sets the target file size for compaction in megabytes. Defaults to "128". - `const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB64 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "64"` - `const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB128 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "128"` - `const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB256 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "256"` - `const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB512 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "512"` - `SnapshotExpiration R2DataCatalogGetResponseMaintenanceConfigSnapshotExpiration` Configures snapshot expiration settings. - `MaxSnapshotAge string` Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d". - `MinSnapshotsToKeep int64` Specifies the minimum number of snapshots to retain. Defaults to 100. - `State R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationState` Specifies the state of maintenance operations. - `const R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationStateEnabled R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationState = "enabled"` - `const R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationStateDisabled R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationState = "disabled"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/r2_data_catalog" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) r2DataCatalog, err := client.R2DataCatalog.Get( context.TODO(), "my-data-bucket", r2_data_catalog.R2DataCatalogGetParams{ AccountID: cloudflare.F("0123456789abcdef0123456789abcdef"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", r2DataCatalog.ID) } ``` #### Response ```json { "errors": [], "messages": [], "result": { "bucket": "analytics-bucket", "credential_status": "present", "id": "550e8400-e29b-41d4-a716-446655440000", "maintenance_config": { "compaction": { "state": "enabled", "target_size_mb": "128" }, "snapshot_expiration": { "max_snapshot_age": "7d", "min_snapshots_to_keep": 100, "state": "enabled" } }, "name": "account123_analytics-bucket", "status": "active" }, "success": true } ```