Esempio n. 1
0
 public Task <WorkerEditor> CreateOrModify(
     string name,
     EndpointResource endpoint,
     WorkerPoolResource[] workerpools)
 {
     return(new WorkerEditor(this).CreateOrModify(name, endpoint, workerpools));
 }
        public async Task <MachineEditor> CreateOrModify(
            string name,
            EndpointResource endpoint,
            EnvironmentResource[] environments,
            string[] roles)
        {
            var existing = await repository.FindByName(name).ConfigureAwait(false);

            if (existing == null)
            {
                Instance = await repository.Create(new MachineResource
                {
                    Name           = name,
                    Endpoint       = endpoint,
                    EnvironmentIds = new ReferenceCollection(environments.Select(e => e.Id)),
                    Roles          = new ReferenceCollection(roles)
                }).ConfigureAwait(false);
            }
            else
            {
                existing.Name     = name;
                existing.Endpoint = endpoint;
                existing.EnvironmentIds.ReplaceAll(environments.Select(e => e.Id));
                existing.Roles.ReplaceAll(roles);

                Instance = await repository.Modify(existing).ConfigureAwait(false);
            }

            return(this);
        }
Esempio n. 3
0
        public WorkerEditor CreateOrModify(
            string name,
            EndpointResource endpoint,
            WorkerPoolResource[] pools)
        {
            var existing = repository.FindByName(name);

            if (existing == null)
            {
                Instance = repository.Create(new WorkerResource
                {
                    Name          = name,
                    Endpoint      = endpoint,
                    WorkerPoolIds = new ReferenceCollection(pools.Select(e => e.Id))
                });
            }
            else
            {
                existing.Name     = name;
                existing.Endpoint = endpoint;
                existing.WorkerPoolIds.ReplaceAll(pools.Select(e => e.Id));

                Instance = repository.Modify(existing);
            }

            return(this);
        }
Esempio n. 4
0
        public async Task <WorkerEditor> CreateOrModify(
            string name,
            EndpointResource endpoint,
            WorkerPoolResource[] workerpools)
        {
            var existing = await repository.FindByName(name).ConfigureAwait(false);

            if (existing == null)
            {
                Instance = await repository.Create(new WorkerResource
                {
                    Name          = name,
                    Endpoint      = endpoint,
                    WorkerPoolIds = new ReferenceCollection(workerpools.Select(e => e.Id))
                }).ConfigureAwait(false);
            }
            else
            {
                existing.Name     = name;
                existing.Endpoint = endpoint;
                existing.WorkerPoolIds.ReplaceAll(workerpools.Select(e => e.Id));

                Instance = await repository.Modify(existing).ConfigureAwait(false);
            }

            return(this);
        }
Esempio n. 5
0
 public MachineEditor CreateOrModify(
     string name,
     EndpointResource endpoint,
     EnvironmentResource[] environments,
     string[] roles)
 {
     return(new MachineEditor(this).CreateOrModify(name, endpoint, environments, roles));
 }
Esempio n. 6
0
 public Task <MachineEditor> CreateOrModify(
     string name,
     EndpointResource endpoint,
     EnvironmentResource[] environments,
     string[] roles,
     TenantResource[] tenants,
     TagResource[] tenantTags)
 {
     return(new MachineEditor(this).CreateOrModify(name, endpoint, environments, roles, tenants, tenantTags));
 }
Esempio n. 7
0
 public MachineEditor CreateOrModify(
     string name,
     EndpointResource endpoint,
     EnvironmentResource[] environments,
     string[] roles,
     TenantResource[] tenants,
     TagResource[] tenantTags,
     TenantedDeploymentMode?tenantedDeploymentParticipation)
 {
     return(new MachineEditor(this).CreateOrModify(name, endpoint, environments, roles, tenants, tenantTags, tenantedDeploymentParticipation));
 }
        public async Task <MachineEditor> CreateOrModify(
            string name,
            EndpointResource endpoint,
            EnvironmentResource[] environments,
            string[] roles,
            TenantResource[] tenants,
            TagResource[] tenantTags,
            TenantedDeploymentMode?tenantedDeploymentParticipation = null)
        {
            var existing = await repository.FindByName(name).ConfigureAwait(false);

            if (existing == null)
            {
                var resource = new MachineResource
                {
                    Name           = name,
                    Endpoint       = endpoint,
                    EnvironmentIds = new ReferenceCollection(environments.Select(e => e.Id)),
                    Roles          = new ReferenceCollection(roles),
                    TenantIds      = new ReferenceCollection(tenants.Select(t => t.Id)),
                    TenantTags     = new ReferenceCollection(tenantTags.Select(t => t.CanonicalTagName)),
                };

                if (tenantedDeploymentParticipation.HasValue)
                {
                    resource.TenantedDeploymentParticipation = tenantedDeploymentParticipation.Value;
                }

                Instance = await repository.Create(resource).ConfigureAwait(false);
            }
            else
            {
                existing.Name     = name;
                existing.Endpoint = endpoint;
                existing.EnvironmentIds.ReplaceAll(environments.Select(e => e.Id));
                existing.Roles.ReplaceAll(roles);
                existing.TenantIds.ReplaceAll(tenants.Select(t => t.Id));
                existing.TenantTags.ReplaceAll(tenantTags.Select(t => t.CanonicalTagName));

                if (tenantedDeploymentParticipation.HasValue)
                {
                    existing.TenantedDeploymentParticipation = tenantedDeploymentParticipation.Value;
                }

                Instance = await repository.Modify(existing).ConfigureAwait(false);
            }

            return(this);
        }
Esempio n. 9
0
        public MachineEditor CreateOrModify(
            string name,
            EndpointResource endpoint,
            EnvironmentResource[] environments,
            string[] roles,
            TenantResource[] tenants,
            TagResource[] tenantTags)
        {
            var existing = repository.FindByName(name);

            if (existing == null)
            {
                Instance = repository.Create(new MachineResource
                {
                    Name           = name,
                    Endpoint       = endpoint,
                    EnvironmentIds = new ReferenceCollection(environments.Select(e => e.Id)),
                    Roles          = new ReferenceCollection(roles),
                    TenantIds      = new ReferenceCollection(tenants.Select(t => t.Id)),
                    TenantTags     = new ReferenceCollection(tenantTags.Select(t => t.CanonicalTagName))
                });
            }
            else
            {
                existing.Name     = name;
                existing.Endpoint = endpoint;
                existing.EnvironmentIds.ReplaceAll(environments.Select(e => e.Id));
                existing.Roles.ReplaceAll(roles);
                existing.TenantIds.ReplaceAll(tenants.Select(t => t.Id));
                existing.TenantTags.ReplaceAll(tenantTags.Select(t => t.CanonicalTagName));

                Instance = repository.Modify(existing);
            }

            return(this);
        }
 public Task <MachineEditor> CreateOrModify(string name, EndpointResource endpoint, EnvironmentResource[] environments, string[] roles)
 {
     throw new System.NotImplementedException();
 }
 public Task <MachineEditor> CreateOrModify(string name, EndpointResource endpoint, EnvironmentResource[] environments, string[] roles,
                                            TenantResource[] tenants, TagResource[] tenantTags, TenantedDeploymentMode?tenantedDeploymentParticipation)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 12
0
 public MachineEditor CreateOrModify(string name, EndpointResource endpoint, EnvironmentResource[] environments,
                                     string[] roles)
 {
     return(null);
 }
 public MachineEditor CreateOrModify(string name, EndpointResource endpoint, EnvironmentResource[] environments, string[] roles,
                                     TenantResource[] tenants, TagResource[] tenantTags)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 14
0
 public InternalEndpointsParser()
 {
     regionIdEndpointCollection = EndpointResource.GetRegionalEndpoints();
     globalEndpointCollection   = EndpointResource.GetGlobalEndpoints();
 }