def validate_diagnostic_settings(namespace):
    from azure.cli.core.commands.client_factory import get_subscription_id
    resource_group_error = '--resource-group is required when name is provided for storage account or workspace or service bus namespace and rule. '
    if (namespace.namespace or namespace.rule_name):
        if (namespace.namespace is None):
            raise CLIError(resource_group_error)
        if (namespace.rule_name is None):
            raise CLIError(resource_group_error)
        if (namespace.resource_group is None):
            raise CLIError(resource_group_error)
        if (not is_valid_resource_id(namespace.namespace)):
            namespace.service_bus_rule_id = resource_id(subscription=get_subscription_id(), resource_group=namespace.resource_group, namespace='microsoft.ServiceBus', type='namespaces', name=namespace.namespace, child_type='AuthorizationRules', child_name=namespace.rule_name)
        else:
            resource_dict = parse_resource_id(namespace.namespace)
            namespace.service_bus_rule_id = resource_id(subscription=resource_dict['subscription'], resource_group=resource_dict['resource_group'], namespace=resource_dict['namespace'], type=resource_dict['type'], name=resource_dict['name'], child_type='AuthorizationRules', child_name=namespace.rule_name)
    if (namespace.storage_account and (not is_valid_resource_id(namespace.storage_account))):
        if (namespace.resource_group is None):
            raise CLIError(resource_group_error)
        namespace.storage_account = resource_id(subscription=get_subscription_id(), resource_group=namespace.resource_group, namespace='microsoft.Storage', type='storageAccounts', name=namespace.storage_account)
    if (namespace.workspace and (not is_valid_resource_id(namespace.workspace))):
        if (namespace.resource_group is None):
            raise CLIError(resource_group_error)
        namespace.workspace = resource_id(subscription=get_subscription_id(), resource_group=namespace.resource_group, namespace='microsoft.OperationalInsights', type='workspaces', name=namespace.workspace)
    _validate_tags(namespace)
def validate_diagnostic_settings(namespace):
    from azure.cli.core.commands.client_factory import get_subscription_id
    resource_group_error = '--resource-group is required when name is provided for storage account or workspace or service bus namespace and rule. '
    if (namespace.namespace or namespace.rule_name):
        if (namespace.namespace is None):
            raise CLIError(resource_group_error)
        if (namespace.rule_name is None):
            raise CLIError(resource_group_error)
        if (namespace.resource_group is None):
            raise CLIError(resource_group_error)
        if (not is_valid_resource_id(namespace.namespace)):
            namespace.service_bus_rule_id = resource_id(subscription=get_subscription_id(), resource_group=namespace.resource_group, namespace='microsoft.ServiceBus', type='namespaces', name=namespace.namespace, child_type='AuthorizationRules', child_name=namespace.rule_name)
        else:
            resource_dict = parse_resource_id(namespace.namespace)
            namespace.service_bus_rule_id = resource_id(subscription=resource_dict['subscription'], resource_group=resource_dict['resource_group'], namespace=resource_dict['namespace'], type=resource_dict['type'], name=resource_dict['name'], child_type='AuthorizationRules', child_name=namespace.rule_name)
    if (namespace.storage_account and (not is_valid_resource_id(namespace.storage_account))):
        if (namespace.resource_group is None):
            raise CLIError(resource_group_error)
        namespace.storage_account = resource_id(subscription=get_subscription_id(), resource_group=namespace.resource_group, namespace='microsoft.Storage', type='storageAccounts', name=namespace.storage_account)
    if (namespace.workspace and (not is_valid_resource_id(namespace.workspace))):
        if (namespace.resource_group is None):
            raise CLIError(resource_group_error)
        namespace.workspace = resource_id(subscription=get_subscription_id(), resource_group=namespace.resource_group, namespace='microsoft.OperationalInsights', type='workspaces', name=namespace.workspace)
    _validate_tags(namespace)