Chapter 09/circuit-oneops-1-master/components/cookbooks/azure_base/libraries/resource_group_manager.rb
# this method will create/update the resource group with the info passed in
this method will create/update the resource group with the info passed in
this method will create / update the resource group with the info passed in
def add
      begin
        @rg_name = get_name if @rg_name.nil?
        OOLog.info("RG Name is: #{@rg_name}")
        if !exists?
          OOLog.info("RG does NOT exists.  Creating...")
          resource_group = Azure::ARM::Resources::Models::ResourceGroup.new
          resource_group.location = @location
          response =
            @client.resource_groups.create_or_update(@rg_name,
                                                     resource_group).value!
          return response
        else
          OOLog.info("Resource Group, #{@rg_name} already exists.  Moving on...")
        end
      rescue MsRestAzure::AzureOperationError => e
        OOLog.fatal("Error creating resource group: #{e.body}")
      rescue => ex
        OOLog.fatal("Error creating resource group: #{ex.message}")
      end
    end
def add begin @rg_name = get_name if @rg_name . nil? OOLog . info ( "RG Name is: #{@rg_name}" ) if ! exists? OOLog . info ( "RG does NOT exists.  Creating..." ) resource_group = Azure :: ARM :: Resources :: Models :: ResourceGroup . new resource_group . location = @location response = @client . resource_groups . create_or_update ( @rg_name , resource_group ) . value! return response else OOLog . info ( "Resource Group, #{@rg_name} already exists.  Moving on..." ) end rescue MsRestAzure :: AzureOperationError => e OOLog . fatal ( "Error creating resource group: #{e.body}" ) rescue => ex OOLog . fatal ( "Error creating resource group: #{ex.message}" ) end end
this method will create/update the resource group with the info passed in
this method will create / update the resource group with the info passed in
# get the name # check if the rg is there # create it if it isn't.