gcloud-ctx

Crates.iogcloud-ctx
lib.rsgcloud-ctx
version0.4.0
sourcesrc
created_at2020-07-14 19:17:09.895038
updated_at2022-02-20 20:01:44.328011
descriptionA gcloud configuration management library
homepagehttps://github.com/adamrodger/gcloud-ctx
repositoryhttps://github.com/adamrodger/gcloud-ctx
max_upload_size
id265172
size23,100
Adam Rodger (adamrodger)

documentation

README

gcloud-ctx

Crate API License

A Rust implementation of gcloud config configurations for managing different gcloud configurations for Google Cloud Platform. This is the library containing the core logic which is used to build the associated gctx command line utility.

Note: gcloud-ctx is independent and not affiliated with Google in any way.

Usage

use gcloud_ctx::{ConfigurationStore, ConflictAction};

let mut store = ConfigurationStore::with_default_location()?;

// create a new configuration, optionally with a force overwrite
use gcloud_ctx::PropertiesBuilder;
let properties = PropertiesBuilder::default()
    .project("my-project")
    .account("a.user@example.org")
    .zone("europe-west1-d")
    .region("europe-west1")
    .build();

store.create("foo", &properties, ConflictAction::Overwrite)?;

// list configurations
for config in store.configurations() {
    println!("{}", config.name());
}

// activate a configuration by name
store.activate("foo")?;

// get the active configuration
println!("{}", store.active());

// copy an existing configuration, with force overwrite
store.copy("foo", "bar", ConflictAction::Overwrite)?;

// rename an existing configuration, with force overwrite
store.rename("bar", "baz", ConflictAction::Overwrite)?;

// delete a configuration
store.delete("baz")?;

// get properties of a configuration
let properties = store.describe("foo")?;
properties.to_writer(std::io::stdout())?;

License

gcloud-ctx is distributed under the terms of the MIT license

Commit count: 100

cargo fmt