예제 #1
0
        public void TestRequest()
        {
            var restClient = new Mock <RestClient>();

            restClient.Setup(x => x.Execute(
                                 It.IsAny <IRestRequest>()
                                 )).Returns((IRestRequest val) => { return(new RestResponse {
                    Request = val
                }); });

            var iamConfig = new iam.Client.Configuration
            {
                BasePath  = "https://somehost.com",
                UserAgent = Api.UserAgent,
            };

            var client = iamConfig.CreateApiClient();

            iamConfig.ApiClient.RestClient = restClient.Object;

            var iam = new AccountManagementApi(new Config("apiKey"), iamConfig);

            try
            {
                iam.GetAccount();
            }
            catch (Exception)
            {
            }

            TestUserAgent(iamConfig.ApiClient.RestClient.UserAgent);
        }
예제 #2
0
        public Instance AddModuleInstance(ModuleEnum module, InstanceConfiguration instanceConfiguration)
        {
            var additionalProperties = instanceConfiguration.GetHashtable();
            var config = new Config(
                apiKey: instanceConfiguration.ApiKey,
                host: instanceConfiguration.Host)
            {
                AutostartNotifications = instanceConfiguration.AutostartDaemon,
                ForceClear             = true,
                LogLevel = LogLevel.ALL,
            };

            var instance = new Instance {
                Id = Guid.NewGuid().ToString(), Module = module, CreatedAt = DateTime.Now
            };

            switch (module)
            {
            case ModuleEnum.AccountManagementApi:
                var accountApi = new AccountManagementApi(config);
                Instances.Add(instance, accountApi);
                break;

            case ModuleEnum.CertificatesApi:
                var certApi = new CertificatesApi(config);
                Instances.Add(instance, certApi);
                break;

            case ModuleEnum.ConnectApi:
                var connectApi = new ConnectApi(config);
                Instances.Add(instance, connectApi);
                break;

            case ModuleEnum.DeviceDirectoryApi:
                var deviceApi = new DeviceDirectoryApi(config);
                Instances.Add(instance, deviceApi);
                break;

            case ModuleEnum.StubAPI:
                var stubApi = new StubApi(config);
                Instances.Add(instance, stubApi);
                break;

            case ModuleEnum.UpdateApi:
                var updateApi = new UpdateApi(config);
                Instances.Add(instance, updateApi);
                break;

            case ModuleEnum.EnrollmentApi:
                var enrollmentApi = new EnrollmentApi(config);
                Instances.Add(instance, enrollmentApi);
                break;

            case ModuleEnum.BootstrapApi:
                var bootstrapApi = new BootstrapApi(config);
                Instances.Add(instance, bootstrapApi);
                break;

            case ModuleEnum.BillingApi:
                var billingApi = new BillingApi(config);
                Instances.Add(instance, billingApi);
                break;
            }

            return(instance);
        }
 public void Init()
 {
     instance = new AccountManagementApi();
 }
예제 #4
0
        public void TestAccountManagementDeveloperApi()
        {
            var accountManagement = new AccountManagementApi(new Config("apiKey"));

            TestUserAgent(accountManagement.DeveloperApi.Configuration.UserAgent);
        }