Reputation: 11
I am trying to find the rest api reference for deleting the azure vm endpoint configured. i got the rest api reference for update/create endpoints over the below link but unable to get the reference for deleting the enpoint. do any one have tried to delete the endpoint using rest api. if so kindly share how to delete the endpoint of a vm in azure using rest api.
http://msdn.microsoft.com/en-us/library/jj157187.aspx - Update Role
Thanks in Advance.
Upvotes: 0
Views: 180
Reputation: 22661
You can have a look on the Azure Ruby SDK:
def delete_endpoint(vm_name, cloud_service_name, endpoint_name)
vm = get_virtual_machine(vm_name, cloud_service_name)
if vm
path = "/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roles/#{vm_name}"
endpoints = vm.tcp_endpoints + vm.udp_endpoints
endpoints.delete_if { |ep| endpoint_name.downcase == ep[:name].downcase }
body = Serialization.update_role_to_xml(endpoints, vm)
request = BaseManagement::ManagementHttpRequest.new(:put, path, body)
Azure::Loggerx.info "Deleting virtual machine endpoint #{endpoint_name} ..."
request.call
else
Azure::Loggerx.error "Cannot find virtual machine \"#{vm_name}\" under cloud service \"#{cloud_service_name}\"."
end
end
Not sure what Microsoft means by "role"....
Upvotes: 0
Reputation: 136146
I don't think there's a REST API operation exclusively for deleting an endpoint. What you could do is first get the VM configuration using Get Role
operation. You will get an XML. Next you could remove the endpoint setting which you wish to delete from this XML and call Update Role
again to persist the setting.
Upvotes: 2