Struct ConfigurationStore

Source
pub struct ConfigurationStore { /* private fields */ }
Expand description

Represents the store of gcloud configurations

Implementations§

Source§

impl ConfigurationStore

Source

pub fn with_default_location() -> Result<Self>

Opens the configuration store using the OS-specific defaults

If the CLOUDSDK_CONFIG environment variable is set then this will be used, otherwise an OS-specific default location will be used, as defined by the dirs crate, e.g.:

  • Windows: %APPDATA%\gcloud
  • Linux: ~/.config/gcloud
  • Mac: ~/.config/gcloud - note that this does not follow the Apple Developer Guidelines
Source

pub fn with_location(gcloud_path: PathBuf) -> Result<Self>

Opens a configuration store at the given path

Source

pub fn active(&self) -> &str

Get the name of the currently active configuration

Source

pub fn configurations(&self) -> Vec<&Configuration>

Get the collection of currently available configurations

Source

pub fn is_active(&self, configuration: &Configuration) -> bool

Check if the given configuration is active

Source

pub fn activate(&mut self, name: &str) -> Result<()>

Activate a configuration by name

Source

pub fn copy( &mut self, src_name: &str, dest_name: &str, conflict: ConflictAction, ) -> Result<()>

Copy an existing configuration, preserving all properties

Source

pub fn create( &mut self, name: &str, properties: &Properties, conflict: ConflictAction, ) -> Result<()>

Create a new configuration

Source

pub fn delete(&mut self, name: &str) -> Result<()>

Delete a configuration

Source

pub fn describe(&self, name: &str) -> Result<Properties>

Describe the properties in the given configuration

Source

pub fn rename( &mut self, old_name: &str, new_name: &str, conflict: ConflictAction, ) -> Result<()>

Rename a configuration

Source

pub fn find_by_name(&self, name: &str) -> Option<&Configuration>

Find a configuration by name

Trait Implementations§

Source§

impl Debug for ConfigurationStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.