Ejemplo n.º 1
0
        public async Task <PartitionDescription> CreatePartitionAsync(PartitionDescription pd)
        {
            var stage = ProvisioningStage.None;

            AssertInternetOfThings();
            AssertPartitionDescription(pd);

            try
            {
                stage = ProvisioningStage.StorePartitionInDatabase;

                StorePartitionInDatabase(pd.Description, pd.Area, pd.Namespace, pd.EventStore,
                                         pd.Owner, pd.OwnerSecret, pd.StorageAccount,
                                         pd.AccessControl, pd.AccessControlSecret);

                stage = ProvisioningStage.CreatePartitionInServiceBus;
                await CreatePartitionInServiceBus(pd.Namespace);

                stage = ProvisioningStage.CreatePartitionInTableStorage;
                await CreatePartitionInTableStorage(pd.Namespace);

                stage = ProvisioningStage.CreatePartitionInAccessControl;
                CreatePartitionInAccessControl(pd.Namespace);
            }
            catch (Exception ex)
            {
                throw new ProvisioningException(EXCEPTION_PARTITION, ex)
                      {
                          Stage = stage
                      };
            }

            return(pd);
        }
Ejemplo n.º 2
0
        private void AssertPartitionDescription(PartitionDescription pd)
        {
            if (pd == null)
            {
                throw new ArgumentNullException("pd");
            }

            pd.Assert();
        }
Ejemplo n.º 3
0
        public void ActivatePartition(PartitionDescription pd)
        {
            AssertInternetOfThings();
            AssertPartitionDescription(pd);

            try
            {
                _partitionRepository.ActivatePartition(pd.Namespace);
            }
            catch (Exception ex)
            {
                throw new ProvisioningException(EXCEPTION_PARTITION, ex)
                      {
                          Stage = ProvisioningStage.ActivatePartition
                      };
            }
        }
Ejemplo n.º 4
0
 public PartitionDescription CreatePartition(PartitionDescription pd)
 {
     return(CreatePartitionAsync(pd).Result);
 }