azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/snapshot_operations.py
def apply(
            self, snapshot_id, object_id, mode="CreateNew", custom_headers=None, raw=False, **operation_config):
        """Submit an operation to apply a snapshot to current subscription. For
        each snapshot, only subscriptions included in the applyScope of
        Snapshot - Take can apply it.<br />
        The snapshot interfaces are for users to backup and restore their face
        data from one face subscription to another, inside same region or
        across regions. The workflow contains two phases, user first calls
        Snapshot - Take to create a copy of the source object and store it as a
        snapshot, then calls Snapshot - Apply to paste the snapshot to target
        subscription. The snapshots are stored in a centralized location (per
        Azure instance), so that they can be applied cross accounts and
        regions.<br />
        Applying snapshot is an asynchronous operation. An operation id can be
        obtained from the "Operation-Location" field in response header, to be
        used in OperationStatus - Get for tracking the progress of applying the
        snapshot. The target object id will be included in the
        "resourceLocation" field in OperationStatus - Get response when the
        operation status is "succeeded".<br />
        Snapshot applying time depends on the number of person and face entries
        in the snapshot object. It could be in seconds, or up to 1 hour for
        1,000,000 persons with multiple faces.<br />
        Snapshots will be automatically expired and cleaned in 48 hours after
        it is created by Snapshot - Take. So the target subscription is
        required to apply the snapshot in 48 hours since its creation.<br />
        Applying a snapshot will not block any other operations against the
        target object, however it is not recommended because the correctness
        cannot be guaranteed during snapshot applying. After snapshot applying
        is completed, all operations towards the target object can work as
        normal. Snapshot also includes the training results of the source
        object, which means target subscription the snapshot applied to does
        not need re-train the target object before calling
        Identify/FindSimilar.<br />
        One snapshot can be applied multiple times in parallel, while currently
        only CreateNew apply mode 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.<br />
        * Free-tier subscription quota: 100 apply operations per month.
        * S0-tier subscription quota: 100 apply operations per day.

        :param snapshot_id: Id referencing a particular snapshot.
        :type snapshot_id: str
        :param object_id: 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'
        :type mode: str or
         ~azure.cognitiveservices.vision.face.models.SnapshotApplyMode
        :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: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`
        """
        body = models.ApplySnapshotRequest(object_id=object_id, mode=mode)

        # Construct URL
        url = self.apply.metadata['url']
        path_format_arguments = {
            'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
            'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(body, 'ApplySnapshotRequest')

        # 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 [202]:
            raise models.APIErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'Operation-Location': 'str',
            })
            return client_raw_response
def apply(
            self, snapshot_id, object_id, mode="CreateNew", custom_headers=None, raw=False, **operation_config):
        """Submit an operation to apply a snapshot to current subscription. For
        each snapshot, only subscriptions included in the applyScope of
        Snapshot - Take can apply it.<br />
        The snapshot interfaces are for users to backup and restore their face
        data from one face subscription to another, inside same region or
        across regions. The workflow contains two phases, user first calls
        Snapshot - Take to create a copy of the source object and store it as a
        snapshot, then calls Snapshot - Apply to paste the snapshot to target
        subscription. The snapshots are stored in a centralized location (per
        Azure instance), so that they can be applied cross accounts and
        regions.<br />
        Applying snapshot is an asynchronous operation. An operation id can be
        obtained from the "Operation-Location" field in response header, to be
        used in OperationStatus - Get for tracking the progress of applying the
        snapshot. The target object id will be included in the
        "resourceLocation" field in OperationStatus - Get response when the
        operation status is "succeeded".<br />
        Snapshot applying time depends on the number of person and face entries
        in the snapshot object. It could be in seconds, or up to 1 hour for
        1,000,000 persons with multiple faces.<br />
        Snapshots will be automatically expired and cleaned in 48 hours after
        it is created by Snapshot - Take. So the target subscription is
        required to apply the snapshot in 48 hours since its creation.<br />
        Applying a snapshot will not block any other operations against the
        target object, however it is not recommended because the correctness
        cannot be guaranteed during snapshot applying. After snapshot applying
        is completed, all operations towards the target object can work as
        normal. Snapshot also includes the training results of the source
        object, which means target subscription the snapshot applied to does
        not need re-train the target object before calling
        Identify/FindSimilar.<br />
        One snapshot can be applied multiple times in parallel, while currently
        only CreateNew apply mode 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.<br />
        * Free-tier subscription quota: 100 apply operations per month.
        * S0-tier subscription quota: 100 apply operations per day.

        :param snapshot_id: Id referencing a particular snapshot.
        :type snapshot_id: str
        :param object_id: 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'
        :type mode: str or
         ~azure.cognitiveservices.vision.face.models.SnapshotApplyMode
        :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: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`
        """
        body = models.ApplySnapshotRequest(object_id=object_id, mode=mode)

        # Construct URL
        url = self.apply.metadata['url']
        path_format_arguments = {
            'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
            'snapshotId': self._serialize.url("snapshot_id", snapshot_id, 'str')
        }
        url = self._client.format_url(url, **path_format_arguments)

        # Construct parameters
        query_parameters = {}

        # Construct headers
        header_parameters = {}
        header_parameters['Content-Type'] = 'application/json; charset=utf-8'
        if custom_headers:
            header_parameters.update(custom_headers)

        # Construct body
        body_content = self._serialize.body(body, 'ApplySnapshotRequest')

        # 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 [202]:
            raise models.APIErrorException(self._deserialize, response)

        if raw:
            client_raw_response = ClientRawResponse(None, response)
            client_raw_response.add_headers({
                'Operation-Location': 'str',
            })
            return client_raw_response
Submit an operation to apply a snapshot to current subscription. For
        each snapshot, only subscriptions included in the applyScope of
        Snapshot - Take can apply it.<br />
        The snapshot interfaces are for users to backup and restore their face
        data from one face subscription to another, inside same region or
        across regions. The workflow contains two phases, user first calls
        Snapshot - Take to create a copy of the source object and store it as a
        snapshot, then calls Snapshot - Apply to paste the snapshot to target
        subscription. The snapshots are stored in a centralized location (per
        Azure instance), so that they can be applied cross accounts and
        regions.<br />
        Applying snapshot is an asynchronous operation. An operation id can be
        obtained from the "Operation-Location" field in response header, to be
        used in OperationStatus - Get for tracking the progress of applying the
        snapshot. The target object id will be included in the
        "resourceLocation" field in OperationStatus - Get response when the
        operation status is "succeeded".<br />
        Snapshot applying time depends on the number of person and face entries
        in the snapshot object. It could be in seconds, or up to 1 hour for
        1,000,000 persons with multiple faces.<br />
        Snapshots will be automatically expired and cleaned in 48 hours after
        it is created by Snapshot - Take. So the target subscription is
        required to apply the snapshot in 48 hours since its creation.<br />
        Applying a snapshot will not block any other operations against the
        target object, however it is not recommended because the correctness
        cannot be guaranteed during snapshot applying. After snapshot applying
        is completed, all operations towards the target object can work as
        normal. Snapshot also includes the training results of the source
        object, which means target subscription the snapshot applied to does
        not need re-train the target object before calling
        Identify/FindSimilar.<br />
        One snapshot can be applied multiple times in parallel, while currently
        only CreateNew apply mode 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.<br />
        * Free-tier subscription quota: 100 apply operations per month.
        * S0-tier subscription quota: 100 apply operations per day.

        :param snapshot_id: Id referencing a particular snapshot.
        :type snapshot_id: str
        :param object_id: 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'
        :type mode: str or
         ~azure.cognitiveservices.vision.face.models.SnapshotApplyMode
        :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: None or ClientRawResponse if raw=true
        :rtype: None or ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`APIErrorException<azure.cognitiveservices.vision.face.models.APIErrorException>`