### Run Fast Server Example Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/fast/README.md This command demonstrates how to start the example Fast server using Cargo. It's useful for testing and understanding the server's behavior. ```bash cargo run --example fastserve ``` -------------------------------- ### Example Service Implementation Source: https://github.com/tritondatacenter/monitor-reef/blob/main/CLAUDE.md This Rust code provides an example implementation of the `MyServiceApi` trait. It defines an empty enum `MyServiceImpl` and implements the `get_resource` function, which is currently a placeholder. It also shows how to obtain an instance of the API description in `main`. ```rust enum MyServiceImpl {} implement MyServiceApi for MyServiceImpl { type Context = ApiContext; async fn get_resource( rqctx: RequestContext, path: Path, ) -> Result, HttpError> { // Your implementation here } } // In main(): let api = my_service_api::my_service_api_mod::api_description::()?; ``` -------------------------------- ### Start PostgreSQL Service Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/manager.md Enables and starts the PostgreSQL service using the svcadm command. This command ensures that the PostgreSQL database is running and accessible. ```bash svcadm enable -s postgresql ``` -------------------------------- ### Run Examples with Cargo Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/moray/README.md Executes example programs included with the rust-moray crate. Users can specify which example to run, such as listbuckets, createbucket, putobject, findobjects, or sql. ```rust cargo run --example ``` -------------------------------- ### Install PostgreSQL 10 Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/manager.md Installs PostgreSQL version 10 using the pkgin package manager. This is necessary for development environments where the rebalancer manager needs to interact with a database. ```bash pkgin install postgresql10 ``` -------------------------------- ### Rust Service Implementation Example Source: https://github.com/tritondatacenter/monitor-reef/blob/main/AGENTS.md This Rust code provides an example implementation of the `MyServiceApi` trait. It defines an empty struct `MyServiceImpl` and implements the `get_resource` function, which is intended to contain the actual business logic for handling resource retrieval requests. ```rust enum MyServiceImpl {} impl MyServiceApi for MyServiceImpl { type Context = ApiContext; async fn get_resource( rqctx: RequestContext, path: Path, ) -> Result, HttpError> { // Your implementation here } } // In main(): let api = my_service_api::my_service_api_mod::api_description::()?; ``` -------------------------------- ### Example JSON output for 'rebalancer-adm job list' Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/manager.md An example of the JSON output returned by the `rebalancer-adm job list` command, showing a list of rebalancer jobs with their action, ID, and state. ```json [ { "action": "Evacuate", "id": "9d5e4b18-cdec-440c-88fa-64f6c49ea814", "state": "Setup" }, { "action": "Evacuate", "id": "bbd4088d-fec9-4875-9aa4-d1ca43a21c93", "state": "Setup" }, { "action": "Evacuate", "id": "1090b9de-d03c-4082-8a61-8637193ff829", "state": "Setup" } ] ``` -------------------------------- ### Implement Service using API Trait Source: https://github.com/tritondatacenter/monitor-reef/blob/main/CLAUDE.md This bash script outlines the steps to create a new service by copying a template, adding API crate dependencies, implementing the API trait, and including it in the workspace. It also provides a Rust example of implementing the `MyServiceApi` trait. ```bash # 1. Copy the service template cp -r services/service-template services/my-service cd services/my-service # 2. Add dependency on your API crate in Cargo.toml # 3. Implement the API trait in src/main.rs # 4. Add to workspace Cargo.toml members list ``` -------------------------------- ### Rust Client Library Usage Example Source: https://github.com/tritondatacenter/monitor-reef/blob/main/clients/internal/client-template/README.md Demonstrates how to use a generated Rust client library in another service. It shows how to instantiate the client and make a request to a specific endpoint. ```rust use your_service_client::Client; #[tokio::main] async fn main() -> Result<(), Box> { let client = Client::new("http://localhost:8080"); // Use the generated client methods let response = client .your_endpoint() .send() .await?; println!("Response: {:?}", response); Ok(()) } ``` -------------------------------- ### Run JIRA Stub Server (Bash) Source: https://github.com/tritondatacenter/monitor-reef/blob/main/services/jira-stub-server/README.md Command to start the JIRA stub server using Cargo. The server listens on http://localhost:9090 and exposes endpoints for searching issues, getting issue details, and retrieving remote links. ```bash cargo run -p jira-stub-server ``` -------------------------------- ### Rust Client Library Authentication Example Source: https://github.com/tritondatacenter/monitor-reef/blob/main/clients/internal/client-template/README.md Illustrates how to configure authentication for the generated Rust client library using a pre-configured reqwest::Client. This is useful for APIs that require authorization tokens. ```rust use reqwest::Client as ReqwestClient; use your_service_client::Client; let reqwest_client = ReqwestClient::builder() .default_headers({ let mut headers = reqwest::header::HeaderMap::new(); headers.insert( reqwest::header::AUTHORIZATION, format!("Bearer {}", api_token).parse()?, ); headers }) .build()?; let client = Client::new_with_client("http://localhost:8080", reqwest_client); ``` -------------------------------- ### Invoke 'yes' RPC Method with fastcall Example Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/fast/README.md This command demonstrates invoking the 'yes' RPC method using the `fastcall` example program. It provides a JSON array with an object specifying a value and count. ```bash fastcall 127.0.0.1 2030 yes '[ { "value": { "hello": "world" }, "count": 3 } ]' ``` -------------------------------- ### Invoke RPC Method with fastcall Example Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/fast/README.md This command shows how to use the `fastcall` example program to invoke the 'date' RPC method. It specifies the arguments as an empty JSON array. ```bash cargo run --example fastcall -- --args '[]' --method date ``` -------------------------------- ### JIRA Stub Server Library Usage (Rust) Source: https://github.com/tritondatacenter/monitor-reef/blob/main/services/jira-stub-server/README.md Example of using the jira-stub-server as a library within Rust tests. It demonstrates initializing the StubContext from fixtures and obtaining the API description. ```rust use jira_stub_server::{StubContext, api_description}; use std::sync::Arc; #[tokio::test] async fn test_with_stub_jira() { let fixtures_dir = Path::new("path/to/fixtures"); let context = Arc::new(StubContext::from_fixtures(&fixtures_dir).unwrap()); let api = api_description().unwrap(); // Create dropshot server with the stub context... } ``` -------------------------------- ### Example: Create and Use Cueball Connection Pool in Rust Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/cueball/README.md This Rust code snippet demonstrates the creation and usage of a cueball connection pool. It requires implementations of the `Resolver` and `Connection` traits. The example initializes a pool with a fake resolver and then spawns threads to claim connections, simulating work. ```rust use std::thread; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::{Arc, Barrier, Mutex}; use std::sync::mpsc::Sender; use std::{thread, time}; use slog::{Drain, Logger, info, o}; use cueball::backend; use cueball::backend::{Backend, BackendAddress, BackendPort}; use cueball::connection::Connection; use cueball::connection_pool::ConnectionPool; use cueball::connection_pool::types::ConnectionPoolOptions; use cueball::error::Error; use cueball::resolver::{BackendAddedMsg, BackendMsg, Resolver}; fn main() { let plain = slog_term::PlainSyncDecorator::new(std::io::stdout()); let log = Logger::root( Mutex::new( slog_term::FullFormat::new(plain).build() ).fuse(), o!("build-id" => "0.1.0") ); let be1 = (IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 55555); let be2 = (IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 55556); let be3 = (IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 55557); let resolver = FakeResolver::new(vec![be1, be2, be3]); let pool_opts = ConnectionPoolOptions:: { max_connections: 15, claim_timeout: Some(1000), resolver: resolver, log: log.clone(), decoherence_interval: None, }; let pool = ConnectionPool::::new(pool_opts); for _ in 0..10 { let pool = pool.clone(); thread::spawn(move || { let conn = pool.claim()?; // Do stuff here // The connection is returned to the pool when it falls out of scope. }) } } ``` -------------------------------- ### Bugview Client Pagination Example in Rust Source: https://github.com/tritondatacenter/monitor-reef/blob/main/clients/internal/bugview-client/README.md Illustrates how to handle pagination when fetching issues using the Bugview Rust client. It shows a loop that retrieves issues page by page until the last page is reached. ```rust let mut next_token: Option = None; loop { let mut request = client.get_issue_index_json(); if let Some(token) = &next_token { request = request.next_page_token(token); } let response = request.send().await?; for issue in response.issues { println!("{}: {}", issue.key, issue.summary); } if response.is_last { break; } next_token = response.next_page_token; } ``` -------------------------------- ### List Managed APIs with openapi-manager Source: https://github.com/tritondatacenter/monitor-reef/blob/main/CLAUDE.md This command lists all the APIs currently managed by the openapi-manager. It's useful for understanding the scope of managed APIs and for auditing purposes. ```bash cargo run -- list ``` -------------------------------- ### List available rebalancer-agent builds Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/operators_guide.md Lists available rebalancer-agent builds that are at or newer than the currently deployed version. This is useful for identifying potential updates. ```bash [root@headnode (nightly-2) ~]# manta-hotpatch-rebalancer-agent avail UUID NAME VERSION PUBLISHED_AT 7a5529e2-3d8b-4c9c-84af-46a1f6e0bb95 mantav2-rebalancer-agent master-20200617T234037Z-g6dc482c 2020-06-18T00:09:27.901Z ``` -------------------------------- ### Query Bugview Service (Bash) Source: https://github.com/tritondatacenter/monitor-reef/blob/main/services/jira-stub-server/README.md Examples of querying the bugview-service using curl. Demonstrates how to list all issues, view a specific issue in HTML or JSON format, and open the service in a browser. ```bash # List all public issues (JSON) curl -s http://localhost:8080/bugview/index.json | jq . # View a specific issue (HTML) curl http://localhost:8080/bugview/issue/OS-8627 # View a specific issue (JSON summary) curl -s http://localhost:8080/bugview/json/OS-8627 | jq . # Open in browser open http://localhost:8080/bugview/ ``` -------------------------------- ### Get Assignment Status (No Failures) Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/agent.md This example demonstrates the JSON response for a GET request to retrieve the status of an assignment that has completed without any task failures. It shows the total number of tasks and the count of completed and failed tasks. ```json { "uuid": "77ed8169-a59f-4d0b-a9e8-1af8a3a3c4ce", "stats": { "state": { "Complete": null }, "failed": 0, "complete": 1, "total": 1 } } ``` -------------------------------- ### Get Assignment Status (With Failures) Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/agent.md This example shows the JSON response for a GET request when an assignment has encountered task failures. It details the failed task, including its object ID, owner, checksum information, and the specific reason for the failure, such as 'MD5Mismatch'. ```json { "uuid": "fd45e70b-5435-457e-a371-93fcb8215e0d", "stats": { "state": { "Complete": [ { "object_id": "7f3ee78a-2e64-4f3d-829f-a31c7c2c2b03", "owner": "d50c4fc4-f408-492f-b8bc-a0dd7c73683f", "md5sum": "QXBlX0QFcscVIwptkUaI8g==", "source": { "datacenter": "dc", "manta_storage_id": "3.stor.us-west.joyent.us" }, "status": { "Failed": { "Failed": "MD5Mismatch" } } } ] }, "failed": 1, "complete": 1, "total": 1 } } ``` -------------------------------- ### Initialize and Use JIRA Client in Rust Source: https://github.com/tritondatacenter/monitor-reef/blob/main/clients/internal/jira-client/README.md Demonstrates how to create a new JIRA client instance with an authenticated reqwest client and perform a search for issues using a JQL query. This example highlights the basic usage pattern for interacting with the JIRA API subset. ```rust use jira_client::Client; let client = Client::new_with_client( "https://jira.example.com", authenticated_reqwest_client ); // Search for issues let response = client .search_issues() .jql("project = FOO AND labels = public") .max_results(50) .send() .await?; ``` -------------------------------- ### Security Audit with Cargo Audit Source: https://github.com/tritondatacenter/monitor-reef/blob/main/CLAUDE.md Instructions for installing and running `cargo-audit` to check for vulnerabilities in project dependencies. This should be performed before each commit. ```bash # Install cargo-audit (one-time setup) cargo install cargo-audit # Run before each commit cargo audit # Update advisory database regularly cargo audit --update ``` -------------------------------- ### Build CLI Application with Generated Client Source: https://github.com/tritondatacenter/monitor-reef/blob/main/CLAUDE.md This bash script demonstrates how to set up a command-line interface (CLI) application that utilizes a generated client library. It covers creating the necessary directory structure, defining the `Cargo.toml` file with dependencies like the generated client and `clap`, and outlines the implementation of the CLI logic in `src/main.rs`. ```bash # 1. Create CLI directory structure mkdir -p cli/my-service-cli/src # 2. Create Cargo.toml cat > cli/my-service-cli/Cargo.toml <, #[arg(long)] sort: Option, }, Get { key: String, #[arg(long)] raw: bool, }, } #[tokio::main] async fn main() -> anyhow::Result<()> { let cli = Cli::parse(); let client = Client::new(&cli.base_url); match cli.command { Commands::List { next_page_token, sort } => { let mut request = client.get_issue_index_json(); if let Some(token) = next_page_token { request = request.next_page_token(token); } if let Some(sort_field) = sort { request = request.sort(sort_field); } let response = request.send().await?; let data = response.into_inner(); println!("Issues (showing {}):", data.issues.len()); for issue in &data.issues { println!(" {}: {}", issue.key, issue.summary); } if let Some(next_token) = data.next_page_token { println!("Next page: bugview list --next-page-token \"{}\"", next_token); } } Commands::Get { key, raw } => { let response = client.get_issue_full_json().key(key).send().await?; let issue = response.into_inner(); if raw { println!("{}", serde_json::to_string_pretty(&issue)?); } else { println!("{} - {}", issue.key, issue.fields["summary"]); } } } Ok(()) } ``` -------------------------------- ### TOML Dependency Configuration for Rust Client Source: https://github.com/tritondatacenter/monitor-reef/blob/main/clients/internal/client-template/README.md Shows how to add the generated Rust client library as a dependency in another service's Cargo.toml file. ```toml # In your service's Cargo.toml [dependencies] your-service-client = { path = "../clients/internal/your-service-client" } ``` -------------------------------- ### GET /bugview Source: https://github.com/tritondatacenter/monitor-reef/blob/main/apis/bugview-api/README.md Redirects to the HTML index of public JIRA issues. ```APIDOC ## GET /bugview ### Description This endpoint acts as a convenience redirect to the main HTML index page for Bugview. ### Method GET ### Endpoint /bugview ### Response #### Success Response (302 Found) - **Location**: `/bugview/index.html` - **Body**: Typically empty, containing only the redirect headers. ``` -------------------------------- ### GET /bugview/index.html Source: https://github.com/tritondatacenter/monitor-reef/blob/main/apis/bugview-api/README.md Provides an HTML index of public JIRA issues. ```APIDOC ## GET /bugview/index.html ### Description Returns an HTML page displaying a list of public JIRA issues. ### Method GET ### Endpoint /bugview/index.html ### Response #### Success Response (200) - **Content-Type**: `text/html` - **Body**: HTML content listing public issues. #### Response Example ```html Bugview Index

Public Issues

``` ``` -------------------------------- ### GET /jobs Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/manager.md Retrieves a list of all job UUIDs currently managed by the system. ```APIDOC ## GET /jobs ### Description Retrieves a list of all job UUIDs. ### Method GET ### Endpoint /jobs ### Response #### Success Response (200) - **job_uuids** (array of strings) - A list of UUIDs for all existing jobs. #### Response Example ```json { "job_uuids": [ "a1b2c3d4-e5f6-7890-1234-567890abcdef", "f0e9d8c7-b6a5-4321-fedc-ba9876543210" ] } ``` #### Error Response (500) - Description: Internal server error: Error encountered while obtaining job list. ``` -------------------------------- ### Generate Client from OpenAPI Spec Source: https://github.com/tritondatacenter/monitor-reef/blob/main/CLAUDE.md This bash script outlines the process of generating a client library from an OpenAPI specification. It involves copying a client template, updating the `build.rs` file to point to the spec, and then building the project to generate the client code. This ensures clients can be built independently of the service implementation. ```bash # 1. Copy client template cp -r clients/internal/client-template clients/internal/my-service-client cd clients/internal/my-service-client # 2. Update build.rs to point to your OpenAPI spec: # let spec_path = "../../../openapi-specs/generated/my-api.json"; # 3. Build to generate client (reads the checked-in spec) cargo build # 4. Use the generated client ``` -------------------------------- ### Get Assignment Status (GET /assignments/uuid) Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/agent.md This endpoint retrieves the status of a specific assignment from the agent. It requires a valid assignment UUID as a path parameter. Successful requests return a JSON object representing the assignment, while errors can occur due to malformed UUIDs or if the assignment is not found. ```http GET /assignments/uuid ``` -------------------------------- ### Build Sharkspotter Tool Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/sharkspotter/README.md Instructions for building the sharkspotter executable using Cargo. This involves compiling the project and then running the executable from the target directory. ```shell cargo build cd target// ./sharkspotter ``` -------------------------------- ### Build rebalancer-manager with Postgres feature Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/manager.md Builds the rebalancer-manager binary with the 'postgres' feature enabled. This command compiles only the specified binary. For release builds, the `--release` flag should be included. ```bash cargo build --bin rebalancer-manager --features "postgres" ``` -------------------------------- ### GET /jobs/uuid Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/manager.md Retrieves detailed information and status for a specific job, identified by its UUID. ```APIDOC ## GET /jobs/uuid ### Description Retrieves detailed information and status for a specific job using its UUID. ### Method GET ### Endpoint /jobs/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The UUID of the job to retrieve. ### Response #### Success Response (200) - **job_status** (object) - Contains the status details of the job. - **Total** (usize) - Total number of objects to process in the job. - **Unprocessed** (usize) - Number of objects yet to be processed. - **Skipped** (usize) - Number of objects skipped. - **Error** (usize) - Number of errors encountered while processing the job. - **Post Processing** (usize) - Number of objects currently undergoing post-processing. - **Complete** (usize) - Number of objects successfully processed. #### Response Example ```json { "job_status": { "Total": 1000, "Unprocessed": 50, "Skipped": 5, "Error": 2, "Post Processing": 10, "Complete": 933 } } ``` #### Error Response (400) - Description: Bad request (invalid uuid). #### Error Response (500) - Description: Internal server error. ``` -------------------------------- ### GET /bugview/issue/{key} Source: https://github.com/tritondatacenter/monitor-reef/blob/main/apis/bugview-api/README.md Provides an HTML view of a single public JIRA issue. ```APIDOC ## GET /bugview/issue/{key} ### Description Returns an HTML page displaying the details of a single public JIRA issue. ### Method GET ### Endpoint /bugview/issue/{key} ### Path Parameters - **key** (string) - Required - The unique key of the JIRA issue (e.g., PROJ-123). ### Response #### Success Response (200) - **Content-Type**: `text/html` - **Body**: HTML content displaying the details of the specified issue. #### Response Example ```html Bugview - PROJ-123

PROJ-123: Example bug report

Status: Open

Description: Detailed description of the bug.

Labels: public, bug

``` ``` -------------------------------- ### GET /bugview/index.json Source: https://github.com/tritondatacenter/monitor-reef/blob/main/apis/bugview-api/README.md Retrieves a paginated list of public JIRA issues in JSON format. ```APIDOC ## GET /bugview/index.json ### Description Fetches a paginated list of public JIRA issues. Supports token-based pagination and sorting. ### Method GET ### Endpoint /bugview/index.json ### Query Parameters - **next_page_token** (string) - Optional - Token from previous response to fetch the next page. - **sort** (string) - Optional - Sort field. Allowed values: `key`, `created`, `updated`. ### Response #### Success Response (200) - **issues** (array) - List of public issues. - **next_page_token** (string) - Token for fetching the next page of results. #### Response Example ```json { "issues": [ { "key": "PROJ-123", "summary": "Example bug report" } ], "next_page_token": "some_token_string" } ``` ``` -------------------------------- ### Run Sharkspotter with Multiple Sharks Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/sharkspotter/README.md Demonstrates how to use sharkspotter to find objects across multiple sharks ('1.stor' and '2.stor') within the same domain. The output files for each shark are then processed with 'json'. ```shell $ cargo run -- --domain east.joyent.us --shark 1.stor --shark 2.stor -M 1 -m 1 $ json -f ./1.stor/shard_1.objs $ json -f ./2.stor/shard_1.objs ``` -------------------------------- ### Rebalancer Agent Usage and Help Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/agent.md Displays the command-line usage and available flags for the rebalancer-agent executable. This helps users understand how to run the agent and access its help information. ```shell rebalancer-agent USAGE: rebalancer-agent [FLAGS] FLAGS: -h, --help Prints help information -V, --version Prints version information ``` -------------------------------- ### GET /bugview/label/{key} Source: https://github.com/tritondatacenter/monitor-reef/blob/main/apis/bugview-api/README.md Provides an HTML index of public JIRA issues filtered by a specific label. ```APIDOC ## GET /bugview/label/{key} ### Description Returns an HTML page displaying public JIRA issues that are tagged with the specified label. ### Method GET ### Endpoint /bugview/label/{key} ### Path Parameters - **key** (string) - Required - The label to filter issues by (e.g., `bug`, `feature`). ### Response #### Success Response (200) - **Content-Type**: `text/html` - **Body**: HTML content listing public issues filtered by the label. #### Response Example ```html Bugview - Label: bug

Public Issues with Label: bug

``` ``` -------------------------------- ### GET /bugview/json/{key} Source: https://github.com/tritondatacenter/monitor-reef/blob/main/apis/bugview-api/README.md Retrieves simplified details for a specific public JIRA issue in JSON format. ```APIDOC ## GET /bugview/json/{key} ### Description Fetches simplified details for a specific public JIRA issue identified by its key. ### Method GET ### Endpoint /bugview/json/{key} ### Path Parameters - **key** (string) - Required - The unique key of the JIRA issue (e.g., PROJ-123). ### Response #### Success Response (200) - **key** (string) - The issue key. - **summary** (string) - The issue summary. #### Response Example ```json { "key": "PROJ-123", "summary": "Example bug report" } ``` ``` -------------------------------- ### Rust Build Script for Client Generation Source: https://github.com/tritondatacenter/monitor-reef/blob/main/clients/internal/client-template/README.md The build.rs script responsible for generating the Rust client library. It reads an OpenAPI specification and uses Progenitor to create the type-safe client code. ```rust // Example snippet from build.rs (actual code not provided in text) // let spec_path = "../../../openapi-specs/generated/your-api.json"; // cargo run -p openapi-manager -- generate // cargo build ``` -------------------------------- ### GET /bugview/fulljson/{key} Source: https://github.com/tritondatacenter/monitor-reef/blob/main/apis/bugview-api/README.md Retrieves full details for a specific public JIRA issue, including all fields, in JSON format. ```APIDOC ## GET /bugview/fulljson/{key} ### Description Fetches the complete details of a specific public JIRA issue, including all available fields, in JSON format. ### Method GET ### Endpoint /bugview/fulljson/{key} ### Path Parameters - **key** (string) - Required - The unique key of the JIRA issue (e.g., PROJ-123). ### Response #### Success Response (200) - **key** (string) - The issue key. - **summary** (string) - The issue summary. - **description** (string) - The full issue description. - **status** (string) - The current status of the issue. - ... (all other JIRA fields) #### Response Example ```json { "key": "PROJ-123", "summary": "Example bug report", "description": "Detailed description of the bug.", "status": "Open", "reporter": "user@example.com", "assignee": null, "created": "2023-10-27T10:00:00Z", "updated": "2023-10-27T11:00:00Z", "labels": ["public", "bug"] } ``` ``` -------------------------------- ### GET /assignments/{uuid} Source: https://github.com/tritondatacenter/monitor-reef/blob/main/libs/rebalancer-legacy/docs/agent.md Retrieves the status of a specific assignment, including details about its tasks and any failures. ```APIDOC ## GET /assignments/{uuid} ### Description Retrieves the status of a specific assignment, including details about its tasks and any failures encountered during processing. The response will indicate the total number of tasks, completed tasks, and failed tasks. If any tasks have failed, detailed information about each failure will be provided. ### Method GET ### Endpoint /assignments/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the assignment. ### Request Example ``` GET /assignments/77ed8169-a59f-4d0b-a9e8-1af8a3a3c4cf ``` ### Response #### Success Response (200) - **uuid** (string) - The unique identifier of the assignment. - **stats** (object) - Statistics about the assignment's tasks. - **state** (object) - The current state of the tasks. - **Complete** (array or null) - An array of completed tasks, or null if none are complete. - **failed** (integer) - The number of tasks that have failed. - **complete** (integer) - The number of tasks that have completed successfully. - **total** (integer) - The total number of tasks in the assignment. #### Response Example (No Failures) ```json { "uuid": "77ed8169-a59f-4d0b-a9e8-1af8a3a3c4ce", "stats": { "state": { "Complete": null }, "failed": 0, "complete": 1, "total": 1 } } ``` #### Response Example (With Failures) ```json { "uuid": "fd45e70b-5435-457e-a371-93fcb8215e0d", "stats": { "state": { "Complete": [ { "object_id": "7f3ee78a-2e64-4f3d-829f-a31c7c2c2b03", "owner": "d50c4fc4-f408-492f-b8bc-a0dd7c73683f", "md5sum": "QXBlX0QFcscVIwptkUaI8g==", "source": { "datacenter": "dc", "manta_storage_id": "3.stor.us-west.joyent.us" }, "status": { "Failed": { "Failed": "MD5Mismatch" } } } ] }, "failed": 1, "complete": 1, "total": 1 } } ``` ### Task States - **Pending**: The task has not been processed yet. - **Running**: The task is currently being processed. - **Complete**: The agent finished processing the task successfully. - **Failed**: The agent finished processing the task but it failed. ``` -------------------------------- ### Implement Minimal External API Client in Rust Source: https://github.com/tritondatacenter/monitor-reef/blob/main/CLAUDE.md Demonstrates how to create a minimal, hand-written Rust client for consuming external or legacy APIs during a migration. This method is preferred over large auto-generated clients, especially when dealing with complex OpenAPI specifications. ```rust use reqwest::Client; use serde::{Deserialize, Serialize}; use std::time::Duration; #[derive(Clone)] pub struct ExternalApiClient { client: Client, base_url: String, } impl ExternalApiClient { pub fn new(base_url: String) -> Result { let client = Client::builder() .timeout(Duration::from_secs(15)) .build()?; Ok(Self { client, base_url }) } pub async fn get_resource(&self, id: &str) -> Result { let url = format!("{}/api/resource/{}", self.base_url, id); let response = self.client.get(&url).send().await?; response.json().await } } ```