Pulumi.FSharp.Extensions
Pulumi.FSharp.Extensions copied to clipboard
CustomResourceOptions CE
This PR adds:
-
CustomResourceOptions
CE inPulumi.FSharp.Core
This is just a hard-coded CE for the Pulumi type (also includes CE forCustomTimeouts
) -
Yield
operation in the resources CEs
I've managed to avoid breaking changes and kept the existing dependsOn
operation, which will overwrite that property on the passed customResourceOptions
. I also added a deprecation notice in the comments.
Here is an example of a generated code:
namespace Pulumi.FSharp
open Pulumi.FSharp
open Pulumi
module Docker =
open Pulumi.Docker
let _combine ((rName, rArgs), (lName, lArgs)) =
(match lName, rName with
| null, null -> null
| null, name -> name
| name, null -> name
| _ -> failwith "Duplicate name"),
(List.concat [ lArgs; rArgs ])
let _combineCros ((rName, rArgs, rCros, rCroI), (lName, lArgs, lCros, lCroI)) =
(match lName, rName with
| null, null -> null
| null, name -> name
| name, null -> name
| _ -> failwith "DuplicateName"),
(List.concat [ lArgs; rArgs ]),
(List.concat [ lCros; rCros ]),
(match lCroI, rCroI with
| null, null -> null
| null, croi -> croi
| croi, null -> croi
| _ -> failwith "DuplicateCroI")
type ImageBuilder() =
member _.Yield(_: unit) = null, [ id ], [ id ], null
member _.Run(name, args, cros, croI) =
Image(
name,
List.fold (fun args f -> f args) (ImageArgs()) args,
List.fold
(fun cros f -> f cros)
(match croI with
| null -> CustomResourceOptions()
| croI -> croI)
cros
)
member this.Combine(args) = _combineCros args
member this.For(args, delayedArgs) = this.Combine(args, delayedArgs ())
member _.Delay(f) = f ()
member _.Zero _ = ()
///Pulumi logical resource name
[<CustomOperation("name")>]
member _.Name((_, args, cros, croI), newName) = newName, args, cros, croI
member _.Yield(arg) =
null,
[ (let func (args: ImageArgs) =
args.Build <- input arg
args
()
func) ],
[ id ],
null
///The image name, of the format repository[:tag], e.g. `docker.io/username/demo-image:v1`.
///This reference is not unique to each build and push.For the unique manifest SHA of a pushed docker image, or the local image ID, please use `repoDigest`.
[<CustomOperation("imageName")>]
member _.ImageName((name, args, cros, croI), imageName) =
name,
List.Cons(
(fun (args: ImageArgs) ->
args.ImageName <- input imageName
args),
args
),
cros,
croI
///The image name, of the format repository[:tag], e.g. `docker.io/username/demo-image:v1`.
///This reference is not unique to each build and push.For the unique manifest SHA of a pushed docker image, or the local image ID, please use `repoDigest`.
member _.ImageName((name, args, cros, croI), imageName) =
name,
List.Cons(
(fun (args: ImageArgs) ->
args.ImageName <- io imageName
args),
args
),
cros,
croI
member _.Yield(arg) =
null,
[ (let func (args: ImageArgs) =
args.Registry <- input arg
args
()
func) ],
[ id ],
null
///A flag to skip a registry push.
[<CustomOperation("skipPush")>]
member _.SkipPush((name, args, cros, croI), skipPush) =
name,
List.Cons(
(fun (args: ImageArgs) ->
args.SkipPush <- input skipPush
args),
args
),
cros,
croI
///A flag to skip a registry push.
member _.SkipPush((name, args, cros, croI), skipPush) =
name,
List.Cons(
(fun (args: ImageArgs) ->
args.SkipPush <- io skipPush
args),
args
),
cros,
croI
///Obsolete. Use customResourceOptions nested CE. Ensure this resource gets created after its dependency
[<CustomOperation("dependsOn")>]
member _.DependsOn((name, args, cros, croI), dependency) =
name,
args,
List.Cons(
(fun (cros: CustomResourceOptions) ->
cros.DependsOn <- inputList [ input dependency ]
cros),
cros
),
croI
///Obsolete. Use customResourceOptions nested CE. Ensure this resource gets created after its dependency
member _.DependsOn((name, args, cros, croI), dependency) =
name,
args,
List.Cons(
(fun (cros: CustomResourceOptions) ->
cros.DependsOn <- inputList (Seq.map input dependency)
cros),
cros
),
croI
member _.Yield(croI: CustomResourceOptions) = null, [ id ], [ id ], croI
///`Image` builds a Docker image and pushes it Docker and OCI compatible registries.
///
///*** Operations ***
///
/// - imageName
///
/// - skipPush
///
///
///
///*** Nested computational expressions ***
///
/// - dockerBuild
///
/// - registry
let image = ImageBuilder()
Friendly reminder 🙂
hi @UnoSD Hope you are fine. Would you have time for reviewing this thing?
Hi @mvsmal, apologies, I forgot this one was open. I will be insanely busy for the rest of Feb, but I'll put this on top of my list for the beginning of March.
hi @mvsmal, thank you for the patience and apologies again. Thing are getting quieter now, so I will try and have a look; by any chance, do you have example code that I can add to the test project to test all the operations in the change? thanks