Fortios v0.0.5 published on Tuesday, Apr 9, 2024 by pulumiverse
fortios.ipmask.getCidr
Explore with Pulumi AI
Convert IP/Mask to CIDR
Example Usage
Example1
import * as pulumi from "@pulumi/pulumi";
import * as fortios from "@pulumi/fortios";
const trnameInterface = fortios.system.getInterface({
name: "port3",
});
const trnameCidr = trnameInterface.then(trnameInterface => fortios.ipmask.getCidr({
ipmask: trnameInterface.ip,
}));
export const output1 = trnameCidr.then(trnameCidr => trnameCidr.cidr);
import pulumi
import pulumi_fortios as fortios
trname_interface = fortios.system.get_interface(name="port3")
trname_cidr = fortios.ipmask.get_cidr(ipmask=trname_interface.ip)
pulumi.export("output1", trname_cidr.cidr)
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-fortios/sdk/go/fortios/ipmask"
"github.com/pulumiverse/pulumi-fortios/sdk/go/fortios/system"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
trnameInterface, err := system.LookupInterface(ctx, &system.LookupInterfaceArgs{
Name: "port3",
}, nil)
if err != nil {
return err
}
trnameCidr, err := ipmask.GetCidr(ctx, &ipmask.GetCidrArgs{
Ipmask: pulumi.StringRef(trnameInterface.Ip),
}, nil)
if err != nil {
return err
}
ctx.Export("output1", trnameCidr.Cidr)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Fortios = Pulumi.Fortios;
return await Deployment.RunAsync(() =>
{
var trnameInterface = Fortios.System.GetInterface.Invoke(new()
{
Name = "port3",
});
var trnameCidr = Fortios.Ipmask.GetCidr.Invoke(new()
{
Ipmask = trnameInterface.Apply(getInterfaceResult => getInterfaceResult.Ip),
});
return new Dictionary<string, object?>
{
["output1"] = trnameCidr.Apply(getCidrResult => getCidrResult.Cidr),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.fortios.system.SystemFunctions;
import com.pulumi.fortios.system.inputs.GetInterfaceArgs;
import com.pulumi.fortios.ipmask.IpmaskFunctions;
import com.pulumi.fortios.ipmask.inputs.GetCidrArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var trnameInterface = SystemFunctions.getInterface(GetInterfaceArgs.builder()
.name("port3")
.build());
final var trnameCidr = IpmaskFunctions.getCidr(GetCidrArgs.builder()
.ipmask(trnameInterface.applyValue(getInterfaceResult -> getInterfaceResult.ip()))
.build());
ctx.export("output1", trnameCidr.applyValue(getCidrResult -> getCidrResult.cidr()));
}
}
variables:
trnameInterface:
fn::invoke:
Function: fortios:system:getInterface
Arguments:
name: port3
trnameCidr:
fn::invoke:
Function: fortios:ipmask:getCidr
Arguments:
ipmask: ${trnameInterface.ip}
outputs:
output1: ${trnameCidr.cidr}
Example2
import * as pulumi from "@pulumi/pulumi";
import * as fortios from "@pulumi/fortios";
const trnameInterface = fortios.system.getInterface({
name: "port3",
});
const trnameCidr = trnameInterface.then(trnameInterface => fortios.ipmask.getCidr({
ipmask: trnameInterface.ip,
ipmasklists: [
"21.1.1.1 255.255.255.0",
"22.1.1.1 255.255.255.240",
"23.1.1.1 255.255.255.224",
],
}));
export const outputConv1 = trnameCidr.then(trnameCidr => trnameCidr.cidr);
export const outputConv2 = trnameCidr.then(trnameCidr => trnameCidr.cidrlists);
export const outputOrignal = trnameInterface.then(trnameInterface => trnameInterface.ip);
import pulumi
import pulumi_fortios as fortios
trname_interface = fortios.system.get_interface(name="port3")
trname_cidr = fortios.ipmask.get_cidr(ipmask=trname_interface.ip,
ipmasklists=[
"21.1.1.1 255.255.255.0",
"22.1.1.1 255.255.255.240",
"23.1.1.1 255.255.255.224",
])
pulumi.export("outputConv1", trname_cidr.cidr)
pulumi.export("outputConv2", trname_cidr.cidrlists)
pulumi.export("outputOrignal", trname_interface.ip)
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-fortios/sdk/go/fortios/ipmask"
"github.com/pulumiverse/pulumi-fortios/sdk/go/fortios/system"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
trnameInterface, err := system.LookupInterface(ctx, &system.LookupInterfaceArgs{
Name: "port3",
}, nil)
if err != nil {
return err
}
trnameCidr, err := ipmask.GetCidr(ctx, &ipmask.GetCidrArgs{
Ipmask: pulumi.StringRef(trnameInterface.Ip),
Ipmasklists: []string{
"21.1.1.1 255.255.255.0",
"22.1.1.1 255.255.255.240",
"23.1.1.1 255.255.255.224",
},
}, nil)
if err != nil {
return err
}
ctx.Export("outputConv1", trnameCidr.Cidr)
ctx.Export("outputConv2", trnameCidr.Cidrlists)
ctx.Export("outputOrignal", trnameInterface.Ip)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Fortios = Pulumi.Fortios;
return await Deployment.RunAsync(() =>
{
var trnameInterface = Fortios.System.GetInterface.Invoke(new()
{
Name = "port3",
});
var trnameCidr = Fortios.Ipmask.GetCidr.Invoke(new()
{
Ipmask = trnameInterface.Apply(getInterfaceResult => getInterfaceResult.Ip),
Ipmasklists = new[]
{
"21.1.1.1 255.255.255.0",
"22.1.1.1 255.255.255.240",
"23.1.1.1 255.255.255.224",
},
});
return new Dictionary<string, object?>
{
["outputConv1"] = trnameCidr.Apply(getCidrResult => getCidrResult.Cidr),
["outputConv2"] = trnameCidr.Apply(getCidrResult => getCidrResult.Cidrlists),
["outputOrignal"] = trnameInterface.Apply(getInterfaceResult => getInterfaceResult.Ip),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.fortios.system.SystemFunctions;
import com.pulumi.fortios.system.inputs.GetInterfaceArgs;
import com.pulumi.fortios.ipmask.IpmaskFunctions;
import com.pulumi.fortios.ipmask.inputs.GetCidrArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var trnameInterface = SystemFunctions.getInterface(GetInterfaceArgs.builder()
.name("port3")
.build());
final var trnameCidr = IpmaskFunctions.getCidr(GetCidrArgs.builder()
.ipmask(trnameInterface.applyValue(getInterfaceResult -> getInterfaceResult.ip()))
.ipmasklists(
"21.1.1.1 255.255.255.0",
"22.1.1.1 255.255.255.240",
"23.1.1.1 255.255.255.224")
.build());
ctx.export("outputConv1", trnameCidr.applyValue(getCidrResult -> getCidrResult.cidr()));
ctx.export("outputConv2", trnameCidr.applyValue(getCidrResult -> getCidrResult.cidrlists()));
ctx.export("outputOrignal", trnameInterface.applyValue(getInterfaceResult -> getInterfaceResult.ip()));
}
}
variables:
trnameInterface:
fn::invoke:
Function: fortios:system:getInterface
Arguments:
name: port3
trnameCidr:
fn::invoke:
Function: fortios:ipmask:getCidr
Arguments:
ipmask: ${trnameInterface.ip}
ipmasklists:
- 21.1.1.1 255.255.255.0
- 22.1.1.1 255.255.255.240
- 23.1.1.1 255.255.255.224
outputs:
outputConv1: ${trnameCidr.cidr}
outputConv2: ${trnameCidr.cidrlists}
outputOrignal: ${trnameInterface.ip}
Using getCidr
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getCidr(args: GetCidrArgs, opts?: InvokeOptions): Promise<GetCidrResult>
function getCidrOutput(args: GetCidrOutputArgs, opts?: InvokeOptions): Output<GetCidrResult>
def get_cidr(ipmask: Optional[str] = None,
ipmasklists: Optional[Sequence[str]] = None,
opts: Optional[InvokeOptions] = None) -> GetCidrResult
def get_cidr_output(ipmask: Optional[pulumi.Input[str]] = None,
ipmasklists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCidrResult]
func GetCidr(ctx *Context, args *GetCidrArgs, opts ...InvokeOption) (*GetCidrResult, error)
func GetCidrOutput(ctx *Context, args *GetCidrOutputArgs, opts ...InvokeOption) GetCidrResultOutput
> Note: This function is named GetCidr
in the Go SDK.
public static class GetCidr
{
public static Task<GetCidrResult> InvokeAsync(GetCidrArgs args, InvokeOptions? opts = null)
public static Output<GetCidrResult> Invoke(GetCidrInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCidrResult> getCidr(GetCidrArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: fortios:ipmask/getCidr:getCidr
arguments:
# arguments dictionary
The following arguments are supported:
- Ipmask string
- Specify IP/MASK.
- Ipmasklists List<string>
- Specify IP/MASK list.
- Ipmask string
- Specify IP/MASK.
- Ipmasklists []string
- Specify IP/MASK list.
- ipmask String
- Specify IP/MASK.
- ipmasklists List<String>
- Specify IP/MASK list.
- ipmask string
- Specify IP/MASK.
- ipmasklists string[]
- Specify IP/MASK list.
- ipmask str
- Specify IP/MASK.
- ipmasklists Sequence[str]
- Specify IP/MASK list.
- ipmask String
- Specify IP/MASK.
- ipmasklists List<String>
- Specify IP/MASK list.
getCidr Result
The following output properties are available:
- Cidr string
- Classless Inter-Domain Routing of the IP/MASK.
- Cidrlists List<string>
- Classless Inter-Domain Routing list converted from the IP/MASK list.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipmask string
- IP/MASK.
- Ipmasklists List<string>
- IP/MASK list.
- Cidr string
- Classless Inter-Domain Routing of the IP/MASK.
- Cidrlists []string
- Classless Inter-Domain Routing list converted from the IP/MASK list.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipmask string
- IP/MASK.
- Ipmasklists []string
- IP/MASK list.
- cidr String
- Classless Inter-Domain Routing of the IP/MASK.
- cidrlists List<String>
- Classless Inter-Domain Routing list converted from the IP/MASK list.
- id String
- The provider-assigned unique ID for this managed resource.
- ipmask String
- IP/MASK.
- ipmasklists List<String>
- IP/MASK list.
- cidr string
- Classless Inter-Domain Routing of the IP/MASK.
- cidrlists string[]
- Classless Inter-Domain Routing list converted from the IP/MASK list.
- id string
- The provider-assigned unique ID for this managed resource.
- ipmask string
- IP/MASK.
- ipmasklists string[]
- IP/MASK list.
- cidr str
- Classless Inter-Domain Routing of the IP/MASK.
- cidrlists Sequence[str]
- Classless Inter-Domain Routing list converted from the IP/MASK list.
- id str
- The provider-assigned unique ID for this managed resource.
- ipmask str
- IP/MASK.
- ipmasklists Sequence[str]
- IP/MASK list.
- cidr String
- Classless Inter-Domain Routing of the IP/MASK.
- cidrlists List<String>
- Classless Inter-Domain Routing list converted from the IP/MASK list.
- id String
- The provider-assigned unique ID for this managed resource.
- ipmask String
- IP/MASK.
- ipmasklists List<String>
- IP/MASK list.
Package Details
- Repository
- fortios pulumiverse/pulumi-fortios
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
fortios
Terraform Provider.