/** * Creates a MediaServicesSettings object from the given connection string. * * @param string $connectionString The media services settings connection string. * * @return MediaServicesSettings */ public static function createFromConnectionString($connectionString) { $tokenizedSettings = self::parseAndValidateKeys($connectionString); $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::allRequired(self::$_accountNameSetting, self::$_accessKeySetting), self::optional(self::$_endpointUriSetting, self::$_oauthEndpointUriSetting)); if ($matchedSpecs) { $endpointUri = Utilities::tryGetValueInsensitive(Resources::MEDIA_SERVICES_ENDPOINT_URI_NAME, $tokenizedSettings, Resources::MEDIA_SERVICES_URL); $oauthEndpointUri = Utilities::tryGetValueInsensitive(Resources::MEDIA_SERVICES_OAUTH_ENDPOINT_URI_NAME, $tokenizedSettings, Resources::MEDIA_SERVICES_OAUTH_URL); $accountName = Utilities::tryGetValueInsensitive(Resources::MEDIA_SERVICES_ACCOUNT_NAME, $tokenizedSettings); $accessKey = Utilities::tryGetValueInsensitive(Resources::MEDIA_SERVICES_ACCESS_KEY, $tokenizedSettings); return new self($accountName, $accessKey, $endpointUri, $oauthEndpointUri); } self::noMatch($connectionString); }
/** * Creates a ServiceBusSettings object from the given connection string. * * @param string $connectionString The storage settings connection string. * * @return ServiceBusSettings */ public static function createFromConnectionString($connectionString) { $tokenizedSettings = self::parseAndValidateKeys($connectionString); $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::allRequired(self::$_serviceBusEndpointSetting, self::$_wrapNameSetting, self::$_wrapPasswordSetting), self::optional(self::$_wrapEndpointUriSetting)); if ($matchedSpecs) { $endpoint = Utilities::tryGetValueInsensitive(Resources::SERVICE_BUS_ENDPOINT_NAME, $tokenizedSettings); // Parse the namespace part from the URI $namespace = explode('.', parse_url($endpoint, PHP_URL_HOST)); $namespace = $namespace[0]; $wrapEndpointUri = Utilities::tryGetValueInsensitive(Resources::STS_ENDPOINT_NAME, $tokenizedSettings, sprintf(Resources::WRAP_ENDPOINT_URI_FORMAT, $namespace)); $issuerName = Utilities::tryGetValueInsensitive(Resources::SHARED_SECRET_ISSUER_NAME, $tokenizedSettings); $issuerValue = Utilities::tryGetValueInsensitive(Resources::SHARED_SECRET_VALUE_NAME, $tokenizedSettings); return new self($endpoint, $namespace, $wrapEndpointUri, $issuerName, $issuerValue); } self::noMatch($connectionString); }
/** * Creates a ServiceManagementSettings object from the given connection string. * * @param string $connectionString The storage settings connection string. * * @return ServiceManagementSettings */ public static function createFromConnectionString($connectionString) { $tokenizedSettings = self::parseAndValidateKeys($connectionString); $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::allRequired(self::$_subscriptionIdSetting, self::$_certificatePathSetting), self::optional(self::$_endpointSetting)); if ($matchedSpecs) { $endpointUri = Utilities::tryGetValueInsensitive(Resources::SERVICE_MANAGEMENT_ENDPOINT_NAME, $tokenizedSettings, Resources::SERVICE_MANAGEMENT_URL); $subscriptionId = Utilities::tryGetValueInsensitive(Resources::SUBSCRIPTION_ID_NAME, $tokenizedSettings); $certificatePath = Utilities::tryGetValueInsensitive(Resources::CERTIFICATE_PATH_NAME, $tokenizedSettings); return new self($subscriptionId, $endpointUri, $certificatePath); } self::noMatch($connectionString); }
/** * Creates a StorageServiceSettings object from the given connection string. * * @param string $connectionString The storage settings connection string. * * @return StorageServiceSettings */ public static function createFromConnectionString($connectionString) { $tokenizedSettings = self::parseAndValidateKeys($connectionString); // Devstore case $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::allRequired(self::$_useDevelopmentStorageSetting), self::optional(self::$_developmentStorageProxyUriSetting)); if ($matchedSpecs) { $proxyUri = Utilities::tryGetValueInsensitive(Resources::DEVELOPMENT_STORAGE_PROXY_URI_NAME, $tokenizedSettings); return self::_getDevelopmentStorageAccount($proxyUri); } // Automatic case $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::allRequired(self::$_defaultEndpointsProtocolSetting, self::$_accountNameSetting, self::$_accountKeySetting), self::optional(self::$_blobEndpointSetting, self::$_queueEndpointSetting, self::$_tableEndpointSetting)); if ($matchedSpecs) { return self::_createStorageServiceSettings($tokenizedSettings, self::_getDefaultServiceEndpoint($tokenizedSettings, Resources::BLOB_BASE_DNS_NAME), self::_getDefaultServiceEndpoint($tokenizedSettings, Resources::QUEUE_BASE_DNS_NAME), self::_getDefaultServiceEndpoint($tokenizedSettings, Resources::TABLE_BASE_DNS_NAME)); } // Explicit case $matchedSpecs = self::matchedSpecification($tokenizedSettings, self::atLeastOne(self::$_blobEndpointSetting, self::$_queueEndpointSetting, self::$_tableEndpointSetting), self::allRequired(self::$_accountNameSetting, self::$_accountKeySetting)); if ($matchedSpecs) { return self::_createStorageServiceSettings($tokenizedSettings); } self::noMatch($connectionString); }