Class: UU::OperationRegistry::Container

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

Overview

Container for running applications.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session = nil) ⇒ Container

Creates a new instance of Container.

Parameters:

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

    Session to use for remote calls.



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

def initialize(session = nil)
  super
end

Class Method Details

.create(node_uri, attributes) ⇒ UU::OS::UESURI

Creates a new container. This method is a convenience shortcut for the #create instance method.

Parameters:

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

    Node URI.

  • attributes (Hash)

    Container attributes.

Returns:

  • (UU::OS::UESURI)

    UESURI of the created container.



# File 'lib/uu/operation_registry/container.rb', line 39

.delete(container_uri) ⇒ void

This method returns an undefined value.

Deletes the specified container from the registry. This method is a convenience shortcut for the #delete instance method.

Parameters:

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

    Container URI.



# File 'lib/uu/operation_registry/container.rb', line 86

.get_attributes(container_uri) ⇒ Hash

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

Parameters:

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

    Container URI.

Returns:

  • (Hash)

    Container attributes.



# File 'lib/uu/operation_registry/container.rb', line 52

.get_container_list(node_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:



114
115
116
# File 'lib/uu/operation_registry/container.rb', line 114

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

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

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

Parameters:

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

    Container URI.

Returns:

  • (UU::OS::UESURI)

    UESURI of the updated container.



# File 'lib/uu/operation_registry/container.rb', line 75

Instance Method Details

#create(node_uri, attributes) ⇒ UU::OS::UESURI

Creates a new container.

Parameters:

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

    Node URI.

  • attributes (Hash)

    Container attributes.

Options Hash (attributes):

  • name (String)

    Container name.

  • code (String)

    Container code. May be nil.

  • description (String)

    Container description. May be nil.

  • nodeImageUri (UU::OS::UESURI)

    Node image URI.

  • inboundPorts (Array<Fixnum>)

    Inbound ports. May be nil.

  • nodeSetUri (UU::OS::UESURI)

    Node set URI.

  • state (String)

    Container state. Value must be one from UU::OperationRegistry::ContainerState. May be nil.

  • appDeploymentUri (UU::OS::UESURI)

    UESURI of deployment that this container belongs to. May be nil.

Returns:

  • (UU::OS::UESURI)

    UESURI of the created container.



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

#delete(container_uri) ⇒ void

This method returns an undefined value.

Deletes the specified container from the registry.

Parameters:

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

    Container URI.



# File 'lib/uu/operation_registry/container.rb', line 81

#get_attributes(container_uri) ⇒ Hash

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

Parameters:

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

    Container URI.

Returns:

  • (Hash)

    Container attributes.



# File 'lib/uu/operation_registry/container.rb', line 46

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

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

Parameters:

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

    Node 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.



105
106
107
# File 'lib/uu/operation_registry/container.rb', line 105

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

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

Sets attributes of a container.

Parameters:

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

    Container URI.

  • attributes (Hash)

    Container attributes.

Options Hash (attributes):

  • name (String)

    Container name. May be nil.

  • code (String)

    Container code. May be nil.

  • description (String)

    Container description. May be nil.

  • inboundPorts (Array<Fixnum>)

    Inbound ports. May be nil.

  • state (String)

    Container state. Value must be one from UU::OperationRegistry::ContainerState. May be nil.

  • appDeploymentUri (UU::OS::UESURI)

    UESURI of deployment that this container belongs to. May be nil.

  • nodeSetUri (UU::OS::UESURI)

    Node set URI.

Returns:

  • (UU::OS::UESURI)

    UESURI of the updated container.



# File 'lib/uu/operation_registry/container.rb', line 59