Skip to content

Commit

Permalink
[AutoPR datafactory/resource-manager] [Datafactory] Adding getFeature…
Browse files Browse the repository at this point in the history
…Value API in factory scope (#4813)

* Generated from 2130f16f3b4eac241c8a50566a5dc4498d081f7b

Adding getFeatureValue API in factory scope

* Packaging update of azure-mgmt-datafactory
  • Loading branch information
AutorestCI authored Apr 26, 2019
1 parent 91e8181 commit 56b7a0b
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
from .append_variable_activity_py3 import AppendVariableActivity
from .set_variable_activity_py3 import SetVariableActivity
from .filter_activity_py3 import FilterActivity
from .validation_activity_py3 import ValidationActivity
from .until_activity_py3 import UntilActivity
from .wait_activity_py3 import WaitActivity
from .for_each_activity_py3 import ForEachActivity
Expand Down Expand Up @@ -778,6 +779,7 @@
from .append_variable_activity import AppendVariableActivity
from .set_variable_activity import SetVariableActivity
from .filter_activity import FilterActivity
from .validation_activity import ValidationActivity
from .until_activity import UntilActivity
from .wait_activity import WaitActivity
from .for_each_activity import ForEachActivity
Expand Down Expand Up @@ -1253,6 +1255,7 @@
'AppendVariableActivity',
'SetVariableActivity',
'FilterActivity',
'ValidationActivity',
'UntilActivity',
'WaitActivity',
'ForEachActivity',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class ControlActivity(Activity):
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: WebHookActivity, AppendVariableActivity,
SetVariableActivity, FilterActivity, UntilActivity, WaitActivity,
ForEachActivity, IfConditionActivity, ExecutePipelineActivity
SetVariableActivity, FilterActivity, ValidationActivity, UntilActivity,
WaitActivity, ForEachActivity, IfConditionActivity, ExecutePipelineActivity
All required parameters must be populated in order to send to Azure.
Expand Down Expand Up @@ -52,7 +52,7 @@ class ControlActivity(Activity):
}

_subtype_map = {
'type': {'WebHook': 'WebHookActivity', 'AppendVariable': 'AppendVariableActivity', 'SetVariable': 'SetVariableActivity', 'Filter': 'FilterActivity', 'Until': 'UntilActivity', 'Wait': 'WaitActivity', 'ForEach': 'ForEachActivity', 'IfCondition': 'IfConditionActivity', 'ExecutePipeline': 'ExecutePipelineActivity'}
'type': {'WebHook': 'WebHookActivity', 'AppendVariable': 'AppendVariableActivity', 'SetVariable': 'SetVariableActivity', 'Filter': 'FilterActivity', 'Validation': 'ValidationActivity', 'Until': 'UntilActivity', 'Wait': 'WaitActivity', 'ForEach': 'ForEachActivity', 'IfCondition': 'IfConditionActivity', 'ExecutePipeline': 'ExecutePipelineActivity'}
}

def __init__(self, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class ControlActivity(Activity):
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: WebHookActivity, AppendVariableActivity,
SetVariableActivity, FilterActivity, UntilActivity, WaitActivity,
ForEachActivity, IfConditionActivity, ExecutePipelineActivity
SetVariableActivity, FilterActivity, ValidationActivity, UntilActivity,
WaitActivity, ForEachActivity, IfConditionActivity, ExecutePipelineActivity
All required parameters must be populated in order to send to Azure.
Expand Down Expand Up @@ -52,7 +52,7 @@ class ControlActivity(Activity):
}

_subtype_map = {
'type': {'WebHook': 'WebHookActivity', 'AppendVariable': 'AppendVariableActivity', 'SetVariable': 'SetVariableActivity', 'Filter': 'FilterActivity', 'Until': 'UntilActivity', 'Wait': 'WaitActivity', 'ForEach': 'ForEachActivity', 'IfCondition': 'IfConditionActivity', 'ExecutePipeline': 'ExecutePipelineActivity'}
'type': {'WebHook': 'WebHookActivity', 'AppendVariable': 'AppendVariableActivity', 'SetVariable': 'SetVariableActivity', 'Filter': 'FilterActivity', 'Validation': 'ValidationActivity', 'Until': 'UntilActivity', 'Wait': 'WaitActivity', 'ForEach': 'ForEachActivity', 'IfCondition': 'IfConditionActivity', 'ExecutePipeline': 'ExecutePipelineActivity'}
}

def __init__(self, *, name: str, additional_properties=None, description: str=None, depends_on=None, user_properties=None, **kwargs) -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 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 .control_activity import ControlActivity


class ValidationActivity(ControlActivity):
"""This activity verifies that an external resource exists.
All required parameters must be populated in order to send to Azure.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param name: Required. Activity name.
:type name: str
:param description: Activity description.
:type description: str
:param depends_on: Activity depends on condition.
:type depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency]
:param user_properties: Activity user properties.
:type user_properties: list[~azure.mgmt.datafactory.models.UserProperty]
:param type: Required. Constant filled by server.
:type type: str
:param timeout: Specifies the timeout for the activity to run. If there is
no value specified, it takes the value of TimeSpan.FromDays(7) which is 1
week as default. Type: string (or Expression with resultType string),
pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9])).
:type timeout: object
:param sleep: A delay in seconds between validation attempts. If no value
is specified, 10 seconds will be used as the default. Type: integer (or
Expression with resultType integer).
:type sleep: object
:param minimum_size: Can be used if dataset points to a file. The file
must be greater than or equal in size to the value specified. Type:
integer (or Expression with resultType integer).
:type minimum_size: object
:param child_items: Can be used if dataset points to a folder. If set to
true, the folder must have at least one file. If set to false, the folder
must be empty. Type: boolean (or Expression with resultType boolean).
:type child_items: object
:param dataset: Required. Validation activity dataset reference.
:type dataset: ~azure.mgmt.datafactory.models.DatasetReference
"""

_validation = {
'name': {'required': True},
'type': {'required': True},
'dataset': {'required': True},
}

_attribute_map = {
'additional_properties': {'key': '', 'type': '{object}'},
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
'depends_on': {'key': 'dependsOn', 'type': '[ActivityDependency]'},
'user_properties': {'key': 'userProperties', 'type': '[UserProperty]'},
'type': {'key': 'type', 'type': 'str'},
'timeout': {'key': 'typeProperties.timeout', 'type': 'object'},
'sleep': {'key': 'typeProperties.sleep', 'type': 'object'},
'minimum_size': {'key': 'typeProperties.minimumSize', 'type': 'object'},
'child_items': {'key': 'typeProperties.childItems', 'type': 'object'},
'dataset': {'key': 'typeProperties.dataset', 'type': 'DatasetReference'},
}

def __init__(self, **kwargs):
super(ValidationActivity, self).__init__(**kwargs)
self.timeout = kwargs.get('timeout', None)
self.sleep = kwargs.get('sleep', None)
self.minimum_size = kwargs.get('minimum_size', None)
self.child_items = kwargs.get('child_items', None)
self.dataset = kwargs.get('dataset', None)
self.type = 'Validation'
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 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 .control_activity_py3 import ControlActivity


class ValidationActivity(ControlActivity):
"""This activity verifies that an external resource exists.
All required parameters must be populated in order to send to Azure.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param name: Required. Activity name.
:type name: str
:param description: Activity description.
:type description: str
:param depends_on: Activity depends on condition.
:type depends_on: list[~azure.mgmt.datafactory.models.ActivityDependency]
:param user_properties: Activity user properties.
:type user_properties: list[~azure.mgmt.datafactory.models.UserProperty]
:param type: Required. Constant filled by server.
:type type: str
:param timeout: Specifies the timeout for the activity to run. If there is
no value specified, it takes the value of TimeSpan.FromDays(7) which is 1
week as default. Type: string (or Expression with resultType string),
pattern: ((\\d+)\\.)?(\\d\\d):(60|([0-5][0-9])):(60|([0-5][0-9])).
:type timeout: object
:param sleep: A delay in seconds between validation attempts. If no value
is specified, 10 seconds will be used as the default. Type: integer (or
Expression with resultType integer).
:type sleep: object
:param minimum_size: Can be used if dataset points to a file. The file
must be greater than or equal in size to the value specified. Type:
integer (or Expression with resultType integer).
:type minimum_size: object
:param child_items: Can be used if dataset points to a folder. If set to
true, the folder must have at least one file. If set to false, the folder
must be empty. Type: boolean (or Expression with resultType boolean).
:type child_items: object
:param dataset: Required. Validation activity dataset reference.
:type dataset: ~azure.mgmt.datafactory.models.DatasetReference
"""

_validation = {
'name': {'required': True},
'type': {'required': True},
'dataset': {'required': True},
}

_attribute_map = {
'additional_properties': {'key': '', 'type': '{object}'},
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
'depends_on': {'key': 'dependsOn', 'type': '[ActivityDependency]'},
'user_properties': {'key': 'userProperties', 'type': '[UserProperty]'},
'type': {'key': 'type', 'type': 'str'},
'timeout': {'key': 'typeProperties.timeout', 'type': 'object'},
'sleep': {'key': 'typeProperties.sleep', 'type': 'object'},
'minimum_size': {'key': 'typeProperties.minimumSize', 'type': 'object'},
'child_items': {'key': 'typeProperties.childItems', 'type': 'object'},
'dataset': {'key': 'typeProperties.dataset', 'type': 'DatasetReference'},
}

def __init__(self, *, name: str, dataset, additional_properties=None, description: str=None, depends_on=None, user_properties=None, timeout=None, sleep=None, minimum_size=None, child_items=None, **kwargs) -> None:
super(ValidationActivity, self).__init__(additional_properties=additional_properties, name=name, description=description, depends_on=depends_on, user_properties=user_properties, **kwargs)
self.timeout = timeout
self.sleep = sleep
self.minimum_size = minimum_size
self.child_items = child_items
self.dataset = dataset
self.type = 'Validation'
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,75 @@ def get_feature_value(

return deserialized
get_feature_value.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/getFeatureValue'}

def get_feature_value_by_factory(
self, resource_group_name, factory_name, feature_name=None, feature_type=None, custom_headers=None, raw=False, **operation_config):
"""Get exposure control feature for specific factory.
:param resource_group_name: The resource group name.
:type resource_group_name: str
:param factory_name: The factory name.
:type factory_name: str
:param feature_name: The feature name.
:type feature_name: str
:param feature_type: The feature type.
:type feature_type: 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: ExposureControlResponse or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.datafactory.models.ExposureControlResponse or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
exposure_control_request = models.ExposureControlRequest(feature_name=feature_name, feature_type=feature_type)

# Construct URL
url = self.get_feature_value_by_factory.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'factoryName': self._serialize.url("factory_name", factory_name, 'str', max_length=63, min_length=3, pattern=r'^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$')
}
url = self._client.format_url(url, **path_format_arguments)

# 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(exposure_control_request, 'ExposureControlRequest')

# 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]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None

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

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

return deserialized
get_feature_value_by_factory.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/getFeatureValue'}
1 change: 1 addition & 0 deletions azure-mgmt-datafactory/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
version=version,
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
long_description=readme + '\n\n' + history,
long_description_content_type='text/x-rst',
license='MIT License',
author='Microsoft Corporation',
author_email='azpysdkhelp@microsoft.com',
Expand Down

0 comments on commit 56b7a0b

Please sign in to comment.