Ejemplo n.º 1
0
def set_policy(cmd,
               client,
               resource_group_name,
               vault_name,
               policy=None,
               name=None,
               fix_for_inconsistent_items=None,
               backup_management_type=None,
               tenant_id=None):
    if backup_management_type is None and policy is not None:
        policy_object = custom_help.get_policy_from_json(client, policy)
        backup_management_type = policy_object.properties.backup_management_type.lower(
        )
    is_critical_operation = custom_help.has_resource_guard_mapping(
        cmd.cli_ctx, resource_group_name, vault_name, "updatePolicy")

    if backup_management_type.lower() == "azureiaasvm":
        return custom.set_policy(cmd, client, resource_group_name, vault_name,
                                 policy, name, tenant_id,
                                 is_critical_operation)
    if backup_management_type.lower() == "azurestorage":
        return custom_afs.set_policy(cmd, client, resource_group_name,
                                     vault_name, policy, name, tenant_id,
                                     is_critical_operation)
    if backup_management_type.lower() == "azureworkload":
        return custom_wl.set_policy(cmd, client, resource_group_name,
                                    vault_name, policy, name,
                                    fix_for_inconsistent_items, tenant_id,
                                    is_critical_operation)
    return None
Ejemplo n.º 2
0
def set_policy(client, resource_group_name, vault_name, policy, name=None):
    policy_object = custom_help.get_policy_from_json(client, policy)
    if policy_object.properties.backup_management_type.lower() == "azureiaasvm":
        return custom.set_policy(client, resource_group_name, vault_name, policy, name)
    if policy_object.properties.backup_management_type.lower() == "azurestorage":
        return custom_afs.set_policy(client, resource_group_name, vault_name, policy, name)
    if policy_object.properties.backup_management_type == "AzureWorkload":
        return custom_wl.set_policy(client, resource_group_name, vault_name, policy, name)
    return None
Ejemplo n.º 3
0
def set_policy(client, resource_group_name, vault_name, policy=None, name=None,
               fix_for_inconsistent_items=None, backup_management_type=None):
    if backup_management_type is None and policy is not None:
        policy_object = custom_help.get_policy_from_json(client, policy)
        backup_management_type = policy_object.properties.backup_management_type.lower()
    if backup_management_type.lower() == "azureiaasvm":
        return custom.set_policy(client, resource_group_name, vault_name, policy, name)
    if backup_management_type.lower() == "azurestorage":
        return custom_afs.set_policy(client, resource_group_name, vault_name, policy, name)
    if backup_management_type.lower() == "azureworkload":
        return custom_wl.set_policy(client, resource_group_name, vault_name, policy, name,
                                    fix_for_inconsistent_items)
    return None