Class: UU::OperationRegistry::Cloud

Inherits:
BaseMethods
  • Object
show all
Defined in:
lib/uu/operation_registry/cloud.rb

Overview

Cloud.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session = nil) ⇒ Cloud

Creates a new instance of Cloud.

Parameters:

  • session (UU::OS::Security::Session) (defaults to: nil)

    Session to use for remote calls.



18
19
20
# File 'lib/uu/operation_registry/cloud.rb', line 18

def initialize(session = nil)
  super
end

Class Method Details

.get_app_deployment_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of app deployments. This method is a convenience shortcut for the #get_app_deployment_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



370
371
372
# File 'lib/uu/operation_registry/cloud.rb', line 370

def self.get_app_deployment_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_app_deployment_list(cloud_uri, criteria)
end

.get_app_share_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of app shares. This method is a convenience shortcut for the #get_app_share_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



397
398
399
# File 'lib/uu/operation_registry/cloud.rb', line 397

def self.get_app_share_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_app_share_list(cloud_uri, criteria)
end

.get_attributes(cloud_uri) ⇒ Hash

Gets the attributes of the cloud specified by cloud URI and returns its detail. This method is a convenience shortcut for the #get_attributes instance method.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

Returns:

  • (Hash)

    Cloud attributes.



# File 'lib/uu/operation_registry/cloud.rb', line 38

.get_container_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of containers. This method is a convenience shortcut for the #get_container_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



121
122
123
# File 'lib/uu/operation_registry/cloud.rb', line 121

def self.get_container_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_container_list(cloud_uri, criteria)
end

.get_host_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of hosts. This method is a convenience shortcut for the #get_host_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



291
292
293
# File 'lib/uu/operation_registry/cloud.rb', line 291

def self.get_host_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_host_list(cloud_uri, criteria)
end

.get_msg_bus_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of message busses. This method is a convenience shortcut for the #get_msg_bus_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



318
319
320
# File 'lib/uu/operation_registry/cloud.rb', line 318

def self.get_msg_bus_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_msg_bus_list(cloud_uri, criteria)
end

.get_node_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of nodes. This method is a convenience shortcut for the #get_node_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



344
345
346
# File 'lib/uu/operation_registry/cloud.rb', line 344

def self.get_node_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_node_list(cloud_uri, criteria)
end

.get_node_set_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of node sets. This method is a convenience shortcut for the #get_node_set_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



424
425
426
# File 'lib/uu/operation_registry/cloud.rb', line 424

def self.get_node_set_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_node_set_list(cloud_uri, criteria)
end

.get_resource_group_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of resource groups. This method is a convenience shortcut for the #get_resource_group_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



147
148
149
# File 'lib/uu/operation_registry/cloud.rb', line 147

def self.get_resource_group_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_resource_group_list(cloud_uri, criteria)
end

.get_resource_group_stats(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns a list of statistics for resource groups in the given cloud. This method is a convenience shortcut for the #get_resource_group_stats instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



238
239
240
# File 'lib/uu/operation_registry/cloud.rb', line 238

def self.get_resource_group_stats(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_resource_group_stats(cloud_uri, criteria)
end

.get_resource_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of resources. This method is a convenience shortcut for the #get_resource_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



451
452
453
# File 'lib/uu/operation_registry/cloud.rb', line 451

def self.get_resource_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_resource_list(cloud_uri, criteria)
end

.get_resource_pool_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of resource pools. This method is a convenience shortcut for the #get_resource_pool_list instance method.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.

See Also:



264
265
266
# File 'lib/uu/operation_registry/cloud.rb', line 264

def self.get_resource_pool_list(cloud_uri, criteria = {})
  self.new(UU::OS::Security::Session.current_session).get_resource_pool_list(cloud_uri, criteria)
end

.set_attributes(cloud_uri, attributes) ⇒ UU::OS::UESURI

Sets attributes of a Cloud. This method is a convenience shortcut for the #set_attributes instance method.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

Returns:

  • (UU::OS::UESURI)

    UESURI of the updated Cloud.



95
96
97
# File 'lib/uu/operation_registry/cloud.rb', line 95

def self.set_attributes(cloud_uri, attributes)
  self.new(UU::OS::Security::Session.current_session).set_attributes(cloud_uri, attributes)
end

Instance Method Details

#get_app_deployment_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of app deployments in the given cloud. Command does not return all nodes, only a sublist. The list of returned nodes could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing app deployments.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, appBoxUri, resourcePoolUri, tenantUri, state, urlPath

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



361
362
363
# File 'lib/uu/operation_registry/cloud.rb', line 361

def get_app_deployment_list(cloud_uri, criteria = {})
  @client.invoke(:getAppDeploymentList, cloud_uri, parameters: criteria)
end

#get_app_share_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of app shares in the given cloud. Command does not return all nodes, only a sublist. The list of returned nodes could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing app shares.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, tenantUri, urlPath, appDeploymentUri

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



388
389
390
# File 'lib/uu/operation_registry/cloud.rb', line 388

def get_app_share_list(cloud_uri, criteria = {})
  @client.invoke(:getAppShareList, cloud_uri, parameters: criteria)
end

#get_attributes(cloud_uri) ⇒ Hash

Gets the attributes of the cloud specified by cloud URI and returns its detail.

Examples:

Response

{
  :name => "Plus4U Cloud",
  :code => "PLUS4U_CLOUD",
  :operTerOid => "0",
  :operTerCode => "OT-BT",
  :env => "{\"uuClientProperties\":{\"uu.server-url\":\"https://api.plus4u.net\",\"uu.c3.base_url\":\"https://sys.plus4u.net\",\"uu.c3.append_routing_data\":\"false\",\"uu.operation.registry.base_url\":\"https://sys.plus4u.net\",\"uu.operation.registry.append_routing_data\":\"false\"},\"gemrc\":{\":backtrace\":\"false\",\":benchmark\":\"false\",\":bulk_threshold\":\"100\",\":sources\":[\"http://rubygems.org\",\"http://gems.plus4u.net\"],\":update_sources\":\"true\",\":verbose\":\"false\",\"gem\":\"--env-shebang --no-doc --no-ri --no-document\"}}",
  :uri => "ues:OT-BT[0]:PLUS4U_CLOUD[58ea977fab27248ac0d96d36]"
}

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

Returns:

  • (Hash)

    Cloud attributes.



# File 'lib/uu/operation_registry/cloud.rb', line 22

#get_container_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns a list of containers in the given cloud. Command does not return all containers, only a sublist. The list of returned containers could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing containers.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: name, code, nodeImageUri, nodeUri, nodeSetUri, state

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



112
113
114
# File 'lib/uu/operation_registry/cloud.rb', line 112

def get_container_list(cloud_uri, criteria = {})
  @client.invoke(:getContainerList, cloud_uri, parameters: criteria)
end

#get_host_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns a list of hosts in the given cloud. Command does not return all hosts, only a sublist. The list of returned hosts could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing hosts.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, state, hostname, resourceGroupUri, totalCapacity, freeCapacity

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



282
283
284
# File 'lib/uu/operation_registry/cloud.rb', line 282

def get_host_list(cloud_uri, criteria = {})
  @client.invoke(:getHostList, cloud_uri, parameters: criteria)
end

#get_msg_bus_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns a list of message busses in the given cloud. Command does not return all message busses, only a sublist. The list of returned message busses could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing message busses.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, repositoryUri, tenantUri, queuePairsLimit, state, labels

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



309
310
311
# File 'lib/uu/operation_registry/cloud.rb', line 309

def get_msg_bus_list(cloud_uri, criteria = {})
  @client.invoke(:getMsgBusList, cloud_uri, parameters: criteria)
end

#get_node_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns a list of nodes in the given cloud. Command does not return all nodes, only a sublist. The list of returned nodes could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing nodes.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, nodeSizeUri, hostUri, resourcePoolUri

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



335
336
337
# File 'lib/uu/operation_registry/cloud.rb', line 335

def get_node_list(cloud_uri, criteria = {})
  @client.invoke(:getNodeList, cloud_uri, parameters: criteria)
end

#get_node_set_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Note:

Attributes “nodeSizeUri”, “nodeCount” and “inboundPorts” are set only for ResourceGroup of type “SWARM”.

Returns list of node sets in the given cloud. Command does not return all nodes, only a sublist. The list of returned nodes could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing node sets.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, tenantUri, urlPath, appDeploymentUri

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



415
416
417
# File 'lib/uu/operation_registry/cloud.rb', line 415

def get_node_set_list(cloud_uri, criteria = {})
  @client.invoke(:getNodeSetList, cloud_uri, parameters: criteria)
end

#get_resource_group_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns a list of resource groups in the given cloud. Command does not return all resource groups, only a sublist. The list of returned resource groups could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing resource groups.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, regionUri

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



138
139
140
# File 'lib/uu/operation_registry/cloud.rb', line 138

def get_resource_group_list(cloud_uri, criteria = {})
  @client.invoke(:getResourceGroupList, cloud_uri, parameters: criteria)
end

#get_resource_group_stats(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Note:

This command returns canonical form of ResourceGroup UESURI (i.e. UESURI containing only IDs, not codes).

Returns a list of statistics for resource groups in the given cloud. The list of returned statistics could be filtered using Mongo Query.

Examples:

Response


{
  :totalSize => 2,
  :criteria => {
    :pageIndex => 0,
    :pageSize => 1000
  },
  :pageEntries => [
    {
      :groupUri => "ues:[99923616732452117]:[59cde284f8458af04c9c5541]",
      :name => "System Resource Group",
      :description => "Operation of system services",
      :stats => {
        :total => {
          :cpu => 96,
          :mem => 72000,
          :storage => 120000
        },
        :free => {
          :cpu => 75,
          :mem => 61500,
          :storage => 99000
        },
        :availableNodes => {
          :G1_S => 75,
          :G1_M => 60,
          :G1_L => 29,
          :G1_XL => 10,
          :C1_S => 37,
          :C1_M => 18,
          :C1_L => 8
        }
      }
    },
    {
     :groupUri => "ues:[99923616732452117]:[59cde288f8458af49d9c5543]",
     :name => "uuApps Resource Group",
     :description => "Operation of uuApps for uuOS 8",
     :stats => {
       :total => {
         :cpu => 32,
         :mem => 24000,
         :storage => 40000
        },
       :free => {
         :cpu => 25,
         :mem => 20500,
         :storage => 33000
        },
       :availableNodes => {
         :G1_S => 25,
         :G1_M => 20,
         :G1_L => 10,
         :G1_XL => 4,
         :C1_S => 12,
         :C1_M => 6,
         :C1_L => 3
        }
      }
    }
  ]
}

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing resource groups.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, name, regionUri

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



229
230
231
# File 'lib/uu/operation_registry/cloud.rb', line 229

def get_resource_group_stats(cloud_uri, criteria = {})
  @client.invoke(:getResourceGroupStats, cloud_uri, parameters: criteria)
end

#get_resource_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns list of resources in the given cloud. Command does not return all resources, only a sublist. The list of returned resources could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing resources.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, regionUri, type, slaStage

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



442
443
444
# File 'lib/uu/operation_registry/cloud.rb', line 442

def get_resource_list(cloud_uri, criteria = {})
  @client.invoke(:getResourceList, cloud_uri, parameters: criteria)
end

#get_resource_pool_list(cloud_uri, criteria = {}) ⇒ UU::OS::Persistence::PagedResult<Hash>

Returns a list of resource pools in the given cloud. Command does not return all resource pools, only a sublist. The list of returned resource pools could be filtered using Mongo Query.

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • criteria (Hash) (defaults to: {})

    Criteria for listing resource pools.

Options Hash (criteria):

  • query (String)

    Mongo Query to filter the result set. See Mongo Query tutorial. Allowed query filter document fields: code, regionUri

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

  • (UU::OS::Persistence::PagedResult<Hash>)

    Paged result set.



255
256
257
# File 'lib/uu/operation_registry/cloud.rb', line 255

def get_resource_pool_list(cloud_uri, criteria = {})
  @client.invoke(:getResourcePoolList, cloud_uri, parameters: criteria)
end

#set_attributes(cloud_uri, attributes) ⇒ UU::OS::UESURI

Sets attributes of a Cloud.

Examples:

Set env JSON

require 'uu_operation_registry'
require 'json'

UU::OS::Security::Session.('...')

env = {
  "uuClientProperties" => {
    "uu.server-url" => "https://api.plus4u.net",
    "uu.c3.base_url" => "https://sys.plus4u.net",
    "uu.c3.append_routing_data" => "false",
    "uu.operation.registry.base_url" => "https://sys.plus4u.net",
    "uu.operation.registry.append_routing_data" => "false"
  },
  "gemrc" => {
    ":backtrace" => "false",
    ":benchmark" => "false",
    ":bulk_threshold" => "100",
    ":sources" => [
      "http://rubygems.org",
      "http://gems.plus4u.net"
    ],
    ":update_sources" => "true",
    ":verbose" => "false",
    "gem" => "--env-shebang --no-doc --no-ri --no-document"
  }
}

UU::OperationRegistry::Cloud.set_attributes(
  'ues:CLOUD:URI',
  :env => env.to_json
)

Parameters:

  • cloud_uri (String, UU::OS::UESURI)

    Cloud URI.

  • attributes (Hash)

    Cloud attributes.

Options Hash (attributes):

  • env (String)

    Env configuration JSON. Contains configuration (gemrc, uu-client.properties) for nodes deployed in the context of the Cloud. May be nil.

Returns:

  • (UU::OS::UESURI)

    UESURI of the updated Cloud.



86
87
88
# File 'lib/uu/operation_registry/cloud.rb', line 86

def set_attributes(cloud_uri, attributes)
  @client.invoke(:setAttributes, cloud_uri, parameters: attributes)
end