[−][src]Struct openstack::Cloud
OpenStack cloud API.
Provides high-level API for working with OpenStack clouds.
Methods
impl Cloud[src]
pub fn new<Auth: AuthMethod + 'static>(auth_method: Auth) -> Cloud[src]
Create a new cloud object with a given authentication plugin.
See auth module for details on how to authenticate
against OpenStack clouds.
Example
fn cloud() -> openstack::Result<openstack::Cloud> { let auth = openstack::auth::Password::new( "https://cloud.example.com", "user1", "pa$$word", "Default") .expect("Invalid authentication URL") .with_project_scope("project1", "Default"); Ok(openstack::Cloud::new(auth)) }
See Also
- from_config to create a Cloud from clouds.yaml
- from_env to create a Cloud from environment variables
pub fn from_config<S: AsRef<str>>(cloud_name: S) -> Result<Cloud>[src]
Create a new cloud object from a configuration file
Example
let os = openstack::Cloud::from_config("cloud-1")?;
pub fn from_env() -> Result<Cloud>[src]
Create a new cloud object from environment variables.
Example
let os = openstack::Cloud::from_env()?;
pub fn with_endpoint_interface<S>(self, endpoint_interface: S) -> Cloud where
S: Into<String>, [src]
S: Into<String>,
Convert this cloud into one using the given endpoint interface.
Example
fn cloud_from_env() -> openstack::Result<openstack::Cloud> { openstack::Cloud::from_env() .map(|os| os.with_endpoint_interface("internal")) }
pub fn refresh(&mut self) -> Result<()>[src]
Refresh this Cloud object (renew token, refetch service catalog, etc).
pub fn find_flavors(&self) -> FlavorQuery[src]
Build a query against flavor list.
The returned object is a builder that should be used to construct the query.
pub fn find_floating_ips(&self) -> FloatingIpQuery[src]
Build a query against floating IP list.
The returned object is a builder that should be used to construct the query.
pub fn find_images(&self) -> ImageQuery[src]
Build a query against image list.
The returned object is a builder that should be used to construct the query.
pub fn find_keypairs(&self) -> KeyPairQuery[src]
Build a query against key pairs list.
The returned object is a builder that should be used to construct the query.
pub fn find_networks(&self) -> NetworkQuery[src]
Build a query against network list.
The returned object is a builder that should be used to construct the query.
pub fn find_ports(&self) -> PortQuery[src]
Build a query against port list.
The returned object is a builder that should be used to construct the query.
pub fn find_servers(&self) -> ServerQuery[src]
Build a query against server list.
The returned object is a builder that should be used to construct the query.
Example
Sorting servers by access_ip_v4 and getting first 5 results:
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let sorting = openstack::compute::ServerSortKey::AccessIpv4; let server_list = os.find_servers() .sort_by(openstack::Sort::Asc(sorting)).with_limit(5) .all().expect("Unable to fetch servers");
pub fn find_subnets(&self) -> SubnetQuery[src]
Build a query against subnet list.
The returned object is a builder that should be used to construct the query.
pub fn get_flavor<Id: AsRef<str>>(&self, id_or_name: Id) -> Result<Flavor>[src]
Find a flavor by its name or ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_flavor("m1.medium").expect("Unable to get a flavor");
pub fn get_floating_ip<Id: AsRef<str>>(&self, id: Id) -> Result<FloatingIp>[src]
Find a floating IP by its ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_floating_ip("031e08c7-2ca7-4c0b-9923-030c8d946ba4") .expect("Unable to get a floating IP");
pub fn get_image<Id: AsRef<str>>(&self, id_or_name: Id) -> Result<Image>[src]
Find an image by its name or ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_image("centos7").expect("Unable to get a image");
pub fn get_keypair<Id: AsRef<str>>(&self, name: Id) -> Result<KeyPair>[src]
Find a key pair by its name or ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_keypair("default").expect("Unable to get a key pair");
pub fn get_network<Id: AsRef<str>>(&self, id_or_name: Id) -> Result<Network>[src]
Find an network by its name or ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_network("centos7").expect("Unable to get a network");
pub fn get_port<Id: AsRef<str>>(&self, id_or_name: Id) -> Result<Port>[src]
Find an port by its name or ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_port("4d9c1710-fa02-49f9-8218-291024ef4140") .expect("Unable to get a port");
pub fn get_server<Id: AsRef<str>>(&self, id_or_name: Id) -> Result<Server>[src]
Find a server by its name or ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_server("8a1c355b-2e1e-440a-8aa8-f272df72bc32") .expect("Unable to get a server");
pub fn get_subnet<Id: AsRef<str>>(&self, id_or_name: Id) -> Result<Subnet>[src]
Find an subnet by its name or ID.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server = os.get_subnet("private-subnet") .expect("Unable to get a subnet");
pub fn list_flavors(&self) -> Result<Vec<FlavorSummary>>[src]
List all flavors.
This call can yield a lot of results, use the find_flavors call to limit the number of flavors to receive.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server_list = os.list_flavors().expect("Unable to fetch flavors");
pub fn list_floating_ips(&self) -> Result<Vec<FloatingIp>>[src]
List all floating IPs
This call can yield a lot of results, use the find_floating_ips call to limit the number of networks to receive.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server_list = os.list_floating_ips().expect("Unable to fetch floating IPs");
pub fn list_images(&self) -> Result<Vec<Image>>[src]
List all images.
This call can yield a lot of results, use the find_images call to limit the number of images to receive.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server_list = os.list_images().expect("Unable to fetch images");
pub fn list_keypairs(&self) -> Result<Vec<KeyPair>>[src]
List all key pairs.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let result = os.list_keypairs().expect("Unable to fetch key pairs");
pub fn list_networks(&self) -> Result<Vec<Network>>[src]
List all networks.
This call can yield a lot of results, use the find_networks call to limit the number of networks to receive.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server_list = os.list_networks().expect("Unable to fetch networks");
pub fn list_ports(&self) -> Result<Vec<Port>>[src]
List all ports.
This call can yield a lot of results, use the find_ports call to limit the number of ports to receive.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server_list = os.list_ports().expect("Unable to fetch ports");
pub fn list_servers(&self) -> Result<Vec<ServerSummary>>[src]
List all servers.
This call can yield a lot of results, use the find_servers call to limit the number of servers to receive.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server_list = os.list_servers().expect("Unable to fetch servers");
pub fn list_subnets(&self) -> Result<Vec<Subnet>>[src]
List all subnets.
This call can yield a lot of results, use the find_subnets call to limit the number of subnets to receive.
Example
use openstack; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let server_list = os.list_subnets().expect("Unable to fetch subnets");
pub fn new_floating_ip<N>(&self, floating_network: N) -> NewFloatingIp where
N: Into<NetworkRef>, [src]
N: Into<NetworkRef>,
Prepare a new floating IP for creation.
This call returns a NewFloatingIp object, which is a builder
to populate floating IP fields.
pub fn new_keypair<S>(&self, name: S) -> NewKeyPair where
S: Into<String>, [src]
S: Into<String>,
Prepare a new key pair for creation.
This call returns a NewKeyPair object, which is a builder to populate
key pair fields.
pub fn new_network(&self) -> NewNetwork[src]
Prepare a new network for creation.
This call returns a NewNetwork object, which is a builder to populate
network fields.
pub fn new_port<N>(&self, network: N) -> NewPort where
N: Into<NetworkRef>, [src]
N: Into<NetworkRef>,
Prepare a new port for creation.
This call returns a NewPort object, which is a builder to populate
port fields.
pub fn new_server<S, F>(&self, name: S, flavor: F) -> NewServer where
S: Into<String>,
F: Into<FlavorRef>, [src]
S: Into<String>,
F: Into<FlavorRef>,
Prepare a new server for creation.
This call returns a NewServer object, which is a builder to populate
server fields.
pub fn new_subnet<N>(&self, network: N, cidr: IpNet) -> NewSubnet where
N: Into<NetworkRef>, [src]
N: Into<NetworkRef>,
Prepare a new subnet for creation.
This call returns a NewSubnet object, which is a builder to populate
subnet fields.
Example
extern crate ipnet; extern crate openstack; use std::net; let os = openstack::Cloud::from_env().expect("Unable to authenticate"); let cidr = ipnet::Ipv4Net::new(net::Ipv4Addr::new(192, 168, 1, 0), 24) .unwrap().into(); let new_subnet = os.new_subnet("private-net", cidr) .with_name("private-subnet") .create().expect("Unable to create subnet");
Trait Implementations
impl Clone for Cloud[src]
fn clone(&self) -> Cloud[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl From<Session> for Cloud[src]
impl Debug for Cloud[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> From for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,