Class: UU::BinaryStore::BinaryStoreControl

Inherits:
Object
  • Object
show all
Defined in:
lib/uu_binarystore/binary_store_control.rb,
lib/uu_binarystore/binary_store_control/binary_store_delete.rb,
lib/uu_binarystore/binary_store_control/binary_store_create.rb,
lib/uu_binarystore/binary_store_control/binary_store_attributes.rb,
lib/uu_binarystore/binary_store_control/binary_store_get_store_list.rb,
lib/uu_binarystore/binary_store_control/binary_store_set_attributes.rb

Overview

Binary store control service.

Defined Under Namespace

Classes: BinaryStoreAttributes, BinaryStoreCreate, BinaryStoreDelete, BinaryStoreGetStoreList, BinaryStoreSetAttributes

Class Method Summary collapse

Class Method Details

.create(repository_uri, binary_store) ⇒ UU::OS::UESURI

Creates new binary store.

Examples:

binary_store_uri = UU::BinaryStore::BinaryStoreControl.create('ues:TERR:REPOSITORY',
:name => 'New Storage',
:allocated_size => 10,
:description => 'New Storage',
:max_size => 1024,
:max_object_size => 100)

Parameters:

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

    URI of binary store repository where to create binary store

  • binary_store (BinaryStoreCreate)

    Specific options

Options Hash (binary_store):

  • :name (String)

    Name of the new binary store. Attribute is mandatory.

  • :code (String)

    Code of the new binary store. Code must be unique in scope of territory. Attribute is optional, defaults to system generated value.

  • :description (String)

    Description of the new binary store. Attribute is optional, defaults to nil.

  • :allocated_size (Fixnum)

    Allocated size (in megabytes). Attribute is optional, defaults to value defined by server.

  • :max_size (Fixnum)

    Maximum size of the binary store (in megabytes). Attribute is optional, defaults to value defined by server.

  • :max_object_size (Fixnum)

    Maximum size of the uuBinary(in megabytes). Attribute is optional, defaults to value defined by server.

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

    Uri of group which grants access to BinaryStore. Attribute is optional, defaults to system created new group role next to binary_store.

Returns:

  • (UU::OS::UESURI)

    URI of created binary store



48
49
50
51
# File 'lib/uu_binarystore/binary_store_control.rb', line 48

def self.create(repository_uri, binary_store)
  session = UU::OS::Security::Session.current_session
  self.new(session).create(UU::OS::UESURI.new(repository_uri), binary_store)
end

.delete(binary_store_uri, options = {}) ⇒ Object

Deletes binary store.

Examples:

UU::BinaryStore::BinaryStoreControl.delete('ues:TERR:STORAGE',:force => true)

Parameters:

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

    URI of binary store

  • options (BinaryStoreDelete) (defaults to: {})

    Additional options for binary store delete

Options Hash (options):

  • :force (Boolean)

    If set to true, binary store will be deleted even if it contains some binaries. Attribute is optional, defaults to false.



69
70
71
72
# File 'lib/uu_binarystore/binary_store_control.rb', line 69

def self.delete(binary_store_uri, options = {})
  session = UU::OS::Security::Session.current_session
  self.new(session).delete(UU::OS::UESURI.new(binary_store_uri), options)
end

.get_attributes(binary_store_uri) ⇒ BinaryStoreAttributes

Returns attributes of the binary store.

Examples:

# get repository attributes
UU::BinaryStore::BinaryStoreControl.get_attributes('ues:TERR:STORAGE')

Parameters:

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

    URI of binary store

Returns:



84
85
86
87
# File 'lib/uu_binarystore/binary_store_control.rb', line 84

def self.get_attributes(binary_store_uri)
  session = UU::OS::Security::Session.current_session
  self.new(session).get_attributes(UU::OS::UESURI.new(binary_store_uri))
end

.get_store_list(repository_uri, criteria = nil) ⇒ UU::OS::REST::ResultList<BinaryStoreGetStoreList, BinaryStoreAttributes>

Returns list of binary stores within given binary store repository.

Examples:

# get storages in repository
list = UU::BinaryStore::BinaryStoreControl.get_store_list('ues:TERR:REPOSITORY')

Parameters:

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

    URI of binary store repository from which to list binary stores

  • criteria (BinaryStoreGetStoreList) (defaults to: nil)

    Criteria to limit the result set

Options Hash (criteria):

  • :query (String)

    Query for filtering and ordering of the result list (more information in uuQuery - Guideline). It is possible to filter the result list by name, code.

  • :page_size (Fixnum)

    Result list page size. Attribute is optional, default to value defined by server.

  • :page_index (Fixnum)

    Result list page index. Attribute is optional, defaults to 0.

Returns:



148
149
150
151
# File 'lib/uu_binarystore/binary_store_control.rb', line 148

def self.get_store_list(repository_uri, criteria = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).get_store_list(UU::OS::UESURI.new(repository_uri), criteria)
end

.set_attributes(binary_store_uri, binary_store) ⇒ UU::OS::UESURI

Updates attributes of the binary store.

Examples:

# set repository attributes
UU::BinaryStore::BinaryStoreControl.set_attributes('ues:TERR:BINARY_STORE',
:name => 'new Name',
:max_object_size => 1024)

Parameters:

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

    URI of binary store

  • binary_store (BinaryStoreSetAttributes)

    DTO containing attributes for updating the binary store

Options Hash (binary_store):

  • :name (String)

    New name of the binary store. Attribute is optional. If not set, name is not changed.

  • :code (String)

    New code of the binary store. Code must be unique in scope of territory. Attribute is optional. If not set, code is not changed.

  • :description (String)

    New description of the binary store. Attribute is optional. If not set, description is not changed.

  • :allocated_size (Fixnum)

    Allocated size of the binary store (in megabytes). If the requested allocated size is larger than maximal size, the update of binary store fails. Attribute is optional. If not set, maximum size is not changed.

  • :max_size (Fixnum)

    Maximum size of the binary store (in megabytes). If changed maximum size is smaller than total size of already stored uuBinaries or smaller than minimal size, the update of binary store fails. Attribute is optional. If not set, maximum size is not changed.

  • :max_object_size (Fixnum)

    Maximum object size of the binary store (in megabytes). If requested maximum object size is smaller than size of largest already stored uuBinary, update of binary store fails. Attribute is optional. If not set, maximum size is not changed.

Returns:

  • (UU::OS::UESURI)

    URI of updated binary store



122
123
124
125
# File 'lib/uu_binarystore/binary_store_control.rb', line 122

def self.set_attributes(binary_store_uri, binary_store)
  session = UU::OS::Security::Session.current_session
  self.new(session).set_attributes(UU::OS::UESURI.new(binary_store_uri), binary_store)
end