/
provider.go
72 lines (64 loc) · 2.52 KB
/
provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package rabbitmq
import (
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// The provider type for the rabbitmq package. By default, resources use package-wide configuration
// settings, however an explicit `Provider` instance may be created and passed during resource
// construction to achieve fine-grained programmatic control over provider settings. See the
// [documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.
type Provider struct {
pulumi.ProviderResourceState
}
// NewProvider registers a new resource with the given unique name, arguments, and options.
func NewProvider(ctx *pulumi.Context,
name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
if args == nil {
args = &ProviderArgs{}
}
if args.CacertFile == nil {
args.CacertFile = pulumi.StringPtr(getEnvOrDefault("", nil, "RABBITMQ_CACERT").(string))
}
if args.Endpoint == nil {
args.Endpoint = pulumi.StringPtr(getEnvOrDefault("", nil, "RABBITMQ_ENDPOINT").(string))
}
if args.Insecure == nil {
args.Insecure = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "RABBITMQ_INSECURE").(bool))
}
if args.Password == nil {
args.Password = pulumi.StringPtr(getEnvOrDefault("", nil, "RABBITMQ_PASSWORD").(string))
}
if args.Username == nil {
args.Username = pulumi.StringPtr(getEnvOrDefault("", nil, "RABBITMQ_USERNAME").(string))
}
var resource Provider
err := ctx.RegisterResource("pulumi:providers:rabbitmq", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type providerArgs struct {
CacertFile *string `pulumi:"cacertFile"`
ClientcertFile *string `pulumi:"clientcertFile"`
ClientkeyFile *string `pulumi:"clientkeyFile"`
Endpoint *string `pulumi:"endpoint"`
Insecure *bool `pulumi:"insecure"`
Password *string `pulumi:"password"`
Username *string `pulumi:"username"`
}
// The set of arguments for constructing a Provider resource.
type ProviderArgs struct {
CacertFile pulumi.StringPtrInput
ClientcertFile pulumi.StringPtrInput
ClientkeyFile pulumi.StringPtrInput
Endpoint pulumi.StringPtrInput
Insecure pulumi.BoolPtrInput
Password pulumi.StringPtrInput
Username pulumi.StringPtrInput
}
func (ProviderArgs) ElementType() reflect.Type {
return reflect.TypeOf((*providerArgs)(nil)).Elem()
}