Resolves the correct Google Cloud Storage options from a configuration object based on the target bucket. Handles both standalone (`coasts`) and downstream package contexts (e.g. `peskas.mozambique.data.pipeline`) transparently, so workflow functions do not need to hardcode config paths.
Usage
resolve_storage_opts(conf, type = c("coasts", "country", "pds"))Arguments
- conf
A configuration list as returned by [read_config()].
- type
Character. The target bucket. One of: - `"coasts"`: the shared coasts bucket where device metadata lives. Uses `conf$storage$google$options_coasts` if present (downstream packages), falling back to `conf$storage$google$options` (coasts itself, where `options` already points to the coasts bucket). - `"country"`: the country-specific pipeline bucket where processed outputs are written. Always uses `conf$storage$google$options`. In the coasts package this is the same bucket as `"coasts"`. - `"pds"`: the PDS-specific bucket where raw GPS tracks are stored. Always uses `conf$pds_storage$google$options`, which resolves to the correct bucket per package (`pds-peskas-coasts` in coasts, `pds-mozambique-prod` in the Mozambique pipeline, etc.).
Value
A named list of Google Cloud Storage options suitable for passing to [cloud_object_name()], [download_cloud_file()], or [upload_cloud_file()].
Details
The three bucket types map to the following storage contexts:
| `type` | coasts package | downstream package | |————|———————–|—————————-| | `"coasts"` | `peskas-coasts-dev` | `peskas-coasts-dev` | | `"country"`| `peskas-coasts-dev` | `mozambique-dev` | | `"pds"` | `pds-peskas-coasts` | `pds-mozambique-dev` |
Examples
if (FALSE) { # \dontrun{
conf <- read_config(package = "peskas.mozambique.data.pipeline")
# Read device metadata from shared coasts bucket
coasts_opts <- resolve_storage_opts(conf, "coasts")
# Write processed output to country bucket
country_opts <- resolve_storage_opts(conf, "country")
# Access raw GPS tracks from PDS bucket
pds_opts <- resolve_storage_opts(conf, "pds")
} # }