Class: EY::CloudClient
- Inherits:
-
Object
- Object
- EY::CloudClient
- Extended by:
- Forwardable
- Defined in:
- lib/engineyard-cloud-client.rb,
lib/engineyard-cloud-client.rb,
lib/engineyard-cloud-client/errors.rb,
lib/engineyard-cloud-client/models.rb,
lib/engineyard-cloud-client/version.rb,
lib/engineyard-cloud-client/connection.rb,
lib/engineyard-cloud-client/models/app.rb,
lib/engineyard-cloud-client/models/log.rb,
lib/engineyard-cloud-client/models/user.rb,
lib/engineyard-cloud-client/model_registry.rb,
lib/engineyard-cloud-client/models/account.rb,
lib/engineyard-cloud-client/models/keypair.rb,
lib/engineyard-cloud-client/models/recipes.rb,
lib/engineyard-cloud-client/models/instance.rb,
lib/engineyard-cloud-client/resolver_result.rb,
lib/engineyard-cloud-client/models/api_struct.rb,
lib/engineyard-cloud-client/models/deployment.rb,
lib/engineyard-cloud-client/models/environment.rb,
lib/engineyard-cloud-client/models/app_environment.rb
Defined Under Namespace
Modules: Test Classes: Account, ApiStruct, App, AppEnvironment, AttributeRequiredError, BadBridgeStatusError, BadEndpointError, Connection, Deployment, Environment, Error, Instance, InstanceNotProvisioned, InvalidCredentials, InvalidInstanceName, InvalidInstanceRole, Keypair, Log, ModelRegistry, MultipleMatchesError, NoBridgeError, Recipes, RequestFailed, ResolverResult, ResourceNotFound, User
Constant Summary collapse
- VERSION =
'1.0.16'
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#app_environments ⇒ Object
TODO: unhaxor This should load an api endpoint that deals directly in app_deployments.
- #apps ⇒ Object
- #current_user ⇒ Object
-
#environment_by_name(environment_name, account_name = nil) ⇒ Object
(also: #env_by_name)
Accepts an environment name and optional account name and returns the best matching environment for the given constraints.
- #environments ⇒ Object
-
#initialize(options = {}) ⇒ CloudClient
constructor
Initialize a new EY::CloudClient.
- #registry ⇒ Object
- #resolve_app_environments(constraints) ⇒ Object
- #resolve_environments(constraints) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CloudClient
Initialize a new EY::CloudClient.
Creates and stores a new Connection for communicating with EY Cloud.
See EY::CloudClient::Connection for options.
29 30 31 |
# File 'lib/engineyard-cloud-client.rb', line 29 def initialize(={}) @connection = Connection.new() end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
22 23 24 |
# File 'lib/engineyard-cloud-client.rb', line 22 def connection @connection end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 |
# File 'lib/engineyard-cloud-client.rb', line 33 def ==(other) other.is_a?(self.class) && other.connection == connection end |
#app_environments ⇒ Object
TODO: unhaxor This should load an api endpoint that deals directly in app_deployments
59 60 61 |
# File 'lib/engineyard-cloud-client.rb', line 59 def app_environments @app_environments ||= apps.map { |app| app.app_environments }.flatten end |
#apps ⇒ Object
53 54 55 |
# File 'lib/engineyard-cloud-client.rb', line 53 def apps @apps ||= EY::CloudClient::App.all(self) end |
#current_user ⇒ Object
63 64 65 |
# File 'lib/engineyard-cloud-client.rb', line 63 def current_user EY::CloudClient::User.from_hash(self, get('/current_user')['user']) end |
#environment_by_name(environment_name, account_name = nil) ⇒ Object Also known as: env_by_name
Accepts an environment name and optional account name and returns the best matching environment for the given constraints.
This is a shortcut for Environment.resolve Raises if nothing is found or if more than one env is found.
72 73 74 |
# File 'lib/engineyard-cloud-client.rb', line 72 def environment_by_name(environment_name, account_name=nil) EY::CloudClient::Environment.by_name(self, environment_name, account_name) end |
#environments ⇒ Object
49 50 51 |
# File 'lib/engineyard-cloud-client.rb', line 49 def environments @environments ||= EY::CloudClient::Environment.all(self) end |
#registry ⇒ Object
37 38 39 |
# File 'lib/engineyard-cloud-client.rb', line 37 def registry @registry ||= ModelRegistry.new end |
#resolve_app_environments(constraints) ⇒ Object
45 46 47 |
# File 'lib/engineyard-cloud-client.rb', line 45 def resolve_app_environments(constraints) EY::CloudClient::AppEnvironment.resolve(self, constraints) end |
#resolve_environments(constraints) ⇒ Object
41 42 43 |
# File 'lib/engineyard-cloud-client.rb', line 41 def resolve_environments(constraints) EY::CloudClient::Environment.resolve(self, constraints) end |