Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR monitor/resource-manager] [Monitor] Fix issue #3585: revert previous commit since it is a brealing change #3084

Merged
Merged
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: 2 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
ComparisonOperationType,
ScaleDirection,
ScaleType,
RecurrenceFrequency,
ConditionOperator,
TimeAggregationOperator,
CategoryType,
Expand Down Expand Up @@ -350,6 +351,7 @@
'ComparisonOperationType',
'ScaleDirection',
'ScaleType',
'RecurrenceFrequency',
'ConditionOperator',
'TimeAggregationOperator',
'CategoryType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ class ScaleType(str, Enum):
exact_count = "ExactCount"


class RecurrenceFrequency(str, Enum):

none = "None"
second = "Second"
minute = "Minute"
hour = "Hour"
day = "Day"
week = "Week"
month = "Month"
year = "Year"


class ConditionOperator(str, Enum):

greater_than = "GreaterThan"
Expand Down
19 changes: 8 additions & 11 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,32 @@ class Recurrence(Model):
"""The repeating times at which this profile begins. This element is not used
if the FixedDate element is used.

Variables are only populated by the server, and will be ignored when
sending a request.

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

:ivar frequency: Required. the recurrence frequency. How often the
:param frequency: Required. the recurrence frequency. How often the
schedule profile should take effect. This value must be Week, meaning each
week will have the same set of profiles. For example, to set a daily
schedule, set **schedule** to every day of the week. The frequency
property specifies that the schedule is repeated weekly. Default value:
"Week" .
:vartype frequency: str
property specifies that the schedule is repeated weekly. Possible values
include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month',
'Year'
:type frequency: str or ~azure.mgmt.monitor.models.RecurrenceFrequency
:param schedule: Required. the scheduling constraints for when the profile
begins.
:type schedule: ~azure.mgmt.monitor.models.RecurrentSchedule
"""

_validation = {
'frequency': {'required': True, 'constant': True},
'frequency': {'required': True},
'schedule': {'required': True},
}

_attribute_map = {
'frequency': {'key': 'frequency', 'type': 'str'},
'frequency': {'key': 'frequency', 'type': 'RecurrenceFrequency'},
'schedule': {'key': 'schedule', 'type': 'RecurrentSchedule'},
}

frequency = "Week"

def __init__(self, **kwargs):
super(Recurrence, self).__init__(**kwargs)
self.frequency = kwargs.get('frequency', None)
self.schedule = kwargs.get('schedule', None)
21 changes: 9 additions & 12 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/recurrence_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,32 @@ class Recurrence(Model):
"""The repeating times at which this profile begins. This element is not used
if the FixedDate element is used.

Variables are only populated by the server, and will be ignored when
sending a request.

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

:ivar frequency: Required. the recurrence frequency. How often the
:param frequency: Required. the recurrence frequency. How often the
schedule profile should take effect. This value must be Week, meaning each
week will have the same set of profiles. For example, to set a daily
schedule, set **schedule** to every day of the week. The frequency
property specifies that the schedule is repeated weekly. Default value:
"Week" .
:vartype frequency: str
property specifies that the schedule is repeated weekly. Possible values
include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month',
'Year'
:type frequency: str or ~azure.mgmt.monitor.models.RecurrenceFrequency
:param schedule: Required. the scheduling constraints for when the profile
begins.
:type schedule: ~azure.mgmt.monitor.models.RecurrentSchedule
"""

_validation = {
'frequency': {'required': True, 'constant': True},
'frequency': {'required': True},
'schedule': {'required': True},
}

_attribute_map = {
'frequency': {'key': 'frequency', 'type': 'str'},
'frequency': {'key': 'frequency', 'type': 'RecurrenceFrequency'},
'schedule': {'key': 'schedule', 'type': 'RecurrentSchedule'},
}

frequency = "Week"

def __init__(self, *, schedule, **kwargs) -> None:
def __init__(self, *, frequency, schedule, **kwargs) -> None:
super(Recurrence, self).__init__(**kwargs)
self.frequency = frequency
self.schedule = schedule
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def create_or_update(

# 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())
Expand All @@ -84,9 +85,8 @@ def create_or_update(
body_content = self._serialize.body(action_group, 'ActionGroupResource')

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

if response.status_code not in [200, 201]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -139,7 +139,7 @@ def get(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -148,8 +148,8 @@ def get(
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)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
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]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -199,7 +199,6 @@ def delete(

# Construct headers
header_parameters = {}
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:
Expand All @@ -208,8 +207,8 @@ def delete(
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

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

if response.status_code not in [200, 204]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -262,6 +261,7 @@ def update(

# 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())
Expand All @@ -274,9 +274,8 @@ def update(
body_content = self._serialize.body(action_group_patch, 'ActionGroupPatchBody')

# Construct and send request
request = self._client.patch(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
request = self._client.patch(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.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -328,7 +327,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -337,9 +336,8 @@ def internal_paging(next_link=None, raw=False):
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)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)
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]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -395,7 +393,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -404,9 +402,8 @@ def internal_paging(next_link=None, raw=False):
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)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)
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]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -475,9 +472,8 @@ def enable_receiver(
body_content = self._serialize.body(enable_request, 'EnableRequest')

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
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, 409]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def create_or_update(

# 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())
Expand All @@ -86,9 +87,8 @@ def create_or_update(
body_content = self._serialize.body(activity_log_alert, 'ActivityLogAlertResource')

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

if response.status_code not in [200, 201]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -141,7 +141,7 @@ def get(

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -150,8 +150,8 @@ def get(
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)
response = self._client.send(request, header_parameters, stream=False, **operation_config)
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]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -201,7 +201,6 @@ def delete(

# Construct headers
header_parameters = {}
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:
Expand All @@ -210,8 +209,8 @@ def delete(
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

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

if response.status_code not in [200, 204]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -264,6 +263,7 @@ def update(

# 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())
Expand All @@ -276,9 +276,8 @@ def update(
body_content = self._serialize.body(activity_log_alert_patch, 'ActivityLogAlertPatchBody')

# Construct and send request
request = self._client.patch(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, stream=False, **operation_config)
request = self._client.patch(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.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -330,7 +329,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -339,9 +338,8 @@ def internal_paging(next_link=None, raw=False):
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)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)
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]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down Expand Up @@ -397,7 +395,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -406,9 +404,8 @@ def internal_paging(next_link=None, raw=False):
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)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)
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]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def internal_paging(next_link=None, raw=False):

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
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:
Expand All @@ -112,9 +112,8 @@ def internal_paging(next_link=None, raw=False):
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)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)
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]:
raise models.ErrorResponseException(self._deserialize, response)
Expand Down
Loading