Microsoft.Azure.Commands.Network.ChildResourceHelp.GetResourceNotSetId C# (CSharp) Method

GetResourceNotSetId() public static method

public static GetResourceNotSetId ( string subscriptionId, string resource, string resourceName ) : string
subscriptionId string
resource string
resourceName string
return string
        public static string GetResourceNotSetId(string subscriptionId, string resource, string resourceName)
        {
            return string.Format(
                Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayChildResourceId,
                subscriptionId,
                Microsoft.Azure.Commands.Network.Properties.Resources.ResourceGroupNotSet,
                Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayNameNotSet,
                resource,
                resourceName);
        }

Usage Example

Example #1
0
        public override void Execute()
        {
            base.Execute();

            if (ShouldProcess(Name, Properties.Resources.AddingResourceMessage + Properties.Resources.VirtualNetworkGatewayIpConfigName))
            {
                // Get the subnetId and publicIpAddressId from the objects if specified
                if (string.Equals(ParameterSetName, "object"))
                {
                    if (Subnet != null)
                    {
                        this.SubnetId = this.Subnet.Id;
                    }
                    if (PublicIpAddress != null)
                    {
                        this.PublicIpAddressId = this.PublicIpAddress.Id;
                    }
                }

                var vnetGatewayIpConfig = new PSVirtualNetworkGatewayIpConfiguration();
                vnetGatewayIpConfig.Name = this.Name;

                if (!string.IsNullOrEmpty(this.SubnetId))
                {
                    vnetGatewayIpConfig.Subnet    = new PSResourceId();
                    vnetGatewayIpConfig.Subnet.Id = this.SubnetId;
                }
                if (!string.IsNullOrEmpty(this.PrivateIpAddress))
                {
                    vnetGatewayIpConfig.PrivateIpAddress          = this.PrivateIpAddress;
                    vnetGatewayIpConfig.PrivateIpAllocationMethod = Management.Network.Models.IPAllocationMethod.Static;
                }
                else
                {
                    vnetGatewayIpConfig.PrivateIpAllocationMethod = Management.Network.Models.IPAllocationMethod.Dynamic;
                }

                if (!string.IsNullOrEmpty(this.PublicIpAddressId))
                {
                    vnetGatewayIpConfig.PublicIpAddress    = new PSResourceId();
                    vnetGatewayIpConfig.PublicIpAddress.Id = this.PublicIpAddressId;
                }

                vnetGatewayIpConfig.Id =
                    ChildResourceHelp.GetResourceNotSetId(
                        this.NetworkClient.NetworkManagementClient.SubscriptionId,
                        Properties.Resources.VirtualNetworkGatewayIpConfigName,
                        this.Name);

                if (this.VirtualNetworkGateway.IpConfigurations == null)
                {
                    this.VirtualNetworkGateway.IpConfigurations = new List <PSVirtualNetworkGatewayIpConfiguration>();
                }
                this.VirtualNetworkGateway.IpConfigurations.Add(vnetGatewayIpConfig);

                WriteObject(this.VirtualNetworkGateway);
            }
        }
All Usage Examples Of Microsoft.Azure.Commands.Network.ChildResourceHelp::GetResourceNotSetId