Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the optional body parameter issues #2868

Merged
merged 11 commits into from
Oct 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class BatchClient {
deleteTaskFile(jobId: string, taskId: string, filePath: string, options?: DeleteTaskFileOptionalParams): Promise<void>;
disableJob(jobId: string, body: BatchJobDisableOptions, options?: DisableJobOptionalParams): Promise<void>;
disableJobSchedule(jobScheduleId: string, options?: DisableJobScheduleOptionalParams): Promise<void>;
disableNodeScheduling(poolId: string, nodeId: string, body?: NodeDisableSchedulingOptions, options?: DisableNodeSchedulingOptionalParams): Promise<void>;
disableNodeScheduling(poolId: string, nodeId: string, options?: DisableNodeSchedulingOptionalParams): Promise<void>;
disablePoolAutoScale(poolId: string, options?: DisablePoolAutoScaleOptionalParams): Promise<void>;
enableJob(jobId: string, options?: EnableJobOptionalParams): Promise<void>;
enableJobSchedule(jobScheduleId: string, options?: EnableJobScheduleOptionalParams): Promise<void>;
Expand Down Expand Up @@ -168,8 +168,8 @@ export class BatchClient {
readonly pipeline: Pipeline;
poolExists(poolId: string, options?: PoolExistsOptionalParams): Promise<void>;
reactivateTask(jobId: string, taskId: string, options?: ReactivateTaskOptionalParams): Promise<void>;
rebootNode(poolId: string, nodeId: string, body?: NodeRebootOptions, options?: RebootNodeOptionalParams): Promise<void>;
reimageNode(poolId: string, nodeId: string, body?: NodeReimageOptions, options?: ReimageNodeOptionalParams): Promise<void>;
rebootNode(poolId: string, nodeId: string, options?: RebootNodeOptionalParams): Promise<void>;
reimageNode(poolId: string, nodeId: string, options?: ReimageNodeOptionalParams): Promise<void>;
removeNodes(poolId: string, body: NodeRemoveOptions, options?: RemoveNodesOptionalParams): Promise<void>;
replaceJob(jobId: string, body: BatchJob, options?: ReplaceJobOptionalParams): Promise<void>;
replaceJobSchedule(jobScheduleId: string, body: BatchJobSchedule, options?: ReplaceJobScheduleOptionalParams): Promise<void>;
Expand All @@ -178,7 +178,7 @@ export class BatchClient {
replaceTask(jobId: string, taskId: string, body: BatchTask, options?: ReplaceTaskOptionalParams): Promise<void>;
resizePool(poolId: string, body: BatchPoolResizeOptions, options?: ResizePoolOptionalParams): Promise<void>;
stopPoolResize(poolId: string, options?: StopPoolResizeOptionalParams): Promise<void>;
terminateJob(jobId: string, body?: BatchJobTerminateOptions, options?: TerminateJobOptionalParams): Promise<void>;
terminateJob(jobId: string, options?: TerminateJobOptionalParams): Promise<void>;
terminateJobSchedule(jobScheduleId: string, options?: TerminateJobScheduleOptionalParams): Promise<void>;
terminateTask(jobId: string, taskId: string, options?: TerminateTaskOptionalParams): Promise<void>;
updateJob(jobId: string, body: BatchJobUpdateOptions, options?: UpdateJobOptionalParams): Promise<void>;
Expand Down Expand Up @@ -817,6 +817,7 @@ export interface DisableJobScheduleOptionalParams extends OperationOptions {
// @public
export interface DisableNodeSchedulingOptionalParams extends OperationOptions {
apiVersion?: string;
body?: NodeDisableSchedulingOptions;
contentType?: string;
timeOutInSeconds?: number;
}
Expand Down Expand Up @@ -1751,6 +1752,7 @@ export interface ReactivateTaskOptionalParams extends OperationOptions {
// @public
export interface RebootNodeOptionalParams extends OperationOptions {
apiVersion?: string;
body?: NodeRebootOptions;
contentType?: string;
timeOutInSeconds?: number;
}
Expand All @@ -1764,6 +1766,7 @@ export interface RecentJob {
// @public
export interface ReimageNodeOptionalParams extends OperationOptions {
apiVersion?: string;
body?: NodeReimageOptions;
contentType?: string;
timeOutInSeconds?: number;
}
Expand Down Expand Up @@ -2082,6 +2085,7 @@ export interface TaskStatistics {
// @public
export interface TerminateJobOptionalParams extends OperationOptions {
apiVersion?: string;
body?: BatchJobTerminateOptions;
contentType?: string;
ifMatch?: string;
ifModifiedSince?: Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,8 @@ import {
batchNodeUserUpdateOptionsSerializer,
BatchNode,
batchNodeDeserializer,
NodeRebootOptions,
nodeRebootOptionsSerializer,
NodeReimageOptions,
nodeReimageOptionsSerializer,
NodeDisableSchedulingOptions,
nodeDisableSchedulingOptionsSerializer,
BatchNodeRemoteLoginSettingsResult,
batchNodeRemoteLoginSettingsResultDeserializer,
Expand Down Expand Up @@ -142,7 +139,6 @@ import {
batchJobUpdateOptionsSerializer,
BatchJobDisableOptions,
batchJobDisableOptionsSerializer,
BatchJobTerminateOptions,
batchJobTerminateOptionsSerializer,
BatchJobCreateOptions,
batchJobCreateOptionsSerializer,
Expand Down Expand Up @@ -1627,7 +1623,6 @@ export async function enableJob(
export function _terminateJobSend(
context: Client,
jobId: string,
body?: BatchJobTerminateOptions,
options: TerminateJobOptionalParams = { requestOptions: {} },
): StreamableMethod {
return context
Expand Down Expand Up @@ -1663,7 +1658,9 @@ export function _terminateJobSend(
"api-version": options?.apiVersion ?? "2023-05-01.17.0",
timeOut: options?.timeOutInSeconds,
},
body: !body ? body : batchJobTerminateOptionsSerializer(body),
body: !options["body"]
? options["body"]
: batchJobTerminateOptionsSerializer(options["body"]),
});
}

Expand All @@ -1689,10 +1686,9 @@ export async function _terminateJobDeserialize(
export async function terminateJob(
context: Client,
jobId: string,
body?: BatchJobTerminateOptions,
options: TerminateJobOptionalParams = { requestOptions: {} },
): Promise<void> {
const result = await _terminateJobSend(context, jobId, body, options);
const result = await _terminateJobSend(context, jobId, options);
return _terminateJobDeserialize(result);
}

Expand Down Expand Up @@ -3829,7 +3825,6 @@ export function _rebootNodeSend(
context: Client,
poolId: string,
nodeId: string,
body?: NodeRebootOptions,
options: RebootNodeOptionalParams = { requestOptions: {} },
): StreamableMethod {
return context
Expand All @@ -3843,7 +3838,9 @@ export function _rebootNodeSend(
"api-version": options?.apiVersion ?? "2023-05-01.17.0",
timeOut: options?.timeOutInSeconds,
},
body: !body ? body : nodeRebootOptionsSerializer(body),
body: !options["body"]
? options["body"]
: nodeRebootOptionsSerializer(options["body"]),
});
}

Expand All @@ -3863,18 +3860,16 @@ export async function rebootNode(
context: Client,
poolId: string,
nodeId: string,
body?: NodeRebootOptions,
options: RebootNodeOptionalParams = { requestOptions: {} },
): Promise<void> {
const result = await _rebootNodeSend(context, poolId, nodeId, body, options);
const result = await _rebootNodeSend(context, poolId, nodeId, options);
return _rebootNodeDeserialize(result);
}

export function _reimageNodeSend(
context: Client,
poolId: string,
nodeId: string,
body?: NodeReimageOptions,
options: ReimageNodeOptionalParams = { requestOptions: {} },
): StreamableMethod {
return context
Expand All @@ -3888,7 +3883,9 @@ export function _reimageNodeSend(
"api-version": options?.apiVersion ?? "2023-05-01.17.0",
timeOut: options?.timeOutInSeconds,
},
body: !body ? body : nodeReimageOptionsSerializer(body),
body: !options["body"]
? options["body"]
: nodeReimageOptionsSerializer(options["body"]),
});
}

Expand All @@ -3912,18 +3909,16 @@ export async function reimageNode(
context: Client,
poolId: string,
nodeId: string,
body?: NodeReimageOptions,
options: ReimageNodeOptionalParams = { requestOptions: {} },
): Promise<void> {
const result = await _reimageNodeSend(context, poolId, nodeId, body, options);
const result = await _reimageNodeSend(context, poolId, nodeId, options);
return _reimageNodeDeserialize(result);
}

export function _disableNodeSchedulingSend(
context: Client,
poolId: string,
nodeId: string,
body?: NodeDisableSchedulingOptions,
options: DisableNodeSchedulingOptionalParams = { requestOptions: {} },
): StreamableMethod {
return context
Expand All @@ -3937,7 +3932,9 @@ export function _disableNodeSchedulingSend(
"api-version": options?.apiVersion ?? "2023-05-01.17.0",
timeOut: options?.timeOutInSeconds,
},
body: !body ? body : nodeDisableSchedulingOptionsSerializer(body),
body: !options["body"]
? options["body"]
: nodeDisableSchedulingOptionsSerializer(options["body"]),
});
}

Expand All @@ -3960,14 +3957,12 @@ export async function disableNodeScheduling(
context: Client,
poolId: string,
nodeId: string,
body?: NodeDisableSchedulingOptions,
options: DisableNodeSchedulingOptionalParams = { requestOptions: {} },
): Promise<void> {
const result = await _disableNodeSchedulingSend(
context,
poolId,
nodeId,
body,
options,
);
return _disableNodeSchedulingDeserialize(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
// Licensed under the MIT License.

import { OperationOptions } from "@azure-rest/core-client";
import {
BatchJobTerminateOptions,
NodeRebootOptions,
NodeReimageOptions,
NodeDisableSchedulingOptions,
} from "../models/models.js";

/** Optional parameters. */
export interface ListApplicationsOptionalParams extends OperationOptions {
Expand Down Expand Up @@ -725,6 +731,8 @@ export interface TerminateJobOptionalParams extends OperationOptions {
ifUnmodifiedSince?: Date;
/** Type of content */
contentType?: string;
/** The options to use for terminating the Job. */
body?: BatchJobTerminateOptions;
}

/** Optional parameters. */
Expand Down Expand Up @@ -1622,6 +1630,8 @@ export interface RebootNodeOptionalParams extends OperationOptions {
timeOutInSeconds?: number;
/** Type of content */
contentType?: string;
/** The options to use for rebooting the Compute Node. */
body?: NodeRebootOptions;
}

/** Optional parameters. */
Expand All @@ -1635,6 +1645,8 @@ export interface ReimageNodeOptionalParams extends OperationOptions {
timeOutInSeconds?: number;
/** Type of content */
contentType?: string;
/** The options to use for reimaging the Compute Node. */
body?: NodeReimageOptions;
}

/** Optional parameters. */
Expand All @@ -1648,6 +1660,8 @@ export interface DisableNodeSchedulingOptionalParams extends OperationOptions {
timeOutInSeconds?: number;
/** Type of content */
contentType?: string;
/** The options to use for disabling scheduling on the Compute Node. */
body?: NodeDisableSchedulingOptions;
}

/** Optional parameters. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ import {
BatchNodeUserCreateOptions,
BatchNodeUserUpdateOptions,
BatchNode,
NodeRebootOptions,
NodeReimageOptions,
NodeDisableSchedulingOptions,
BatchNodeRemoteLoginSettingsResult,
UploadBatchServiceLogsOptions,
UploadBatchServiceLogsResult,
Expand All @@ -182,7 +179,6 @@ import {
BatchJob,
BatchJobUpdateOptions,
BatchJobDisableOptions,
BatchJobTerminateOptions,
BatchJobCreateOptions,
JobPreparationAndReleaseTaskExecutionInformation,
TaskCountsResult,
Expand Down Expand Up @@ -546,10 +542,9 @@ export class BatchClient {
*/
terminateJob(
jobId: string,
body?: BatchJobTerminateOptions,
options: TerminateJobOptionalParams = { requestOptions: {} },
): Promise<void> {
return terminateJob(this._client, jobId, body, options);
return terminateJob(this._client, jobId, options);
}

/**
Expand Down Expand Up @@ -1022,10 +1017,9 @@ export class BatchClient {
rebootNode(
poolId: string,
nodeId: string,
body?: NodeRebootOptions,
options: RebootNodeOptionalParams = { requestOptions: {} },
): Promise<void> {
return rebootNode(this._client, poolId, nodeId, body, options);
return rebootNode(this._client, poolId, nodeId, options);
}

/**
Expand All @@ -1036,10 +1030,9 @@ export class BatchClient {
reimageNode(
poolId: string,
nodeId: string,
body?: NodeReimageOptions,
options: ReimageNodeOptionalParams = { requestOptions: {} },
): Promise<void> {
return reimageNode(this._client, poolId, nodeId, body, options);
return reimageNode(this._client, poolId, nodeId, options);
}

/**
Expand All @@ -1049,10 +1042,9 @@ export class BatchClient {
disableNodeScheduling(
poolId: string,
nodeId: string,
body?: NodeDisableSchedulingOptions,
options: DisableNodeSchedulingOptionalParams = { requestOptions: {} },
): Promise<void> {
return disableNodeScheduling(this._client, poolId, nodeId, body, options);
return disableNodeScheduling(this._client, poolId, nodeId, options);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export interface ListMetricNamespacesOptionalParams extends OperationOptions {
// @public
export interface ListMetricsOptionalParams extends OperationOptions {
aggregation?: string;
body?: MetricRequestPayload;
interval?: TimeGrain;
}

Expand Down Expand Up @@ -459,7 +460,7 @@ export class LoadTestRunClient {
listMetricDefinitions(testRunId: string, metricNamespace: string, options?: ListMetricDefinitionsOptionalParams): Promise<MetricDefinitionCollection>;
listMetricDimensionValues(testRunId: string, name: string, metricname: string, metricNamespace: string, timespan: string, options?: ListMetricDimensionValuesOptionalParams): Promise<DimensionValueList>;
listMetricNamespaces(testRunId: string, options?: ListMetricNamespacesOptionalParams): Promise<MetricNamespaceCollection>;
listMetrics(testRunId: string, metricname: string, metricNamespace: string, timespan: string, body?: MetricRequestPayload, options?: ListMetricsOptionalParams): PagedAsyncIterableIterator<TimeSeriesElement>;
listMetrics(testRunId: string, metricname: string, metricNamespace: string, timespan: string, options?: ListMetricsOptionalParams): PagedAsyncIterableIterator<TimeSeriesElement>;
listTestRuns(options?: ListTestRunsOptionalParams): PagedAsyncIterableIterator<TestRun>;
readonly pipeline: Pipeline;
stopTestRun(testRunId: string, options?: StopTestRunOptionalParams): Promise<TestRun>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
metricDefinitionCollectionDeserializer,
MetricNamespaceCollection,
metricNamespaceCollectionDeserializer,
MetricRequestPayload,
metricRequestPayloadSerializer,
_Metrics,
_metricsDeserializer,
Expand Down Expand Up @@ -491,7 +490,6 @@ export function _listMetricsSend(
metricname: string,
metricNamespace: string,
timespan: string,
body?: MetricRequestPayload,
options: ListMetricsOptionalParams = { requestOptions: {} },
): StreamableMethod {
return context
Expand All @@ -505,7 +503,9 @@ export function _listMetricsSend(
metricNamespace: metricNamespace,
timespan: timespan,
},
body: !body ? body : metricRequestPayloadSerializer(body),
body: !options["body"]
? options["body"]
: metricRequestPayloadSerializer(options["body"]),
});
}

Expand All @@ -527,7 +527,6 @@ export function listMetrics(
metricname: string,
metricNamespace: string,
timespan: string,
body?: MetricRequestPayload,
options: ListMetricsOptionalParams = { requestOptions: {} },
): PagedAsyncIterableIterator<TimeSeriesElement> {
return buildPagedAsyncIterator(
Expand All @@ -539,7 +538,6 @@ export function listMetrics(
metricname,
metricNamespace,
timespan,
body,
options,
),
_listMetricsDeserialize,
Expand Down
Loading
Loading