Skip to content

Commit 18387a3

Browse files
feat(mgmt): add CheckNamespaceAdmin endpoint (#376)
Because - In pipeline, model, and artifact backends, we might need to verify the namespace type when provided with the namespace UID. This Commit - Adds the `CheckNamespaceAdmin` endpoint to `MgmtPrivateService`. --------- Co-authored-by: droplet-bot <[email protected]>
1 parent 56f0eea commit 18387a3

File tree

3 files changed

+74
-15
lines changed

3 files changed

+74
-15
lines changed

core/mgmt/v1beta/mgmt.proto

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,34 @@ message CheckNamespaceResponse {
438438
Namespace type = 1;
439439
}
440440

441+
// CheckNamespaceAdminRequest represents a request to verify if a namespace is
442+
// available.
443+
message CheckNamespaceAdminRequest {
444+
// The namespace ID to be checked.
445+
string id = 1 [(google.api.field_behavior) = REQUIRED];
446+
}
447+
448+
// CheckNamespaceAdminResponse contains the availability of a namespace or the type
449+
// of resource that's using it.
450+
message CheckNamespaceAdminResponse {
451+
// Namespace contains information about the availability of a namespace.
452+
enum Namespace {
453+
// Unspecified.
454+
NAMESPACE_UNSPECIFIED = 0;
455+
// Available.
456+
NAMESPACE_AVAILABLE = 1;
457+
// Namespace belongs to a user.
458+
NAMESPACE_USER = 2;
459+
// Namespace belongs to an organization.
460+
NAMESPACE_ORGANIZATION = 3;
461+
// Reserved.
462+
NAMESPACE_RESERVED = 4;
463+
}
464+
465+
// Namespace type.
466+
Namespace type = 1;
467+
}
468+
441469
// API tokens allow users to make requests to the Instill AI API.
442470
message ApiToken {
443471
option (google.api.resource) = {

core/mgmt/v1beta/mgmt_private_service.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,13 @@ service MgmtPrivateService {
8686
option (google.api.method_signature) = "owner";
8787
}
8888

89+
// Check if a namespace is in use
90+
//
91+
// Returns the availability of a namespace or, alternatively, the type of
92+
// resource that is using it.
93+
rpc CheckNamespaceAdmin(CheckNamespaceAdminRequest) returns (CheckNamespaceAdminResponse) {
94+
option (google.api.method_signature) = "namespace";
95+
}
96+
8997
option (google.api.api_visibility).restriction = "INTERNAL";
9098
}

openapiv2/core/service.swagger.yaml

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,20 +1140,6 @@ definitions:
11401140
- STATE_INACTIVE: Inactive.
11411141
- STATE_ACTIVE: Active.
11421142
- STATE_EXPIRED: Expired.
1143-
CheckNamespaceResponseNamespace:
1144-
type: string
1145-
enum:
1146-
- NAMESPACE_AVAILABLE
1147-
- NAMESPACE_USER
1148-
- NAMESPACE_ORGANIZATION
1149-
- NAMESPACE_RESERVED
1150-
description: |-
1151-
Namespace contains information about the availability of a namespace.
1152-
1153-
- NAMESPACE_AVAILABLE: Available.
1154-
- NAMESPACE_USER: Namespace belongs to a user.
1155-
- NAMESPACE_ORGANIZATION: Namespace belongs to an organization.
1156-
- NAMESPACE_RESERVED: Reserved.
11571143
HealthCheckResponseServingStatus:
11581144
type: string
11591145
enum:
@@ -1531,6 +1517,29 @@ definitions:
15311517
- id
15321518
- email
15331519
- newsletterSubscription
1520+
v1betaCheckNamespaceAdminResponse:
1521+
type: object
1522+
properties:
1523+
type:
1524+
$ref: '#/definitions/v1betaCheckNamespaceAdminResponseNamespace'
1525+
description: Namespace type.
1526+
description: |-
1527+
CheckNamespaceAdminResponse contains the availability of a namespace or the type
1528+
of resource that's using it.
1529+
v1betaCheckNamespaceAdminResponseNamespace:
1530+
type: string
1531+
enum:
1532+
- NAMESPACE_AVAILABLE
1533+
- NAMESPACE_USER
1534+
- NAMESPACE_ORGANIZATION
1535+
- NAMESPACE_RESERVED
1536+
description: |-
1537+
Namespace contains information about the availability of a namespace.
1538+
1539+
- NAMESPACE_AVAILABLE: Available.
1540+
- NAMESPACE_USER: Namespace belongs to a user.
1541+
- NAMESPACE_ORGANIZATION: Namespace belongs to an organization.
1542+
- NAMESPACE_RESERVED: Reserved.
15341543
v1betaCheckNamespaceRequest:
15351544
type: object
15361545
properties:
@@ -1546,11 +1555,25 @@ definitions:
15461555
type: object
15471556
properties:
15481557
type:
1549-
$ref: '#/definitions/CheckNamespaceResponseNamespace'
1558+
$ref: '#/definitions/v1betaCheckNamespaceResponseNamespace'
15501559
description: Namespace type.
15511560
description: |-
15521561
CheckNamespaceResponse contains the availability of a namespace or the type
15531562
of resource that's using it.
1563+
v1betaCheckNamespaceResponseNamespace:
1564+
type: string
1565+
enum:
1566+
- NAMESPACE_AVAILABLE
1567+
- NAMESPACE_USER
1568+
- NAMESPACE_ORGANIZATION
1569+
- NAMESPACE_RESERVED
1570+
description: |-
1571+
Namespace contains information about the availability of a namespace.
1572+
1573+
- NAMESPACE_AVAILABLE: Available.
1574+
- NAMESPACE_USER: Namespace belongs to a user.
1575+
- NAMESPACE_ORGANIZATION: Namespace belongs to an organization.
1576+
- NAMESPACE_RESERVED: Reserved.
15541577
v1betaConnectorUsageData:
15551578
type: object
15561579
properties:

0 commit comments

Comments
 (0)