void ApplyChanges(MachineResource machine, IEnumerable <EnvironmentResource> environment, MachinePolicyResource machinePolicy, IEnumerable <TenantResource> tenants)
        {
            machine.EnvironmentIds = new ReferenceCollection(environment.Select(e => e.Id).ToArray());
            machine.TenantIds      = new ReferenceCollection(tenants.Select(t => t.Id).ToArray());
            machine.TenantTags     = new ReferenceCollection(TenantTags);
            machine.Roles          = new ReferenceCollection(Roles);
            machine.Name           = MachineName;
            if (machinePolicy != null)
            {
                machine.MachinePolicyId = machinePolicy.Id;
            }

            if (CommunicationStyle == CommunicationStyle.TentaclePassive)
            {
                var listening = new ListeningTentacleEndpointResource();
                listening.Uri        = new Uri("https://" + TentacleHostname.ToLowerInvariant() + ":" + TentaclePort.ToString(CultureInfo.InvariantCulture) + "/").ToString();
                listening.Thumbprint = TentacleThumbprint;
                machine.Endpoint     = listening;
            }
            else if (CommunicationStyle == CommunicationStyle.TentacleActive)
            {
                var polling = new PollingTentacleEndpointResource();
                polling.Uri        = SubscriptionId.ToString();
                polling.Thumbprint = TentacleThumbprint;
                machine.Endpoint   = polling;
            }
        }
예제 #2
0
        protected void ApplyBaseChanges(MachineBasedResource machine, MachinePolicyResource machinePolicy, ProxyResource proxy)
        {
            machine.Name = MachineName;
            if (machinePolicy != null)
            {
                machine.MachinePolicyId = machinePolicy.Id;
            }

            if (CommunicationStyle == CommunicationStyle.TentaclePassive)
            {
                var listening = new ListeningTentacleEndpointResource();
                listening.Uri        = new Uri("https://" + TentacleHostname.ToLowerInvariant() + ":" + TentaclePort.ToString(CultureInfo.InvariantCulture) + "/").ToString();
                listening.Thumbprint = TentacleThumbprint;
                listening.ProxyId    = proxy?.Id;
                machine.Endpoint     = listening;
            }
            else if (CommunicationStyle == CommunicationStyle.TentacleActive)
            {
                var polling = new PollingTentacleEndpointResource();
                polling.Uri        = SubscriptionId.ToString();
                polling.Thumbprint = TentacleThumbprint;
                machine.Endpoint   = polling;
            }
        }