-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa4d7c3
commit 1444c04
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'azure_generic_resource' | ||
|
||
class AzureCDNProfile < AzureGenericResource | ||
name 'azure_cdn_profile' | ||
desc 'Verifies settings for a specific Azure CDN Profile.' | ||
example <<-EXAMPLE | ||
describe azure_cdn_profile(resource_group: 'large_vms', name: 'demo1') do | ||
it { should exist } | ||
end | ||
EXAMPLE | ||
|
||
def initialize(opts = {}) | ||
raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) | ||
|
||
opts[:resource_provider] = specific_resource_constraint('Microsoft.Cdn/profiles', opts) | ||
super(opts, true) | ||
end | ||
|
||
def to_s | ||
super(AzureCDNProfile) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name = input(:cdn_profile_name, value: '') | ||
resource_group = input(:resource_group, value: '') | ||
location = input(:location, value: '') | ||
|
||
describe azure_cdn_profile(resource_group: resource_group, name: name) do | ||
it { should exist } | ||
its('location') { should eq location } | ||
its('provisioningState') { should eq 'Succeeded' } | ||
its('resourceState') { should eq 'Active' } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require_relative 'helper' | ||
require 'azure_cdn_profile' | ||
|
||
class AzureCDNProfileConstructorTest < Minitest::Test | ||
def test_empty_param_not_ok | ||
assert_raises(ArgumentError) { AzureCDNProfile.new } | ||
end | ||
|
||
def test_resource_group_alone_not_ok | ||
assert_raises(ArgumentError) { AzureCDNProfile.new(resource_provider: 'some_type') } | ||
end | ||
end |