Skip to content

Commit

Permalink
Generated from 1b9b098a5d61cbc372acb108a29c29328a4120b2 (#4219)
Browse files Browse the repository at this point in the history
Resolve comments.
  • Loading branch information
AutorestCI authored Jan 22, 2019
1 parent 7105cb6 commit 3b98e82
Show file tree
Hide file tree
Showing 16 changed files with 1,152 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .operations.large_person_group_person_operations import LargePersonGroupPersonOperations
from .operations.large_person_group_operations import LargePersonGroupOperations
from .operations.large_face_list_operations import LargeFaceListOperations
from .operations.snapshot_operations import SnapshotOperations
from . import models


Expand Down Expand Up @@ -72,6 +73,8 @@ class FaceClient(SDKClient):
:vartype large_person_group: azure.cognitiveservices.vision.face.operations.LargePersonGroupOperations
:ivar large_face_list: LargeFaceList operations
:vartype large_face_list: azure.cognitiveservices.vision.face.operations.LargeFaceListOperations
:ivar snapshot: Snapshot operations
:vartype snapshot: azure.cognitiveservices.vision.face.operations.SnapshotOperations
:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus.api.cognitive.microsoft.com).
Expand Down Expand Up @@ -106,3 +109,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.large_face_list = LargeFaceListOperations(
self._client, self.config, self._serialize, self._deserialize)
self.snapshot = SnapshotOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
from .update_face_request_py3 import UpdateFaceRequest
from .training_status_py3 import TrainingStatus
from .name_and_user_data_contract_py3 import NameAndUserDataContract
from .apply_snapshot_request_py3 import ApplySnapshotRequest
from .snapshot_py3 import Snapshot
from .take_snapshot_request_py3 import TakeSnapshotRequest
from .update_snapshot_request_py3 import UpdateSnapshotRequest
from .operation_status_py3 import OperationStatus
from .image_url_py3 import ImageUrl
except (SyntaxError, ImportError):
from .error import Error
Expand Down Expand Up @@ -86,6 +91,11 @@
from .update_face_request import UpdateFaceRequest
from .training_status import TrainingStatus
from .name_and_user_data_contract import NameAndUserDataContract
from .apply_snapshot_request import ApplySnapshotRequest
from .snapshot import Snapshot
from .take_snapshot_request import TakeSnapshotRequest
from .update_snapshot_request import UpdateSnapshotRequest
from .operation_status import OperationStatus
from .image_url import ImageUrl
from .face_client_enums import (
Gender,
Expand All @@ -97,6 +107,9 @@
NoiseLevel,
FindSimilarMatchMode,
TrainingStatusType,
SnapshotApplyMode,
SnapshotObjectType,
OperationStatusType,
FaceAttributeType,
)

Expand Down Expand Up @@ -138,6 +151,11 @@
'UpdateFaceRequest',
'TrainingStatus',
'NameAndUserDataContract',
'ApplySnapshotRequest',
'Snapshot',
'TakeSnapshotRequest',
'UpdateSnapshotRequest',
'OperationStatus',
'ImageUrl',
'Gender',
'GlassesType',
Expand All @@ -148,5 +166,8 @@
'NoiseLevel',
'FindSimilarMatchMode',
'TrainingStatusType',
'SnapshotApplyMode',
'SnapshotObjectType',
'OperationStatusType',
'FaceAttributeType',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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 ApplySnapshotRequest(Model):
"""Request body for applying snapshot operation.
All required parameters must be populated in order to send to Azure.
:param object_id: Required. User specified target object id to be created
from the snapshot.
:type object_id: str
:param mode: Snapshot applying mode. Currently only CreateNew is
supported, which means the apply operation will fail if target
subscription already contains an object of same type and using the same
objectId. Users can specify the "objectId" in request body to avoid such
conflicts. Possible values include: 'CreateNew'. Default value:
"CreateNew" .
:type mode: str or
~azure.cognitiveservices.vision.face.models.SnapshotApplyMode
"""

_validation = {
'object_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'},
}

_attribute_map = {
'object_id': {'key': 'objectId', 'type': 'str'},
'mode': {'key': 'mode', 'type': 'SnapshotApplyMode'},
}

def __init__(self, **kwargs):
super(ApplySnapshotRequest, self).__init__(**kwargs)
self.object_id = kwargs.get('object_id', None)
self.mode = kwargs.get('mode', "CreateNew")
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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 ApplySnapshotRequest(Model):
"""Request body for applying snapshot operation.
All required parameters must be populated in order to send to Azure.
:param object_id: Required. User specified target object id to be created
from the snapshot.
:type object_id: str
:param mode: Snapshot applying mode. Currently only CreateNew is
supported, which means the apply operation will fail if target
subscription already contains an object of same type and using the same
objectId. Users can specify the "objectId" in request body to avoid such
conflicts. Possible values include: 'CreateNew'. Default value:
"CreateNew" .
:type mode: str or
~azure.cognitiveservices.vision.face.models.SnapshotApplyMode
"""

_validation = {
'object_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'},
}

_attribute_map = {
'object_id': {'key': 'objectId', 'type': 'str'},
'mode': {'key': 'mode', 'type': 'SnapshotApplyMode'},
}

def __init__(self, *, object_id: str, mode="CreateNew", **kwargs) -> None:
super(ApplySnapshotRequest, self).__init__(**kwargs)
self.object_id = object_id
self.mode = mode
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ class TrainingStatusType(str, Enum):
failed = "failed"


class SnapshotApplyMode(str, Enum):

create_new = "CreateNew"


class SnapshotObjectType(str, Enum):

face_list = "FaceList"
large_face_list = "LargeFaceList"
large_person_group = "LargePersonGroup"
person_group = "PersonGroup"


class OperationStatusType(str, Enum):

notstarted = "notstarted"
running = "running"
succeeded = "succeeded"
failed = "failed"


class FaceAttributeType(str, Enum):

age = "age"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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 OperationStatus(Model):
"""Operation status object. Operation refers to the asynchronous backend task
including taking a snapshot and applying a snapshot.
All required parameters must be populated in order to send to Azure.
:param status: Required. Operation status: notstarted, running, succeeded,
failed. If the operation is requested and waiting to perform, the status
is notstarted. If the operation is ongoing in backend, the status is
running. Status succeeded means the operation is completed successfully,
specifically for snapshot taking operation, it illustrates the snapshot is
well taken and ready to apply, and for snapshot applying operation, it
presents the target object has finished creating by the snapshot and ready
to be used. Status failed is often caused by editing the source object
while taking the snapshot or editing the target object while applying the
snapshot before completion, see the field "message" to check the failure
reason. Possible values include: 'notstarted', 'running', 'succeeded',
'failed'
:type status: str or
~azure.cognitiveservices.vision.face.models.OperationStatusType
:param created_time: Required. A combined UTC date and time string that
describes the time when the operation (take or apply a snapshot) is
requested. E.g. 2018-12-25T11:41:02.2331413Z.
:type created_time: datetime
:param last_action_time: A combined UTC date and time string that
describes the last time the operation (take or apply a snapshot) is
actively migrating data. The lastActionTime will keep increasing until the
operation finishes. E.g. 2018-12-25T11:51:27.8705696Z.
:type last_action_time: datetime
:param resource_location: When the operation succeeds successfully, for
snapshot taking operation the snapshot id will be included in this field,
and for snapshot applying operation, the path to get the target object
will be returned in this field.
:type resource_location: str
:param message: Show failure message when operation fails (omitted when
operation succeeds).
:type message: str
"""

_validation = {
'status': {'required': True},
'created_time': {'required': True},
}

_attribute_map = {
'status': {'key': 'status', 'type': 'OperationStatusType'},
'created_time': {'key': 'createdTime', 'type': 'iso-8601'},
'last_action_time': {'key': 'lastActionTime', 'type': 'iso-8601'},
'resource_location': {'key': 'resourceLocation', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, **kwargs):
super(OperationStatus, self).__init__(**kwargs)
self.status = kwargs.get('status', None)
self.created_time = kwargs.get('created_time', None)
self.last_action_time = kwargs.get('last_action_time', None)
self.resource_location = kwargs.get('resource_location', None)
self.message = kwargs.get('message', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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 OperationStatus(Model):
"""Operation status object. Operation refers to the asynchronous backend task
including taking a snapshot and applying a snapshot.
All required parameters must be populated in order to send to Azure.
:param status: Required. Operation status: notstarted, running, succeeded,
failed. If the operation is requested and waiting to perform, the status
is notstarted. If the operation is ongoing in backend, the status is
running. Status succeeded means the operation is completed successfully,
specifically for snapshot taking operation, it illustrates the snapshot is
well taken and ready to apply, and for snapshot applying operation, it
presents the target object has finished creating by the snapshot and ready
to be used. Status failed is often caused by editing the source object
while taking the snapshot or editing the target object while applying the
snapshot before completion, see the field "message" to check the failure
reason. Possible values include: 'notstarted', 'running', 'succeeded',
'failed'
:type status: str or
~azure.cognitiveservices.vision.face.models.OperationStatusType
:param created_time: Required. A combined UTC date and time string that
describes the time when the operation (take or apply a snapshot) is
requested. E.g. 2018-12-25T11:41:02.2331413Z.
:type created_time: datetime
:param last_action_time: A combined UTC date and time string that
describes the last time the operation (take or apply a snapshot) is
actively migrating data. The lastActionTime will keep increasing until the
operation finishes. E.g. 2018-12-25T11:51:27.8705696Z.
:type last_action_time: datetime
:param resource_location: When the operation succeeds successfully, for
snapshot taking operation the snapshot id will be included in this field,
and for snapshot applying operation, the path to get the target object
will be returned in this field.
:type resource_location: str
:param message: Show failure message when operation fails (omitted when
operation succeeds).
:type message: str
"""

_validation = {
'status': {'required': True},
'created_time': {'required': True},
}

_attribute_map = {
'status': {'key': 'status', 'type': 'OperationStatusType'},
'created_time': {'key': 'createdTime', 'type': 'iso-8601'},
'last_action_time': {'key': 'lastActionTime', 'type': 'iso-8601'},
'resource_location': {'key': 'resourceLocation', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, *, status, created_time, last_action_time=None, resource_location: str=None, message: str=None, **kwargs) -> None:
super(OperationStatus, self).__init__(**kwargs)
self.status = status
self.created_time = created_time
self.last_action_time = last_action_time
self.resource_location = resource_location
self.message = message
Loading

0 comments on commit 3b98e82

Please sign in to comment.