def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[constants.RESOURCE_GROUP_KEY] ctx.logger.info("Searching for resource group {0}".format(resource_group_name)) headers, location, subscription_id = auth.get_credentials() resource_group_url = "{0}/subscriptions/{1}/resourceGroups/{2}?api-version={3}".format(constants.azure_url, subscription_id, resource_group_name, constants.api_version_resource_group) return azurerequests.get_provisioning_state(headers, resource_group_name, resource_group_url)
def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[constants.RESOURCE_GROUP_KEY] vnet_name = ctx.instance.runtime_properties[constants.VNET_KEY] ctx.logger.info("Searching for VNET {0}".format(vnet_name)) headers, location, subscription_id = auth.get_credentials() check_vnet_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.network/" \ "virtualNetworks/{3}?api-version={4}".format(constants.azure_url, subscription_id, resource_group_name, vnet_name, constants.api_version_network) return azurerequests.get_provisioning_state(headers, resource_group_name, check_vnet_url)
def get_provisioning_state(**_): current_instance = utils.get_instance_or_source_instance() resource_group_name = current_instance.runtime_properties[constants.RESOURCE_GROUP_KEY] vm_name = current_instance.runtime_properties[constants.VM_KEY] ctx.logger.info("Searching for {0}".format(vm_name)) headers, location, subscription_id = auth.get_credentials() virtual_machine_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.Compute/" \ "virtualMachines/{3}?validating=true&api-version={4}".format(constants.azure_url, subscription_id, resource_group_name, vm_name, constants.api_version) return azurerequests.get_provisioning_state(headers, resource_group_name, virtual_machine_url)
def get_provisioning_state(**_): utils.validate_node_properties(constants.STORAGE_ACCOUNT_REQUIRED_PROPERTIES, ctx.node.properties) resource_group_name = ctx.instance.runtime_properties[constants.RESOURCE_GROUP_KEY] storage_account_name = ctx.instance.runtime_properties[constants.STORAGE_ACCOUNT_KEY] ctx.logger.info("Searching for storage account {0} in resource group {1}".format(storage_account_name, resource_group_name)) headers, location, subscription_id = auth.get_credentials() storage_account_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/" \ "Microsoft.Storage/storageAccounts/{3}?api-version={4}".\ format(constants.azure_url, subscription_id, resource_group_name, storage_account_name, constants.api_version) return azurerequests.get_provisioning_state(headers, storage_account_name, storage_account_url)
def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[constants.RESOURCE_GROUP_KEY] public_ip_name = ctx.instance.runtime_properties[constants.PUBLIC_IP_KEY] ctx.logger.info("Searching for public ip {0}".format(public_ip_name)) headers, location, subscription_id = auth.get_credentials() check_public_ip_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.network/" \ "publicIPAddresses/{3}?api-version={4}".format(constants.azure_url, subscription_id, resource_group_name, public_ip_name, constants.api_version_network) return azurerequests.get_provisioning_state(headers, resource_group_name, check_public_ip_url)
def get_provisioning_state(**_): current_instance = utils.get_instance_or_source_instance() resource_group_name = current_instance.runtime_properties[ constants.RESOURCE_GROUP_KEY] vm_name = current_instance.runtime_properties[constants.VM_KEY] ctx.logger.info("Searching for {0}".format(vm_name)) headers, location, subscription_id = auth.get_credentials() virtual_machine_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.Compute/" \ "virtualMachines/{3}?validating=true&api-version={4}".format(constants.azure_url, subscription_id, resource_group_name, vm_name, constants.api_version) return azurerequests.get_provisioning_state(headers, resource_group_name, virtual_machine_url)
def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[ constants.RESOURCE_GROUP_KEY] vnet_name = ctx.instance.runtime_properties[constants.VNET_KEY] ctx.logger.info("Searching for VNET {0}".format(vnet_name)) headers, location, subscription_id = auth.get_credentials() check_vnet_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.network/" \ "virtualNetworks/{3}?api-version={4}".format(constants.azure_url, subscription_id, resource_group_name, vnet_name, constants.api_version_network) return azurerequests.get_provisioning_state(headers, resource_group_name, check_vnet_url)
def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[constants.RESOURCE_GROUP_KEY] nic_key = _get_nic_key() nic_name = ctx.instance.runtime_properties[nic_key] ctx.logger.info("Searching for NIC {0}".format(nic_name)) headers, location, subscription_id = auth.get_credentials() network_str = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/".format(subscription_id, resource_group_name) check_nic_url = "{0}{1}/networkInterfaces/{2}?api-version={3}".format(constants.azure_url, network_str, nic_name, constants.api_version_network) return azurerequests.get_provisioning_state(headers, resource_group_name, check_nic_url, save_successful_response=True)
def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[constants.RESOURCE_GROUP_KEY] vm_name = ctx.instance.runtime_properties[constants.VM_KEY] custom_script_name = ctx.instance.runtime_properties[constants.CUSTOM_SCRIPT_KEY] ctx.logger.info("Searching for custom script {0} for VM {1}".format(custom_script_name, vm_name)) headers, location, subscription_id = auth.get_credentials() custom_script_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.Compute/" \ "virtualMachines/{3}/extensions/{4}?api-version={5}".format(constants.azure_url, subscription_id, resource_group_name, vm_name, custom_script_name, constants.api_version) return azurerequests.get_provisioning_state(headers, resource_group_name, custom_script_url)
def get_provisioning_state(**_): utils.validate_node_properties( constants.STORAGE_ACCOUNT_REQUIRED_PROPERTIES, ctx.node.properties) resource_group_name = ctx.instance.runtime_properties[ constants.RESOURCE_GROUP_KEY] storage_account_name = ctx.instance.runtime_properties[ constants.STORAGE_ACCOUNT_KEY] ctx.logger.info( "Searching for storage account {0} in resource group {1}".format( storage_account_name, resource_group_name)) headers, location, subscription_id = auth.get_credentials() storage_account_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/" \ "Microsoft.Storage/storageAccounts/{3}?api-version={4}".\ format(constants.azure_url, subscription_id, resource_group_name, storage_account_name, constants.api_version) return azurerequests.get_provisioning_state(headers, storage_account_name, storage_account_url)
def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[ constants.RESOURCE_GROUP_KEY] vm_name = ctx.instance.runtime_properties[constants.VM_KEY] custom_script_name = ctx.instance.runtime_properties[ constants.CUSTOM_SCRIPT_KEY] ctx.logger.info("Searching for custom script {0} for VM {1}".format( custom_script_name, vm_name)) headers, location, subscription_id = auth.get_credentials() custom_script_url = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.Compute/" \ "virtualMachines/{3}/extensions/{4}?api-version={5}".format(constants.azure_url, subscription_id, resource_group_name, vm_name, custom_script_name, constants.api_version) return azurerequests.get_provisioning_state(headers, resource_group_name, custom_script_url)
def get_provisioning_state(**_): resource_group_name = ctx.instance.runtime_properties[ constants.RESOURCE_GROUP_KEY] nic_key = _get_nic_key() nic_name = ctx.instance.runtime_properties[nic_key] ctx.logger.info("Searching for NIC {0}".format(nic_name)) headers, location, subscription_id = auth.get_credentials() network_str = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/".format( subscription_id, resource_group_name) check_nic_url = "{0}{1}/networkInterfaces/{2}?api-version={3}".format( constants.azure_url, network_str, nic_name, constants.api_version_network) return azurerequests.get_provisioning_state(headers, resource_group_name, check_nic_url, save_successful_response=True)