1. Packages
  2. Netaddr Provider
  3. API Docs
  4. getAddressMac
netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

netaddr.getAddressMac

Explore with Pulumi AI

netaddr logo
netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

    Retrieves data on an existing mac address.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netaddr from "@pulumi/netaddr";
    
    const testRangeMac = netaddr.getRangeMac({
        keyPrefix: "/test/mac/",
    });
    const testAddressMac = testRangeMac.then(testRangeMac => netaddr.getAddressMac({
        rangeId: testRangeMac.id,
        name: "test",
    }));
    export const dataMacTest = testAddressMac.then(testAddressMac => testAddressMac.address);
    
    import pulumi
    import pulumi_netaddr as netaddr
    
    test_range_mac = netaddr.get_range_mac(key_prefix="/test/mac/")
    test_address_mac = netaddr.get_address_mac(range_id=test_range_mac.id,
        name="test")
    pulumi.export("dataMacTest", test_address_mac.address)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netaddr/netaddr"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		testRangeMac, err := netaddr.LookupRangeMac(ctx, &netaddr.LookupRangeMacArgs{
    			KeyPrefix: "/test/mac/",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		testAddressMac, err := netaddr.LookupAddressMac(ctx, &netaddr.LookupAddressMacArgs{
    			RangeId: testRangeMac.Id,
    			Name:    "test",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("dataMacTest", testAddressMac.Address)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netaddr = Pulumi.Netaddr;
    
    return await Deployment.RunAsync(() => 
    {
        var testRangeMac = Netaddr.GetRangeMac.Invoke(new()
        {
            KeyPrefix = "/test/mac/",
        });
    
        var testAddressMac = Netaddr.GetAddressMac.Invoke(new()
        {
            RangeId = testRangeMac.Apply(getRangeMacResult => getRangeMacResult.Id),
            Name = "test",
        });
    
        return new Dictionary<string, object?>
        {
            ["dataMacTest"] = testAddressMac.Apply(getAddressMacResult => getAddressMacResult.Address),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netaddr.NetaddrFunctions;
    import com.pulumi.netaddr.inputs.GetRangeMacArgs;
    import com.pulumi.netaddr.inputs.GetAddressMacArgs;
    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 testRangeMac = NetaddrFunctions.getRangeMac(GetRangeMacArgs.builder()
                .keyPrefix("/test/mac/")
                .build());
    
            final var testAddressMac = NetaddrFunctions.getAddressMac(GetAddressMacArgs.builder()
                .rangeId(testRangeMac.applyValue(getRangeMacResult -> getRangeMacResult.id()))
                .name("test")
                .build());
    
            ctx.export("dataMacTest", testAddressMac.applyValue(getAddressMacResult -> getAddressMacResult.address()));
        }
    }
    
    variables:
      testRangeMac:
        fn::invoke:
          function: netaddr:getRangeMac
          arguments:
            keyPrefix: /test/mac/
      testAddressMac:
        fn::invoke:
          function: netaddr:getAddressMac
          arguments:
            rangeId: ${testRangeMac.id}
            name: test
    outputs:
      dataMacTest: ${testAddressMac.address}
    

    Using getAddressMac

    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 getAddressMac(args: GetAddressMacArgs, opts?: InvokeOptions): Promise<GetAddressMacResult>
    function getAddressMacOutput(args: GetAddressMacOutputArgs, opts?: InvokeOptions): Output<GetAddressMacResult>
    def get_address_mac(id: Optional[str] = None,
                        name: Optional[str] = None,
                        range_id: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetAddressMacResult
    def get_address_mac_output(id: Optional[pulumi.Input[str]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        range_id: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetAddressMacResult]
    func LookupAddressMac(ctx *Context, args *LookupAddressMacArgs, opts ...InvokeOption) (*LookupAddressMacResult, error)
    func LookupAddressMacOutput(ctx *Context, args *LookupAddressMacOutputArgs, opts ...InvokeOption) LookupAddressMacResultOutput

    > Note: This function is named LookupAddressMac in the Go SDK.

    public static class GetAddressMac 
    {
        public static Task<GetAddressMacResult> InvokeAsync(GetAddressMacArgs args, InvokeOptions? opts = null)
        public static Output<GetAddressMacResult> Invoke(GetAddressMacInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAddressMacResult> getAddressMac(GetAddressMacArgs args, InvokeOptions options)
    public static Output<GetAddressMacResult> getAddressMac(GetAddressMacArgs args, InvokeOptions options)
    
    fn::invoke:
      function: netaddr:index/getAddressMac:getAddressMac
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the address.
    RangeId string
    Identifier of the address range the address is tied to.
    Id string
    The ID of this resource.
    Name string
    Name of the address.
    RangeId string
    Identifier of the address range the address is tied to.
    Id string
    The ID of this resource.
    name String
    Name of the address.
    rangeId String
    Identifier of the address range the address is tied to.
    id String
    The ID of this resource.
    name string
    Name of the address.
    rangeId string
    Identifier of the address range the address is tied to.
    id string
    The ID of this resource.
    name str
    Name of the address.
    range_id str
    Identifier of the address range the address is tied to.
    id str
    The ID of this resource.
    name String
    Name of the address.
    rangeId String
    Identifier of the address range the address is tied to.
    id String
    The ID of this resource.

    getAddressMac Result

    The following output properties are available:

    Address string
    The address that got assigned to the resource.
    Id string
    The ID of this resource.
    Name string
    Name of the address.
    RangeId string
    Identifier of the address range the address is tied to.
    Address string
    The address that got assigned to the resource.
    Id string
    The ID of this resource.
    Name string
    Name of the address.
    RangeId string
    Identifier of the address range the address is tied to.
    address String
    The address that got assigned to the resource.
    id String
    The ID of this resource.
    name String
    Name of the address.
    rangeId String
    Identifier of the address range the address is tied to.
    address string
    The address that got assigned to the resource.
    id string
    The ID of this resource.
    name string
    Name of the address.
    rangeId string
    Identifier of the address range the address is tied to.
    address str
    The address that got assigned to the resource.
    id str
    The ID of this resource.
    name str
    Name of the address.
    range_id str
    Identifier of the address range the address is tied to.
    address String
    The address that got assigned to the resource.
    id String
    The ID of this resource.
    name String
    Name of the address.
    rangeId String
    Identifier of the address range the address is tied to.

    Package Details

    Repository
    netaddr ferlab-ste-justine/terraform-provider-netaddr
    License
    Notes
    This Pulumi package is based on the netaddr Terraform Provider.
    netaddr logo
    netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine