你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

NetworkAttachment Class

  • java.lang.Object
    • com.azure.resourcemanager.networkcloud.models.NetworkAttachment

Implements

public final class NetworkAttachment
implements JsonSerializable<NetworkAttachment>

NetworkAttachment represents the single network attachment.

Constructor Summary

Constructor Description
NetworkAttachment()

Creates an instance of NetworkAttachment class.

Method Summary

Modifier and Type Method and Description
String attachedNetworkId()

Get the attachedNetworkId property: The resource ID of the associated network attached to the virtual machine.

DefaultGateway defaultGateway()

Get the defaultGateway property: The indicator of whether this is the default gateway.

static NetworkAttachment fromJson(JsonReader jsonReader)

Reads an instance of NetworkAttachment from the JsonReader.

VirtualMachineIpAllocationMethod ipAllocationMethod()

Get the ipAllocationMethod property: The IP allocation mechanism for the virtual machine.

String ipv4Address()

Get the ipv4Address property: The IPv4 address of the virtual machine.

String ipv6Address()

Get the ipv6Address property: The IPv6 address of the virtual machine.

String macAddress()

Get the macAddress property: The MAC address of the interface for the virtual machine that corresponds to this network attachment.

String networkAttachmentName()

Get the networkAttachmentName property: The associated network's interface name.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

NetworkAttachment withAttachedNetworkId(String attachedNetworkId)

Set the attachedNetworkId property: The resource ID of the associated network attached to the virtual machine.

NetworkAttachment withDefaultGateway(DefaultGateway defaultGateway)

Set the defaultGateway property: The indicator of whether this is the default gateway.

NetworkAttachment withIpAllocationMethod(VirtualMachineIpAllocationMethod ipAllocationMethod)

Set the ipAllocationMethod property: The IP allocation mechanism for the virtual machine.

NetworkAttachment withIpv4Address(String ipv4Address)

Set the ipv4Address property: The IPv4 address of the virtual machine.

NetworkAttachment withIpv6Address(String ipv6Address)

Set the ipv6Address property: The IPv6 address of the virtual machine.

NetworkAttachment withNetworkAttachmentName(String networkAttachmentName)

Set the networkAttachmentName property: The associated network's interface name.

Methods inherited from java.lang.Object

Constructor Details

NetworkAttachment

public NetworkAttachment()

Creates an instance of NetworkAttachment class.

Method Details

attachedNetworkId

public String attachedNetworkId()

Get the attachedNetworkId property: The resource ID of the associated network attached to the virtual machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork resources.

Returns:

the attachedNetworkId value.

defaultGateway

public DefaultGateway defaultGateway()

Get the defaultGateway property: The indicator of whether this is the default gateway. Only one of the attached networks (including the CloudServicesNetwork attachment) for a single machine may be specified as True.

Returns:

the defaultGateway value.

fromJson

public static NetworkAttachment fromJson(JsonReader jsonReader)

Reads an instance of NetworkAttachment from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of NetworkAttachment if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

ipAllocationMethod

public VirtualMachineIpAllocationMethod ipAllocationMethod()

Get the ipAllocationMethod property: The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value.

Returns:

the ipAllocationMethod value.

ipv4Address

public String ipv4Address()

Get the ipv4Address property: The IPv4 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - this field must contain a user specified IPv4 address from within the subnet specified in the attached network. Dynamic - this field is read-only, but will be populated with an address from within the subnet specified in the attached network. Disabled - this field will be empty.

Returns:

the ipv4Address value.

ipv6Address

public String ipv6Address()

Get the ipv6Address property: The IPv6 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - this field must contain an IPv6 address range from within the range specified in the attached network. Dynamic - this field is read-only, but will be populated with an range from within the subnet specified in the attached network. Disabled - this field will be empty.

Returns:

the ipv6Address value.

macAddress

public String macAddress()

Get the macAddress property: The MAC address of the interface for the virtual machine that corresponds to this network attachment.

Returns:

the macAddress value.

networkAttachmentName

public String networkAttachmentName()

Get the networkAttachmentName property: The associated network's interface name. If specified, the network attachment name has a maximum length of 15 characters and must be unique to this virtual machine. If the user doesn’t specify this value, the default interface name of the network resource will be used. For a CloudServicesNetwork resource, this name will be ignored.

Returns:

the networkAttachmentName value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

withAttachedNetworkId

public NetworkAttachment withAttachedNetworkId(String attachedNetworkId)

Set the attachedNetworkId property: The resource ID of the associated network attached to the virtual machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork resources.

Parameters:

attachedNetworkId - the attachedNetworkId value to set.

Returns:

the NetworkAttachment object itself.

withDefaultGateway

public NetworkAttachment withDefaultGateway(DefaultGateway defaultGateway)

Set the defaultGateway property: The indicator of whether this is the default gateway. Only one of the attached networks (including the CloudServicesNetwork attachment) for a single machine may be specified as True.

Parameters:

defaultGateway - the defaultGateway value to set.

Returns:

the NetworkAttachment object itself.

withIpAllocationMethod

public NetworkAttachment withIpAllocationMethod(VirtualMachineIpAllocationMethod ipAllocationMethod)

Set the ipAllocationMethod property: The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value.

Parameters:

ipAllocationMethod - the ipAllocationMethod value to set.

Returns:

the NetworkAttachment object itself.

withIpv4Address

public NetworkAttachment withIpv4Address(String ipv4Address)

Set the ipv4Address property: The IPv4 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - this field must contain a user specified IPv4 address from within the subnet specified in the attached network. Dynamic - this field is read-only, but will be populated with an address from within the subnet specified in the attached network. Disabled - this field will be empty.

Parameters:

ipv4Address - the ipv4Address value to set.

Returns:

the NetworkAttachment object itself.

withIpv6Address

public NetworkAttachment withIpv6Address(String ipv6Address)

Set the ipv6Address property: The IPv6 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - this field must contain an IPv6 address range from within the range specified in the attached network. Dynamic - this field is read-only, but will be populated with an range from within the subnet specified in the attached network. Disabled - this field will be empty.

Parameters:

ipv6Address - the ipv6Address value to set.

Returns:

the NetworkAttachment object itself.

withNetworkAttachmentName

public NetworkAttachment withNetworkAttachmentName(String networkAttachmentName)

Set the networkAttachmentName property: The associated network's interface name. If specified, the network attachment name has a maximum length of 15 characters and must be unique to this virtual machine. If the user doesn’t specify this value, the default interface name of the network resource will be used. For a CloudServicesNetwork resource, this name will be ignored.

Parameters:

networkAttachmentName - the networkAttachmentName value to set.

Returns:

the NetworkAttachment object itself.

Applies to