DataZone / Client / create_rule

create_rule#

DataZone.Client.create_rule(**kwargs)#

Creates a rule in Amazon DataZone. A rule is a formal agreement that enforces specific requirements across user workflows (e.g., publishing assets to the catalog, requesting subscriptions, creating projects) within the Amazon DataZone data portal. These rules help maintain consistency, ensure compliance, and uphold governance standards in data management processes. For instance, a metadata enforcement rule can specify the required information for creating a subscription request or publishing a data asset to the catalog, ensuring alignment with organizational standards.

See also: AWS API Documentation

Request Syntax

response = client.create_rule(
    action='CREATE_SUBSCRIPTION_REQUEST',
    clientToken='string',
    description='string',
    detail={
        'metadataFormEnforcementDetail': {
            'requiredMetadataForms': [
                {
                    'typeIdentifier': 'string',
                    'typeRevision': 'string'
                },
            ]
        }
    },
    domainIdentifier='string',
    name='string',
    scope={
        'assetType': {
            'selectionMode': 'ALL'|'SPECIFIC',
            'specificAssetTypes': [
                'string',
            ]
        },
        'dataProduct': True|False,
        'project': {
            'selectionMode': 'ALL'|'SPECIFIC',
            'specificProjects': [
                'string',
            ]
        }
    },
    target={
        'domainUnitTarget': {
            'domainUnitId': 'string',
            'includeChildDomainUnits': True|False
        }
    }
)
Parameters:
  • action (string) –

    [REQUIRED]

    The action of the rule.

  • clientToken (string) –

    A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.

    This field is autopopulated if not provided.

  • description (string) – The description of the rule.

  • detail (dict) –

    [REQUIRED]

    The detail of the rule.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: metadataFormEnforcementDetail.

    • metadataFormEnforcementDetail (dict) –

      The enforcement detail of the metadata form.

      • requiredMetadataForms (list) –

        The required metadata forms.

        • (dict) –

          The reference of a metadata form.

          • typeIdentifier (string) – [REQUIRED]

            The type ID of the metadata form reference.

          • typeRevision (string) – [REQUIRED]

            The type revision of the metadata form reference.

  • domainIdentifier (string) –

    [REQUIRED]

    The ID of the domain where the rule is created.

  • name (string) –

    [REQUIRED]

    The name of the rule.

  • scope (dict) –

    [REQUIRED]

    The scope of the rule.

    • assetType (dict) –

      The asset type included in the rule scope.

      • selectionMode (string) – [REQUIRED]

        The selection mode for the rule.

      • specificAssetTypes (list) –

        The specific asset types that are included in the rule.

        • (string) –

    • dataProduct (boolean) –

      The data product included in the rule scope.

    • project (dict) –

      The project included in the rule scope.

      • selectionMode (string) – [REQUIRED]

        The selection mode of the rule.

      • specificProjects (list) –

        The specific projects in which the rule is created.

        • (string) –

  • target (dict) –

    [REQUIRED]

    The target of the rule.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: domainUnitTarget.

    • domainUnitTarget (dict) –

      The ID of the domain unit.

      • domainUnitId (string) – [REQUIRED]

        The ID of the domain unit.

      • includeChildDomainUnits (boolean) –

        Specifies whether to apply a rule to the child domain units.

Return type:

dict

Returns:

Response Syntax

{
    'action': 'CREATE_SUBSCRIPTION_REQUEST',
    'createdAt': datetime(2015, 1, 1),
    'createdBy': 'string',
    'description': 'string',
    'detail': {
        'metadataFormEnforcementDetail': {
            'requiredMetadataForms': [
                {
                    'typeIdentifier': 'string',
                    'typeRevision': 'string'
                },
            ]
        }
    },
    'identifier': 'string',
    'name': 'string',
    'ruleType': 'METADATA_FORM_ENFORCEMENT',
    'scope': {
        'assetType': {
            'selectionMode': 'ALL'|'SPECIFIC',
            'specificAssetTypes': [
                'string',
            ]
        },
        'dataProduct': True|False,
        'project': {
            'selectionMode': 'ALL'|'SPECIFIC',
            'specificProjects': [
                'string',
            ]
        }
    },
    'target': {
        'domainUnitTarget': {
            'domainUnitId': 'string',
            'includeChildDomainUnits': True|False
        }
    },
    'targetType': 'DOMAIN_UNIT'
}

Response Structure

  • (dict) –

    • action (string) –

      The action of the rule.

    • createdAt (datetime) –

      The timestamp at which the rule is created.

    • createdBy (string) –

      The user who creates the rule.

    • description (string) –

      The description of the rule.

    • detail (dict) –

      The detail of the rule.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: metadataFormEnforcementDetail. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • metadataFormEnforcementDetail (dict) –

        The enforcement detail of the metadata form.

        • requiredMetadataForms (list) –

          The required metadata forms.

          • (dict) –

            The reference of a metadata form.

            • typeIdentifier (string) –

              The type ID of the metadata form reference.

            • typeRevision (string) –

              The type revision of the metadata form reference.

    • identifier (string) –

      The ID of the rule.

    • name (string) –

      The name of the rule.

    • ruleType (string) –

      The type of the rule.

    • scope (dict) –

      The scope of the rule.

      • assetType (dict) –

        The asset type included in the rule scope.

        • selectionMode (string) –

          The selection mode for the rule.

        • specificAssetTypes (list) –

          The specific asset types that are included in the rule.

          • (string) –

      • dataProduct (boolean) –

        The data product included in the rule scope.

      • project (dict) –

        The project included in the rule scope.

        • selectionMode (string) –

          The selection mode of the rule.

        • specificProjects (list) –

          The specific projects in which the rule is created.

          • (string) –

    • target (dict) –

      The target of the rule.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: domainUnitTarget. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • domainUnitTarget (dict) –

        The ID of the domain unit.

        • domainUnitId (string) –

          The ID of the domain unit.

        • includeChildDomainUnits (boolean) –

          Specifies whether to apply a rule to the child domain units.

    • targetType (string) –

      The target type of the rule.

Exceptions

  • DataZone.Client.exceptions.InternalServerException

  • DataZone.Client.exceptions.ResourceNotFoundException

  • DataZone.Client.exceptions.AccessDeniedException

  • DataZone.Client.exceptions.ThrottlingException

  • DataZone.Client.exceptions.ServiceQuotaExceededException

  • DataZone.Client.exceptions.ConflictException

  • DataZone.Client.exceptions.ValidationException

  • DataZone.Client.exceptions.UnauthorizedException