private void loadParams()

in src/main/java/ScalingClient.java [93:153]


	private void loadParams() throws Exception {
		if (System.getProperty(STREAM_PARAM) == null) {
			throw new Exception("You must provide a Stream Name");
		} else {
			this.streamName = System.getProperty(STREAM_PARAM);
		}

		this.shardId = System.getProperty(SHARD_ID_PARAM);

		if (System.getProperty(ACTION_PARAM) == null) {
			throw new Exception("You must provide a Scaling Action");
		} else {
			this.scalingAction = ScalingAction.valueOf(System.getProperty(ACTION_PARAM));

			// ensure the action is one of the supported types for shards
			if (this.shardId != null && !(this.scalingAction.equals(StreamScaler.ScalingAction.split)
					|| this.scalingAction.equals(StreamScaler.ScalingAction.merge))) {
				throw new Exception("Can only Split or Merge Shards");
			}
		}

		if (System.getProperty(REGION_PARAM) != null) {
			this.region = Region.of(System.getProperty(REGION_PARAM));
		}

		if (System.getProperty(WAIT_FOR_COMPLETION) != null) {
			this.doWait = Boolean.parseBoolean(System.getProperty(WAIT_FOR_COMPLETION));
		}

		if (this.scalingAction != ScalingAction.report) {
			if (System.getProperty(SCALE_COUNT_PARAM) == null && System.getProperty(SCALE_PCT_PARAM) == null)
				throw new Exception("You must provide either a scaling Count or Percentage");

			if (System.getProperty(SCALE_COUNT_PARAM) != null && System.getProperty(SCALE_PCT_PARAM) != null)
				throw new Exception("You must provide either a scaling Count or Percentage but not both");

			if (this.shardId != null && System.getProperty(SCALE_COUNT_PARAM) == null) {
				throw new Exception("Shards must be scaled by an absolute number only");
			}

			if (System.getProperty(SCALE_COUNT_PARAM) != null) {
				this.scaleCount = Integer.parseInt(System.getProperty(SCALE_COUNT_PARAM));
				this.scaleBy = StreamScaler.ScaleBy.count;
			}

			if (System.getProperty(SCALE_PCT_PARAM) != null) {
				this.scalePct = Double.parseDouble(System.getProperty(SCALE_PCT_PARAM));
				this.scaleBy = StreamScaler.ScaleBy.pct;
			}

			if (System.getProperty(MIN_SHARDS_PARAM) != null) {
				this.minShards = Integer.parseInt(System.getProperty(MIN_SHARDS_PARAM));
			}

			if (System.getProperty(MAX_SHARDS_PARAM) != null) {
				this.maxShards = Integer.parseInt(System.getProperty(MAX_SHARDS_PARAM));
			}
		}

		scaler = new StreamScaler(this.region);
	}