public DigitalOceanClient(string token) { var client = new RestClient(DigitalOceanApiUrl) { UserAgent = "digitalocean-api-dotnet" }; client.AddDefaultHeader("Authorization", $"Bearer {token}"); _connection = new Connection(client); Actions = new ActionsClient(_connection); DomainRecords = new DomainRecordsClient(_connection); Domains = new DomainsClient(_connection); DropletActions = new DropletActionsClient(_connection); Droplets = new DropletsClient(_connection); FloatingIps = new FloatingIpsClient(_connection); FloatingIpActions = new FloatingIpActionsClient(_connection); ImageActions = new ImageActionsClient(_connection); Images = new ImagesClient(_connection); Keys = new KeysClient(_connection); Regions = new RegionsClient(_connection); Sizes = new SizesClient(_connection); Snapshots = new SnapshotsClient(_connection); Tags = new TagsClient(_connection); Volumes = new VolumesClient(_connection); }
public void CorrectRequestForGetUpgrades() { var factory = Substitute.For<IConnection>(); var client = new DropletsClient(factory); client.GetUpgrades(); factory.Received().GetPaginated<DropletUpgrade>("droplet_upgrades", null); }
public void CorrectRequestForListDropletNeighbors() { var factory = Substitute.For <IConnection>(); var client = new DropletsClient(factory); client.ListDropletNeighbors(); factory.Received().GetPaginated <Droplet>("reports/droplet_neighbors", null, "neighbors"); }
public void CorrectRequestForGetAll() { var factory = Substitute.For <IConnection>(); var client = new DropletsClient(factory); client.GetAll(); factory.Received().GetPaginated <Models.Responses.Droplet>("droplets", null, "droplets"); }
public void CorrectRequestForDelete() { var factory = Substitute.For<IConnection>(); var client = new DropletsClient(factory); client.Delete(9001); var parameters = Arg.Is<List<Parameter>>(list => (int)list[0].Value == 9001); factory.Received().ExecuteRaw("droplets/{id}", parameters, Method.DELETE); }
public void CorrectRequestForGet() { var factory = Substitute.For<IConnection>(); var client = new DropletsClient(factory); client.Get(9001); var parameters = Arg.Is<List<Parameter>>(list => (int)list[0].Value == 9001); factory.Received().ExecuteRequest<Droplet>("droplets/{id}", parameters, null, "droplet"); }
public void CorrectRequestForCreate() { var factory = Substitute.For<IConnection>(); var client = new DropletsClient(factory); var body = new Models.Requests.Droplet(); client.Create(body); factory.Received().ExecuteRequest<Droplet>("droplets", null, body, "droplet", Method.POST); }
public void CorrectRequestForGetActions() { var factory = Substitute.For<IConnection>(); var client = new DropletsClient(factory); client.GetActions(9001); var parameters = Arg.Is<List<Parameter>>(list => (int)list[0].Value == 9001); factory.Received().GetPaginated<Action>("droplets/{id}/actions", parameters, "actions"); }
public void CorrectRequestForGetAllByTag() { var factory = Substitute.For <IConnection>(); var client = new DropletsClient(factory); client.GetAllByTag("notarealtag"); var parameters = Arg.Is <List <Parameter> >(list => (string)list[0].Value == "notarealtag"); factory.Received().GetPaginated <Droplet>("droplets?tag_name={name}", parameters, "droplets"); }
public void CorrectRequestForDeleteByTag() { var factory = Substitute.For <IConnection>(); var client = new DropletsClient(factory); client.DeleteByTag("notarealtag"); var parameters = Arg.Is <List <Parameter> >(list => (string)list[0].Value == "notarealtag"); factory.Received().ExecuteRaw("droplets?tag_name={name}", parameters, null, Method.DELETE); }
public async void CorrectRequestForGetAll() { var factory = Substitute.For <IConnection>(); var client = new DropletsClient(factory); var body = new Models.Requests.Droplet(); var droplet = await client.Create(body); await DropletUtils.AwaitStatus(client, droplet.Id, "active"); // client.GetAll(); // // factory.Received().GetPaginated<Size>("sizes", null, "sizes"); }
public DigitalOceanClient(string token) { var client = new RestClient(DigitalOceanApiUrl) { UserAgent = "digitalocean-api-dotnet" }; client.AddDefaultHeader("Authorization", string.Format("Bearer {0}", token)); _connection = new Connection(client); Account = new AccountClient(_connection); Actions = new ActionsClient(_connection); CdnEndpoints = new CdnEndpointsClient(_connection); Certificates = new CertificatesClient(_connection); ContainerRegistry = new ContainerRegistryClient(_connection); Databases = new DatabasesClient(_connection); DomainRecords = new DomainRecordsClient(_connection); Domains = new DomainsClient(_connection); DropletActions = new DropletActionsClient(_connection); Droplets = new DropletsClient(_connection); Firewalls = new FirewallsClient(_connection); FloatingIpActions = new FloatingIpActionsClient(_connection); FloatingIps = new FloatingIpsClient(_connection); ImageActions = new ImageActionsClient(_connection); Images = new ImagesClient(_connection); LoadBalancers = new LoadBalancerClient(_connection); Projects = new ProjectsClient(_connection); ProjectResources = new ProjectResourcesClient(_connection); Keys = new KeysClient(_connection); Kubernetes = new KubernetesClient(_connection); Regions = new RegionsClient(_connection); Sizes = new SizesClient(_connection); Snapshots = new SnapshotsClient(_connection); Tags = new TagsClient(_connection); Volumes = new VolumesClient(_connection); VolumeActions = new VolumeActionsClient(_connection); BalanceClient = new BalanceClient(_connection); Vpc = new VpcClient(_connection); }
public DigitalOceanClient(string token) { var client = new RestClient(DigitalOceanApiUrl) { UserAgent = "digitalocean-api-dotnet" }; client.AddDefaultHeader("Authorization", string.Format("Bearer {0}", token)); _connection = new Connection(client); Actions = new ActionsClient(_connection); DomainRecords = new DomainRecordsClient(_connection); Domains = new DomainsClient(_connection); DropletActions = new DropletActionsClient(_connection); Droplets = new DropletsClient(_connection); ImageActions = new ImageActionsClient(_connection); Images = new ImagesClient(_connection); Keys = new KeysClient(_connection); Regions = new RegionsClient(_connection); Sizes = new SizesClient(_connection); }