diff --git a/packages_generated/iam/src/v1alpha1/api.gen.ts b/packages_generated/iam/src/v1alpha1/api.gen.ts index 384cfc285..3b0f1d8e5 100644 --- a/packages_generated/iam/src/v1alpha1/api.gen.ts +++ b/packages_generated/iam/src/v1alpha1/api.gen.ts @@ -10,10 +10,12 @@ import { import { marshalAddGroupMemberRequest, marshalAddGroupMembersRequest, + marshalAddSamlCertificateRequest, marshalCreateAPIKeyRequest, marshalCreateApplicationRequest, marshalCreateGroupRequest, marshalCreateJWTRequest, + marshalCreateOrganizationSamlRequest, marshalCreatePolicyRequest, marshalCreateSSHKeyRequest, marshalCreateUserRequest, @@ -26,6 +28,7 @@ import { marshalUpdateAPIKeyRequest, marshalUpdateApplicationRequest, marshalUpdateGroupRequest, + marshalUpdateOrganizationSamlRequest, marshalUpdateOrganizationSecuritySettingsRequest, marshalUpdatePolicyRequest, marshalUpdateSSHKeyRequest, @@ -51,6 +54,7 @@ import { unmarshalListQuotaResponse, unmarshalListRulesResponse, unmarshalListSSHKeysResponse, + unmarshalListSamlCertificatesResponse, unmarshalListUsersResponse, unmarshalLog, unmarshalMFAOTP, @@ -59,6 +63,8 @@ import { unmarshalPolicy, unmarshalQuotum, unmarshalSSHKey, + unmarshalSaml, + unmarshalSamlCertificate, unmarshalSetRulesResponse, unmarshalUser, unmarshalValidateUserMFAOTPResponse, @@ -67,12 +73,14 @@ import type { APIKey, AddGroupMemberRequest, AddGroupMembersRequest, + AddSamlCertificateRequest, Application, ClonePolicyRequest, CreateAPIKeyRequest, CreateApplicationRequest, CreateGroupRequest, CreateJWTRequest, + CreateOrganizationSamlRequest, CreatePolicyRequest, CreateSSHKeyRequest, CreateUserMFAOTPRequest, @@ -81,8 +89,10 @@ import type { DeleteApplicationRequest, DeleteGroupRequest, DeleteJWTRequest, + DeleteOrganizationSamlRequest, DeletePolicyRequest, DeleteSSHKeyRequest, + DeleteSamlCertificateRequest, DeleteUserMFAOTPRequest, DeleteUserRequest, EncodedJWT, @@ -92,6 +102,7 @@ import type { GetJWTRequest, GetLogRequest, GetOrganizationRequest, + GetOrganizationSamlRequest, GetOrganizationSecuritySettingsRequest, GetPolicyRequest, GetQuotumRequest, @@ -126,6 +137,8 @@ import type { ListRulesResponse, ListSSHKeysRequest, ListSSHKeysResponse, + ListSamlCertificatesRequest, + ListSamlCertificatesResponse, ListUsersRequest, ListUsersResponse, LockUserRequest, @@ -139,6 +152,8 @@ import type { RemoveGroupMemberRequest, RemoveUserConnectionRequest, SSHKey, + Saml, + SamlCertificate, SetGroupMembersRequest, SetOrganizationAliasRequest, SetRulesRequest, @@ -147,6 +162,7 @@ import type { UpdateAPIKeyRequest, UpdateApplicationRequest, UpdateGroupRequest, + UpdateOrganizationSamlRequest, UpdateOrganizationSecuritySettingsRequest, UpdatePolicyRequest, UpdateSSHKeyRequest, @@ -1389,4 +1405,117 @@ export class API extends ParentAPI { method: 'POST', path: `/iam/v1alpha1/organizations/${validatePathParam('organizationId', request.organizationId ?? this.client.settings.defaultOrganizationId)}/migrate-guests`, }) + + /** + * Get SAML Identity Provider configuration of an Organization. + * + * @param request - The request {@link GetOrganizationSamlRequest} + * @returns A Promise of Saml + */ + getOrganizationSaml = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/iam/v1alpha1/organizations/${validatePathParam('organizationId', request.organizationId ?? this.client.settings.defaultOrganizationId)}/saml`, + }, + unmarshalSaml, + ) + + /** + * Create a SAML Identity Provider configuration for an Organization. + * + * @param request - The request {@link CreateOrganizationSamlRequest} + * @returns A Promise of Saml + */ + createOrganizationSaml = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateOrganizationSamlRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/iam/v1alpha1/organizations/${validatePathParam('organizationId', request.organizationId ?? this.client.settings.defaultOrganizationId)}/saml`, + }, + unmarshalSaml, + ) + + /** + * Update a SAML Identity Provider configuration for an Organization. + * + * @param request - The request {@link UpdateOrganizationSamlRequest} + * @returns A Promise of Saml + */ + updateOrganizationSaml = ( + request: Readonly = {}, + ) => + this.client.fetch( + { + body: JSON.stringify( + marshalUpdateOrganizationSamlRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'PATCH', + path: `/iam/v1alpha1/organizations/${validatePathParam('organizationId', request.organizationId ?? this.client.settings.defaultOrganizationId)}/saml`, + }, + unmarshalSaml, + ) + + /** + * Delete a SAML Identity Provider configuration for an Organization. + * + * @param request - The request {@link DeleteOrganizationSamlRequest} + */ + deleteOrganizationSaml = ( + request: Readonly = {}, + ) => + this.client.fetch({ + method: 'DELETE', + path: `/iam/v1alpha1/organizations/${validatePathParam('organizationId', request.organizationId ?? this.client.settings.defaultOrganizationId)}/saml`, + }) + + /** + * List SAML certificates. + * + * @param request - The request {@link ListSamlCertificatesRequest} + * @returns A Promise of ListSamlCertificatesResponse + */ + listSamlCertificates = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/iam/v1alpha1/saml/${validatePathParam('samlId', request.samlId)}/certificates`, + }, + unmarshalListSamlCertificatesResponse, + ) + + /** + * Add a SAML certificate. + * + * @param request - The request {@link AddSamlCertificateRequest} + * @returns A Promise of SamlCertificate + */ + addSamlCertificate = (request: Readonly) => + this.client.fetch( + { + body: JSON.stringify( + marshalAddSamlCertificateRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/iam/v1alpha1/saml/${validatePathParam('samlId', request.samlId)}/certificates`, + }, + unmarshalSamlCertificate, + ) + + /** + * Delete a SAML certificate. + * + * @param request - The request {@link DeleteSamlCertificateRequest} + */ + deleteSamlCertificate = (request: Readonly) => + this.client.fetch({ + method: 'DELETE', + path: `/iam/v1alpha1/saml-certificates/${validatePathParam('certificateId', request.certificateId)}`, + }) } diff --git a/packages_generated/iam/src/v1alpha1/index.gen.ts b/packages_generated/iam/src/v1alpha1/index.gen.ts index a469eb45b..61344b3cf 100644 --- a/packages_generated/iam/src/v1alpha1/index.gen.ts +++ b/packages_generated/iam/src/v1alpha1/index.gen.ts @@ -3,9 +3,10 @@ export { API } from './api.gen' export * from './marshalling.gen' export type { - APIKey, AddGroupMemberRequest, AddGroupMembersRequest, + AddSamlCertificateRequest, + APIKey, Application, BearerType, ClonePolicyRequest, @@ -16,6 +17,7 @@ export type { CreateApplicationRequest, CreateGroupRequest, CreateJWTRequest, + CreateOrganizationSamlRequest, CreatePolicyRequest, CreateSSHKeyRequest, CreateUserMFAOTPRequest, @@ -25,7 +27,9 @@ export type { DeleteApplicationRequest, DeleteGroupRequest, DeleteJWTRequest, + DeleteOrganizationSamlRequest, DeletePolicyRequest, + DeleteSamlCertificateRequest, DeleteSSHKeyRequest, DeleteUserMFAOTPRequest, DeleteUserRequest, @@ -36,6 +40,7 @@ export type { GetJWTRequest, GetLogRequest, GetOrganizationRequest, + GetOrganizationSamlRequest, GetOrganizationSecuritySettingsRequest, GetPolicyRequest, GetQuotumRequest, @@ -48,8 +53,8 @@ export type { Group, InitiateUserConnectionRequest, InitiateUserConnectionResponse, - JWT, JoinUserConnectionRequest, + JWT, ListAPIKeysRequest, ListAPIKeysRequestOrderBy, ListAPIKeysResponse, @@ -78,6 +83,8 @@ export type { ListQuotaResponse, ListRulesRequest, ListRulesResponse, + ListSamlCertificatesRequest, + ListSamlCertificatesResponse, ListSSHKeysRequest, ListSSHKeysRequestOrderBy, ListSSHKeysResponse, @@ -102,15 +109,20 @@ export type { RemoveUserConnectionRequest, Rule, RuleSpecs, - SSHKey, + Saml, + SamlCertificate, + SamlCertificateOrigin, + SamlCertificateType, SetGroupMembersRequest, SetOrganizationAliasRequest, SetRulesRequest, SetRulesResponse, + SSHKey, UnlockUserRequest, UpdateAPIKeyRequest, UpdateApplicationRequest, UpdateGroupRequest, + UpdateOrganizationSamlRequest, UpdateOrganizationSecuritySettingsRequest, UpdatePolicyRequest, UpdateSSHKeyRequest, diff --git a/packages_generated/iam/src/v1alpha1/marshalling.gen.ts b/packages_generated/iam/src/v1alpha1/marshalling.gen.ts index 2300491f1..92290ed25 100644 --- a/packages_generated/iam/src/v1alpha1/marshalling.gen.ts +++ b/packages_generated/iam/src/v1alpha1/marshalling.gen.ts @@ -1,17 +1,18 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. import randomName from '@scaleway/random-name' +import type { DefaultValues } from '@scaleway/sdk-client' import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, } from '@scaleway/sdk-client' -import type { DefaultValues } from '@scaleway/sdk-client' import type { APIKey, AddGroupMemberRequest, AddGroupMembersRequest, + AddSamlCertificateRequest, Application, Connection, ConnectionConnectedOrganization, @@ -20,6 +21,7 @@ import type { CreateApplicationRequest, CreateGroupRequest, CreateJWTRequest, + CreateOrganizationSamlRequest, CreatePolicyRequest, CreateSSHKeyRequest, CreateUserRequest, @@ -42,6 +44,7 @@ import type { ListQuotaResponse, ListRulesResponse, ListSSHKeysResponse, + ListSamlCertificatesResponse, ListUsersResponse, Log, MFAOTP, @@ -56,6 +59,8 @@ import type { Rule, RuleSpecs, SSHKey, + Saml, + SamlCertificate, SetGroupMembersRequest, SetOrganizationAliasRequest, SetRulesRequest, @@ -63,6 +68,7 @@ import type { UpdateAPIKeyRequest, UpdateApplicationRequest, UpdateGroupRequest, + UpdateOrganizationSamlRequest, UpdateOrganizationSecuritySettingsRequest, UpdatePolicyRequest, UpdateSSHKeyRequest, @@ -265,6 +271,22 @@ export const unmarshalSSHKey = (data: unknown): SSHKey => { } as SSHKey } +export const unmarshalSamlCertificate = (data: unknown): SamlCertificate => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'SamlCertificate' failed as data isn't a dictionary.`, + ) + } + + return { + content: data.content, + expiresAt: unmarshalDate(data.expires_at), + id: data.id, + origin: data.origin, + type: data.type, + } as SamlCertificate +} + export const unmarshalUser = (data: unknown): User => { if (!isJSONObject(data)) { throw new TypeError( @@ -601,6 +623,23 @@ export const unmarshalListSSHKeysResponse = ( } as ListSSHKeysResponse } +export const unmarshalListSamlCertificatesResponse = ( + data: unknown, +): ListSamlCertificatesResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListSamlCertificatesResponse' failed as data isn't a dictionary.`, + ) + } + + return { + certificates: unmarshalArrayOfObject( + data.certificates, + unmarshalSamlCertificate, + ), + } as ListSamlCertificatesResponse +} + export const unmarshalListUsersResponse = ( data: unknown, ): ListUsersResponse => { @@ -658,6 +697,20 @@ export const unmarshalOrganizationSecuritySettings = ( } as OrganizationSecuritySettings } +export const unmarshalSaml = (data: unknown): Saml => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Saml' failed as data isn't a dictionary.`, + ) + } + + return { + entityId: data.entity_id, + id: data.id, + singleSignOnUrl: data.single_sign_on_url, + } as Saml +} + export const unmarshalSetRulesResponse = (data: unknown): SetRulesResponse => { if (!isJSONObject(data)) { throw new TypeError( @@ -702,6 +755,14 @@ export const marshalAddGroupMembersRequest = ( user_ids: request.userIds, }) +export const marshalAddSamlCertificateRequest = ( + request: AddSamlCertificateRequest, + defaults: DefaultValues, +): Record => ({ + content: request.content, + type: request.type, +}) + export const marshalCreateAPIKeyRequest = ( request: CreateAPIKeyRequest, defaults: DefaultValues, @@ -743,6 +804,14 @@ export const marshalCreateJWTRequest = ( user_id: request.userId, }) +export const marshalCreateOrganizationSamlRequest = ( + request: CreateOrganizationSamlRequest, + defaults: DefaultValues, +): Record => ({ + entity_id: request.entityId, + single_sign_on_url: request.singleSignOnUrl, +}) + const marshalRuleSpecs = ( request: RuleSpecs, defaults: DefaultValues, @@ -890,6 +959,14 @@ export const marshalUpdateGroupRequest = ( tags: request.tags, }) +export const marshalUpdateOrganizationSamlRequest = ( + request: UpdateOrganizationSamlRequest, + defaults: DefaultValues, +): Record => ({ + entity_id: request.entityId, + single_sign_on_url: request.singleSignOnUrl, +}) + export const marshalUpdateOrganizationSecuritySettingsRequest = ( request: UpdateOrganizationSecuritySettingsRequest, defaults: DefaultValues, diff --git a/packages_generated/iam/src/v1alpha1/types.gen.ts b/packages_generated/iam/src/v1alpha1/types.gen.ts index 6575aa835..1e7cb4555 100644 --- a/packages_generated/iam/src/v1alpha1/types.gen.ts +++ b/packages_generated/iam/src/v1alpha1/types.gen.ts @@ -95,6 +95,16 @@ export type PermissionSetScopeType = | 'organization' | 'account_root_user' +export type SamlCertificateOrigin = + | 'unknown_certificate_origin' + | 'scaleway' + | 'identity_provider' + +export type SamlCertificateType = + | 'unknown_certificate_type' + | 'signing' + | 'encryption' + export type UserStatus = 'unknown_status' | 'invitation_pending' | 'activated' export type UserType = 'unknown_type' | 'guest' | 'owner' | 'member' @@ -680,6 +690,29 @@ export interface SSHKey { disabled: boolean } +export interface SamlCertificate { + /** + * ID of the SAML certificate. + */ + id: string + /** + * Type of the SAML certificate. + */ + type: SamlCertificateType + /** + * Origin of the SAML certificate. + */ + origin: SamlCertificateOrigin + /** + * Content of the SAML certificate. + */ + content: string + /** + * Date and time of the SAML certificate expiration. + */ + expiresAt?: Date +} + export interface User { /** * ID of user. @@ -793,6 +826,21 @@ export type AddGroupMembersRequest = { applicationIds?: string[] } +export type AddSamlCertificateRequest = { + /** + * ID of the SAML configuration. + */ + samlId: string + /** + * Type of the SAML certificate. + */ + type: SamlCertificateType + /** + * Content of the SAML certificate. + */ + content: string +} + export type ClonePolicyRequest = { policyId: string } @@ -873,6 +921,21 @@ export type CreateJWTRequest = { referrer: string } +export type CreateOrganizationSamlRequest = { + /** + * ID of the Organization. + */ + organizationId?: string + /** + * Entity ID of the SAML Identity Provider. + */ + entityId: string + /** + * Single Sign-On URL of the SAML Identity Provider. + */ + singleSignOnUrl: string +} + export type CreatePolicyRequest = { /** * Name of the policy to create (max length is 64 characters). @@ -993,6 +1056,13 @@ export type DeleteJWTRequest = { jti: string } +export type DeleteOrganizationSamlRequest = { + /** + * ID of the Organization. + */ + organizationId?: string +} + export type DeletePolicyRequest = { /** * Id of policy to delete. @@ -1004,6 +1074,13 @@ export type DeleteSSHKeyRequest = { sshKeyId: string } +export type DeleteSamlCertificateRequest = { + /** + * ID of the certificate to delete. + */ + certificateId: string +} + export type DeleteUserMFAOTPRequest = { /** * User ID of the MFA OTP. @@ -1075,6 +1152,13 @@ export type GetOrganizationRequest = { organizationId?: string } +export type GetOrganizationSamlRequest = { + /** + * ID of the Organization. + */ + organizationId?: string +} + export type GetOrganizationSecuritySettingsRequest = { /** * ID of the Organization. @@ -1605,6 +1689,20 @@ export interface ListSSHKeysResponse { totalCount: number } +export type ListSamlCertificatesRequest = { + /** + * ID of the SAML configuration. + */ + samlId: string +} + +export interface ListSamlCertificatesResponse { + /** + * List of SAML certificates. + */ + certificates: SamlCertificate[] +} + export type ListUsersRequest = { /** * Criteria for sorting results. @@ -1729,6 +1827,21 @@ export type RemoveUserConnectionRequest = { targetUserId: string } +export interface Saml { + /** + * ID of the SAML configuration. + */ + id: string + /** + * Entity ID of the SAML Identity Provider. + */ + entityId: string + /** + * Single Sign-On URL of the SAML Identity Provider. + */ + singleSignOnUrl: string +} + export type SetGroupMembersRequest = { groupId: string userIds: string[] @@ -1824,6 +1937,21 @@ export type UpdateGroupRequest = { tags?: string[] } +export type UpdateOrganizationSamlRequest = { + /** + * ID of the Organization. + */ + organizationId?: string + /** + * Entity ID of the SAML Identity Provider. + */ + entityId?: string + /** + * Single Sign-On URL of the SAML Identity Provider. + */ + singleSignOnUrl?: string +} + export type UpdateOrganizationSecuritySettingsRequest = { /** * ID of the Organization. diff --git a/packages_generated/iam/src/v1alpha1/validation-rules.gen.ts b/packages_generated/iam/src/v1alpha1/validation-rules.gen.ts index 151913785..f0251a9a3 100644 --- a/packages_generated/iam/src/v1alpha1/validation-rules.gen.ts +++ b/packages_generated/iam/src/v1alpha1/validation-rules.gen.ts @@ -1,6 +1,13 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. +export const AddSamlCertificateRequest = { + content: { + maxLength: 16384, + minLength: 1, + }, +} + export const CreateAPIKeyRequest = { description: { ignoreEmpty: true, @@ -32,6 +39,13 @@ export const CreateGroupRequest = { }, } +export const CreateOrganizationSamlRequest = { + entityId: { + maxLength: 1024, + minLength: 1, + }, +} + export const CreatePolicyRequest = { description: { ignoreEmpty: true, @@ -266,6 +280,13 @@ export const UpdateGroupRequest = { }, } +export const UpdateOrganizationSamlRequest = { + entityId: { + maxLength: 1024, + minLength: 1, + }, +} + export const UpdateOrganizationSecuritySettingsRequest = { loginAttemptsBeforeLocked: { greaterThanOrEqual: 1,