diff --git a/.github/workflows/ci-run-test.yml b/.github/workflows/ci-run-test.yml index f882ef78d56c..62f8fdd85081 100644 --- a/.github/workflows/ci-run-test.yml +++ b/.github/workflows/ci-run-test.yml @@ -125,14 +125,6 @@ jobs: if: ${{ inputs.enable-coverage && runner.os != 'Windows' }} run: | echo "PULUMI_TEST_COVERAGE_PATH=$(pwd)/coverage" >> "$GITHUB_ENV" - # See: https://github.com/actions/virtual-environments/issues/2642#issuecomment-774988591 - - name: Configure Windows pagefile - uses: aaronfriel/action-configure-pagefile@v2.0-beta.1 - if: ${{ runner.os == 'Windows' }} - with: - minimum-size: 4GB - maximum-size: 4GB - disk-root: "D:" - name: Configure Go Cache Key env: CACHE_KEY: "${{ fromJson(inputs.version-set).go }}-${{ runner.os }}-${{ runner.arch }}" diff --git a/changelog/pending/20221205--sdk--add-methods-to-cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml b/changelog/pending/20221205--sdk--add-methods-to-cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml new file mode 100644 index 000000000000..98064d91c897 --- /dev/null +++ b/changelog/pending/20221205--sdk--add-methods-to-cast-pointer-types-to-corresponding-pulumi-ptr-types.yaml @@ -0,0 +1,4 @@ +changes: +- type: feat + scope: sdk + description: Add methods to cast pointer types to corresponding Pulumi Ptr types diff --git a/sdk/go/pulumi/generate/templates/types_builtins.go.template b/sdk/go/pulumi/generate/templates/types_builtins.go.template index 0777ad28c864..5ac68f4f2a83 100644 --- a/sdk/go/pulumi/generate/templates/types_builtins.go.template +++ b/sdk/go/pulumi/generate/templates/types_builtins.go.template @@ -47,6 +47,12 @@ type {{.PtrType}} {{.ElemElementType}} func {{.Name}}(v {{.ElemElementType}}) {{.Name}}Input { return ({{.InputType}})(&v) } +func {{.Name}}FromPtr(v *{{.ElemElementType}}) {{.Name}}Input { + if v == nil { + return nil + } + return ({{.InputType}})(v) +} {{end}} {{if .DefineInputMethods}} // ElementType returns the element type of this Input ({{.ElementType}}). diff --git a/sdk/go/pulumi/types_builtins.go b/sdk/go/pulumi/types_builtins.go index f276ce12e3e3..868c49c4ecbd 100644 --- a/sdk/go/pulumi/types_builtins.go +++ b/sdk/go/pulumi/types_builtins.go @@ -1378,6 +1378,12 @@ type boolPtr bool func BoolPtr(v bool) BoolPtrInput { return (*boolPtr)(&v) } +func BoolPtrFromPtr(v *bool) BoolPtrInput { + if v == nil { + return nil + } + return (*boolPtr)(v) +} // ElementType returns the element type of this Input (*bool). func (*boolPtr) ElementType() reflect.Type { @@ -1909,6 +1915,12 @@ type float64Ptr float64 func Float64Ptr(v float64) Float64PtrInput { return (*float64Ptr)(&v) } +func Float64PtrFromPtr(v *float64) Float64PtrInput { + if v == nil { + return nil + } + return (*float64Ptr)(v) +} // ElementType returns the element type of this Input (*float64). func (*float64Ptr) ElementType() reflect.Type { @@ -2455,6 +2467,12 @@ type idPtr ID func IDPtr(v ID) IDPtrInput { return (*idPtr)(&v) } +func IDPtrFromPtr(v *ID) IDPtrInput { + if v == nil { + return nil + } + return (*idPtr)(v) +} // ElementType returns the element type of this Input (*ID). func (*idPtr) ElementType() reflect.Type { @@ -3462,6 +3480,12 @@ type intPtr int func IntPtr(v int) IntPtrInput { return (*intPtr)(&v) } +func IntPtrFromPtr(v *int) IntPtrInput { + if v == nil { + return nil + } + return (*intPtr)(v) +} // ElementType returns the element type of this Input (*int). func (*intPtr) ElementType() reflect.Type { @@ -3993,6 +4017,12 @@ type stringPtr string func StringPtr(v string) StringPtrInput { return (*stringPtr)(&v) } +func StringPtrFromPtr(v *string) StringPtrInput { + if v == nil { + return nil + } + return (*stringPtr)(v) +} // ElementType returns the element type of this Input (*string). func (*stringPtr) ElementType() reflect.Type { @@ -4539,6 +4569,12 @@ type urnPtr URN func URNPtr(v URN) URNPtrInput { return (*urnPtr)(&v) } +func URNPtrFromPtr(v *URN) URNPtrInput { + if v == nil { + return nil + } + return (*urnPtr)(v) +} // ElementType returns the element type of this Input (*URN). func (*urnPtr) ElementType() reflect.Type {