import * as HttpClient from "effect/unstable/http/HttpClient";
import * as redacted from "effect/Redacted";
import * as S from "effect/Schema";
import * as stream from "effect/Stream";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import * as C from "../category.js";
import { SensitiveString } from "../sensitive.js";
const svc = T.AwsApiService({
    sdkId: "EMR Serverless",
    serviceShapeName: "AwsToledoWebService",
});
const auth = T.AwsAuthSigv4({ name: "emr-serverless" });
const ver = T.ServiceVersion("2021-07-13");
const proto = T.AwsProtocolsRestJson1();
const rules = T.EndpointResolver((p, _) => {
    const { Region, UseDualStack = false, UseFIPS = false, Endpoint } = p;
    const e = (u, p = {}, h = {}) => ({
        type: "endpoint",
        endpoint: { url: u, properties: p, headers: h },
    });
    const err = (m) => ({
        type: "error",
        message: m,
    });
    if (Endpoint != null) {
        if (UseFIPS === true) {
            return err("Invalid Configuration: FIPS and custom endpoint are not supported");
        }
        if (UseDualStack === true) {
            return err("Invalid Configuration: Dualstack and custom endpoint are not supported");
        }
        return e(Endpoint);
    }
    if (Region != null) {
        {
            const PartitionResult = _.partition(Region);
            if (PartitionResult != null && PartitionResult !== false) {
                if (UseFIPS === true && UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsFIPS") &&
                        true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://emr-serverless-fips.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("FIPS and DualStack are enabled, but this partition does not support one or both");
                }
                if (UseFIPS === true) {
                    if (_.getAttr(PartitionResult, "supportsFIPS") === true) {
                        return e(`https://emr-serverless-fips.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
                    }
                    return err("FIPS is enabled but this partition does not support FIPS");
                }
                if (UseDualStack === true) {
                    if (true === _.getAttr(PartitionResult, "supportsDualStack")) {
                        return e(`https://emr-serverless.${Region}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`);
                    }
                    return err("DualStack is enabled but this partition does not support DualStack");
                }
                return e(`https://emr-serverless.${Region}.${_.getAttr(PartitionResult, "dnsSuffix")}`);
            }
        }
    }
    return err("Invalid Configuration: Missing Region");
});
export const ListTagsForResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ resourceArn: S.String.pipe(T.HttpLabel("resourceArn")) }).pipe(T.all(T.Http({ method: "GET", uri: "/tags/{resourceArn}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListTagsForResourceRequest",
});
export const TagMap = /*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, S.String.pipe(S.optional));
export const ListTagsForResourceResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ tags: S.optional(TagMap) })).annotate({
    identifier: "ListTagsForResourceResponse",
});
export const TagResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    resourceArn: S.String.pipe(T.HttpLabel("resourceArn")),
    tags: TagMap,
}).pipe(T.all(T.Http({ method: "POST", uri: "/tags/{resourceArn}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "TagResourceRequest",
});
export const TagResourceResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "TagResourceResponse",
});
export const TagKeyList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const UntagResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    resourceArn: S.String.pipe(T.HttpLabel("resourceArn")),
    tagKeys: TagKeyList.pipe(T.HttpQuery("tagKeys")),
}).pipe(T.all(T.Http({ method: "DELETE", uri: "/tags/{resourceArn}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "UntagResourceRequest",
});
export const UntagResourceResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "UntagResourceResponse",
});
export const WorkerResourceConfig = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    cpu: S.String,
    memory: S.String,
    disk: S.optional(S.String),
    diskType: S.optional(S.String),
})).annotate({
    identifier: "WorkerResourceConfig",
});
export const InitialCapacityConfig = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    workerCount: S.Number,
    workerConfiguration: S.optional(WorkerResourceConfig),
})).annotate({
    identifier: "InitialCapacityConfig",
});
export const InitialCapacityConfigMap = /*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, InitialCapacityConfig.pipe(S.optional));
export const MaximumAllowedResources = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ cpu: S.String, memory: S.String, disk: S.optional(S.String) })).annotate({
    identifier: "MaximumAllowedResources",
});
export const AutoStartConfig = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.Boolean) })).annotate({
    identifier: "AutoStartConfig",
});
export const AutoStopConfig = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    enabled: S.optional(S.Boolean),
    idleTimeoutMinutes: S.optional(S.Number),
})).annotate({ identifier: "AutoStopConfig" });
export const SubnetIds = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const SecurityGroupIds = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const NetworkConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    subnetIds: S.optional(SubnetIds),
    securityGroupIds: S.optional(SecurityGroupIds),
})).annotate({
    identifier: "NetworkConfiguration",
});
export const ImageConfigurationInput = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ imageUri: S.optional(S.String) })).annotate({
    identifier: "ImageConfigurationInput",
});
export const WorkerTypeSpecificationInput = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ imageConfiguration: S.optional(ImageConfigurationInput) })).annotate({
    identifier: "WorkerTypeSpecificationInput",
});
export const WorkerTypeSpecificationInputMap = 
/*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, WorkerTypeSpecificationInput.pipe(S.optional));
export const SensitivePropertiesMap = /*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, S.String.pipe(S.optional));
export const Configuration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    classification: S.String,
    properties: S.optional(SensitivePropertiesMap),
    configurations: S.optional(S.suspend(() => ConfigurationList).annotate({
        identifier: "ConfigurationList",
    })),
})).annotate({ identifier: "Configuration" });
export const ConfigurationList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.suspend(() => Configuration).annotate({
    identifier: "Configuration",
}));
export const S3MonitoringConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    logUri: S.optional(S.String),
    encryptionKeyArn: S.optional(S.String),
})).annotate({
    identifier: "S3MonitoringConfiguration",
});
export const ManagedPersistenceMonitoringConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    enabled: S.optional(S.Boolean),
    encryptionKeyArn: S.optional(S.String),
})).annotate({
    identifier: "ManagedPersistenceMonitoringConfiguration",
});
export const LogTypeList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const LogTypeMap = /*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, LogTypeList.pipe(S.optional));
export const CloudWatchLoggingConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    enabled: S.Boolean,
    logGroupName: S.optional(S.String),
    logStreamNamePrefix: S.optional(S.String),
    encryptionKeyArn: S.optional(S.String),
    logTypes: S.optional(LogTypeMap),
})).annotate({
    identifier: "CloudWatchLoggingConfiguration",
});
export const PrometheusMonitoringConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ remoteWriteUrl: S.optional(S.String) })).annotate({
    identifier: "PrometheusMonitoringConfiguration",
});
export const MonitoringConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    s3MonitoringConfiguration: S.optional(S3MonitoringConfiguration),
    managedPersistenceMonitoringConfiguration: S.optional(ManagedPersistenceMonitoringConfiguration),
    cloudWatchLoggingConfiguration: S.optional(CloudWatchLoggingConfiguration),
    prometheusMonitoringConfiguration: S.optional(PrometheusMonitoringConfiguration),
})).annotate({
    identifier: "MonitoringConfiguration",
});
export const EncryptionContext = /*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, S.String.pipe(S.optional));
export const DiskEncryptionConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    encryptionContext: S.optional(EncryptionContext),
    encryptionKeyArn: S.optional(S.String),
})).annotate({
    identifier: "DiskEncryptionConfiguration",
});
export const InteractiveConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    studioEnabled: S.optional(S.Boolean),
    livyEndpointEnabled: S.optional(S.Boolean),
})).annotate({
    identifier: "InteractiveConfiguration",
});
export const SchedulerConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    queueTimeoutMinutes: S.optional(S.Number),
    maxConcurrentRuns: S.optional(S.Number),
})).annotate({
    identifier: "SchedulerConfiguration",
});
export const IdentityCenterConfigurationInput = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    identityCenterInstanceArn: S.optional(S.String),
    userBackgroundSessionsEnabled: S.optional(S.Boolean),
})).annotate({
    identifier: "IdentityCenterConfigurationInput",
});
export const JobLevelCostAllocationConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.Boolean) })).annotate({
    identifier: "JobLevelCostAllocationConfiguration",
});
export const CreateApplicationRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    name: S.optional(S.String),
    releaseLabel: S.String,
    type: S.String,
    clientToken: S.String.pipe(T.IdempotencyToken()),
    initialCapacity: S.optional(InitialCapacityConfigMap),
    maximumCapacity: S.optional(MaximumAllowedResources),
    tags: S.optional(TagMap),
    autoStartConfiguration: S.optional(AutoStartConfig),
    autoStopConfiguration: S.optional(AutoStopConfig),
    networkConfiguration: S.optional(NetworkConfiguration),
    architecture: S.optional(S.String),
    imageConfiguration: S.optional(ImageConfigurationInput),
    workerTypeSpecifications: S.optional(WorkerTypeSpecificationInputMap),
    runtimeConfiguration: S.optional(ConfigurationList),
    monitoringConfiguration: S.optional(MonitoringConfiguration),
    diskEncryptionConfiguration: S.optional(DiskEncryptionConfiguration),
    interactiveConfiguration: S.optional(InteractiveConfiguration),
    schedulerConfiguration: S.optional(SchedulerConfiguration),
    identityCenterConfiguration: S.optional(IdentityCenterConfigurationInput),
    jobLevelCostAllocationConfiguration: S.optional(JobLevelCostAllocationConfiguration),
}).pipe(T.all(T.Http({ method: "POST", uri: "/applications" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "CreateApplicationRequest",
});
export const CreateApplicationResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String,
    name: S.optional(S.String),
    arn: S.String,
})).annotate({
    identifier: "CreateApplicationResponse",
});
export const GetApplicationRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ applicationId: S.String.pipe(T.HttpLabel("applicationId")) }).pipe(T.all(T.Http({ method: "GET", uri: "/applications/{applicationId}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetApplicationRequest",
});
export const ImageConfiguration = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ imageUri: S.String, resolvedImageDigest: S.optional(S.String) })).annotate({
    identifier: "ImageConfiguration",
});
export const WorkerTypeSpecification = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ imageConfiguration: S.optional(ImageConfiguration) })).annotate({
    identifier: "WorkerTypeSpecification",
});
export const WorkerTypeSpecificationMap = /*@__PURE__*/ /*#__PURE__*/ S.Record(S.String, WorkerTypeSpecification.pipe(S.optional));
export const IdentityCenterConfiguration = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    identityCenterInstanceArn: S.optional(S.String),
    identityCenterApplicationArn: S.optional(S.String),
    userBackgroundSessionsEnabled: S.optional(S.Boolean),
})).annotate({
    identifier: "IdentityCenterConfiguration",
});
export const Application = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String,
    name: S.optional(S.String),
    arn: S.String,
    releaseLabel: S.String,
    type: S.String,
    state: S.String,
    stateDetails: S.optional(S.String),
    initialCapacity: S.optional(InitialCapacityConfigMap),
    maximumCapacity: S.optional(MaximumAllowedResources),
    createdAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    updatedAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    tags: S.optional(TagMap),
    autoStartConfiguration: S.optional(AutoStartConfig),
    autoStopConfiguration: S.optional(AutoStopConfig),
    networkConfiguration: S.optional(NetworkConfiguration),
    architecture: S.optional(S.String),
    imageConfiguration: S.optional(ImageConfiguration),
    workerTypeSpecifications: S.optional(WorkerTypeSpecificationMap),
    runtimeConfiguration: S.optional(ConfigurationList),
    monitoringConfiguration: S.optional(MonitoringConfiguration),
    diskEncryptionConfiguration: S.optional(DiskEncryptionConfiguration),
    interactiveConfiguration: S.optional(InteractiveConfiguration),
    schedulerConfiguration: S.optional(SchedulerConfiguration),
    identityCenterConfiguration: S.optional(IdentityCenterConfiguration),
    jobLevelCostAllocationConfiguration: S.optional(JobLevelCostAllocationConfiguration),
})).annotate({ identifier: "Application" });
export const GetApplicationResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ application: Application })).annotate({
    identifier: "GetApplicationResponse",
});
export const UpdateApplicationRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
    clientToken: S.String.pipe(T.IdempotencyToken()),
    initialCapacity: S.optional(InitialCapacityConfigMap),
    maximumCapacity: S.optional(MaximumAllowedResources),
    autoStartConfiguration: S.optional(AutoStartConfig),
    autoStopConfiguration: S.optional(AutoStopConfig),
    networkConfiguration: S.optional(NetworkConfiguration),
    architecture: S.optional(S.String),
    imageConfiguration: S.optional(ImageConfigurationInput),
    workerTypeSpecifications: S.optional(WorkerTypeSpecificationInputMap),
    interactiveConfiguration: S.optional(InteractiveConfiguration),
    releaseLabel: S.optional(S.String),
    runtimeConfiguration: S.optional(ConfigurationList),
    monitoringConfiguration: S.optional(MonitoringConfiguration),
    diskEncryptionConfiguration: S.optional(DiskEncryptionConfiguration),
    schedulerConfiguration: S.optional(SchedulerConfiguration),
    identityCenterConfiguration: S.optional(IdentityCenterConfigurationInput),
    jobLevelCostAllocationConfiguration: S.optional(JobLevelCostAllocationConfiguration),
}).pipe(T.all(T.Http({ method: "PATCH", uri: "/applications/{applicationId}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "UpdateApplicationRequest",
});
export const UpdateApplicationResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ application: Application })).annotate({
    identifier: "UpdateApplicationResponse",
});
export const DeleteApplicationRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
}).pipe(T.all(T.Http({ method: "DELETE", uri: "/applications/{applicationId}" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "DeleteApplicationRequest",
});
export const DeleteApplicationResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "DeleteApplicationResponse",
});
export const ApplicationStateSet = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const ListApplicationsRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    nextToken: S.optional(S.String).pipe(T.HttpQuery("nextToken")),
    maxResults: S.optional(S.Number).pipe(T.HttpQuery("maxResults")),
    states: S.optional(ApplicationStateSet).pipe(T.HttpQuery("states")),
}).pipe(T.all(T.Http({ method: "GET", uri: "/applications" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListApplicationsRequest",
});
export const ApplicationSummary = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    id: S.String,
    name: S.optional(S.String),
    arn: S.String,
    releaseLabel: S.String,
    type: S.String,
    state: S.String,
    stateDetails: S.optional(S.String),
    createdAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    updatedAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    architecture: S.optional(S.String),
})).annotate({
    identifier: "ApplicationSummary",
});
export const ApplicationList = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(ApplicationSummary);
export const ListApplicationsResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applications: ApplicationList,
    nextToken: S.optional(S.String),
})).annotate({
    identifier: "ListApplicationsResponse",
});
export const StartApplicationRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
}).pipe(T.all(T.Http({ method: "POST", uri: "/applications/{applicationId}/start" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "StartApplicationRequest",
});
export const StartApplicationResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "StartApplicationResponse",
});
export const StopApplicationRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
}).pipe(T.all(T.Http({ method: "POST", uri: "/applications/{applicationId}/stop" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "StopApplicationRequest",
});
export const StopApplicationResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "StopApplicationResponse",
});
export const PolicyArnList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const JobRunExecutionIamPolicy = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    policy: S.optional(S.String),
    policyArns: S.optional(PolicyArnList),
})).annotate({
    identifier: "JobRunExecutionIamPolicy",
});
export const EntryPointArguments = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(SensitiveString);
export const SparkSubmit = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    entryPoint: SensitiveString,
    entryPointArguments: S.optional(EntryPointArguments),
    sparkSubmitParameters: S.optional(SensitiveString),
})).annotate({ identifier: "SparkSubmit" });
export const Hive = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    query: SensitiveString,
    initQueryFile: S.optional(SensitiveString),
    parameters: S.optional(SensitiveString),
})).annotate({ identifier: "Hive" });
export const JobDriver = /*@__PURE__*/ /*#__PURE__*/ S.Union([
    S.Struct({ sparkSubmit: SparkSubmit }),
    S.Struct({ hive: Hive }),
]);
export const ConfigurationOverrides = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationConfiguration: S.optional(ConfigurationList),
    monitoringConfiguration: S.optional(MonitoringConfiguration),
    diskEncryptionConfiguration: S.optional(DiskEncryptionConfiguration),
})).annotate({
    identifier: "ConfigurationOverrides",
});
export const RetryPolicy = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    maxAttempts: S.optional(S.Number),
    maxFailedAttemptsPerHour: S.optional(S.Number),
})).annotate({ identifier: "RetryPolicy" });
export const StartJobRunRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
    clientToken: S.String.pipe(T.IdempotencyToken()),
    executionRoleArn: S.String,
    executionIamPolicy: S.optional(JobRunExecutionIamPolicy),
    jobDriver: S.optional(JobDriver),
    configurationOverrides: S.optional(ConfigurationOverrides),
    tags: S.optional(TagMap),
    executionTimeoutMinutes: S.optional(S.Number),
    name: S.optional(S.String),
    mode: S.optional(S.String),
    retryPolicy: S.optional(RetryPolicy),
}).pipe(T.all(T.Http({ method: "POST", uri: "/applications/{applicationId}/jobruns" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "StartJobRunRequest",
});
export const StartJobRunResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ applicationId: S.String, jobRunId: S.String, arn: S.String })).annotate({
    identifier: "StartJobRunResponse",
});
export const GetJobRunRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
    jobRunId: S.String.pipe(T.HttpLabel("jobRunId")),
    attempt: S.optional(S.Number).pipe(T.HttpQuery("attempt")),
}).pipe(T.all(T.Http({
    method: "GET",
    uri: "/applications/{applicationId}/jobruns/{jobRunId}",
}), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetJobRunRequest",
});
export const TotalResourceUtilization = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    vCPUHour: S.optional(S.Number),
    memoryGBHour: S.optional(S.Number),
    storageGBHour: S.optional(S.Number),
})).annotate({
    identifier: "TotalResourceUtilization",
});
export const ResourceUtilization = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    vCPUHour: S.optional(S.Number),
    memoryGBHour: S.optional(S.Number),
    storageGBHour: S.optional(S.Number),
})).annotate({
    identifier: "ResourceUtilization",
});
export const JobRun = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String,
    jobRunId: S.String,
    name: S.optional(S.String),
    arn: S.String,
    createdBy: S.String,
    createdAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    updatedAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    executionRole: S.String,
    executionIamPolicy: S.optional(JobRunExecutionIamPolicy),
    state: S.String,
    stateDetails: S.String,
    releaseLabel: S.String,
    configurationOverrides: S.optional(ConfigurationOverrides),
    jobDriver: JobDriver,
    tags: S.optional(TagMap),
    totalResourceUtilization: S.optional(TotalResourceUtilization),
    networkConfiguration: S.optional(NetworkConfiguration),
    totalExecutionDurationSeconds: S.optional(S.Number),
    executionTimeoutMinutes: S.optional(S.Number),
    billedResourceUtilization: S.optional(ResourceUtilization),
    mode: S.optional(S.String),
    retryPolicy: S.optional(RetryPolicy),
    attempt: S.optional(S.Number),
    attemptCreatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    attemptUpdatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    startedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    endedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    queuedDurationMilliseconds: S.optional(S.Number),
})).annotate({ identifier: "JobRun" });
export const GetJobRunResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ jobRun: JobRun })).annotate({
    identifier: "GetJobRunResponse",
});
export const CancelJobRunRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
    jobRunId: S.String.pipe(T.HttpLabel("jobRunId")),
    shutdownGracePeriodInSeconds: S.optional(S.Number).pipe(T.HttpQuery("shutdownGracePeriodInSeconds")),
}).pipe(T.all(T.Http({
    method: "DELETE",
    uri: "/applications/{applicationId}/jobruns/{jobRunId}",
}), svc, auth, proto, ver, rules))).annotate({
    identifier: "CancelJobRunRequest",
});
export const CancelJobRunResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ applicationId: S.String, jobRunId: S.String })).annotate({
    identifier: "CancelJobRunResponse",
});
export const JobRunStateSet = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const ListJobRunsRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
    nextToken: S.optional(S.String).pipe(T.HttpQuery("nextToken")),
    maxResults: S.optional(S.Number).pipe(T.HttpQuery("maxResults")),
    createdAtAfter: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))).pipe(T.HttpQuery("createdAtAfter")),
    createdAtBefore: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))).pipe(T.HttpQuery("createdAtBefore")),
    states: S.optional(JobRunStateSet).pipe(T.HttpQuery("states")),
    mode: S.optional(S.String).pipe(T.HttpQuery("mode")),
}).pipe(T.all(T.Http({ method: "GET", uri: "/applications/{applicationId}/jobruns" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListJobRunsRequest",
});
export const JobRunSummary = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String,
    id: S.String,
    name: S.optional(S.String),
    mode: S.optional(S.String),
    arn: S.String,
    createdBy: S.String,
    createdAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    updatedAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    executionRole: S.String,
    state: S.String,
    stateDetails: S.String,
    releaseLabel: S.String,
    type: S.optional(S.String),
    attempt: S.optional(S.Number),
    attemptCreatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    attemptUpdatedAt: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
})).annotate({ identifier: "JobRunSummary" });
export const JobRuns = /*@__PURE__*/ /*#__PURE__*/ S.Array(JobRunSummary);
export const ListJobRunsResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ jobRuns: JobRuns, nextToken: S.optional(S.String) })).annotate({
    identifier: "ListJobRunsResponse",
});
export const GetDashboardForJobRunRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
    jobRunId: S.String.pipe(T.HttpLabel("jobRunId")),
    attempt: S.optional(S.Number).pipe(T.HttpQuery("attempt")),
    accessSystemProfileLogs: S.optional(S.Boolean).pipe(T.HttpQuery("accessSystemProfileLogs")),
}).pipe(T.all(T.Http({
    method: "GET",
    uri: "/applications/{applicationId}/jobruns/{jobRunId}/dashboard",
}), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetDashboardForJobRunRequest",
});
export const GetDashboardForJobRunResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ url: S.optional(S.String) })).annotate({
    identifier: "GetDashboardForJobRunResponse",
});
export const ListJobRunAttemptsRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String.pipe(T.HttpLabel("applicationId")),
    jobRunId: S.String.pipe(T.HttpLabel("jobRunId")),
    nextToken: S.optional(S.String).pipe(T.HttpQuery("nextToken")),
    maxResults: S.optional(S.Number).pipe(T.HttpQuery("maxResults")),
}).pipe(T.all(T.Http({
    method: "GET",
    uri: "/applications/{applicationId}/jobruns/{jobRunId}/attempts",
}), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListJobRunAttemptsRequest",
});
export const JobRunAttemptSummary = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    applicationId: S.String,
    id: S.String,
    name: S.optional(S.String),
    mode: S.optional(S.String),
    arn: S.String,
    createdBy: S.String,
    jobCreatedAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    createdAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    updatedAt: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    executionRole: S.String,
    state: S.String,
    stateDetails: S.String,
    releaseLabel: S.String,
    type: S.optional(S.String),
    attempt: S.optional(S.Number),
})).annotate({
    identifier: "JobRunAttemptSummary",
});
export const JobRunAttempts = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(JobRunAttemptSummary);
export const ListJobRunAttemptsResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    jobRunAttempts: JobRunAttempts,
    nextToken: S.optional(S.String),
})).annotate({
    identifier: "ListJobRunAttemptsResponse",
});
//# Errors
export class InternalServerException extends S.TaggedErrorClass()("InternalServerException", { message: S.String }).pipe(C.withServerError) {
}
export class ResourceNotFoundException extends S.TaggedErrorClass()("ResourceNotFoundException", { message: S.String }).pipe(C.withBadRequestError) {
}
export class ValidationException extends S.TaggedErrorClass()("ValidationException", { message: S.String }).pipe(C.withBadRequestError) {
}
export class ConflictException extends S.TaggedErrorClass()("ConflictException", { message: S.String }).pipe(C.withConflictError) {
}
export class ServiceQuotaExceededException extends S.TaggedErrorClass()("ServiceQuotaExceededException", { message: S.String }).pipe(C.withQuotaError) {
}
/**
 * Lists the tags assigned to the resources.
 */
export const listTagsForResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ListTagsForResourceRequest,
    output: ListTagsForResourceResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Assigns tags to resources. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key and an optional value, both of which you define. Tags enable you to categorize your Amazon Web Services resources by attributes such as purpose, owner, or environment. When you have many resources of the same type, you can quickly identify a specific resource based on the tags you've assigned to it.
 */
export const tagResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: TagResourceRequest,
    output: TagResourceResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Removes tags from resources.
 */
export const untagResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UntagResourceRequest,
    output: UntagResourceResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Creates an application.
 */
export const createApplication = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateApplicationRequest,
    output: CreateApplicationResponse,
    errors: [
        ConflictException,
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Displays detailed information about a specified application.
 */
export const getApplication = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetApplicationRequest,
    output: GetApplicationResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Updates a specified application. An application has to be in a stopped or created state in order to be updated.
 */
export const updateApplication = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateApplicationRequest,
    output: UpdateApplicationResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Deletes an application. An application has to be in a stopped or created state in order to be deleted.
 */
export const deleteApplication = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteApplicationRequest,
    output: DeleteApplicationResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Lists applications based on a set of parameters.
 */
export const listApplications = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListApplicationsRequest,
    output: ListApplicationsResponse,
    errors: [InternalServerException, ValidationException],
    pagination: {
        inputToken: "nextToken",
        outputToken: "nextToken",
        items: "applications",
        pageSize: "maxResults",
    },
}));
/**
 * Starts a specified application and initializes initial capacity if configured.
 */
export const startApplication = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: StartApplicationRequest,
    output: StartApplicationResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ServiceQuotaExceededException,
        ValidationException,
    ],
}));
/**
 * Stops a specified application and releases initial capacity if configured. All scheduled and running jobs must be completed or cancelled before stopping an application.
 */
export const stopApplication = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: StopApplicationRequest,
    output: StopApplicationResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Starts a job run.
 */
export const startJobRun = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: StartJobRunRequest,
    output: StartJobRunResponse,
    errors: [
        ConflictException,
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Displays detailed information about a job run.
 */
export const getJobRun = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetJobRunRequest,
    output: GetJobRunResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Cancels a job run.
 */
export const cancelJobRun = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CancelJobRunRequest,
    output: CancelJobRunResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Lists job runs based on a set of parameters.
 */
export const listJobRuns = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListJobRunsRequest,
    output: ListJobRunsResponse,
    errors: [InternalServerException, ValidationException],
    pagination: {
        inputToken: "nextToken",
        outputToken: "nextToken",
        items: "jobRuns",
        pageSize: "maxResults",
    },
}));
/**
 * Creates and returns a URL that you can use to access the application UIs for a job run.
 *
 * For jobs in a running state, the application UI is a live user interface such as the Spark or Tez web UI. For completed jobs, the application UI is a persistent application user interface such as the Spark History Server or persistent Tez UI.
 *
 * The URL is valid for one hour after you generate it. To access the application UI after that hour elapses, you must invoke the API again to generate a new URL.
 */
export const getDashboardForJobRun = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetDashboardForJobRunRequest,
    output: GetDashboardForJobRunResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
}));
/**
 * Lists all attempt of a job run.
 */
export const listJobRunAttempts = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListJobRunAttemptsRequest,
    output: ListJobRunAttemptsResponse,
    errors: [
        InternalServerException,
        ResourceNotFoundException,
        ValidationException,
    ],
    pagination: {
        inputToken: "nextToken",
        outputToken: "nextToken",
        items: "jobRunAttempts",
        pageSize: "maxResults",
    },
}));
//# sourceMappingURL=emr-serverless.js.map