Skip to content

Commit

Permalink
Generated from 82cee8e19ad81e9d82d712cfabad1649b91b619a
Browse files Browse the repository at this point in the history
Merge pull request #1 from omarelhariry/a-moghan/PublishingResponses

Adding Publishing To Regions Status
  • Loading branch information
AutorestCI committed Nov 25, 2018
1 parent 4b2d3e9 commit 213691e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class EndpointInfo(Model):
:type assigned_endpoint_key: str
:param endpoint_region: The endpoint's region.
:type endpoint_region: str
:param failed_regions: Regions where publishing failed.
:type failed_regions: str
:param published_date_time: Timestamp when was last published.
:type published_date_time: str
"""
Expand All @@ -39,6 +41,7 @@ class EndpointInfo(Model):
'region': {'key': 'region', 'type': 'str'},
'assigned_endpoint_key': {'key': 'assignedEndpointKey', 'type': 'str'},
'endpoint_region': {'key': 'endpointRegion', 'type': 'str'},
'failed_regions': {'key': 'failedRegions', 'type': 'str'},
'published_date_time': {'key': 'publishedDateTime', 'type': 'str'},
}

Expand All @@ -50,4 +53,5 @@ def __init__(self, **kwargs):
self.region = kwargs.get('region', None)
self.assigned_endpoint_key = kwargs.get('assigned_endpoint_key', None)
self.endpoint_region = kwargs.get('endpoint_region', None)
self.failed_regions = kwargs.get('failed_regions', None)
self.published_date_time = kwargs.get('published_date_time', None)
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class EndpointInfo(Model):
:type assigned_endpoint_key: str
:param endpoint_region: The endpoint's region.
:type endpoint_region: str
:param failed_regions: Regions where publishing failed.
:type failed_regions: str
:param published_date_time: Timestamp when was last published.
:type published_date_time: str
"""
Expand All @@ -39,15 +41,17 @@ class EndpointInfo(Model):
'region': {'key': 'region', 'type': 'str'},
'assigned_endpoint_key': {'key': 'assignedEndpointKey', 'type': 'str'},
'endpoint_region': {'key': 'endpointRegion', 'type': 'str'},
'failed_regions': {'key': 'failedRegions', 'type': 'str'},
'published_date_time': {'key': 'publishedDateTime', 'type': 'str'},
}

def __init__(self, *, version_id: str=None, is_staging: bool=None, endpoint_url: str=None, region: str=None, assigned_endpoint_key: str=None, endpoint_region: str=None, published_date_time: str=None, **kwargs) -> None:
def __init__(self, *, version_id: str=None, is_staging: bool=None, endpoint_url: str=None, region: str=None, assigned_endpoint_key: str=None, endpoint_region: str=None, failed_regions: str=None, published_date_time: str=None, **kwargs) -> None:
super(EndpointInfo, self).__init__(**kwargs)
self.version_id = version_id
self.is_staging = is_staging
self.endpoint_url = endpoint_url
self.region = region
self.assigned_endpoint_key = assigned_endpoint_key
self.endpoint_region = endpoint_region
self.failed_regions = failed_regions
self.published_date_time = published_date_time
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class ProductionOrStagingEndpointInfo(EndpointInfo):
:type assigned_endpoint_key: str
:param endpoint_region: The endpoint's region.
:type endpoint_region: str
:param failed_regions: Regions where publishing failed.
:type failed_regions: str
:param published_date_time: Timestamp when was last published.
:type published_date_time: str
"""
Expand All @@ -39,6 +41,7 @@ class ProductionOrStagingEndpointInfo(EndpointInfo):
'region': {'key': 'region', 'type': 'str'},
'assigned_endpoint_key': {'key': 'assignedEndpointKey', 'type': 'str'},
'endpoint_region': {'key': 'endpointRegion', 'type': 'str'},
'failed_regions': {'key': 'failedRegions', 'type': 'str'},
'published_date_time': {'key': 'publishedDateTime', 'type': 'str'},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class ProductionOrStagingEndpointInfo(EndpointInfo):
:type assigned_endpoint_key: str
:param endpoint_region: The endpoint's region.
:type endpoint_region: str
:param failed_regions: Regions where publishing failed.
:type failed_regions: str
:param published_date_time: Timestamp when was last published.
:type published_date_time: str
"""
Expand All @@ -39,8 +41,9 @@ class ProductionOrStagingEndpointInfo(EndpointInfo):
'region': {'key': 'region', 'type': 'str'},
'assigned_endpoint_key': {'key': 'assignedEndpointKey', 'type': 'str'},
'endpoint_region': {'key': 'endpointRegion', 'type': 'str'},
'failed_regions': {'key': 'failedRegions', 'type': 'str'},
'published_date_time': {'key': 'publishedDateTime', 'type': 'str'},
}

def __init__(self, *, version_id: str=None, is_staging: bool=None, endpoint_url: str=None, region: str=None, assigned_endpoint_key: str=None, endpoint_region: str=None, published_date_time: str=None, **kwargs) -> None:
super(ProductionOrStagingEndpointInfo, self).__init__(version_id=version_id, is_staging=is_staging, endpoint_url=endpoint_url, region=region, assigned_endpoint_key=assigned_endpoint_key, endpoint_region=endpoint_region, published_date_time=published_date_time, **kwargs)
def __init__(self, *, version_id: str=None, is_staging: bool=None, endpoint_url: str=None, region: str=None, assigned_endpoint_key: str=None, endpoint_region: str=None, failed_regions: str=None, published_date_time: str=None, **kwargs) -> None:
super(ProductionOrStagingEndpointInfo, self).__init__(version_id=version_id, is_staging=is_staging, endpoint_url=endpoint_url, region=region, assigned_endpoint_key=assigned_endpoint_key, endpoint_region=endpoint_region, failed_regions=failed_regions, published_date_time=published_date_time, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,8 @@ def publish(
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: ProductionOrStagingEndpointInfo or ClientRawResponse if
raw=true
:rtype:
~azure.cognitiveservices.language.luis.authoring.models.ProductionOrStagingEndpointInfo
or ~msrest.pipeline.ClientRawResponse
:return: object or ClientRawResponse if raw=true
:rtype: object or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
"""
Expand Down Expand Up @@ -696,13 +693,17 @@ def publish(
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 [201]:
if response.status_code not in [201, 207, 503]:
raise models.ErrorResponseException(self._deserialize, response)

deserialized = None

if response.status_code == 201:
deserialized = self._deserialize('ProductionOrStagingEndpointInfo', response)
if response.status_code == 207:
deserialized = self._deserialize('ProductionOrStagingEndpointInfo', response)
if response.status_code == 503:
deserialized = self._deserialize('str', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
Expand Down

0 comments on commit 213691e

Please sign in to comment.