diff --git a/shared/management/http/api/openapi.yml b/shared/management/http/api/openapi.yml index 519d3ca12..f131f4d01 100644 --- a/shared/management/http/api/openapi.yml +++ b/shared/management/http/api/openapi.yml @@ -3663,6 +3663,137 @@ components: example: "https://invoice.stripe.com/i/acct_1M2DaBKina4I2KUb/test_YWNjdF8xTTJEdVBLaW5hM0kyS1ViLF1SeFpQdEJZd3lUOGNEajNqeWdrdXY2RFM4aHcyCnpsLDEzMjg3GTgyNQ02000JoIHc1X?s=db" required: - url + MSPStatusResponse: + type: object + properties: + id: + type: string + description: Tenant account ID (present only for tenants) + example: ch8i4ug6lnn4g9hqv7m0 + parent: + type: string + description: Parent MSP account ID (present only for tenants) + example: ch8i4ug6lnn4g9hqv7m1 + activated_at: + type: string + description: MSP or Tenant activation timestamp in RFC3339 format + example: "2024-01-01T00:00:00Z" + invited_at: + type: string + description: Tenant invitation timestamp in RFC3339 format (present only for tenants) + example: "2024-01-01T00:00:00Z" + status: + type: string + description: Tenant status (present only for tenants) + enum: ["existing", "invited", "pending", "active"] + example: active + name: + type: string + description: MSP name (present only for MSP accounts) + example: "My MSP" + domain: + type: string + description: MSP domain (present only for MSP accounts) + example: "msp.com" + has_reseller: + type: boolean + description: Whether the MSP has a reseller (present only for MSP accounts) + default: false + example: false + is_reseller: + type: boolean + description: Whether the account is a reseller + default: false + example: false + parent_name: + type: string + description: Parent MSP name (present only for tenants) + example: "My MSP" + parent_domain: + type: string + description: Parent MSP domain (present only for tenants) + example: "msp.com" + parent_owner_name: + type: string + description: Parent MSP owner name + example: "John Doe" + parent_owner_email: + type: string + description: Parent MSP owner email + example: "john@msp.com" + ResellerStatusResponse: + type: object + properties: + activated_at: + type: string + description: Reseller activation timestamp in RFC3339 format + example: "2024-01-01T00:00:00Z" + name: + type: string + description: Reseller name + example: "My Reseller" + domain: + type: string + description: Reseller domain + example: "reseller.com" + parent_owner_name: + type: string + description: Reseller owner name + example: "John Doe" + parent_owner_email: + type: string + description: Reseller owner email + example: "john@reseller.com" + ResellerMSPResponse: + type: object + properties: + id: + type: string + description: The MSP account ID + example: ch8i4ug6lnn4g9hqv7m0 + name: + type: string + description: The MSP name + example: "Partner MSP" + domain: + type: string + description: The MSP domain + example: "partner-msp.com" + has_reseller: + type: boolean + description: Whether the MSP is managed by a reseller + example: true + activated_at: + type: string + description: MSP activation timestamp in RFC3339 format + example: "2024-01-01T00:00:00Z" + invited_at: + type: string + description: MSP invitation timestamp in RFC3339 format + example: "2024-01-01T00:00:00Z" + required: + - id + - name + - domain + - has_reseller + GetResellerMSPsResponse: + type: array + items: + $ref: "#/components/schemas/ResellerMSPResponse" + CreateResellerMSPRequest: + type: object + properties: + name: + type: string + description: The name for the MSP + example: "New Partner MSP" + domain: + type: string + description: The domain for the MSP + example: "new-partner.com" + required: + - name + - domain CreateTenantRequest: type: object properties: @@ -8447,6 +8578,237 @@ paths: $ref: "#/components/responses/requires_authentication" "500": $ref: "#/components/responses/internal_error" + /api/integrations/msp: + get: + summary: Get MSP or Tenant status + description: Returns the MSP, Tenant, or Reseller status of the authenticated account + tags: + - MSP + responses: + "200": + description: MSP or Tenant status response + content: + application/json: + schema: + $ref: "#/components/schemas/MSPStatusResponse" + "401": + $ref: "#/components/responses/requires_authentication" + "500": + $ref: "#/components/responses/internal_error" + post: + summary: Create MSP account + description: Activates the authenticated account as an MSP + tags: + - MSP + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + invite: + type: string + description: The invite code + example: "705860a1-27a3-4976-bf63-c5cd2fc1582b" + required: + - invite + responses: + "200": + description: MSP account created or already exists + "400": + $ref: "#/components/responses/bad_request" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "412": + description: MSP account requirements not met + "500": + $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller: + get: + summary: Get Reseller status + description: Returns the reseller status of the authenticated account + tags: + - MSP + responses: + "200": + description: Reseller status response + content: + application/json: + schema: + $ref: "#/components/schemas/ResellerStatusResponse" + "401": + $ref: "#/components/responses/requires_authentication" + "500": + $ref: "#/components/responses/internal_error" + post: + summary: Activate Reseller account + description: Activates the authenticated account as a reseller + tags: + - MSP + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + invite: + type: string + description: The invite code + example: "705860a1-27a3-4976-bf63-c5cd2fc1582b" + required: + - invite + responses: + "200": + description: Reseller account activated or already exists + "400": + $ref: "#/components/responses/bad_request" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "412": + description: Reseller account requirements not met + "500": + $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller/msps: + get: + summary: List MSPs under reseller + tags: + - MSP + responses: + "200": + description: List of MSPs managed by the reseller + content: + application/json: + schema: + $ref: "#/components/schemas/GetResellerMSPsResponse" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "500": + $ref: "#/components/responses/internal_error" + post: + summary: Create MSP under reseller + description: Creates a new MSP account managed by the reseller. No domain validation required. + tags: + - MSP + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateResellerMSPRequest" + responses: + "200": + description: MSP created successfully + content: + application/json: + schema: + $ref: "#/components/schemas/ResellerMSPResponse" + "400": + $ref: "#/components/responses/bad_request" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "409": + description: MSP already exists for this domain + "500": + $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller/msps/{id}: + delete: + summary: Unlink MSP from reseller + tags: + - MSP + parameters: + - in: path + name: id + required: true + schema: + type: string + description: The MSP account ID to unlink + responses: + "200": + description: MSP unlinked successfully + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: MSP not found or not managed by this reseller + "500": + $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller/msps/{id}/invite: + post: + summary: Invite existing MSP to reseller + description: Sends an invitation to an existing MSP to join the reseller + tags: + - MSP + parameters: + - in: path + name: id + required: true + schema: + type: string + description: The MSP account ID to invite + responses: + "200": + description: Invitation sent successfully + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: MSP not found + "412": + description: MSP is already managed by a reseller + "500": + $ref: "#/components/responses/internal_error" + put: + summary: Accept or decline reseller invitation + description: MSP owner accepts or declines an invitation from a reseller + tags: + - MSP + parameters: + - in: path + name: id + required: true + schema: + type: string + description: The MSP account ID + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + value: + type: string + description: Accept or decline the invitation + enum: + - accept + - decline + required: + - value + responses: + "200": + description: Invitation response processed + "400": + $ref: "#/components/responses/bad_request" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: MSP not found or no pending invitation + "500": + $ref: "#/components/responses/internal_error" /api/integrations/msp/tenants: get: summary: Get MSP tenants diff --git a/shared/management/http/api/types.gen.go b/shared/management/http/api/types.gen.go index 84ee125b1..f37c258e6 100644 --- a/shared/management/http/api/types.gen.go +++ b/shared/management/http/api/types.gen.go @@ -629,6 +629,30 @@ func (e JobResponseStatus) Valid() bool { } } +// Defines values for MSPStatusResponseStatus. +const ( + MSPStatusResponseStatusActive MSPStatusResponseStatus = "active" + MSPStatusResponseStatusExisting MSPStatusResponseStatus = "existing" + MSPStatusResponseStatusInvited MSPStatusResponseStatus = "invited" + MSPStatusResponseStatusPending MSPStatusResponseStatus = "pending" +) + +// Valid indicates whether the value is a known member of the MSPStatusResponseStatus enum. +func (e MSPStatusResponseStatus) Valid() bool { + switch e { + case MSPStatusResponseStatusActive: + return true + case MSPStatusResponseStatusExisting: + return true + case MSPStatusResponseStatusInvited: + return true + case MSPStatusResponseStatusPending: + return true + default: + return false + } +} + // Defines values for NameserverNsType. const ( NameserverNsTypeUdp NameserverNsType = "udp" @@ -1277,6 +1301,24 @@ func (e GetApiEventsProxyParamsStatus) Valid() bool { } } +// Defines values for PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue. +const ( + PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValueAccept PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue = "accept" + PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValueDecline PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue = "decline" +) + +// Valid indicates whether the value is a known member of the PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue enum. +func (e PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue) Valid() bool { + switch e { + case PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValueAccept: + return true + case PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValueDecline: + return true + default: + return false + } +} + // Defines values for PutApiIntegrationsMspTenantsIdInviteJSONBodyValue. const ( PutApiIntegrationsMspTenantsIdInviteJSONBodyValueAccept PutApiIntegrationsMspTenantsIdInviteJSONBodyValue = "accept" @@ -1591,6 +1633,15 @@ type CreateIntegrationRequest struct { // CreateIntegrationRequestPlatform The event streaming platform to integrate with (e.g., "datadog", "s3", "firehose"). This field is used for creation. For updates (PUT), this field, if sent, is ignored by the backend. type CreateIntegrationRequestPlatform string +// CreateResellerMSPRequest defines model for CreateResellerMSPRequest. +type CreateResellerMSPRequest struct { + // Domain The domain for the MSP + Domain string `json:"domain"` + + // Name The name for the MSP + Name string `json:"name"` +} + // CreateScimIntegrationRequest Request payload for creating an SCIM IDP integration type CreateScimIntegrationRequest struct { // GroupPrefixes List of start_with string patterns for groups to sync @@ -1969,6 +2020,9 @@ type GeoLocationCheck struct { // GeoLocationCheckAction Action to take upon policy match type GeoLocationCheckAction string +// GetResellerMSPsResponse defines model for GetResellerMSPsResponse. +type GetResellerMSPsResponse = []ResellerMSPResponse + // GetTenantsResponse defines model for GetTenantsResponse. type GetTenantsResponse = []TenantResponse @@ -2348,6 +2402,51 @@ type Location struct { CountryCode CountryCode `json:"country_code"` } +// MSPStatusResponse defines model for MSPStatusResponse. +type MSPStatusResponse struct { + // ActivatedAt MSP or Tenant activation timestamp in RFC3339 format + ActivatedAt *string `json:"activated_at,omitempty"` + + // Domain MSP domain (present only for MSP accounts) + Domain *string `json:"domain,omitempty"` + + // HasReseller Whether the MSP has a reseller (present only for MSP accounts) + HasReseller *bool `json:"has_reseller,omitempty"` + + // Id Tenant account ID (present only for tenants) + Id *string `json:"id,omitempty"` + + // InvitedAt Tenant invitation timestamp in RFC3339 format (present only for tenants) + InvitedAt *string `json:"invited_at,omitempty"` + + // IsReseller Whether the account is a reseller + IsReseller *bool `json:"is_reseller,omitempty"` + + // Name MSP name (present only for MSP accounts) + Name *string `json:"name,omitempty"` + + // Parent Parent MSP account ID (present only for tenants) + Parent *string `json:"parent,omitempty"` + + // ParentDomain Parent MSP domain (present only for tenants) + ParentDomain *string `json:"parent_domain,omitempty"` + + // ParentName Parent MSP name (present only for tenants) + ParentName *string `json:"parent_name,omitempty"` + + // ParentOwnerEmail Parent MSP owner email + ParentOwnerEmail *string `json:"parent_owner_email,omitempty"` + + // ParentOwnerName Parent MSP owner name + ParentOwnerName *string `json:"parent_owner_name,omitempty"` + + // Status Tenant status (present only for tenants) + Status *MSPStatusResponseStatus `json:"status,omitempty"` +} + +// MSPStatusResponseStatus Tenant status (present only for tenants) +type MSPStatusResponseStatus string + // MinKernelVersionCheck Posture check with the kernel version type MinKernelVersionCheck struct { // MinKernelVersion Minimum acceptable version @@ -3474,6 +3573,45 @@ type ProxyCluster struct { ConnectedProxies int `json:"connected_proxies"` } +// ResellerMSPResponse defines model for ResellerMSPResponse. +type ResellerMSPResponse struct { + // ActivatedAt MSP activation timestamp in RFC3339 format + ActivatedAt *string `json:"activated_at,omitempty"` + + // Domain The MSP domain + Domain string `json:"domain"` + + // HasReseller Whether the MSP is managed by a reseller + HasReseller bool `json:"has_reseller"` + + // Id The MSP account ID + Id string `json:"id"` + + // InvitedAt MSP invitation timestamp in RFC3339 format + InvitedAt *string `json:"invited_at,omitempty"` + + // Name The MSP name + Name string `json:"name"` +} + +// ResellerStatusResponse defines model for ResellerStatusResponse. +type ResellerStatusResponse struct { + // ActivatedAt Reseller activation timestamp in RFC3339 format + ActivatedAt *string `json:"activated_at,omitempty"` + + // Domain Reseller domain + Domain *string `json:"domain,omitempty"` + + // Name Reseller name + Name *string `json:"name,omitempty"` + + // ParentOwnerEmail Reseller owner email + ParentOwnerEmail *string `json:"parent_owner_email,omitempty"` + + // ParentOwnerName Reseller owner name + ParentOwnerName *string `json:"parent_owner_name,omitempty"` +} + // Resource defines model for Resource. type Resource struct { // Id ID of the resource @@ -4522,6 +4660,27 @@ type PutApiIntegrationsBillingSubscriptionJSONBody struct { PriceID *string `json:"priceID,omitempty"` } +// PostApiIntegrationsMspJSONBody defines parameters for PostApiIntegrationsMsp. +type PostApiIntegrationsMspJSONBody struct { + // Invite The invite code + Invite string `json:"invite"` +} + +// PostApiIntegrationsMspResellerJSONBody defines parameters for PostApiIntegrationsMspReseller. +type PostApiIntegrationsMspResellerJSONBody struct { + // Invite The invite code + Invite string `json:"invite"` +} + +// PutApiIntegrationsMspResellerMspsIdInviteJSONBody defines parameters for PutApiIntegrationsMspResellerMspsIdInvite. +type PutApiIntegrationsMspResellerMspsIdInviteJSONBody struct { + // Value Accept or decline the invitation + Value PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue `json:"value"` +} + +// PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue defines parameters for PutApiIntegrationsMspResellerMspsIdInvite. +type PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue string + // PutApiIntegrationsMspTenantsIdInviteJSONBody defines parameters for PutApiIntegrationsMspTenantsIdInvite. type PutApiIntegrationsMspTenantsIdInviteJSONBody struct { // Value Accept or decline the invitation. @@ -4648,6 +4807,18 @@ type CreateSentinelOneEDRIntegrationJSONRequestBody = EDRSentinelOneRequest // UpdateSentinelOneEDRIntegrationJSONRequestBody defines body for UpdateSentinelOneEDRIntegration for application/json ContentType. type UpdateSentinelOneEDRIntegrationJSONRequestBody = EDRSentinelOneRequest +// PostApiIntegrationsMspJSONRequestBody defines body for PostApiIntegrationsMsp for application/json ContentType. +type PostApiIntegrationsMspJSONRequestBody PostApiIntegrationsMspJSONBody + +// PostApiIntegrationsMspResellerJSONRequestBody defines body for PostApiIntegrationsMspReseller for application/json ContentType. +type PostApiIntegrationsMspResellerJSONRequestBody PostApiIntegrationsMspResellerJSONBody + +// PostApiIntegrationsMspResellerMspsJSONRequestBody defines body for PostApiIntegrationsMspResellerMsps for application/json ContentType. +type PostApiIntegrationsMspResellerMspsJSONRequestBody = CreateResellerMSPRequest + +// PutApiIntegrationsMspResellerMspsIdInviteJSONRequestBody defines body for PutApiIntegrationsMspResellerMspsIdInvite for application/json ContentType. +type PutApiIntegrationsMspResellerMspsIdInviteJSONRequestBody PutApiIntegrationsMspResellerMspsIdInviteJSONBody + // PostApiIntegrationsMspTenantsJSONRequestBody defines body for PostApiIntegrationsMspTenants for application/json ContentType. type PostApiIntegrationsMspTenantsJSONRequestBody = CreateTenantRequest