Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .feature_client import FeatureClient
from .version import VERSION

__all__ = ['FeatureClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
import uuid
from .operations.features_operations import FeaturesOperations
from . import models


class FeatureClientConfiguration(AzureConfiguration):
"""Configuration for FeatureClient
Note that all parameters used to create this instance are saved as instance
attributes.

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(FeatureClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-mgmt-resource/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class FeatureClient(SDKClient):
"""Azure Feature Exposure Control (AFEC) provides a mechanism for the resource providers to control feature exposure to users. Resource providers typically use this mechanism to provide public/private preview for new features prior to making them generally available. Users need to explicitly register for AFEC features to get access to such functionality.

:ivar config: Configuration for client.
:vartype config: FeatureClientConfiguration

:ivar features: Features operations
:vartype features: azure.mgmt.resource.features.v2015_12_01.operations.FeaturesOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

self.config = FeatureClientConfiguration(credentials, subscription_id, base_url)
super(FeatureClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2015-12-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.features = FeaturesOperations(
self._client, self.config, self._serialize, self._deserialize)

def list_operations(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available Microsoft.Features REST API operations.

: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: An iterator like instance of Operation
:rtype:
~azure.mgmt.resource.features.v2015_12_01.models.OperationPaged[~azure.mgmt.resource.features.v2015_12_01.models.Operation]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_operations.metadata['url']

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

else:
url = next_link
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
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 and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

return response

# Deserialize response
deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies)

if raw:
header_dict = {}
client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response

return deserialized
list_operations.metadata = {'url': '/providers/Microsoft.Features/operations'}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

try:
from .feature_properties_py3 import FeatureProperties
from .feature_result_py3 import FeatureResult
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
except (SyntaxError, ImportError):
from .feature_properties import FeatureProperties
from .feature_result import FeatureResult
from .operation_display import OperationDisplay
from .operation import Operation
from .operation_paged import OperationPaged
from .feature_result_paged import FeatureResultPaged

__all__ = [
'FeatureProperties',
'FeatureResult',
'OperationDisplay',
'Operation',
'OperationPaged',
'FeatureResultPaged',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class FeatureProperties(Model):
"""Information about feature.

:param state: The registration state of the feature for the subscription.
:type state: str
"""

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

def __init__(self, **kwargs):
super(FeatureProperties, self).__init__(**kwargs)
self.state = kwargs.get('state', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class FeatureProperties(Model):
"""Information about feature.

:param state: The registration state of the feature for the subscription.
:type state: str
"""

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

def __init__(self, *, state: str=None, **kwargs) -> None:
super(FeatureProperties, self).__init__(**kwargs)
self.state = state
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class FeatureResult(Model):
"""Previewed feature information.

:param name: The name of the feature.
:type name: str
:param properties: Properties of the previewed feature.
:type properties:
~azure.mgmt.resource.features.v2015_12_01.models.FeatureProperties
:param id: The resource ID of the feature.
:type id: str
:param type: The resource type of the feature.
:type type: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'FeatureProperties'},
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}

def __init__(self, **kwargs):
super(FeatureResult, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.properties = kwargs.get('properties', None)
self.id = kwargs.get('id', None)
self.type = kwargs.get('type', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.paging import Paged


class FeatureResultPaged(Paged):
"""
A paging container for iterating over a list of :class:`FeatureResult <azure.mgmt.resource.features.v2015_12_01.models.FeatureResult>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[FeatureResult]'}
}

def __init__(self, *args, **kwargs):

super(FeatureResultPaged, self).__init__(*args, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class FeatureResult(Model):
"""Previewed feature information.

:param name: The name of the feature.
:type name: str
:param properties: Properties of the previewed feature.
:type properties:
~azure.mgmt.resource.features.v2015_12_01.models.FeatureProperties
:param id: The resource ID of the feature.
:type id: str
:param type: The resource type of the feature.
:type type: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'FeatureProperties'},
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}

def __init__(self, *, name: str=None, properties=None, id: str=None, type: str=None, **kwargs) -> None:
super(FeatureResult, self).__init__(**kwargs)
self.name = name
self.properties = properties
self.id = id
self.type = type
Loading