Skip to content

fermyon/nomad-dotnet

Repository files navigation

Fermyon.Nomad - the C# library for the Nomad

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.4
  • SDK version: 0.4.0
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen

Frameworks supported

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Fermyon.Nomad.Api;
using Fermyon.Nomad.Client;
using Fermyon.Nomad.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out Fermyon.Nomad.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Fermyon.Nomad.Api;
using Fermyon.Nomad.Client;
using Fermyon.Nomad.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://127.0.0.1:4646/v1";
            // Configure API key authorization: X-Nomad-Token
            config.ApiKey.Add("X-Nomad-Token", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("X-Nomad-Token", "Bearer");

            var apiInstance = new ACLApi(config);
            var policyName = "policyName_example";  // string | The ACL policy name.
            var region = "region_example";  // string? | Filters results based on the specified region. (optional) 
            var _namespace = "_namespace_example";  // string? | Filters results based on the specified namespace. (optional) 
            var xNomadToken = "xNomadToken_example";  // string? | A Nomad ACL token. (optional) 
            var idempotencyToken = "idempotencyToken_example";  // string? | Can be used to ensure operations are only run once. (optional) 

            try
            {
                apiInstance.DeleteACLPolicy(policyName, region, _namespace, xNomadToken, idempotencyToken);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling ACLApi.DeleteACLPolicy: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://127.0.0.1:4646/v1

Class Method HTTP request Description
ACLApi DeleteACLPolicy DELETE /acl/policy/{policyName}
ACLApi DeleteACLToken DELETE /acl/token/{tokenAccessor}
ACLApi GetACLPolicies GET /acl/policies
ACLApi GetACLPolicy GET /acl/policy/{policyName}
ACLApi GetACLToken GET /acl/token/{tokenAccessor}
ACLApi GetACLTokenSelf GET /acl/token
ACLApi GetACLTokens GET /acl/tokens
ACLApi PostACLBootstrap POST /acl/bootstrap
ACLApi PostACLPolicy POST /acl/policy/{policyName}
ACLApi PostACLToken POST /acl/token/{tokenAccessor}
ACLApi PostACLTokenOnetime POST /acl/token/onetime
ACLApi PostACLTokenOnetimeExchange POST /acl/token/onetime/exchange
AllocationsApi GetAllocation GET /allocation/{allocID}
AllocationsApi GetAllocationServices GET /allocation/{allocID}/services
AllocationsApi GetAllocations GET /allocations
AllocationsApi PostAllocationStop POST /allocation/{allocID}/stop
ClientsApi GetAllocationLogs GET /client/fs/logs/{allocID}
DeploymentsApi GetDeployment GET /deployment/{deploymentID}
DeploymentsApi GetDeploymentAllocations GET /deployment/allocations/{deploymentID}
DeploymentsApi GetDeployments GET /deployments
DeploymentsApi PostDeploymentAllocationHealth POST /deployment/allocation-health/{deploymentID}
DeploymentsApi PostDeploymentFail POST /deployment/fail/{deploymentID}
DeploymentsApi PostDeploymentPause POST /deployment/pause/{deploymentID}
DeploymentsApi PostDeploymentPromote POST /deployment/promote/{deploymentID}
DeploymentsApi PostDeploymentUnblock POST /deployment/unblock/{deploymentID}
EnterpriseApi CreateQuotaSpec POST /quota
EnterpriseApi DeleteQuotaSpec DELETE /quota/{specName}
EnterpriseApi GetQuotaSpec GET /quota/{specName}
EnterpriseApi GetQuotas GET /quotas
EnterpriseApi PostQuotaSpec POST /quota/{specName}
EvaluationsApi GetEvaluation GET /evaluation/{evalID}
EvaluationsApi GetEvaluationAllocations GET /evaluation/{evalID}/allocations
EvaluationsApi GetEvaluations GET /evaluations
JobsApi DeleteJob DELETE /job/{jobName}
JobsApi GetJob GET /job/{jobName}
JobsApi GetJobAllocations GET /job/{jobName}/allocations
JobsApi GetJobDeployment GET /job/{jobName}/deployment
JobsApi GetJobDeployments GET /job/{jobName}/deployments
JobsApi GetJobEvaluations GET /job/{jobName}/evaluations
JobsApi GetJobScaleStatus GET /job/{jobName}/scale
JobsApi GetJobSummary GET /job/{jobName}/summary
JobsApi GetJobVersions GET /job/{jobName}/versions
JobsApi GetJobs GET /jobs
JobsApi PostJob POST /job/{jobName}
JobsApi PostJobDispatch POST /job/{jobName}/dispatch
JobsApi PostJobEvaluate POST /job/{jobName}/evaluate
JobsApi PostJobParse POST /jobs/parse
JobsApi PostJobPeriodicForce POST /job/{jobName}/periodic/force
JobsApi PostJobPlan POST /job/{jobName}/plan
JobsApi PostJobRevert POST /job/{jobName}/revert
JobsApi PostJobScalingRequest POST /job/{jobName}/scale
JobsApi PostJobStability POST /job/{jobName}/stable
JobsApi PostJobValidateRequest POST /validate/job
JobsApi RegisterJob POST /jobs
MetricsApi GetMetricsSummary GET /metrics
NamespacesApi CreateNamespace POST /namespace
NamespacesApi DeleteNamespace DELETE /namespace/{namespaceName}
NamespacesApi GetNamespace GET /namespace/{namespaceName}
NamespacesApi GetNamespaces GET /namespaces
NamespacesApi PostNamespace POST /namespace/{namespaceName}
NodesApi GetNode GET /node/{nodeId}
NodesApi GetNodeAllocations GET /node/{nodeId}/allocations
NodesApi GetNodes GET /nodes
NodesApi UpdateNodeDrain POST /node/{nodeId}/drain
NodesApi UpdateNodeEligibility POST /node/{nodeId}/eligibility
NodesApi UpdateNodePurge POST /node/{nodeId}/purge
OperatorApi DeleteOperatorRaftPeer DELETE /operator/raft/peer
OperatorApi GetOperatorAutopilotConfiguration GET /operator/autopilot/configuration
OperatorApi GetOperatorAutopilotHealth GET /operator/autopilot/health
OperatorApi GetOperatorRaftConfiguration GET /operator/raft/configuration
OperatorApi GetOperatorSchedulerConfiguration GET /operator/scheduler/configuration
OperatorApi PostOperatorSchedulerConfiguration POST /operator/scheduler/configuration
OperatorApi PutOperatorAutopilotConfiguration PUT /operator/autopilot/configuration
PluginsApi GetPluginCSI GET /plugin/csi/{pluginID}
PluginsApi GetPlugins GET /plugins
RegionsApi GetRegions GET /regions
ScalingApi GetScalingPolicies GET /scaling/policies
ScalingApi GetScalingPolicy GET /scaling/policy/{policyID}
SearchApi GetFuzzySearch POST /search/fuzzy
SearchApi GetSearch POST /search
StatusApi GetStatusLeader GET /status/leader
StatusApi GetStatusPeers GET /status/peers
SystemApi PutSystemGC PUT /system/gc
SystemApi PutSystemReconcileSummaries PUT /system/reconcile/summaries
VolumesApi CreateVolume POST /volume/csi/{volumeId}/{action}
VolumesApi DeleteSnapshot DELETE /volumes/snapshot
VolumesApi DeleteVolumeRegistration DELETE /volume/csi/{volumeId}
VolumesApi DetachOrDeleteVolume DELETE /volume/csi/{volumeId}/{action}
VolumesApi GetExternalVolumes GET /volumes/external
VolumesApi GetSnapshots GET /volumes/snapshot
VolumesApi GetVolume GET /volume/csi/{volumeId}
VolumesApi GetVolumes GET /volumes
VolumesApi PostSnapshot POST /volumes/snapshot
VolumesApi PostVolume POST /volumes
VolumesApi PostVolumeRegistration POST /volume/csi/{volumeId}

Documentation for Models

Documentation for Authorization

X-Nomad-Token

  • Type: API key
  • API key parameter name: X-Nomad-Token
  • Location: HTTP header

About

.NET client for Nomad.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages