xclarity_client 0.5.9 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/apib/persisted_result.apib +196 -0
- data/docs/apib/unmanage_request.apib +163 -0
- data/docs/apib/users.apib +26 -0
- data/lib/utils/logger.rb +1 -0
- data/lib/xclarity_client/client.rb +95 -43
- data/lib/xclarity_client/connection/connection.rb +118 -0
- data/lib/xclarity_client/discover.rb +1 -1
- data/lib/xclarity_client/{aicc.rb → endpoints/aicc.rb} +1 -8
- data/lib/xclarity_client/endpoints/buildable_resource_mixin.rb +61 -0
- data/lib/xclarity_client/{cabinet.rb → endpoints/cabinet.rb} +1 -7
- data/lib/xclarity_client/{canister.rb → endpoints/canister.rb} +1 -7
- data/lib/xclarity_client/{chassi.rb → endpoints/chassi.rb} +1 -8
- data/lib/xclarity_client/{cmm.rb → endpoints/cmm.rb} +1 -7
- data/lib/xclarity_client/{config_pattern.rb → endpoints/config_pattern.rb} +2 -9
- data/lib/xclarity_client/{config_profile.rb → endpoints/config_profile.rb} +1 -8
- data/lib/xclarity_client/{config_target.rb → endpoints/config_target.rb} +1 -8
- data/lib/xclarity_client/{discover_request.rb → endpoints/discover_request.rb} +1 -8
- data/lib/xclarity_client/{discovery.rb → endpoints/discovery.rb} +1 -8
- data/lib/xclarity_client/endpoints/endpoints.rb +34 -0
- data/lib/xclarity_client/{event.rb → endpoints/event.rb} +1 -7
- data/lib/xclarity_client/{fan.rb → endpoints/fan.rb} +1 -9
- data/lib/xclarity_client/{fan_mux.rb → endpoints/fan_mux.rb} +2 -10
- data/lib/xclarity_client/{ffdc.rb → endpoints/ffdc.rb} +1 -8
- data/lib/xclarity_client/endpoints/globalsettings.rb +12 -0
- data/lib/xclarity_client/endpoints/hostplatform.rb +17 -0
- data/lib/xclarity_client/{job.rb → endpoints/job.rb} +1 -8
- data/lib/xclarity_client/{node.rb → endpoints/node.rb} +1 -8
- data/lib/xclarity_client/endpoints/osimage.rb +14 -0
- data/lib/xclarity_client/endpoints/persisted_result.rb +8 -0
- data/lib/xclarity_client/{power_supply.rb → endpoints/power_supply.rb} +2 -8
- data/lib/xclarity_client/endpoints/remote_access.rb +8 -0
- data/lib/xclarity_client/endpoints/remotefileserver.rb +15 -0
- data/lib/xclarity_client/{scalable_complex.rb → endpoints/scalable_complex.rb} +1 -8
- data/lib/xclarity_client/{switch.rb → endpoints/switch.rb} +1 -8
- data/lib/xclarity_client/endpoints/unmanage_request.rb +8 -0
- data/lib/xclarity_client/{update_repo.rb → endpoints/update_repo.rb} +1 -8
- data/lib/xclarity_client/{user.rb → endpoints/user.rb} +5 -9
- data/lib/xclarity_client/endpoints/xclarity_endpoint.rb +13 -0
- data/lib/xclarity_client/errors/errors.rb +10 -0
- data/lib/xclarity_client/schemas.rb +199 -0
- data/lib/xclarity_client/services/aicc_management.rb +9 -0
- data/lib/xclarity_client/services/cabinet_management.rb +9 -0
- data/lib/xclarity_client/services/canister_management.rb +9 -0
- data/lib/xclarity_client/services/chassi_management.rb +9 -0
- data/lib/xclarity_client/services/cmm_management.rb +9 -0
- data/lib/xclarity_client/services/config_pattern_management.rb +41 -0
- data/lib/xclarity_client/{config_profile_management.rb → services/config_profile_management.rb} +8 -14
- data/lib/xclarity_client/services/config_target_management.rb +9 -0
- data/lib/xclarity_client/services/discover_request_management.rb +30 -0
- data/lib/xclarity_client/services/discovery_management.rb +9 -0
- data/lib/xclarity_client/services/event_management.rb +9 -0
- data/lib/xclarity_client/services/fan_management.rb +9 -0
- data/lib/xclarity_client/services/fan_mux_management.rb +9 -0
- data/lib/xclarity_client/services/ffdc_management.rb +9 -0
- data/lib/xclarity_client/services/globalsettings_management.rb +26 -0
- data/lib/xclarity_client/services/hostplatform_management.rb +32 -0
- data/lib/xclarity_client/services/job_management.rb +27 -0
- data/lib/xclarity_client/services/mixins/endpoint_manager_mixin.rb +30 -0
- data/lib/xclarity_client/services/mixins/list_name_interpreter_mixin.rb +61 -0
- data/lib/xclarity_client/services/mixins/response_builder_mixin.rb +38 -0
- data/lib/xclarity_client/{node_management.rb → services/node_management.rb} +7 -11
- data/lib/xclarity_client/services/osimage_management.rb +47 -0
- data/lib/xclarity_client/services/persisted_result_management.rb +11 -0
- data/lib/xclarity_client/services/power_supply_management.rb +9 -0
- data/lib/xclarity_client/services/remote_access_management.rb +57 -0
- data/lib/xclarity_client/services/remotefileserver_management.rb +41 -0
- data/lib/xclarity_client/services/scalable_complex_management.rb +9 -0
- data/lib/xclarity_client/services/services.rb +37 -0
- data/lib/xclarity_client/services/switch_management.rb +9 -0
- data/lib/xclarity_client/services/unmanage_request_management.rb +38 -0
- data/lib/xclarity_client/{update_repo_management.rb → services/update_repo_management.rb} +4 -12
- data/lib/xclarity_client/services/user_management.rb +42 -0
- data/lib/xclarity_client/services/xclarity_service.rb +139 -0
- data/lib/xclarity_client/version.rb +1 -1
- data/lib/xclarity_client/xclarity_base.rb +2 -2
- data/lib/xclarity_client.rb +6 -50
- data/xclarity_client.gemspec +1 -0
- metadata +93 -53
- data/lib/xclarity_client/aicc_management.rb +0 -16
- data/lib/xclarity_client/cabinet_management.rb +0 -17
- data/lib/xclarity_client/canister_management.rb +0 -17
- data/lib/xclarity_client/chassi_management.rb +0 -17
- data/lib/xclarity_client/cmm_management.rb +0 -17
- data/lib/xclarity_client/config_pattern_management.rb +0 -48
- data/lib/xclarity_client/config_target_management.rb +0 -14
- data/lib/xclarity_client/discover_request_management.rb +0 -32
- data/lib/xclarity_client/discovery_management.rb +0 -17
- data/lib/xclarity_client/event_management.rb +0 -17
- data/lib/xclarity_client/fan_management.rb +0 -17
- data/lib/xclarity_client/fan_mux_management.rb +0 -17
- data/lib/xclarity_client/ffdc_management.rb +0 -13
- data/lib/xclarity_client/job_management.rb +0 -28
- data/lib/xclarity_client/power_supply_management.rb +0 -17
- data/lib/xclarity_client/scalable_complex_management.rb +0 -17
- data/lib/xclarity_client/switch_management.rb +0 -16
- data/lib/xclarity_client/user_management.rb +0 -17
- data/lib/xclarity_client/xclarity_resource.rb +0 -21
- /data/lib/xclarity_client/{error → errors}/authentication_error.rb +0 -0
- /data/lib/xclarity_client/{error → errors}/connection_failed.rb +0 -0
- /data/lib/xclarity_client/{error → errors}/connection_failed_unknown.rb +0 -0
- /data/lib/xclarity_client/{error → errors}/connection_refused.rb +0 -0
- /data/lib/xclarity_client/{error → errors}/hostname_unknown.rb +0 -0
- /data/lib/xclarity_client/{virtual_appliance_management.rb → services/virtual_appliance_management.rb} +0 -0
- /data/lib/xclarity_client/{xclarity_management_mixin.rb → services/xclarity_management_mixin.rb} +0 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
module Endpoints
|
3
|
+
end
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'xclarity_client/endpoints/xclarity_endpoint'
|
7
|
+
require 'xclarity_client/endpoints/aicc'
|
8
|
+
require 'xclarity_client/endpoints/cabinet'
|
9
|
+
require 'xclarity_client/endpoints/canister'
|
10
|
+
require 'xclarity_client/endpoints/chassi'
|
11
|
+
require 'xclarity_client/endpoints/cmm'
|
12
|
+
require 'xclarity_client/endpoints/config_pattern'
|
13
|
+
require 'xclarity_client/endpoints/config_profile'
|
14
|
+
require 'xclarity_client/endpoints/config_target'
|
15
|
+
require 'xclarity_client/endpoints/discover_request'
|
16
|
+
require 'xclarity_client/endpoints/discovery'
|
17
|
+
require 'xclarity_client/endpoints/event'
|
18
|
+
require 'xclarity_client/endpoints/fan_mux'
|
19
|
+
require 'xclarity_client/endpoints/fan'
|
20
|
+
require 'xclarity_client/endpoints/ffdc'
|
21
|
+
require 'xclarity_client/endpoints/job'
|
22
|
+
require 'xclarity_client/endpoints/node'
|
23
|
+
require 'xclarity_client/endpoints/persisted_result'
|
24
|
+
require 'xclarity_client/endpoints/power_supply'
|
25
|
+
require 'xclarity_client/endpoints/scalable_complex'
|
26
|
+
require 'xclarity_client/endpoints/switch'
|
27
|
+
require 'xclarity_client/endpoints/unmanage_request'
|
28
|
+
require 'xclarity_client/endpoints/update_repo'
|
29
|
+
require 'xclarity_client/endpoints/user'
|
30
|
+
require 'xclarity_client/endpoints/remote_access'
|
31
|
+
require 'xclarity_client/endpoints/globalsettings'
|
32
|
+
require 'xclarity_client/endpoints/hostplatform'
|
33
|
+
require 'xclarity_client/endpoints/osimage'
|
34
|
+
require 'xclarity_client/endpoints/remotefileserver'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class Event
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class Event < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/events'.freeze
|
6
4
|
LIST_NAME = 'eventList'.freeze
|
7
5
|
|
@@ -14,9 +12,5 @@ module XClarityClient
|
|
14
12
|
:systemSerialNumberText, :systemText, :systemTypeModelText, :systemTypeText,
|
15
13
|
:timeStamp, :typeText, :userid, :userIDIndex, :descriptionArgs, :userActionArgs, :failFRUNames,
|
16
14
|
:failFRUUUIDs, :failFRUPartNumbers
|
17
|
-
|
18
|
-
def initialize(attributes)
|
19
|
-
build_resource(attributes)
|
20
|
-
end
|
21
15
|
end
|
22
16
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class Fan
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class Fan < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/fans'.freeze
|
6
4
|
LIST_NAME = 'fanList'.freeze
|
7
5
|
|
@@ -11,11 +9,5 @@ module XClarityClient
|
|
11
9
|
:model, :name, :parent, :partNumber, :posID, :powerAllocation, :powerState,
|
12
10
|
:productId, :productName, :serialNumber, :slots, :type, :uri, :userDescription,
|
13
11
|
:uuid, :vpdID
|
14
|
-
|
15
|
-
|
16
|
-
def initialize(attributes)
|
17
|
-
build_resource(attributes)
|
18
|
-
end
|
19
|
-
|
20
12
|
end
|
21
13
|
end
|
@@ -1,18 +1,10 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class FanMux
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class FanMux < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/fanMuxes'.freeze
|
6
4
|
LIST_NAME = 'fanMuxList'.freeze
|
7
5
|
|
8
6
|
attr_accessor :cmmDisplayName, :cmmHealthState, :dataHandle, :description, :FRU, :fruSerialNumber, :hardwareRevision,
|
9
|
-
:leds, :machineType, :manufactureDate, :manufacturer, :manufacturerId, :model, :name, :parent, :partNumber, :productId,
|
7
|
+
:leds, :machineType, :manufactureDate, :manufacturer, :manufacturerId, :model, :name, :parent, :partNumber, :productId,
|
10
8
|
:productName, :serialNumber, :slots, :status, :type, :uri, :uuid
|
11
|
-
|
12
|
-
|
13
|
-
def initialize(attributes)
|
14
|
-
build_resource(attributes)
|
15
|
-
end
|
16
|
-
|
17
9
|
end
|
18
10
|
end
|
@@ -1,15 +1,8 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class Ffdc
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class Ffdc < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/ffdc/endpoint'.freeze
|
6
4
|
LIST_NAME = 'ffdcList'.freeze
|
7
5
|
|
8
6
|
attr_accessor :jobURL
|
9
|
-
|
10
|
-
def initialize(attributes)
|
11
|
-
build_resource(attributes)
|
12
|
-
end
|
13
|
-
|
14
7
|
end
|
15
8
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class GlobalSetting < Endpoints::XclarityEndpoint
|
3
|
+
BASE_URI = '/osdeployment/globalSettings'.freeze
|
4
|
+
|
5
|
+
attr_accessor :activeDirectory, :credentials, :ipAssignment,
|
6
|
+
:isVLANMode, :licenseKeys
|
7
|
+
|
8
|
+
def initialize(attributes)
|
9
|
+
build_resource(attributes)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class HostPlatform < Endpoints::XclarityEndpoint
|
3
|
+
BASE_URI = '/hostPlatforms'.freeze
|
4
|
+
LIST_NAME = 'items'.freeze
|
5
|
+
|
6
|
+
attr_accessor :availableImages, :bay, :bootOrder, :chassisIpAddress,
|
7
|
+
:chassisName, :chassisuuid, :deployStatus, :deployStatusID,
|
8
|
+
:id, :immIpAddress, :isRealNode, :licenseKey, :mgmtProcType,
|
9
|
+
:name, :networkSettings, :nodeType, :primary, :rackID,
|
10
|
+
:rackUnit, :readyCheck, :remoteControl, :storageSettings,
|
11
|
+
:uuid
|
12
|
+
|
13
|
+
def initialize(attributes)
|
14
|
+
build_resource(attributes)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,17 +1,10 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class Job
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class Job < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/jobs'.freeze
|
6
4
|
LIST_NAME = 'jobsList'.freeze
|
7
5
|
|
8
6
|
attr_accessor :status, :cancelledBy, :createdBy, :category, :typeId, :messageDisplay, :cancelURI,
|
9
7
|
:messageParameters, :startTime, :messageID, :messageBundle, :endTime, :id, :isCancelable, :rebootPersistent,
|
10
8
|
:uuid, :hidden
|
11
|
-
|
12
|
-
def initialize(attributes)
|
13
|
-
build_resource(attributes)
|
14
|
-
end
|
15
|
-
|
16
9
|
end
|
17
10
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class Node
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class Node < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/nodes'.freeze
|
6
4
|
LIST_NAME = 'nodeList'.freeze
|
7
5
|
|
@@ -18,10 +16,5 @@ module XClarityClient
|
|
18
16
|
:recoveryPassword, :secureBootMode, :serialNumber, :server_type, :slots, :status, :subSlots, :subType, :thinkServerFru, :tlsVersion, :type, :uri,
|
19
17
|
:userDescription, :username, :uuid, :vnicMode, :vpdID, :securityDescriptor, :primary, :logicalID, :FeaturesOnDemand,
|
20
18
|
:canisterSlots, :canisters, :userDefinedName, :management_processor_type
|
21
|
-
|
22
|
-
def initialize(attributes)
|
23
|
-
build_resource(attributes)
|
24
|
-
end
|
25
|
-
|
26
19
|
end
|
27
20
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class OsImage < Endpoints::XclarityEndpoint
|
3
|
+
BASE_URI = '/osImages'.freeze
|
4
|
+
LIST_NAME = 'items'.freeze
|
5
|
+
|
6
|
+
attr_accessor :description, :osrelease, :name, :profiles,
|
7
|
+
:id, :type, :osBuildId, :deployStatus
|
8
|
+
|
9
|
+
def initialize(attributes)
|
10
|
+
build_resource(attributes)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -1,17 +1,11 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class PowerSupply
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class PowerSupply < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/powerSupplies'.freeze
|
6
4
|
LIST_NAME = 'powerSupplyList'.freeze
|
7
5
|
|
8
6
|
attr_accessor :cmmDisplayName, :cmmHealthState, :dataHandle, :description, :firmware, :FRU, :fruSerialNumber, :hardwareRevision,
|
9
|
-
:inputVoltageIsAC, :inputVoltageMax, :inputVoltageMin, :leds, :machineType, :manufactureDate, :manufacturer,
|
7
|
+
:inputVoltageIsAC, :inputVoltageMax, :inputVoltageMin, :leds, :machineType, :manufactureDate, :manufacturer,
|
10
8
|
:manufacturerId, :model, :name, :parent, :partNumber, :posID, :powerAllocation, :powerState, :productId, :productName,
|
11
9
|
:serialNumber, :slots, :type, :uri, :userDescription, :uuid, :vpdID
|
12
|
-
|
13
|
-
def initialize(attributes)
|
14
|
-
build_resource(attributes)
|
15
|
-
end
|
16
10
|
end
|
17
11
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class RemoteFileServer < Endpoints::XclarityEndpoint
|
3
|
+
BASE_URI = '/osImages/remoteFileServers'.freeze
|
4
|
+
LIST_NAME = 'serverList'.freeze
|
5
|
+
|
6
|
+
attr_accessor :protocol, :address, :port,
|
7
|
+
:displayName, :serverId, :username,
|
8
|
+
:keyType, :serverPublicKey
|
9
|
+
|
10
|
+
def initialize(attributes)
|
11
|
+
build_resource(attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -1,16 +1,9 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class ScalableComplex
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class ScalableComplex < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/scalableComplex'.freeze
|
6
4
|
LIST_NAME = ['complex', 'complexList'].map { |name| name.freeze }.freeze
|
7
5
|
|
8
6
|
attr_accessor :complexID, :location, :nodeCount, :orphanNodes,
|
9
7
|
:partition, :partitionCount, :uuid
|
10
|
-
|
11
|
-
def initialize(attributes)
|
12
|
-
build_resource(attributes)
|
13
|
-
end
|
14
|
-
|
15
8
|
end
|
16
9
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class Switch
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class Switch < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/switches'.freeze
|
6
4
|
LIST_NAME = 'switchList'.freeze
|
7
5
|
|
@@ -16,10 +14,5 @@ module XClarityClient
|
|
16
14
|
:temperatureSensors, :entitleSerialNumber, :manufacturingDate, :panicDump,
|
17
15
|
:powerSupply, :stackRole, :fans, :contact, :sysObjectID, :savePending, :resetReason,
|
18
16
|
:applyPending, :OS, :cpuUtilization, :ports, :upTime
|
19
|
-
|
20
|
-
def initialize(attributes)
|
21
|
-
build_resource(attributes)
|
22
|
-
end
|
23
|
-
|
24
17
|
end
|
25
18
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class UnmanageRequest < Endpoints::XclarityEndpoint
|
3
|
+
BASE_URI = '/unmanageRequest'.freeze
|
4
|
+
LIST_NAME = 'unmanageRequestList'.freeze
|
5
|
+
|
6
|
+
attr_accessor :progress, :results, :messageBundle, :messageID, :messageParameters, :result, :resultLongDescription, :resultShortDescription, :status, :taskid, :time_spent, :uuid
|
7
|
+
end
|
8
|
+
end
|
@@ -1,15 +1,8 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class UpdateRepo
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class UpdateRepo < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/updateRepositories/firmware'.freeze
|
6
4
|
LIST_NAME = 'updateRepoList'.freeze
|
7
5
|
|
8
6
|
attr_accessor :importDir, :status, :lastRefreshed, :size, :publicKeys, :updates, :updatesByMt, :supportedMts, :updatesByMtByComp
|
9
|
-
|
10
|
-
def initialize(attributes)
|
11
|
-
build_resource(attributes)
|
12
|
-
end
|
13
|
-
|
14
7
|
end
|
15
8
|
end
|
@@ -1,18 +1,14 @@
|
|
1
1
|
module XClarityClient
|
2
|
-
class User
|
3
|
-
include XClarityClient::Resource
|
4
|
-
|
2
|
+
class User < Endpoints::XclarityEndpoint
|
5
3
|
BASE_URI = '/userAccounts'.freeze
|
6
4
|
LIST_NAME = 'usersList'.freeze
|
5
|
+
SUB_URIS = {
|
6
|
+
changePassword: "#{BASE_URI}/passwordChange"
|
7
|
+
}
|
7
8
|
|
8
9
|
attr_accessor :response, :PasswordChangeFirstAccess, :activeSessions, :createTimestamp, :description, :groups,
|
9
|
-
:id, :lastLoginTimestamp, :ldapDn, :loginAttempts, :loginCount, :modifyTimestamp, :pwExpirationWarning,
|
10
|
+
:id, :lastLoginTimestamp, :ldapDn, :loginAttempts, :loginCount, :modifyTimestamp, :pwExpirationWarning,
|
10
11
|
:pwExpired, :pwdAge, :reserved, :state, :supervisor, :timeBeforeExpirationInDays, :userName, :userPw,
|
11
12
|
:result, :messages
|
12
|
-
|
13
|
-
def initialize(attributes)
|
14
|
-
build_resource(attributes)
|
15
|
-
end
|
16
|
-
|
17
13
|
end
|
18
14
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
module Errors
|
3
|
+
end
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'xclarity_client/errors/authentication_error'
|
7
|
+
require 'xclarity_client/errors/connection_failed'
|
8
|
+
require 'xclarity_client/errors/connection_failed_unknown'
|
9
|
+
require 'xclarity_client/errors/connection_refused'
|
10
|
+
require 'xclarity_client/errors/hostname_unknown'
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require 'json-schema'
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
class Schemas
|
5
|
+
@remotefs = {
|
6
|
+
"id" => "create_remotefileserver_profile",
|
7
|
+
"type" => "object",
|
8
|
+
"required" => ["address", "displayName", "port", "protocol"],
|
9
|
+
"properties" => {
|
10
|
+
"address" => {
|
11
|
+
"type" => "string"
|
12
|
+
},
|
13
|
+
"displayName" => {
|
14
|
+
"type" => "string"
|
15
|
+
},
|
16
|
+
"keyComment" => {
|
17
|
+
"type" => "string"
|
18
|
+
},
|
19
|
+
"keyPassphras" => {
|
20
|
+
"type" => "string"
|
21
|
+
},
|
22
|
+
"keyType" => {
|
23
|
+
"type" => "string"
|
24
|
+
},
|
25
|
+
"password" => {
|
26
|
+
"type" => "string"
|
27
|
+
},
|
28
|
+
"port" => {
|
29
|
+
"type" => "integer"
|
30
|
+
},
|
31
|
+
"protocol" => {
|
32
|
+
"type" => "string"
|
33
|
+
},
|
34
|
+
"serverId" => {
|
35
|
+
"type" => "string"
|
36
|
+
},
|
37
|
+
"username" => {
|
38
|
+
"type" => "string"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
@hostplatforms = {
|
44
|
+
"id" => "deploy_osimage",
|
45
|
+
"type" => "array",
|
46
|
+
"items" => {
|
47
|
+
"type" => "object",
|
48
|
+
"required" => ["networkSettings", "selectedImage", "storageSettings", "uuid"],
|
49
|
+
"properties" => {
|
50
|
+
"adusername" => {
|
51
|
+
"type" => "string"
|
52
|
+
},
|
53
|
+
"adpassword" => {
|
54
|
+
"type" => "string"
|
55
|
+
},
|
56
|
+
"configFileId" => {
|
57
|
+
"type" => "string"
|
58
|
+
},
|
59
|
+
"licenseKey" => {
|
60
|
+
"type" => "string"
|
61
|
+
},
|
62
|
+
"selectedImage" => {
|
63
|
+
"type" => "string"
|
64
|
+
},
|
65
|
+
"storageSettings" => {
|
66
|
+
"type" => "object"
|
67
|
+
},
|
68
|
+
"unattendFileId" => {
|
69
|
+
"type" => "string"
|
70
|
+
},
|
71
|
+
"uuid" => {
|
72
|
+
"type" => "string"
|
73
|
+
},
|
74
|
+
"windowsDomain" => {
|
75
|
+
"type" => "string"
|
76
|
+
},
|
77
|
+
"windowsDomainBlob" => {
|
78
|
+
"type" => "string"
|
79
|
+
},
|
80
|
+
"networkSettings" => {
|
81
|
+
"type" => "object",
|
82
|
+
"properties" =>
|
83
|
+
{
|
84
|
+
"dns1" => {
|
85
|
+
"type" => "string"
|
86
|
+
},
|
87
|
+
"dns2" => {
|
88
|
+
"type" => "string"
|
89
|
+
},
|
90
|
+
"gateway" => {
|
91
|
+
"type" => "string"
|
92
|
+
},
|
93
|
+
"hostname" => {
|
94
|
+
"type" => "string"
|
95
|
+
},
|
96
|
+
"ipAddress" => {
|
97
|
+
"type" => "string"
|
98
|
+
},
|
99
|
+
"mtu" => {
|
100
|
+
"type" => "integer"
|
101
|
+
},
|
102
|
+
"prefixLength" => {
|
103
|
+
"type" => "string"
|
104
|
+
},
|
105
|
+
"selectedMAC" => {
|
106
|
+
"type" => "string"
|
107
|
+
},
|
108
|
+
"vlanId" => {
|
109
|
+
"type" => "string"
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
@globalsettings = {
|
118
|
+
"id" => "set_globalsettings",
|
119
|
+
"type" => "object",
|
120
|
+
"required" => ["activeDirectory", "ipAssignment", "isVLANMode", "licenseKeys", "credentials"],
|
121
|
+
"properties" => {
|
122
|
+
"activeDirectory": {
|
123
|
+
"type" => "object"
|
124
|
+
},
|
125
|
+
"ipAssignment":{
|
126
|
+
"type" => "string"
|
127
|
+
},
|
128
|
+
"isVLANMode": {
|
129
|
+
"type" => "boolean"
|
130
|
+
},
|
131
|
+
"licenseKeys":{
|
132
|
+
"type" => "object"
|
133
|
+
},
|
134
|
+
"deploySettings":{
|
135
|
+
"type" => "string"
|
136
|
+
},
|
137
|
+
"credentials":{
|
138
|
+
"type" => "array",
|
139
|
+
"items" => {
|
140
|
+
"type" => "object",
|
141
|
+
"required" => ["type",
|
142
|
+
"name",
|
143
|
+
"password",
|
144
|
+
"passwordChanged"],
|
145
|
+
"properties" =>
|
146
|
+
{
|
147
|
+
"type":{
|
148
|
+
"type"=> "string"
|
149
|
+
},
|
150
|
+
"name":{
|
151
|
+
"type" => "string"
|
152
|
+
},
|
153
|
+
"password":{
|
154
|
+
"type" => "string"
|
155
|
+
},
|
156
|
+
"passwordChanged":{
|
157
|
+
"type" => "boolean"
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
REQ_SCHEMA={
|
166
|
+
"deploy_osimage" => @hostplatforms,
|
167
|
+
"set_globalsettings" => @globalsettings,
|
168
|
+
"create_remotefileserver_profile" => @remotefs
|
169
|
+
}
|
170
|
+
|
171
|
+
def Schemas.validate_input(schema_name, data)
|
172
|
+
x=JSON::Validator.fully_validate(Schemas::REQ_SCHEMA[schema_name], data)
|
173
|
+
if not x.empty?
|
174
|
+
errmsg = "input validation failed for data #{data}"
|
175
|
+
$lxca_log.error errmsg, ""
|
176
|
+
puts errmsg
|
177
|
+
for k in x
|
178
|
+
$lxca_log.error k, ""
|
179
|
+
puts k
|
180
|
+
end
|
181
|
+
return nil
|
182
|
+
else
|
183
|
+
return 1
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
#parameter name should be string
|
188
|
+
def Schemas.validate_input_parameter(name, value, exp_type)
|
189
|
+
if not value.kind_of?(exp_type)
|
190
|
+
errmsg = "invalid #{name} #{value}, expected #{name} of type #{exp_type}"
|
191
|
+
$lxca_log.error errmsg, ""
|
192
|
+
puts errmsg
|
193
|
+
return nil
|
194
|
+
else
|
195
|
+
return 1
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|