Working with Resources

You can load, modify and save resources using the different Repository classes provided in the Octopus.Client library. The following example retrieves a deployment target, names it Test Server 1 and then saves it:

PowerShell
$machine = $repository.Machines.Get("machines-1");
$machine.Name = "Test Server 1";
$repository.Machines.Modify($machine);
C#
// Sync
var machine = repository.Machines.Get("machines-1");
machine.Name = "Test Server 1";
repository.Machines.Modify(machine);
 
// Async
var machine = await repository.Machines.Get("machines-1");
machine.Name = "Test Server 1";
await repository.Machines.Modify(machine);

The repository methods all make direct HTTP requests. There’s no “session” abstraction or transaction support.

Help us continuously improve

Please let us know if you have any feedback about this page.

Send feedback

Page updated on Sunday, January 1, 2023