-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" /> | ||
<package id="Octopus.Client" version="2.5.3.245" targetFramework="net40" /> | ||
<package id="ScriptCs.Contracts" version="0.9.0" targetFramework="net45" /> | ||
<package id="ScriptCs.OctopusClient" version="0.0.2" targetFramework="net45" /> | ||
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" /> | ||
<package id="Octopus.Client" version="2.5.8.447" targetFramework="net40" /> | ||
<package id="ScriptCs.Contracts" version="0.10.2" targetFramework="net45" /> | ||
<package id="ScriptCs.OctopusClient" version="0.1.1" targetFramework="net45" /> | ||
<package id="Sprache" version="1.10.0.37" targetFramework="net40" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
var octopus = Require<OctopusClientPack>(); | ||
var repo = octopus.GetRepository("http://server/octopusdeploy/api", "API-XXXXXXXXXXXXXXXXXXXXXXXXXXX"); | ||
var server = octopus.Server("http://server/octopusdeploy/api", "API-XXXXXXXXXXXXXXXXXXXXXXXXXXX"); | ||
Console.WriteLine("Getting the current user..."); | ||
var user = repo.Users.GetCurrent(); | ||
var user = server.Users.GetCurrent(); | ||
Console.WriteLine("Current user: {0}", user.DisplayName); | ||
Console.WriteLine("Getting your dashboard..."); | ||
var dashboard = repo.Dashboards.GetDashboard(); | ||
var dashboard = server.Dashboards.GetDashboard(); | ||
foreach(var item in dashboard.Items) | ||
{ | ||
var project = repo.Projects.Get(item.ProjectId); | ||
var environment = repo.Environments.Get(item.EnvironmentId); | ||
var project = server.Projects.Get(item.ProjectId); | ||
var environment = server.Environments.Get(item.EnvironmentId); | ||
Console.WriteLine("Project: {0} -> Environment: {1} -> Release Version: {2}", project.Name, environment.Name, item.ReleaseVersion); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,76 @@ | ||
using Octopus.Client; | ||
using System.IO; | ||
using System.Runtime.InteropServices.ComTypes; | ||
using Octopus.Client; | ||
using Octopus.Client.Model; | ||
using ScriptCs.Contracts; | ||
|
||
namespace ScriptCs.OctopusClient | ||
{ | ||
public class OctopusClientPack : IScriptPackContext | ||
{ | ||
public OctopusRepository GetRepository(string hostUrl, string apiKey) | ||
private IOctopusClient _client; | ||
|
||
public OctopusRepository Server(string hostUrl, string apiKey) | ||
{ | ||
var endpoint = new OctopusServerEndpoint(hostUrl, apiKey); | ||
|
||
return new OctopusRepository(endpoint); | ||
var repository = new OctopusRepository(endpoint); | ||
_client = repository.Client; | ||
|
||
return repository; | ||
} | ||
|
||
public RootResource GetRootDocument() | ||
{ | ||
return _client.RootDocument; | ||
} | ||
|
||
public ResourceCollection<T> List<T>(string path, object pathParameters = null) | ||
{ | ||
return _client.List<T>(path, pathParameters); | ||
} | ||
|
||
public T Get<T>(string path, object pathParameters = null) | ||
{ | ||
return _client.Get<T>(path, pathParameters); | ||
} | ||
|
||
public Stream GetContent(string path) | ||
{ | ||
return _client.GetContent(path); | ||
} | ||
|
||
public T Create<T>(string path, T resource) | ||
{ | ||
return _client.Create(path, resource); | ||
} | ||
|
||
public void Post(string path) | ||
{ | ||
_client.Post(path); | ||
} | ||
public void Post<T>(string path, T resource) | ||
{ | ||
_client.Post(path, resource); | ||
} | ||
|
||
public void Put<T>(string path, T resource) | ||
{ | ||
_client.Put(path, resource); | ||
} | ||
|
||
public void PutContent(string path, Stream content) | ||
{ | ||
_client.PutContent(path, content); | ||
} | ||
|
||
public T Update<T>(string path, T resource) | ||
{ | ||
return _client.Update(path, resource); | ||
} | ||
|
||
public TaskResource Delete(string path) | ||
{ | ||
return _client.Delete(path); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" /> | ||
<package id="Octopus.Client" version="2.5.3.245" targetFramework="net45" /> | ||
<package id="ScriptCs.Contracts" version="0.9.0" targetFramework="net45" /> | ||
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" /> | ||
<package id="Octopus.Client" version="2.5.8.447" targetFramework="net45" /> | ||
<package id="ScriptCs.Contracts" version="0.10.2" targetFramework="net45" /> | ||
<package id="Sprache" version="1.10.0.37" targetFramework="net45" /> | ||
</packages> |