createScalingPlan method

Future<CreateScalingPlanResponse> createScalingPlan({
  1. required ApplicationSource applicationSource,
  2. required List<ScalingInstruction> scalingInstructions,
  3. required String scalingPlanName,
})

Creates a scaling plan.

May throw ValidationException. May throw LimitExceededException. May throw ConcurrentUpdateException. May throw InternalServiceException.

Parameter applicationSource : A CloudFormation stack or set of tags. You can create one scaling plan per application source.

Parameter scalingInstructions : The scaling instructions.

Parameter scalingPlanName : The name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes.

Implementation

Future<CreateScalingPlanResponse> createScalingPlan({
  required ApplicationSource applicationSource,
  required List<ScalingInstruction> scalingInstructions,
  required String scalingPlanName,
}) async {
  ArgumentError.checkNotNull(applicationSource, 'applicationSource');
  ArgumentError.checkNotNull(scalingInstructions, 'scalingInstructions');
  ArgumentError.checkNotNull(scalingPlanName, 'scalingPlanName');
  _s.validateStringLength(
    'scalingPlanName',
    scalingPlanName,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AnyScaleScalingPlannerFrontendService.CreateScalingPlan'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ApplicationSource': applicationSource,
      'ScalingInstructions': scalingInstructions,
      'ScalingPlanName': scalingPlanName,
    },
  );

  return CreateScalingPlanResponse.fromJson(jsonResponse.body);
}