Microsoft.Azure.Commands.ApiManagement.Models.ApiManagementLongRunningOperation.CreateLongRunningOperation C# (CSharp) Method

CreateLongRunningOperation() static private method

static private CreateLongRunningOperation ( string operationName, Microsoft.Azure.Management.ApiManagement.Models.LongRunningOperationResponse longRunningResponse ) : ApiManagementLongRunningOperation
operationName string
longRunningResponse Microsoft.Azure.Management.ApiManagement.Models.LongRunningOperationResponse
return ApiManagementLongRunningOperation
        internal static ApiManagementLongRunningOperation CreateLongRunningOperation(
            string operationName,
            LongRunningOperationResponse longRunningResponse)
        {
            if (string.IsNullOrWhiteSpace(operationName))
            {
                throw new ArgumentNullException("operationName");
            }

            if (longRunningResponse == null)
            {
                throw new ArgumentNullException("longRunningResponse");
            }

            var result = new ApiManagementLongRunningOperation
            {
                OperationName = operationName,
                OperationLink = longRunningResponse.OperationStatusLink,
                RetryAfter = TimeSpan.FromSeconds(longRunningResponse.RetryAfter),
                Status = longRunningResponse.Status,
                Error = longRunningResponse.Error != null
                    ? longRunningResponse.Error.Message
                    : null
            };

            var apiServiceLongRunningResponse = longRunningResponse as ApiServiceLongRunningOperationResponse;
            if (apiServiceLongRunningResponse != null && apiServiceLongRunningResponse.Value != null)
            {
                result.ApiManagement = new PsApiManagement(apiServiceLongRunningResponse.Value);
            }

            return result;
        }