Class: Inspec::Resources::IisSite
- Inherits:
-
Object
- Object
- Inspec::Resources::IisSite
- Defined in:
- lib/resources/iis_site.rb
Direct Known Subclasses
Instance Method Summary collapse
- #app_pool ⇒ Object
- #bindings ⇒ Object
- #exists? ⇒ Boolean
- #has_app_pool?(app_pool) ⇒ Boolean
- #has_binding?(binding) ⇒ Boolean
- #has_path?(path) ⇒ Boolean
- #iis_site ⇒ Object
-
#initialize(site_name) ⇒ IisSite
constructor
A new instance of IisSite.
- #path ⇒ Object
- #running? ⇒ Boolean
- #state ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(site_name) ⇒ IisSite
Returns a new instance of IisSite.
31 32 33 34 35 36 37 38 39 |
# File 'lib/resources/iis_site.rb', line 31 def initialize(site_name) @site_name = site_name @cache = nil @site_provider = SiteProvider.new(inspec) # verify that this resource is only supported on Windows return skip_resource 'The `iis_site` resource is not supported on your OS.' if inspec.os[:family] != 'windows' end |
Instance Method Details
#app_pool ⇒ Object
41 42 43 |
# File 'lib/resources/iis_site.rb', line 41 def app_pool iis_site[:app_pool] end |
#bindings ⇒ Object
45 46 47 |
# File 'lib/resources/iis_site.rb', line 45 def bindings iis_site[:bindings] end |
#exists? ⇒ Boolean
57 58 59 |
# File 'lib/resources/iis_site.rb', line 57 def exists? !iis_site.nil? && !iis_site[:name].nil? end |
#has_app_pool?(app_pool) ⇒ Boolean
65 66 67 |
# File 'lib/resources/iis_site.rb', line 65 def has_app_pool?(app_pool) iis_site.nil? ? false : iis_site[:app_pool] == app_pool end |
#has_binding?(binding) ⇒ Boolean
73 74 75 |
# File 'lib/resources/iis_site.rb', line 73 def has_binding?(binding) iis_site.nil? ? false : (iis_site[:bindings].include? binding) end |
#has_path?(path) ⇒ Boolean
69 70 71 |
# File 'lib/resources/iis_site.rb', line 69 def has_path?(path) iis_site.nil? ? false : iis_site[:path] == path end |
#iis_site ⇒ Object
81 82 83 84 |
# File 'lib/resources/iis_site.rb', line 81 def iis_site return @cache if !@cache.nil? @cache = @site_provider.iis_site(@site_name) if !@site_provider.nil? end |
#path ⇒ Object
53 54 55 |
# File 'lib/resources/iis_site.rb', line 53 def path iis_site[:path] end |
#running? ⇒ Boolean
61 62 63 |
# File 'lib/resources/iis_site.rb', line 61 def running? iis_site.nil? ? false : (iis_site[:state] == 'Started') end |
#state ⇒ Object
49 50 51 |
# File 'lib/resources/iis_site.rb', line 49 def state iis_site[:state] end |
#to_s ⇒ Object
77 78 79 |
# File 'lib/resources/iis_site.rb', line 77 def to_s "iis_site '#{@site_name}'" end |