Working with Resources
Last updated
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:
$machine = $repository.Machines.Get("machines-1");
$machine.Name = "Test Server 1";
$repository.Machines.Modify($machine);
// 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.
Need support? We're here to help.