> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud Storage generations

> Retain GCS object generations as Files.

Bind one Google Cloud Storage bucket and a literal prefix to
`@bijectionhq/app-objects`. Follow the same mount, source controls, and
1 MiB File and 24 KiB range limits as the S3 source. Pass the receiver below to the app as `provider`. For protected content, pass the declared label as the binder's last argument and as the app's `data`.
[Object storage mount and controls](https://docs.bijection.com/integrations/native-s3.md).

```ts bijection/app.ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { app, label, secret } from "@bijectionhq/bijection";
import objects, { gcsBucket } from "@bijectionhq/app-objects";

const archive = label();
const token = secret();
const bucket = gcsBucket({
  bucket: "example-archive",
  prefix: "incoming/",
}, { kind: "bearer", secret: token }, archive);

export default app({ archive, token, bucket, store: objects({ data: archive, provider: bucket }) });
```

Seal a read-only Google access token in the `secret()` the binder takes
and rotate it before expiry. A receiver can also use `kind: "oauth2"`
with a Google OAuth client, a sealed client secret and a sealed refresh
token. The principal needs `storage.objects.list` and
`storage.objects.get` on the bucket. Give the grant the narrowest available
storage scope. [Google Cloud Storage list API](https://docs.cloud.google.com/storage/docs/json_api/v1/objects/list).

Enable Object Versioning to observe noncurrent generations. The app
follows page tokens and selects a generation explicitly on every read,
with a matching generation precondition. The returned generation and byte
range must agree. The app reads stored bytes, including stored gzip when
the service returns it without transcoding. Soft-deleted objects and
deletion by absence are outside the publication contract.
[Google Cloud Storage versioned objects](https://docs.cloud.google.com/storage/docs/using-versioned-objects),
[Cloud Storage generation headers](https://docs.cloud.google.com/storage/docs/xml-api/reference-headers#x-goog-generation).

The app bundle requires the bundled parser artifact. Configure `source.initialize`
to publish CSV or JSON records alongside retained Files.
[CSV and JSON object records](https://docs.bijection.com/integrations/native-object-records.md).

For protected installs, use a sealed bearer and rotate it before expiry.

For snapshot deletion by absence, select a [versioned inventory](https://docs.bijection.com/integrations/native-object-inventory.md).

## Put an object

Bind `gcsWriter({ bucket, prefix }, auth, label)`
and pass it to the objects app as `writer`. Follow the
[object write command](https://docs.bijection.com/integrations/native-s3.md#put-an-object) for the key,
inline payload, contract and evidence API.

The writer uses the Cloud Storage XML API. An HTTP 200 acknowledges the
full object at the submitted key. A returned generation identifies the
provider version written. The optional ETag is an opaque provider value.
[Provider API](https://docs.cloud.google.com/storage/docs/xml-api/put-object-upload)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.