Пример #1
0
        public override async Task ValidateAndResolveAsync(IAzure azure, FluentRequestModel fluentRequestModel, string propertyName, IGroupableModel parentModel, CancellationToken cancellationToken)
        {
            await this.ValidateAndResolveResourceGroupAsync(azure, fluentRequestModel, propertyName, parentModel, cancellationToken);

            if (this.Linux != null)
            {
                this.Linux.Validate($"{propertyName}.linux");
            }
            else if (this.Windows != null)
            {
                this.Windows.Validate($"{propertyName}.windows");
            }
            else
            {
                throw new ArgumentException($"{propertyName}.linux or {propertyName}.windows should be specified");
            }
            if (NewPrimaryNetwork != null)
            {
                NewPrimaryNetwork.Validate($"{propertyName}.newPrimaryNetwork");
                NewPrimaryNetwork.ResolveInlineCreatable(azure, this);
                NewPrimaryNetwork.ResolveCreatableReference(azure, fluentRequestModel);
            }
            if (ExistingPrimaryNetwork != null)
            {
                ExistingPrimaryNetwork.Validate($"{propertyName}.existingPrimaryNetwork");
                await ExistingPrimaryNetwork.ResolveResourceAsync(azure, cancellationToken);
            }
            if (NewPrimaryPublicIPAddress != null)
            {
                NewPrimaryPublicIPAddress.Validate($"{propertyName}.newPrimaryPublicIPAddress");
                NewPrimaryPublicIPAddress.ResolveInlineCreatable(azure, this);
                NewPrimaryPublicIPAddress.ResolveCreatableReference(azure, fluentRequestModel);
            }
            if (ExistingPrimaryPublicIPAddress != null)
            {
                ExistingPrimaryPublicIPAddress.Validate($"{propertyName}.existingPrimaryPublicIPAddress");
                await ExistingPrimaryPublicIPAddress.ResolveResourceAsync(azure, cancellationToken);
            }
            if (NewPrimaryNetworkInterface != null)
            {
                NewPrimaryNetworkInterface.Validate($"{propertyName}.newPrimaryNetworkInterface");
                NewPrimaryNetworkInterface.ResolveInlineCreatable(azure, this);
                NewPrimaryNetworkInterface.ResolveCreatableReference(azure, fluentRequestModel);
            }
            if (ExistingPrimaryNetworkInterface != null)
            {
                ExistingPrimaryNetworkInterface.Validate($"{propertyName}.existingPrimaryNetworkInterface");
                await ExistingPrimaryNetworkInterface.ResolveResourceAsync(azure, cancellationToken);
            }
            if (this.BootDiagnostics != null)
            {
                await this.BootDiagnostics.ValidateAndResolveAsync(azure, fluentRequestModel, $"{propertyName}.bootDiagnostics", this, cancellationToken);
            }
        }
Пример #2
0
        public override async Task ValidateAndResolveAsync(IAzure azure, FluentRequestModel fluentRequestModel, string propertyName, IGroupableModel parentModel, CancellationToken cancellationToken = default(CancellationToken))
        {
            await base.ValidateAndResolveResourceGroupAsync(azure, fluentRequestModel, propertyName, parentModel, cancellationToken);

            if (NewPrimaryNetwork != null)
            {
                NewPrimaryNetwork.Validate($"{propertyName}.newPrimaryNetwork");
                NewPrimaryNetwork.ResolveInlineCreatable(azure, this);
                NewPrimaryNetwork.ResolveCreatableReference(azure, fluentRequestModel);
            }
            if (ExistingPrimaryNetwork != null)
            {
                ExistingPrimaryNetwork.Validate($"{propertyName}.existingPrimaryNetwork");
                await ExistingPrimaryNetwork.ResolveResourceAsync(azure, cancellationToken);
            }
            if (NewPrimaryPublicIPAddress != null)
            {
                NewPrimaryPublicIPAddress.Validate($"{propertyName}.newPrimaryPublicIPAddress");
                NewPrimaryPublicIPAddress.ResolveInlineCreatable(azure, this);
                NewPrimaryPublicIPAddress.ResolveCreatableReference(azure, fluentRequestModel);
            }
            if (ExistingPrimiaryPublicIPAddress != null)
            {
                ExistingPrimiaryPublicIPAddress.Validate($"{propertyName}.existingPrimiaryPublicIPAddress");
                await ExistingPrimiaryPublicIPAddress.ResolveResourceAsync(azure, cancellationToken);
            }
            if (ExistingLoadBalancerBackends != null)
            {
                await ExistingLoadBalancerBackends.ValidateAndResolveAsync(azure, fluentRequestModel, $"{propertyName}.loadBalancerBackends", this, cancellationToken);
            }
            if (ExistingLoadBalancerInboundNatRules != null)
            {
                await ExistingLoadBalancerInboundNatRules.ValidateAndResolveAsync(azure, fluentRequestModel, $"{propertyName}.loadBalancerBackends", this, cancellationToken);
            }
            if (NewNetworkSecurityGroups != null)
            {
                await NewNetworkSecurityGroups.ValidateAndResolveAsync(azure, fluentRequestModel, $"{propertyName}.newPrimaryPublicIPAddress", this, cancellationToken);
            }
            if (ExistingNetworkSecurityGroups != null)
            {
                await ExistingNetworkSecurityGroups.ValidateAndResolveAsync(azure, fluentRequestModel, $"{propertyName}.existingNetworkSecurityGroups", this, cancellationToken);
            }
        }