Skip to content

Commit

Permalink
Revert "remove removable stuff"
Browse files Browse the repository at this point in the history
This reverts commit f923a6c.
  • Loading branch information
outscale-mgo committed Oct 31, 2023
1 parent 63be21e commit 135b911
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 22,014 deletions.
1 change: 1 addition & 0 deletions provider/cmd/pulumi-resource-outscale/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
schema.go
63 changes: 63 additions & 0 deletions provider/cmd/pulumi-resource-outscale/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build ignore

package main

import (
"encoding/json"
"errors"
"io/fs"
"io/ioutil"
"log"
"os"

"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
)

func main() {
version, found := os.LookupEnv("VERSION")
if !found {
log.Fatal("version not found")
}

schemaContents, err := ioutil.ReadFile("./schema.json")
if err != nil {
log.Fatal(err)
}

var packageSpec schema.PackageSpec
err = json.Unmarshal(schemaContents, &packageSpec)
if err != nil {
log.Fatalf("cannot deserialize schema: %v", err)
}

packageSpec.Version = version
versionedContents, err := json.Marshal(packageSpec)
if err != nil {
log.Fatalf("cannot reserialize schema: %v", err)
}

// Clean up schema.go as it may be present & gitignored and tolerate an error if the file isn't present.
err = os.Remove("./schema.go")
if err != nil && !errors.Is(err, fs.ErrNotExist) {
log.Fatal(err)
}

err = ioutil.WriteFile("./schema-embed.json", versionedContents, 0600)
if err != nil {
log.Fatal(err)
}
}
33 changes: 33 additions & 0 deletions provider/cmd/pulumi-resource-outscale/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate go run ./generate.go

package main

import (
_ "embed"

"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
outscale "github.com/outscale/pulumi-outscale/provider"
"github.com/outscale/pulumi-outscale/provider/pkg/version"
)

//go:embed schema-embed.json
var pulumiSchema []byte

func main() {
// Modify the path to point to the new provider
tfbridge.Main("outscale", version.Version, outscale.Provider(), pulumiSchema)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
schema.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build ignore

package main

import (
"encoding/json"
"errors"
"io/fs"
"io/ioutil"
"log"
"os"

"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
)

func main() {
version, found := os.LookupEnv("VERSION")
if !found {
log.Fatal("version not found")
}

schemaContents, err := ioutil.ReadFile("./schema.json")
if err != nil {
log.Fatal(err)
}

var packageSpec schema.PackageSpec
err = json.Unmarshal(schemaContents, &packageSpec)
if err != nil {
log.Fatalf("cannot deserialize schema: %v", err)
}

packageSpec.Version = version
versionedContents, err := json.Marshal(packageSpec)
if err != nil {
log.Fatalf("cannot reserialize schema: %v", err)
}

// Clean up schema.go as it may be present & gitignored and tolerate an error if the file isn't present.
err = os.Remove("./schema.go")
if err != nil && !errors.Is(err, fs.ErrNotExist) {
log.Fatal(err)
}

err = ioutil.WriteFile("./schema-embed.json", versionedContents, 0600)
if err != nil {
log.Fatal(err)
}
}
33 changes: 33 additions & 0 deletions provider/cmd/pulumi-resource-outscale/pulumi-resource-xyz/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate go run ./generate.go

package main

import (
_ "embed"

"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
outscale "github.com/outscale/pulumi-outscale/provider"
"github.com/outscale/pulumi-outscale/provider/pkg/version"
)

//go:embed schema-embed.json
var pulumiSchema []byte

func main() {
// Modify the path to point to the new provider
tfbridge.Main("outscale", version.Version, outscale.Provider(), pulumiSchema)
}
Loading

0 comments on commit 135b911

Please sign in to comment.