Giter Site home page Giter Site logo

digitalocean.api's Introduction

Hi there ๐Ÿ‘‹

Something will eventually be here! ๐Ÿ‘€

digitalocean.api's People

Contributors

alienhoboken avatar alistergreg avatar azakhi avatar coskun avatar dependabot-preview[bot] avatar fossabot avatar jagbarrameda avatar johnkiller avatar joshclose avatar krstr96 avatar nicholi avatar podobaas avatar reesarthurchmiel avatar ruslanfirefly avatar shahab1363 avatar stannedelchev avatar taskyman avatar trmcnvn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

digitalocean.api's Issues

Better Exception Handling

Great project; nicely done.

Recommend better exception handling, by making it all Task based its very hard to figure out what the exceptions mean. Perhaps you can have a way of passing out the exceptions or having some kind of event we can bind to?

Error getting information about a Droplet

Functions client.Droplets.GetAll() and client.Droplets.Get() dont work. :(

var client = new DigitalOceanClient("[API_KEY]");
var task = client.Droplets.GetAll();
task.Wait();

Unable to cast object of type "RestSharp.JsonArray" to type "System.Collections.Generic.IDictionary`2[System.String,System.Object]".

Missing Features

New API sections yet to be integrated:

  • Billing History
  • Invoices

There is also a new Container Registry API, but it is listed as Private Beta.

Droplet.GetAll() not working

Hello, after 3 month of working yesterday client.Droplet.GetAll() stop working with ex.message="Not Found", but curl or doctl.exe returning fine. Please help

Equal name class in different namespace

Thanks for this library! :)

I use this library in my project, but I have difficulties because the same names for the request and response classes, albeit in different namespaces. Often it is necessary to use the request and response class in the same class.
It turns out 2 options:

  1. Use alias
  2. Use the full name of the type.

All these 2 options impair code reading. Could it be better to use endings in classes?

Task<DigitalOcean.API.Models.Responses.Action>> and etc

For example:
ActionRq - request
ActionRs - response

OR

ActionRequest
ActionResponse

[PR Consideration] Type changes for Request/Response Models

Since you just made the version 3 bump change, I am guessing from the minor API breakage in renaming the TTL to Ttl properties, I'd like to start consideration for possible type changes from 2.x. Mostly would like to know if you would be amenable to a detailed audit of all the current Request/Response models in the form of a PR. Possibly also considering any name inconsistencies like the TTL/Ttl thing.

Some of the things I am thinking of:

  1. All ValueTypes properties in Request models should be marked as Nullable if they are not required in the request. I have seem semi-inconsistent notation in some of the Request models, some marking their ints/floats/bools as Nullable and others not. Ones I've already noticed would be the booleans in Models.Requests.Droplet: backups, ipv6, private_networking, monitoring. Obviously this would cause no "real change", as the defaults for all these when unsent is false and the default value for any boolean is false anyways in C#. But would seem like an appropriate time for a consistency fix.

  2. Changing the types from float to Decimal for PriceMonthly and PriceHourly in Models.Responses.Sizes. As these values are specifically for currencies, Decimal would seem more appropriate in my mind.

I haven't really looked through too many of the classes that closely, but other things might come up.

Images - Add missing SizeGigabytes

I would like to know the size in gigabytes of the image/ snapshot

API shows

size_gigabytes | integer | The size of the image in gigabytes.

Cannot use NuGet to install into my new project.

Hi, I have tried
[1] Download this project source and open with VS2015, and
[2] Opened a new project and go to NuGet to install "DigitalOcean.API" in my project. (Although I changed my project's Target framework into .NET 2.0 or .NET 4.5.2, still got errors)
But seems all methods are not work for me. I don't know why, I have no ideas. Please advise with thanks!

For [1] ref:
image

For [2] ref:
image

Differentiate Between Databases & Database Clusters

Could some of database & database cluster namespaces be changed for clarity?
For example, currently
client.Databases.GetAll() returns a list of database clusters.
client.Databases.GetAllDatabases(string id)returns a list of actual databases.

Could change to something like:
client.DatabaseClusters.GetAll() client.DatabaseClusters.GetById(string id) client.DatabaseClusters.Add() for database clusters and let the actual database methods continue to occupy the "Databases" namespace.

Support for portable .Net projects

The motivation is to have DigitalOcean Api clients for Windows Phone and Windows 8.1.
There are json serializers and Rest clients for portable .Net so it possible to make DigitalOcean.API a portable .Net project. I think of SharpSerializer (maybe Json supports has been added already, if not there are others) and Microsoft.Net.HTTP library (https://www.nuget.org/packages/Microsoft.Net.Http).

Missing Features

  • Block Storage (#46)
  • Block Storage Actions (#47)
  • Databases (#50)
  • Droplets (#51)
    • Create multiple Droplets
    • List Neighbors for a Droplet
    • List all Droplet Neighbors
  • Droplet Actions (#51)
    • Enable Backups
    • Acting on Tagged Droplets
  • Floating IPs (#48)
  • Floating IP Actions (#48)
  • Firewalls (#49)
  • Images (#51)
    • Create Image (#43)
    • List Images by Tag
    • List all actions for an Image
  • Image Actions
    • Convert an Image to a Snapshot
  • Kubernetes (#52)

How to create droplet from a snapshot

I see the API supports creating snapshots from a droplet. However, I wish to create a droplet from an old snapshot. Do you know if this is supported?

Thanks

InboundRule.Sources being an array causing ``422 unprocessable_entity: You specified an invalid type for one of the sources` error response.

According to DigitalOcean API creating firewall section (https://developers.digitalocean.com/documentation/v2/#create-a-new-firewall) sources attribute of InboundRule should be a single object. Providing an array results in an error response as given in title. To be sure I tested following bodies using Postman:

{ "name": "test", "inbound_rules": [ { "protocol": "tcp", "ports": "22", "sources": [ { "addresses": [ "18.0.0.0/8" ] } ] } ] }
Response: { "id": "unprocessable_entity", "message": "You specified an invalid type for one of the sources.", "request_id": "" }

Single object request:
{ "name": "test", "inbound_rules": [ { "protocol": "tcp", "ports": "22", "sources": { "addresses": [ "18.0.0.0/8" ] } } ] }
Response: successfully created firewall

Point in time restore call fails with status code 422 - unprocessable_entity

Hi,

At the outset, thank you for such a great client. Clients make interacting with APIs so seamless and quick.

Problem

A few days ago, I was using this client in order to do a point in time restore of a managed DB on our account. Here is the API documentation for that particular call.

My request looked like this:

	var restoreDBRequest = new DatabaseBackup
	{
		Name = "db-restored-from-API",
		Engine = "pg",
		Version = "10",
		Size = "db-s-1vcpu-2gb",
		Region = "blr1",
		NumNodes = 2,
		Tags = new List<string>(),
		BackupRestore = new DatabaseBackupRestore
		{
			DatabaseName = "existing-db",
			CreatedAt = new DateTime(2021, 02, 20, 16, 45, 0)
		}
	};

Which constantly threw the error with a status code 422:

{"message":"invalid json body","id":"unprocessable_entity","request_id":"XXXXX"}

Using this information, I contacted digital ocean's support for a resolution and after much back and forth it has been solved. As per them

  1. The name of the restored db cannot contain capital letters.
  2. The timestamp should be in ISO8601 format.

I made these 2 changes and executed the request:

	var restoreDBRequest = new DatabaseBackup
	{
-		Name = "db-restored-from-API",
+		Name = "db-restored-from-api",
		Engine = "pg",
		Version = "10",
		Size = "db-s-1vcpu-2gb",
		Region = "blr1",
		NumNodes = 2,
		Tags = new List<string>(),
		BackupRestore = new DatabaseBackupRestore
		{
			DatabaseName = "existing-db",
-			CreatedAt = new DateTime(2021, 02, 20, 16, 45, 0)
+			CreatedAt = new DateTime(2021, 02, 20, 16, 45, 0, DateTimeKind.Local)
		}
	};

And I was successfully able to restore my DB to the point in time that I wanted.

Issue

  1. Do you think it makes sense to run a .ToLower() on the DatabaseBackup.Name field?
  2. Do you think it makes sense to throw an exception if the Kind property of DatabaseBackupRestore.CreatedAt is Unspecified?

Creating new Domain Records - ApiException: Not Found

Unable to create domain records and am getting the Not Found exception. Is this a bug or am I doing something wrong?

Thanks!

// subdomainName and ip are passed into this method

var record = new DomainRecord()
{
    Type = "A",
    Name = subdomainName,
    Data = ip,
};

await _client.DomainRecords.Create($"{subdomainName}", record);
Unhandled Exception: DigitalOcean.API.Exceptions.ApiException: Not Found
   at DigitalOcean.API.Extensions.RestSharpExtensions.ThrowIfException(IRestResponse response)
   at DigitalOcean.API.Extensions.RestSharpExtensions.ExecuteTask[T](IRestClient client, IRestRequest request)
   at DigitalOcean.API.Http.Connection.ExecuteRequest[T](String endpoint, IList`1 parameters, Object data, String expectedRoot, Method method)
   at ServerManager.Services.DigitalOceanService.AddDnsRecord(String ip, String subdomainName, String domainName) in C:\Users\chris\code\codestage\ServerManager\Services\DigitalOceanService.cs:line 83
   at CodeStageConsole.Commands.CreateWordpressSiteCommand.Execute(IService serverManager, Int32 serverId, String siteName) in C:\Users\chris\code\codestage\CodeStageConsole\Commands\CreateWordpressSiteCommand.cs:line 24
   at CodeStageConsole.Program.OnExecute() in C:\Users\chris\code\codestage\CodeStageConsole\Program.cs:line 65
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.InvokeAsync(MethodInfo method, Object instance, Object[] arguments)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.<OnExecute>b__0()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](IConsole console, String[] args)
   at CodeStageConsole.Program.Main(String[] args) in C:\Users\chris\code\codestage\CodeStageConsole\Program.cs:line 32

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.