github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/networkmanager/connection.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package networkmanager
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Creates a connection between two devices.
    16  // The devices can be a physical or virtual appliance that connects to a third-party appliance in a VPC, or a physical appliance that connects to another physical appliance in an on-premises network.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/networkmanager"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := networkmanager.NewConnection(ctx, "example", &networkmanager.ConnectionArgs{
    34  //				GlobalNetworkId:   pulumi.Any(exampleAwsNetworkmanagerGlobalNetwork.Id),
    35  //				DeviceId:          pulumi.Any(example1.Id),
    36  //				ConnectedDeviceId: pulumi.Any(example2.Id),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import `aws_networkmanager_connection` using the connection ARN. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:networkmanager/connection:Connection example arn:aws:networkmanager::123456789012:device/global-network-0d47f6t230mz46dy4/connection-07f6fd08867abc123
    54  // ```
    55  type Connection struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// The Amazon Resource Name (ARN) of the connection.
    59  	Arn pulumi.StringOutput `pulumi:"arn"`
    60  	// The ID of the second device in the connection.
    61  	ConnectedDeviceId pulumi.StringOutput `pulumi:"connectedDeviceId"`
    62  	// The ID of the link for the second device.
    63  	ConnectedLinkId pulumi.StringPtrOutput `pulumi:"connectedLinkId"`
    64  	// A description of the connection.
    65  	Description pulumi.StringPtrOutput `pulumi:"description"`
    66  	// The ID of the first device in the connection.
    67  	DeviceId pulumi.StringOutput `pulumi:"deviceId"`
    68  	// The ID of the global network.
    69  	GlobalNetworkId pulumi.StringOutput `pulumi:"globalNetworkId"`
    70  	// The ID of the link for the first device.
    71  	LinkId pulumi.StringPtrOutput `pulumi:"linkId"`
    72  	// Key-value tags for the connection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    73  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    74  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    75  	//
    76  	// Deprecated: Please use `tags` instead.
    77  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    78  }
    79  
    80  // NewConnection registers a new resource with the given unique name, arguments, and options.
    81  func NewConnection(ctx *pulumi.Context,
    82  	name string, args *ConnectionArgs, opts ...pulumi.ResourceOption) (*Connection, error) {
    83  	if args == nil {
    84  		return nil, errors.New("missing one or more required arguments")
    85  	}
    86  
    87  	if args.ConnectedDeviceId == nil {
    88  		return nil, errors.New("invalid value for required argument 'ConnectedDeviceId'")
    89  	}
    90  	if args.DeviceId == nil {
    91  		return nil, errors.New("invalid value for required argument 'DeviceId'")
    92  	}
    93  	if args.GlobalNetworkId == nil {
    94  		return nil, errors.New("invalid value for required argument 'GlobalNetworkId'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource Connection
    98  	err := ctx.RegisterResource("aws:networkmanager/connection:Connection", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetConnection gets an existing Connection resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetConnection(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *ConnectionState, opts ...pulumi.ResourceOption) (*Connection, error) {
   109  	var resource Connection
   110  	err := ctx.ReadResource("aws:networkmanager/connection:Connection", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering Connection resources.
   118  type connectionState struct {
   119  	// The Amazon Resource Name (ARN) of the connection.
   120  	Arn *string `pulumi:"arn"`
   121  	// The ID of the second device in the connection.
   122  	ConnectedDeviceId *string `pulumi:"connectedDeviceId"`
   123  	// The ID of the link for the second device.
   124  	ConnectedLinkId *string `pulumi:"connectedLinkId"`
   125  	// A description of the connection.
   126  	Description *string `pulumi:"description"`
   127  	// The ID of the first device in the connection.
   128  	DeviceId *string `pulumi:"deviceId"`
   129  	// The ID of the global network.
   130  	GlobalNetworkId *string `pulumi:"globalNetworkId"`
   131  	// The ID of the link for the first device.
   132  	LinkId *string `pulumi:"linkId"`
   133  	// Key-value tags for the connection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   134  	Tags map[string]string `pulumi:"tags"`
   135  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   136  	//
   137  	// Deprecated: Please use `tags` instead.
   138  	TagsAll map[string]string `pulumi:"tagsAll"`
   139  }
   140  
   141  type ConnectionState struct {
   142  	// The Amazon Resource Name (ARN) of the connection.
   143  	Arn pulumi.StringPtrInput
   144  	// The ID of the second device in the connection.
   145  	ConnectedDeviceId pulumi.StringPtrInput
   146  	// The ID of the link for the second device.
   147  	ConnectedLinkId pulumi.StringPtrInput
   148  	// A description of the connection.
   149  	Description pulumi.StringPtrInput
   150  	// The ID of the first device in the connection.
   151  	DeviceId pulumi.StringPtrInput
   152  	// The ID of the global network.
   153  	GlobalNetworkId pulumi.StringPtrInput
   154  	// The ID of the link for the first device.
   155  	LinkId pulumi.StringPtrInput
   156  	// Key-value tags for the connection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   157  	Tags pulumi.StringMapInput
   158  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   159  	//
   160  	// Deprecated: Please use `tags` instead.
   161  	TagsAll pulumi.StringMapInput
   162  }
   163  
   164  func (ConnectionState) ElementType() reflect.Type {
   165  	return reflect.TypeOf((*connectionState)(nil)).Elem()
   166  }
   167  
   168  type connectionArgs struct {
   169  	// The ID of the second device in the connection.
   170  	ConnectedDeviceId string `pulumi:"connectedDeviceId"`
   171  	// The ID of the link for the second device.
   172  	ConnectedLinkId *string `pulumi:"connectedLinkId"`
   173  	// A description of the connection.
   174  	Description *string `pulumi:"description"`
   175  	// The ID of the first device in the connection.
   176  	DeviceId string `pulumi:"deviceId"`
   177  	// The ID of the global network.
   178  	GlobalNetworkId string `pulumi:"globalNetworkId"`
   179  	// The ID of the link for the first device.
   180  	LinkId *string `pulumi:"linkId"`
   181  	// Key-value tags for the connection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   182  	Tags map[string]string `pulumi:"tags"`
   183  }
   184  
   185  // The set of arguments for constructing a Connection resource.
   186  type ConnectionArgs struct {
   187  	// The ID of the second device in the connection.
   188  	ConnectedDeviceId pulumi.StringInput
   189  	// The ID of the link for the second device.
   190  	ConnectedLinkId pulumi.StringPtrInput
   191  	// A description of the connection.
   192  	Description pulumi.StringPtrInput
   193  	// The ID of the first device in the connection.
   194  	DeviceId pulumi.StringInput
   195  	// The ID of the global network.
   196  	GlobalNetworkId pulumi.StringInput
   197  	// The ID of the link for the first device.
   198  	LinkId pulumi.StringPtrInput
   199  	// Key-value tags for the connection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   200  	Tags pulumi.StringMapInput
   201  }
   202  
   203  func (ConnectionArgs) ElementType() reflect.Type {
   204  	return reflect.TypeOf((*connectionArgs)(nil)).Elem()
   205  }
   206  
   207  type ConnectionInput interface {
   208  	pulumi.Input
   209  
   210  	ToConnectionOutput() ConnectionOutput
   211  	ToConnectionOutputWithContext(ctx context.Context) ConnectionOutput
   212  }
   213  
   214  func (*Connection) ElementType() reflect.Type {
   215  	return reflect.TypeOf((**Connection)(nil)).Elem()
   216  }
   217  
   218  func (i *Connection) ToConnectionOutput() ConnectionOutput {
   219  	return i.ToConnectionOutputWithContext(context.Background())
   220  }
   221  
   222  func (i *Connection) ToConnectionOutputWithContext(ctx context.Context) ConnectionOutput {
   223  	return pulumi.ToOutputWithContext(ctx, i).(ConnectionOutput)
   224  }
   225  
   226  // ConnectionArrayInput is an input type that accepts ConnectionArray and ConnectionArrayOutput values.
   227  // You can construct a concrete instance of `ConnectionArrayInput` via:
   228  //
   229  //	ConnectionArray{ ConnectionArgs{...} }
   230  type ConnectionArrayInput interface {
   231  	pulumi.Input
   232  
   233  	ToConnectionArrayOutput() ConnectionArrayOutput
   234  	ToConnectionArrayOutputWithContext(context.Context) ConnectionArrayOutput
   235  }
   236  
   237  type ConnectionArray []ConnectionInput
   238  
   239  func (ConnectionArray) ElementType() reflect.Type {
   240  	return reflect.TypeOf((*[]*Connection)(nil)).Elem()
   241  }
   242  
   243  func (i ConnectionArray) ToConnectionArrayOutput() ConnectionArrayOutput {
   244  	return i.ToConnectionArrayOutputWithContext(context.Background())
   245  }
   246  
   247  func (i ConnectionArray) ToConnectionArrayOutputWithContext(ctx context.Context) ConnectionArrayOutput {
   248  	return pulumi.ToOutputWithContext(ctx, i).(ConnectionArrayOutput)
   249  }
   250  
   251  // ConnectionMapInput is an input type that accepts ConnectionMap and ConnectionMapOutput values.
   252  // You can construct a concrete instance of `ConnectionMapInput` via:
   253  //
   254  //	ConnectionMap{ "key": ConnectionArgs{...} }
   255  type ConnectionMapInput interface {
   256  	pulumi.Input
   257  
   258  	ToConnectionMapOutput() ConnectionMapOutput
   259  	ToConnectionMapOutputWithContext(context.Context) ConnectionMapOutput
   260  }
   261  
   262  type ConnectionMap map[string]ConnectionInput
   263  
   264  func (ConnectionMap) ElementType() reflect.Type {
   265  	return reflect.TypeOf((*map[string]*Connection)(nil)).Elem()
   266  }
   267  
   268  func (i ConnectionMap) ToConnectionMapOutput() ConnectionMapOutput {
   269  	return i.ToConnectionMapOutputWithContext(context.Background())
   270  }
   271  
   272  func (i ConnectionMap) ToConnectionMapOutputWithContext(ctx context.Context) ConnectionMapOutput {
   273  	return pulumi.ToOutputWithContext(ctx, i).(ConnectionMapOutput)
   274  }
   275  
   276  type ConnectionOutput struct{ *pulumi.OutputState }
   277  
   278  func (ConnectionOutput) ElementType() reflect.Type {
   279  	return reflect.TypeOf((**Connection)(nil)).Elem()
   280  }
   281  
   282  func (o ConnectionOutput) ToConnectionOutput() ConnectionOutput {
   283  	return o
   284  }
   285  
   286  func (o ConnectionOutput) ToConnectionOutputWithContext(ctx context.Context) ConnectionOutput {
   287  	return o
   288  }
   289  
   290  // The Amazon Resource Name (ARN) of the connection.
   291  func (o ConnectionOutput) Arn() pulumi.StringOutput {
   292  	return o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   293  }
   294  
   295  // The ID of the second device in the connection.
   296  func (o ConnectionOutput) ConnectedDeviceId() pulumi.StringOutput {
   297  	return o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.ConnectedDeviceId }).(pulumi.StringOutput)
   298  }
   299  
   300  // The ID of the link for the second device.
   301  func (o ConnectionOutput) ConnectedLinkId() pulumi.StringPtrOutput {
   302  	return o.ApplyT(func(v *Connection) pulumi.StringPtrOutput { return v.ConnectedLinkId }).(pulumi.StringPtrOutput)
   303  }
   304  
   305  // A description of the connection.
   306  func (o ConnectionOutput) Description() pulumi.StringPtrOutput {
   307  	return o.ApplyT(func(v *Connection) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   308  }
   309  
   310  // The ID of the first device in the connection.
   311  func (o ConnectionOutput) DeviceId() pulumi.StringOutput {
   312  	return o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.DeviceId }).(pulumi.StringOutput)
   313  }
   314  
   315  // The ID of the global network.
   316  func (o ConnectionOutput) GlobalNetworkId() pulumi.StringOutput {
   317  	return o.ApplyT(func(v *Connection) pulumi.StringOutput { return v.GlobalNetworkId }).(pulumi.StringOutput)
   318  }
   319  
   320  // The ID of the link for the first device.
   321  func (o ConnectionOutput) LinkId() pulumi.StringPtrOutput {
   322  	return o.ApplyT(func(v *Connection) pulumi.StringPtrOutput { return v.LinkId }).(pulumi.StringPtrOutput)
   323  }
   324  
   325  // Key-value tags for the connection. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   326  func (o ConnectionOutput) Tags() pulumi.StringMapOutput {
   327  	return o.ApplyT(func(v *Connection) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   328  }
   329  
   330  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   331  //
   332  // Deprecated: Please use `tags` instead.
   333  func (o ConnectionOutput) TagsAll() pulumi.StringMapOutput {
   334  	return o.ApplyT(func(v *Connection) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   335  }
   336  
   337  type ConnectionArrayOutput struct{ *pulumi.OutputState }
   338  
   339  func (ConnectionArrayOutput) ElementType() reflect.Type {
   340  	return reflect.TypeOf((*[]*Connection)(nil)).Elem()
   341  }
   342  
   343  func (o ConnectionArrayOutput) ToConnectionArrayOutput() ConnectionArrayOutput {
   344  	return o
   345  }
   346  
   347  func (o ConnectionArrayOutput) ToConnectionArrayOutputWithContext(ctx context.Context) ConnectionArrayOutput {
   348  	return o
   349  }
   350  
   351  func (o ConnectionArrayOutput) Index(i pulumi.IntInput) ConnectionOutput {
   352  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Connection {
   353  		return vs[0].([]*Connection)[vs[1].(int)]
   354  	}).(ConnectionOutput)
   355  }
   356  
   357  type ConnectionMapOutput struct{ *pulumi.OutputState }
   358  
   359  func (ConnectionMapOutput) ElementType() reflect.Type {
   360  	return reflect.TypeOf((*map[string]*Connection)(nil)).Elem()
   361  }
   362  
   363  func (o ConnectionMapOutput) ToConnectionMapOutput() ConnectionMapOutput {
   364  	return o
   365  }
   366  
   367  func (o ConnectionMapOutput) ToConnectionMapOutputWithContext(ctx context.Context) ConnectionMapOutput {
   368  	return o
   369  }
   370  
   371  func (o ConnectionMapOutput) MapIndex(k pulumi.StringInput) ConnectionOutput {
   372  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Connection {
   373  		return vs[0].(map[string]*Connection)[vs[1].(string)]
   374  	}).(ConnectionOutput)
   375  }
   376  
   377  func init() {
   378  	pulumi.RegisterInputType(reflect.TypeOf((*ConnectionInput)(nil)).Elem(), &Connection{})
   379  	pulumi.RegisterInputType(reflect.TypeOf((*ConnectionArrayInput)(nil)).Elem(), ConnectionArray{})
   380  	pulumi.RegisterInputType(reflect.TypeOf((*ConnectionMapInput)(nil)).Elem(), ConnectionMap{})
   381  	pulumi.RegisterOutputType(ConnectionOutput{})
   382  	pulumi.RegisterOutputType(ConnectionArrayOutput{})
   383  	pulumi.RegisterOutputType(ConnectionMapOutput{})
   384  }