PHP Класс Scalr\Service\Azure

С версии: 5.8.6
Автор: Vlad Dobrovolskiy ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $appClientId, string $appSecretKey, string $tenantName ) Constructor.
__get ( string $name ) : Scalr\Service\Azure\AbstractService Magic getter.
assignContributorRoleToApp ( string $subscriptionId, string $roleAssignmentId, string $appObjectId, string $contributorRoleId ) : Scalr\Service\Azure\DataType\RoleAssignmentData Assign Contributor Role Id to specified app.
deleteRoleAssignment ( string $subscriptionId, string $roleAssignmentId ) : boolean Delete role assignment.
getAccessToken ( ) : object Gets Access Token.
getAccessTokenByAuthCode ( string $authorizationCode ) : object Receive access token from server using Authorisation Code.
getAppObjectId ( ) : string Receive from server Application Object ID for app with specified App Client ID using Client Token (AuthClient::getClientToken()).
getAuthorizationCodeLocation ( ) : string Retrieve location where user must go to receive redirect-callback from Azure with authorization code.
getAvailableServices ( ) : array List of all available services.
getClient ( ) : QueryClient Gets Client
getClientToken ( string $resource = self::URL_GRAPH_WINDOWS ) : object Receive short-time-live client token to use in GraphClient.
getContributorRoleAssignmentInfo ( string $subscriptionId, string $appObjectId, string $contributorRoleId ) : Scalr\Service\Azure\DataType\RoleAssignmentData Get Role Assignment list in specified subscription.
getContributorRoleId ( string $subscriptionId ) : string Get Contributor Role Id for specified subscription.
getEnvironment ( ) : Scalr_Environment Gets an Scalr Environment object which is associated with the Azure client instance
getLocationsList ( string $namespace = GeoLocationData::RESOURCE_PROVIDER_COMPUTE ) : Scalr\Service\Azure\DataType\GeoLocationData List all of the available geo-locations where user can create resource groups and resources.
getProvidersList ( string $subscriptionId ) : Scalr\Service\Azure\DataType\ProviderList List information about all of the available resource providers and whether they are registered with the subscription.
getProxy ( ) : array | boolean Gets proxy configuration
getRefreshToken ( ) : object Getter for Refresh Token.
getRoleAssignmentInfo ( string $subscriptionId, string $roleAssignmentId ) : Scalr\Service\Azure\DataType\RoleAssignmentData Get Role Assignment info in specified subscription.
getSubscriptionsList ( ) : Scalr\Service\Azure\DataType\SubscriptionList Get list of all user subscriptions.
registerSubscription ( string $subscriptionId, string $resourceProvider ) : Scalr\Service\Azure\DataType\ProviderData Register a subscription with a resource provider.
setAccessToken ( string $token, string $expireDate, string $error = null ) Setter for Access Token.
setEnvironment ( Scalr_Environment $environment = null ) : Azure Sets an Scalr environment object which is associated with the Azure client instance
setProxy ( string $host, integer $port = 3128, string $user = null, string $pass = null, integer $type, integer $authType = 1 ) Set proxy configuration to connect to AWS services
unregisterSubscription ( string $subscriptionId, string $resourceProvider ) : Scalr\Service\Azure\DataType\ProviderData Unregister a subscription from a resource provider.
validateTenantName ( ) : boolean Validate tenant name.

Защищенные методы

Метод Описание
getToken ( string $grantType, string $resource, string $refreshToken = null, string $authorizationCode = null ) : object Receive token.

Приватные методы

Метод Описание
loadToken ( string $type ) : object Load token from storage (DB in future).

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( string $appClientId, string $appSecretKey, string $tenantName )
$appClientId string Application Client ID
$appSecretKey string Application Secret Key
$tenantName string Name of tenant.

__get() публичный Метод

Magic getter.
public __get ( string $name ) : Scalr\Service\Azure\AbstractService
$name string
Результат Scalr\Service\Azure\AbstractService

assignContributorRoleToApp() публичный Метод

Assign Contributor Role Id to specified app.
public assignContributorRoleToApp ( string $subscriptionId, string $roleAssignmentId, string $appObjectId, string $contributorRoleId ) : Scalr\Service\Azure\DataType\RoleAssignmentData
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
$roleAssignmentId string New role assignment id
$appObjectId string Application Object Id
$contributorRoleId string Contributor Role Id
Результат Scalr\Service\Azure\DataType\RoleAssignmentData Server response body (JSON)

deleteRoleAssignment() публичный Метод

Delete role assignment.
public deleteRoleAssignment ( string $subscriptionId, string $roleAssignmentId ) : boolean
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
$roleAssignmentId string Role assignment id
Результат boolean

getAccessToken() публичный Метод

Gets Access Token.
public getAccessToken ( ) : object
Результат object stdClass with next properties : token, expireDate and error. $accesToken is invalid, when error is not null

getAccessTokenByAuthCode() публичный Метод

Receive access token from server using Authorisation Code.
public getAccessTokenByAuthCode ( string $authorizationCode ) : object
$authorizationCode string Code, received from server
Результат object stdClass with next properties : token, expireDate and error. $accesToken is invalid, when error is not null

getAppObjectId() публичный Метод

Receive from server Application Object ID for app with specified App Client ID using Client Token (AuthClient::getClientToken()).
public getAppObjectId ( ) : string
Результат string Application Object ID

getAuthorizationCodeLocation() публичный Метод

Retrieve location where user must go to receive redirect-callback from Azure with authorization code.
public getAuthorizationCodeLocation ( ) : string
Результат string URL for access code request

getAvailableServices() публичный Метод

List of all available services.
public getAvailableServices ( ) : array
Результат array Service names

getClient() публичный Метод

Gets Client
public getClient ( ) : QueryClient
Результат Scalr\Service\Azure\Client\QueryClient Returns QueryClient

getClientToken() публичный Метод

Receive short-time-live client token to use in GraphClient.
public getClientToken ( string $resource = self::URL_GRAPH_WINDOWS ) : object
$resource string
Результат object stdClass with next properties : token, expireDate and error. $clientToken is invalid, when error is not null

getContributorRoleAssignmentInfo() публичный Метод

Get Role Assignment list in specified subscription.
public getContributorRoleAssignmentInfo ( string $subscriptionId, string $appObjectId, string $contributorRoleId ) : Scalr\Service\Azure\DataType\RoleAssignmentData
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
$appObjectId string Application Object Id
$contributorRoleId string Contributor Role Id
Результат Scalr\Service\Azure\DataType\RoleAssignmentData Server response body (JSON)

getContributorRoleId() публичный Метод

Get Contributor Role Id for specified subscription.
public getContributorRoleId ( string $subscriptionId ) : string
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
Результат string Contributor Role Id

getEnvironment() публичный Метод

Gets an Scalr Environment object which is associated with the Azure client instance
public getEnvironment ( ) : Scalr_Environment
Результат Scalr_Environment Returns Scalr Environment object

getLocationsList() публичный Метод

List all of the available geo-locations where user can create resource groups and resources.
public getLocationsList ( string $namespace = GeoLocationData::RESOURCE_PROVIDER_COMPUTE ) : Scalr\Service\Azure\DataType\GeoLocationData
$namespace string Resource provider
Результат Scalr\Service\Azure\DataType\GeoLocationData Object described on https://msdn.microsoft.com/en-us/library/azure/dn790540.aspx

getProvidersList() публичный Метод

List information about all of the available resource providers and whether they are registered with the subscription.
public getProvidersList ( string $subscriptionId ) : Scalr\Service\Azure\DataType\ProviderList
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
Результат Scalr\Service\Azure\DataType\ProviderList

getProxy() публичный Метод

Gets proxy configuration
public getProxy ( ) : array | boolean
Результат array | boolean

getRefreshToken() публичный Метод

Getter for Refresh Token.
public getRefreshToken ( ) : object
Результат object stdClass with next properties : token, expireDate and error.

getRoleAssignmentInfo() публичный Метод

Get Role Assignment info in specified subscription.
public getRoleAssignmentInfo ( string $subscriptionId, string $roleAssignmentId ) : Scalr\Service\Azure\DataType\RoleAssignmentData
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
$roleAssignmentId string Role assignment id
Результат Scalr\Service\Azure\DataType\RoleAssignmentData Server response body (JSON)

getSubscriptionsList() публичный Метод

Get list of all user subscriptions.
public getSubscriptionsList ( ) : Scalr\Service\Azure\DataType\SubscriptionList
Результат Scalr\Service\Azure\DataType\SubscriptionList List of subscription objects

getToken() защищенный Метод

Receive token.
protected getToken ( string $grantType, string $resource, string $refreshToken = null, string $authorizationCode = null ) : object
$grantType string Grant type
$resource string Resource
$refreshToken string optional Refresh Token value
$authorizationCode string
Результат object Object with next properties : token, expireDate and error. Token is invalid, when error is not null

registerSubscription() публичный Метод

Register a subscription with a resource provider.
public registerSubscription ( string $subscriptionId, string $resourceProvider ) : Scalr\Service\Azure\DataType\ProviderData
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
$resourceProvider string The namespace of the resource provider with which you want to register your subscription
Результат Scalr\Service\Azure\DataType\ProviderData

setAccessToken() публичный Метод

Setter for Access Token.
public setAccessToken ( string $token, string $expireDate, string $error = null )
$token string Access Token body
$expireDate string Access Token expire date (unixtime)
$error string optional Access Token error description

setEnvironment() публичный Метод

Sets an Scalr environment object which is associated with the Azure client instance
public setEnvironment ( Scalr_Environment $environment = null ) : Azure
$environment Scalr_Environment An environment object
Результат Azure

setProxy() публичный Метод

Set proxy configuration to connect to AWS services
public setProxy ( string $host, integer $port = 3128, string $user = null, string $pass = null, integer $type, integer $authType = 1 )
$host string
$port integer
$user string
$pass string
$type integer Allowed values 4 - SOCKS4, 5 - SOCKS5, 0 - HTTP
$authType integer Allowed authtypes: 1 - Basic, Digest - 2, GSSNeg - 4, NTLM - 8, any - -1

unregisterSubscription() публичный Метод

Unregister a subscription from a resource provider.
public unregisterSubscription ( string $subscriptionId, string $resourceProvider ) : Scalr\Service\Azure\DataType\ProviderData
$subscriptionId string subscription::subscriptionId value of one of user's subscriptions
$resourceProvider string The namespace of the resource provider with which you want to unregister from your subscription
Результат Scalr\Service\Azure\DataType\ProviderData

validateTenantName() публичный Метод

Validate tenant name.
public validateTenantName ( ) : boolean
Результат boolean Return true, if tenantName is valid, else return false