Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #965 from joyent/ether/v3-b3-room-rack-improvements
Browse files Browse the repository at this point in the history
v3 b3 room+rack improvements
  • Loading branch information
karenetheridge authored Dec 12, 2019
2 parents ad30297 + 9f1bafe commit b0a3849
Show file tree
Hide file tree
Showing 40 changed files with 939 additions and 588 deletions.
7 changes: 4 additions & 3 deletions docs/json-schema/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,14 @@
"$ref" : "common.json#/definitions/uuid"
},
"vendor_name" : {
"$ref" : "common.json#/definitions/non_empty_string"
"$ref" : "common.json#/definitions/mojo_relaxed_placeholder"
}
},
"required" : [
"datacenter_id",
"az",
"alias"
"alias",
"vendor_name"
],
"type" : "object"
},
Expand All @@ -266,7 +267,7 @@
"$ref" : "common.json#/definitions/uuid"
},
"vendor_name" : {
"$ref" : "common.json#/definitions/non_empty_string"
"$ref" : "common.json#/definitions/mojo_relaxed_placeholder"
}
},
"type" : "object"
Expand Down
120 changes: 8 additions & 112 deletions docs/json-schema/response.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,7 @@
"type" : "string"
},
"vendor_name" : {
"description" : "the vendor's name for the room",
"oneOf" : [
{
"type" : "string"
},
{
"type" : "null"
}
]
"$ref" : "common.json#/definitions/mojo_relaxed_placeholder"
}
},
"required" : [
Expand Down Expand Up @@ -882,14 +874,14 @@
"DeviceLocation" : {
"additionalProperties" : false,
"properties" : {
"datacenter" : {
"$ref" : "/definitions/Datacenter"
"az" : {
"type" : "string"
},
"datacenter_room" : {
"$ref" : "/definitions/DatacenterRoomDetailed"
"$ref" : "common.json#/definitions/mojo_standard_placeholder"
},
"rack" : {
"$ref" : "/definitions/Rack"
"$ref" : "common.json#/definitions/mojo_relaxed_placeholder"
},
"rack_unit_start" : {
"$ref" : "common.json#/definitions/positive_integer"
Expand Down Expand Up @@ -934,7 +926,7 @@
}
},
"required" : [
"datacenter",
"az",
"datacenter_room",
"rack",
"rack_unit_start",
Expand Down Expand Up @@ -1103,55 +1095,7 @@
"type" : "null"
},
{
"additionalProperties" : false,
"properties" : {
"datacenter" : {
"additionalProperties" : false,
"properties" : {
"name" : {
"description" : "datacenter.region",
"type" : "string"
},
"vendor_name" : {
"description" : "the vendor's name for the datacenter",
"oneOf" : [
{
"type" : "null"
},
{
"type" : "string"
}
]
}
},
"required" : [
"name",
"vendor_name"
],
"type" : "object"
},
"rack" : {
"additionalProperties" : false,
"properties" : {
"name" : {
"type" : "string"
},
"rack_unit_start" : {
"$ref" : "common.json#/definitions/positive_integer"
}
},
"required" : [
"name",
"rack_unit_start"
],
"type" : "object"
}
},
"required" : [
"datacenter",
"rack"
],
"type" : "object"
"$ref" : "/definitions/DeviceLocation"
}
]
},
Expand Down Expand Up @@ -2985,55 +2929,7 @@
]
},
"location" : {
"additionalProperties" : false,
"properties" : {
"datacenter" : {
"additionalProperties" : false,
"properties" : {
"name" : {
"description" : "datacenter.region",
"type" : "string"
},
"vendor_name" : {
"description" : "the vendor's name for the datacenter",
"oneOf" : [
{
"type" : "null"
},
{
"type" : "string"
}
]
}
},
"required" : [
"name",
"vendor_name"
],
"type" : "object"
},
"rack" : {
"additionalProperties" : false,
"properties" : {
"name" : {
"type" : "string"
},
"rack_unit_start" : {
"$ref" : "common.json#/definitions/positive_integer"
}
},
"required" : [
"name",
"rack_unit_start"
],
"type" : "object"
}
},
"required" : [
"datacenter",
"rack"
],
"type" : "object"
"$ref" : "/definitions/DeviceLocation"
},
"phase" : {
"$ref" : "common.json#/definitions/device_phase"
Expand Down
11 changes: 5 additions & 6 deletions docs/modules/Conch::Controller::DatacenterRoom.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ Conch::Controller::DatacenterRoom
## find\_datacenter\_room

Chainable action that uses the `datacenter_room_id_or_alias` value provided in the stash
(usually via the request URL) to look up a datacenter\_room, and stashes the result in
`datacenter_room`.
(usually via the request URL) to look up a datacenter\_room, and stashes the query to get to it
in `datacenter_room_rs`.

If `require_role` is provided, it is used as the minimum required role for the user to
continue; otherwise the user must be a system admin.

## get\_all

Expand Down Expand Up @@ -38,10 +41,6 @@ Permanently delete a datacenter room.

Response uses the Racks json schema.

## find\_rack

Response uses the Rack json schema.

# LICENSING

Copyright Joyent, Inc.
Expand Down
16 changes: 8 additions & 8 deletions docs/modules/Conch::Controller::Rack.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Conch::Controller::Rack

## find\_rack

Chainable action that uses the `rack_id` value provided in the stash (usually via the
request URL) to look up a rack, and stashes the query to get to it in `rack_rs`.
Chainable action that uses the `rack_id_or_name` value provided in the stash (usually via the
request URL) to look up a rack (constraining to the datacenter\_room if `datacenter_room_rs` is
also provided) and stashes the query to get to it in `rack_rs`.

When datacenter\_room information is **not** provided, `rack_id_or_name` must be either a uuid
or a "long" rack name (["vendor\_name" in Conch::DB::Result::DatacenterRoom](../modules/Conch%3A%3ADB%3A%3AResult%3A%3ADatacenterRoom#vendor_name)) plus
["name" in Conch::DB::Result::Rack](../modules/Conch%3A%3ADB%3A%3AResult%3A%3ARack#name)); otherwise, it can also be a short rack name
["name" in Conch::DB::Result::Rack](../modules/Conch%3A%3ADB%3A%3AResult%3A%3ARack#name)).

If `require_role` is provided, it is used as the minimum required role for the user to
continue; otherwise the user must be a system admin.
Expand All @@ -22,12 +28,6 @@ Get a single rack

Response uses the Rack json schema.

## get\_all

Get all racks

Response uses the Racks json schema.

## get\_layouts

Gets all the layouts for the specified rack.
Expand Down
6 changes: 5 additions & 1 deletion docs/modules/Conch::DB::Result::DatacenterRoom.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ is_nullable: 0

```
data_type: 'text'
is_nullable: 1
is_nullable: 0
```

## created
Expand Down Expand Up @@ -75,6 +75,10 @@ original: {default_value => \"now()"}

- ["alias"](#alias)

## `datacenter_room_vendor_name_key`

- ["vendor\_name"](#vendor_name)

# RELATIONS

## datacenter
Expand Down
5 changes: 5 additions & 0 deletions docs/modules/Conch::DB::ResultSet::Device.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ Modifies the resultset to add columns `rack_id`, `rack_unit_start` and `rack_nam

Modifies the resultset to add the `sku` column.

## location\_data

Returns a resultset that provides location data ([response.json#/definitions/DeviceLocation](../json-schema/response.json#/definitions/DeviceLocation)),
optionally returned under a hash using the provided key name.

# LICENSING

Copyright Joyent, Inc.
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/Conch::DB::ResultSet::Rack.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ you want, so don't do that.)

This is used for identifying potential conflicts when adjusting layouts.

## with\_user\_role

Constrains the resultset to those where the provided user\_id has (at least) the specified role
in at least one workspace or build associated with the specified rack(s), including parent
workspaces.

## user\_has\_role

Checks that the provided user\_id has (at least) the specified role in at least one workspace
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Conch::Route::Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ read-write role on the device (via a workspace or build; see ["routes" in Conch:
- Requires system admin authorization or the read-only role on the build
- Response: response.yaml#/Racks

### `POST /build/:build_id_or_name/rack/:rack_id`
### `POST /build/:build_id_or_name/rack/:rack_id_or_name`

- Requires system admin authorization, or the read/write role on the build and the
read-write role on a workspace or build that contains the rack
Expand Down
62 changes: 57 additions & 5 deletions docs/modules/Conch::Route::DatacenterRoom.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ All routes require authentication.

### `GET /room/:datacenter_room_id_or_alias`

- Requires system admin authorization
- User requires system admin authorization, or the read-only role on a rack located in
the room
- Response: [response.json#/definitions/DatacenterRoomDetailed](../json-schema/response.json#/definitions/DatacenterRoomDetailed)

### `POST /room/:datacenter_room_id_or_alias`
Expand All @@ -37,16 +38,67 @@ All routes require authentication.
- Requires system admin authorization
- Response: `204 NO CONTENT`

### `GET /room/:datacenter_room_id_or_alias/racks`
### `GET /room/:datacenter_room_id_or_alias/rack`

- Requires system admin authorization
- User requires system admin authorization, or the read-only role on a rack located in
the room (in which case data returned is restricted to those racks)
- Response: [response.json#/definitions/Racks](../json-schema/response.json#/definitions/Racks)

### `GET /room/:datacenter_room_id_or_alias/rack/:rack_name`
### `GET /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name`

- Requires system admin authorization
- User requires the read-only role on the rack
- Response: [response.json#/definitions/Rack](../json-schema/response.json#/definitions/Rack)

### `POST /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name`

- User requires the read/write role on the rack
- Request: [request.json#/definitions/RackUpdate](../json-schema/request.json#/definitions/RackUpdate)
- Response: Redirect to the updated rack

### `DELETE /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name`

- Requires system admin authorization
- Response: `204 NO CONTENT`

### `GET /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name/layouts`

- User requires the read-only role on the rack
- Response: [response.json#/definitions/RackLayouts](../json-schema/response.json#/definitions/RackLayouts)

### `POST /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name/layouts`

- User requires the read/write role on the rack
- Request: [request.json#/definitions/RackLayouts](../json-schema/request.json#/definitions/RackLayouts)
- Response: Redirect to the rack's layouts

### `GET /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name/assignment`

- User requires the read-only role on the rack
- Response: [response.json#/definitions/RackAssignments](../json-schema/response.json#/definitions/RackAssignments)

### `POST /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name/assignment`

- User requires the read/write role on the rack
- Request: [request.json#/definitions/RackAssignmentUpdates](../json-schema/request.json#/definitions/RackAssignmentUpdates)
- Response: Redirect to the updated rack assignment

### `DELETE /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name/assignment`

This method requires a request body.

- User requires the read/write role on the rack
- Request: [request.json#/definitions/RackAssignmentDeletes](../json-schema/request.json#/definitions/RackAssignmentDeletes)
- Response: `204 NO CONTENT`

### `POST /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name/phase?rack_only=<0|1>`

The query parameter `rack_only` (defaults to `0`) specifies whether to update
only the rack's phase, or all the rack's devices' phases as well.

- User requires the read/write role on the rack
- Request: [request.json#/definitions/RackPhase](../json-schema/request.json#/definitions/RackPhase)
- Response: Redirect to the updated rack

# LICENSING

Copyright Joyent, Inc.
Expand Down
Loading

0 comments on commit b0a3849

Please sign in to comment.