VcnConfig.Builder


public static final class VcnConfig.Builder
extends Object

java.lang.Object
   ↳ android.net.vcn.VcnConfig.Builder


This class is used to incrementally build VcnConfig objects.

Summary

Public constructors

Builder(Context context)

Public methods

VcnConfig.Builder addGatewayConnectionConfig(VcnGatewayConnectionConfig gatewayConnectionConfig)

Adds a configuration for an individual gateway connection.

VcnConfig build()

Builds and validates the VcnConfig.

VcnConfig.Builder setRestrictedUnderlyingNetworkTransports(Set<Integer> transports)

Sets transports that will be restricted by the VCN.

Inherited methods

Public constructors

Builder

Added in API level 31
public Builder (Context context)

Parameters
context Context: This value cannot be null.

Public methods

addGatewayConnectionConfig

Added in API level 31
public VcnConfig.Builder addGatewayConnectionConfig (VcnGatewayConnectionConfig gatewayConnectionConfig)

Adds a configuration for an individual gateway connection.

Parameters
gatewayConnectionConfig VcnGatewayConnectionConfig: the configuration for an individual gateway connection This value cannot be null.

Returns
VcnConfig.Builder this Builder instance, for chaining This value cannot be null.

Throws
IllegalArgumentException if a VcnGatewayConnectionConfig has already been set for this VcnConfig with the same GatewayConnection name (as returned via VcnGatewayConnectionConfig.getGatewayConnectionName()).

build

Added in API level 31
public VcnConfig build ()

Builds and validates the VcnConfig.

Returns
VcnConfig an immutable VcnConfig instance This value cannot be null.

setRestrictedUnderlyingNetworkTransports

Added in API level 34
public VcnConfig.Builder setRestrictedUnderlyingNetworkTransports (Set<Integer> transports)

Sets transports that will be restricted by the VCN.

In general, apps will not be able to bind to, or use a restricted network. In other words, unless the network type is marked restricted, any app can opt to use underlying networks, instead of through the VCN.

Parameters
transports Set: transports that will be restricted by VCN. Networks that include any of the transports will be marked as restricted. NetworkCapabilities.TRANSPORT_WIFI is marked restricted by default. This value cannot be null.

Returns
VcnConfig.Builder this Builder instance, for chaining This value cannot be null.

Throws
IllegalArgumentException if the input contains unsupported transport types.