CodeGuruProfiler - AWS API Codegen

API Documentation | Deno Module Docs | Original docs from AWS-JS-SDK

Customize Generated Module

Only include specific operations:
Include documentation comments:

Example Import

import { CodeGuruProfiler } from "https://aws-api.deno.dev/v0.3/services/codeguruprofiler.ts";


Generated Source (the actual code)

// Generation parameters:
//   aws-sdk-js definitions from v2.1060.0
//   AWS service UID: codeguruprofiler-2019-07-18
//   code generation: v0.3
//   generated at: 2025-08-17

// Originally served at https://aws-api.deno.dev/v0.3/services/codeguruprofiler.ts

// Autogenerated API client for: Amazon CodeGuru Profiler

import * as client from "https://deno.land/x/aws_api@v0.6.0/client/common.ts";
import * as cmnP from "https://deno.land/x/aws_api@v0.6.0/encoding/common.ts";
import * as jsonP from "https://deno.land/x/aws_api@v0.6.0/encoding/json.ts";

export class CodeGuruProfiler {
  #client: client.ServiceClient;
  constructor(apiFactory: client.ApiFactory) {
    this.#client = apiFactory.buildServiceClient(CodeGuruProfiler.ApiMetadata);
  }

  static ApiMetadata: client.ApiMetadata = {
    "apiVersion": "2019-07-18",
    "endpointPrefix": "codeguru-profiler",
    "jsonVersion": "1.1",
    "protocol": "rest-json",
    "serviceFullName": "Amazon CodeGuru Profiler",
    "serviceId": "CodeGuruProfiler",
    "signatureVersion": "v4",
    "signingName": "codeguru-profiler",
    "uid": "codeguruprofiler-2019-07-18"
  };

  /** Add up to 2 anomaly notifications channels for a profiling group. */
  async addNotificationChannels(
    params: AddNotificationChannelsRequest,
    opts: client.RequestOptions = {},
  ): Promise<AddNotificationChannelsResponse> {
    const body: jsonP.JSONObject = {
      channels: params["channels"]?.map(x => fromChannel(x)),
    };
    const resp = await this.#client.performRequest({
      opts, body,
      action: "AddNotificationChannels",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/notificationConfiguration`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {},
      optional: {
        "notificationConfiguration": toNotificationConfiguration,
      },
    }, await resp.json());
  }

  /** Returns the time series of values for a requested list of frame metrics from a time period. */
  async batchGetFrameMetricData(
    params: BatchGetFrameMetricDataRequest,
    opts: client.RequestOptions = {},
  ): Promise<BatchGetFrameMetricDataResponse> {
    const query = new URLSearchParams;
    const body: jsonP.JSONObject = {
      frameMetrics: params["frameMetrics"]?.map(x => fromFrameMetric(x)),
    };
    if (params["endTime"] != null) query.set("endTime", cmnP.serializeDate_iso8601(params["endTime"]) ?? "");
    if (params["period"] != null) query.set("period", params["period"]?.toString() ?? "");
    if (params["startTime"] != null) query.set("startTime", cmnP.serializeDate_iso8601(params["startTime"]) ?? "");
    if (params["targetResolution"] != null) query.set("targetResolution", params["targetResolution"]?.toString() ?? "");
    const resp = await this.#client.performRequest({
      opts, query, body,
      action: "BatchGetFrameMetricData",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/frames/-/metrics`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "endTime": "d",
        "endTimes": [toTimestampStructure],
        "frameMetricData": [toFrameMetricDatum],
        "resolution": (x: jsonP.JSONValue) => cmnP.readEnum<AggregationPeriod>(x),
        "startTime": "d",
        "unprocessedEndTimes": x => jsonP.readMap(String, l => Array.isArray(l) ? l.map(toTimestampStructure) : [], x),
      },
      optional: {},
    }, await resp.json());
  }

  /** Used by profiler agents to report their current state and to receive remote configuration updates. */
  async configureAgent(
    params: ConfigureAgentRequest,
    opts: client.RequestOptions = {},
  ): Promise<ConfigureAgentResponse> {
    const body: jsonP.JSONObject = {
      fleetInstanceId: params["fleetInstanceId"],
      metadata: params["metadata"],
    };
    const resp = await this.#client.performRequest({
      opts, body,
      action: "ConfigureAgent",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/configureAgent`,
      responseCode: 200,
    });
    return {
      configuration: jsonP.readObj({
        required: {
          "periodInSeconds": "n",
          "shouldProfile": "b",
        },
        optional: {
          "agentParameters": x => jsonP.readMap(x => cmnP.readEnumReq<AgentParameterField>(x), String, x),
        },
      }, await resp.json()),
    };
  }

  /** Creates a profiling group. */
  async createProfilingGroup(
    params: CreateProfilingGroupRequest,
    opts: client.RequestOptions = {},
  ): Promise<CreateProfilingGroupResponse> {
    const query = new URLSearchParams;
    const body: jsonP.JSONObject = {
      agentOrchestrationConfig: fromAgentOrchestrationConfig(params["agentOrchestrationConfig"]),
      computePlatform: params["computePlatform"],
      profilingGroupName: params["profilingGroupName"],
      tags: params["tags"],
    };
    query.set("clientToken", params["clientToken"]?.toString() ?? "");
    const resp = await this.#client.performRequest({
      opts, query, body,
      action: "CreateProfilingGroup",
      requestUri: "/profilingGroups",
      responseCode: 201,
    });
    return {
      profilingGroup: toProfilingGroupDescription(await resp.json()),
    };
  }

  /** Deletes a profiling group. */
  async deleteProfilingGroup(
    params: DeleteProfilingGroupRequest,
    opts: client.RequestOptions = {},
  ): Promise<void> {

    const resp = await this.#client.performRequest({
      opts,
      action: "DeleteProfilingGroup",
      method: "DELETE",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}`,
      responseCode: 204,
    });
  }

  /** Returns a [ProfilingGroupDescription](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html) object that contains information about the requested profiling group. */
  async describeProfilingGroup(
    params: DescribeProfilingGroupRequest,
    opts: client.RequestOptions = {},
  ): Promise<DescribeProfilingGroupResponse> {

    const resp = await this.#client.performRequest({
      opts,
      action: "DescribeProfilingGroup",
      method: "GET",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}`,
      responseCode: 200,
    });
    return {
      profilingGroup: toProfilingGroupDescription(await resp.json()),
    };
  }

  /** Returns a list of [FindingsReportSummary](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_FindingsReportSummary.html) objects that contain analysis results for all profiling groups in your AWS account. */
  async getFindingsReportAccountSummary(
    params: GetFindingsReportAccountSummaryRequest = {},
    opts: client.RequestOptions = {},
  ): Promise<GetFindingsReportAccountSummaryResponse> {
    const query = new URLSearchParams;
    if (params["dailyReportsOnly"] != null) query.set("dailyReportsOnly", params["dailyReportsOnly"]?.toString() ?? "");
    if (params["maxResults"] != null) query.set("maxResults", params["maxResults"]?.toString() ?? "");
    if (params["nextToken"] != null) query.set("nextToken", params["nextToken"]?.toString() ?? "");
    const resp = await this.#client.performRequest({
      opts, query,
      action: "GetFindingsReportAccountSummary",
      method: "GET",
      requestUri: "/internal/findingsReports",
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "reportSummaries": [toFindingsReportSummary],
      },
      optional: {
        "nextToken": "s",
      },
    }, await resp.json());
  }

  /** Get the current configuration for anomaly notifications for a profiling group. */
  async getNotificationConfiguration(
    params: GetNotificationConfigurationRequest,
    opts: client.RequestOptions = {},
  ): Promise<GetNotificationConfigurationResponse> {

    const resp = await this.#client.performRequest({
      opts,
      action: "GetNotificationConfiguration",
      method: "GET",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/notificationConfiguration`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "notificationConfiguration": toNotificationConfiguration,
      },
      optional: {},
    }, await resp.json());
  }

  /** Returns the JSON-formatted resource-based policy on a profiling group. */
  async getPolicy(
    params: GetPolicyRequest,
    opts: client.RequestOptions = {},
  ): Promise<GetPolicyResponse> {

    const resp = await this.#client.performRequest({
      opts,
      action: "GetPolicy",
      method: "GET",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/policy`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "policy": "s",
        "revisionId": "s",
      },
      optional: {},
    }, await resp.json());
  }

  /** TODO: Failed to render documentation: unhandled top level doc tag pre */
  async getProfile(
    params: GetProfileRequest,
    opts: client.RequestOptions = {},
  ): Promise<GetProfileResponse> {
    const headers = new Headers;
    const query = new URLSearchParams;
    if (params["accept"] != null) headers.append("Accept", params["accept"]);
    if (params["endTime"] != null) query.set("endTime", cmnP.serializeDate_iso8601(params["endTime"]) ?? "");
    if (params["maxDepth"] != null) query.set("maxDepth", params["maxDepth"]?.toString() ?? "");
    if (params["period"] != null) query.set("period", params["period"]?.toString() ?? "");
    if (params["startTime"] != null) query.set("startTime", cmnP.serializeDate_iso8601(params["startTime"]) ?? "");
    const resp = await this.#client.performRequest({
      opts, headers, query,
      action: "GetProfile",
      method: "GET",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/profile`,
      responseCode: 200,
    });
    return {
      contentEncoding: resp.headers.get("Content-Encoding"),
      contentType: resp.headers.get("Content-Type") ?? "",
      profile: new Uint8Array(await resp.arrayBuffer()),
    };
  }

  /** Returns a list of [Recommendation](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_Recommendation.html) objects that contain recommendations for a profiling group for a given time period. */
  async getRecommendations(
    params: GetRecommendationsRequest,
    opts: client.RequestOptions = {},
  ): Promise<GetRecommendationsResponse> {
    const query = new URLSearchParams;
    query.set("endTime", cmnP.serializeDate_iso8601(params["endTime"]) ?? "");
    if (params["locale"] != null) query.set("locale", params["locale"]?.toString() ?? "");
    query.set("startTime", cmnP.serializeDate_iso8601(params["startTime"]) ?? "");
    const resp = await this.#client.performRequest({
      opts, query,
      action: "GetRecommendations",
      method: "GET",
      requestUri: cmnP.encodePath`/internal/profilingGroups/${params["profilingGroupName"]}/recommendations`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "anomalies": [toAnomaly],
        "profileEndTime": "d",
        "profileStartTime": "d",
        "profilingGroupName": "s",
        "recommendations": [toRecommendation],
      },
      optional: {},
    }, await resp.json());
  }

  /** List the available reports for a given profiling group and time range. */
  async listFindingsReports(
    params: ListFindingsReportsRequest,
    opts: client.RequestOptions = {},
  ): Promise<ListFindingsReportsResponse> {
    const query = new URLSearchParams;
    if (params["dailyReportsOnly"] != null) query.set("dailyReportsOnly", params["dailyReportsOnly"]?.toString() ?? "");
    query.set("endTime", cmnP.serializeDate_iso8601(params["endTime"]) ?? "");
    if (params["maxResults"] != null) query.set("maxResults", params["maxResults"]?.toString() ?? "");
    if (params["nextToken"] != null) query.set("nextToken", params["nextToken"]?.toString() ?? "");
    query.set("startTime", cmnP.serializeDate_iso8601(params["startTime"]) ?? "");
    const resp = await this.#client.performRequest({
      opts, query,
      action: "ListFindingsReports",
      method: "GET",
      requestUri: cmnP.encodePath`/internal/profilingGroups/${params["profilingGroupName"]}/findingsReports`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "findingsReportSummaries": [toFindingsReportSummary],
      },
      optional: {
        "nextToken": "s",
      },
    }, await resp.json());
  }

  /** Lists the start times of the available aggregated profiles of a profiling group for an aggregation period within the specified time range. */
  async listProfileTimes(
    params: ListProfileTimesRequest,
    opts: client.RequestOptions = {},
  ): Promise<ListProfileTimesResponse> {
    const query = new URLSearchParams;
    query.set("endTime", cmnP.serializeDate_iso8601(params["endTime"]) ?? "");
    if (params["maxResults"] != null) query.set("maxResults", params["maxResults"]?.toString() ?? "");
    if (params["nextToken"] != null) query.set("nextToken", params["nextToken"]?.toString() ?? "");
    if (params["orderBy"] != null) query.set("orderBy", params["orderBy"]?.toString() ?? "");
    query.set("period", params["period"]?.toString() ?? "");
    query.set("startTime", cmnP.serializeDate_iso8601(params["startTime"]) ?? "");
    const resp = await this.#client.performRequest({
      opts, query,
      action: "ListProfileTimes",
      method: "GET",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/profileTimes`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "profileTimes": [toProfileTime],
      },
      optional: {
        "nextToken": "s",
      },
    }, await resp.json());
  }

  /** Returns a list of profiling groups. */
  async listProfilingGroups(
    params: ListProfilingGroupsRequest = {},
    opts: client.RequestOptions = {},
  ): Promise<ListProfilingGroupsResponse> {
    const query = new URLSearchParams;
    if (params["includeDescription"] != null) query.set("includeDescription", params["includeDescription"]?.toString() ?? "");
    if (params["maxResults"] != null) query.set("maxResults", params["maxResults"]?.toString() ?? "");
    if (params["nextToken"] != null) query.set("nextToken", params["nextToken"]?.toString() ?? "");
    const resp = await this.#client.performRequest({
      opts, query,
      action: "ListProfilingGroups",
      method: "GET",
      requestUri: "/profilingGroups",
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "profilingGroupNames": ["s"],
      },
      optional: {
        "nextToken": "s",
        "profilingGroups": [toProfilingGroupDescription],
      },
    }, await resp.json());
  }

  /** Returns a list of the tags that are assigned to a specified resource. */
  async listTagsForResource(
    params: ListTagsForResourceRequest,
    opts: client.RequestOptions = {},
  ): Promise<ListTagsForResourceResponse> {

    const resp = await this.#client.performRequest({
      opts,
      action: "ListTagsForResource",
      method: "GET",
      requestUri: cmnP.encodePath`/tags/${params["resourceArn"]}`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {},
      optional: {
        "tags": x => jsonP.readMap(String, String, x),
      },
    }, await resp.json());
  }

  /** Submits profiling data to an aggregated profile of a profiling group. */
  async postAgentProfile(
    params: PostAgentProfileRequest,
    opts: client.RequestOptions = {},
  ): Promise<void> {
    const body = typeof params["agentProfile"] === 'string' ? new TextEncoder().encode(params["agentProfile"]) : params["agentProfile"];
    const headers = new Headers;
    const query = new URLSearchParams;
    headers.append("Content-Type", params["contentType"]);
    if (params["profileToken"] != null) query.set("profileToken", params["profileToken"]?.toString() ?? "");
    const resp = await this.#client.performRequest({
      opts, headers, query, body,
      action: "PostAgentProfile",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/agentProfile`,
      responseCode: 204,
    });
  }

  /** TODO: Failed to render documentation: unhandled top level doc tag pre */
  async putPermission(
    params: PutPermissionRequest,
    opts: client.RequestOptions = {},
  ): Promise<PutPermissionResponse> {
    const body: jsonP.JSONObject = {
      principals: params["principals"],
      revisionId: params["revisionId"],
    };
    const resp = await this.#client.performRequest({
      opts, body,
      action: "PutPermission",
      method: "PUT",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/policy/${params["actionGroup"]}`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "policy": "s",
        "revisionId": "s",
      },
      optional: {},
    }, await resp.json());
  }

  /** Remove one anomaly notifications channel for a profiling group. */
  async removeNotificationChannel(
    params: RemoveNotificationChannelRequest,
    opts: client.RequestOptions = {},
  ): Promise<RemoveNotificationChannelResponse> {

    const resp = await this.#client.performRequest({
      opts,
      action: "RemoveNotificationChannel",
      method: "DELETE",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/notificationConfiguration/${params["channelId"]}`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {},
      optional: {
        "notificationConfiguration": toNotificationConfiguration,
      },
    }, await resp.json());
  }

  /** Removes permissions from a profiling group's resource-based policy that are provided using an action group. */
  async removePermission(
    params: RemovePermissionRequest,
    opts: client.RequestOptions = {},
  ): Promise<RemovePermissionResponse> {
    const query = new URLSearchParams;
    query.set("revisionId", params["revisionId"]?.toString() ?? "");
    const resp = await this.#client.performRequest({
      opts, query,
      action: "RemovePermission",
      method: "DELETE",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}/policy/${params["actionGroup"]}`,
      responseCode: 200,
    });
    return jsonP.readObj({
      required: {
        "policy": "s",
        "revisionId": "s",
      },
      optional: {},
    }, await resp.json());
  }

  /** Sends feedback to CodeGuru Profiler about whether the anomaly detected by the analysis is useful or not. */
  async submitFeedback(
    params: SubmitFeedbackRequest,
    opts: client.RequestOptions = {},
  ): Promise<void> {
    const body: jsonP.JSONObject = {
      comment: params["comment"],
      type: params["type"],
    };
    const resp = await this.#client.performRequest({
      opts, body,
      action: "SubmitFeedback",
      requestUri: cmnP.encodePath`/internal/profilingGroups/${params["profilingGroupName"]}/anomalies/${params["anomalyInstanceId"]}/feedback`,
      responseCode: 204,
    });
  }

  /** Use to assign one or more tags to a resource. */
  async tagResource(
    params: TagResourceRequest,
    opts: client.RequestOptions = {},
  ): Promise<void> {
    const body: jsonP.JSONObject = {
      tags: params["tags"],
    };
    const resp = await this.#client.performRequest({
      opts, body,
      action: "TagResource",
      requestUri: cmnP.encodePath`/tags/${params["resourceArn"]}`,
      responseCode: 204,
    });
  }

  /** Use to remove one or more tags from a resource. */
  async untagResource(
    params: UntagResourceRequest,
    opts: client.RequestOptions = {},
  ): Promise<void> {
    const query = new URLSearchParams;
    for (const item of params["tagKeys"]) {
      query.append("tagKeys", item?.toString() ?? "");
    }
    const resp = await this.#client.performRequest({
      opts, query,
      action: "UntagResource",
      method: "DELETE",
      requestUri: cmnP.encodePath`/tags/${params["resourceArn"]}`,
      responseCode: 204,
    });
  }

  /** Updates a profiling group. */
  async updateProfilingGroup(
    params: UpdateProfilingGroupRequest,
    opts: client.RequestOptions = {},
  ): Promise<UpdateProfilingGroupResponse> {
    const body: jsonP.JSONObject = {
      agentOrchestrationConfig: fromAgentOrchestrationConfig(params["agentOrchestrationConfig"]),
    };
    const resp = await this.#client.performRequest({
      opts, body,
      action: "UpdateProfilingGroup",
      method: "PUT",
      requestUri: cmnP.encodePath`/profilingGroups/${params["profilingGroupName"]}`,
      responseCode: 200,
    });
    return {
      profilingGroup: toProfilingGroupDescription(await resp.json()),
    };
  }

}

// refs: 1 - tags: named, input
/** The structure representing the AddNotificationChannelsRequest. */
export interface AddNotificationChannelsRequest {
  /** One or 2 channels to report to when anomalies are detected. */
  channels: Channel[];
  /** The name of the profiling group that we are setting up notifications for. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** The structure representing the BatchGetFrameMetricDataRequest. */
export interface BatchGetFrameMetricDataRequest {
  /** The end time of the time period for the returned time series values. */
  endTime?: Date | number | null;
  /** The details of the metrics that are used to request a time series of values. */
  frameMetrics?: FrameMetric[] | null;
  /** The duration of the frame metrics used to return the time series values. */
  period?: string | null;
  /** The name of the profiling group associated with the the frame metrics used to return the time series values. */
  profilingGroupName: string;
  /** The start time of the time period for the frame metrics used to return the time series values. */
  startTime?: Date | number | null;
  /** The requested resolution of time steps for the returned time series of values. */
  targetResolution?: AggregationPeriod | null;
}

// refs: 1 - tags: named, input
/** The structure representing the configureAgentRequest. */
export interface ConfigureAgentRequest {
  /** A universally unique identifier (UUID) for a profiling instance. */
  fleetInstanceId?: string | null;
  /** Metadata captured about the compute platform the agent is running on. */
  metadata?: { [key in MetadataField]: string | null | undefined } | null;
  /** The name of the profiling group for which the configured agent is collecting profiling data. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** The structure representing the createProfiliingGroupRequest. */
export interface CreateProfilingGroupRequest {
  /** Specifies whether profiling is enabled or disabled for the created profiling group. */
  agentOrchestrationConfig?: AgentOrchestrationConfig | null;
  /** Amazon CodeGuru Profiler uses this universally unique identifier (UUID) to prevent the accidental creation of duplicate profiling groups if there are failures and retries. */
  clientToken: string;
  /** The compute platform of the profiling group. */
  computePlatform?: ComputePlatform | null;
  /** The name of the profiling group to create. */
  profilingGroupName: string;
  /** A list of tags to add to the created profiling group. */
  tags?: { [key: string]: string | null | undefined } | null;
}

// refs: 1 - tags: named, input
/** The structure representing the deleteProfilingGroupRequest. */
export interface DeleteProfilingGroupRequest {
  /** The name of the profiling group to delete. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** The structure representing the describeProfilingGroupRequest. */
export interface DescribeProfilingGroupRequest {
  /** The name of the profiling group to get information about. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** The structure representing the GetFindingsReportAccountSummaryRequest. */
export interface GetFindingsReportAccountSummaryRequest {
  /** A `Boolean` value indicating whether to only return reports from daily profiles. */
  dailyReportsOnly?: boolean | null;
  /** The maximum number of results returned by `GetFindingsReportAccountSummary` in paginated output. */
  maxResults?: number | null;
  /** The `nextToken` value returned from a previous paginated `GetFindingsReportAccountSummary` request where `maxResults` was used and the results exceeded the value of that parameter. */
  nextToken?: string | null;
}

// refs: 1 - tags: named, input
/** The structure representing the GetNotificationConfigurationRequest. */
export interface GetNotificationConfigurationRequest {
  /** The name of the profiling group we want to get the notification configuration for. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** The structure representing the `getPolicyRequest`. */
export interface GetPolicyRequest {
  /** The name of the profiling group. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** The structure representing the getProfileRequest. */
export interface GetProfileRequest {
  /** TODO: Failed to render documentation: unhandled top level doc tag pre */
  accept?: string | null;
  /** The end time of the requested profile. */
  endTime?: Date | number | null;
  /** The maximum depth of the stacks in the code that is represented in the aggregated profile. */
  maxDepth?: number | null;
  /** TODO: Failed to render documentation: unhandled top level doc tag pre */
  period?: string | null;
  /** The name of the profiling group to get. */
  profilingGroupName: string;
  /** TODO: Failed to render documentation: unhandled top level doc tag pre */
  startTime?: Date | number | null;
}

// refs: 1 - tags: named, input
/** The structure representing the GetRecommendationsRequest. */
export interface GetRecommendationsRequest {
  /** The start time of the profile to get analysis data about. */
  endTime: Date | number;
  /** The language used to provide analysis. */
  locale?: string | null;
  /** The name of the profiling group to get analysis data about. */
  profilingGroupName: string;
  /** The end time of the profile to get analysis data about. */
  startTime: Date | number;
}

// refs: 1 - tags: named, input
/** The structure representing the ListFindingsReportsRequest. */
export interface ListFindingsReportsRequest {
  /** A `Boolean` value indicating whether to only return reports from daily profiles. */
  dailyReportsOnly?: boolean | null;
  /** The end time of the profile to get analysis data about. */
  endTime: Date | number;
  /** The maximum number of report results returned by `ListFindingsReports` in paginated output. */
  maxResults?: number | null;
  /** The `nextToken` value returned from a previous paginated `ListFindingsReportsRequest` request where `maxResults` was used and the results exceeded the value of that parameter. */
  nextToken?: string | null;
  /** The name of the profiling group from which to search for analysis data. */
  profilingGroupName: string;
  /** The start time of the profile to get analysis data about. */
  startTime: Date | number;
}

// refs: 1 - tags: named, input
/** The structure representing the listProfileTimesRequest. */
export interface ListProfileTimesRequest {
  /** The end time of the time range from which to list the profiles. */
  endTime: Date | number;
  /** The maximum number of profile time results returned by `ListProfileTimes` in paginated output. */
  maxResults?: number | null;
  /** The `nextToken` value returned from a previous paginated `ListProfileTimes` request where `maxResults` was used and the results exceeded the value of that parameter. */
  nextToken?: string | null;
  /** The order (ascending or descending by start time of the profile) to use when listing profiles. */
  orderBy?: OrderBy | null;
  /** The aggregation period. */
  period: AggregationPeriod;
  /** The name of the profiling group. */
  profilingGroupName: string;
  /** The start time of the time range from which to list the profiles. */
  startTime: Date | number;
}

// refs: 1 - tags: named, input
/** The structure representing the listProfilingGroupsRequest. */
export interface ListProfilingGroupsRequest {
  /** A `Boolean` value indicating whether to include a description. */
  includeDescription?: boolean | null;
  /** The maximum number of profiling groups results returned by `ListProfilingGroups` in paginated output. */
  maxResults?: number | null;
  /** The `nextToken` value returned from a previous paginated `ListProfilingGroups` request where `maxResults` was used and the results exceeded the value of that parameter. */
  nextToken?: string | null;
}

// refs: 1 - tags: named, input
export interface ListTagsForResourceRequest {
  /** The Amazon Resource Name (ARN) of the resource that contains the tags to return. */
  resourceArn: string;
}

// refs: 1 - tags: named, input
/** The structure representing the postAgentProfileRequest. */
export interface PostAgentProfileRequest {
  /** The submitted profiling data. */
  agentProfile: Uint8Array | string;
  /** TODO: Failed to render documentation: unhandled top level doc tag pre */
  contentType: string;
  /** Amazon CodeGuru Profiler uses this universally unique identifier (UUID) to prevent the accidental submission of duplicate profiling data if there are failures and retries. */
  profileToken?: string | null;
  /** The name of the profiling group with the aggregated profile that receives the submitted profiling data. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** The structure representing the `putPermissionRequest`. */
export interface PutPermissionRequest {
  /** Specifies an action group that contains permissions to add to a profiling group resource. */
  actionGroup: ActionGroup;
  /** A list ARNs for the roles and users you want to grant access to the profiling group. */
  principals: string[];
  /** The name of the profiling group to grant access to. */
  profilingGroupName: string;
  /** A universally unique identifier (UUID) for the revision of the policy you are adding to the profiling group. */
  revisionId?: string | null;
}

// refs: 1 - tags: named, input
/** The structure representing the RemoveNotificationChannelRequest. */
export interface RemoveNotificationChannelRequest {
  /** The id of the channel that we want to stop receiving notifications. */
  channelId: string;
  /** The name of the profiling group we want to change notification configuration for. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, input
/** TODO: Failed to render documentation: unhandled paragraph inner tag pre */
export interface RemovePermissionRequest {
  /** Specifies an action group that contains the permissions to remove from a profiling group's resource-based policy. */
  actionGroup: ActionGroup;
  /** The name of the profiling group. */
  profilingGroupName: string;
  /** A universally unique identifier (UUID) for the revision of the resource-based policy from which you want to remove permissions. */
  revisionId: string;
}

// refs: 1 - tags: named, input
/** The structure representing the SubmitFeedbackRequest. */
export interface SubmitFeedbackRequest {
  /** The universally unique identifier (UUID) of the [AnomalyInstance](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AnomalyInstance.html) object that is included in the analysis data. */
  anomalyInstanceId: string;
  /** Optional feedback about this anomaly. */
  comment?: string | null;
  /** The name of the profiling group that is associated with the analysis data. */
  profilingGroupName: string;
  /** The feedback tpye. */
  type: FeedbackType;
}

// refs: 1 - tags: named, input
export interface TagResourceRequest {
  /** The Amazon Resource Name (ARN) of the resource that the tags are added to. */
  resourceArn: string;
  /** The list of tags that are added to the specified resource. */
  tags: { [key: string]: string | null | undefined };
}

// refs: 1 - tags: named, input
export interface UntagResourceRequest {
  /** The Amazon Resource Name (ARN) of the resource that contains the tags to remove. */
  resourceArn: string;
  /** A list of tag keys. */
  tagKeys: string[];
}

// refs: 1 - tags: named, input
/** The structure representing the updateProfilingGroupRequest. */
export interface UpdateProfilingGroupRequest {
  /** Specifies whether profiling is enabled or disabled for a profiling group. */
  agentOrchestrationConfig: AgentOrchestrationConfig;
  /** The name of the profiling group to update. */
  profilingGroupName: string;
}

// refs: 1 - tags: named, output
/** The structure representing the AddNotificationChannelsResponse. */
export interface AddNotificationChannelsResponse {
  /** The new notification configuration for this profiling group. */
  notificationConfiguration?: NotificationConfiguration | null;
}

// refs: 1 - tags: named, output
/** The structure representing the BatchGetFrameMetricDataResponse. */
export interface BatchGetFrameMetricDataResponse {
  /** The end time of the time period for the returned time series values. */
  endTime: Date | number;
  /** List of instances, or time steps, in the time series. */
  endTimes: TimestampStructure[];
  /** Details of the metrics to request a time series of values. */
  frameMetricData: FrameMetricDatum[];
  /** Resolution or granularity of the profile data used to generate the time series. */
  resolution: AggregationPeriod;
  /** The start time of the time period for the returned time series values. */
  startTime: Date | number;
  /** List of instances which remained unprocessed. */
  unprocessedEndTimes: { [key: string]: TimestampStructure[] | null | undefined };
}

// refs: 1 - tags: named, output
/** The structure representing the configureAgentResponse. */
export interface ConfigureAgentResponse {
  /** An [AgentConfiguration](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AgentConfiguration.html) object that specifies if an agent profiles or not and for how long to return profiling data. */
  configuration: AgentConfiguration;
}

// refs: 1 - tags: named, output
/** The structure representing the createProfilingGroupResponse. */
export interface CreateProfilingGroupResponse {
  /** The returned [ProfilingGroupDescription](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html) object that contains information about the created profiling group. */
  profilingGroup: ProfilingGroupDescription;
}

// refs: 1 - tags: named, output
/** The structure representing the describeProfilingGroupResponse. */
export interface DescribeProfilingGroupResponse {
  /** The returned [ProfilingGroupDescription](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html) object that contains information about the requested profiling group. */
  profilingGroup: ProfilingGroupDescription;
}

// refs: 1 - tags: named, output
/** The structure representing the GetFindingsReportAccountSummaryResponse. */
export interface GetFindingsReportAccountSummaryResponse {
  /** The `nextToken` value to include in a future `GetFindingsReportAccountSummary` request. */
  nextToken?: string | null;
  /** The return list of [FindingsReportSummary](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_FindingsReportSummary.html) objects taht contain summaries of analysis results for all profiling groups in your AWS account. */
  reportSummaries: FindingsReportSummary[];
}

// refs: 1 - tags: named, output
/** The structure representing the GetNotificationConfigurationResponse. */
export interface GetNotificationConfigurationResponse {
  /** The current notification configuration for this profiling group. */
  notificationConfiguration: NotificationConfiguration;
}

// refs: 1 - tags: named, output
/** The structure representing the `getPolicyResponse`. */
export interface GetPolicyResponse {
  /** The JSON-formatted resource-based policy attached to the `ProfilingGroup`. */
  policy: string;
  /** A unique identifier for the current revision of the returned policy. */
  revisionId: string;
}

// refs: 1 - tags: named, output
/** The structure representing the getProfileResponse. */
export interface GetProfileResponse {
  /** The content encoding of the profile. */
  contentEncoding?: string | null;
  /** The content type of the profile in the payload. */
  contentType: string;
  /** Information about the profile. */
  profile: Uint8Array;
}

// refs: 1 - tags: named, output
/** The structure representing the GetRecommendationsResponse. */
export interface GetRecommendationsResponse {
  /** The list of anomalies that the analysis has found for this profile. */
  anomalies: Anomaly[];
  /** The end time of the profile the analysis data is about. */
  profileEndTime: Date | number;
  /** The start time of the profile the analysis data is about. */
  profileStartTime: Date | number;
  /** The name of the profiling group the analysis data is about. */
  profilingGroupName: string;
  /** The list of recommendations that the analysis found for this profile. */
  recommendations: Recommendation[];
}

// refs: 1 - tags: named, output
/** The structure representing the ListFindingsReportsResponse. */
export interface ListFindingsReportsResponse {
  /** The list of analysis results summaries. */
  findingsReportSummaries: FindingsReportSummary[];
  /** The `nextToken` value to include in a future `ListFindingsReports` request. */
  nextToken?: string | null;
}

// refs: 1 - tags: named, output
/** The structure representing the listProfileTimesResponse. */
export interface ListProfileTimesResponse {
  /** The `nextToken` value to include in a future `ListProfileTimes` request. */
  nextToken?: string | null;
  /** The list of start times of the available profiles for the aggregation period in the specified time range. */
  profileTimes: ProfileTime[];
}

// refs: 1 - tags: named, output
/** The structure representing the listProfilingGroupsResponse. */
export interface ListProfilingGroupsResponse {
  /** The `nextToken` value to include in a future `ListProfilingGroups` request. */
  nextToken?: string | null;
  /** A returned list of profiling group names. */
  profilingGroupNames: string[];
  /** A returned list [ProfilingGroupDescription](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html) objects. */
  profilingGroups?: ProfilingGroupDescription[] | null;
}

// refs: 1 - tags: named, output
export interface ListTagsForResourceResponse {
  /** The list of tags assigned to the specified resource. */
  tags?: { [key: string]: string | null | undefined } | null;
}

// refs: 1 - tags: named, output
/** The structure representing the `putPermissionResponse`. */
export interface PutPermissionResponse {
  /** The JSON-formatted resource-based policy on the profiling group that includes the added permissions. */
  policy: string;
  /** A universally unique identifier (UUID) for the revision of the resource-based policy that includes the added permissions. */
  revisionId: string;
}

// refs: 1 - tags: named, output
/** The structure representing the RemoveNotificationChannelResponse. */
export interface RemoveNotificationChannelResponse {
  /** The new notification configuration for this profiling group. */
  notificationConfiguration?: NotificationConfiguration | null;
}

// refs: 1 - tags: named, output
/** The structure representing the `removePermissionResponse`. */
export interface RemovePermissionResponse {
  /** The JSON-formatted resource-based policy on the profiling group after the specified permissions were removed. */
  policy: string;
  /** A universally unique identifier (UUID) for the revision of the resource-based policy after the specified permissions were removed. */
  revisionId: string;
}

// refs: 1 - tags: named, output
/** The structure representing the updateProfilingGroupResponse. */
export interface UpdateProfilingGroupResponse {
  /** A [ProfilingGroupDescription](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingGroupDescription.html) that contains information about the returned updated profiling group. */
  profilingGroup: ProfilingGroupDescription;
}

// refs: 4 - tags: input, named, interface, output
/** Notification medium for users to get alerted for events that occur in application profile. */
export interface Channel {
  /** List of publishers for different type of events that may be detected in an application from the profile. */
  eventPublishers: EventPublisher[];
  /** Unique identifier for each `Channel` in the notification configuration of a Profiling Group. */
  id?: string | null;
  /** Unique arn of the resource to be used for notifications. */
  uri: string;
}
function fromChannel(input?: Channel | null): jsonP.JSONValue {
  if (!input) return input;
  return {
    eventPublishers: input["eventPublishers"],
    id: input["id"],
    uri: input["uri"],
  }
}
function toChannel(root: jsonP.JSONValue): Channel {
  return jsonP.readObj({
    required: {
      "eventPublishers": [(x: jsonP.JSONValue) => cmnP.readEnum<EventPublisher>(x)],
      "uri": "s",
    },
    optional: {
      "id": "s",
    },
  }, root);
}

// refs: 4 - tags: input, named, enum, output
export type EventPublisher =
| "AnomalyDetection"
| cmnP.UnexpectedEnumValue;

// refs: 2 - tags: input, named, interface, output
/** The frame name, metric type, and thread states. */
export interface FrameMetric {
  /** Name of the method common across the multiple occurrences of a frame in an application profile. */
  frameName: string;
  /** List of application runtime thread states used to get the counts for a frame a derive a metric value. */
  threadStates: string[];
  /** A type of aggregation that specifies how a metric for a frame is analyzed. */
  type: MetricType;
}
function fromFrameMetric(input?: FrameMetric | null): jsonP.JSONValue {
  if (!input) return input;
  return {
    frameName: input["frameName"],
    threadStates: input["threadStates"],
    type: input["type"],
  }
}
function toFrameMetric(root: jsonP.JSONValue): FrameMetric {
  return jsonP.readObj({
    required: {
      "frameName": "s",
      "threadStates": ["s"],
      "type": (x: jsonP.JSONValue) => cmnP.readEnum<MetricType>(x),
    },
    optional: {},
  }, root);
}

// refs: 3 - tags: input, named, enum, output
export type MetricType =
| "AggregatedRelativeTotalTime"
| cmnP.UnexpectedEnumValue;

// refs: 7 - tags: input, named, enum, output
export type AggregationPeriod =
| "PT5M"
| "PT1H"
| "P1D"
| cmnP.UnexpectedEnumValue;

// refs: 1 - tags: input, named, enum
export type MetadataField =
| "ComputePlatform"
| "AgentId"
| "AwsRequestId"
| "ExecutionEnvironment"
| "LambdaFunctionArn"
| "LambdaMemoryLimitInMB"
| "LambdaRemainingTimeInMilliseconds"
| "LambdaTimeGapBetweenInvokesInMilliseconds"
| "LambdaPreviousExecutionTimeInMilliseconds"
| cmnP.UnexpectedEnumValue;

// refs: 6 - tags: input, named, interface, output
/** Specifies whether profiling is enabled or disabled for a profiling group. */
export interface AgentOrchestrationConfig {
  /** A `Boolean` that specifies whether the profiling agent collects profiling data or not. */
  profilingEnabled: boolean;
}
function fromAgentOrchestrationConfig(input?: AgentOrchestrationConfig | null): jsonP.JSONValue {
  if (!input) return input;
  return {
    profilingEnabled: input["profilingEnabled"],
  }
}
function toAgentOrchestrationConfig(root: jsonP.JSONValue): AgentOrchestrationConfig {
  return jsonP.readObj({
    required: {
      "profilingEnabled": "b",
    },
    optional: {},
  }, root);
}

// refs: 5 - tags: input, named, enum, output
export type ComputePlatform =
| "Default"
| "AWSLambda"
| cmnP.UnexpectedEnumValue;

// refs: 1 - tags: input, named, enum
export type OrderBy =
| "TimestampDescending"
| "TimestampAscending"
| cmnP.UnexpectedEnumValue;

// refs: 2 - tags: input, named, enum
export type ActionGroup =
| "agentPermissions"
| cmnP.UnexpectedEnumValue;

// refs: 2 - tags: input, named, enum, output
export type FeedbackType =
| "Positive"
| "Negative"
| cmnP.UnexpectedEnumValue;

// refs: 3 - tags: output, named, interface
/** The configuration for notifications stored for each profiling group. */
export interface NotificationConfiguration {
  /** List of up to two channels to be used for sending notifications for events detected from the application profile. */
  channels?: Channel[] | null;
}
function toNotificationConfiguration(root: jsonP.JSONValue): NotificationConfiguration {
  return jsonP.readObj({
    required: {},
    optional: {
      "channels": [toChannel],
    },
  }, root);
}

// refs: 2 - tags: output, named, interface
/** A data type that contains a `Timestamp` object. */
export interface TimestampStructure {
  /** A `Timestamp`. */
  value: Date | number;
}
function toTimestampStructure(root: jsonP.JSONValue): TimestampStructure {
  return jsonP.readObj({
    required: {
      "value": "d",
    },
    optional: {},
  }, root);
}

// refs: 1 - tags: output, named, interface
/** Information about a frame metric and its values. */
export interface FrameMetricDatum {
  frameMetric: FrameMetric;
  /** A list of values that are associated with a frame metric. */
  values: number[];
}
function toFrameMetricDatum(root: jsonP.JSONValue): FrameMetricDatum {
  return jsonP.readObj({
    required: {
      "frameMetric": toFrameMetric,
      "values": ["n"],
    },
    optional: {},
  }, root);
}

// refs: 1 - tags: output, named, interface
/** The response of [ConfigureAgent](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html) that specifies if an agent profiles or not and for how long to return profiling data. */
export interface AgentConfiguration {
  /** Parameters used by the profiler. */
  agentParameters?: { [key in AgentParameterField]: string | null | undefined } | null;
  /** How long a profiling agent should send profiling data using [ConfigureAgent](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html). */
  periodInSeconds: number;
  /** A `Boolean` that specifies whether the profiling agent collects profiling data or not. */
  shouldProfile: boolean;
}
function toAgentConfiguration(root: jsonP.JSONValue): AgentConfiguration {
  return jsonP.readObj({
    required: {
      "periodInSeconds": "n",
      "shouldProfile": "b",
    },
    optional: {
      "agentParameters": x => jsonP.readMap(x => cmnP.readEnumReq<AgentParameterField>(x), String, x),
    },
  }, root);
}

// refs: 1 - tags: output, named, enum
export type AgentParameterField =
| "SamplingIntervalInMilliseconds"
| "ReportingIntervalInMilliseconds"
| "MinimumTimeForReportingInMilliseconds"
| "MemoryUsageLimitPercent"
| "MaxStackDepth"
| cmnP.UnexpectedEnumValue;

// refs: 4 - tags: output, named, interface
/** Contains information about a profiling group. */
export interface ProfilingGroupDescription {
  /** An [AgentOrchestrationConfig](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AgentOrchestrationConfig.html) object that indicates if the profiling group is enabled for profiled or not. */
  agentOrchestrationConfig?: AgentOrchestrationConfig | null;
  /** The Amazon Resource Name (ARN) identifying the profiling group resource. */
  arn?: string | null;
  /** The compute platform of the profiling group. */
  computePlatform?: ComputePlatform | null;
  /** The time when the profiling group was created. */
  createdAt?: Date | number | null;
  /** The name of the profiling group. */
  name?: string | null;
  /** A [ProfilingStatus](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ProfilingStatus.html) object that includes information about the last time a profile agent pinged back, the last time a profile was received, and the aggregation period and start time for the most recent aggregated profile. */
  profilingStatus?: ProfilingStatus | null;
  /** A list of the tags that belong to this profiling group. */
  tags?: { [key: string]: string | null | undefined } | null;
  /** The date and time when the profiling group was last updated. */
  updatedAt?: Date | number | null;
}
function toProfilingGroupDescription(root: jsonP.JSONValue): ProfilingGroupDescription {
  return jsonP.readObj({
    required: {},
    optional: {
      "agentOrchestrationConfig": toAgentOrchestrationConfig,
      "arn": "s",
      "computePlatform": (x: jsonP.JSONValue) => cmnP.readEnum<ComputePlatform>(x),
      "createdAt": "d",
      "name": "s",
      "profilingStatus": toProfilingStatus,
      "tags": x => jsonP.readMap(String, String, x),
      "updatedAt": "d",
    },
  }, root);
}

// refs: 4 - tags: output, named, interface
/** Profiling status includes information about the last time a profile agent pinged back, the last time a profile was received, and the aggregation period and start time for the most recent aggregated profile. */
export interface ProfilingStatus {
  /** The date and time when the profiling agent most recently pinged back. */
  latestAgentOrchestratedAt?: Date | number | null;
  /** The date and time when the most recent profile was received. */
  latestAgentProfileReportedAt?: Date | number | null;
  /** An [AggregatedProfileTime](https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html) object that contains the aggregation period and start time for an aggregated profile. */
  latestAggregatedProfile?: AggregatedProfileTime | null;
}
function toProfilingStatus(root: jsonP.JSONValue): ProfilingStatus {
  return jsonP.readObj({
    required: {},
    optional: {
      "latestAgentOrchestratedAt": "d",
      "latestAgentProfileReportedAt": "d",
      "latestAggregatedProfile": toAggregatedProfileTime,
    },
  }, root);
}

// refs: 4 - tags: output, named, interface
/** Specifies the aggregation period and aggregation start time for an aggregated profile. */
export interface AggregatedProfileTime {
  /** The aggregation period. */
  period?: AggregationPeriod | null;
  /** The time that aggregation of posted agent profiles for a profiling group starts. */
  start?: Date | number | null;
}
function toAggregatedProfileTime(root: jsonP.JSONValue): AggregatedProfileTime {
  return jsonP.readObj({
    required: {},
    optional: {
      "period": (x: jsonP.JSONValue) => cmnP.readEnum<AggregationPeriod>(x),
      "start": "d",
    },
  }, root);
}

// refs: 2 - tags: output, named, interface
/** Information about potential recommendations that might be created from the analysis of profiling data. */
export interface FindingsReportSummary {
  /** The universally unique identifier (UUID) of the recommendation report. */
  id?: string | null;
  /** The end time of the period during which the metric is flagged as anomalous. */
  profileEndTime?: Date | number | null;
  /** The start time of the profile the analysis data is about. */
  profileStartTime?: Date | number | null;
  /** The name of the profiling group that is associated with the analysis data. */
  profilingGroupName?: string | null;
  /** The total number of different recommendations that were found by the analysis. */
  totalNumberOfFindings?: number | null;
}
function toFindingsReportSummary(root: jsonP.JSONValue): FindingsReportSummary {
  return jsonP.readObj({
    required: {},
    optional: {
      "id": "s",
      "profileEndTime": "d",
      "profileStartTime": "d",
      "profilingGroupName": "s",
      "totalNumberOfFindings": "n",
    },
  }, root);
}

// refs: 1 - tags: output, named, interface
/** Details about an anomaly in a specific metric of application profile. */
export interface Anomaly {
  /** A list of the instances of the detected anomalies during the requested period. */
  instances: AnomalyInstance[];
  /** Details about the metric that the analysis used when it detected the anomaly. */
  metric: Metric;
  /** The reason for which metric was flagged as anomalous. */
  reason: string;
}
function toAnomaly(root: jsonP.JSONValue): Anomaly {
  return jsonP.readObj({
    required: {
      "instances": [toAnomalyInstance],
      "metric": toMetric,
      "reason": "s",
    },
    optional: {},
  }, root);
}

// refs: 1 - tags: output, named, interface
/** The specific duration in which the metric is flagged as anomalous. */
export interface AnomalyInstance {
  /** The end time of the period during which the metric is flagged as anomalous. */
  endTime?: Date | number | null;
  /** The universally unique identifier (UUID) of an instance of an anomaly in a metric. */
  id: string;
  /** The start time of the period during which the metric is flagged as anomalous. */
  startTime: Date | number;
  /** Feedback type on a specific instance of anomaly submitted by the user. */
  userFeedback?: UserFeedback | null;
}
function toAnomalyInstance(root: jsonP.JSONValue): AnomalyInstance {
  return jsonP.readObj({
    required: {
      "id": "s",
      "startTime": "d",
    },
    optional: {
      "endTime": "d",
      "userFeedback": toUserFeedback,
    },
  }, root);
}

// refs: 1 - tags: output, named, interface
/** Feedback that can be submitted for each instance of an anomaly by the user. */
export interface UserFeedback {
  /** Optional `Positive` or `Negative` feedback submitted by the user about whether the recommendation is useful or not. */
  type: FeedbackType;
}
function toUserFeedback(root: jsonP.JSONValue): UserFeedback {
  return jsonP.readObj({
    required: {
      "type": (x: jsonP.JSONValue) => cmnP.readEnum<FeedbackType>(x),
    },
    optional: {},
  }, root);
}

// refs: 1 - tags: output, named, interface
/** Details about the metric that the analysis used when it detected the anomaly. */
export interface Metric {
  /** The name of the method that appears as a frame in any stack in a profile. */
  frameName: string;
  /** The list of application runtime thread states that is used to calculate the metric value for the frame. */
  threadStates: string[];
  /** A type that specifies how a metric for a frame is analyzed. */
  type: MetricType;
}
function toMetric(root: jsonP.JSONValue): Metric {
  return jsonP.readObj({
    required: {
      "frameName": "s",
      "threadStates": ["s"],
      "type": (x: jsonP.JSONValue) => cmnP.readEnum<MetricType>(x),
    },
    optional: {},
  }, root);
}

// refs: 1 - tags: output, named, interface
/** A potential improvement that was found from analyzing the profiling data. */
export interface Recommendation {
  /** How many different places in the profile graph triggered a match. */
  allMatchesCount: number;
  /** How much of the total sample count is potentially affected. */
  allMatchesSum: number;
  /** End time of the profile that was used by this analysis. */
  endTime: Date | number;
  /** The pattern that analysis recognized in the profile to make this recommendation. */
  pattern: Pattern;
  /** The start time of the profile that was used by this analysis. */
  startTime: Date | number;
  /** List of the matches with most impact. */
  topMatches: Match[];
}
function toRecommendation(root: jsonP.JSONValue): Recommendation {
  return jsonP.readObj({
    required: {
      "allMatchesCount": "n",
      "allMatchesSum": "n",
      "endTime": "d",
      "pattern": toPattern,
      "startTime": "d",
      "topMatches": [toMatch],
    },
    optional: {},
  }, root);
}

// refs: 1 - tags: output, named, interface
/** A set of rules used to make a recommendation during an analysis. */
export interface Pattern {
  /** A list of the different counters used to determine if there is a match. */
  countersToAggregate?: string[] | null;
  /** The description of the recommendation. */
  description?: string | null;
  /** The universally unique identifier (UUID) of this pattern. */
  id?: string | null;
  /** The name for this pattern. */
  name?: string | null;
  /** A string that contains the steps recommended to address the potential inefficiency. */
  resolutionSteps?: string | null;
  /** A list of frame names that were searched during the analysis that generated a recommendation. */
  targetFrames?: string[][] | null;
  /** The percentage of time an application spends in one method that triggers a recommendation. */
  thresholdPercent?: number | null;
}
function toPattern(root: jsonP.JSONValue): Pattern {
  return jsonP.readObj({
    required: {},
    optional: {
      "countersToAggregate": ["s"],
      "description": "s",
      "id": "s",
      "name": "s",
      "resolutionSteps": "s",
      "targetFrames": [x => jsonP.readList(String, x)],
      "thresholdPercent": "n",
    },
  }, root);
}

// refs: 1 - tags: output, named, interface
/** The part of a profile that contains a recommendation found during analysis. */
export interface Match {
  /** The location in the profiling graph that contains a recommendation found during analysis. */
  frameAddress?: string | null;
  /** The target frame that triggered a match. */
  targetFramesIndex?: number | null;
  /** The value in the profile data that exceeded the recommendation threshold. */
  thresholdBreachValue?: number | null;
}
function toMatch(root: jsonP.JSONValue): Match {
  return jsonP.readObj({
    required: {},
    optional: {
      "frameAddress": "s",
      "targetFramesIndex": "n",
      "thresholdBreachValue": "n",
    },
  }, root);
}

// refs: 1 - tags: output, named, interface
/** Contains the start time of a profile. */
export interface ProfileTime {
  /** The start time of a profile. */
  start?: Date | number | null;
}
function toProfileTime(root: jsonP.JSONValue): ProfileTime {
  return jsonP.readObj({
    required: {},
    optional: {
      "start": "d",
    },
  }, root);
}