/// <summary> /// Generate authorization for copying a custom model into the target Form Recognizer resource. /// </summary> /// <param name="resourceId">Azure Resource Id of the target Form Recognizer resource where the model will be copied to. /// This information can be found in the Properties section of the Form Recognizer resource in the Azure Portal.</param> /// <param name="resourceRegion">Location of the target Form Recognizer resource. /// This information can be found in the Keys and Endpoint section of the Form Recognizer resource in the Azure Portal.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <returns>A <see cref="Response{T}"/> representing the result of the operation. It can be cast to <see cref="CopyAuthorization"/> containing /// the authorization information necessary to copy a custom model into a target Form Recognizer resource.</returns> public virtual async Task <Response <CopyAuthorization> > GetCopyAuthorizationAsync(string resourceId, string resourceRegion, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(resourceId, nameof(resourceId)); Argument.AssertNotNullOrEmpty(resourceRegion, nameof(resourceRegion)); using DiagnosticScope scope = Diagnostics.CreateScope($"{nameof(FormTrainingClient)}.{nameof(GetCopyAuthorization)}"); scope.Start(); try { Response <CopyAuthorizationResult> response = await ServiceClient.GenerateModelCopyAuthorizationAsync(cancellationToken).ConfigureAwait(false); return(Response.FromValue(new CopyAuthorization(response.Value, resourceId, resourceRegion), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }