This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
generated from pulumi/pulumi-tf-provider-boilerplate
/
getIpBlockRanges.go
156 lines (134 loc) · 6.5 KB
/
getIpBlockRanges.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// *** 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 equinix
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this datasource to get CIDR expressions for allocated IP blocks of all the types in a project, optionally filtered by facility or metro.
//
// There are four types of IP blocks in Equinix Metal: global IPv4, public IPv4, private IPv4 and IPv6. Both global and public IPv4 are routable from the Internet. Public IPv4 blocks are allocated in a facility or metro, and addresses from it can only be assigned to devices in that location. Addresses from Global IPv4 block can be assigned to a device in any metro.
//
// The datasource has 4 list attributes: `globalIpv4`, `publicIpv4`, `privateIpv4` and `ipv6`, each listing CIDR notation (`<network>/<mask>`) of respective blocks from the project.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-equinix-metal/sdk/v3/go/equinix-metal"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// projectId := "<UUID_of_your_project>"
// test, err := equinix - metal.GetIpBlockRanges(ctx, &GetIpBlockRangesArgs{
// ProjectId: projectId,
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("out", test)
// return nil
// })
// }
// ```
func GetIpBlockRanges(ctx *pulumi.Context, args *GetIpBlockRangesArgs, opts ...pulumi.InvokeOption) (*GetIpBlockRangesResult, error) {
var rv GetIpBlockRangesResult
err := ctx.Invoke("equinix-metal:index/getIpBlockRanges:getIpBlockRanges", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getIpBlockRanges.
type GetIpBlockRangesArgs struct {
// Facility code filtering the IP blocks. Global IPv4 blcoks will be listed anyway. If you omit this and metro, all the block from the project will be listed.
Facility *string `pulumi:"facility"`
// Metro code filtering the IP blocks. Global IPv4 blcoks will be listed anyway. If you omit this and facility, all the block from the project will be listed.
Metro *string `pulumi:"metro"`
// ID of the project from which to list the blocks.
ProjectId string `pulumi:"projectId"`
}
// A collection of values returned by getIpBlockRanges.
type GetIpBlockRangesResult struct {
Facility *string `pulumi:"facility"`
// list of CIDR expressions for Global IPv4 blocks in the project
GlobalIpv4s []string `pulumi:"globalIpv4s"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// list of CIDR expressions for IPv6 blocks in the project
Ipv6s []string `pulumi:"ipv6s"`
Metro *string `pulumi:"metro"`
// list of CIDR expressions for Private IPv4 blocks in the project
PrivateIpv4s []string `pulumi:"privateIpv4s"`
ProjectId string `pulumi:"projectId"`
// list of CIDR expressions for Public IPv4 blocks in the project
PublicIpv4s []string `pulumi:"publicIpv4s"`
}
func GetIpBlockRangesOutput(ctx *pulumi.Context, args GetIpBlockRangesOutputArgs, opts ...pulumi.InvokeOption) GetIpBlockRangesResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetIpBlockRangesResult, error) {
args := v.(GetIpBlockRangesArgs)
r, err := GetIpBlockRanges(ctx, &args, opts...)
return *r, err
}).(GetIpBlockRangesResultOutput)
}
// A collection of arguments for invoking getIpBlockRanges.
type GetIpBlockRangesOutputArgs struct {
// Facility code filtering the IP blocks. Global IPv4 blcoks will be listed anyway. If you omit this and metro, all the block from the project will be listed.
Facility pulumi.StringPtrInput `pulumi:"facility"`
// Metro code filtering the IP blocks. Global IPv4 blcoks will be listed anyway. If you omit this and facility, all the block from the project will be listed.
Metro pulumi.StringPtrInput `pulumi:"metro"`
// ID of the project from which to list the blocks.
ProjectId pulumi.StringInput `pulumi:"projectId"`
}
func (GetIpBlockRangesOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetIpBlockRangesArgs)(nil)).Elem()
}
// A collection of values returned by getIpBlockRanges.
type GetIpBlockRangesResultOutput struct{ *pulumi.OutputState }
func (GetIpBlockRangesResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetIpBlockRangesResult)(nil)).Elem()
}
func (o GetIpBlockRangesResultOutput) ToGetIpBlockRangesResultOutput() GetIpBlockRangesResultOutput {
return o
}
func (o GetIpBlockRangesResultOutput) ToGetIpBlockRangesResultOutputWithContext(ctx context.Context) GetIpBlockRangesResultOutput {
return o
}
func (o GetIpBlockRangesResultOutput) Facility() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) *string { return v.Facility }).(pulumi.StringPtrOutput)
}
// list of CIDR expressions for Global IPv4 blocks in the project
func (o GetIpBlockRangesResultOutput) GlobalIpv4s() pulumi.StringArrayOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) []string { return v.GlobalIpv4s }).(pulumi.StringArrayOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetIpBlockRangesResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) string { return v.Id }).(pulumi.StringOutput)
}
// list of CIDR expressions for IPv6 blocks in the project
func (o GetIpBlockRangesResultOutput) Ipv6s() pulumi.StringArrayOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) []string { return v.Ipv6s }).(pulumi.StringArrayOutput)
}
func (o GetIpBlockRangesResultOutput) Metro() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) *string { return v.Metro }).(pulumi.StringPtrOutput)
}
// list of CIDR expressions for Private IPv4 blocks in the project
func (o GetIpBlockRangesResultOutput) PrivateIpv4s() pulumi.StringArrayOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) []string { return v.PrivateIpv4s }).(pulumi.StringArrayOutput)
}
func (o GetIpBlockRangesResultOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) string { return v.ProjectId }).(pulumi.StringOutput)
}
// list of CIDR expressions for Public IPv4 blocks in the project
func (o GetIpBlockRangesResultOutput) PublicIpv4s() pulumi.StringArrayOutput {
return o.ApplyT(func(v GetIpBlockRangesResult) []string { return v.PublicIpv4s }).(pulumi.StringArrayOutput)
}
func init() {
pulumi.RegisterOutputType(GetIpBlockRangesResultOutput{})
}