diff --git a/.env b/.env index b9c840a2..310e9795 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ ENV=DEV # PROD or DEV -ONLY_RELAY_SERVICE=FALSE # TRUE - This will start only nightly relay service without cloud service +ONLY_RELAY_SERVICE=TRUE # TRUE - This will start only nightly relay service without cloud service NONCE=VERY_SECRET_NONCE MAILER_ADDRESS=do_not_reply@nightly.app # Different than db address specified in infra/.env due to docker shenanigans, used in setting up datasource in grafana @@ -13,76 +13,4 @@ GF_SECURITY_ADMIN_USER=admin GF_SECURITY_ADMIN_PASSWORD=admin # TEST PASSWORD DO NO USE IN PRODUCTION MAILER_PASSWORD=ZtA5gFKMsXzHmEm -MAILER_ACTIVE=FALSE - -# Generated so it can work with grafana -# ssh-keygen -t rsa -b 4096 -m PEM -f grafana.key -N "" -# openssl rsa -in grafana.key -pubout -outform PEM -out grafana.key.pub -# TEST KEY DO NO USE IN PRODUCTION -JWT_SECRET="-----BEGIN RSA PRIVATE KEY----- -MIIJKQIBAAKCAgEAzlUYIpqSUAyLJaf8ZUef06YBh5DcmaTrwGcVwC57VtywY7bH -XQUtGooULQjiYgnyOPxHDt2W+gQW1axiMxOQew0MF0kXYQhg0+WA1dcWOsxCDpyL -c4z+E7EmdV7MTuvsDR2TLhZ6DFmVbN4ca64Wvftz//3Ptc/I1/VpfGsHWb0Vpmph -kbE9vWGHzzJVp/Lvtk7ybcpfxiiNWEi7unr7/TIEsqy93lCRfpLKIvO06ITH1GZz -7+VPL/8q8lrH5kSwxqo5szq1mEa0pNN6hTpocz00x5oBfL9K/TNLQNgdb5uOOfjQ -9pYtZ49UDyMLs5lCsZ6ue+SIbWrJXDEPMIEgLzx9nnvytL9wbiwo5GQdIaDAZXMw -VVdKQGyqx+UhaHmrb1u0RVRcFzO/QPWzNCWvoxJGfg9dVTxfjaa1HzQ0irPs86zC -QUnt0OyTuq0SmUgTCNXLSQaN8MigN++zwT4cIRDB0WMgmu8sxtnmA3Zq+2GYT97j -mbdVMB34DVbXI4UigD3UieVe4rO95cEssoUTAFG0pthv64BRKIIRNch+eiBBjkGp -nWKRybzsmqnEqpMf9v7KQU9hmpBJDbi6KA6w3fg3KSroJZwosbAwdBuylCfQgq1j -Z6UfR/ss9kYGhaWbCB3ARmY9XHFc+OZuFW0pohgfBfs9RDMDVkTa4tzBAGsCAwEA -AQKCAgB/cQHCRdS/SrAbZyG28MFgObXSJQCMidfvc/x0QoF+CjuMq1WCN/M+5DBI -DKe/RENvPSsqnGVnMWVlPt88iwX/avSf4U5maYVc+/FSo1IgqQ7X9YsQqPI5+X42 -moH48TFQfIbuvYVO4XowzxOg0ttLJufkIsHLm3aDJRqtdXIJ1IdtzWFMWrw2n+oB -aSaM4Ll80lBczdXQEDYVZH9HVDUWk3FhZt6zVPI4yrO9WOfRgknnAAz2DJ2XmLTP -EpFLwfuqCXQwJsAJOQrUj6aqaYQgQZq6+n2WrpTDxY3ilFnCGMOFPRDcba/HujiC -TPQqTyxphwhgj6xQYNfUcJzgKbFVPkcp2Y72feu4dPwRn9v/9zflsezPg33mjNLD -ls2XrA1S+UKQpiLbF5Mv6U0MxuFRoZIVhSflA/FGHgIE+IGiMDWPLQVpTBJYDjWG -9giRRBOm4qf9CPPJVnJVEkibDbsKnRTMOPSRBgNBYvpiMO06hWsNktntJ/iqvgf0 -2L//kQEPUTx5+RdSjarQNw0tU7nQid0mf1e3rEXfitr77E6dp+T+2POXQzr2lTFA -QzaWkIRNNJqCBI/aUhEkAnx2kVlzgLBGYVtAwlCZVF9r0VphmAIQdSeaiI/4N3zh -jPl0jVYQCKUPe7FslC6f/hks6Y+uMJIeph9XHdYBvcDWZcZCCQKCAQEA/vhsO+vR -vFRu4q6cvruFoEqODjZnwYUdYKnSa7O2ZTn3VkUE197pL5tSc2At9txZ6AFZ28ye -ZDUsx+IOvt2PUfJAo7cAL6Vx9TTEMlDcSs0LFRKIrE5lI9hMHOu1evJxN9s3jivZ -rp0PLEGrllcKIOg5+Zh/yXQue0R2b3H3/f7BdvMS4gjZq8NF0SDLe/WL2PQ0baSL -MLC8048CDM3BVzjxx2u6ghFambJ0fJIID6DAvkdrNZ/loie71sEVJdJiY3jra/Mq -JCOZJlRBTevVSfI0uqtybv1QYaU+Mqth8fZxWvhC14Rf30VLEWp9GV0u7Q9p0baj -nXay/kwXE7uvJQKCAQEAzypkQ6BodHU2FRPpU4wytsowTVbcQs5DNr9ayrTyuPGa -ydGRzJ0/qHzAv/rWjImny7r8uuvDfNXAxRI5kbAJMImrbG6zjmLHwYKCrB1GFsx1 -QRRuDiMFbblVitA1XHs/sSM0VdO18nLYPY71uIEaTKZTxd1rYuxam3SwZ7prTUGH -zfI8S4G5vnAn2nWUHmbSNKdtBPqMf65pPGPkKmzBUd++1mvmdsVroGxi37n5vL66 -cUKlvQ5u+l1cqV/EWC6wIoJhrsgkfAO7aFSZQIXIdUeh2C57oFoVdCWULhN09quB -XIRularP7IC/0e7dMAf5tyQ7Z90/zyMqEpMyX6XkTwKCAQEA5JbMUpyFmRcJoulx -Vf7BOogc+9kDBJjXUcZvBGhGalKh0RJn2THcVfYm4ZGlI+FCKaKscUbt6mFSGJIv -LidtSsap9R0oaY8mr/PywjmEhvt1qBrJtdFDE/PjqToZpnSd1LoRAMGHk+jzpXXq -5Ap85ivNblyulGo5EgK7PActkuZHhOFAWK4emMOlYGzKggQOsR+fsX0H3UtWv0VD -TT9ay1weR+/pcpskYw9/J/+0gm5Y3z8gex8zvUFqQosw7ovD8fKC/nEvot7Xe2mm -crmwq28enwz+t0scOa7wKHVGhquvzSMuqhHf8kgpmR+jsI2+eIKNGJtp7M5yg1Ks -jeCCkQKCAQAP3/G69OnMMscoKlRw4IdqVmgJJSTPwbqI0XUFn4QSBAGWgYaopUwh -fx3OGEykjE/dXsDLGhHq2P5im5jpvxGVNJd8Qadku9EO1Q9qXPvn91bs28HrN2fN -FqylbHsKUS96RXZXNVf18jL71J6jutDnGr/Eo8j81ZvD2ddCu5hJXUIo1+0i5Bf1 -reZ/6Q6mnb5x5nqGLSTjC9xokkcDsT3HJlwbVj1c0JgEvQl+l2O5wOvMjgzhRd/f -M5RMLlh/YWSB4HfXyuJw1mBgCEuOFDJeOlT+meFDUmPeeJq4RSlrVY0eJ8/JjENO -njcUwTcV3SaXkCE1PlELcGhi8ACmL7IlAoIBAQDRR/cQe7/6jIfEXbCemkWQ5Drs -CF6jk7gUREbNiTpfWUYSa4DcsyB5phvn2MTM/rsunWtKBrRl7FwDPZcIHrNnsp1U -w/OPG9nl9ScULy34hwksYShrFZPGeWM8dg+zB1LpwgzsirQiXqmu5FDUrzmCqLM6 -8GYuZHYXowAU0LDUtn/z8Mqv05HR/NwTZxDlxyJMIdVdoUYyWtYUAHb5p839N1Qx -tj4b9QGK2SBDcOQwq8eCnK/DUjIBUTL+4DNSDeQCr8gc82SwkoZGBCwIWQH+ZwDz -noL/o/3a5OnNQI0eB7/0g6ElR8BmkeZy1sZXaxZ3caatctEUuUgVFYuVkf9m ------END RSA PRIVATE KEY----- -" -JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY----- -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzlUYIpqSUAyLJaf8ZUef -06YBh5DcmaTrwGcVwC57VtywY7bHXQUtGooULQjiYgnyOPxHDt2W+gQW1axiMxOQ -ew0MF0kXYQhg0+WA1dcWOsxCDpyLc4z+E7EmdV7MTuvsDR2TLhZ6DFmVbN4ca64W -vftz//3Ptc/I1/VpfGsHWb0VpmphkbE9vWGHzzJVp/Lvtk7ybcpfxiiNWEi7unr7 -/TIEsqy93lCRfpLKIvO06ITH1GZz7+VPL/8q8lrH5kSwxqo5szq1mEa0pNN6hTpo -cz00x5oBfL9K/TNLQNgdb5uOOfjQ9pYtZ49UDyMLs5lCsZ6ue+SIbWrJXDEPMIEg -Lzx9nnvytL9wbiwo5GQdIaDAZXMwVVdKQGyqx+UhaHmrb1u0RVRcFzO/QPWzNCWv -oxJGfg9dVTxfjaa1HzQ0irPs86zCQUnt0OyTuq0SmUgTCNXLSQaN8MigN++zwT4c -IRDB0WMgmu8sxtnmA3Zq+2GYT97jmbdVMB34DVbXI4UigD3UieVe4rO95cEssoUT -AFG0pthv64BRKIIRNch+eiBBjkGpnWKRybzsmqnEqpMf9v7KQU9hmpBJDbi6KA6w -3fg3KSroJZwosbAwdBuylCfQgq1jZ6UfR/ss9kYGhaWbCB3ARmY9XHFc+OZuFW0p -ohgfBfs9RDMDVkTa4tzBAGsCAwEAAQ== ------END PUBLIC KEY----- -" \ No newline at end of file +MAILER_ACTIVE=FALSE \ No newline at end of file diff --git a/.github/workflows/connect-test-local.yml b/.github/workflows/connect-test-local.yml index decdccce..0669cab0 100644 --- a/.github/workflows/connect-test-local.yml +++ b/.github/workflows/connect-test-local.yml @@ -85,7 +85,7 @@ jobs: run: | cargo test-integration cargo run --bin nightly-connect-server & - sleep 5 + sleep 50 - name: test base local run: | pnpm test:ci diff --git a/Cargo.toml b/Cargo.toml index 766d9c33..da1d4f66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ tower = { version = "0.4.13", features = [ "limit", ] } tower-http = { version = "0.5.2", features = ["cors", "trace"] } -reqwest = {version = "0.11.24", features = ["json"]} +reqwest = { version = "0.11.24", features = ["json"] } tokio = { version = "1.35.1", features = ["full"] } async-trait = "0.1.77" r-cache = "0.5.0" @@ -48,6 +48,7 @@ sqlx = { version = "0.7.3", features = [ "chrono", ] } chrono = { version = "0.4.22", features = ["serde"] } +configparser = "3.1.0" [profile.dev] debug = 0 diff --git a/database/migrations/0014_domain_verifications.sql b/database/migrations/0014_domain_verifications.sql index 3edb82b9..435b35f3 100644 --- a/database/migrations/0014_domain_verifications.sql +++ b/database/migrations/0014_domain_verifications.sql @@ -13,3 +13,8 @@ CREATE UNIQUE INDEX idx_unique_verified_domains ON domain_verifications (domain_ WHERE finished_at IS NOT NULL AND deleted_at IS NULL; CREATE INDEX domain_verifications_app_id_idx ON domain_verifications(app_id); + +-- Safety measure to prevent multiple verification requests for the same domain for the same app +CREATE UNIQUE INDEX idx_unique_active_domain_verifications +ON domain_verifications (domain_name, app_id) +WHERE finished_at IS NULL AND cancelled_at IS NULL AND deleted_at IS NULL; \ No newline at end of file diff --git a/database/src/tables/domain_verifications/update.rs b/database/src/tables/domain_verifications/update.rs index c2938657..bba939f4 100644 --- a/database/src/tables/domain_verifications/update.rs +++ b/database/src/tables/domain_verifications/update.rs @@ -252,10 +252,14 @@ mod tests { .await .unwrap(); - assert_eq!(data.len(), 1); - let verification = data.get(0).unwrap(); - assert!(verification.cancelled_at.is_some()); - assert!(verification.domain_name == "valid_domain_name_2"); + assert_eq!(data.len(), 2); + // Find the cancelled verification + let cancelled_verification = data + .iter() + .find(|v| v.domain_name == "valid_domain_name_2".to_string()) + .unwrap(); + + assert!(cancelled_verification.cancelled_at.is_some()); } #[tokio::test] @@ -284,7 +288,40 @@ mod tests { // Check let data = db - .get_domain_verifications_by_app_id(&&app_id) + .get_domain_verifications_by_app_id(&app_id) + .await + .unwrap(); + + assert_eq!(data.len(), 1); + assert!(data.get(0).unwrap().deleted_at.is_none()); + + // FInish verification + let mut tx = db.connection_pool.begin().await.unwrap(); + db.finish_domain_verification(&mut tx, &domain_name, &app_id) + .await + .unwrap(); + tx.commit().await.unwrap(); + + // Check + let data = db + .get_domain_verifications_by_app_id(&app_id) + .await + .unwrap(); + + assert_eq!(data.len(), 1); + assert!(data.get(0).unwrap().finished_at.is_some()); + + // Delete verification + let mut tx = db.connection_pool.begin().await.unwrap(); + db.delete_domain_verification(&mut tx, &domain_name, &app_id) + .await + .unwrap(); + + tx.commit().await.unwrap(); + + // Check + let data = db + .get_domain_verifications_by_app_id(&app_id) .await .unwrap(); diff --git a/grafana-client-gen/run_codegen.sh b/grafana-client-gen/run_codegen.sh index 31721b14..898ce113 100755 --- a/grafana-client-gen/run_codegen.sh +++ b/grafana-client-gen/run_codegen.sh @@ -1,17 +1,67 @@ #!/bin/bash +# Source both .env files if [ -f .env ]; then export $(cat .env | xargs) fi -echo "Build path: "$OPENAPI_GENERATOR_DIR -echo "Language: "$OPENAPI_LANGUAGE +# Source Grafana version from the other directory +if [ -f ../grafana/.env ]; then + export $(cat ../grafana/.env | xargs) +elif [ -f ../grafana-client-gen/.env ]; then + export $(cat ../grafana-client-gen/.env | xargs) +fi + +if [ -z "$GRAFANA_VERSION" ]; then + echo "Error: GRAFANA_VERSION not found in environment variables" + exit 1 +fi + +echo "Build path: $OPENAPI_GENERATOR_DIR" +echo "Language: $OPENAPI_LANGUAGE" +echo "Grafana Version: $GRAFANA_VERSION" + +# Remove v prefix if present in version +GRAFANA_VERSION_CLEAN=${GRAFANA_VERSION#v} echo "Removing existing build directory..." rm -rf $OPENAPI_GENERATOR_DIR -echo "Setting up new build directory and downloading the OpenAPI spec..." +echo "Setting up new build directory..." mkdir -p $OPENAPI_GENERATOR_DIR -curl -o $OPENAPI_GENERATOR_DIR/openapi3.json https://raw.githubusercontent.com/grafana/grafana/main/public/openapi3.json + +# First, get the tag reference +TAG_URL="https://api.github.com/repos/grafana/grafana/git/refs/tags/v$GRAFANA_VERSION_CLEAN" +echo "Fetching from tag URL: $TAG_URL" +TAG_DATA=$(curl -s "$TAG_URL") +echo "Tag API Response:" +echo "$TAG_DATA" + +# Get the SHA of the tag object +TAG_SHA=$(echo "$TAG_DATA" | grep -o '"sha": "[^"]*"' | head -1 | cut -d'"' -f4) +echo "Tag SHA: $TAG_SHA" + +# Now get the actual commit SHA that this tag points to +TAG_URL="https://api.github.com/repos/grafana/grafana/git/tags/$TAG_SHA" +echo "Fetching tag details from: $TAG_URL" +TAG_DETAILS=$(curl -s "$TAG_URL") +echo "Tag Details Response:" +echo "$TAG_DETAILS" + +# Extract the actual commit SHA +COMMIT_HASH=$(echo "$TAG_DETAILS" | grep -o '"sha": "[^"]*"' | tail -1 | cut -d'"' -f4) + +if [ -z "$COMMIT_HASH" ] || [ "$COMMIT_HASH" = "null" ]; then + echo "Failed to get proper commit hash for version $GRAFANA_VERSION_CLEAN" + exit 1 +fi + +echo "Found commit hash: $COMMIT_HASH" + +# Download the OpenAPI spec for the specific version +echo "Downloading OpenAPI spec for commit $COMMIT_HASH..." +SPEC_URL="https://raw.githubusercontent.com/grafana/grafana/$COMMIT_HASH/public/openapi3.json" +echo "Downloading from: $SPEC_URL" +curl -L -o $OPENAPI_GENERATOR_DIR/openapi3.json "$SPEC_URL" if [ -f $OPENAPI_GENERATOR_DIR/openapi3.json ]; then echo "OPENAPI file downloaded successfully." @@ -20,8 +70,15 @@ else exit 1 fi +# Get current user's UID and GID +USER_ID=$(id -u) +GROUP_ID=$(id -g) + echo "Running Docker to generate code..." -docker run --rm -v ${PWD}/${OPENAPI_GENERATOR_DIR}:/local openapitools/openapi-generator-cli generate \ +docker run --rm \ + --user $USER_ID:$GROUP_ID \ + -v ${PWD}/${OPENAPI_GENERATOR_DIR}:/local \ + openapitools/openapi-generator-cli generate \ -i /local/openapi3.json \ -g $OPENAPI_LANGUAGE \ -o /local/grafana-rust-client @@ -35,17 +92,16 @@ if [ -d "$OPENAPI_GENERATOR_DIR/grafana-rust-client/src" ]; then rm -rf "$OPENAPI_GENERATOR_DIR/grafana-rust-client/.travis.yml" rm -f "$OPENAPI_GENERATOR_DIR/grafana-rust-client/.gitignore" rm -f "$OPENAPI_GENERATOR_DIR/grafana-rust-client/git_push.sh" - + echo "Copying generated package to the target directory..." rm -rf "$TARGET_DIR" cp -r "$OPENAPI_GENERATOR_DIR/grafana-rust-client" "$TARGET_DIR" echo "Files copied successfully to $TARGET_DIR." - - echo "Setting full permissions for $TARGET_DIR..." + + echo "Setting permissions for $TARGET_DIR..." chmod -R 777 "$TARGET_DIR" - echo "Permissions set to 777 for all files and directories in $TARGET_DIR." + echo "Permissions set for all files and directories in $TARGET_DIR." else echo "Code generation did not complete successfully; src directory not found." exit 1 -fi - +fi \ No newline at end of file diff --git a/grafana/.env b/grafana/.env new file mode 100644 index 00000000..cccffa07 --- /dev/null +++ b/grafana/.env @@ -0,0 +1,3 @@ +# We can't just put the version inside main .env file as docker developers denied this feature due to skill issues +# https://github.com/docker/compose/issues/11122 +GRAFANA_VERSION=11.0.0 \ No newline at end of file diff --git a/grafana/docker-compose.yml b/grafana/docker-compose.yml index 3aa00661..5e9e1449 100644 --- a/grafana/docker-compose.yml +++ b/grafana/docker-compose.yml @@ -1,6 +1,6 @@ services: grafana: - image: grafana/grafana:11.0.0 + image: grafana/grafana:${GRAFANA_VERSION} user: "${GRAFANA_USER_ID:-1000:1000}" volumes: - ./grafana-data:/var/lib/grafana # Persists Grafana data diff --git a/grafana/grafana.ini b/grafana/grafana.ini index 04a696d3..8680bcba 100644 --- a/grafana/grafana.ini +++ b/grafana/grafana.ini @@ -1,3 +1,4 @@ +; Auth via jwt token is not working perfectly by design https://github.com/grafana/grafana/pull/78602 [auth.jwt] enabled = true header_name = X-JWT-Assertion @@ -8,4 +9,10 @@ key_file = /etc/grafana/public-key.pem url_login = true [feature_toggles] -enable = dashboardScene \ No newline at end of file +enable = dashboardScene + +[security] +; TEST USERNAME DO NOT USE IN PRODUCTION +admin_user = admin +; TEST PASSWORD DO NOT USE IN PRODUCTION +admin_password = admin \ No newline at end of file diff --git a/jwt_keys/note.txt b/jwt_keys/note.txt new file mode 100644 index 00000000..5754abfb --- /dev/null +++ b/jwt_keys/note.txt @@ -0,0 +1,3 @@ +# Generated so it can work with grafana +# ssh-keygen -t rsa -b 4096 -m PEM -f grafana.key -N "" +# openssl rsa -in grafana.key -pubout -outform PEM -out grafana.key.pub \ No newline at end of file diff --git a/openapi/README.md b/openapi/README.md index 7b5165c8..98af9f64 100755 --- a/openapi/README.md +++ b/openapi/README.md @@ -222,14 +222,6 @@ Class | Method | HTTP request | Description *LicensingApi* | [**post_license_token**](docs/LicensingApi.md#post_license_token) | **POST** /licensing/token | Create license token. *LicensingApi* | [**post_renew_license_token**](docs/LicensingApi.md#post_renew_license_token) | **POST** /licensing/token/renew | Manually force license refresh. *LicensingApi* | [**refresh_license_stats**](docs/LicensingApi.md#refresh_license_stats) | **GET** /licensing/refresh-stats | Refresh license stats. -*MigrationsApi* | [**create_cloud_migration_token**](docs/MigrationsApi.md#create_cloud_migration_token) | **POST** /cloudmigration/token | Create gcom access token. -*MigrationsApi* | [**create_migration**](docs/MigrationsApi.md#create_migration) | **POST** /cloudmigration/migration | Create a migration. -*MigrationsApi* | [**delete_cloud_migration**](docs/MigrationsApi.md#delete_cloud_migration) | **DELETE** /cloudmigration/migration/{id} | Delete a migration. -*MigrationsApi* | [**get_cloud_migration**](docs/MigrationsApi.md#get_cloud_migration) | **GET** /cloudmigration/migration/{id} | Get a cloud migration. -*MigrationsApi* | [**get_cloud_migration_run**](docs/MigrationsApi.md#get_cloud_migration_run) | **GET** /cloudmigration/migration/{id}/run/{runID} | Get the result of a single migration run. -*MigrationsApi* | [**get_cloud_migration_run_list**](docs/MigrationsApi.md#get_cloud_migration_run_list) | **GET** /cloudmigration/migration/{id}/run | Get a list of migration runs for a migration. -*MigrationsApi* | [**get_migration_list**](docs/MigrationsApi.md#get_migration_list) | **GET** /cloudmigration/migration | Get a list of all cloud migrations. -*MigrationsApi* | [**run_cloud_migration**](docs/MigrationsApi.md#run_cloud_migration) | **POST** /cloudmigration/migration/{id}/run | Trigger the run of a migration to the Grafana Cloud. *OrgApi* | [**add_org_user_to_current_org**](docs/OrgApi.md#add_org_user_to_current_org) | **POST** /org/users | Add a new user to the current organization. *OrgApi* | [**get_current_org**](docs/OrgApi.md#get_current_org) | **GET** /org | Get current Organization. *OrgApi* | [**get_org_users_for_current_org**](docs/OrgApi.md#get_org_users_for_current_org) | **GET** /org/users | Get all users within the current organization. @@ -446,10 +438,6 @@ Class | Method | HTTP request | Description - [Certificate](docs/Certificate.md) - [ChangeUserPasswordCommand](docs/ChangeUserPasswordCommand.md) - [ClearHelpFlags200Response](docs/ClearHelpFlags200Response.md) - - [CloudMigrationListResponse](docs/CloudMigrationListResponse.md) - - [CloudMigrationRequest](docs/CloudMigrationRequest.md) - - [CloudMigrationResponse](docs/CloudMigrationResponse.md) - - [CloudMigrationRunList](docs/CloudMigrationRunList.md) - [ClusterStatus](docs/ClusterStatus.md) - [Config](docs/Config.md) - [ContactPointExport](docs/ContactPointExport.md) @@ -457,7 +445,6 @@ Class | Method | HTTP request | Description - [Correlation](docs/Correlation.md) - [CorrelationConfig](docs/CorrelationConfig.md) - [CorrelationConfigUpdateDto](docs/CorrelationConfigUpdateDto.md) - - [CreateAccessTokenResponseDto](docs/CreateAccessTokenResponseDto.md) - [CreateCorrelationCommand](docs/CreateCorrelationCommand.md) - [CreateCorrelationResponseBody](docs/CreateCorrelationResponseBody.md) - [CreateDashboardSnapshot200Response](docs/CreateDashboardSnapshot200Response.md) @@ -566,8 +553,6 @@ Class | Method | HTTP request | Description - [MassDeleteAnnotationsCmd](docs/MassDeleteAnnotationsCmd.md) - [Matcher](docs/Matcher.md) - [MetricRequest](docs/MetricRequest.md) - - [MigrateDataResponseDto](docs/MigrateDataResponseDto.md) - - [MigrateDataResponseItemDto](docs/MigrateDataResponseItemDto.md) - [MoveFolderCommand](docs/MoveFolderCommand.md) - [MsTeamsConfig](docs/MsTeamsConfig.md) - [MuteTimeInterval](docs/MuteTimeInterval.md) diff --git a/openapi/docs/AccessControlApi.md b/openapi/docs/AccessControlApi.md index b1573b74..98efbc88 100755 --- a/openapi/docs/AccessControlApi.md +++ b/openapi/docs/AccessControlApi.md @@ -301,10 +301,10 @@ Name | Type | Description | Required | Notes ## list_roles -> Vec list_roles(delegatable, include_hidden) +> Vec list_roles(delegatable) Get all roles. -Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. The `delegatable` flag reduces the set of roles to only those for which the signed-in user has permissions to assign. +Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. ### Parameters @@ -312,7 +312,6 @@ Gets all existing roles. The response contains all global and organization local Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **delegatable** | Option<**bool**> | | | -**include_hidden** | Option<**bool**> | | | ### Return type diff --git a/openapi/docs/AlertQueryExport.md b/openapi/docs/AlertQueryExport.md index 50c09a87..db5fe0fc 100755 --- a/openapi/docs/AlertQueryExport.md +++ b/openapi/docs/AlertQueryExport.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **datasource_uid** | Option<**String**> | | [optional] -**model** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] +**model** | Option<[**serde_json::Value**](.md)> | | [optional] **query_type** | Option<**String**> | | [optional] **ref_id** | Option<**String**> | | [optional] **relative_time_range** | Option<[**models::RelativeTimeRangeExport**](RelativeTimeRangeExport.md)> | | [optional] diff --git a/openapi/docs/Certificate.md b/openapi/docs/Certificate.md index 6ab071ac..9ce30d32 100755 --- a/openapi/docs/Certificate.md +++ b/openapi/docs/Certificate.md @@ -30,8 +30,7 @@ Name | Type | Description | Notes **permitted_email_addresses** | Option<**Vec**> | | [optional] **permitted_ip_ranges** | Option<[**Vec**](IPNet.md)> | | [optional] **permitted_uri_domains** | Option<**Vec**> | | [optional] -**policies** | Option<[**Vec**](serde_json::Value.md)> | Policies contains all policy identifiers included in the certificate. In Go 1.22, encoding/gob cannot handle and ignores this field. | [optional] -**policy_identifiers** | Option<[**Vec>**](Vec.md)> | PolicyIdentifiers contains asn1.ObjectIdentifiers, the components of which are limited to int32. If a certificate contains a policy which cannot be represented by asn1.ObjectIdentifier, it will not be included in PolicyIdentifiers, but will be present in Policies, which contains all parsed policy OIDs. | [optional] +**policy_identifiers** | Option<[**Vec>**](Vec.md)> | | [optional] **public_key** | Option<[**serde_json::Value**](.md)> | | [optional] **public_key_algorithm** | Option<**i64**> | | [optional] **raw** | Option<**Vec**> | | [optional] diff --git a/openapi/docs/CloudMigrationListResponse.md b/openapi/docs/CloudMigrationListResponse.md deleted file mode 100755 index 27cab7c9..00000000 --- a/openapi/docs/CloudMigrationListResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# CloudMigrationListResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**migrations** | Option<[**Vec**](CloudMigrationResponse.md)> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/openapi/docs/CloudMigrationRequest.md b/openapi/docs/CloudMigrationRequest.md deleted file mode 100755 index d7afab7d..00000000 --- a/openapi/docs/CloudMigrationRequest.md +++ /dev/null @@ -1,11 +0,0 @@ -# CloudMigrationRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**auth_token** | Option<**String**> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/openapi/docs/CloudMigrationResponse.md b/openapi/docs/CloudMigrationResponse.md deleted file mode 100755 index 65902acd..00000000 --- a/openapi/docs/CloudMigrationResponse.md +++ /dev/null @@ -1,14 +0,0 @@ -# CloudMigrationResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**created** | Option<**String**> | | [optional] -**id** | Option<**i64**> | | [optional] -**stack** | Option<**String**> | | [optional] -**updated** | Option<**String**> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/openapi/docs/CloudMigrationRunList.md b/openapi/docs/CloudMigrationRunList.md deleted file mode 100755 index 936e7cba..00000000 --- a/openapi/docs/CloudMigrationRunList.md +++ /dev/null @@ -1,11 +0,0 @@ -# CloudMigrationRunList - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**runs** | Option<[**Vec**](MigrateDataResponseDTO.md)> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/openapi/docs/CookiePreferences.md b/openapi/docs/CookiePreferences.md index b9cee54e..d1830af9 100755 --- a/openapi/docs/CookiePreferences.md +++ b/openapi/docs/CookiePreferences.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**analytics** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] -**functional** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] -**performance** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] +**analytics** | Option<[**serde_json::Value**](.md)> | | [optional] +**functional** | Option<[**serde_json::Value**](.md)> | | [optional] +**performance** | Option<[**serde_json::Value**](.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/openapi/docs/CorrelationConfig.md b/openapi/docs/CorrelationConfig.md index ce1cd210..e4c1010a 100755 --- a/openapi/docs/CorrelationConfig.md +++ b/openapi/docs/CorrelationConfig.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **field** | **String** | Field used to attach the correlation link | -**target** | [**std::collections::HashMap**](serde_json::Value.md) | Target data query | +**target** | [**serde_json::Value**](.md) | Target data query | **transformations** | Option<[**Vec**](Transformation.md)> | | [optional] **r#type** | **String** | | diff --git a/openapi/docs/CorrelationConfigUpdateDto.md b/openapi/docs/CorrelationConfigUpdateDto.md index 296d0db7..9375f777 100755 --- a/openapi/docs/CorrelationConfigUpdateDto.md +++ b/openapi/docs/CorrelationConfigUpdateDto.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **field** | Option<**String**> | Field used to attach the correlation link | [optional] -**target** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | Target data query | [optional] +**target** | Option<[**serde_json::Value**](.md)> | Target data query | [optional] **transformations** | Option<[**Vec**](Transformation.md)> | Source data transformations | [optional] **r#type** | Option<**String**> | | [optional] diff --git a/openapi/docs/CreateAccessTokenResponseDto.md b/openapi/docs/CreateAccessTokenResponseDto.md deleted file mode 100755 index 70480332..00000000 --- a/openapi/docs/CreateAccessTokenResponseDto.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateAccessTokenResponseDto - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**token** | Option<**String**> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/openapi/docs/EnterpriseApi.md b/openapi/docs/EnterpriseApi.md index 99341cd4..83a6c946 100755 --- a/openapi/docs/EnterpriseApi.md +++ b/openapi/docs/EnterpriseApi.md @@ -902,10 +902,10 @@ This endpoint does not need any parameter. ## list_roles -> Vec list_roles(delegatable, include_hidden) +> Vec list_roles(delegatable) Get all roles. -Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. The `delegatable` flag reduces the set of roles to only those for which the signed-in user has permissions to assign. +Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. ### Parameters @@ -913,7 +913,6 @@ Gets all existing roles. The response contains all global and organization local Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **delegatable** | Option<**bool**> | | | -**include_hidden** | Option<**bool**> | | | ### Return type diff --git a/openapi/docs/FieldConfig.md b/openapi/docs/FieldConfig.md index 30086dea..d3a37fcf 100755 --- a/openapi/docs/FieldConfig.md +++ b/openapi/docs/FieldConfig.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**color** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | Map values to a display color NOTE: this interface is under development in the frontend... so simple map for now | [optional] -**custom** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | Panel Specific Values | [optional] +**color** | Option<[**serde_json::Value**](.md)> | Map values to a display color NOTE: this interface is under development in the frontend... so simple map for now | [optional] +**custom** | Option<[**serde_json::Value**](.md)> | Panel Specific Values | [optional] **decimals** | Option<**i32**> | | [optional] **description** | Option<**String**> | Description is human readable field metadata | [optional] **display_name** | Option<**String**> | DisplayName overrides Grafana default naming, should not be used from a data source | [optional] diff --git a/openapi/docs/IpNet.md b/openapi/docs/IpNet.md index f47cc46f..d87b9d5a 100755 --- a/openapi/docs/IpNet.md +++ b/openapi/docs/IpNet.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ip** | Option<**String**> | | [optional] -**mask** | Option<**Vec**> | See type [IPNet] and func [ParseCIDR] for details. | [optional] +**mask** | Option<**Vec**> | See type IPNet and func ParseCIDR for details. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/openapi/docs/ListAllProvidersSettings200ResponseInner.md b/openapi/docs/ListAllProvidersSettings200ResponseInner.md index c2c8aede..dcaf183b 100755 --- a/openapi/docs/ListAllProvidersSettings200ResponseInner.md +++ b/openapi/docs/ListAllProvidersSettings200ResponseInner.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**String**> | | [optional] **provider** | Option<**String**> | | [optional] -**settings** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] +**settings** | Option<[**serde_json::Value**](.md)> | | [optional] **source** | Option<**String**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/openapi/docs/MigrateDataResponseDto.md b/openapi/docs/MigrateDataResponseDto.md deleted file mode 100755 index bc9c7fc2..00000000 --- a/openapi/docs/MigrateDataResponseDto.md +++ /dev/null @@ -1,12 +0,0 @@ -# MigrateDataResponseDto - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | Option<**i64**> | | [optional] -**items** | Option<[**Vec**](MigrateDataResponseItemDTO.md)> | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/openapi/docs/MigrateDataResponseItemDto.md b/openapi/docs/MigrateDataResponseItemDto.md deleted file mode 100755 index 33eba195..00000000 --- a/openapi/docs/MigrateDataResponseItemDto.md +++ /dev/null @@ -1,14 +0,0 @@ -# MigrateDataResponseItemDto - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**error** | Option<**String**> | | [optional] -**ref_id** | **String** | | -**status** | **String** | | -**r#type** | **String** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/openapi/docs/MigrationsApi.md b/openapi/docs/MigrationsApi.md deleted file mode 100755 index 42cf6a09..00000000 --- a/openapi/docs/MigrationsApi.md +++ /dev/null @@ -1,239 +0,0 @@ -# \MigrationsApi - -All URIs are relative to */api* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**create_cloud_migration_token**](MigrationsApi.md#create_cloud_migration_token) | **POST** /cloudmigration/token | Create gcom access token. -[**create_migration**](MigrationsApi.md#create_migration) | **POST** /cloudmigration/migration | Create a migration. -[**delete_cloud_migration**](MigrationsApi.md#delete_cloud_migration) | **DELETE** /cloudmigration/migration/{id} | Delete a migration. -[**get_cloud_migration**](MigrationsApi.md#get_cloud_migration) | **GET** /cloudmigration/migration/{id} | Get a cloud migration. -[**get_cloud_migration_run**](MigrationsApi.md#get_cloud_migration_run) | **GET** /cloudmigration/migration/{id}/run/{runID} | Get the result of a single migration run. -[**get_cloud_migration_run_list**](MigrationsApi.md#get_cloud_migration_run_list) | **GET** /cloudmigration/migration/{id}/run | Get a list of migration runs for a migration. -[**get_migration_list**](MigrationsApi.md#get_migration_list) | **GET** /cloudmigration/migration | Get a list of all cloud migrations. -[**run_cloud_migration**](MigrationsApi.md#run_cloud_migration) | **POST** /cloudmigration/migration/{id}/run | Trigger the run of a migration to the Grafana Cloud. - - - -## create_cloud_migration_token - -> models::CreateAccessTokenResponseDto create_cloud_migration_token() -Create gcom access token. - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**models::CreateAccessTokenResponseDto**](CreateAccessTokenResponseDTO.md) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## create_migration - -> models::CloudMigrationResponse create_migration(cloud_migration_request) -Create a migration. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**cloud_migration_request** | [**CloudMigrationRequest**](CloudMigrationRequest.md) | | [required] | - -### Return type - -[**models::CloudMigrationResponse**](CloudMigrationResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## delete_cloud_migration - -> delete_cloud_migration(id) -Delete a migration. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **i64** | ID of an migration | [required] | - -### Return type - - (empty response body) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## get_cloud_migration - -> models::CloudMigrationResponse get_cloud_migration(id) -Get a cloud migration. - -It returns migrations that has been created. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **i64** | ID of an migration | [required] | - -### Return type - -[**models::CloudMigrationResponse**](CloudMigrationResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## get_cloud_migration_run - -> models::MigrateDataResponseDto get_cloud_migration_run(id, run_id) -Get the result of a single migration run. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **i64** | ID of an migration | [required] | -**run_id** | **i64** | Run ID of a migration run | [required] | - -### Return type - -[**models::MigrateDataResponseDto**](MigrateDataResponseDTO.md) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## get_cloud_migration_run_list - -> models::CloudMigrationRunList get_cloud_migration_run_list(id) -Get a list of migration runs for a migration. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **i64** | ID of an migration | [required] | - -### Return type - -[**models::CloudMigrationRunList**](CloudMigrationRunList.md) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## get_migration_list - -> models::CloudMigrationListResponse get_migration_list() -Get a list of all cloud migrations. - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**models::CloudMigrationListResponse**](CloudMigrationListResponse.md) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -## run_cloud_migration - -> models::MigrateDataResponseDto run_cloud_migration(id) -Trigger the run of a migration to the Grafana Cloud. - -It returns migrations that has been created. - -### Parameters - - -Name | Type | Description | Required | Notes -------------- | ------------- | ------------- | ------------- | ------------- -**id** | **i64** | ID of an migration | [required] | - -### Return type - -[**models::MigrateDataResponseDto**](MigrateDataResponseDTO.md) - -### Authorization - -[api_key](../README.md#api_key), [basic](../README.md#basic) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/openapi/docs/PublicError.md b/openapi/docs/PublicError.md index e260865e..c2d41758 100755 --- a/openapi/docs/PublicError.md +++ b/openapi/docs/PublicError.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**extra** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | Extra Additional information about the error | [optional] +**extra** | Option<[**serde_json::Value**](.md)> | Extra Additional information about the error | [optional] **message** | Option<**String**> | Message A human readable message | [optional] **message_id** | **String** | MessageID A unique identifier for the error | **status_code** | **i64** | StatusCode The HTTP status code returned | diff --git a/openapi/docs/QueryStat.md b/openapi/docs/QueryStat.md index ad445bc2..2197af41 100755 --- a/openapi/docs/QueryStat.md +++ b/openapi/docs/QueryStat.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**color** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | Map values to a display color NOTE: this interface is under development in the frontend... so simple map for now | [optional] -**custom** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | Panel Specific Values | [optional] +**color** | Option<[**serde_json::Value**](.md)> | Map values to a display color NOTE: this interface is under development in the frontend... so simple map for now | [optional] +**custom** | Option<[**serde_json::Value**](.md)> | Panel Specific Values | [optional] **decimals** | Option<**i32**> | | [optional] **description** | Option<**String**> | Description is human readable field metadata | [optional] **display_name** | Option<**String**> | DisplayName overrides Grafana default naming, should not be used from a data source | [optional] diff --git a/openapi/docs/RecordingRuleJson.md b/openapi/docs/RecordingRuleJson.md index 4495cbbe..a02ffb0e 100755 --- a/openapi/docs/RecordingRuleJson.md +++ b/openapi/docs/RecordingRuleJson.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **interval** | Option<**i64**> | | [optional] **name** | Option<**String**> | | [optional] **prom_name** | Option<**String**> | | [optional] -**queries** | Option<[**Vec>**](std::collections::HashMap.md)> | | [optional] +**queries** | Option<[**Vec**](serde_json::Value.md)> | | [optional] **range** | Option<**i64**> | | [optional] **target_ref_id** | Option<**String**> | | [optional] diff --git a/openapi/docs/Unstructured.md b/openapi/docs/Unstructured.md index 720bfa81..264352cf 100755 --- a/openapi/docs/Unstructured.md +++ b/openapi/docs/Unstructured.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**object** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | Object is a JSON compatible map with string, float, int, bool, []interface{}, or map[string]interface{} children. | [optional] +**object** | Option<[**serde_json::Value**](.md)> | Object is a JSON compatible map with string, float, int, bool, []interface{}, or map[string]interface{} children. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/openapi/docs/UpdateProviderSettingsRequest.md b/openapi/docs/UpdateProviderSettingsRequest.md index a45b3666..99386b04 100755 --- a/openapi/docs/UpdateProviderSettingsRequest.md +++ b/openapi/docs/UpdateProviderSettingsRequest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | Option<**String**> | | [optional] **provider** | Option<**String**> | | [optional] -**settings** | Option<[**std::collections::HashMap**](serde_json::Value.md)> | | [optional] +**settings** | Option<[**serde_json::Value**](.md)> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/openapi/docs/Url.md b/openapi/docs/Url.md index 0ad55078..43d53024 100755 --- a/openapi/docs/Url.md +++ b/openapi/docs/Url.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **raw_path** | Option<**String**> | | [optional] **raw_query** | Option<**String**> | | [optional] **scheme** | Option<**String**> | | [optional] -**user** | Option<[**serde_json::Value**](.md)> | The Userinfo type is an immutable encapsulation of username and password details for a [URL]. An existing Userinfo value is guaranteed to have a username set (potentially empty, as allowed by RFC 2396), and optionally a password. | [optional] +**user** | Option<[**serde_json::Value**](.md)> | The Userinfo type is an immutable encapsulation of username and password details for a URL. An existing Userinfo value is guaranteed to have a username set (potentially empty, as allowed by RFC 2396), and optionally a password. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/openapi/src/apis/access_control_api.rs b/openapi/src/apis/access_control_api.rs index 68564f90..8831998f 100755 --- a/openapi/src/apis/access_control_api.rs +++ b/openapi/src/apis/access_control_api.rs @@ -621,8 +621,8 @@ pub async fn get_role_assignments(configuration: &configuration::Configuration, } } -/// Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. The `delegatable` flag reduces the set of roles to only those for which the signed-in user has permissions to assign. -pub async fn list_roles(configuration: &configuration::Configuration, delegatable: Option, include_hidden: Option) -> Result, Error> { +/// Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. +pub async fn list_roles(configuration: &configuration::Configuration, delegatable: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -633,9 +633,6 @@ pub async fn list_roles(configuration: &configuration::Configuration, delegatabl if let Some(ref local_var_str) = delegatable { local_var_req_builder = local_var_req_builder.query(&[("delegatable", &local_var_str.to_string())]); } - if let Some(ref local_var_str) = include_hidden { - local_var_req_builder = local_var_req_builder.query(&[("includeHidden", &local_var_str.to_string())]); - } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } diff --git a/openapi/src/apis/enterprise_api.rs b/openapi/src/apis/enterprise_api.rs index 5b917f77..61e40b2e 100755 --- a/openapi/src/apis/enterprise_api.rs +++ b/openapi/src/apis/enterprise_api.rs @@ -1753,8 +1753,8 @@ pub async fn list_recording_rules(configuration: &configuration::Configuration, } } -/// Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. The `delegatable` flag reduces the set of roles to only those for which the signed-in user has permissions to assign. -pub async fn list_roles(configuration: &configuration::Configuration, delegatable: Option, include_hidden: Option) -> Result, Error> { +/// Gets all existing roles. The response contains all global and organization local roles, for the organization which user is signed in. You need to have a permission with action `roles:read` and scope `roles:*`. +pub async fn list_roles(configuration: &configuration::Configuration, delegatable: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -1765,9 +1765,6 @@ pub async fn list_roles(configuration: &configuration::Configuration, delegatabl if let Some(ref local_var_str) = delegatable { local_var_req_builder = local_var_req_builder.query(&[("delegatable", &local_var_str.to_string())]); } - if let Some(ref local_var_str) = include_hidden { - local_var_req_builder = local_var_req_builder.query(&[("includeHidden", &local_var_str.to_string())]); - } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } diff --git a/openapi/src/apis/folders_api.rs b/openapi/src/apis/folders_api.rs index 015952b4..b9a70bc4 100755 --- a/openapi/src/apis/folders_api.rs +++ b/openapi/src/apis/folders_api.rs @@ -8,10 +8,12 @@ * Generated by: https://openapi-generator.tech */ + use reqwest; -use super::{configuration, Error}; use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_folder`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -104,22 +106,18 @@ pub enum UpdateFolderError { UnknownValue(serde_json::Value), } + /// If nested folders are enabled then it additionally expects the parent folder UID. -pub async fn create_folder( - configuration: &configuration::Configuration, - create_folder_command: models::CreateFolderCommand, -) -> Result> { +pub async fn create_folder(configuration: &configuration::Configuration, create_folder_command: models::CreateFolderCommand) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/folders", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -130,10 +128,7 @@ pub async fn create_folder( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; local_var_req_builder = local_var_req_builder.json(&create_folder_command); @@ -146,43 +141,26 @@ pub async fn create_folder( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -// Response for this method has been modified - errors in the original OpenAPI spec /// Deletes an existing folder identified by UID along with all dashboards (and their alerts) stored in the folder. This operation cannot be reverted. If nested folders are enabled then it also deletes all the subfolders. -pub async fn delete_folder( - configuration: &configuration::Configuration, - folder_uid: &str, - force_delete_rules: Option, -) -> Result> { +pub async fn delete_folder(configuration: &configuration::Configuration, folder_uid: &str, force_delete_rules: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/folders/{folder_uid}", - local_var_configuration.base_path, - folder_uid = crate::apis::urlencode(folder_uid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/folders/{folder_uid}", local_var_configuration.base_path, folder_uid=crate::apis::urlencode(folder_uid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_str) = force_delete_rules { - local_var_req_builder = - local_var_req_builder.query(&[("forceDeleteRules", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("forceDeleteRules", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -193,14 +171,10 @@ pub async fn delete_folder( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; let local_var_req = local_var_req_builder.build()?; - println!("req: {:?}", local_var_req); let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); @@ -209,37 +183,23 @@ pub async fn delete_folder( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns the folder identified by id. This is deprecated. Please refer to [updated API](#/folders/getFolderByUID) instead -pub async fn get_folder_by_id( - configuration: &configuration::Configuration, - folder_id: i64, -) -> Result> { +pub async fn get_folder_by_id(configuration: &configuration::Configuration, folder_id: i64) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/folders/id/{folder_id}", - local_var_configuration.base_path, - folder_id = folder_id - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/folders/id/{folder_id}", local_var_configuration.base_path, folder_id=folder_id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -250,10 +210,7 @@ pub async fn get_folder_by_id( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; let local_var_req = local_var_req_builder.build()?; @@ -265,36 +222,22 @@ pub async fn get_folder_by_id( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_folder_by_uid( - configuration: &configuration::Configuration, - folder_uid: &str, -) -> Result> { +pub async fn get_folder_by_uid(configuration: &configuration::Configuration, folder_uid: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/folders/{folder_uid}", - local_var_configuration.base_path, - folder_uid = crate::apis::urlencode(folder_uid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/folders/{folder_uid}", local_var_configuration.base_path, folder_uid=crate::apis::urlencode(folder_uid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -305,10 +248,7 @@ pub async fn get_folder_by_uid( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; let local_var_req = local_var_req_builder.build()?; @@ -320,36 +260,22 @@ pub async fn get_folder_by_uid( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn get_folder_descendant_counts( - configuration: &configuration::Configuration, - folder_uid: &str, -) -> Result, Error> { +pub async fn get_folder_descendant_counts(configuration: &configuration::Configuration, folder_uid: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/folders/{folder_uid}/counts", - local_var_configuration.base_path, - folder_uid = crate::apis::urlencode(folder_uid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/folders/{folder_uid}/counts", local_var_configuration.base_path, folder_uid=crate::apis::urlencode(folder_uid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -360,10 +286,7 @@ pub async fn get_folder_descendant_counts( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; let local_var_req = local_var_req_builder.build()?; @@ -375,52 +298,35 @@ pub async fn get_folder_descendant_counts( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// It returns all folders that the authenticated user has permission to view. If nested folders are enabled, it expects an additional query parameter with the parent folder UID and returns the immediate subfolders that the authenticated user has permission to view. If the parameter is not supplied then it returns immediate subfolders under the root that the authenticated user has permission to view. -pub async fn get_folders( - configuration: &configuration::Configuration, - limit: Option, - page: Option, - parent_uid: Option<&str>, - permission: Option<&str>, -) -> Result, Error> { +pub async fn get_folders(configuration: &configuration::Configuration, limit: Option, page: Option, parent_uid: Option<&str>, permission: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/folders", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = limit { - local_var_req_builder = - local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); } if let Some(ref local_var_str) = page { - local_var_req_builder = - local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); } if let Some(ref local_var_str) = parent_uid { - local_var_req_builder = - local_var_req_builder.query(&[("parentUid", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("parentUid", &local_var_str.to_string())]); } if let Some(ref local_var_str) = permission { - local_var_req_builder = - local_var_req_builder.query(&[("permission", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("permission", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -431,10 +337,7 @@ pub async fn get_folders( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; let local_var_req = local_var_req_builder.build()?; @@ -446,37 +349,22 @@ pub async fn get_folders( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn move_folder( - configuration: &configuration::Configuration, - folder_uid: &str, - move_folder_command: models::MoveFolderCommand, -) -> Result> { +pub async fn move_folder(configuration: &configuration::Configuration, folder_uid: &str, move_folder_command: models::MoveFolderCommand) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/folders/{folder_uid}/move", - local_var_configuration.base_path, - folder_uid = crate::apis::urlencode(folder_uid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/folders/{folder_uid}/move", local_var_configuration.base_path, folder_uid=crate::apis::urlencode(folder_uid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -487,10 +375,7 @@ pub async fn move_folder( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; local_var_req_builder = local_var_req_builder.json(&move_folder_command); @@ -503,37 +388,22 @@ pub async fn move_folder( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } -pub async fn update_folder( - configuration: &configuration::Configuration, - folder_uid: &str, - update_folder_command: models::UpdateFolderCommand, -) -> Result> { +pub async fn update_folder(configuration: &configuration::Configuration, folder_uid: &str, update_folder_command: models::UpdateFolderCommand) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/folders/{folder_uid}", - local_var_configuration.base_path, - folder_uid = crate::apis::urlencode(folder_uid) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/folders/{folder_uid}", local_var_configuration.base_path, folder_uid=crate::apis::urlencode(folder_uid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_apikey) = local_var_configuration.api_key { let local_var_key = local_var_apikey.key.clone(); @@ -544,10 +414,7 @@ pub async fn update_folder( local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); }; if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; local_var_req_builder = local_var_req_builder.json(&update_folder_command); @@ -560,13 +427,9 @@ pub async fn update_folder( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/openapi/src/apis/migrations_api.rs b/openapi/src/apis/migrations_api.rs deleted file mode 100755 index ae8b1529..00000000 --- a/openapi/src/apis/migrations_api.rs +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - - -use reqwest; - -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - - -/// struct for typed errors of method [`create_cloud_migration_token`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateCloudMigrationTokenError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`create_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateMigrationError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`delete_cloud_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteCloudMigrationError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_cloud_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetCloudMigrationError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_cloud_migration_run`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetCloudMigrationRunError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_cloud_migration_run_list`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetCloudMigrationRunListError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`get_migration_list`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetMigrationListError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - -/// struct for typed errors of method [`run_cloud_migration`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum RunCloudMigrationError { - Status401(models::ErrorResponseBody), - Status403(models::ErrorResponseBody), - Status500(models::ErrorResponseBody), - UnknownValue(serde_json::Value), -} - - -pub async fn create_cloud_migration_token(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/token", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn create_migration(configuration: &configuration::Configuration, cloud_migration_request: models::CloudMigrationRequest) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/migration", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - local_var_req_builder = local_var_req_builder.json(&cloud_migration_request); - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn delete_cloud_migration(configuration: &configuration::Configuration, id: i64) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/migration/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// It returns migrations that has been created. -pub async fn get_cloud_migration(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/migration/{id}", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn get_cloud_migration_run(configuration: &configuration::Configuration, id: i64, run_id: i64) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/migration/{id}/run/{runID}", local_var_configuration.base_path, id=id, runID=run_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn get_cloud_migration_run_list(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/migration/{id}/run", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -pub async fn get_migration_list(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/migration", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// It returns migrations that has been created. -pub async fn run_cloud_migration(configuration: &configuration::Configuration, id: i64) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/cloudmigration/migration/{id}/run", local_var_configuration.base_path, id=id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_apikey) = local_var_configuration.api_key { - let local_var_key = local_var_apikey.key.clone(); - let local_var_value = match local_var_apikey.prefix { - Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), - None => local_var_key, - }; - local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); - }; - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); - }; - - let local_var_req = local_var_req_builder.build()?; - let local_var_resp = local_var_client.execute(local_var_req).await?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - diff --git a/openapi/src/apis/mod.rs b/openapi/src/apis/mod.rs index 4ca60ac1..55e5a9ed 100755 --- a/openapi/src/apis/mod.rs +++ b/openapi/src/apis/mod.rs @@ -113,7 +113,6 @@ pub mod get_current_org_api; pub mod ldap_debug_api; pub mod library_elements_api; pub mod licensing_api; -pub mod migrations_api; pub mod org_api; pub mod org_invites_api; pub mod org_preferences_api; diff --git a/openapi/src/models/alert_query_export.rs b/openapi/src/models/alert_query_export.rs index 52b277e9..a03a0804 100755 --- a/openapi/src/models/alert_query_export.rs +++ b/openapi/src/models/alert_query_export.rs @@ -15,7 +15,7 @@ pub struct AlertQueryExport { #[serde(rename = "datasourceUid", skip_serializing_if = "Option::is_none")] pub datasource_uid: Option, #[serde(rename = "model", skip_serializing_if = "Option::is_none")] - pub model: Option>, + pub model: Option, #[serde(rename = "queryType", skip_serializing_if = "Option::is_none")] pub query_type: Option, #[serde(rename = "refId", skip_serializing_if = "Option::is_none")] diff --git a/openapi/src/models/certificate.rs b/openapi/src/models/certificate.rs index 5ad0cbdd..9412f3ab 100755 --- a/openapi/src/models/certificate.rs +++ b/openapi/src/models/certificate.rs @@ -74,10 +74,6 @@ pub struct Certificate { pub permitted_ip_ranges: Option>, #[serde(rename = "PermittedURIDomains", skip_serializing_if = "Option::is_none")] pub permitted_uri_domains: Option>, - /// Policies contains all policy identifiers included in the certificate. In Go 1.22, encoding/gob cannot handle and ignores this field. - #[serde(rename = "Policies", skip_serializing_if = "Option::is_none")] - pub policies: Option>, - /// PolicyIdentifiers contains asn1.ObjectIdentifiers, the components of which are limited to int32. If a certificate contains a policy which cannot be represented by asn1.ObjectIdentifier, it will not be included in PolicyIdentifiers, but will be present in Policies, which contains all parsed policy OIDs. #[serde(rename = "PolicyIdentifiers", skip_serializing_if = "Option::is_none")] pub policy_identifiers: Option>>, #[serde(rename = "PublicKey", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] @@ -144,7 +140,6 @@ impl Certificate { permitted_email_addresses: None, permitted_ip_ranges: None, permitted_uri_domains: None, - policies: None, policy_identifiers: None, public_key: None, public_key_algorithm: None, diff --git a/openapi/src/models/cloud_migration_list_response.rs b/openapi/src/models/cloud_migration_list_response.rs deleted file mode 100755 index 853e2868..00000000 --- a/openapi/src/models/cloud_migration_list_response.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CloudMigrationListResponse { - #[serde(rename = "migrations", skip_serializing_if = "Option::is_none")] - pub migrations: Option>, -} - -impl CloudMigrationListResponse { - pub fn new() -> CloudMigrationListResponse { - CloudMigrationListResponse { - migrations: None, - } - } -} - diff --git a/openapi/src/models/cloud_migration_request.rs b/openapi/src/models/cloud_migration_request.rs deleted file mode 100755 index 9a08210b..00000000 --- a/openapi/src/models/cloud_migration_request.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CloudMigrationRequest { - #[serde(rename = "authToken", skip_serializing_if = "Option::is_none")] - pub auth_token: Option, -} - -impl CloudMigrationRequest { - pub fn new() -> CloudMigrationRequest { - CloudMigrationRequest { - auth_token: None, - } - } -} - diff --git a/openapi/src/models/cloud_migration_response.rs b/openapi/src/models/cloud_migration_response.rs deleted file mode 100755 index 09c4bb89..00000000 --- a/openapi/src/models/cloud_migration_response.rs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CloudMigrationResponse { - #[serde(rename = "created", skip_serializing_if = "Option::is_none")] - pub created: Option, - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "stack", skip_serializing_if = "Option::is_none")] - pub stack: Option, - #[serde(rename = "updated", skip_serializing_if = "Option::is_none")] - pub updated: Option, -} - -impl CloudMigrationResponse { - pub fn new() -> CloudMigrationResponse { - CloudMigrationResponse { - created: None, - id: None, - stack: None, - updated: None, - } - } -} - diff --git a/openapi/src/models/cloud_migration_run_list.rs b/openapi/src/models/cloud_migration_run_list.rs deleted file mode 100755 index 8cdc98a1..00000000 --- a/openapi/src/models/cloud_migration_run_list.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CloudMigrationRunList { - #[serde(rename = "runs", skip_serializing_if = "Option::is_none")] - pub runs: Option>, -} - -impl CloudMigrationRunList { - pub fn new() -> CloudMigrationRunList { - CloudMigrationRunList { - runs: None, - } - } -} - diff --git a/openapi/src/models/cookie_preferences.rs b/openapi/src/models/cookie_preferences.rs index 3c88f040..e21abba2 100755 --- a/openapi/src/models/cookie_preferences.rs +++ b/openapi/src/models/cookie_preferences.rs @@ -13,11 +13,11 @@ use crate::models; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CookiePreferences { #[serde(rename = "analytics", skip_serializing_if = "Option::is_none")] - pub analytics: Option>, + pub analytics: Option, #[serde(rename = "functional", skip_serializing_if = "Option::is_none")] - pub functional: Option>, + pub functional: Option, #[serde(rename = "performance", skip_serializing_if = "Option::is_none")] - pub performance: Option>, + pub performance: Option, } impl CookiePreferences { diff --git a/openapi/src/models/correlation_config.rs b/openapi/src/models/correlation_config.rs index 2b157546..9843a5a4 100755 --- a/openapi/src/models/correlation_config.rs +++ b/openapi/src/models/correlation_config.rs @@ -17,7 +17,7 @@ pub struct CorrelationConfig { pub field: String, /// Target data query #[serde(rename = "target")] - pub target: std::collections::HashMap, + pub target: serde_json::Value, #[serde(rename = "transformations", skip_serializing_if = "Option::is_none")] pub transformations: Option>, #[serde(rename = "type")] @@ -25,7 +25,7 @@ pub struct CorrelationConfig { } impl CorrelationConfig { - pub fn new(field: String, target: std::collections::HashMap, r#type: String) -> CorrelationConfig { + pub fn new(field: String, target: serde_json::Value, r#type: String) -> CorrelationConfig { CorrelationConfig { field, target, diff --git a/openapi/src/models/correlation_config_update_dto.rs b/openapi/src/models/correlation_config_update_dto.rs index 1572e282..913e7d3d 100755 --- a/openapi/src/models/correlation_config_update_dto.rs +++ b/openapi/src/models/correlation_config_update_dto.rs @@ -17,7 +17,7 @@ pub struct CorrelationConfigUpdateDto { pub field: Option, /// Target data query #[serde(rename = "target", skip_serializing_if = "Option::is_none")] - pub target: Option>, + pub target: Option, /// Source data transformations #[serde(rename = "transformations", skip_serializing_if = "Option::is_none")] pub transformations: Option>, diff --git a/openapi/src/models/create_access_token_response_dto.rs b/openapi/src/models/create_access_token_response_dto.rs deleted file mode 100755 index aac90589..00000000 --- a/openapi/src/models/create_access_token_response_dto.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct CreateAccessTokenResponseDto { - #[serde(rename = "token", skip_serializing_if = "Option::is_none")] - pub token: Option, -} - -impl CreateAccessTokenResponseDto { - pub fn new() -> CreateAccessTokenResponseDto { - CreateAccessTokenResponseDto { - token: None, - } - } -} - diff --git a/openapi/src/models/delete_folder_200_response.rs b/openapi/src/models/delete_folder_200_response.rs index c0bd3c85..29242300 100755 --- a/openapi/src/models/delete_folder_200_response.rs +++ b/openapi/src/models/delete_folder_200_response.rs @@ -10,32 +10,26 @@ use crate::models; -// Response has been modified - errors in the original OpenAPI spec #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DeleteFolder200Response { + /// ID Identifier of the deleted folder. + #[serde(rename = "id")] + pub id: i64, /// Message Message of the deleted folder. #[serde(rename = "message")] pub message: String, + /// Title of the deleted folder. + #[serde(rename = "title")] + pub title: String, } -// pub struct DeleteFolder200Response { -// /// ID Identifier of the deleted folder. -// #[serde(rename = "id")] -// pub id: i64, -// /// Message Message of the deleted folder. -// #[serde(rename = "message")] -// pub message: String, -// /// Title of the deleted folder. -// #[serde(rename = "title")] -// pub title: String, -// } - impl DeleteFolder200Response { - pub fn new(message: String) -> DeleteFolder200Response { + pub fn new(id: i64, message: String, title: String) -> DeleteFolder200Response { DeleteFolder200Response { - // id, + id, message, - // title, + title, } } } + diff --git a/openapi/src/models/field_config.rs b/openapi/src/models/field_config.rs index 27194ea5..4cb93594 100755 --- a/openapi/src/models/field_config.rs +++ b/openapi/src/models/field_config.rs @@ -14,10 +14,10 @@ use crate::models; pub struct FieldConfig { /// Map values to a display color NOTE: this interface is under development in the frontend... so simple map for now #[serde(rename = "color", skip_serializing_if = "Option::is_none")] - pub color: Option>, + pub color: Option, /// Panel Specific Values #[serde(rename = "custom", skip_serializing_if = "Option::is_none")] - pub custom: Option>, + pub custom: Option, #[serde(rename = "decimals", skip_serializing_if = "Option::is_none")] pub decimals: Option, /// Description is human readable field metadata diff --git a/openapi/src/models/ip_net.rs b/openapi/src/models/ip_net.rs index 358b21db..b49da88b 100755 --- a/openapi/src/models/ip_net.rs +++ b/openapi/src/models/ip_net.rs @@ -14,7 +14,7 @@ use crate::models; pub struct IpNet { #[serde(rename = "IP", skip_serializing_if = "Option::is_none")] pub ip: Option, - /// See type [IPNet] and func [ParseCIDR] for details. + /// See type IPNet and func ParseCIDR for details. #[serde(rename = "Mask", skip_serializing_if = "Option::is_none")] pub mask: Option>, } diff --git a/openapi/src/models/list_all_providers_settings_200_response_inner.rs b/openapi/src/models/list_all_providers_settings_200_response_inner.rs index f73990dc..5daf9422 100755 --- a/openapi/src/models/list_all_providers_settings_200_response_inner.rs +++ b/openapi/src/models/list_all_providers_settings_200_response_inner.rs @@ -17,7 +17,7 @@ pub struct ListAllProvidersSettings200ResponseInner { #[serde(rename = "provider", skip_serializing_if = "Option::is_none")] pub provider: Option, #[serde(rename = "settings", skip_serializing_if = "Option::is_none")] - pub settings: Option>, + pub settings: Option, #[serde(rename = "source", skip_serializing_if = "Option::is_none")] pub source: Option, } diff --git a/openapi/src/models/migrate_data_response_dto.rs b/openapi/src/models/migrate_data_response_dto.rs deleted file mode 100755 index db15d097..00000000 --- a/openapi/src/models/migrate_data_response_dto.rs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct MigrateDataResponseDto { - #[serde(rename = "id", skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(rename = "items", skip_serializing_if = "Option::is_none")] - pub items: Option>, -} - -impl MigrateDataResponseDto { - pub fn new() -> MigrateDataResponseDto { - MigrateDataResponseDto { - id: None, - items: None, - } - } -} - diff --git a/openapi/src/models/migrate_data_response_item_dto.rs b/openapi/src/models/migrate_data_response_item_dto.rs deleted file mode 100755 index 80678301..00000000 --- a/openapi/src/models/migrate_data_response_item_dto.rs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Grafana HTTP API. - * - * The Grafana backend exposes an HTTP API, the same API is used by the frontend to do everything from saving dashboards, creating users and updating data sources. - * - * The version of the OpenAPI document: 0.0.1 - * Contact: hello@grafana.com - * Generated by: https://openapi-generator.tech - */ - -use crate::models; - -#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] -pub struct MigrateDataResponseItemDto { - #[serde(rename = "error", skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(rename = "refId")] - pub ref_id: String, - #[serde(rename = "status")] - pub status: Status, - #[serde(rename = "type")] - pub r#type: Type, -} - -impl MigrateDataResponseItemDto { - pub fn new(ref_id: String, status: Status, r#type: Type) -> MigrateDataResponseItemDto { - MigrateDataResponseItemDto { - error: None, - ref_id, - status, - r#type, - } - } -} -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Status { - #[serde(rename = "OK")] - Ok, - #[serde(rename = "ERROR")] - Error, -} - -impl Default for Status { - fn default() -> Status { - Self::Ok - } -} -/// -#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] -pub enum Type { - #[serde(rename = "DASHBOARD")] - Dashboard, - #[serde(rename = "DATASOURCE")] - Datasource, - #[serde(rename = "FOLDER")] - Folder, -} - -impl Default for Type { - fn default() -> Type { - Self::Dashboard - } -} - diff --git a/openapi/src/models/mod.rs b/openapi/src/models/mod.rs index e34e8801..1163e976 100755 --- a/openapi/src/models/mod.rs +++ b/openapi/src/models/mod.rs @@ -112,14 +112,6 @@ pub mod change_user_password_command; pub use self::change_user_password_command::ChangeUserPasswordCommand; pub mod clear_help_flags_200_response; pub use self::clear_help_flags_200_response::ClearHelpFlags200Response; -pub mod cloud_migration_list_response; -pub use self::cloud_migration_list_response::CloudMigrationListResponse; -pub mod cloud_migration_request; -pub use self::cloud_migration_request::CloudMigrationRequest; -pub mod cloud_migration_response; -pub use self::cloud_migration_response::CloudMigrationResponse; -pub mod cloud_migration_run_list; -pub use self::cloud_migration_run_list::CloudMigrationRunList; pub mod cluster_status; pub use self::cluster_status::ClusterStatus; pub mod config; @@ -134,8 +126,6 @@ pub mod correlation_config; pub use self::correlation_config::CorrelationConfig; pub mod correlation_config_update_dto; pub use self::correlation_config_update_dto::CorrelationConfigUpdateDto; -pub mod create_access_token_response_dto; -pub use self::create_access_token_response_dto::CreateAccessTokenResponseDto; pub mod create_correlation_command; pub use self::create_correlation_command::CreateCorrelationCommand; pub mod create_correlation_response_body; @@ -352,10 +342,6 @@ pub mod matcher; pub use self::matcher::Matcher; pub mod metric_request; pub use self::metric_request::MetricRequest; -pub mod migrate_data_response_dto; -pub use self::migrate_data_response_dto::MigrateDataResponseDto; -pub mod migrate_data_response_item_dto; -pub use self::migrate_data_response_item_dto::MigrateDataResponseItemDto; pub mod move_folder_command; pub use self::move_folder_command::MoveFolderCommand; pub mod ms_teams_config; diff --git a/openapi/src/models/name.rs b/openapi/src/models/name.rs index 734bc167..daab3d20 100755 --- a/openapi/src/models/name.rs +++ b/openapi/src/models/name.rs @@ -10,7 +10,7 @@ use crate::models; -/// Name : Name represents an X.509 distinguished name. This only includes the common elements of a DN. Note that Name is only an approximation of the X.509 structure. If an accurate representation is needed, asn1.Unmarshal the raw subject or issuer as an [RDNSequence]. +/// Name : Name represents an X.509 distinguished name. This only includes the common elements of a DN. Note that Name is only an approximation of the X.509 structure. If an accurate representation is needed, asn1.Unmarshal the raw subject or issuer as an RDNSequence. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Name { #[serde(rename = "Country", skip_serializing_if = "Option::is_none")] @@ -30,7 +30,7 @@ pub struct Name { } impl Name { - /// Name represents an X.509 distinguished name. This only includes the common elements of a DN. Note that Name is only an approximation of the X.509 structure. If an accurate representation is needed, asn1.Unmarshal the raw subject or issuer as an [RDNSequence]. + /// Name represents an X.509 distinguished name. This only includes the common elements of a DN. Note that Name is only an approximation of the X.509 structure. If an accurate representation is needed, asn1.Unmarshal the raw subject or issuer as an RDNSequence. pub fn new() -> Name { Name { country: None, diff --git a/openapi/src/models/public_error.rs b/openapi/src/models/public_error.rs index 16a7257c..deda112d 100755 --- a/openapi/src/models/public_error.rs +++ b/openapi/src/models/public_error.rs @@ -15,7 +15,7 @@ use crate::models; pub struct PublicError { /// Extra Additional information about the error #[serde(rename = "extra", skip_serializing_if = "Option::is_none")] - pub extra: Option>, + pub extra: Option, /// Message A human readable message #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, diff --git a/openapi/src/models/query_stat.rs b/openapi/src/models/query_stat.rs index 2d549cac..1720bfeb 100755 --- a/openapi/src/models/query_stat.rs +++ b/openapi/src/models/query_stat.rs @@ -15,10 +15,10 @@ use crate::models; pub struct QueryStat { /// Map values to a display color NOTE: this interface is under development in the frontend... so simple map for now #[serde(rename = "color", skip_serializing_if = "Option::is_none")] - pub color: Option>, + pub color: Option, /// Panel Specific Values #[serde(rename = "custom", skip_serializing_if = "Option::is_none")] - pub custom: Option>, + pub custom: Option, #[serde(rename = "decimals", skip_serializing_if = "Option::is_none")] pub decimals: Option, /// Description is human readable field metadata diff --git a/openapi/src/models/recording_rule_json.rs b/openapi/src/models/recording_rule_json.rs index 593eb6d7..3d9eeb17 100755 --- a/openapi/src/models/recording_rule_json.rs +++ b/openapi/src/models/recording_rule_json.rs @@ -30,7 +30,7 @@ pub struct RecordingRuleJson { #[serde(rename = "prom_name", skip_serializing_if = "Option::is_none")] pub prom_name: Option, #[serde(rename = "queries", skip_serializing_if = "Option::is_none")] - pub queries: Option>>, + pub queries: Option>, #[serde(rename = "range", skip_serializing_if = "Option::is_none")] pub range: Option, #[serde(rename = "target_ref_id", skip_serializing_if = "Option::is_none")] diff --git a/openapi/src/models/unstructured.rs b/openapi/src/models/unstructured.rs index 5f655bc9..8aba0d3d 100755 --- a/openapi/src/models/unstructured.rs +++ b/openapi/src/models/unstructured.rs @@ -15,7 +15,7 @@ use crate::models; pub struct Unstructured { /// Object is a JSON compatible map with string, float, int, bool, []interface{}, or map[string]interface{} children. #[serde(rename = "Object", skip_serializing_if = "Option::is_none")] - pub object: Option>, + pub object: Option, } impl Unstructured { diff --git a/openapi/src/models/update_provider_settings_request.rs b/openapi/src/models/update_provider_settings_request.rs index 4ad59f1f..91ffc2b6 100755 --- a/openapi/src/models/update_provider_settings_request.rs +++ b/openapi/src/models/update_provider_settings_request.rs @@ -17,7 +17,7 @@ pub struct UpdateProviderSettingsRequest { #[serde(rename = "provider", skip_serializing_if = "Option::is_none")] pub provider: Option, #[serde(rename = "settings", skip_serializing_if = "Option::is_none")] - pub settings: Option>, + pub settings: Option, } impl UpdateProviderSettingsRequest { diff --git a/openapi/src/models/url.rs b/openapi/src/models/url.rs index f8879d6f..2ad8af25 100755 --- a/openapi/src/models/url.rs +++ b/openapi/src/models/url.rs @@ -10,7 +10,7 @@ use crate::models; -/// Url : The general form represented is: [scheme:][//[userinfo@]host][/]path[?query][#fragment] URLs that do not start with a slash after the scheme are interpreted as: scheme:opaque[?query][#fragment] The Host field contains the host and port subcomponents of the URL. When the port is present, it is separated from the host with a colon. When the host is an IPv6 address, it must be enclosed in square brackets: \"[fe80::1]:80\". The [net.JoinHostPort] function combines a host and port into a string suitable for the Host field, adding square brackets to the host when necessary. Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/. A consequence is that it is impossible to tell which slashes in the Path were slashes in the raw URL and which were %2f. This distinction is rarely important, but when it is, the code should use the [URL.EscapedPath] method, which preserves the original encoding of Path. The RawPath field is an optional field which is only set when the default encoding of Path is different from the escaped path. See the EscapedPath method for more details. URL's String method uses the EscapedPath method to obtain the path. +/// Url : The general form represented is: [scheme:][//[userinfo@]host][/]path[?query][#fragment] URLs that do not start with a slash after the scheme are interpreted as: scheme:opaque[?query][#fragment] Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/. A consequence is that it is impossible to tell which slashes in the Path were slashes in the raw URL and which were %2f. This distinction is rarely important, but when it is, the code should use the EscapedPath method, which preserves the original encoding of Path. The RawPath field is an optional field which is only set when the default encoding of Path is different from the escaped path. See the EscapedPath method for more details. URL's String method uses the EscapedPath method to obtain the path. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Url { #[serde(rename = "ForceQuery", skip_serializing_if = "Option::is_none")] @@ -33,13 +33,13 @@ pub struct Url { pub raw_query: Option, #[serde(rename = "Scheme", skip_serializing_if = "Option::is_none")] pub scheme: Option, - /// The Userinfo type is an immutable encapsulation of username and password details for a [URL]. An existing Userinfo value is guaranteed to have a username set (potentially empty, as allowed by RFC 2396), and optionally a password. + /// The Userinfo type is an immutable encapsulation of username and password details for a URL. An existing Userinfo value is guaranteed to have a username set (potentially empty, as allowed by RFC 2396), and optionally a password. #[serde(rename = "User", skip_serializing_if = "Option::is_none")] pub user: Option, } impl Url { - /// The general form represented is: [scheme:][//[userinfo@]host][/]path[?query][#fragment] URLs that do not start with a slash after the scheme are interpreted as: scheme:opaque[?query][#fragment] The Host field contains the host and port subcomponents of the URL. When the port is present, it is separated from the host with a colon. When the host is an IPv6 address, it must be enclosed in square brackets: \"[fe80::1]:80\". The [net.JoinHostPort] function combines a host and port into a string suitable for the Host field, adding square brackets to the host when necessary. Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/. A consequence is that it is impossible to tell which slashes in the Path were slashes in the raw URL and which were %2f. This distinction is rarely important, but when it is, the code should use the [URL.EscapedPath] method, which preserves the original encoding of Path. The RawPath field is an optional field which is only set when the default encoding of Path is different from the escaped path. See the EscapedPath method for more details. URL's String method uses the EscapedPath method to obtain the path. + /// The general form represented is: [scheme:][//[userinfo@]host][/]path[?query][#fragment] URLs that do not start with a slash after the scheme are interpreted as: scheme:opaque[?query][#fragment] Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/. A consequence is that it is impossible to tell which slashes in the Path were slashes in the raw URL and which were %2f. This distinction is rarely important, but when it is, the code should use the EscapedPath method, which preserves the original encoding of Path. The RawPath field is an optional field which is only set when the default encoding of Path is different from the escaped path. See the EscapedPath method for more details. URL's String method uses the EscapedPath method to obtain the path. pub fn new() -> Url { Url { force_query: None, diff --git a/server/Cargo.toml b/server/Cargo.toml index 997132df..c0bd8c36 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -database = { path = "../database"} -openapi = { path = "../openapi"} +database = { path = "../database" } +openapi = { path = "../openapi" } serde = { workspace = true } tokio = { workspace = true } @@ -39,6 +39,7 @@ addr = { workspace = true } hickory-resolver = { workspace = true } webauthn-rs = { workspace = true } sha256 = { workspace = true } +configparser = { workspace = true } [features] -cloud_integration_tests = [] \ No newline at end of file +cloud_integration_tests = [] diff --git a/server/bindings/CloudApiErrors.ts b/server/bindings/CloudApiErrors.ts index 09aa1d84..3b03285e 100644 --- a/server/bindings/CloudApiErrors.ts +++ b/server/bindings/CloudApiErrors.ts @@ -1,53 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type CloudApiErrors = - | 'TeamDoesNotExist' - | 'UserDoesNotExist' - | 'CloudFeatureDisabled' - | 'InsufficientPermissions' - | 'TeamHasNoRegisteredApps' - | 'DatabaseError' - | 'MaximumUsersPerTeamReached' - | 'UserAlreadyBelongsToTheTeam' - | 'IncorrectPassword' - | 'AccessTokenFailure' - | 'RefreshTokenFailure' - | 'AppAlreadyExists' - | 'MaximumAppsPerTeamReached' - | 'TeamAlreadyExists' - | 'PersonalTeamAlreadyExists' - | 'EmailAlreadyExists' - | 'InternalServerError' - | 'UserDoesNotBelongsToTheTeam' - | 'InvalidName' - | 'UnauthorizedOriginError' - | 'AppDoesNotExist' - | 'UserAlreadyInvitedToTheTeam' - | 'MaximumInvitesPerTeamReached' - | 'InviteNotFound' - | 'ActionForbiddenForPersonalTeam' - | 'InviteDoesNotExist' - | 'InvalidPaginationCursor' - | 'InvalidOrExpiredVerificationCode' - | 'InvalidOrExpiredAuthCode' - | 'InvalidDomainName' - | 'DomainAlreadyVerified' - | 'DomainVerificationFailure' - | 'DomainNotFound' - | 'DomainVerificationNotStarted' - | 'DomainAlreadyVerifiedByAnotherApp' - | 'NoPendingDomainVerification' - | 'WebAuthnError' - | 'PasswordNotSet' - | 'UserDoesNotHavePasskey' - | 'PasskeyAlreadyExists' - | 'InvalidPasskeyCredential' - | 'PasskeyDoesNotExist' - | 'FailedToCreateTeam' - | 'DashboardImportFail' - | 'OriginHeaderRequired' - | 'InvalidOrigin' - | 'InvalidAction' - | 'AdminCannotLeaveTeam' - | 'GrafanaError' - | 'TeamWithoutGrafanaId' +export type CloudApiErrors = "TeamDoesNotExist" | "UserDoesNotExist" | "CloudFeatureDisabled" | "InsufficientPermissions" | "TeamHasNoRegisteredApps" | "DatabaseError" | "MaximumUsersPerTeamReached" | "UserAlreadyBelongsToTheTeam" | "IncorrectPassword" | "AccessTokenFailure" | "RefreshTokenFailure" | "AppAlreadyExists" | "MaximumAppsPerTeamReached" | "TeamAlreadyExists" | "PersonalTeamAlreadyExists" | "EmailAlreadyExists" | "InternalServerError" | "UserDoesNotBelongsToTheTeam" | "InvalidName" | "UnauthorizedOriginError" | "AppDoesNotExist" | "UserAlreadyInvitedToTheTeam" | "MaximumInvitesPerTeamReached" | "InviteNotFound" | "ActionForbiddenForPersonalTeam" | "InviteDoesNotExist" | "InvalidPaginationCursor" | "InvalidOrExpiredVerificationCode" | "InvalidOrExpiredAuthCode" | "InvalidDomainName" | "DomainAlreadyVerified" | "DomainVerificationFailure" | "DomainNotFound" | "DomainVerificationNotStarted" | "DomainAlreadyVerifiedByAnotherApp" | "NoPendingDomainVerification" | "WebAuthnError" | "PasswordNotSet" | "UserDoesNotHavePasskey" | "PasskeyAlreadyExists" | "InvalidPasskeyCredential" | "PasskeyDoesNotExist" | "FailedToCreateTeam" | "DashboardImportFail" | "OriginHeaderRequired" | "InvalidOrigin" | "InvalidAction" | "AdminCannotLeaveTeam" | "GrafanaError" | "TeamWithoutGrafanaId" | "UserDoesNotExistInGrafana"; \ No newline at end of file diff --git a/server/bindings/HttpCloudEndpoint.ts b/server/bindings/HttpCloudEndpoint.ts index 26ee84a8..40e75cb7 100644 --- a/server/bindings/HttpCloudEndpoint.ts +++ b/server/bindings/HttpCloudEndpoint.ts @@ -1,46 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type HttpCloudEndpoint = - | '/register_new_app' - | '/register_with_password_start' - | '/register_with_password_finish' - | '/login_with_password' - | '/login_with_google' - | '/refresh_token' - | '/register_new_team' - | '/remove_user_from_team' - | '/get_user_joined_teams' - | '/events' - | '/invite_user_to_team' - | '/accept_team_invite' - | '/get_team_user_invites' - | '/get_user_team_invites' - | '/cancel_team_user_invite' - | '/cancel_user_team_invite' - | '/get_app_events' - | '/reset_password_start' - | '/reset_password_finish' - | '/verify_domain_start' - | '/verify_domain_finish' - | '/remove_whitelisted_domain' - | '/cancel_pending_domain_verification' - | '/register_with_passkey_start' - | '/register_with_passkey_finish' - | '/reset_passkey_start' - | '/reset_passkey_finish' - | '/get_passkey_challenge' - | '/delete_passkey' - | '/add_passkey_start' - | '/add_passkey_finish' - | '/get_user_metadata' - | '/get_team_metadata' - | '/get_team_users_privileges' - | '/change_user_privileges' - | '/login_with_passkey_start' - | '/login_with_passkey_finish' - | '/verify_code' - | '/leave_team' - | '/delete_app' - | '/delete_team' - | '/delete_account_start' - | '/delete_account_finish' +export type HttpCloudEndpoint = "/register_new_app" | "/register_with_password_start" | "/register_with_password_finish" | "/login_with_password" | "/login_with_google" | "/refresh_token" | "/register_new_team" | "/remove_user_from_team" | "/get_user_joined_teams" | "/events" | "/invite_user_to_team" | "/accept_team_invite" | "/get_team_user_invites" | "/get_user_team_invites" | "/cancel_team_user_invite" | "/cancel_user_team_invite" | "/get_app_events" | "/reset_password_start" | "/reset_password_finish" | "/verify_domain_start" | "/verify_domain_finish" | "/remove_whitelisted_domain" | "/cancel_pending_domain_verification" | "/register_with_passkey_start" | "/register_with_passkey_finish" | "/reset_passkey_start" | "/reset_passkey_finish" | "/get_passkey_challenge" | "/delete_passkey" | "/add_passkey_start" | "/add_passkey_finish" | "/get_user_metadata" | "/get_team_metadata" | "/get_team_users_privileges" | "/change_user_privileges" | "/login_with_passkey_start" | "/login_with_passkey_finish" | "/verify_code" | "/leave_team" | "/delete_app" | "/delete_team" | "/delete_account_start" | "/delete_account_finish"; \ No newline at end of file diff --git a/server/bindings/HttpDeleteAccountFinishRequest.ts b/server/bindings/HttpDeleteAccountFinishRequest.ts index 415d900f..85fc78d5 100644 --- a/server/bindings/HttpDeleteAccountFinishRequest.ts +++ b/server/bindings/HttpDeleteAccountFinishRequest.ts @@ -1,5 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface HttpDeleteAccountFinishRequest { - authCode: string -} +export interface HttpDeleteAccountFinishRequest { authCode: string, } \ No newline at end of file diff --git a/server/bindings/HttpDeleteAccountStartRequest.ts b/server/bindings/HttpDeleteAccountStartRequest.ts index f6bfabe2..a68a3d1e 100644 --- a/server/bindings/HttpDeleteAccountStartRequest.ts +++ b/server/bindings/HttpDeleteAccountStartRequest.ts @@ -1,6 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export interface HttpDeleteAccountStartRequest { - device: string - browser: string -} +export interface HttpDeleteAccountStartRequest { device: string, browser: string, } \ No newline at end of file diff --git a/server/bindings/VerificationAction.ts b/server/bindings/VerificationAction.ts index aa133d19..d3440245 100644 --- a/server/bindings/VerificationAction.ts +++ b/server/bindings/VerificationAction.ts @@ -1,8 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type VerificationAction = - | 'registerPassword' - | 'registerPasskey' - | 'resetPassword' - | 'resetPasskey' - | 'deleteAccount' +export type VerificationAction = "registerPassword" | "registerPasskey" | "resetPassword" | "resetPasskey" | "deleteAccount"; \ No newline at end of file diff --git a/server/src/auth/auth_token.rs b/server/src/auth/auth_token.rs index 082ef34e..92f0b9e4 100644 --- a/server/src/auth/auth_token.rs +++ b/server/src/auth/auth_token.rs @@ -1,3 +1,5 @@ +use crate::env::NONCE; + use super::auth_token_type::AuthTokenType; use chrono::{Duration, Utc}; use jsonwebtoken::{decode, encode, Algorithm, DecodingKey, EncodingKey, Header, Validation}; @@ -10,12 +12,13 @@ pub struct AuthToken { pub user_id: String, pub ip: Option, pub token_type: AuthTokenType, - pub sub: String, + pub sub: String, // user email + pub nonce: String, pub exp: u64, // Required (validate_exp defaults to true in validation). Expiration time (as UTC timestamp) } impl AuthToken { - pub fn new_access(user_id: &String, ip: Option) -> Self { + pub fn new_access(user_id: &String, email: &String, ip: Option) -> Self { AuthToken { id: uuid7::uuid7().to_string(), user_id: user_id.clone(), @@ -24,11 +27,12 @@ impl AuthToken { None => None, }, token_type: AuthTokenType::Access, - sub: user_id.clone(), + sub: email.clone(), + nonce: NONCE().to_string(), exp: (Utc::now() + Duration::minutes(30)).timestamp() as u64, // Token expires in 30 minutes } } - pub fn new_refresh(user_id: &String, ip: Option) -> Self { + pub fn new_refresh(user_id: &String, email: &String, ip: Option) -> Self { AuthToken { id: uuid7::uuid7().to_string(), user_id: user_id.clone(), @@ -37,7 +41,8 @@ impl AuthToken { None => None, }, token_type: AuthTokenType::Refresh, - sub: user_id.clone(), + sub: email.clone(), + nonce: NONCE().to_string(), exp: (Utc::now() + Duration::minutes(60 * 7 * 24)).timestamp() as u64, // Token expires in 7 days } } @@ -82,7 +87,7 @@ mod tests { fn test_auth_token_new() { // Test the `new` method to create a new `AuthToken` instance. let ip = SocketAddr::from(([123, 233, 3, 21], 8080)); - let auth_token = AuthToken::new_access(&"1".to_string(), Some(ip)); + let auth_token = AuthToken::new_access(&"1".to_string(), &"1".to_string(), Some(ip)); // Check that the `user_id` and `exp` fields are set correctly. assert_eq!(auth_token.user_id, "1".to_string()); assert_eq!(auth_token.ip.unwrap(), ip.ip()); @@ -93,7 +98,7 @@ mod tests { fn test_auth_token_encode() { // Test the `encode` method to generate a JWT from an `AuthToken` instance. let ip = SocketAddr::from(([123, 233, 3, 21], 8080)); - let auth_token = AuthToken::new_access(&"1".to_string(), Some(ip)); + let auth_token = AuthToken::new_access(&"1".to_string(), &"test".to_string(), Some(ip)); let token = auth_token.encode(JWT_SECRET()).unwrap(); // Check that the JWT is a non-empty string. @@ -104,7 +109,7 @@ mod tests { fn test_auth_token_decode() { // Test the `decode` method to parse a JWT and create an `AuthToken` instance. let ip = SocketAddr::from(([123, 233, 3, 21], 8080)); - let auth_token = AuthToken::new_access(&"1".to_string(), Some(ip)); + let auth_token = AuthToken::new_access(&"1".to_string(), &"1".to_string(), Some(ip)); let token = auth_token.encode(JWT_SECRET()).unwrap(); let decoded_auth_token = AuthToken::decode(&token, JWT_PUBLIC_KEY(), ip).unwrap(); @@ -131,7 +136,7 @@ mod tests { fn test_auth_token_decode_incorrect_secret() { // Test the `decode` method with the incorrect public key. let ip = SocketAddr::from(([123, 233, 3, 21], 8080)); - let auth_token = AuthToken::new_access(&"1".to_string(), Some(ip)); + let auth_token = AuthToken::new_access(&"1".to_string(), &"1".to_string(), Some(ip)); let incorrect_public_key = "-----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzlUYIpqSUAyLJaf8ZUef 06YBh5DcmaTrwGcVwC57VtywY7bHXQUtGooULQjiYgnyOPxHDt2W+gQW1axiMxOQ @@ -169,6 +174,7 @@ mod tests { user_id: user_id.clone(), exp, ip: Some(ip.ip()), + nonce: "NONCE".to_string(), token_type: AuthTokenType::Access, sub: user_id, }; @@ -183,7 +189,7 @@ mod tests { fn test_decode_different_ip() { // Test the `decode` method with an expired JWT. let ip = SocketAddr::from(([123, 233, 3, 21], 8080)); - let auth_token = AuthToken::new_access(&"1".to_string(), Some(ip)); + let auth_token = AuthToken::new_access(&"1".to_string(), &"1".to_string(), Some(ip)); let token = auth_token.encode(JWT_SECRET()).unwrap(); let different_ip = SocketAddr::from(([2, 133, 3, 21], 8080)); diff --git a/server/src/env.rs b/server/src/env.rs index 852b9f4c..2c7b16c3 100644 --- a/server/src/env.rs +++ b/server/src/env.rs @@ -1,6 +1,7 @@ #![allow(non_snake_case)] +use configparser::ini::Ini; use once_cell::sync::OnceCell; -use rand::{distributions::Alphanumeric, thread_rng, Rng}; +use std::fs; #[derive(Debug)] pub struct ENV { @@ -26,25 +27,30 @@ pub fn get_env() -> &'static ENV { let ENVIRONMENT = std::env::var("ENV").expect("Failed to get ENV env"); let ENVIRONMENT = ENVIRONMENT.as_str(); + // Read JWT keys from files + let jwt_secret = fs::read_to_string("../jwt_keys/grafana.key") + .expect("Failed to read JWT private key file"); + let jwt_public = fs::read_to_string("../jwt_keys/grafana.key.pub") + .expect("Failed to read JWT public key file"); + + // Parse grafana.ini + let mut config = Ini::new(); + config + .load("../grafana/grafana.ini") + .expect("Failed to load grafana.ini"); + + // Read admin credentials from grafana.ini + let admin_user = config + .get("security", "admin_user") + .expect("Failed to get admin_user from grafana.ini"); + let admin_password = config + .get("security", "admin_password") + .expect("Failed to get admin_password from grafana.ini"); + let env = ENV { ENVIRONMENT: ENVIRONMENT.to_owned(), - JWT_SECRET: { - let rand_string: String = thread_rng() - .sample_iter(&Alphanumeric) - .take(6) - .map(char::from) - .collect(); - std::env::var("JWT_SECRET").expect("JWT_SECRET env not set") + rand_string.as_str() - }, - JWT_PUBLIC_KEY: { - let rand_string: String = thread_rng() - .sample_iter(&Alphanumeric) - .take(6) - .map(char::from) - .collect(); - std::env::var("JWT_PUBLIC_KEY").expect("JWT_PUBLIC_KEY env not set") - + rand_string.as_str() - }, + JWT_SECRET: jwt_secret, + JWT_PUBLIC_KEY: jwt_public, ONLY_RELAY_SERVICE: std::env::var("ONLY_RELAY_SERVICE") .expect("Failed to get ONLY_RELAY_SERVICE env") .eq_ignore_ascii_case("true"), @@ -57,10 +63,8 @@ pub fn get_env() -> &'static ENV { .expect("Failed to get DATABASE_ADDRESS env"), GRAFANA_BASE_PATH: std::env::var("GRAFANA_BASE_PATH") .expect("Failed to get GRAFANA_BASE_PATH env"), - GF_SECURITY_ADMIN_USER: std::env::var("GF_SECURITY_ADMIN_USER") - .expect("Failed to get GF_SECURITY_ADMIN_USER env"), - GF_SECURITY_ADMIN_PASSWORD: std::env::var("GF_SECURITY_ADMIN_PASSWORD") - .expect("Failed to get GF_SECURITY_ADMIN_PASSWORD env"), + GF_SECURITY_ADMIN_USER: admin_user, + GF_SECURITY_ADMIN_PASSWORD: admin_password, MAILER_ACTIVE: std::env::var("MAILER_ACTIVE") .expect("Failed to get MAILER_ACTIVE env") .eq_ignore_ascii_case("true"), diff --git a/server/src/http/cloud/change_user_privileges.rs b/server/src/http/cloud/change_user_privileges.rs index 0613c6a9..71e2202a 100644 --- a/server/src/http/cloud/change_user_privileges.rs +++ b/server/src/http/cloud/change_user_privileges.rs @@ -338,6 +338,7 @@ mod tests { use std::net::SocketAddr; use tower::ServiceExt; + #[ignore = "Not used for now"] #[tokio::test] async fn test_change_privileges() { let test_app = create_test_app(false).await; diff --git a/server/src/http/cloud/invite_user_to_team.rs b/server/src/http/cloud/invite_user_to_team.rs index 7c7c0019..1ee22d61 100644 --- a/server/src/http/cloud/invite_user_to_team.rs +++ b/server/src/http/cloud/invite_user_to_team.rs @@ -256,6 +256,7 @@ mod tests { }; use std::net::SocketAddr; use tower::ServiceExt; + use uuid7::uuid7; #[tokio::test] async fn test_invite_user_to_team() { @@ -354,9 +355,11 @@ mod tests { let (auth_token, _email, _password) = register_and_login_random_user(&test_app).await; + let team_id = uuid7().to_string(); + // Team does not exist let resp = invite_user_to_test_team( - &i64::MAX.to_string(), + &team_id, &"test_user_email@gmail.com".to_string(), &auth_token, &test_app, diff --git a/server/src/http/cloud/login/login_with_google.rs b/server/src/http/cloud/login/login_with_google.rs index 560a7837..ad9566f0 100644 --- a/server/src/http/cloud/login/login_with_google.rs +++ b/server/src/http/cloud/login/login_with_google.rs @@ -69,7 +69,7 @@ pub async fn login_with_google( match db.get_user_by_email(&request.email).await { Ok(Some(user)) => { let (auth_token, refresh_token) = - generate_tokens(request.enforce_ip, ip, &user.user_id)?; + generate_tokens(request.enforce_ip, ip, &user.user_id, &request.email)?; return Ok(Json(HttpLoginWithGoogleResponse { user_id: user.user_id, @@ -114,7 +114,8 @@ pub async fn login_with_google( } // Generate tokens - let (auth_token, refresh_token) = generate_tokens(request.enforce_ip, ip, &user_id)?; + let (auth_token, refresh_token) = + generate_tokens(request.enforce_ip, ip, &user_id, &request.email)?; return Ok(Json(HttpLoginWithGoogleResponse { user_id: user_id, diff --git a/server/src/http/cloud/login/login_with_passkey_finish.rs b/server/src/http/cloud/login/login_with_passkey_finish.rs index 6f17c586..f5edaf1d 100644 --- a/server/src/http/cloud/login/login_with_passkey_finish.rs +++ b/server/src/http/cloud/login/login_with_passkey_finish.rs @@ -97,7 +97,8 @@ pub async fn login_with_passkey_finish( }; // Generate tokens - let (auth_token, refresh_token) = generate_tokens(request.enforce_ip, ip, &user.user_id)?; + let (auth_token, refresh_token) = + generate_tokens(request.enforce_ip, ip, &user.user_id, &user.email)?; return Ok(Json(HttpLoginWithPasskeyFinishResponse { auth_token, diff --git a/server/src/http/cloud/login/login_with_password.rs b/server/src/http/cloud/login/login_with_password.rs index 0a2af1b2..47c819a8 100644 --- a/server/src/http/cloud/login/login_with_password.rs +++ b/server/src/http/cloud/login/login_with_password.rs @@ -62,8 +62,7 @@ pub async fn login_with_password( )); } }; - println!("useeeeeeeeeeeeeeeeeeeeeeeeer"); - println!("{:?}", user); + // Check if user has password let password_hash = match user.password_hash { Some(password_hash) => password_hash, @@ -84,7 +83,8 @@ pub async fn login_with_password( } // Generate tokens - let (auth_token, refresh_token) = generate_tokens(request.enforce_ip, ip, &user.user_id)?; + let (auth_token, refresh_token) = + generate_tokens(request.enforce_ip, ip, &user.user_id, &user.email)?; return Ok(Json(HttpLoginResponse { auth_token, diff --git a/server/src/http/cloud/register/register_with_passkey_finish.rs b/server/src/http/cloud/register/register_with_passkey_finish.rs index c2c8b21c..f7700911 100644 --- a/server/src/http/cloud/register/register_with_passkey_finish.rs +++ b/server/src/http/cloud/register/register_with_passkey_finish.rs @@ -110,7 +110,8 @@ pub async fn register_with_passkey_finish( { Ok(_) => { // Generate tokens - let (auth_token, refresh_token) = generate_tokens(request.enforce_ip, ip, &user_id)?; + let (auth_token, refresh_token) = + generate_tokens(request.enforce_ip, ip, &user_id, &request.email)?; return Ok(Json(HttpRegisterWithPasskeyFinishResponse { auth_token, refresh_token, diff --git a/server/src/http/cloud/remove_user_from_team.rs b/server/src/http/cloud/remove_user_from_team.rs index 77170918..e66356c5 100644 --- a/server/src/http/cloud/remove_user_from_team.rs +++ b/server/src/http/cloud/remove_user_from_team.rs @@ -216,6 +216,7 @@ mod tests { }; use std::net::SocketAddr; use tower::ServiceExt; + use uuid7::uuid7; #[tokio::test] async fn test_remove_user_from_team() { @@ -320,9 +321,11 @@ mod tests { let (auth_token, _email, _password) = register_and_login_random_user(&test_app).await; + let team_id = uuid7().to_string(); + // Team does not exist let resp = remove_user_from_test_team( - &i64::MAX.to_string(), + &team_id, &"test_user_email@gmail.com".to_string(), &auth_token, &test_app, diff --git a/server/src/http/cloud/utils.rs b/server/src/http/cloud/utils.rs index 04c0d6b7..b8afeb01 100644 --- a/server/src/http/cloud/utils.rs +++ b/server/src/http/cloud/utils.rs @@ -241,12 +241,13 @@ pub fn generate_tokens( enforce_ip: bool, ip: SocketAddr, user_id: &String, + user_email: &String, // (Auth Token, Refresh Token) ) -> Result<(String, String), (StatusCode, String)> { // Generate tokens let ip = if enforce_ip { Some(ip) } else { None }; // Access token - let token = match AuthToken::new_access(&user_id, ip).encode(JWT_SECRET()) { + let token = match AuthToken::new_access(&user_id, &user_email, ip).encode(JWT_SECRET()) { Ok(token) => token, Err(err) => { error!("Failed to create access token: {:?}", err); @@ -257,7 +258,8 @@ pub fn generate_tokens( } }; // Refresh token - let refresh_token = match AuthToken::new_refresh(&user_id, ip).encode(JWT_SECRET()) { + let refresh_token = match AuthToken::new_refresh(&user_id, &user_email, ip).encode(JWT_SECRET()) + { Ok(token) => token, Err(err) => { error!("Failed to create refresh token: {:?}", err); @@ -275,7 +277,8 @@ pub fn refresh_auth_token( refresh_token: AuthToken, ip: Option, ) -> Result { - match AuthToken::new_access(&refresh_token.user_id, ip).encode(JWT_SECRET()) { + match AuthToken::new_access(&refresh_token.user_id, &refresh_token.sub, ip).encode(JWT_SECRET()) + { Ok(token) => return Ok(token), Err(err) => { error!("Failed to create access token: {:?}", err); diff --git a/server/src/middlewares/auth_middleware.rs b/server/src/middlewares/auth_middleware.rs index 78ce412e..855871c3 100644 --- a/server/src/middlewares/auth_middleware.rs +++ b/server/src/middlewares/auth_middleware.rs @@ -1,5 +1,5 @@ use crate::auth::{auth_token_type::AuthTokenType, AuthToken}; -use crate::env::JWT_PUBLIC_KEY; +use crate::env::{JWT_PUBLIC_KEY, NONCE}; use axum::{ extract::{ConnectInfo, Request}, http::{HeaderMap, StatusCode}, @@ -39,6 +39,12 @@ pub async fn access_auth_middleware( } None => return Err((StatusCode::UNAUTHORIZED, "No auth token".to_string())), }; + + // Check if nonce is the same + if auth_token.nonce != NONCE() { + return Err((StatusCode::UNAUTHORIZED, "Expired token".to_string())); + } + // Insert the user_id into the request extensions req.extensions_mut() .insert(auth_token.user_id.clone() as UserId);