Class: XClarityClient::Services::XClarityService
- Inherits:
-
Object
- Object
- XClarityClient::Services::XClarityService
- Extended by:
- EndpointManagerMixin
- Includes:
- ResponseBuilderMixin
- Defined in:
- lib/xclarity_client/services/xclarity_service.rb
Direct Known Subclasses
AiccManagement, CabinetManagement, CanisterManagement, ChassiManagement, CmmManagement, CompliancePolicyManagement, ConfigPatternManagement, ConfigProfileManagement, ConfigTargetManagement, DiscoverRequestManagement, DiscoveryManagement, EventManagement, FanManagement, FanMuxManagement, FfdcManagement, GlobalSettingManagement, HostPlatformManagement, JobManagement, ManageRequestManagement, ManagementServerManagement, NodeManagement, OsImageManagement, PersistedResultManagement, PowerSupplyManagement, RemoteFileServerManagement, XClarityClient::ScalableComplexManagement, XClarityClient::StorageManagement, XClarityClient::SwitchManagement, UnmanageRequestManagement, UpdateCompManagement, UpdateRepoManagement, UserManagement
Instance Method Summary collapse
-
#fetch_all(opts = {}, uri = {}) ⇒ Array
Fetchs all resources represented by ‘managed_resource` from LXCA.
- #get_headers_with_opts(opts, resource) ⇒ Object
- #get_object(uuids, includeAttributes, excludeAttributes) ⇒ Object
- #get_object_with_id(ids, includeAttributes, excludeAttributes) ⇒ Object
- #get_object_with_opts(opts, resource, uri = '') ⇒ Object
-
#initialize(connection_conf) ⇒ XClarityService
constructor
A new instance of XClarityService.
Methods included from ResponseBuilderMixin
#build_response_with_resource_list
Methods included from ListNameInterpreterMixin
Constructor Details
#initialize(connection_conf) ⇒ XClarityService
Returns a new instance of XClarityService.
11 12 13 |
# File 'lib/xclarity_client/services/xclarity_service.rb', line 11 def initialize(connection_conf) @connection = XClarityClient::Connection.new(connection_conf) end |
Instance Method Details
#fetch_all(opts = {}, uri = {}) ⇒ Array
Fetchs all resources represented by ‘managed_resource` from LXCA
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/xclarity_client/services/xclarity_service.rb', line 21 def fetch_all(opts = {}, uri = {}) uri = managed_resource::BASE_URI if uri.empty? || uri.nil? $lxca_log.info "XclarityClient::Endpoints::XClarityService fetch_all", "Sending request to #{managed_resource} resource" response = @connection.do_get(uri, :query => opts) $lxca_log.info("XclarityClient::Endpoints::XClarityService fetch_all", "Response received from #{uri}") build_response_with_resource_list(response, managed_resource) end |
#get_headers_with_opts(opts, resource) ⇒ Object
74 75 76 |
# File 'lib/xclarity_client/services/xclarity_service.rb', line 74 def get_headers_with_opts(opts, resource) get_response_with_opts(opts, resource).headers end |
#get_object(uuids, includeAttributes, excludeAttributes) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/xclarity_client/services/xclarity_service.rb', line 35 def get_object(uuids, includeAttributes, excludeAttributes) $lxca_log.info "XclarityClient::Endpoints::XClarityService get_object", "Sending request to #{managed_resource} resource" uuid_array = uuids&.reject { |uuid| uuid.nil? || uuid.empty? } response = if not includeAttributes.nil? get_object_with_include_attributes(uuid_array, includeAttributes) elsif not excludeAttributes.nil? get_object_with_exclude_attributes(uuid_array, excludeAttributes) elsif not uuid_array.nil? @connection.do_get(managed_resource::BASE_URI + "/" + uuid_array.join(",")) else @connection.do_get(managed_resource::BASE_URI) end build_response_with_resource_list(response, managed_resource) end |
#get_object_with_id(ids, includeAttributes, excludeAttributes) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/xclarity_client/services/xclarity_service.rb', line 55 def get_object_with_id(ids, includeAttributes, excludeAttributes) response = if not includeAttributes.nil? get_object_with_id_include_attributes(ids, includeAttributes, managed_resource) elsif not excludeAttributes.nil? get_object_with_id_exclude_attributes(ids, excludeAttributes, managed_resource) elsif not ids.nil? @connection.do_get(managed_resource::BASE_URI + "/" + ids.join(",")) else @connection.do_get(managed_resource::BASE_URI) end build_response_with_resource_list(response, managed_resource) end |
#get_object_with_opts(opts, resource, uri = '') ⇒ Object
69 70 71 72 |
# File 'lib/xclarity_client/services/xclarity_service.rb', line 69 def get_object_with_opts(opts, resource, uri = '') response = get_response_with_opts(opts, resource, uri) build_response_with_resource_list(response, managed_resource) end |