@@ -74,6 +74,13 @@ const PUT_UPDATE_REPOSITORY_MAX_BYTES: usize = 4 * GIB;
7474 allow_other_tags = false ,
7575 policy = EndpointTagPolicy :: ExactlyOne ,
7676 tags = {
77+ "affinity" = {
78+ description = "Affinity and anti-affinity groups give control over instance placement." ,
79+ external_docs = {
80+ url = "http://docs.oxide.computer/api/affinity"
81+ }
82+
83+ } ,
7784 "disks" = {
7885 description = "Virtual disks are used to store instance-local data which includes the operating system." ,
7986 external_docs = {
@@ -1257,6 +1264,224 @@ pub trait NexusExternalApi {
12571264 disk_to_detach : TypedBody < params:: DiskPath > ,
12581265 ) -> Result < HttpResponseAccepted < Disk > , HttpError > ;
12591266
1267+ // Affinity Groups
1268+
1269+ /// List affinity groups
1270+ #[ endpoint {
1271+ method = GET ,
1272+ path = "/v1/affinity-groups" ,
1273+ tags = [ "affinity" ] ,
1274+ } ]
1275+ async fn affinity_group_list (
1276+ rqctx : RequestContext < Self :: Context > ,
1277+ query_params : Query < PaginatedByNameOrId < params:: ProjectSelector > > ,
1278+ ) -> Result < HttpResponseOk < ResultsPage < views:: AffinityGroup > > , HttpError > ;
1279+
1280+ /// Fetch an affinity group
1281+ #[ endpoint {
1282+ method = GET ,
1283+ path = "/v1/affinity-groups/{affinity_group}" ,
1284+ tags = [ "affinity" ] ,
1285+ } ]
1286+ async fn affinity_group_view (
1287+ rqctx : RequestContext < Self :: Context > ,
1288+ query_params : Query < params:: OptionalProjectSelector > ,
1289+ path_params : Path < params:: AffinityGroupPath > ,
1290+ ) -> Result < HttpResponseOk < views:: AffinityGroup > , HttpError > ;
1291+
1292+ /// List members of an affinity group
1293+ #[ endpoint {
1294+ method = GET ,
1295+ path = "/v1/affinity-groups/{affinity_group}/members" ,
1296+ tags = [ "affinity" ] ,
1297+ } ]
1298+ async fn affinity_group_member_list (
1299+ rqctx : RequestContext < Self :: Context > ,
1300+ query_params : Query < PaginatedById < params:: OptionalProjectSelector > > ,
1301+ path_params : Path < params:: AffinityGroupPath > ,
1302+ ) -> Result < HttpResponseOk < ResultsPage < AffinityGroupMember > > , HttpError > ;
1303+
1304+ /// Fetch an affinity group member
1305+ #[ endpoint {
1306+ method = GET ,
1307+ path = "/v1/affinity-groups/{affinity_group}/members/instance/{instance}" ,
1308+ tags = [ "affinity" ] ,
1309+ } ]
1310+ async fn affinity_group_member_instance_view (
1311+ rqctx : RequestContext < Self :: Context > ,
1312+ query_params : Query < params:: OptionalProjectSelector > ,
1313+ path_params : Path < params:: AffinityInstanceGroupMemberPath > ,
1314+ ) -> Result < HttpResponseOk < AffinityGroupMember > , HttpError > ;
1315+
1316+ /// Add a member to an affinity group
1317+ #[ endpoint {
1318+ method = POST ,
1319+ path = "/v1/affinity-groups/{affinity_group}/members/instance/{instance}" ,
1320+ tags = [ "affinity" ] ,
1321+ } ]
1322+ async fn affinity_group_member_instance_add (
1323+ rqctx : RequestContext < Self :: Context > ,
1324+ query_params : Query < params:: OptionalProjectSelector > ,
1325+ path_params : Path < params:: AffinityInstanceGroupMemberPath > ,
1326+ ) -> Result < HttpResponseCreated < AffinityGroupMember > , HttpError > ;
1327+
1328+ /// Remove a member from an affinity group
1329+ #[ endpoint {
1330+ method = DELETE ,
1331+ path = "/v1/affinity-groups/{affinity_group}/members/instance/{instance}" ,
1332+ tags = [ "affinity" ] ,
1333+ } ]
1334+ async fn affinity_group_member_instance_delete (
1335+ rqctx : RequestContext < Self :: Context > ,
1336+ query_params : Query < params:: OptionalProjectSelector > ,
1337+ path_params : Path < params:: AffinityInstanceGroupMemberPath > ,
1338+ ) -> Result < HttpResponseDeleted , HttpError > ;
1339+
1340+ /// Create an affinity group
1341+ #[ endpoint {
1342+ method = POST ,
1343+ path = "/v1/affinity-groups" ,
1344+ tags = [ "affinity" ] ,
1345+ } ]
1346+ async fn affinity_group_create (
1347+ rqctx : RequestContext < Self :: Context > ,
1348+ query_params : Query < params:: ProjectSelector > ,
1349+ new_affinity_group_params : TypedBody < params:: AffinityGroupCreate > ,
1350+ ) -> Result < HttpResponseCreated < views:: AffinityGroup > , HttpError > ;
1351+
1352+ /// Update an affinity group
1353+ #[ endpoint {
1354+ method = PUT ,
1355+ path = "/v1/affinity-groups/{affinity_group}" ,
1356+ tags = [ "affinity" ] ,
1357+ } ]
1358+ async fn affinity_group_update (
1359+ rqctx : RequestContext < Self :: Context > ,
1360+ query_params : Query < params:: OptionalProjectSelector > ,
1361+ path_params : Path < params:: AffinityGroupPath > ,
1362+ updated_group : TypedBody < params:: AffinityGroupUpdate > ,
1363+ ) -> Result < HttpResponseOk < views:: AffinityGroup > , HttpError > ;
1364+
1365+ /// Delete an affinity group
1366+ #[ endpoint {
1367+ method = DELETE ,
1368+ path = "/v1/affinity-groups/{affinity_group}" ,
1369+ tags = [ "affinity" ] ,
1370+ } ]
1371+ async fn affinity_group_delete (
1372+ rqctx : RequestContext < Self :: Context > ,
1373+ query_params : Query < params:: OptionalProjectSelector > ,
1374+ path_params : Path < params:: AffinityGroupPath > ,
1375+ ) -> Result < HttpResponseDeleted , HttpError > ;
1376+
1377+ /// List anti-affinity groups
1378+ #[ endpoint {
1379+ method = GET ,
1380+ path = "/v1/anti-affinity-groups" ,
1381+ tags = [ "affinity" ] ,
1382+ } ]
1383+ async fn anti_affinity_group_list (
1384+ rqctx : RequestContext < Self :: Context > ,
1385+ query_params : Query < PaginatedByNameOrId < params:: ProjectSelector > > ,
1386+ ) -> Result < HttpResponseOk < ResultsPage < views:: AntiAffinityGroup > > , HttpError > ;
1387+
1388+ /// Fetch an anti-affinity group
1389+ #[ endpoint {
1390+ method = GET ,
1391+ path = "/v1/anti-affinity-groups/{anti_affinity_group}" ,
1392+ tags = [ "affinity" ] ,
1393+ } ]
1394+ async fn anti_affinity_group_view (
1395+ rqctx : RequestContext < Self :: Context > ,
1396+ query_params : Query < params:: OptionalProjectSelector > ,
1397+ path_params : Path < params:: AntiAffinityGroupPath > ,
1398+ ) -> Result < HttpResponseOk < views:: AntiAffinityGroup > , HttpError > ;
1399+
1400+ /// List members of an anti-affinity group
1401+ #[ endpoint {
1402+ method = GET ,
1403+ path = "/v1/anti-affinity-groups/{anti_affinity_group}/members" ,
1404+ tags = [ "affinity" ] ,
1405+ } ]
1406+ async fn anti_affinity_group_member_list (
1407+ rqctx : RequestContext < Self :: Context > ,
1408+ query_params : Query < PaginatedById < params:: OptionalProjectSelector > > ,
1409+ path_params : Path < params:: AntiAffinityGroupPath > ,
1410+ ) -> Result < HttpResponseOk < ResultsPage < AntiAffinityGroupMember > > , HttpError > ;
1411+
1412+ /// Fetch an anti-affinity group member
1413+ #[ endpoint {
1414+ method = GET ,
1415+ path = "/v1/anti-affinity-groups/{anti_affinity_group}/members/instance/{instance}" ,
1416+ tags = [ "affinity" ] ,
1417+ } ]
1418+ async fn anti_affinity_group_member_instance_view (
1419+ rqctx : RequestContext < Self :: Context > ,
1420+ query_params : Query < params:: OptionalProjectSelector > ,
1421+ path_params : Path < params:: AntiAffinityInstanceGroupMemberPath > ,
1422+ ) -> Result < HttpResponseOk < AntiAffinityGroupMember > , HttpError > ;
1423+
1424+ /// Add a member to an anti-affinity group
1425+ #[ endpoint {
1426+ method = POST ,
1427+ path = "/v1/anti-affinity-groups/{anti_affinity_group}/members/instance/{instance}" ,
1428+ tags = [ "affinity" ] ,
1429+ } ]
1430+ async fn anti_affinity_group_member_instance_add (
1431+ rqctx : RequestContext < Self :: Context > ,
1432+ query_params : Query < params:: OptionalProjectSelector > ,
1433+ path_params : Path < params:: AntiAffinityInstanceGroupMemberPath > ,
1434+ ) -> Result < HttpResponseCreated < AntiAffinityGroupMember > , HttpError > ;
1435+
1436+ /// Remove a member from an anti-affinity group
1437+ #[ endpoint {
1438+ method = DELETE ,
1439+ path = "/v1/anti-affinity-groups/{anti_affinity_group}/members/instance/{instance}" ,
1440+ tags = [ "affinity" ] ,
1441+ } ]
1442+ async fn anti_affinity_group_member_instance_delete (
1443+ rqctx : RequestContext < Self :: Context > ,
1444+ query_params : Query < params:: OptionalProjectSelector > ,
1445+ path_params : Path < params:: AntiAffinityInstanceGroupMemberPath > ,
1446+ ) -> Result < HttpResponseDeleted , HttpError > ;
1447+
1448+ /// Create an anti-affinity group
1449+ #[ endpoint {
1450+ method = POST ,
1451+ path = "/v1/anti-affinity-groups" ,
1452+ tags = [ "affinity" ] ,
1453+ } ]
1454+ async fn anti_affinity_group_create (
1455+ rqctx : RequestContext < Self :: Context > ,
1456+ query_params : Query < params:: ProjectSelector > ,
1457+ new_affinity_group_params : TypedBody < params:: AntiAffinityGroupCreate > ,
1458+ ) -> Result < HttpResponseCreated < views:: AntiAffinityGroup > , HttpError > ;
1459+
1460+ /// Update an anti-affinity group
1461+ #[ endpoint {
1462+ method = PUT ,
1463+ path = "/v1/anti-affinity-groups/{anti_affinity_group}" ,
1464+ tags = [ "affinity" ] ,
1465+ } ]
1466+ async fn anti_affinity_group_update (
1467+ rqctx : RequestContext < Self :: Context > ,
1468+ query_params : Query < params:: OptionalProjectSelector > ,
1469+ path_params : Path < params:: AntiAffinityGroupPath > ,
1470+ updated_group : TypedBody < params:: AntiAffinityGroupUpdate > ,
1471+ ) -> Result < HttpResponseOk < views:: AntiAffinityGroup > , HttpError > ;
1472+
1473+ /// Delete an anti-affinity group
1474+ #[ endpoint {
1475+ method = DELETE ,
1476+ path = "/v1/anti-affinity-groups/{anti_affinity_group}" ,
1477+ tags = [ "affinity" ] ,
1478+ } ]
1479+ async fn anti_affinity_group_delete (
1480+ rqctx : RequestContext < Self :: Context > ,
1481+ query_params : Query < params:: OptionalProjectSelector > ,
1482+ path_params : Path < params:: AntiAffinityGroupPath > ,
1483+ ) -> Result < HttpResponseDeleted , HttpError > ;
1484+
12601485 // Certificates
12611486
12621487 /// List certificates for external endpoints
0 commit comments