Ejemplo n.º 1
0
        private void SetupManagementClients(MockContext context)
        {
            ResourceManagementClient = GetResourceManagementClient(context);
            IotHubClient             = GetIotHubClient(context);
            IotDpsClient             = GetIotDpsClient(context);

            _helper.SetupManagementClients(
                ResourceManagementClient,
                IotHubClient,
                IotDpsClient
                );
        }
Ejemplo n.º 2
0
 protected void Initialize(MockContext context)
 {
     if (!_isInitialized)
     {
         lock (_initLock)
         {
             if (!_isInitialized)
             {
                 _testEnv            = TestEnvironmentFactory.GetTestEnvironment();
                 _resourcesClient    = GetClient <ResourceManagementClient>(context);
                 _provisioningClient = GetClient <IotDpsClient>(context);
             }
             _isInitialized = true;
         }
     }
 }
 protected void Initialize(MockContext context)
 {
     if (!initialized)
     {
         lock (locker)
         {
             if (!initialized)
             {
                 testEnv            = TestEnvironmentFactory.GetTestEnvironment();
                 resourcesClient    = GetClient <ResourceManagementClient>(context);
                 provisioningClient = GetClient <IotDpsClient>(context);
             }
             initialized = true;
         }
     }
 }
        private async Task CreateDeviceProvisioningService(IResourceGroup resourceGroup)
        {
            var client = new IotDpsClient(new TokenCredentials(_accessToken))
            {
                SubscriptionId = _configuration.SubscriptionId
            };
            var deviceProvisioningService = await client.IotDpsResource.BeginCreateOrUpdateAsync(
                resourceGroup.Name,
                _configuration.ResourceNamePrefix + "Dps",
                new ProvisioningServiceDescription(
                    _configuration.RegionName,
                    new IotDpsPropertiesDescription(),
                    new IotDpsSkuInfo("S1", "Standard", 1)));

            Console.WriteLine($"Successfully created or updated Device Provisioning Service '{deviceProvisioningService.Name}'");
        }