@@ -6,6 +6,8 @@ open Propulsion.Tool.Args
66open Serilog
77open System
88
9+ module CosmosInit = Equinox.CosmosStore.Core.Initialization
10+
911[<NoEquality; NoComparison>]
1012type Parameters =
1113 | [<AltCommandLine( " -V" ) >] Verbose
@@ -36,18 +38,17 @@ and [<NoComparison; NoEquality>] InitAuxParameters =
3638 | Mode _ -> " Configure RU mode to use Container-level RU, Database-level RU, or Serverless allocations (Default: Use Container-level allocation)."
3739 | Suffix _ -> " Specify Container Name suffix (default: `-aux`)."
3840 | Cosmos _ -> " Cosmos Connection parameters."
39-
40- and CosmosInitInfo ( p : ParseResults < InitAuxParameters >) =
41- let throughputSpec =
42- if p.Contains Autoscale then Equinox.CosmosStore.Core.Initialization.Throughput.Autoscale ( p.GetResult( Rus, 4000 ))
43- else Equinox.CosmosStore.Core.Initialization.Throughput.Manual ( p.GetResult( Rus, 400 ))
41+ and CosmosModeType = Container | Db | Serverless
42+ and CosmosInitArguments ( p : ParseResults < InitAuxParameters >) =
43+ let rusOrDefault value = p.GetResult( Rus, value)
44+ let throughput auto = if auto then CosmosInit.Throughput.Autoscale ( rusOrDefault 4000 ) else CosmosInit.Throughput.Manual ( rusOrDefault 400 )
4445 member val ProvisioningMode =
45- match p.GetResult( Mode, CosmosModeType.Container) with
46- | CosmosModeType.Container -> Equinox.CosmosStore.Core.Initialization. Provisioning.Container throughputSpec
47- | CosmosModeType.Db -> Equinox.CosmosStore.Core.Initialization. Provisioning.Database throughputSpec
48- | CosmosModeType.Serverless ->
49- if p.Contains Rus || p.Contains Autoscale then missingArg " Cannot specify RU/s or Autoscale in Serverless mode "
50- Equinox.CosmosStore.Core.Initialization.Provisioning.Serverless
46+ match p.GetResult( Mode, CosmosModeType.Container), p.Contains Autoscale with
47+ | CosmosModeType.Container, auto -> CosmosInit. Provisioning.Container ( throughput auto )
48+ | CosmosModeType.Db, auto -> CosmosInit. Provisioning.Database ( throughput auto )
49+ | CosmosModeType.Serverless, auto when auto || p.Contains Rus -> missingArg " Cannot specify RU/s or Autoscale in Serverless mode "
50+ | CosmosModeType.Serverless , _ -> CosmosInit.Provisioning. Serverless
51+
5152and [<NoEquality; NoComparison>] CheckpointParameters =
5253 | [<AltCommandLine " -s" ; Mandatory>] Source of Propulsion.Feed.SourceId
5354 | [<AltCommandLine " -t" ; Mandatory>] Tranche of Propulsion.Feed.TrancheId
@@ -99,7 +100,6 @@ and [<NoComparison; NoEquality>] StatsParameters =
99100 member a.Usage = a |> function
100101 | Cosmos _ -> " Specify CosmosDB parameters."
101102 | Dynamo _ -> " Specify DynamoDB parameters."
102- and CosmosModeType = Container | Db | Serverless
103103
104104let [<Literal>] appName = " propulsion-tool"
105105
@@ -108,8 +108,7 @@ module CosmosInit =
108108 let aux ( c , p : ParseResults < InitAuxParameters >) =
109109 match p.GetSubCommand() with
110110 | InitAuxParameters.Cosmos sa ->
111- let a = Args.Cosmos.Arguments( c, sa)
112- let mode = ( CosmosInitInfo p) .ProvisioningMode
111+ let mode , a = ( CosmosInitArguments p) .ProvisioningMode, Args.Cosmos.Arguments( c, sa)
113112 let client = a.ConnectLeases()
114113 match mode with
115114 | Equinox.CosmosStore.Core.Initialization.Provisioning.Container throughput ->
0 commit comments