ovh queries for cloud and webstorage cdn
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152
diff --git a/lib/ovh/v1/cloud/cloudstorage/query.ex b/lib/ovh/v1/cloud/cloudstorage/query.ex
index ba0c579..ff07586 100644
--- a/lib/ovh/v1/cloud/cloudstorage/query.ex
+++ b/lib/ovh/v1/cloud/cloudstorage/query.ex
@@ -1,53 +1,43 @@
defmodule ExOvh.Ovh.V1.Cloud.Cloudstorage.Query do
@moduledoc ~s"""
- Helper functions for building `queries directed at the `/cloud` part of the custom ovh api and for cloudstorage in particular.
- See `ExOvh.Ovh.V1.Cloud.Query` for generic cloud requests.
-
-
- ## Notes
+ Helper functions for building queries directed at the cloudstorage related parts of the `/cloud` requests.
- Coverage for the following ovh api requests:
-
-
- | Function | OVH API call |
- |---|---|
- | get_containers(service_name) | GET /cloud/project/{serviceName}/storage Get storage containers |
- | create_container(service_name, container_name, region \\ "SBG1") | POST /cloud/project/{serviceName}/storage Create container |
- | | |
- | | |
- | | |
- | | |
- | | |
- | | |
- | | |
+ See `ExOvh.Ovh.V1.Cloud.Query` for generic cloud requests.
+ ## Functions Summary
-# GET /cloud/project/{serviceName}/storage/access Access to storage API
-# GET /cloud/project/{serviceName}/storage/{containerId} Get storage container
-# DELETE /cloud/project/{serviceName}/storage/{containerId} Delete container
-# POST /cloud/project/{serviceName}/storage/{containerId}/cors Add CORS support on your container
-# POST /cloud/project/{serviceName}/storage/{containerId}/static Deploy your container files as a static web site
-# POST /cloud/project/{serviceName}/terminate
+ | Function | Description | OVH API call |
+ |---|---|---|
+ | `get_containers/1` | <small>Get containers for a given swift tenant id (project id or ovh service name)</small> | <sub><sup>GET /cloud/project/{serviceName}/storage </sup></sub> |
+ | `create_container/3` | <small>Create a container for a given tenant_id (ovh service_name), a container and a region.</small> | <sub><sup>POST /cloud/project/{serviceName}/storage</sup></sub> |
+ | `get_access/1` | <small>Get access details for the Swift API for a given swift tenant_id (ovh service_name)</small> | <sub><sup>GET /cloud/project/{serviceName}/storage/access</sup></sub> |
+ | `container_info/2` | <small>Gets details about a container such as objects, size, region, public or not, static_url, name, ...</small> | <sub><sup>GET /cloud/project/{serviceName}/storage/{containerId}</sup></sub> |
+ | `delete_container/2` | <small>Deletes a given container.</small> | <sub><sup>DELETE /cloud/project/{serviceName}/storage/{containerId}</sup></sub> |
+ | `modify_container_cors/3` | <small>Modify the CORS settings for a container. See [swift docs](http://docs.openstack.org/developer/swift/cors.html)</small> | <sub><sup>POST /cloud/project/{serviceName}/storage/{containerId}/cors Add CORS support on your container</sup></sub> |
+ | `deploy_container_as_static_website/2` | <small>Deploy the container files as a static web site.</small> | <sub><sup>POST /cloud/project/{serviceName}/storage/{containerId}/static</sup></sub> |
## Example
- ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.get_containers(service_name) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.get_containers(service_name) |> ExOvh.Ovh.request!()
"""
alias ExOvh.Ovh.Query
@doc ~s"""
- GET /cloud/project/{serviceName}/storage Get storage containers
+ Get storage containers
- ## Arguments
+ ## Api call
- - service_name: service name for the ovh cloud service
+ GET /cloud/project/{serviceName}/storage
+ ## Arguments
+
+ - `service_name`: service name for the ovh cloud service
## Example
- ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.get_containers(service_name) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.get_containers(service_name) |> ExOvh.Ovh.request!()
"""
@spec get_containers(String.t) :: Query.t
def get_containers(service_name) do
@@ -60,19 +50,23 @@ defmodule ExOvh.Ovh.V1.Cloud.Cloudstorage.Query do
@doc ~s"""
- POST /cloud/project/{serviceName}/storage Create container
+ Create container
+
+ ## Api call
+
+ POST /cloud/project/{serviceName}/storage
## Arguments
- - service_name: service name for the ovh cloud service
- - container_name: name for the new container
- - region: region for the new container, defaults to "SBG1". See regions by running:
+ - `service_name`: service name for the ovh cloud service
+ - `container_name`: name for the new container
+ - `region`: region for the new container, defaults to "SBG1". See regions by running:
Currently can choose from "GRA1", "BHS1", "SBG1".
## Example
- ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.create_container(service_name, "test_container") |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.create_container(service_name, "test_container") |> ExOvh.Ovh.request!()
"""
@spec create_container(String.t, String.t, String.t) :: Query.t
def create_container(service_name, container_name, region \\ "SBG1") do
@@ -88,5 +82,184 @@ defmodule ExOvh.Ovh.V1.Cloud.Cloudstorage.Query do
end
+ @doc ~s"""
+ Gets the x_auth_token and the swift endpoints for a given tenant_id (ovh service_name). A different endpoint is returned
+ depending on the region. Examples of regions include "BHS1", "SBG1", "GRA1". With these details, requests can be made through
+ the Swift api.
+
+ ## Api call
+
+ GET /cloud/project/{serviceName}/storage/access
+
+ ## Arguments
+
+ - `service_name`: service name for the ovh cloud service
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.get_access(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec get_access(String.t) :: Query.t
+ def get_access(service_name) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/storage/access",
+ params: :nil
+ }
+ end
+
+
+
+ @doc ~s"""
+ Gets the details for a given container.
+
+ Returns information such as a list of objects in the container, size of the container, whether the container is public
+ or not, the region of the container, the name of the container, the number of stored objects for the container and the
+ static url for the container.
+
+ ## Api call
+
+ GET /cloud/project/{serviceName}/storage/{containerId}
+
+ ## Arguments
+
+ - `service_name`: service name for the ovh cloud service
+ - `container_id`: container_id for a given container. *Note*: this is not the same as the container_name.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.container_info(service_name, container_id) |> ExOvh.Ovh.request!()
+ """
+ @spec container_info(String.t, String.t) :: Query.t
+ def container_info(service_name, container_id) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/storage/#{container_id}",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Deletes a given container.
+
+ *Note:* container_d is not the same as container_name.
+
+ ## Api call
+
+ DELETE /cloud/project/{serviceName}/storage/{containerId}
+
+ ## Arguments
+
+ - `service_name`: service name for the ovh cloud service
+ - `container_id`: container_id for a given container. *Note*: this is not the same as the container_name.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.delete_container(service_name, container_id) |> ExOvh.Ovh.request!()
+ """
+ @spec delete_container(String.t, String.t) :: Query.t
+ def delete_container(service_name, container_id) do
+ %Query{
+ method: :delete,
+ uri: "/cloud/project/#{service_name}/storage/#{container_id}",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Modify CORS settings for a container.
+
+ Modifies the container metadata such that cross origin requests can be permitted.
+ See [CORS section of swift docs](http://docs.openstack.org/developer/swift/cors.html) for more info. Ans see here for more
+ on [CORS in general](http://enable-cors.org/resources.html)
+
+ | Metadata | Use |
+ | --- | --- |
+ | X-Container-Meta-Access-Control-Allow-Origin | Origins to be allowed to make Cross Origin Requests, space separated. |
+
+
+ *Note:* container_d is not the same as container_name.
+
+ ## Api call
+
+ DELETE /cloud/project/{serviceName}/storage/{containerId}
+
+ ## Arguments
+
+ - `service_name`: service name for the ovh cloud service
+ - `container_id`: container_id for a given container. *Note*: this is not the same as the container_name.
+ - `origin`: an origin that may make cross origin requests to the container. Defaults to `{}` (none) if left absent.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.modify_container_cors(service_name, container_id, "http://localhost:4001/") |> ExOvh.Ovh.prepare_request() |> Og.log_return() |> ExOvh.Ovh.request!()
+
+ ## Notes
+
+ To get a full overview of the container details with all metadata, the Swift client should be used. To see the changes, try running the following
+ command for the `container_name` associated with this `container_id`. In fact, the OVH functions are not really required, most changes can be made directly
+ using queries sent via the `Swift.Cloudstorage` client.
+
+ account = ExOvh.Swift.Cloudstorage.account()
+ container = "test_container"
+ Openstex.Swift.V1.Query.container_info(container, account) |> ExOvh.Swift.Cloudstorage.request!() |> Map.get(:headers) |> Map.get("X-Container-Meta-Access-Control-Allow-Origin")
+ """
+ @spec modify_container_cors(String.t, String.t, String.t) :: Query.t
+ def modify_container_cors(service_name, container_id, origin \\ {}) do
+ %Query{
+ method: :post,
+ uri: "/cloud/project/#{service_name}/storage/#{container_id}/cors",
+ params: %{
+ "origin" => origin
+ } |> Poison.encode!()
+ }
+ end
+
+
+
+ @doc ~s"""
+ Deploy a container as a static website.
+
+ Modifies the ACL settings for a container on the "X-Container-Read" header and also other container metadata.
+ See [swift auth docs](http://docs.openstack.org/developer/swift/overview_auth.html),
+ [swift acl middleware](http://docs.openstack.org/developer/swift/misc.html#module-swift.common.middleware.acl)
+ and [swift account middleware](http://docs.openstack.org/developer/swift/middleware.html#module-swift.common.middleware.tempauth)
+ for more information.
+
+ ## Api call
+
+ POST /cloud/project/{serviceName}/storage/{containerId}/static
+
+ ## Arguments
+
+ - `service_name`: service name for the ovh cloud service
+ - `container_id`: container_id for a given container. *Note*: this is not the same as the container_name.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.modify_container_cors(service_name, container_id, "http://localhost:4001/") |> ExOvh.Ovh.prepare_request() |> Og.log_return() |> ExOvh.Ovh.request!()
+
+ ## Notes
+
+ To get a full overview of the container details with all metadata, the Swift client should be used. To see the changes, try running the following
+ command for the `container_name` associated with this `container_id`. In fact, the OVH functions are not really required, most changes can be made directly
+ using queries sent via the `Swift.Cloudstorage` client.
+
+ account = ExOvh.Swift.Cloudstorage.account()
+ container = "test_container"
+ Openstex.Swift.V1.Query.container_info(container, account) |> ExOvh.Swift.Cloudstorage.request!() |> Map.get(:headers)
+ """
+ @spec deploy_container_as_static_website(String.t, String.t) :: Query.t
+ def deploy_container_as_static_website(service_name, container_id) do
+ %Query{
+ method: :post,
+ uri: "/cloud/project/#{service_name}/storage/#{container_id}/static",
+ params: :nil
+ }
+ end
+
+
end
diff --git a/lib/ovh/v1/cloud/query.ex b/lib/ovh/v1/cloud/query.ex
index c7595ba..828d6d2 100644
--- a/lib/ovh/v1/cloud/query.ex
+++ b/lib/ovh/v1/cloud/query.ex
@@ -2,49 +2,60 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@moduledoc ~s"""
Helper functions for building queries directed at the `/cloud` part of the ovh api.
- ## Notes
+ ## Functions Summary
| Function | Description | OVH API call |
|---|---|---|
- | `list_services/0` | <small>List available services</small> | <sub><sup>GET /cloud/project</sup></sub> |
+ | `list_services/0` | <small>List available services or list available cloud projects. A returned project id in OVH terms is similar to a tenant id in swift terms</small> | <sub><sup>GET /cloud/project</sup></sub> |
| `get_users/1` | <small>Get all users</small> | <sub><sup>GET /cloud/project/{serviceName}/user</sup></sub> |
- | `create_user/2` | <small>Create user</small> | <sub><sup>POST /cloud/project/{serviceName}/user</sup></sub> |
- | `get_user_details/2` | <small>Get user details</small> | <sub><sup>GET /cloud/project/{serviceName}/user/{userId}</sup></sub> |
+ | `create_user/2` | <small>Create user</small> | <sub><sup>POST /ctsloud/project/{serviceName}/user</sup></sub> |
+ | `get_user_details/2` | <small>Get user details. Returns the user_id and username and other details.</small> | <sub><sup>GET /cloud/project/{serviceName}/user/{userId}</sup></sub> |
| `delete_user/2` | <small>Delete user</small> | <sub><sup>DELETE /cloud/project/{serviceName}/user/{userId}</sup></sub> |
| `download_openrc_script/3` | <small>Get RC file of OpenStack</small> | <sub><sup>GET /cloud/project/{serviceName}/user/{userId}/openrc</sup></sub> |
| `regenerate_credentials/2` | <small>Regenerate user credentials including password</small> | <sub><sup>POST /cloud/project/{serviceName}/user/{userId}/regeneratePassword</sup></sub> |
| `swift_identity/3` | <small>Gets a json object similar to that returned by Keystone Identity. Includes the 'X-Auth-Token'</small> | <sub><sup>POST /cloud/project/{serviceName}/user/{userId}/token</sup></sub> |
-
-
- ## TODO
-
- POST /cloud/createProject Start a new cloud project
- GET /cloud/price Get services prices
- GET /cloud/project/{serviceName} Get this object properties
- PUT /cloud/project/{serviceName} Alter this object properties
- GET /cloud/project/{serviceName}/acl Get ACL on your cloud project
- POST /cloud/project/{serviceName}/acl
- GET /cloud/project/{serviceName}/serviceInfos
- GET /cloud/project/{serviceName}/quota Get project quotas
- GET /cloud/project/{serviceName}/region Get regions
- GET /cloud/project/{serviceName}/region/{regionName}
- GET /cloud/project/{serviceName}/consumption
- GET /cloud/project/{serviceName}/bill
+ | `create_project/2` | <small>Start a new cloud project in the OVH cloud. Corresponds to creating a new Swift stack with a new tenant_id.</small> | <sub><sup>POST /cloud/createProject</sup></sub> |
+ | `get_prices/2` | <small>Get Prices for OVH cloud services.</small> | <sub><sup>GET /cloud/price</sup></sub> |
+ | `project_info/1` | <small>Get information about a project with the project_id (tenant_id)</small> | <sub><sup>GET /cloud/project/{serviceName}</sup></sub> |
+ | `modify_project/2` | <small>Modify a project properties. Change the project description.</small> | <sub><sup>PUT /cloud/project/{serviceName}</sup></sub> |
+ | `project_administrative_info/1` | <small>Get administration information about the project.</small> | <sub><sup>GET /cloud/project/{serviceName}/serviceInfos</sup></sub> |
+ | `project_quotas/1` | <small>Get project quotas.</small> | <sub><sup>GET /cloud/project/{serviceName}/quota</sup></sub> |
+ | `project_regions/1` | <small>Get project regions.</small> | <sub><sup>GET /cloud/project/{serviceName}/region</sup></sub> |
+ | `project_region_info/2` | <small>Get details about a project region.</small> | <sub><sup>GET /cloud/project/{serviceName}/region/{regionName}</sup></sub> |
+ | `project_consumption/3` | <small>Get details about a project consumption for a given `date_from` and `date_to`.</small> | <sub><sup>GET /cloud/project/{serviceName}/consumption</sup></sub> |
+ | `project_bills/3` | <small>Get details about a project billing for a given `date_from` and `date_to`..</small> | <sub><sup>GET /cloud/project/{serviceName}/bill</sup></sub> |
+ | `create_project_alert/4` | <small>Add a new project alert</small> | <sub><sup>POST /cloud/project/{serviceName}/alerting</sup></sub> |
+ | `get_project_alert_info/2` | <small>Get detailed information about a project alert.</small> | <sub><sup>GET /cloud/project/{serviceName}/alerting/{id}</sup></sub> |
+ | `modify_project_alert/5` | <small>Modify an existing project alert.</small> | <sub><sup>PUT /cloud/project/{serviceName}/alerting/{id}</sup></sub> |
+ | `delete_project_alert/2` | <small>Delete an existing project alert.</small> | <sub><sup>DELETE /cloud/project/{serviceName}/alerting/{id}</sup></sub> |
+ | `terminate_service/2` | <small>Terminate a cloud project.</small> | <sub><sup>POST /cloud/project/{serviceName}/terminate</sup></sub> |
+
+
+ ## TO BE ADDED
+
+ GET /cloud/project/{serviceName}/acl
+ POST /cloud/project/{serviceName}/acl
+ GET /cloud/project/{serviceName}/acl/{accountId}
+ DELETE /cloud/project/{serviceName}/acl/{accountId}
## Example
- ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.get_containers(service_name) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Cloudstorage.Query.get_containers(service_name) |> ExOvh.Ovh.request!()
"""
alias ExOvh.Ovh.Query
@doc ~s"""
- GET /cloud/project List available services
+ List available services
+
+ ## Api Call
+
+ GET /cloud/project
## Example
- ExOvh.Ovh.V1.Cloud.Query.list_services() |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.list_services() |> ExOvh.Ovh.request!()
"""
@spec list_services() :: Query.t
def list_services() do
@@ -57,11 +68,19 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@doc ~s"""
- GET /cloud/project/{serviceName}/user Get all users
+ Get all users
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/user
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
## Example
- ExOvh.Ovh.V1.Cloud.Query.get_users(service_name) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.get_users(service_name) |> ExOvh.Ovh.request!()
"""
@spec get_users(String.t) :: Query.t
def get_users(service_name) do
@@ -74,11 +93,20 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@doc ~s"""
- POST /cloud/project/{serviceName}/user Create user
+ Create user
+
+ ## Api Call
+
+ POST /cloud/project/{serviceName}/user
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `description`: description ascribed to the new user.
## Example
- ExOvh.Ovh.V1.Cloud.Query.create_user(service_name, "ex_ovh") |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.create_user(service_name, "ex_ovh") |> ExOvh.Ovh.request!()
"""
@spec create_user(String.t, String.t) :: Query.t
def create_user(service_name, description) do
@@ -94,11 +122,20 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@doc ~s"""
- GET /cloud/project/{serviceName}/user/{userId} Get user details
+ Get user details. Returns the user_id and username and other details.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/user/{userId}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `user_id`: corresponds to user_id. See `get_users/1`
## Example
- ExOvh.Ovh.V1.Cloud.Query.get_user_details(service_name, user_id) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.get_user_details(service_name, user_id) |> ExOvh.Ovh.request!()
"""
@spec get_user_details(String.t, String.t) :: Query.t
def get_user_details(service_name, user_id) do
@@ -111,11 +148,20 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@doc ~s"""
- DELETE /cloud/project/{serviceName}/user/{userId} Delete user
+ Delete a specific user.
+
+ ## Api Call
+
+ DELETE /cloud/project/{serviceName}/user/{userId}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `user_id`: The user_id. See `get_users/1`
## Example
- ExOvh.Ovh.V1.Cloud.Query.delete_user(service_name, user_id) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.delete_user(service_name, user_id) |> ExOvh.Ovh.request!()
"""
@spec delete_user(String.t, String.t) :: Query.t
def delete_user(service_name, user_id) do
@@ -128,11 +174,22 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@doc ~s"""
- GET /cloud/project/{serviceName}/user/{userId}/openrc Get RC file of OpenStack
+ Get RC file of OpenStack. This file is a bash script with much of the openstack credentials. Makes it easier for
+ setting up a swift client from the terminal.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/user/{userId}/openrc
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `user_id`: user_id for user accessing the service.
+ - `region`: region for which the rc file will be created. Defaults to "SBG1" if left absent.
## Example
- ExOvh.Ovh.V1.Cloud.Query.download_openrc_script(service_name, user_id, "SBG1") |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.download_openrc_script(service_name, user_id, "SBG1") |> ExOvh.Ovh.request!()
"""
@spec download_openrc_script(String.t, String.t, String.t) :: Query.t
def download_openrc_script(service_name, user_id, region \\ "SBG1") do
@@ -147,11 +204,20 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@doc ~s"""
- POST /cloud/project/{serviceName}/user/{userId}/regeneratePassword Regenerate user password
+ Regenerate user password and other credentials.
+
+ ## Api Call
+
+ POST /cloud/project/{serviceName}/user/{userId}/regeneratePassword
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `user_id`: user_id for accessing the project. See `get_users/1`
## Example
- ExOvh.Ovh.V1.Cloud.Query.regenerate_credentials(service_name, user_id) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.regenerate_credentials(service_name, user_id) |> ExOvh.Ovh.request!()
"""
@spec regenerate_credentials(String.t, String.t) :: Query.t
def regenerate_credentials(service_name, user_id) do
@@ -164,12 +230,21 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
@doc ~s"""
- POST /cloud/project/{serviceName}/user/{userId}/token Get the token for the user (very similar to
- keystone identity)
+ Get the token for the user (very similar to keystone identity)
+
+ ## Api Call
+
+ POST /cloud/project/{serviceName}/user/{userId}/token
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `user_id`: The swift user_id to login with. See `get_users/1`.
+ - `password`: The swift password to login with. See `regenerate_credentials/2`
## Example
- ExOvh.Ovh.V1.Cloud.Query.swift_identity(service_name, user_id) |> ExOvh.request!()
+ ExOvh.Ovh.V1.Cloud.Query.swift_identity(service_name, user_id) |> ExOvh.Ovh.request!()
"""
@spec swift_identity(String.t, String.t, String.t) :: Query.t
def swift_identity(service_name, user_id, password) do
@@ -184,6 +259,451 @@ defmodule ExOvh.Ovh.V1.Cloud.Query do
end
+ @doc ~s"""
+ Create a new Cloud Project.
+
+ ## Api Call
+
+ POST /cloud/createProject
+
+ ## Arguments
+
+ - `description`: project description
+ - `voucher`: ovh voucher code
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.create_project(description, voucher) |> ExOvh.Ovh.request!()
+ """
+ @spec create_project(String.t, String.t) :: Query.t
+ def create_project(description, voucher) do
+ %Query{
+ method: :post,
+ uri: "/cloud/createProject",
+ params: %{
+ "description" => description,
+ "voucher" => voucher
+ }
+ |> Poison.encode!()
+ }
+ end
+
+
+ @doc ~s"""
+ Get services prices for the OVH public cloud.
+
+ ## Api Call
+
+ GET /cloud/price
+
+ ## Arguments
+
+ - `region`: prices for a particular region (optional)
+ - `flavor_id`: ovh voucher code (optional)
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.get_prices() |> ExOvh.Ovh.request!()
+ """
+ @spec get_prices(String.t | :nil, String.t | :nil) :: Query.t
+ def get_prices(region \\ :nil, flavor_id \\ :nil) do
+ params = if region == :nil and flavor_id == :nil, do: :nil
+ params = if region != :nil and flavor_id == :nil, do: %{ "region" => region }
+ params = if region == :nil and flavor_id != :nil, do: %{ "flavorId" => flavor_id }
+ params = if region != :nil and flavor_id != :nil, do: %{ "region" => region, "flavorId" => flavor_id }
+ %Query{
+ method: :get,
+ uri: "/cloud/createProject",
+ params: params
+ }
+ end
+
+
+ @doc ~s"""
+ Get details for a given project.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.project_info(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec project_info(String.t) :: Query.t
+ def project_info(service_name) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Modify the project description for a project.
+
+ ## Api Call
+
+ PUT /cloud/project/{serviceName}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.modify_project(service_name, new_description) |> ExOvh.Ovh.request!()
+ """
+ @spec modify_project(String.t, String.t) :: Query.t
+ def modify_project(service_name, new_description) do
+ %Query{
+ method: :put,
+ uri: "/cloud/project/#{service_name}",
+ params: %{
+ "description" => new_description
+ }
+ |> Poison.encode!()
+ }
+ end
+
+
+ @doc ~s"""
+ Get administration information about the project
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/serviceInfos
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.project_administrative_info(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec project_administrative_info(String.t) :: Query.t
+ def project_administrative_info(service_name) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/serviceInfos",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Get project quotas.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/quota
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.project_quotas(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec project_quotas(String.t) :: Query.t
+ def project_quotas(service_name) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/quota",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Get project regions.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/region
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.project_regions(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec project_regions(String.t) :: Query.t
+ def project_regions(service_name) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/region",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Get project details about a project region.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/region/{regionName}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.project_region_info(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec project_region_info(String.t, String.t) :: Query.t
+ def project_region_info(service_name, region_name) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/region/#{region_name}",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Get project details about a project consumption.
+
+ *Note:* Will only allow for up to one month of data to be returned.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/consumption
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `date_from`: starting date in `ISO 8601` format. defaults to 4 weeks/28 days ago (UTC time) if left absent.
+ - `date_to`: end date in `ISO 8601` format. defaults to now (UTC time) if left absent.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.project_consumption(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec project_consumption(String.t, String.t, String.t) :: Query.t
+ def project_consumption(service_name, date_from \\ :nil, date_to \\ :nil) do
+ date_from = if date_from == :nil, do: Calendar.DateTime.now_utc!() |> Calendar.DateTime.add!(-(60*60*24*28)) |> Calendar.DateTime.Format.rfc3339(), else: date_from
+ date_to = if date_from == :nil, do: Calendar.DateTime.now_utc!() |> Calendar.DateTime.Format.rfc3339(), else: date_from
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/consumption",
+ params: %{from: date_from, to: date_to}
+ }
+ end
+
+
+ @doc ~s"""
+ Get project details about a project bills.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/bill
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `date_from`: starting date in `ISO 8601` format. defaults to 4 weeks/28 days ago (UTC time) if left absent.
+ - `date_to`: end date in `ISO 8601` format. defaults to now (UTC time) if left absent.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.project_bills(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec project_bills(String.t, String.t, String.t) :: Query.t
+ def project_bills(service_name, date_from \\ :nil, date_to \\ :nil) do
+ date_from = if date_from == :nil, do: Calendar.DateTime.now_utc!() |> Calendar.DateTime.add!(-(60*60*24*28)) |> Calendar.DateTime.Format.rfc3339(), else: date_from
+ date_to = if date_from == :nil, do: Calendar.DateTime.now_utc!() |> Calendar.DateTime.Format.rfc3339(), else: date_from
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/bill",
+ params: %{from: date_from, to: date_to}
+ }
+ end
+
+
+ @doc ~s"""
+ Get a list of project alert ids. These project alert ids can then be looked up in a separate query for more information.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/alerting
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.get_project_alerts(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec get_project_alerts(String.t) :: Query.t
+ def get_project_alerts(service_name) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/alerting",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Create a new project alert.
+
+ *Notes:*
+ It seems only one alert is allowed per project. To create a new one alter the old one or delete the old one and add a new one.
+ Once the monthly threshold in the given currency is exceeded, then the alert email is sent.
+
+ ## Api Call
+
+ POST /cloud/project/{serviceName}/alerting
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `delay`: The delay between each alert in seconds. This has to be selected from an enumerable (a list). 3600 is the lowest. defaults to 3600. (1 hour)
+ - `email`: The email to send the alert to.
+ - `monthlyThreshold`: The maximum monetary (cash) usage allowed in one month. This is an integer value. Ask OVH about how the currency is chosen.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.create_project_alert(service_name, "email_address@email.email", 5) |> ExOvh.Ovh.request!()
+ """
+ @spec create_project_alert(String.t, String.t, integer, String.t) :: Query.t | no_return
+ def create_project_alert(service_name, email, monthly_threshold, delay \\ "3600") do
+ unless is_integer(monthly_threshold), do: Og.log_return(__ENV__, "monthly_threshold should be an integer!", :error) |> raise()
+ %Query{
+ method: :post,
+ uri: "/cloud/project/#{service_name}/alerting",
+ params: %{
+ "delay" => delay,
+ "email" => email,
+ "monthlyThreshold" => monthly_threshold
+ } |> Poison.encode!()
+ }
+ end
+
+
+ @doc ~s"""
+ Get detailed information about a project alert.
+
+ ## Api Call
+
+ GET /cloud/project/{serviceName}/alerting/{id}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `alert_id`: The id of the project alert. See `get_project_alerts/1`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.get_project_alert_info(service_name, alert_id) |> ExOvh.Ovh.request!()
+ """
+ @spec get_project_alert_info(String.t, String.t) :: Query.t
+ def get_project_alert_info(service_name, alert_id) do
+ %Query{
+ method: :get,
+ uri: "/cloud/project/#{service_name}/alerting/#{alert_id}",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Modify an existing project alert.
+
+ ## Api Call
+
+ PUT /cloud/project/{serviceName}/alerting/{id}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `alert_id`: The alert to be modified.
+ - `delay`: The delay between each alert in seconds. This has to be selected from an enumerable (a list). 3600 is the lowest. defaults to 3600. (1 hour)
+ - `email`: The email to send the alert to.
+ - `monthlyThreshold`: The maximum monetary (cash) usage allowed in one month. This is an integer value. Ask OVH about how the currency is chosen.
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.modify_project_alert(service_name, alert_id, "email_address@email.email", 5) |> ExOvh.Ovh.request!()
+ """
+ @spec modify_project_alert(String.t, String.t, String.t, integer, String.t) :: Query.t
+ def modify_project_alert(service_name, alert_id, email, monthly_threshold, delay \\ "3600") do
+ unless is_integer(monthly_threshold), do: Og.log_return(__ENV__, "monthly_threshold should be an integer!", :error) |> raise()
+ %Query{
+ method: :put,
+ uri: "/cloud/project/#{service_name}/alerting/#{alert_id}",
+ params: %{
+ "delay" => delay,
+ "email" => email,
+ "monthlyThreshold" => monthly_threshold
+ } |> Poison.encode!()
+ }
+ end
+
+
+ @doc ~s"""
+ Delete a project alert.
+
+ ## Api Call
+
+ DELETE /cloud/project/{serviceName}/alerting/{id}
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+ - `alert_id`: The id of the project alert. See `get_project_alerts/1`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.get_project_alert_info(service_name, alert_id) |> ExOvh.Ovh.request!()
+ """
+ @spec delete_project_alert(String.t, String.t) :: Query.t
+ def delete_project_alert(service_name, alert_id) do
+ %Query{
+ method: :delete,
+ uri: "/cloud/project/#{service_name}/alerting/#{alert_id}",
+ params: :nil
+ }
+ end
+
+
+ @doc ~s"""
+ Terminate a cloud project.
+
+ ## Api Call
+
+ POST /cloud/project/{serviceName}/terminate
+
+ ## Arguments
+
+ - `service_name`: corresponds to project_id or tenant_id. See `list_services/0`
+
+ ## Example
+
+ ExOvh.Ovh.V1.Cloud.Query.terminate_project(service_name) |> ExOvh.Ovh.request!()
+ """
+ @spec terminate_project(String.t) :: Query.t
+ def terminate_project(service_name) do
+ %Query{
+ method: :post,
+ uri: "/cloud/project/#{service_name}/terminate",
+ params: :nil
+ }
+ end
+
end
\ No newline at end of file
diff --git a/lib/ovh/v1/webstorage/query.ex b/lib/ovh/v1/webstorage/query.ex
index 2d3a5d4..cc3ac3f 100644
--- a/lib/ovh/v1/webstorage/query.ex
+++ b/lib/ovh/v1/webstorage/query.ex
@@ -2,22 +2,35 @@ defmodule ExOvh.Ovh.V1.Webstorage.Query do
@moduledoc ~s"""
Helper functions for building `queries directed at the `/cdn/webstorage` part of the custom ovh api.
+ ## Functions Summary
+
+ | Function | Description | OVH API call |
+ |---|---|---|
+ | `get_services/0` | <small>Get a list of all webstorage cdn services.</small> | <sub><sup>GET /v1/cdn/webstorage</sup></sub> |
+ | `get_service/1` | <small>Get the domain, server and storage limits for a specific webstorage cdn service</small> | <sub><sup>GET /v1/cdn/webstorage/{serviceName}</sup></sub> |
+ | `get_service_info/1` | <small>Get a administrative details for a specific webstorage cdn service</small> | <sub><sup>GET /v1/cdn/webstorage/{serviceName}/serviceInfos</sup></sub> |
+ | `get_service_stats/2` | <small>Get statistics for a specific webstorage cdn service</small> | <sub><sup>GET /v1/cdn/webstorage/{serviceName}/statistics</sup></sub> |
+ | `get_credentials/1` | <small>Get credentials for using the swift compliant api</small> | <sub><sup>GET /v1/cdn/webstorage/{serviceName}/statistics</sup></sub> |
+
+
## Example
- alias ExOvh.Ovh.V1.Webstorage.Query
- query = Query.get_all_webstorage()
- ExOvh.request(query)
+ ExOvh.Ovh.V1.Webstorage.Query.get_all_webstorage() |> ExOvh.Ovh.request()
"""
alias ExOvh.Ovh.Query
@doc ~s"""
- GET /v1/cdn/webstorage, Get a list of all webstorage cdn services available for the client account
+ Get a list of all webstorage cdn services available for the client account
- ### Example usage
+ ## Api call
+
+ GET /v1/cdn/webstorage
+
+ ## Example
- ExOvh.Ovh.V1.Webstorage.Query. get_services() |> ExOvh.request()
+ ExOvh.Ovh.V1.Webstorage.Query. get_services() |> ExOvh.Ovh.request()
"""
@spec get_services() :: Query.t
def get_services() do
@@ -31,14 +44,22 @@ defmodule ExOvh.Ovh.V1.Webstorage.Query do
@doc ~s"""
- GET /v1/cdn/webstorage/{serviceName}, Get the domain, server and storage limits for a specific webstorage cdn service
+ Get the domain, server and storage limits for a specific webstorage cdn service
- ### Example usage
+ ## Api call
+
+ GET /v1/cdn/webstorage/{serviceName}
+
+ ## Arguments
+
+ - `service_name`: Name of the Webstorage CDN service - assigned by OVH.
+
+ ## Example
alias ExOvh.Ovh.V1.Webstorage.Query
service_name = "cdnwebstorage-????"
query = Query.get_service(service_name)
- {:ok, resp} = ExOvh.request(query)
+ {:ok, resp} = ExOvh.Ovh.request(query)
%{
"domain" => domain,
"storageLimit => storage_limit,
@@ -57,14 +78,22 @@ defmodule ExOvh.Ovh.V1.Webstorage.Query do
@doc ~s"""
- GET /v1/cdn/webstorage/{serviceName}/serviceInfos, Get a administrative details for a specific webstorage cdn service
+ Get a administrative details for a specific webstorage cdn service
+
+ ## Api call
- ### Example usage
+ GET /v1/cdn/webstorage/{serviceName}/serviceInfos
+
+ ## Arguments
+
+ - `service_name`: Name of the Webstorage CDN service - assigned by OVH.
+
+ ## Example
alias ExOvh.Ovh.V1.Webstorage.Query
service_name = "cdnwebstorage-????"
Query.get_service_info(service_name)
- {:ok, resp} = ExOvh.request(query)
+ {:ok, resp} = ExOvh.Ovh.request(query)
"""
@spec get_service_info(String.t) :: Query.t
def get_service_info(service_name) do
@@ -78,17 +107,25 @@ defmodule ExOvh.Ovh.V1.Webstorage.Query do
@doc ~s"""
- GET /v1/cdn/webstorage/{serviceName}/statistics, Get statistics for a specific webstorage cdn service
+ Get statistics for a specific webstorage cdn service
- `period can be "month", "week" or "day"`
- `type can be "backend", "quota" or "cdn"`
+ ## Api call
- ### Example usage
+ GET /v1/cdn/webstorage/{serviceName}/statistics
+
+ ## Arguments
+
+ - `service_name`: Name of the Webstorage CDN service - assigned by OVH.
+ - `options`:
+ - `period can be "month", "week" or "day"`
+ - `type can be "backend", "quota" or "cdn"`
+
+ ## Example
alias ExOvh.Ovh.V1.Webstorage.Query
service_name = "cdnwebstorage-????"
query = Query.get_service_stats(service_name, [period: "month", type: "backend"])
- {:ok, resp} = ExOvh.request(query)
+ {:ok, resp} = ExOvh.Ovh.request(query)
"""
@spec get_service_stats(String.t, Keyword.t) :: Query.t
def get_service_stats(service_name, opts \\ []) do
@@ -104,14 +141,22 @@ defmodule ExOvh.Ovh.V1.Webstorage.Query do
@doc ~s"""
- GET /v1/cdn/webstorage/{serviceName}/credentials, Get credentials for using the swift compliant api
+ Get credentials for using the swift compliant api
+
+ ## Api call
+
+ GET /v1/cdn/webstorage/{serviceName}/credentials
- ### Example usage
+ ## Arguments
+
+ - `service_name`: Name of the Webstorage CDN service - assigned by OVH.
+
+ ## Example
alias ExOvh.Ovh.V1.Webstorage.Query
service_name = "cdnwebstorage-????"
query = Query.get_webstorage_credentials(service_name)
- {:ok, resp} = ExOvh.request(query)
+ {:ok, resp} = ExOvh.Ovh.request(query)
"""
@spec get_credentials(String.t) :: ExOvh.Query.Ovh.t
def get_credentials(service_name) do