Chapter 09/circuit-oneops-1-master/components/cookbooks/azure/libraries/public_ip.rb
# this function creates or updates the public ip address
# it expects the resource group, name of the pip and public ip object
# to already be created.
this function creates or updates the public ip address
it expects the resource group, name of the pip and public ip object
to already be created.
this function creates or updates the public ip address it expects the resource group name of the pip and public ip object to already be created .
def create_update(resource_group_name, public_ip_name, public_ip_address)
      begin
        OOLog.info("Creating/Updating public IP '#{public_ip_name}' from '#{resource_group_name}' ")
        start_time = Time.now.to_i
        promise = @client.public_ip_addresses.create_or_update(resource_group_name,
                                                               public_ip_name,
                                                               public_ip_address)
        response = promise.value!
        result = response.body
        end_time = Time.now.to_i
        duration = end_time - start_time
        OOLog.info("operation took #{duration} seconds")
        return result
      rescue MsRestAzure::AzureOperationError => ex
        OOLog.fatal("Exception trying to create/update public ip #{public_ip_address.name} from resource group: #{resource_group_name}.  Exception: #{ex.body}")
      rescue => e
        OOLog.fatal("Exception trying to create/update public ip #{public_ip_address.name} from resource group: #{resource_group_name}.  Exception: #{e.message}")
      end
    end
def create_update ( resource_group_name , public_ip_name , public_ip_address ) begin OOLog . info ( "Creating/Updating public IP '#{public_ip_name}' from '#{resource_group_name}' " ) start_time = Time . now . to_i promise = @client . public_ip_addresses . create_or_update ( resource_group_name , public_ip_name , public_ip_address ) response = promise . value! result = response . body end_time = Time . now . to_i duration = end_time - start_time OOLog . info ( "operation took #{duration} seconds" ) return result rescue MsRestAzure :: AzureOperationError => ex OOLog . fatal ( "Exception trying to create/update public ip #{public_ip_address.name} from resource group: #{resource_group_name}.  Exception: #{ex.body}" ) rescue => e OOLog . fatal ( "Exception trying to create/update public ip #{public_ip_address.name} from resource group: #{resource_group_name}.  Exception: #{e.message}" ) end end
this function creates or updates the public ip address
it expects the resource group, name of the pip and public ip object
to already be created.
this function creates or updates the public ip address it expects the resource group name of the pip and public ip object to already be created .
resource_group_name
<not_specific>
public_ip_name
<not_specific>
public_ip_address
<not_specific>