-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathalicloud_ims_sso.rb
50 lines (41 loc) · 1.04 KB
/
alicloud_ims_sso.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'alicloud_backend'
class AliCloudSsoSettings < AliCloudResourceBase
name 'alicloud_ims_sso'
desc 'Verifies settings for AliCloud SSO settings.'
example <<-EXAMPLE
describe alicloud_ims_sso do
it { should exist}
it { have_sso_enabled }
its('idp_domain') { should cmp 'mydomain.com' }
end
EXAMPLE
attr_reader :sso_enabled, :auxiliary_domain
def initialize(opts = {})
super(opts)
validate_parameters(required: %i(region))
catch_alicloud_errors do
@resp = @alicloud.ims_client.request(
action: 'GetSamlSsoSettings',
params: {
"RegionId": opts[:region],
},
)
end
if @resp.nil? || @resp['SamlSsoSettings'].nil?
@sso_enabled = false
@auxiliary_domain = nil
return
end
@sso_enabled = @resp['SamlSsoSettings']['SsoEnabled']
@auxiliary_domain = @resp['SamlSsoSettings']['AuxiliaryDomain']
end
def exists?
end
def has_sso_enabled?
@sso_enabled
end
def to_s
'AliCloud SSO Settings'
end
end