Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/appservice/azure-mgmt-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is the Microsoft Azure Web Apps Management Client Library.
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/)
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).


# Usage
Expand Down
35 changes: 35 additions & 0 deletions sdk/appservice/azure-mgmt-web/azure/mgmt/web/_operations_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,41 @@ def check_name_availability(self, name, type, is_fqdn=None, custom_headers=None,
mixin_instance.api_version = api_version
return mixin_instance.check_name_availability(name, type, is_fqdn, custom_headers, raw, **operation_config)

def generate_github_access_token_for_appservice_cli_async(self, code, state, custom_headers=None, raw=False, **operation_config):
"""Exchange code for GitHub access token for AppService CLI.

Description for Exchange code for GitHub access token for AppService
CLI.

:param code: Code string to exchange for Github Access token
:type code: str
:param state: State string used for verification.
:type state: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: AppserviceGithubToken or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.web.v2019_08_01.models.AppserviceGithubToken or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`DefaultErrorResponseException<azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseException>`

"""
api_version = self._get_api_version('generate_github_access_token_for_appservice_cli_async')
if api_version == '2019-08-01':
from .v2019_08_01.operations import WebSiteManagementClientOperationsMixin as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
mixin_instance = OperationClass()
mixin_instance._client = self._client
mixin_instance.config = self.config
mixin_instance._serialize = Serializer(self._models_dict(api_version))
mixin_instance._deserialize = Deserializer(self._models_dict(api_version))
mixin_instance.api_version = api_version
return mixin_instance.generate_github_access_token_for_appservice_cli_async(code, state, custom_headers, raw, **operation_config)

def get_publishing_user(self, custom_headers=None, raw=False, **operation_config):
"""Gets publishing user.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from ._models_py3 import AppServiceEnvironment
from ._models_py3 import AppServiceEnvironmentPatchResource
from ._models_py3 import AppServiceEnvironmentResource
from ._models_py3 import AppserviceGithubToken
from ._models_py3 import AppserviceGithubTokenRequest
from ._models_py3 import AppServicePlan
from ._models_py3 import AppServicePlanPatchResource
from ._models_py3 import ArmIdWrapper
Expand Down Expand Up @@ -284,6 +286,8 @@
from ._models import AppServiceEnvironment
from ._models import AppServiceEnvironmentPatchResource
from ._models import AppServiceEnvironmentResource
from ._models import AppserviceGithubToken
from ._models import AppserviceGithubTokenRequest
from ._models import AppServicePlan
from ._models import AppServicePlanPatchResource
from ._models import ArmIdWrapper
Expand Down Expand Up @@ -671,6 +675,8 @@
'AppServiceEnvironment',
'AppServiceEnvironmentPatchResource',
'AppServiceEnvironmentResource',
'AppserviceGithubToken',
'AppserviceGithubTokenRequest',
'AppServicePlan',
'AppServicePlanPatchResource',
'ArmIdWrapper',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,66 @@ def __init__(self, **kwargs):
self.ssl_cert_key_vault_secret_name = kwargs.get('ssl_cert_key_vault_secret_name', None)


class AppserviceGithubToken(Model):
"""Github access token for Appservice CLI github integration.

:param access_token: Github access token for Appservice CLI github
integration
:type access_token: str
:param scope: Scope of the github access token
:type scope: str
:param token_type: token type
:type token_type: str
:param got_token: True if valid github token received, False otherwise
:type got_token: bool
:param error_message: Error message if unable to get token
:type error_message: str
"""

_attribute_map = {
'access_token': {'key': 'accessToken', 'type': 'str'},
'scope': {'key': 'scope', 'type': 'str'},
'token_type': {'key': 'tokenType', 'type': 'str'},
'got_token': {'key': 'gotToken', 'type': 'bool'},
'error_message': {'key': 'errorMessage', 'type': 'str'},
}

def __init__(self, **kwargs):
super(AppserviceGithubToken, self).__init__(**kwargs)
self.access_token = kwargs.get('access_token', None)
self.scope = kwargs.get('scope', None)
self.token_type = kwargs.get('token_type', None)
self.got_token = kwargs.get('got_token', None)
self.error_message = kwargs.get('error_message', None)


class AppserviceGithubTokenRequest(Model):
"""Appservice Github token request content.

All required parameters must be populated in order to send to Azure.

:param code: Required. Code string to exchange for Github Access token
:type code: str
:param state: Required. State string used for verification.
:type state: str
"""

_validation = {
'code': {'required': True},
'state': {'required': True},
}

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'state': {'key': 'state', 'type': 'str'},
}

def __init__(self, **kwargs):
super(AppserviceGithubTokenRequest, self).__init__(**kwargs)
self.code = kwargs.get('code', None)
self.state = kwargs.get('state', None)


class AppServicePlan(Resource):
"""App Service plan.

Expand Down Expand Up @@ -10818,6 +10878,9 @@ class SiteSourceControl(ProxyOnlyResource):
integration; <code>false</code> to enable continuous integration (which
configures webhooks into online repos like GitHub).
:type is_manual_integration: bool
:param is_git_hub_action: <code>true</code> if this is deployed via GitHub
action.
:type is_git_hub_action: bool
:param deployment_rollback_enabled: <code>true</code> to enable deployment
rollback; otherwise, <code>false</code>.
:type deployment_rollback_enabled: bool
Expand All @@ -10840,6 +10903,7 @@ class SiteSourceControl(ProxyOnlyResource):
'repo_url': {'key': 'properties.repoUrl', 'type': 'str'},
'branch': {'key': 'properties.branch', 'type': 'str'},
'is_manual_integration': {'key': 'properties.isManualIntegration', 'type': 'bool'},
'is_git_hub_action': {'key': 'properties.isGitHubAction', 'type': 'bool'},
'deployment_rollback_enabled': {'key': 'properties.deploymentRollbackEnabled', 'type': 'bool'},
'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'},
}
Expand All @@ -10849,6 +10913,7 @@ def __init__(self, **kwargs):
self.repo_url = kwargs.get('repo_url', None)
self.branch = kwargs.get('branch', None)
self.is_manual_integration = kwargs.get('is_manual_integration', None)
self.is_git_hub_action = kwargs.get('is_git_hub_action', None)
self.deployment_rollback_enabled = kwargs.get('deployment_rollback_enabled', None)
self.is_mercurial = kwargs.get('is_mercurial', None)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,66 @@ def __init__(self, *, location: str, app_service_environment_resource_name: str,
self.ssl_cert_key_vault_secret_name = ssl_cert_key_vault_secret_name


class AppserviceGithubToken(Model):
"""Github access token for Appservice CLI github integration.

:param access_token: Github access token for Appservice CLI github
integration
:type access_token: str
:param scope: Scope of the github access token
:type scope: str
:param token_type: token type
:type token_type: str
:param got_token: True if valid github token received, False otherwise
:type got_token: bool
:param error_message: Error message if unable to get token
:type error_message: str
"""

_attribute_map = {
'access_token': {'key': 'accessToken', 'type': 'str'},
'scope': {'key': 'scope', 'type': 'str'},
'token_type': {'key': 'tokenType', 'type': 'str'},
'got_token': {'key': 'gotToken', 'type': 'bool'},
'error_message': {'key': 'errorMessage', 'type': 'str'},
}

def __init__(self, *, access_token: str=None, scope: str=None, token_type: str=None, got_token: bool=None, error_message: str=None, **kwargs) -> None:
super(AppserviceGithubToken, self).__init__(**kwargs)
self.access_token = access_token
self.scope = scope
self.token_type = token_type
self.got_token = got_token
self.error_message = error_message


class AppserviceGithubTokenRequest(Model):
"""Appservice Github token request content.

All required parameters must be populated in order to send to Azure.

:param code: Required. Code string to exchange for Github Access token
:type code: str
:param state: Required. State string used for verification.
:type state: str
"""

_validation = {
'code': {'required': True},
'state': {'required': True},
}

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'state': {'key': 'state', 'type': 'str'},
}

def __init__(self, *, code: str, state: str, **kwargs) -> None:
super(AppserviceGithubTokenRequest, self).__init__(**kwargs)
self.code = code
self.state = state


class AppServicePlan(Resource):
"""App Service plan.

Expand Down Expand Up @@ -10818,6 +10878,9 @@ class SiteSourceControl(ProxyOnlyResource):
integration; <code>false</code> to enable continuous integration (which
configures webhooks into online repos like GitHub).
:type is_manual_integration: bool
:param is_git_hub_action: <code>true</code> if this is deployed via GitHub
action.
:type is_git_hub_action: bool
:param deployment_rollback_enabled: <code>true</code> to enable deployment
rollback; otherwise, <code>false</code>.
:type deployment_rollback_enabled: bool
Expand All @@ -10840,15 +10903,17 @@ class SiteSourceControl(ProxyOnlyResource):
'repo_url': {'key': 'properties.repoUrl', 'type': 'str'},
'branch': {'key': 'properties.branch', 'type': 'str'},
'is_manual_integration': {'key': 'properties.isManualIntegration', 'type': 'bool'},
'is_git_hub_action': {'key': 'properties.isGitHubAction', 'type': 'bool'},
'deployment_rollback_enabled': {'key': 'properties.deploymentRollbackEnabled', 'type': 'bool'},
'is_mercurial': {'key': 'properties.isMercurial', 'type': 'bool'},
}

def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_manual_integration: bool=None, deployment_rollback_enabled: bool=None, is_mercurial: bool=None, **kwargs) -> None:
def __init__(self, *, kind: str=None, repo_url: str=None, branch: str=None, is_manual_integration: bool=None, is_git_hub_action: bool=None, deployment_rollback_enabled: bool=None, is_mercurial: bool=None, **kwargs) -> None:
super(SiteSourceControl, self).__init__(kind=kind, **kwargs)
self.repo_url = repo_url
self.branch = branch
self.is_manual_integration = is_manual_integration
self.is_git_hub_action = is_git_hub_action
self.deployment_rollback_enabled = deployment_rollback_enabled
self.is_mercurial = is_mercurial

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,69 @@

class WebSiteManagementClientOperationsMixin(object):

def generate_github_access_token_for_appservice_cli_async(
self, code, state, custom_headers=None, raw=False, **operation_config):
"""Exchange code for GitHub access token for AppService CLI.

Description for Exchange code for GitHub access token for AppService
CLI.

:param code: Code string to exchange for Github Access token
:type code: str
:param state: State string used for verification.
:type state: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: AppserviceGithubToken or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.web.v2019_08_01.models.AppserviceGithubToken or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`DefaultErrorResponseException<azure.mgmt.web.v2019_08_01.models.DefaultErrorResponseException>`
"""
request = models.AppserviceGithubTokenRequest(code=code, state=state)

# Construct URL
url = self.generate_github_access_token_for_appservice_cli_async.metadata['url']

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct body
body_content = self._serialize.body(request, 'AppserviceGithubTokenRequest')

# Construct and send request
request = self._client.post(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.DefaultErrorResponseException(self._deserialize, response)

deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('AppserviceGithubToken', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
generate_github_access_token_for_appservice_cli_async.metadata = {'url': '/providers/Microsoft.Web/generateGithubAccessTokenForAppserviceCLI'}

def get_publishing_user(
self, custom_headers=None, raw=False, **operation_config):
"""Gets publishing user.
Expand Down