/*
 * Copyright (c) Microsoft Corporation.
 * Licensed under the MIT License.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is regenerated.
 */

import { PrivateLinkScopeOperationStatus } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { MonitorClient } from "../monitorClient";
import {
  PrivateLinkScopeOperationStatusGetOptionalParams,
  PrivateLinkScopeOperationStatusGetResponse
} from "../models";

/** Class containing PrivateLinkScopeOperationStatus operations. */
export class PrivateLinkScopeOperationStatusImpl
  implements PrivateLinkScopeOperationStatus {
  private readonly client: MonitorClient;

  /**
   * Initialize a new instance of the class PrivateLinkScopeOperationStatus class.
   * @param client Reference to the service client
   */
  constructor(client: MonitorClient) {
    this.client = client;
  }

  /**
   * Get the status of an azure asynchronous operation associated with a private link scope operation.
   * @param asyncOperationId The operation Id.
   * @param resourceGroupName The name of the resource group. The name is case insensitive.
   * @param options The options parameters.
   */
  get(
    asyncOperationId: string,
    resourceGroupName: string,
    options?: PrivateLinkScopeOperationStatusGetOptionalParams
  ): Promise<PrivateLinkScopeOperationStatusGetResponse> {
    return this.client.sendOperationRequest(
      { asyncOperationId, resourceGroupName, options },
      getOperationSpec
    );
  }
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);

const getOperationSpec: coreClient.OperationSpec = {
  path:
    "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}",
  httpMethod: "GET",
  responses: {
    200: {
      bodyMapper: Mappers.OperationStatus
    }
  },
  queryParameters: [Parameters.apiVersion10],
  urlParameters: [
    Parameters.$host,
    Parameters.resourceGroupName,
    Parameters.subscriptionId,
    Parameters.asyncOperationId
  ],
  headerParameters: [Parameters.accept],
  serializer
};
