Skip to content

Commit 486aa0e

Browse files
authored
feat(iam): add GetOrganization and SetOrganizationAlias (#2183)
1 parent 275f08c commit 486aa0e

File tree

5 files changed

+106
-0
lines changed

5 files changed

+106
-0
lines changed

packages_generated/iam/src/v1alpha1/api.gen.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
marshalRemoveGroupMemberRequest,
2222
marshalRemoveUserConnectionRequest,
2323
marshalSetGroupMembersRequest,
24+
marshalSetOrganizationAliasRequest,
2425
marshalSetRulesRequest,
2526
marshalUpdateAPIKeyRequest,
2627
marshalUpdateApplicationRequest,
@@ -53,6 +54,7 @@ import {
5354
unmarshalListUsersResponse,
5455
unmarshalLog,
5556
unmarshalMFAOTP,
57+
unmarshalOrganization,
5658
unmarshalOrganizationSecuritySettings,
5759
unmarshalPolicy,
5860
unmarshalQuotum,
@@ -89,6 +91,7 @@ import type {
8991
GetGroupRequest,
9092
GetJWTRequest,
9193
GetLogRequest,
94+
GetOrganizationRequest,
9295
GetOrganizationSecuritySettingsRequest,
9396
GetPolicyRequest,
9497
GetQuotumRequest,
@@ -129,13 +132,15 @@ import type {
129132
Log,
130133
MFAOTP,
131134
MigrateOrganizationGuestsRequest,
135+
Organization,
132136
OrganizationSecuritySettings,
133137
Policy,
134138
Quotum,
135139
RemoveGroupMemberRequest,
136140
RemoveUserConnectionRequest,
137141
SSHKey,
138142
SetGroupMembersRequest,
143+
SetOrganizationAliasRequest,
139144
SetRulesRequest,
140145
SetRulesResponse,
141146
UnlockUserRequest,
@@ -1338,6 +1343,40 @@ export class API extends ParentAPI {
13381343
unmarshalOrganizationSecuritySettings,
13391344
)
13401345

1346+
/**
1347+
* Set your Organization's alias.. This will fail if an alias has already been defined. Please contact support if you need to change your Organization's alias.
1348+
*
1349+
* @param request - The request {@link SetOrganizationAliasRequest}
1350+
* @returns A Promise of Organization
1351+
*/
1352+
setOrganizationAlias = (request: Readonly<SetOrganizationAliasRequest>) =>
1353+
this.client.fetch<Organization>(
1354+
{
1355+
body: JSON.stringify(
1356+
marshalSetOrganizationAliasRequest(request, this.client.settings),
1357+
),
1358+
headers: jsonContentHeaders,
1359+
method: 'PUT',
1360+
path: `/iam/v1alpha1/organizations/${validatePathParam('organizationId', request.organizationId ?? this.client.settings.defaultOrganizationId)}/alias`,
1361+
},
1362+
unmarshalOrganization,
1363+
)
1364+
1365+
/**
1366+
* Get your Organization's IAM information.
1367+
*
1368+
* @param request - The request {@link GetOrganizationRequest}
1369+
* @returns A Promise of Organization
1370+
*/
1371+
getOrganization = (request: Readonly<GetOrganizationRequest> = {}) =>
1372+
this.client.fetch<Organization>(
1373+
{
1374+
method: 'GET',
1375+
path: `/iam/v1alpha1/organizations/${validatePathParam('organizationId', request.organizationId ?? this.client.settings.defaultOrganizationId)}`,
1376+
},
1377+
unmarshalOrganization,
1378+
)
1379+
13411380
/**
13421381
* Migrate the organization's guests to IAM members.
13431382
*

packages_generated/iam/src/v1alpha1/index.gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export type {
3535
GetGroupRequest,
3636
GetJWTRequest,
3737
GetLogRequest,
38+
GetOrganizationRequest,
3839
GetOrganizationSecuritySettingsRequest,
3940
GetPolicyRequest,
4041
GetQuotumRequest,
@@ -90,6 +91,7 @@ export type {
9091
LogResourceType,
9192
MFAOTP,
9293
MigrateOrganizationGuestsRequest,
94+
Organization,
9395
OrganizationSecuritySettings,
9496
PermissionSet,
9597
PermissionSetScopeType,
@@ -102,6 +104,7 @@ export type {
102104
RuleSpecs,
103105
SSHKey,
104106
SetGroupMembersRequest,
107+
SetOrganizationAliasRequest,
105108
SetRulesRequest,
106109
SetRulesResponse,
107110
UnlockUserRequest,

packages_generated/iam/src/v1alpha1/marshalling.gen.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import type {
4545
ListUsersResponse,
4646
Log,
4747
MFAOTP,
48+
Organization,
4849
OrganizationSecuritySettings,
4950
PermissionSet,
5051
Policy,
@@ -56,6 +57,7 @@ import type {
5657
RuleSpecs,
5758
SSHKey,
5859
SetGroupMembersRequest,
60+
SetOrganizationAliasRequest,
5961
SetRulesRequest,
6062
SetRulesResponse,
6163
UpdateAPIKeyRequest,
@@ -626,6 +628,20 @@ export const unmarshalMFAOTP = (data: unknown): MFAOTP => {
626628
} as MFAOTP
627629
}
628630

631+
export const unmarshalOrganization = (data: unknown): Organization => {
632+
if (!isJSONObject(data)) {
633+
throw new TypeError(
634+
`Unmarshalling the type 'Organization' failed as data isn't a dictionary.`,
635+
)
636+
}
637+
638+
return {
639+
alias: data.alias,
640+
id: data.id,
641+
name: data.name,
642+
} as Organization
643+
}
644+
629645
export const unmarshalOrganizationSecuritySettings = (
630646
data: unknown,
631647
): OrganizationSecuritySettings => {
@@ -833,6 +849,13 @@ export const marshalSetGroupMembersRequest = (
833849
user_ids: request.userIds,
834850
})
835851

852+
export const marshalSetOrganizationAliasRequest = (
853+
request: SetOrganizationAliasRequest,
854+
defaults: DefaultValues,
855+
): Record<string, unknown> => ({
856+
alias: request.alias,
857+
})
858+
836859
export const marshalSetRulesRequest = (
837860
request: SetRulesRequest,
838861
defaults: DefaultValues,

packages_generated/iam/src/v1alpha1/types.gen.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,13 @@ export type GetLogRequest = {
10681068
logId: string
10691069
}
10701070

1071+
export type GetOrganizationRequest = {
1072+
/**
1073+
* ID of the Organization.
1074+
*/
1075+
organizationId?: string
1076+
}
1077+
10711078
export type GetOrganizationSecuritySettingsRequest = {
10721079
/**
10731080
* ID of the Organization.
@@ -1662,6 +1669,21 @@ export type MigrateOrganizationGuestsRequest = {
16621669
organizationId?: string
16631670
}
16641671

1672+
export interface Organization {
1673+
/**
1674+
* ID of the Organization.
1675+
*/
1676+
id: string
1677+
/**
1678+
* Name of the Organization.
1679+
*/
1680+
name: string
1681+
/**
1682+
* Alias of the Organization.
1683+
*/
1684+
alias: string
1685+
}
1686+
16651687
export interface OrganizationSecuritySettings {
16661688
/**
16671689
* Defines whether password renewal is enforced during first login.
@@ -1713,6 +1735,17 @@ export type SetGroupMembersRequest = {
17131735
applicationIds: string[]
17141736
}
17151737

1738+
export type SetOrganizationAliasRequest = {
1739+
/**
1740+
* ID of the Organization.
1741+
*/
1742+
organizationId?: string
1743+
/**
1744+
* Alias of the Organization.
1745+
*/
1746+
alias: string
1747+
}
1748+
17161749
export type SetRulesRequest = {
17171750
/**
17181751
* Id of policy to update.

packages_generated/iam/src/v1alpha1/validation-rules.gen.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ export const RuleSpecs = {
230230
},
231231
}
232232

233+
export const SetOrganizationAliasRequest = {
234+
alias: {
235+
maxLength: 32,
236+
minLength: 2,
237+
pattern: /^[a-z0-9]+$/,
238+
},
239+
}
240+
233241
export const UpdateAPIKeyRequest = {
234242
description: {
235243
maxLength: 200,

0 commit comments

Comments
 (0)