2020-04-21 01:36:05 +02:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
package python
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
2021-03-17 14:20:05 +01:00
|
|
|
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
|
2020-04-21 01:36:05 +02:00
|
|
|
)
|
|
|
|
|
2020-06-10 22:55:10 +02:00
|
|
|
// Compatibility mode for Kubernetes 2.0 SDK
|
|
|
|
const kubernetes20 = "kubernetes20"
|
|
|
|
|
2021-04-16 04:03:28 +02:00
|
|
|
// Compatibility mode for tfbridge 2.x SDKs
|
|
|
|
const tfbridge20 = "tfbridge20"
|
|
|
|
|
2020-04-21 01:36:05 +02:00
|
|
|
// PropertyInfo tracks Python-specific information associated with properties in a package.
|
|
|
|
type PropertyInfo struct {
|
|
|
|
MapCase bool `json:"mapCase,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// PackageInfo tracks Python-specific information associated with a package.
|
|
|
|
type PackageInfo struct {
|
|
|
|
Requires map[string]string `json:"requires,omitempty"`
|
2020-06-08 22:07:56 +02:00
|
|
|
// Readme contains the text for the package's README.md files.
|
|
|
|
Readme string `json:"readme,omitempty"`
|
2020-06-09 23:33:02 +02:00
|
|
|
// Optional overrides for Pulumi module names
|
|
|
|
//
|
|
|
|
// { "flowcontrol.apiserver.k8s.io/v1alpha1": "flowcontrol/v1alpha1" }
|
|
|
|
//
|
|
|
|
ModuleNameOverrides map[string]string `json:"moduleNameOverrides,omitempty"`
|
2020-06-10 22:55:10 +02:00
|
|
|
// Toggle compatibility mode for a specified target.
|
|
|
|
Compatibility string `json:"compatibility,omitempty"`
|
2020-11-25 02:15:37 +01:00
|
|
|
// Deprecated: This bool is no longer needed since all providers now use input/output classes.
|
2020-08-07 00:09:23 +02:00
|
|
|
UsesIOClasses bool `json:"usesIOClasses,omitempty"`
|
2020-12-04 04:22:16 +01:00
|
|
|
// Indicates whether the pulumiplugin.json file should be generated.
|
|
|
|
EmitPulumiPluginFile bool `json:"emitPulumiPluginFile,omitempty"`
|
2020-04-21 01:36:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Importer implements schema.Language for Python.
|
|
|
|
var Importer schema.Language = importer(0)
|
|
|
|
|
|
|
|
type importer int
|
|
|
|
|
|
|
|
// ImportDefaultSpec decodes language-specific metadata associated with a DefaultValue.
|
|
|
|
func (importer) ImportDefaultSpec(def *schema.DefaultValue, raw json.RawMessage) (interface{}, error) {
|
|
|
|
return raw, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ImportPropertySpec decodes language-specific metadata associated with a Property.
|
|
|
|
func (importer) ImportPropertySpec(property *schema.Property, raw json.RawMessage) (interface{}, error) {
|
|
|
|
var info PropertyInfo
|
|
|
|
if err := json.Unmarshal([]byte(raw), &info); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return info, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ImportObjectTypeSpec decodes language-specific metadata associated with a ObjectType.
|
|
|
|
func (importer) ImportObjectTypeSpec(object *schema.ObjectType, raw json.RawMessage) (interface{}, error) {
|
|
|
|
return raw, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ImportResourceSpec decodes language-specific metadata associated with a Resource.
|
|
|
|
func (importer) ImportResourceSpec(resource *schema.Resource, raw json.RawMessage) (interface{}, error) {
|
|
|
|
return raw, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ImportFunctionSpec decodes language-specific metadata associated with a Function.
|
|
|
|
func (importer) ImportFunctionSpec(function *schema.Function, raw json.RawMessage) (interface{}, error) {
|
|
|
|
return raw, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ImportPackageSpec decodes language-specific metadata associated with a Package.
|
|
|
|
func (importer) ImportPackageSpec(pkg *schema.Package, raw json.RawMessage) (interface{}, error) {
|
|
|
|
var info PackageInfo
|
|
|
|
if err := json.Unmarshal([]byte(raw), &info); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return info, nil
|
|
|
|
}
|