本文整理汇总了PHP中WindowsAzure\Common\Internal\Utilities::tryAddUrlScheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::tryAddUrlScheme方法的具体用法?PHP Utilities::tryAddUrlScheme怎么用?PHP Utilities::tryAddUrlScheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowsAzure\Common\Internal\Utilities
的用法示例。
在下文中一共展示了Utilities::tryAddUrlScheme方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFileService
/**
* Builds a file object.
*
* @param string $connectionString The configuration connection string.
*
* @return \WindowsFileService\File\Internal\IFile
*/
public function createFileService($connectionString)
{
$settings = StorageServiceSettings::createFromConnectionString($connectionString);
$httpClient = $this->httpClient();
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme($settings->getFileEndpointUri());
$fileWrapper = new FileRestProxy($httpClient, $uri, $settings->getName(), $serializer);
// Adding headers filter
$headers = array(Resources::USER_AGENT => Resources::SDK_USER_AGENT);
$headers[Resources::X_MS_VERSION] = Resources::FILE_API_LATEST_VERSION;
$headersFilter = new HeadersFilter($headers);
$fileWrapper = $fileWrapper->withFilter($headersFilter);
// Adding date filter
$dateFilter = new DateFilter();
$fileWrapper = $fileWrapper->withFilter($dateFilter);
$authFilter = new AuthenticationFilter($this->fileAuthenticationScheme($settings->getName(), $settings->getKey()));
$fileWrapper = $fileWrapper->withFilter($authFilter);
return $fileWrapper;
}
示例2: testTryAddUrlSchemeWithoutScheme
/**
* @covers WindowsAzure\Common\Internal\Utilities::tryAddUrlScheme
*/
public function testTryAddUrlSchemeWithoutScheme()
{
// Setup
$url = 'microsoft.com';
$expected = 'http://microsoft.com';
// Test
$actual = Utilities::tryAddUrlScheme($url);
// Assert
$this->assertEquals($expected, $actual);
}
示例3: createMediaServicesService
/**
* Builds a media services object.
*
* @param WindowsAzure\Common\Internal\MediaServicesSettings $settings The media
* services configuration settings.
*
* @return WindowsAzure\MediaServices\Internal\IMediaServices
*/
public function createMediaServicesService($settings)
{
Validate::isA($settings, 'WindowsAzure\\Common\\Internal\\MediaServicesSettings', 'settings');
$httpClient = new HttpClient();
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme($settings->getEndpointUri(), Resources::HTTPS_SCHEME);
$mediaServicesWrapper = new MediaServicesRestProxy($httpClient, $uri, $settings->getAccountName(), $serializer);
// Adding headers filter
$xMSVersion = Resources::MEDIA_SERVICES_API_LATEST_VERSION;
$dataVersion = Resources::MEDIA_SERVICES_DATA_SERVICE_VERSION_VALUE;
$dataMaxVersion = Resources::MEDIA_SERVICES_MAX_DATA_SERVICE_VERSION_VALUE;
$accept = Resources::ACCEPT_HEADER_VALUE;
$contentType = Resources::ATOM_ENTRY_CONTENT_TYPE;
$userAgent = Resources::SDK_USER_AGENT;
$headers = array(Resources::X_MS_VERSION => $xMSVersion, Resources::DATA_SERVICE_VERSION => $dataVersion, Resources::MAX_DATA_SERVICE_VERSION => $dataMaxVersion, Resources::ACCEPT_HEADER => $accept, Resources::CONTENT_TYPE => $contentType, Resources::USER_AGENT => $userAgent);
$headersFilter = new HeadersFilter($headers);
$mediaServicesWrapper = $mediaServicesWrapper->withFilter($headersFilter);
// Adding OAuth filter
$oauthService = new OAuthRestProxy(new HttpClient(), $settings->getOAuthEndpointUri());
$authentification = new OAuthScheme($settings->getAccountName(), $settings->getAccessKey(), Resources::OAUTH_GT_CLIENT_CREDENTIALS, Resources::MEDIA_SERVICES_OAUTH_SCOPE, $oauthService);
$authentificationFilter = new AuthenticationFilter($authentification);
$mediaServicesWrapper = $mediaServicesWrapper->withFilter($authentificationFilter);
return $mediaServicesWrapper;
}
示例4: createServiceManagementService
/**
* Builds a service management object.
*
* @param string $connectionString The configuration connection string.
*
* @return WindowsAzure\ServiceManagement\Internal\IServiceManagement
*/
public function createServiceManagementService($connectionString)
{
$settings = ServiceManagementSettings::createFromConnectionString($connectionString);
$certificatePath = $settings->getCertificatePath();
$httpClient = new HttpClient($certificatePath);
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme($settings->getEndpointUri(), Resources::HTTPS_SCHEME);
$serviceManagementWrapper = new ServiceManagementRestProxy($httpClient, $settings->getSubscriptionId(), $uri, $serializer);
// Adding headers filter
$headers = array();
$headers[Resources::X_MS_VERSION] = Resources::SM_API_LATEST_VERSION;
$headersFilter = new HeadersFilter($headers);
$serviceManagementWrapper = $serviceManagementWrapper->withFilter($headersFilter);
return $serviceManagementWrapper;
}
示例5: _buildServiceManagement
/**
* Builds a service management object.
*
* @param WindowsAzure\Common\Configuration $config The configuration.
*
* @return WindowsAzure\ServiceManagement\Internal\IServiceManagement
*/
private function _buildServiceManagement($config)
{
$certificatePath = $config->getProperty(ServiceManagementSettings::CERTIFICATE_PATH);
$httpClient = new HttpClient($certificatePath);
$xmlSerializer = new XmlSerializer();
$uri = Utilities::tryAddUrlScheme($config->getProperty(ServiceManagementSettings::URI), Resources::HTTPS_SCHEME);
$serviceManagementWrapper = new ServiceManagementRestProxy($httpClient, $config->getProperty(ServiceManagementSettings::SUBSCRIPTION_ID), $uri, $xmlSerializer);
// Adding headers filter
$serviceManagementWrapper = self::_addHeadersFilter($serviceManagementWrapper, Resources::SERVICE_MANAGEMENT_TYPE_NAME);
return $serviceManagementWrapper;
}