@metal-stack/api 0.0.40-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/js/Makefile +16 -0
  4. package/js/buf/validate/validate_pb.d.ts +4597 -0
  5. package/js/buf/validate/validate_pb.js +351 -0
  6. package/js/buf/validate/validate_pb.ts +4938 -0
  7. package/js/metalstack/admin/v2/filesystem_pb.d.ts +207 -0
  8. package/js/metalstack/admin/v2/filesystem_pb.js +48 -0
  9. package/js/metalstack/admin/v2/filesystem_pb.ts +248 -0
  10. package/js/metalstack/admin/v2/image_pb.d.ts +242 -0
  11. package/js/metalstack/admin/v2/image_pb.js +59 -0
  12. package/js/metalstack/admin/v2/image_pb.ts +288 -0
  13. package/js/metalstack/admin/v2/ip_pb.d.ts +60 -0
  14. package/js/metalstack/admin/v2/ip_pb.js +26 -0
  15. package/js/metalstack/admin/v2/ip_pb.ts +78 -0
  16. package/js/metalstack/admin/v2/machine_pb.d.ts +113 -0
  17. package/js/metalstack/admin/v2/machine_pb.js +38 -0
  18. package/js/metalstack/admin/v2/machine_pb.ts +140 -0
  19. package/js/metalstack/admin/v2/network_pb.d.ts +407 -0
  20. package/js/metalstack/admin/v2/network_pb.js +68 -0
  21. package/js/metalstack/admin/v2/network_pb.ts +478 -0
  22. package/js/metalstack/admin/v2/partition_pb.d.ts +341 -0
  23. package/js/metalstack/admin/v2/partition_pb.js +58 -0
  24. package/js/metalstack/admin/v2/partition_pb.ts +402 -0
  25. package/js/metalstack/admin/v2/project_pb.d.ts +67 -0
  26. package/js/metalstack/admin/v2/project_pb.js +27 -0
  27. package/js/metalstack/admin/v2/project_pb.ts +87 -0
  28. package/js/metalstack/admin/v2/size_pb.d.ts +183 -0
  29. package/js/metalstack/admin/v2/size_pb.js +48 -0
  30. package/js/metalstack/admin/v2/size_pb.ts +220 -0
  31. package/js/metalstack/admin/v2/switch_pb.d.ts +377 -0
  32. package/js/metalstack/admin/v2/switch_pb.js +79 -0
  33. package/js/metalstack/admin/v2/switch_pb.ts +435 -0
  34. package/js/metalstack/admin/v2/tenant_pb.d.ts +149 -0
  35. package/js/metalstack/admin/v2/tenant_pb.js +38 -0
  36. package/js/metalstack/admin/v2/tenant_pb.ts +182 -0
  37. package/js/metalstack/admin/v2/token_pb.d.ts +164 -0
  38. package/js/metalstack/admin/v2/token_pb.js +47 -0
  39. package/js/metalstack/admin/v2/token_pb.ts +199 -0
  40. package/js/metalstack/admin/v2/vpn_pb.ts +184 -0
  41. package/js/metalstack/api/v2/common_pb.d.ts +407 -0
  42. package/js/metalstack/api/v2/common_pb.js +311 -0
  43. package/js/metalstack/api/v2/common_pb.ts +488 -0
  44. package/js/metalstack/api/v2/filesystem_pb.d.ts +704 -0
  45. package/js/metalstack/api/v2/filesystem_pb.js +259 -0
  46. package/js/metalstack/api/v2/filesystem_pb.ts +819 -0
  47. package/js/metalstack/api/v2/health_pb.d.ts +220 -0
  48. package/js/metalstack/api/v2/health_pb.js +130 -0
  49. package/js/metalstack/api/v2/health_pb.ts +264 -0
  50. package/js/metalstack/api/v2/image_pb.d.ts +368 -0
  51. package/js/metalstack/api/v2/image_pb.js +129 -0
  52. package/js/metalstack/api/v2/image_pb.ts +436 -0
  53. package/js/metalstack/api/v2/ip_pb.d.ts +555 -0
  54. package/js/metalstack/api/v2/ip_pb.js +137 -0
  55. package/js/metalstack/api/v2/ip_pb.ts +650 -0
  56. package/js/metalstack/api/v2/machine_pb.d.ts +1831 -0
  57. package/js/metalstack/api/v2/machine_pb.js +459 -0
  58. package/js/metalstack/api/v2/machine_pb.ts +2155 -0
  59. package/js/metalstack/api/v2/method_pb.d.ts +122 -0
  60. package/js/metalstack/api/v2/method_pb.js +38 -0
  61. package/js/metalstack/api/v2/method_pb.ts +149 -0
  62. package/js/metalstack/api/v2/network_pb.d.ts +820 -0
  63. package/js/metalstack/api/v2/network_pb.js +244 -0
  64. package/js/metalstack/api/v2/network_pb.ts +954 -0
  65. package/js/metalstack/api/v2/partition_pb.d.ts +251 -0
  66. package/js/metalstack/api/v2/partition_pb.js +62 -0
  67. package/js/metalstack/api/v2/partition_pb.ts +300 -0
  68. package/js/metalstack/api/v2/predefined_rules_pb.d.ts +54 -0
  69. package/js/metalstack/api/v2/predefined_rules_pb.js +57 -0
  70. package/js/metalstack/api/v2/predefined_rules_pb.ts +79 -0
  71. package/js/metalstack/api/v2/project_pb.d.ts +862 -0
  72. package/js/metalstack/api/v2/project_pb.js +163 -0
  73. package/js/metalstack/api/v2/project_pb.ts +1001 -0
  74. package/js/metalstack/api/v2/size_pb.d.ts +261 -0
  75. package/js/metalstack/api/v2/size_pb.js +94 -0
  76. package/js/metalstack/api/v2/size_pb.ts +312 -0
  77. package/js/metalstack/api/v2/switch_pb.d.ts +508 -0
  78. package/js/metalstack/api/v2/switch_pb.js +207 -0
  79. package/js/metalstack/api/v2/switch_pb.ts +653 -0
  80. package/js/metalstack/api/v2/tenant_pb.d.ts +864 -0
  81. package/js/metalstack/api/v2/tenant_pb.js +163 -0
  82. package/js/metalstack/api/v2/tenant_pb.ts +1004 -0
  83. package/js/metalstack/api/v2/token_pb.d.ts +540 -0
  84. package/js/metalstack/api/v2/token_pb.js +118 -0
  85. package/js/metalstack/api/v2/token_pb.ts +621 -0
  86. package/js/metalstack/api/v2/user_pb.d.ts +108 -0
  87. package/js/metalstack/api/v2/user_pb.js +34 -0
  88. package/js/metalstack/api/v2/user_pb.ts +139 -0
  89. package/js/metalstack/api/v2/version_pb.d.ts +88 -0
  90. package/js/metalstack/api/v2/version_pb.js +30 -0
  91. package/js/metalstack/api/v2/version_pb.ts +112 -0
  92. package/js/metalstack/api/v2/vpn_pb.ts +72 -0
  93. package/js/metalstack/infra/v2/bmc_pb.d.ts +45 -0
  94. package/js/metalstack/infra/v2/bmc_pb.js +25 -0
  95. package/js/metalstack/infra/v2/bmc_pb.ts +104 -0
  96. package/js/metalstack/infra/v2/event_pb.d.ts +181 -0
  97. package/js/metalstack/infra/v2/event_pb.js +116 -0
  98. package/js/metalstack/infra/v2/event_pb.ts +218 -0
  99. package/js/metalstack/infra/v2/switch_pb.d.ts +223 -0
  100. package/js/metalstack/infra/v2/switch_pb.js +54 -0
  101. package/js/metalstack/infra/v2/switch_pb.ts +228 -0
  102. package/js/tsconfig.json +70 -0
  103. package/package.json +21 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 The metal-stack Authors.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # metal-stack.io api
2
+
3
+ [![Release](https://github.com/metal-stack/api/actions/workflows/main.yml/badge.svg)](https://github.com/metal-stack/api/actions/workflows/main.yml) [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/metal-stack/api) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/metal-stack/api) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/metal-stack/api) [![Go Report Card](https://goreportcard.com/badge/github.com/metal-stack/api)](https://goreportcard.com/report/github.com/metal-stack/api)
4
+
5
+ > [!IMPORTANT]
6
+ > Please note that this repository is still in alpha stage. For now, the primary API is still defined in the [metal-api](https://github.com/metal-stack/metal-api) project. We will make a special announcement when this repository becomes GA.
7
+
8
+ This is the V2 API of [metal-stack.io](https://metal-stack.io) to implement [MEP-4](https://metal-stack.io/docs/MEP-4-multi-tenancy-for-the-metal-api).
9
+
10
+ ## Usage examples
11
+
12
+ Can be found in the [examples](examples/) folder.
13
+
14
+ ## Conventions
15
+
16
+ Method options provide an intuitve and declarative way of providing annotations to service methods.
17
+ These are used for scoping api-methods, which are getting utilized for authentication, authorization and auditing (mainly in interceptors).
18
+
19
+ ### Motivational Example
20
+
21
+ ```proto
22
+ service IPService {
23
+ // Get an ip
24
+ rpc Get(IPServiceGetRequest) returns (IPServiceGetResponse) {
25
+ option (project_roles) = PROJECT_ROLE_OWNER;
26
+ option (project_roles) = PROJECT_ROLE_EDITOR;
27
+ option (project_roles) = PROJECT_ROLE_VIEWER;
28
+ option (auditing) = AUDITING_EXCLUDED;
29
+ }
30
+ // Create an ip
31
+ rpc Create(IPServiceCreateRequest) returns (IPServiceCreateResponse) {
32
+ option (project_roles) = PROJECT_ROLE_OWNER;
33
+ option (project_roles) = PROJECT_ROLE_EDITOR;
34
+ }
35
+ }
36
+
37
+ // IPServiceCreateRequest is the request payload for a ip create request
38
+ message IPServiceCreateRequest {
39
+ // Network from which the IP should be created
40
+ string network = 1 [(buf.validate.field).string = {
41
+ min_len: 2
42
+ max_len: 128
43
+ }];
44
+ // Project of the ip
45
+ string project = 2 [(buf.validate.field).string.uuid = true];
46
+ // Name of the ip
47
+ optional string name = 3 [(buf.validate.field).string.(metalstack.api.v2.is_name) = true];
48
+ // Description of the ip
49
+ optional string description = 4 [(buf.validate.field).string.(metalstack.api.v2.is_description) = true];
50
+ // IP if given try to create this ip if still available
51
+ optional string ip = 5 [(buf.validate.field).string.ip = true];
52
+ // Machine for which this ip should get created
53
+ optional string machine = 6 [(buf.validate.field).string.uuid = true];
54
+ // Labels to put onto the ip
55
+ optional Labels labels = 7;
56
+ // Type of the IP, ether ephemeral (default), or static
57
+ optional IPType type = 8 [(buf.validate.field).enum.defined_only = true];
58
+ // Addressfamily of the IP to create, defaults to ipv4
59
+ optional IPAddressFamily address_family = 9 [(buf.validate.field).enum.defined_only = true];
60
+ }
61
+ ```
62
+
63
+ In this example we can see the motivation behind the method options.
64
+
65
+ 1. Get: can be issued by project owner, editor, viewer and is excluded from auditing
66
+ 2. Allocate: can be used by project owner, editor
67
+ 3. Both methods are project-scoped, since they are annotated by a project role -> Request object needs to have the **project** field in order to specify the target project of the service method
68
+
69
+ Further explanations are explained in the following.
70
+
71
+ ### Auth
72
+
73
+ These options specify the RBAC of the api-endpoint.
74
+
75
+ | Option | Description | Values | Explanation |
76
+ | -------------- | -------------------------------------------- | ----------- | ------------------------------------------------------ |
77
+ | TENANT_ROLE\_ | Specifies the required tenant role | UNSPECIFIED | |
78
+ | | | OWNER | tenant owner |
79
+ | | | EDITOR | tenant editor |
80
+ | | | VIEWER | tenant viewer |
81
+ | | | GUEST | tenant guest |
82
+ | PROJECT_ROLE\_ | Specifies the required project role | UNSPECIFIED | |
83
+ | | | OWNER | project owner |
84
+ | | | EDITOR | project editor |
85
+ | | | VIEWER | project viewer |
86
+ | ADMIN_ROLE\_ | Specifies the required admin role | UNSPECIFIED | |
87
+ | | | EDITOR | admin editor |
88
+ | | | VIEWER | admin viewer |
89
+ | VISIBILITY\_ | Specifies the visibility of the api-endpoint | UNSPECIFIED | |
90
+ | | | PUBLIC | api-method is visible to public, a token is not needed |
91
+ | | | SELF | api-method is scoped to owner resources |
92
+
93
+ > [!IMPORTANT]
94
+ >
95
+ > Every operation needs at least an option, which references the scope of the request: **ROLE** or **VISIBILITY**
96
+
97
+ > [!CAUTION]
98
+ >
99
+ > If we use a Tenant or Project role, the request will be respectively scoped as Tenant or Project request.
100
+ > Tenant-Requests must have the field **login**, which is the tenant id and specifies the tenant on which the service-method is scoped.
101
+ > Project-Requests must have the field **project**, which is the project id and specifies the project on which the service-method is scoped.
102
+
103
+ ### Auditing
104
+
105
+ For traceability we require to store audit-logs.
106
+
107
+ | Option | Description | Values | Explanation |
108
+ | ---------- | ---------------------------------------- | ----------- | ------------------------ |
109
+ | AUDITING\_ | Specifies if the api-endpoint is audited | UNSPECIFIED | DEFAULT: included |
110
+ | | | INCLUDED | operation is audited |
111
+ | | | EXCLUDED | operation is not audited |
package/js/Makefile ADDED
@@ -0,0 +1,16 @@
1
+ .PHONY: install
2
+ install:
3
+ bun install -dd
4
+
5
+ .PHONY: clean
6
+ clean:
7
+ rm -rf metalstack
8
+
9
+ .PHONY: build
10
+ build: install
11
+ ifeq ($(CI),true)
12
+ cd .. &&\
13
+ yq e -i -o=json ".version=\"$(VERSION)\"" package.json &&\
14
+ yq e -o=json ".version" package.json
15
+ endif
16
+ cd .. && bun run build