Esempio n. 1
0
    def create_adapter_with_shared_key(self, root_relative_path: str = None):
        hostname = os.environ.get("ADLS_HOSTNAME")
        root_path = os.environ.get("ADLS_ROOTPATH")
        shared_key = os.environ.get("ADLS_SHAREDKEY")

        self.assertFalse(StringUtils.is_null_or_white_space(hostname), "ADLS_HOSTNAME environment variable not set up")
        self.assertFalse(StringUtils.is_null_or_white_space(root_path), "ADLS_ROOTPATH environment variable not set up")
        self.assertFalse(StringUtils.is_null_or_white_space(shared_key), "ADLS_SHAREDKEY environment variable not set up")

        adapter = ADLSAdapter(hostname=hostname, root=self.combine_path(root_path, root_relative_path), shared_key=shared_key)

        return adapter
Esempio n. 2
0
File: adls.py Progetto: minettes/CDM
    def hostname(self, value: str):
        if StringUtils.is_null_or_white_space(value):
            raise ValueError('Hostname cannot be null or whitespace.')

        self._hostname = value
        self._formatted_hostname = self._format_hostname(self.hostname)
        self._formatted_hostname_no_protocol = self._format_hostname(self._remove_protocol_from_hostname(self._hostname))
Esempio n. 3
0
    def create_adapter_with_client_id(self, root_relative_path: str = None):
        hostname = os.environ.get("ADLS_HOSTNAME")
        root_path = os.environ.get("ADLS_ROOTPATH")
        tenant = os.environ.get("ADLS_TENANT")
        client_id = os.environ.get("ADLS_CLIENTID")
        client_secret = os.environ.get("ADLS_CLIENTSECRET")

        self.assertFalse(StringUtils.is_null_or_white_space(hostname), "ADLS_HOSTNAME environment variable not set up")
        self.assertFalse(StringUtils.is_null_or_white_space(root_path), "ADLS_ROOTPATH environment variable not set up")
        self.assertFalse(StringUtils.is_null_or_white_space(tenant), "ADLS_TENANT environment variable not set up")
        self.assertFalse(StringUtils.is_null_or_white_space(client_id), "ADLS_CLIENTID environment variable not set up")
        self.assertFalse(StringUtils.is_null_or_white_space(client_secret), "ADLS_CLIENTSECRET environment variable not set up")

        adapter = ADLSAdapter(hostname=hostname, root=self.combine_path(root_path, root_relative_path), tenant=tenant, client_id=client_id, secret=client_secret)

        return adapter
Esempio n. 4
0
    def to_data(instance: 'CdmE2ERelationship', res_opt: ResolveOptions,
                options: CopyOptions) -> E2ERelationship:
        relationship = E2ERelationship()
        if not StringUtils.is_null_or_white_space(instance.relationship_name):
            relationship.name = instance.relationship_name
        relationship.fromEntity = instance.from_entity
        relationship.fromEntityAttribute = instance.from_entity_attribute
        relationship.toEntity = instance.to_entity
        relationship.toEntityAttribute = instance.to_entity_attribute

        return relationship
Esempio n. 5
0
    def from_data(ctx: CdmCorpusContext,
                  data: E2ERelationship) -> CdmE2ERelationship:
        relationship = ctx.corpus.make_object(
            CdmObjectType.E2E_RELATIONSHIP_DEF)
        if not StringUtils.is_null_or_white_space(data.name):
            relationship.relationship_name = data.name
        relationship.from_entity = data.fromEntity
        relationship.from_entity_attribute = data.fromEntityAttribute
        relationship.to_entity = data.toEntity
        relationship.to_entity_attribute = data.toEntityAttribute

        return relationship
    def to_data(instance: 'CdmE2ERelationship', res_opt: ResolveOptions,
                options: CopyOptions) -> E2ERelationship:
        relationship = E2ERelationship()
        if not StringUtils.is_null_or_white_space(instance.name):
            relationship.name = instance.name
        relationship.fromEntity = instance.from_entity
        relationship.fromEntityAttribute = instance.from_entity_attribute
        relationship.toEntity = instance.to_entity
        relationship.toEntityAttribute = instance.to_entity_attribute
        relationship.exhibitsTraits = copy_data_utils._array_copy_data(
            res_opt, instance.exhibits_traits, options)

        return relationship
Esempio n. 7
0
    def from_data(ctx: CdmCorpusContext,
                  data: E2ERelationship) -> CdmE2ERelationship:
        relationship = ctx.corpus.make_object(
            CdmObjectType.E2E_RELATIONSHIP_DEF)
        if not StringUtils.is_null_or_white_space(data.name):
            relationship.relationship_name = data.name
        relationship.from_entity = data.fromEntity
        relationship.from_entity_attribute = data.fromEntityAttribute
        relationship.to_entity = data.toEntity
        relationship.to_entity_attribute = data.toEntityAttribute
        utils.add_list_to_cdm_collection(
            relationship.exhibits_traits,
            utils.create_trait_reference_array(ctx, data.exhibitsTraits))

        return relationship