Class: UU::OperationRegistry::Tenant

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

Overview

Tenant.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session = nil) ⇒ Tenant

Creates a new instance of Tenant.

Parameters:

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

    Session to use for remote calls.



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

def initialize(session = nil)
  super
end

Class Method Details

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

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

Parameters:

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

    Cloud URI.

  • attributes (Hash)

    Tenant attributes.

Returns:

  • (UU::OS::UESURI)

    UESURI of the created tenant.



# File 'lib/uu/operation_registry/tenant.rb', line 42

.delete(tenant_uri) ⇒ void

This method returns an undefined value.

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

Parameters:

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

    Tenant URI.



# File 'lib/uu/operation_registry/tenant.rb', line 90

.get_attributes(tenant_uri) ⇒ Hash

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

Parameters:

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

    Tenant URI.

Returns:

  • (Hash)

    Tenant attributes.



# File 'lib/uu/operation_registry/tenant.rb', line 55

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

Returns list of tenants. This method is a convenience shortcut for the #get_tenant_list instance method.

Returns:

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

    Paged result set.

See Also:



118
119
120
# File 'lib/uu/operation_registry/tenant.rb', line 118

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

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

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

Parameters:

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

    Tenant URI.

Returns:

  • (UU::OS::UESURI)

    UESURI of the updated tenant.



# File 'lib/uu/operation_registry/tenant.rb', line 79

Instance Method Details

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

Creates a new tenant. Tenant is a representation of territory in operation registry.

Parameters:

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

    Cloud URI.

  • attributes (Hash)

    Tenant attributes.

Options Hash (attributes):

  • oid (String)

    Unique territory ID. Must not be nil nor empty.

  • name (String)

    Tenant name. May be nil.

  • code (String)

    Tenant code.

  • tid (String)

    OID of the related tenant representing territory (with type: TID). May be nil unless type is specified.

  • type (String)

    Tenant type. May be nil. Supported tenant types are:

    • ASID - represents uuAppServer (ASID = AppServer ID), belongs to a TID tenant

    • AWID - represents uuAppWorkspace (AWID = AppWorkspace ID), belongs to a TID tenant

    • TID - represents Business Territory or My Territory (TID = Territory ID)

  • description (String)

    Tenant description. May be nil.

Returns:

  • (UU::OS::UESURI)

    UESURI of the created tenant.



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

#delete(tenant_uri) ⇒ void

This method returns an undefined value.

Deletes the specified tenant from the registry.

Parameters:

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

    Tenant URI.



# File 'lib/uu/operation_registry/tenant.rb', line 85

#get_attributes(tenant_uri) ⇒ Hash

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

Parameters:

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

    Tenant URI.

Returns:

  • (Hash)

    Tenant attributes.



# File 'lib/uu/operation_registry/tenant.rb', line 49

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

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

Parameters:

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

    Cloud URI.

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

    Criteria for listing tenants.

Options Hash (criteria):

  • query (String)

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

  • pageIndex (Fixnum)

    Result set page index.

  • pageSize (Fixnum)

    Result set page size.

Returns:

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

    Paged result set.



109
110
111
# File 'lib/uu/operation_registry/tenant.rb', line 109

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

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

Sets attributes of an tenant.

Parameters:

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

    Tenant URI.

  • attributes (Hash)

    Tenant attributes.

Options Hash (attributes):

  • oid (String)

    Unique territory ID. May be nil but must not be empty when specified.

  • name (String)

    Tenant name. May be nil.

  • code (String)

    Tenant code. May be nil.

  • tid (String)

    OID of the related tenant representing territory (with type: TID). May be nil unless type is specified.

  • type (String)

    Tenant type. May be nil. Supported tenant types are: ASID, AWID, TID. See #create for details.

  • description (String)

    Tenant description. May be nil.

Returns:

  • (UU::OS::UESURI)

    UESURI of the updated tenant.



# File 'lib/uu/operation_registry/tenant.rb', line 62