Skip to content

Commit

Permalink
support singular cdn profile
Browse files Browse the repository at this point in the history
  • Loading branch information
sathish-progress committed Jun 11, 2022
1 parent aa4d7c3 commit 1444c04
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions libraries/azure_cdn_profile.rb
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
10 changes: 10 additions & 0 deletions test/integration/verify/controls/azure_cdn_profile.rb
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
12 changes: 12 additions & 0 deletions test/unit/resources/azure_cdn_profile_test.rb
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

0 comments on commit 1444c04

Please sign in to comment.