iosxe.Restconf
Explore with Pulumi AI
Manages IOS-XE objects via RESTCONF calls. This resource can only manage a single object. It is able to read the state and therefore reconcile configuration drift.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Iosxe = Lbrlabs.PulumiPackage.Iosxe;
return await Deployment.RunAsync(() =>
{
var simple = new Iosxe.Restconf("simple", new()
{
Attributes =
{
{ "banner", "My Banner" },
},
Path = "Cisco-IOS-XE-native:native/banner/login",
});
var nestedList = new Iosxe.Restconf("nestedList", new()
{
Attributes =
{
{ "source-route", "true" },
},
Lists = new[]
{
new Iosxe.Inputs.RestconfListArgs
{
Items = new[]
{
{
{ "name", "VRF1" },
},
},
Key = "name",
Name = "vrf",
},
},
Path = "Cisco-IOS-XE-native:native/ip",
});
});
package main
import (
"github.com/lbrlabs/pulumi-iosxe/sdk/go/iosxe"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := iosxe.NewRestconf(ctx, "simple", &iosxe.RestconfArgs{
Attributes: pulumi.StringMap{
"banner": pulumi.String("My Banner"),
},
Path: pulumi.String("Cisco-IOS-XE-native:native/banner/login"),
})
if err != nil {
return err
}
_, err = iosxe.NewRestconf(ctx, "nestedList", &iosxe.RestconfArgs{
Attributes: pulumi.StringMap{
"source-route": pulumi.String("true"),
},
Lists: iosxe.RestconfListArray{
&iosxe.RestconfListArgs{
Items: pulumi.StringMapArray{
pulumi.StringMap{
"name": pulumi.String("VRF1"),
},
},
Key: pulumi.String("name"),
Name: pulumi.String("vrf"),
},
},
Path: pulumi.String("Cisco-IOS-XE-native:native/ip"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.iosxe.Restconf;
import com.pulumi.iosxe.RestconfArgs;
import com.pulumi.iosxe.inputs.RestconfListArgs;
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) {
var simple = new Restconf("simple", RestconfArgs.builder()
.attributes(Map.of("banner", "My Banner"))
.path("Cisco-IOS-XE-native:native/banner/login")
.build());
var nestedList = new Restconf("nestedList", RestconfArgs.builder()
.attributes(Map.of("source-route", "true"))
.lists(RestconfListArgs.builder()
.items(Map.of("name", "VRF1"))
.key("name")
.name("vrf")
.build())
.path("Cisco-IOS-XE-native:native/ip")
.build());
}
}
import pulumi
import lbrlabs_pulumi_iosxe as iosxe
simple = iosxe.Restconf("simple",
attributes={
"banner": "My Banner",
},
path="Cisco-IOS-XE-native:native/banner/login")
nested_list = iosxe.Restconf("nestedList",
attributes={
"source-route": "true",
},
lists=[iosxe.RestconfListArgs(
items=[{
"name": "VRF1",
}],
key="name",
name="vrf",
)],
path="Cisco-IOS-XE-native:native/ip")
import * as pulumi from "@pulumi/pulumi";
import * as iosxe from "@lbrlabs/pulumi-iosxe";
const simple = new iosxe.Restconf("simple", {
attributes: {
banner: "My Banner",
},
path: "Cisco-IOS-XE-native:native/banner/login",
});
const nestedList = new iosxe.Restconf("nestedList", {
attributes: {
"source-route": "true",
},
lists: [{
items: [{
name: "VRF1",
}],
key: "name",
name: "vrf",
}],
path: "Cisco-IOS-XE-native:native/ip",
});
resources:
simple:
type: iosxe:Restconf
properties:
attributes:
banner: My Banner
path: Cisco-IOS-XE-native:native/banner/login
nestedList:
type: iosxe:Restconf
properties:
attributes:
source-route: 'true'
lists:
- items:
- name: VRF1
key: name
name: vrf
path: Cisco-IOS-XE-native:native/ip
Create Restconf Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Restconf(name: string, args: RestconfArgs, opts?: CustomResourceOptions);
@overload
def Restconf(resource_name: str,
args: RestconfArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Restconf(resource_name: str,
opts: Optional[ResourceOptions] = None,
path: Optional[str] = None,
attributes: Optional[Mapping[str, str]] = None,
delete: Optional[bool] = None,
device: Optional[str] = None,
lists: Optional[Sequence[RestconfListArgs]] = None)
func NewRestconf(ctx *Context, name string, args RestconfArgs, opts ...ResourceOption) (*Restconf, error)
public Restconf(string name, RestconfArgs args, CustomResourceOptions? opts = null)
public Restconf(String name, RestconfArgs args)
public Restconf(String name, RestconfArgs args, CustomResourceOptions options)
type: iosxe:Restconf
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RestconfArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RestconfArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RestconfArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RestconfArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RestconfArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var restconfResource = new Iosxe.Restconf("restconfResource", new()
{
Path = "string",
Attributes =
{
{ "string", "string" },
},
Delete = false,
Device = "string",
Lists = new[]
{
new Iosxe.Inputs.RestconfListArgs
{
Key = "string",
Name = "string",
Items = new[]
{
{
{ "string", "string" },
},
},
Values = new[]
{
"string",
},
},
},
});
example, err := iosxe.NewRestconf(ctx, "restconfResource", &iosxe.RestconfArgs{
Path: pulumi.String("string"),
Attributes: pulumi.StringMap{
"string": pulumi.String("string"),
},
Delete: pulumi.Bool(false),
Device: pulumi.String("string"),
Lists: iosxe.RestconfListArray{
&iosxe.RestconfListArgs{
Key: pulumi.String("string"),
Name: pulumi.String("string"),
Items: pulumi.StringMapArray{
pulumi.StringMap{
"string": pulumi.String("string"),
},
},
Values: pulumi.StringArray{
pulumi.String("string"),
},
},
},
})
var restconfResource = new Restconf("restconfResource", RestconfArgs.builder()
.path("string")
.attributes(Map.of("string", "string"))
.delete(false)
.device("string")
.lists(RestconfListArgs.builder()
.key("string")
.name("string")
.items(Map.of("string", "string"))
.values("string")
.build())
.build());
restconf_resource = iosxe.Restconf("restconfResource",
path="string",
attributes={
"string": "string",
},
delete=False,
device="string",
lists=[iosxe.RestconfListArgs(
key="string",
name="string",
items=[{
"string": "string",
}],
values=["string"],
)])
const restconfResource = new iosxe.Restconf("restconfResource", {
path: "string",
attributes: {
string: "string",
},
"delete": false,
device: "string",
lists: [{
key: "string",
name: "string",
items: [{
string: "string",
}],
values: ["string"],
}],
});
type: iosxe:Restconf
properties:
attributes:
string: string
delete: false
device: string
lists:
- items:
- string: string
key: string
name: string
values:
- string
path: string
Restconf Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Restconf resource accepts the following input properties:
- Path string
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
. - Attributes Dictionary<string, string>
- Map of key-value pairs which represents the YANG leafs and its values.
- Delete bool
- Delete object during destroy operation. Default value is
true
. - Device string
- A device name from the provider configuration.
- Lists
List<Lbrlabs.
Pulumi Package. Iosxe. Inputs. Restconf List> - YANG lists.
- Path string
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
. - Attributes map[string]string
- Map of key-value pairs which represents the YANG leafs and its values.
- Delete bool
- Delete object during destroy operation. Default value is
true
. - Device string
- A device name from the provider configuration.
- Lists
[]Restconf
List Args - YANG lists.
- path String
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
. - attributes Map<String,String>
- Map of key-value pairs which represents the YANG leafs and its values.
- delete Boolean
- Delete object during destroy operation. Default value is
true
. - device String
- A device name from the provider configuration.
- lists
List<Restconf
List> - YANG lists.
- path string
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
. - attributes {[key: string]: string}
- Map of key-value pairs which represents the YANG leafs and its values.
- delete boolean
- Delete object during destroy operation. Default value is
true
. - device string
- A device name from the provider configuration.
- lists
Restconf
List[] - YANG lists.
- path str
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
. - attributes Mapping[str, str]
- Map of key-value pairs which represents the YANG leafs and its values.
- delete bool
- Delete object during destroy operation. Default value is
true
. - device str
- A device name from the provider configuration.
- lists
Sequence[Restconf
List Args] - YANG lists.
- path String
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
. - attributes Map<String>
- Map of key-value pairs which represents the YANG leafs and its values.
- delete Boolean
- Delete object during destroy operation. Default value is
true
. - device String
- A device name from the provider configuration.
- lists List<Property Map>
- YANG lists.
Outputs
All input properties are implicitly available as output properties. Additionally, the Restconf resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Restconf Resource
Get an existing Restconf resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RestconfState, opts?: CustomResourceOptions): Restconf
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
attributes: Optional[Mapping[str, str]] = None,
delete: Optional[bool] = None,
device: Optional[str] = None,
lists: Optional[Sequence[RestconfListArgs]] = None,
path: Optional[str] = None) -> Restconf
func GetRestconf(ctx *Context, name string, id IDInput, state *RestconfState, opts ...ResourceOption) (*Restconf, error)
public static Restconf Get(string name, Input<string> id, RestconfState? state, CustomResourceOptions? opts = null)
public static Restconf get(String name, Output<String> id, RestconfState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Attributes Dictionary<string, string>
- Map of key-value pairs which represents the YANG leafs and its values.
- Delete bool
- Delete object during destroy operation. Default value is
true
. - Device string
- A device name from the provider configuration.
- Lists
List<Lbrlabs.
Pulumi Package. Iosxe. Inputs. Restconf List> - YANG lists.
- Path string
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
.
- Attributes map[string]string
- Map of key-value pairs which represents the YANG leafs and its values.
- Delete bool
- Delete object during destroy operation. Default value is
true
. - Device string
- A device name from the provider configuration.
- Lists
[]Restconf
List Args - YANG lists.
- Path string
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
.
- attributes Map<String,String>
- Map of key-value pairs which represents the YANG leafs and its values.
- delete Boolean
- Delete object during destroy operation. Default value is
true
. - device String
- A device name from the provider configuration.
- lists
List<Restconf
List> - YANG lists.
- path String
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
.
- attributes {[key: string]: string}
- Map of key-value pairs which represents the YANG leafs and its values.
- delete boolean
- Delete object during destroy operation. Default value is
true
. - device string
- A device name from the provider configuration.
- lists
Restconf
List[] - YANG lists.
- path string
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
.
- attributes Mapping[str, str]
- Map of key-value pairs which represents the YANG leafs and its values.
- delete bool
- Delete object during destroy operation. Default value is
true
. - device str
- A device name from the provider configuration.
- lists
Sequence[Restconf
List Args] - YANG lists.
- path str
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
.
- attributes Map<String>
- Map of key-value pairs which represents the YANG leafs and its values.
- delete Boolean
- Delete object during destroy operation. Default value is
true
. - device String
- A device name from the provider configuration.
- lists List<Property Map>
- YANG lists.
- path String
- A RESTCONF path, e.g.
openconfig-interfaces:interfaces
.
Supporting Types
RestconfList, RestconfListArgs
Import
$ pulumi import iosxe:index/restconf:Restconf example "Cisco-IOS-XE-native:native/banner/login"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- iosxe lbrlabs/pulumi-iosxe
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
iosxe
Terraform Provider.