def _ex_connection_class_kwargs()

in libcloud/storage/drivers/azure_blobs.py [0:0]


    def _ex_connection_class_kwargs(self):
        kwargs = {}
        # add tenant_id and identity if using azureAd auth
        if self._auth_type == "azureAd":
            kwargs["tenant_id"] = self._tenant_id
            kwargs["identity"] = self._identity
            kwargs["cloud_environment"] = self._cloud_environment

        # if the user didn't provide a custom host value, assume we're
        # targeting the default Azure Storage endpoints
        if self._host is None:
            kwargs["host"] = "{}.{}".format(self.key, AZURE_STORAGE_HOST_SUFFIX)
            return kwargs

        # connecting to a special storage region like Azure Government or
        # Azure China requires setting a custom storage endpoint but we
        # still use the same scheme to identify a specific account as for
        # the standard storage endpoint
        try:
            host_suffix = next(
                host_suffix
                for host_suffix in (
                    AZURE_STORAGE_HOST_SUFFIX_CHINA,
                    AZURE_STORAGE_HOST_SUFFIX_GOVERNMENT,
                    AZURE_STORAGE_HOST_SUFFIX_PRIVATELINK,
                )
                if self._host.endswith(host_suffix)
            )
        except StopIteration:
            pass
        else:
            kwargs["host"] = "{}.{}".format(self.key, host_suffix)
            return kwargs

        # if the host isn't targeting one of the special storage regions, it
        # must be pointing to Azurite or IoT Edge Storage so switch to prefix
        # identification
        kwargs["account_prefix"] = self.key

        return kwargs