Class: UU::C3::AppDeployment

Inherits:
Object
  • Object
show all
Defined in:
lib/uu/c3/app_deployment.rb

Overview

Client of service providing operations for self-service deployment of uuApps.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session = nil) ⇒ AppDeployment

Creates a new instance of AppDeployment.

Parameters:

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

    Instance of session representing authenticated user (can be obtained with OS::Security::Session#current_session method).



35
36
37
# File 'lib/uu/c3/app_deployment.rb', line 35

def initialize(session = nil)
  @client = UU::OS::CMD::CommandClient.new(PATH, session)
end

Class Method Details

.deploy(resource_pool_uri, parameters = {}) ⇒ UU::OS::Lang::Future

Deploys the specified appbox to the given pool. This method is a convenience shortcut for the #deploy instance method.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

future = UU::C3::AppDeployment.deploy("ues:DEV1234-BT:DEV",
  appBoxUri: "ues:DEV1234-BT:CDS.GB_1.0.6",
  msgBusMapping: {"MESSAGEBUS" => "ues:OT-BT:MSGBUS_042"},
  uuEEs: ["1-2345-6"])
future.get # blocking operation

Configuring uuApp at deployment time

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

future = UU::C3::AppDeployment.deploy("ues:DEV1234-BT:DEV",
  config: {
      param1: "value1",
      param2: "osid:value2", # uuAppObjectStore ID (hexa32Code; needs to be whitelisted for the uuSubApp)
      param3: "bsid:value3", # uuAppBinaryStore ID (hexa32Code; needs to be whitelisted for the uuSubApp)
      redis_uri: "redis://:secrets@example.com:1234/9"
  }
)
app_deployment_uri = future.get # blocking operation

Reading deployment-time configuration (uuApps 2.1)

# read config everywhere inside application
redis_uri = UU::OS::Application::Config[:redis_uri] # String "redis://:secrets@example.com:1234/9"

# You can set default values inside application in file project_root/config/app.rb, example:

# cds-gb/config/app.rb:

# default Redis uri used if no config parameter is set through +deploy+ method. E.g. for local development.
UU::OS::Application::Config[:redis_uri] = "redis://:secrets@localhost:1234/9"

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the deployment operation to finish.



214
215
216
# File 'lib/uu/c3/app_deployment.rb', line 214

def self.deploy(resource_pool_uri, parameters = {})
  self.new(UU::OS::Security::Session.current_session).deploy(resource_pool_uri, parameters)
end

.get_app_deployment_list(resource_pool_uri, criteria = {}) ⇒ Hash<Symbol, Object>

Returns list of applications deployed in the given pool. This method is a convenience shortcut for the #get_app_deployment_list instance method.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

apps = UU::C3::AppDeployment.get_app_deployment_list("ues:DEV1234-BT:DEV", :state => UU::C3::AppDeploymentState::DEPLOYED)

Returns:

  • (Hash<Symbol, Object>)

    Paged result set.



483
484
485
# File 'lib/uu/c3/app_deployment.rb', line 483

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

.get_app_share_list(app_deployment_uri, parameters = {}) ⇒ Hash<Symbol, Object>

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

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

list = UU::C3::AppDeployment.get_app_share_list("ues:DEV1234-BT:PROD:CDS.GB", pageSize: 30, pageIndex: 2)

Parameters:

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

    URI of app deployment to list app shares for.

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

    App share list parameters.

Options Hash (parameters):

  • pageSize (Fixnum)

    Size of one page of records. Default is 1000.

  • pageIndex (Fixnum)

    Page index where 0 means first page, 1 second and so on. Default is 0.

Returns:

  • (Hash<Symbol, Object>)

    Paged result set.



659
660
661
# File 'lib/uu/c3/app_deployment.rb', line 659

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

.get_attributes(app_deployment_uri_or_tid_asid) ⇒ Hash<Symbol, Object>

Returns attributes of app deployment identified by either its UESURI or combination of TID (Territory ID) and ASID (AppServer ID) associated with that app deployment. This method is a convenience shortcut for the #get_attributes method.

Examples:

Get attributes by app deployment UESURI

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.get_attributes("ues:[123]:[56a3b8ec69a1b474a0000086]:[56a3b8ec69a1b474a0000089]")

Get attributes by ASID

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.get_attributes("123-35830958093")

Parameters:

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

    UESURI of app deployment or TID+ASID (concatenated with a dash - e.g. “1234-5678” where “1234” is TID and “5678” is ASID).

Returns:

  • (Hash<Symbol, Object>)

    App deployment attributes.



713
714
715
# File 'lib/uu/c3/app_deployment.rb', line 713

def self.get_attributes(app_deployment_uri_or_tid_asid)
  return self.new(UU::OS::Security::Session.current_session).get_attributes(app_deployment_uri_or_tid_asid)
end

.get_effective_env(resource_pool_uri) ⇒ Hash

Returns effective environment configuration for nodes deployed in the specified resource pool. This method is a convenience shortcut for the #get_effective_env method.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

effective_env = UU::C3::AppDeployment.get_effective_env("ues:DEV1234-BT:DEV")

Parameters:

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

    URI of a resource pool.

Returns:

  • (Hash)

    Effective environment configuration.



898
899
900
# File 'lib/uu/c3/app_deployment.rb', line 898

def self.get_effective_env(resource_pool_uri)
  self.new(UU::OS::Security::Session.current_session).get_effective_env(resource_pool_uri)
end

.get_resource_pool_capacity(resource_pool_uri) ⇒ Hash<Symbol, Object>

Returns capacity overview for the given pool. This method is a convenience shortcut for the #get_resource_pool_capacity instance method.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

capacity = UU::C3::AppDeployment.get_resource_pool_capacity("ues:DEV1234-BT:DEV")

Response

{
  :uri => "ues:DEV0116-BT[84723967990075193]:DEV[58bd2f89ed26b7cf63b77088]",
  :name => "DEV0116-BT Development Pool",
  :accessGroupUri => "ues:DEV0116-BT[84723967990075193]:DEV~DEPLOYERS[93947438642013117]",
  :auditorsUri => "ues:DEV0116-BT[84723967990075193]:DEV~LOGREADERS[64294013174317893]",
  :monitoringBaseUrl => "https://telemetry.plus4u.net/uu-cloudg01-monitoring/78462435-4036e1c5896443619087eb5bde9d2b70/",
  :contractedCapacity => {
    :cpu => 5,
    :mem => 5000,
    :storage => 5000
  },
  :allocatedCapacity => {
    :cpu => 0,
    :mem => 0,
    :storage => 0
  }
}

Parameters:

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

    URI of the pool for which to get capacity.

Returns:

  • (Hash<Symbol, Object>)

    Capacity overview. Total contracted capacity (under :contractedCapacity key) and currently allocated capacity (under :allocatedCapacity key) are returned. Also returns ResourcePool name (under :name key), AccessGroup URI (under :accessGroupUri key), Auditors URI if set (under :auditorsUri key) and URL of associated monitoring application if deployed (under :monitoringBaseUrl key).



391
392
393
# File 'lib/uu/c3/app_deployment.rb', line 391

def self.get_resource_pool_capacity(resource_pool_uri)
  self.new(UU::OS::Security::Session.current_session).get_resource_pool_capacity(resource_pool_uri)
end

.get_supported_runtime_stack_list(resource_pool_uri, criteria = {}) ⇒ Hash<Symbol, Object>

Returns list of supported runtime stacks for the specified resource pool. This method is a convenience shortcut for the #get_supported_runtime_stack_list instance method.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

supported_runtime_stacks = UU::C3::AppDeployment.get_supported_runtime_stack_list("ues:DEV1234-BT:DEV")

Parameters:

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

    URI of resource pool for which to list supported runtime stacks.

Returns:

  • (Hash<Symbol, Object>)

    Paged result set.



986
987
988
# File 'lib/uu/c3/app_deployment.rb', line 986

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

.redeploy(app_deployment_uri) ⇒ UU::OS::Lang::Future

Redeploys the specified app deployment. This method is a convenience shortcut for the #redeploy instance method.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

future = UU::C3::AppDeployment.redeploy("ues:[123]:[56a3b8ec69a1b474a0000086]:[56a3b8ec69a1b474a0000089]")
app_deplyment_uri = future.get # blocking operation

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the redeployment operation to finish.



290
291
292
# File 'lib/uu/c3/app_deployment.rb', line 290

def self.redeploy(app_deployment_uri, parameters = {})
  self.new(UU::OS::Security::Session.current_session).redeploy(app_deployment_uri, parameters)
end

.scale(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future

Note:

This command is experimental. And it may not be available for use in all uuCloud regions.

Modifies the count of nodes on which the AppDeployment is deployed. This method is a convenience shortcut for the #scale method.

Examples:

Scale all NodeSets of a particular AppDeployment to the same count.

require "uu_c3"
app_deployment_uri = "ues:TER:POOL:APP_CODE"
node_count = 3

UU::OS::Security::Session.("app-deployer-passwd")
UU::C3::AppDeployment.scale(app_deployment_uri, nodeCount: node_count)

Scale the specified NodeSets of a particular AppDeployment.

require "uu_c3"
app_deployment_uri = "ues:TER:POOL:APP_CODE"

UU::OS::Security::Session.("app-deployer-passwd")

UU::C3::AppDeployment.scale(app_deployment_uri,
  nodeSets: [
    {
      nodeSetUri: "ues:NODE:SET1",
      nodeCount: 2
    },
    {
      nodeSetUri: "ues:NODE:SET2",
      nodeCount: 5
    }
  ]
)

Parameters:

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

    URI of AppDeployment to scale.

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

    Scale parameters.

Options Hash (parameters):

  • nodeCount (Fixnum)

    Number of nodes for all NodeSets of the AppDeployment. If nodeCount is specified, nodeSets must not be specified.

  • nodeSets (Array<Hash>)

    Parameters of the NodeSets to scale. If nodeSets is specified, nodeCount must not be specified. Supported keys and value types:

    • nodeSetUri (UU::OS::UESURI, String) URI of the NodeSet to scale. Required.

    • nodeCount (Fixnum) Number of nodes to scale the NodeSet to. Required.

  • targetSlot (UU::C3::AppDeploymentSlot)

    Slot of AppDeployment. Default value is ‘PRODUCTION’.

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the scale operation to finish. Note that maximum timeout of future is set to 30 seconds, which may not be sufficient time to finish scaling in all cases. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object.



822
823
824
# File 'lib/uu/c3/app_deployment.rb', line 822

def self.scale(app_deployment_uri, parameters = {})
  self.new(UU::OS::Security::Session.current_session).scale(app_deployment_uri, parameters)
end

.share(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future

Shares the specified app deployment to the given territories. This method is a convenience shortcut for the #share instance method.

(i.e. creation of the appbox activity). By default, reporting is enabled.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

UU::C3::AppDeployment.share("ues:DEV1234-BT:DEV:CDS.GB",
  territories: ["ues:MT.123:MT.123", "ues:MT.456:MT.456"]
)
future.get # blocking operation

Parameters:

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

    URI of app deployment which will be shared.

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

    AppDeployment share parameters.

Options Hash (parameters):

  • territories (Array)

    List of territory URIs where application will be shared. Maximum is 1000 territories per command.

  • reportProgress (TrueClass, FalseClass)

    Disable (false) or enable (true) progress reporting

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the share operation to finish. Note that maximum timeout of future is set to 30 seconds, which is unfortunately insufficient time to finish sharing. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object.



541
542
543
# File 'lib/uu/c3/app_deployment.rb', line 541

def self.share(app_deployment_uri, parameters = {})
  self.new(UU::OS::Security::Session.current_session).share(app_deployment_uri, parameters)
end

.swap(app_deployment_uri) ⇒ UU::OS::Lang::Future

Note:

If you are not sure what this command mean. Take some information about ‘Blue/Green deployment strategy’ before use.

Note:

Make sure you really want to do this action! Check if your ‘BETA’ slot configuration is really configured to be used on ‘PRODUCTION’ slot.

Note:

If your production application was scaled, remember that this command switch scaled nodes to ‘BETA’ slot and production will be scaled as ‘BETA’ before this action.

Note:

This command cannot be called if there is a non-nil slotMapping attribute set on a corresponding ResourceGroup.

Swaps between 'PRODUCTION' and 'BETA' slots. This will have impact on AppDeployments accessible on concrete slots(gateways for slots will be changed). This command enables to use newest version of application with zero-downtime to switch. Can be used to rollback previous stable version or test on production environment.

Parameters:

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

    URI of application.

Returns:

  • (UU::OS::Lang::Future)

    Future instance. Make sure than asynchronous part ends successfully.



928
929
930
# File 'lib/uu/c3/app_deployment.rb', line 928

def self.swap(app_deployment_uri)
  self.new(UU::OS::Security::Session.current_session).swap(app_deployment_uri)
end

.undeploy(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future?

Undeploys the specified uuApp from the pool and releases all related allocated resources. This method is a convenience shortcut for the #undeploy instance method.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
future = app_deployment.undeploy("ues:[123]:[56a3b8ec69a1b474a0000086]:[56a3b8ec69a1b474a0000089]")
future.get # blocking operation

Returns:

  • (UU::OS::Lang::Future, nil)

    Instance of future to use to wait for the undeployment operation to finish. Returns nil if no deployed resources were found.



262
263
264
# File 'lib/uu/c3/app_deployment.rb', line 262

def self.undeploy(app_deployment_uri, parameters = {})
  self.new(UU::OS::Security::Session.current_session).undeploy(app_deployment_uri, parameters)
end

.unshare(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future

Terminates sharing of the specified app deployment for the given territories. This method is a convenience shortcut for the #unshare instance method.

(i.e. creation of the appbox activity). By default, reporting is enabled.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

future = UU::C3::AppDeployment.unshare("ues:DEV1234-BT:DEV:CDS.GB",
  territories: ["ues:MT.123:MT.123", "ues:MT.456:MT.456"]
)
future.get # blocking operation

Parameters:

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

    URI of app deployment which will be unshared.

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

    AppDeployment unshare parameters.

Options Hash (parameters):

  • territories (Array)

    List of territory URIs from where the app deployment will be unshared. Maximum is 1000 territories per command.

  • reportProgress (TrueClass, FalseClass)

    Disable (false) or enable (true) progress reporting

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the unshare operation to finish. Note that maximum timeout of future is set to 30 seconds, which is unfortunately insufficient time to finish unsharing. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object.



601
602
603
# File 'lib/uu/c3/app_deployment.rb', line 601

def self.unshare(app_deployment_uri, parameters = {})
  self.new(UU::OS::Security::Session.current_session).unshare(app_deployment_uri, parameters)
end

Instance Method Details

#deploy(resource_pool_uri, parameters = {}) ⇒ UU::OS::Lang::Future, UU::OS::UESURI

Deploys the specified appbox to the given pool.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
future = app_deployment.deploy("ues:DEV1234-BT:DEV",
  appBoxUri: "ues:DEV1234-BT:CDS.GB_1.0.6",
  msgBusMapping: {"MESSAGEBUS" => "ues:OT-BT:MSGBUS_042"},
  uuEEs: ["1-2345-6"])
future.get # blocking operation

Configuring uuApp at deployment time

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
future = app_deployment.deploy("ues:DEV1234-BT:DEV",
  appBoxUri: "ues:DEV1234-BT:CDS.GB_1.0.6",
  config: {
      param1: "value1",
      param2: "osid:value2", # uuAppObjectStore ID (hexa32Code; needs to be whitelisted for the uuSubApp)
      param3: "bsid:value3", # uuAppBinaryStore ID (hexa32Code; needs to be whitelisted for the uuSubApp)
      redis_uri: "redis://:secrets@example.com:1234/9"
  }
)
app_deployment_uri = future.get # blocking operation

Reading deployment-time configuration (uuApps 2.1)

# read config everywhere inside application
redis_uri = UU::OS::Application::Config[:redis_uri] # String "redis://:secrets@example.com:1234/9"

# You can set default values inside application in file project_root/config/app.rb, example:

# cds-gb/config/app.rb:

# default Redis uri used if no config parameter is set through +deploy+ method. E.g. for local development.
UU::OS::Application::Config[:redis_uri] = "redis://:secrets@localhost:1234/9"

Parameters:

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

    Target pool to deploy appbox to. This parameter is required.

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

    AppDeployment parameters.

Options Hash (parameters):

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

    The appbox to deploy. This parameter is required.

  • uuEEs (Array<String>)

    Optional list of uuEEs (identified by +4U ID) to use by the deployed application in the territory specified by resource_pool_uri. May be nil. If this parameter is specified, the list is validated against whitelist configured in UU Cloud metadata (by UU Cloud provider) - only uuEEs specified in the whitelist may be used by the app in the target territory (identified by resource_pool_uri); if this parameter contains uuEEs not specified in the whitelist, the command fails with an exception (since uuC3 1.2.4). If this parameter is not specified, the list of uuEEs is obtained from the whitelist stored in UU Cloud metadata, if specified for the given app and territory (since uuC3 1.2.4).

  • msgBusMapping (Hash<String, String>)

    In case message bus usage is declared in application deployment descriptors (which is necessary for asynchronous commands to work), mapping from alias message bus code to actual message bus to use must be provided. It is done via simple key-value hash, where key is message bus code used in deployment descriptors and value is UESURI of an existing message bus. May be nil.

  • config (Hash<String, Object>)

    Optional application configuration. Configuration is readable everywhere across the deployed application through OS::Application::Config class. Typically is used for production runtime configuration like resources URI (URI to uuAppObjectStore, uuAppBinaryStore, Redis etc.) Parameter may contain only uuJson serializable data (as described in UNI-BT:44191583772172834). It means that only basic values are supported (String, Fixnum, Boolean, Hash, Array), others object are serialized to String. For example if you use ruby Time class as parameter, so String “2016-02-15 13:54:33 +0100” (serialized Time) will be available in application.

  • forceBuild (TrueClass, FalseClass)

    Flag determining whether to force building new uuNode images (regardless whether they exist for the given uuApp Box version or not) or to reuse existing uuNode images (if they exist). Default behaviour is to reuse existing uuNode images (i.e. false value).

    • true means that any existing uuNode images for this uuApp Box version are ignored and new ones get built anew.

      • Positive effect: uuNodes get deployed with images built from uuApp Packs attached to the uuApp Box being deployed.

      • Negative effect: The deployment process takes more time because uuNode images need to be built afresh (even if they already exist).

    • false (default value) means that uuNode images get built only if they don't exist for the given uuApp Box version).

      • Positive effect: The deployment process may take less time if the uuNode images already exist.

    It is recommended to not set this flag if you are not sure. May be nil.

    Note that you cannot set forceBuild for currently deployed applications. If you need to rebuild uuNode images for deployed application you have two options:

    • undeploy the application first and then deploy with forceBuild

    • change application version

    The reason is that there cannot exist two uuNode images for the same version of the same application.

  • asid (String)

    AppServer identifier. May be nil but an AppServer with the specified ASID must exist if specified. Only applicable to uuAppsg01 (UAF uuApps).

  • returnFuture (TrueClass, FalseClass)

    Flag determining whether to return future (true) that is used to wait for the end of the asynchronous part of the deploy or to return appDeploymentUri instead (false). May be nil. Default value is true to preserve backward compatibility.

  • targetSlot (UU::C3::AppDeploymentSlot)

    Slot used for AppDeployment. Slot defines how will be application accessible. Point of slots is enable testing on production environment and following swap on the production gateway.(Principe of Blue/Green Deployment) For classic deploy and access application over standard gateway is defined slot ‘PRODUCTION’(default value). For testing in production environment is defined slot ‘BETA’.

    Note: Configuration used in ‘BETA’ slot will be after swap used in ‘PRODUCTION’ slot.

Returns:

  • (UU::OS::Lang::Future, UU::OS::UESURI)

    Either instance of future to use to wait for the deployment operation to finish (Note that maximum timeout of future is set to 30 seconds, which is unfortunately insufficient time to finish deployment. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object. Future.get returns appDeploymentUri usable e.g. for the #undeploy method.) or appDeploymentUri. See parameter returnFuture.

See Also:



166
167
168
169
170
# File 'lib/uu/c3/app_deployment.rb', line 166

def deploy(resource_pool_uri, parameters = {})
  result = @client.invoke(:deploy, resource_pool_uri, parameters: parameters)
  return UU::OS::UESURI.new(result) if result.is_a?(String)
  result
end

#get_app_deployment_list(resource_pool_uri, criteria = {}) ⇒ Hash<Symbol, Object>

Returns list of applications deployed in the given pool.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
apps = app_deployment.get_app_deployment_list("ues:DEV1234-BT:DEV", :state => UU::C3::AppDeploymentState::DEPLOYED)

Response

{
    :totalSize => 1300,
    :criteria => {
        :pageIndex => 2,
        :pageSize => 30
    },
    :pageEntries => {
        :appBoxUri => "ues:[123]:[456]",
        :asid => "df590bef9e834400bc379185d2a43116",
        :appBoxCode => "FOO_ART",
        :code => "CDS.GB",
        :state => "DEPLOYED",
        :version => "1.0.84",
        :urlPath => "/cds-gb",
        :multitenant => true,
        :config => {
            code => "CDS.GB",
            :version => "1.0.84",
            :urlPath => "/cds-gb"
        },
        :resourcePoolUri => "ues:TERRITORY[123]:POOL[59955e0d123ddbdfe046c6f8]",
        :tenantUri => "ues:OT-BT[0]:TERRITORY[59955e0d123ddb574146c6f6]",
        :lastStateChange => "2017-08-17T09:12:54.052Z",
        :uri => "ues:TERRITORY[123]:POOL[59955e0d123ddbdfe046c6f8]:CDS.GB[59955e0e123ddb387646c6fc]",
        :nodeSets => [
            {
                :uri => "ues:TERRITORY[99923616732452117]:CDS_GB_VUC_PACK/CDS_GB_VUC_CONTAINER/CDS_BT[5739c55927928929b914820f]",
                :code => "CDS_GB_VUC_PACK/CDS_GB_VUC_CONTAINER/CDS_BT",
                :nodeCount => 1
            },
            {
                :uri => "ues:TERRITORY[99923616732452117]:CDS_GB_CMD_PACK/CDS_GB_CMD_CONTAINER/CDS_BT[5739c55927928929b914820f]",
                :code => "CDS_GB_CMD_PACK/CDS_GB_CMD_CONTAINER/CDS_BT",
                :nodeCount => 1
            }
        ],
        :allocatedCapacity => {
            :cpu => 2100,
            :mem => 2100,
            :storage => 2100
        },
        :msgBusses => [
            {
                :msgBusUri => "ues:SYSTEM:MSGBUS01",
                :queuePairsCount => 2
            },
            {
                :msgBusUri => "ues:SYSTEM:MSGBUS02",
                :queuePairsCount => 1
            }
        ]
    }
}

Parameters:

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

    URI of the pool for which to get deployed applications list.

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

    Optional criteria for listing deployments.

Options Hash (criteria):

  • state (UU::C3::AppDeploymentState, String)

    State of AppDeployment.

  • pageSize (Fixnum)

    Size of one page of records. Default is 1000.

  • pageIndex (Fixnum)

    Page index where 0 means first page, 1 second and so on. Default is 0.

Returns:

  • (Hash<Symbol, Object>)

    Paged result set.

See Also:



468
469
470
# File 'lib/uu/c3/app_deployment.rb', line 468

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

#get_app_share_list(app_deployment_uri, parameters = {}) ⇒ Hash<Symbol, Object>

Returns list of application shares.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
list = app_deployment.get_app_share_list("ues:DEV1234-BT:PROD:CDS.GB", pageSize: 30, pageIndex: 2)

Response

{
  :totalSize => 1300,
  :criteria => {
    :pageIndex => 2,
    :pageSize => 30
  },
  :pageEntries => [
    {
      :uri => "ues:MT_123:MT_123/CDS_GB",
      :code => "MT_123/CDS_GB",
      :urlPath => "/cds-gb",
      :appDeploymentUri => "ues:MT_123:POOL:CDS.GB",
      :territoryUri => "ues:MT_123:MT_123"
    }
    # ...
  ]
}

Parameters:

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

    URI of app deployment to list app shares for.

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

    App share list parameters.

Options Hash (parameters):

  • pageSize (Fixnum)

    Size of one page of records. Default is 1000.

  • pageIndex (Fixnum)

    Page index where 0 means first page, 1 second and so on. Default is 0.

Returns:

  • (Hash<Symbol, Object>)

    Paged result set.

See Also:



640
641
642
# File 'lib/uu/c3/app_deployment.rb', line 640

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

#get_attributes(app_deployment_uri_or_tid_asid) ⇒ Hash<Symbol, Object>

Returns attributes of app deployment identified by either its UESURI or combination of TID (Territory ID) and ASID (AppServer ID) associated with that app deployment.

Examples:

Get attributes by app deployment UESURI

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
attrs = app_deployment.get_attributes("ues:[123]:[56a3b8ec69a1b474a0000086]:[56a3b8ec69a1b474a0000089]")

Get attributes by ASID

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
attrs = app_deployment.get_attributes("123-35830958093")

Parameters:

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

    UESURI of app deployment or TID+ASID (concatenated with a dash - e.g. “1234-5678”).

Returns:

  • (Hash<Symbol, Object>)

    App deployment attributes.



686
687
688
# File 'lib/uu/c3/app_deployment.rb', line 686

def get_attributes(app_deployment_uri_or_tid_asid)
  return @client.invoke(:getAttributes, app_deployment_uri_or_tid_asid)
end

#get_effective_env(resource_pool_uri) ⇒ Hash

Returns effective environment configuration for nodes deployed in the specified resource pool.

"Effective" means that the values are possibly merged from multiple sources (cloud, region, resource group, resource pool) and the values are taken according to the level of granularity of those sources.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
effective_env = app_deployment.get_effective_env("ues:DEV1234-BT:DEV")

Response

{
 "uuClientProperties": {
   "source": "Cloud",
   "sourceUri": "ues:OT-BT[91343612732354324]:PLUS4U_CLOUD[31cs2238f1428au1b19n513n]",
   "value": {
     "uu.server-url": "https://api.plus4u.net",
     "uu.c3.base_url": "https://sys.plus4u.net",
     "uu.c3.append_routing_data": "false",
     "uu.imagecatalog.server-path-prefix": "/c00",
     "uu.objectstore.server-path-prefix": "/c00",
     "uu.operation.registry.base_uri": "https://sys.plus4u.net",
     "uu.operation.registry.append_routing_data": "false"
   }
 },
 "gemrc": {
   "source": "Cloud",
   "sourceUri": "ues:OT-BT[91343612732354324]:PLUS4U_CLOUD[31cs2238f1428au1b19n513n]",
   "value": {
     ":backtrace": "false",
     ":benchmark": "false",
     ":bulk_trashold": "100",
     ":sources": [
       "http://rubygems.org",
       "http://gems.plus4u.net"
     ],
     ":update_sources": "true",
     ":verbose": "false",
     "gem": "--env-shebang --no-doc --no-ri --no-document"
   }
 }
}

Parameters:

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

    URI of a resource pool.

Returns:

  • (Hash)

    Effective environment configuration.

    • source - determines level of granularity of the source

    • sourceUri - UESURI of the particular source the value was taken from

    • value - the actual value



881
882
883
# File 'lib/uu/c3/app_deployment.rb', line 881

def get_effective_env(resource_pool_uri)
  @client.invoke(:getEffectiveEnv, resource_pool_uri, parameters: {})
end

#get_resource_pool_capacity(resource_pool_uri) ⇒ Hash<Symbol, Object>

Returns capacity overview for the given pool.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
capacity = app_deployment.get_resource_pool_capacity("ues:DEV1234-BT:DEV")

Response

{
  :uri => "ues:DEV0116-BT[84723967990075193]:DEV[58bd2f89ed26b7cf63b77088]",
  :name => "DEV0116-BT Development Pool",
  :accessGroupUri => "ues:DEV0116-BT[84723967990075193]:DEV~DEPLOYERS[93947438642013117]",
  :auditorsUri => "ues:DEV0116-BT[84723967990075193]:DEV~LOGREADERS[64294013174317893]",
  :monitoringBaseUrl => "https://telemetry.plus4u.net/uu-cloudg01-monitoring/78462435-4036e1c5896443619087eb5bde9d2b70/",
  :contractedCapacity => {
    :cpu => 5,
    :mem => 5000,
    :storage => 5000
  },
  :allocatedCapacity => {
    :cpu => 0,
    :mem => 0,
    :storage => 0
  }
}

Parameters:

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

    URI of the pool for which to get capacity.

Returns:

  • (Hash<Symbol, Object>)

    Capacity overview. Total contracted capacity (under :contractedCapacity key) and currently allocated capacity (under :allocatedCapacity key) are returned. Also returns ResourcePool name (under :name key), AccessGroup URI (under :accessGroupUri key), Auditors URI if set (under :auditorsUri key) and URL of associated monitoring application if deployed (under :monitoringBaseUrl key).

See Also:



348
349
350
# File 'lib/uu/c3/app_deployment.rb', line 348

def get_resource_pool_capacity(resource_pool_uri)
  @client.invoke(:getResourcePoolCapacity, resource_pool_uri)
end

#get_supported_runtime_stack_list(resource_pool_uri, criteria = {}) ⇒ Hash<Symbol, Object>

Returns list of supported runtime stacks for the specified resource pool.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
supported_runtime_stacks = app_deployment.get_supported_runtime_stack_list("ues:DEV1234-BT:DEV")

Response

{
  :totalSize => 3,
  :criteria => {
    :pageIndex => 0,
    :pageSize => 1000
  },
  :pageEntries => [
    {
      :name => "RuntimeStack for uuAppg01 with Ruby 2.4",
      :code => "UU.APPG01/APPSERVER_RUBY_STACK-2.0",
      :uri => "ues:OT-BT[99923616732452117]:UU.APPG01/APPSERVER_RUBY_STACK-2.0[5a213123cf37769a53bf9f52]"
    },
    {
      :name => "RuntimeStack for uuAppg01 with Java",
      :code => "UU.APPG01/APPSERVER_JAVA_STACK-1.0",
      :uri => "ues:OT-BT[99923616732452117]:UU.APPG01/APPSERVER_JAVA_STACK-1.0[5a213124d2e12b7745e79065]"
    },
    {
      :name => "RuntimeStack for uuAppg01 with Node.js",
      :code => "UU.APPG01/APPSERVER_NODEJS_STACK-1.0",
      :uri: => "ues:OT-BT[99923616732452117]:UU.APPG01/APPSERVER_NODEJS_STACK-1.0[5a213127cf37769a53bf9f54]"
    }
  ]
}

Parameters:

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

    URI of resource pool for which to list supported runtime stacks.

Returns:

  • (Hash<Symbol, Object>)

    Paged result set.



970
971
972
# File 'lib/uu/c3/app_deployment.rb', line 970

def get_supported_runtime_stack_list(resource_pool_uri, criteria = {})
  @client.invoke(:getSupportedRuntimeStackList, resource_pool_uri, parameters: criteria)
end

#redeploy(app_deployment_uri) ⇒ UU::OS::Lang::Future

Redeploys the specified app deployment.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
future = app_deployment.redeploy("ues:[123]:[56a3b8ec69a1b474a0000086]:[56a3b8ec69a1b474a0000089]")
app_deplyment_uri = future.get # blocking operation

Parameters:

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

    URI of deployment which will by redeployed.

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the redeployment operation to finish. Note that maximum timeout of future is set to 30 seconds, which is unfortunately insufficient time to finish redeployment. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object. Future.get returns appDeploymentUri.



290
291
292
# File 'lib/uu/c3/app_deployment.rb', line 290

def redeploy(app_deployment_uri, parameters = {})
  @client.invoke(:redeploy, app_deployment_uri, parameters: parameters)
end

#scale(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future

Note:

This command is experimental. And it may not be available for use in all uuCloud regions.

Modifies the count of nodes on which the AppDeployment is deployed. You can scale out or scale in the entire AppDeployment (all NodeSets) or just the specified NodeSets.

Examples:

Scale all NodeSets of a particular AppDeployment to the same count.

require "uu_c3"
app_deployment_uri = "ues:TER:POOL:APP_CODE"
node_count = 3

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
app_deployment.scale(app_deployment_uri, nodeCount: node_count)

Scale the specified NodeSets of a particular AppDeployment.

require "uu_c3"
app_deployment_uri = "ues:TER:POOL:APP_CODE"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
app_deployment.scale(app_deployment_uri,
  nodeSets: [
    {
      nodeSetUri: "ues:NODE:SET1",
      nodeCount: 2
    },
    {
      nodeSetUri: "ues:NODE:SET2",
      nodeCount: 5
    }
  ]
)

Parameters:

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

    URI of AppDeployment to scale.

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

    Scale parameters.

Options Hash (parameters):

  • nodeCount (Fixnum)

    Number of nodes for all NodeSets of the AppDeployment. If nodeCount is specified, nodeSets must not be specified.

  • nodeSets (Array<Hash>)

    Parameters of the NodeSets to scale. If nodeSets is specified, nodeCount must not be specified. Supported keys and value types:

    • nodeSetUri (UU::OS::UESURI, String) URI of the NodeSet to scale. Required.

    • nodeCount (Fixnum) Number of nodes to scale the NodeSet to. Required.

  • targetSlot (UU::C3::AppDeploymentSlot)

    Slot of AppDeployment. Default value is ‘PRODUCTION’.

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the scale operation to finish. Note that maximum timeout of future is set to 30 seconds, which may not be sufficient time to finish scaling in all cases. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object.

See Also:



770
771
772
# File 'lib/uu/c3/app_deployment.rb', line 770

def scale(app_deployment_uri, parameters = {})
  @client.invoke(:scale, app_deployment_uri, parameters: parameters)
end

#share(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future

Shares the specified app deployment to the given territories.

(i.e. creation of the appbox activity). By default, reporting is enabled.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

future = UU::C3::AppDeployment.share("ues:DEV1234-BT:PROD:CDS.GB",
  territories: ["ues:MT.123:MT.123", "ues:MT.456:MT.456"]
)
future.get # blocking operation

Parameters:

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

    URI of app deployment which will be shared.

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

    AppDeployment share parameters.

Options Hash (parameters):

  • territories (Array)

    List of territory URIs where application will be shared. Maximum is 1000 territories per command.

  • reportProgress (TrueClass, FalseClass)

    Disable (false) or enable (true) progress reporting

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the share operation to finish. Note that maximum timeout of future is set to 30 seconds, which is unfortunately insufficient time to finish sharing. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object.

See Also:



512
513
514
# File 'lib/uu/c3/app_deployment.rb', line 512

def share(app_deployment_uri, parameters = {})
  @client.invoke(:share, app_deployment_uri, parameters: parameters)
end

#swap(app_deployment_uri) ⇒ UU::OS::Lang::Future

Note:

If you are not sure what this command mean. Take some information about ‘Blue/Green deployment strategy’ before use.

Note:

Make sure you really want to do this action! Check if your ‘BETA’ slot configuration is really configured to be used on ‘PRODUCTION’ slot.

Note:

If your production application was scaled, remember that this command switch scaled nodes to ‘BETA’ slot and production will be scaled as ‘BETA’ before this action.

Note:

This command cannot be called if there is a non-nil slotMapping attribute set on a corresponding ResourceGroup.

Swaps between 'PRODUCTION' and 'BETA' slots. This will have impact on AppDeployments accessible on concrete slots(gateways for slots will be changed). This command enables to use newest version of application with zero-downtime to switch. Can be used to rollback previous stable version or test on production environment.

Parameters:

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

    URI of application.

Returns:

  • (UU::OS::Lang::Future)

    Future instance. Make sure than asynchronous part ends successfully.



913
914
915
# File 'lib/uu/c3/app_deployment.rb', line 913

def swap(app_deployment_uri)
  @client.invoke(:swap, app_deployment_uri, parameters: {})
end

#undeploy(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future?

Undeploys the specified uuApp from the pool and releases all related allocated resources. This command can be invoked repeatedly with the same parameters, to ensure full cleanup even after unexpected failures from previous invocations.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
future = app_deployment.undeploy("ues:[123]:[56a3b8ec69a1b474a0000086]:[56a3b8ec69a1b474a0000089]")
future.get # blocking operation

Parameters:

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

    URI of deployment which will by undeployed.

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

    Undeploy parameters.

Options Hash (parameters):

Returns:

  • (UU::OS::Lang::Future, nil)

    Instance of future to use to wait for the undeployment operation to finish. Note that maximum timeout of future is set to 30 seconds, which is unfortunately insufficient time to finish undeployment. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object. Returns nil if no deployed resources were found.

See Also:



243
244
245
# File 'lib/uu/c3/app_deployment.rb', line 243

def undeploy(app_deployment_uri, parameters = {})
  @client.invoke(:undeploy, app_deployment_uri, parameters: parameters)
end

#unshare(app_deployment_uri, parameters = {}) ⇒ UU::OS::Lang::Future

Terminates sharing of the specified app deployment for the given territories. Routing data for the particular app deployment and territories are removed.

(i.e. creation of the appbox activity). By default, reporting is enabled.

Examples:

require "uu_c3"

UU::OS::Security::Session.("app-deployer-passwd")

app_deployment = UU::C3::AppDeployment.new(UU::OS::Security::Session.current_session)
future = app_deployment.unshare("ues:DEV1234-BT:DEV:CDS.GB",
  territories: ["ues:MT.123:MT.123", "ues:MT.456:MT.456"]
)
future.get # blocking operation

Parameters:

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

    URI of app deployment which will be unshared.

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

    AppDeployment unshare parameters.

Options Hash (parameters):

  • territories (Array)

    List of territory URIs from where the app deployment will be unshared. Maximum is 1000 territories per command.

  • reportProgress (TrueClass, FalseClass)

    Disable (false) or enable (true) progress reporting

Returns:

  • (UU::OS::Lang::Future)

    Instance of future to use to wait for the unshare operation to finish. Note that maximum timeout of future is set to 30 seconds, which is unfortunately insufficient time to finish unsharing. Therefore timeout error might be expected when Future.get is invoked immediately after the command invocation. It is however possible to wait repeatedly using the same instance of the returned Future object.

See Also:



572
573
574
# File 'lib/uu/c3/app_deployment.rb', line 572

def unshare(app_deployment_uri, parameters = {})
  @client.invoke(:unshare, app_deployment_uri, parameters: parameters)
end