|
| 1 | +// Generated by cdk-import |
| 2 | +import * as cdk from "aws-cdk-lib"; |
| 3 | +import * as constructs from "constructs"; |
| 4 | + |
| 5 | +/** |
| 6 | + * Returns, adds, and edits organizational units in MongoDB Cloud. |
| 7 | + * |
| 8 | + * @schema CfnOrganizationProps |
| 9 | + */ |
| 10 | +export interface CfnOrganizationProps { |
| 11 | + /** |
| 12 | + * Human-readable label that identifies the organization. |
| 13 | + * |
| 14 | + * @schema CfnOrganizationProps#Name |
| 15 | + */ |
| 16 | + readonly name: string; |
| 17 | + |
| 18 | + /** |
| 19 | + * @schema CfnOrganizationProps#APIKey |
| 20 | + */ |
| 21 | + readonly apiKey?: ApiKey; |
| 22 | + |
| 23 | + /** |
| 24 | + * Unique 24-hexadecimal digit string that identifies the federation to link the newly created organization to. If specified, the proposed Organization Owner of the new organization must have the Organization Owner role in an organization associated with the federation. |
| 25 | + * |
| 26 | + * @schema CfnOrganizationProps#FederatedSettingsId |
| 27 | + */ |
| 28 | + readonly federatedSettingsId?: string; |
| 29 | + |
| 30 | + /** |
| 31 | + * Unique 24-hexadecimal digit string that identifies the MongoDB Cloud user that you want to assign the Organization Owner role. This user must be a member of the same organization as the calling API key. If you provide federationSettingsId, this user must instead have the Organization Owner role on an organization in the specified federation. This parameter is required only when you authenticate with Programmatic API Keys. |
| 32 | + * |
| 33 | + * @schema CfnOrganizationProps#OrgOwnerId |
| 34 | + */ |
| 35 | + readonly orgOwnerId: string; |
| 36 | + |
| 37 | + /** |
| 38 | + * Profile used to provide credentials information, (a secret with the cfn/atlas/profile/{Profile}, is required), if not provided default is used |
| 39 | + * |
| 40 | + * @schema CfnOrganizationProps#Profile |
| 41 | + */ |
| 42 | + readonly profile?: string; |
| 43 | + |
| 44 | + /** |
| 45 | + * AwsSecretName used to set newly created Org credentials information. |
| 46 | + * |
| 47 | + * @schema CfnOrganizationProps#AwsSecretName |
| 48 | + */ |
| 49 | + readonly awsSecretName: string; |
| 50 | + |
| 51 | + /** |
| 52 | + * Flag that indicates whether this organization has been deleted. |
| 53 | + * |
| 54 | + * @schema CfnOrganizationProps#IsDeleted |
| 55 | + */ |
| 56 | + readonly isDeleted?: boolean; |
| 57 | +} |
| 58 | + |
| 59 | +/** |
| 60 | + * Converts an object of type 'CfnOrganizationProps' to JSON representation. |
| 61 | + */ |
| 62 | +/* eslint-disable max-len, quote-props */ |
| 63 | +export function toJson_CfnOrganizationProps( |
| 64 | + obj: CfnOrganizationProps | undefined |
| 65 | +): Record<string, any> | undefined { |
| 66 | + if (obj === undefined) { |
| 67 | + return undefined; |
| 68 | + } |
| 69 | + const result = { |
| 70 | + Name: obj.name, |
| 71 | + APIKey: toJson_ApiKey(obj.apiKey), |
| 72 | + FederatedSettingsId: obj.federatedSettingsId, |
| 73 | + OrgOwnerId: obj.orgOwnerId, |
| 74 | + Profile: obj.profile, |
| 75 | + AwsSecretName: obj.awsSecretName, |
| 76 | + IsDeleted: obj.isDeleted, |
| 77 | + }; |
| 78 | + // filter undefined values |
| 79 | + return Object.entries(result).reduce( |
| 80 | + (r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }), |
| 81 | + {} |
| 82 | + ); |
| 83 | +} |
| 84 | +/* eslint-enable max-len, quote-props */ |
| 85 | + |
| 86 | +/** |
| 87 | + * @schema APIKey |
| 88 | + */ |
| 89 | +export interface ApiKey { |
| 90 | + /** |
| 91 | + * Purpose or explanation provided when someone created this organization API key. 1 to 250 characters |
| 92 | + * |
| 93 | + * @schema APIKey#Description |
| 94 | + */ |
| 95 | + readonly description?: string; |
| 96 | + |
| 97 | + /** |
| 98 | + * List of roles to grant this API key. If you provide this list, provide a minimum of one role and ensure each role applies to this organization. |
| 99 | + * |
| 100 | + * @schema APIKey#Roles |
| 101 | + */ |
| 102 | + readonly roles?: string[]; |
| 103 | +} |
| 104 | + |
| 105 | +/** |
| 106 | + * Converts an object of type 'ApiKey' to JSON representation. |
| 107 | + */ |
| 108 | +/* eslint-disable max-len, quote-props */ |
| 109 | +export function toJson_ApiKey( |
| 110 | + obj: ApiKey | undefined |
| 111 | +): Record<string, any> | undefined { |
| 112 | + if (obj === undefined) { |
| 113 | + return undefined; |
| 114 | + } |
| 115 | + const result = { |
| 116 | + Description: obj.description, |
| 117 | + Roles: obj.roles?.map((y) => y), |
| 118 | + }; |
| 119 | + // filter undefined values |
| 120 | + return Object.entries(result).reduce( |
| 121 | + (r, i) => (i[1] === undefined ? r : { ...r, [i[0]]: i[1] }), |
| 122 | + {} |
| 123 | + ); |
| 124 | +} |
| 125 | +/* eslint-enable max-len, quote-props */ |
| 126 | + |
| 127 | +/** |
| 128 | + * A CloudFormation `MongoDB::Atlas::Organization` |
| 129 | + * |
| 130 | + * @cloudformationResource MongoDB::Atlas::Organization |
| 131 | + * @stability external |
| 132 | + */ |
| 133 | +export class CfnOrganization extends cdk.CfnResource { |
| 134 | + /** |
| 135 | + * The CloudFormation resource type name for this resource class. |
| 136 | + */ |
| 137 | + public static readonly CFN_RESOURCE_TYPE_NAME = |
| 138 | + "MongoDB::Atlas::Organization"; |
| 139 | + |
| 140 | + /** |
| 141 | + * Resource props. |
| 142 | + */ |
| 143 | + public readonly props: CfnOrganizationProps; |
| 144 | + |
| 145 | + /** |
| 146 | + * Attribute `MongoDB::Atlas::Organization.OrgId` |
| 147 | + */ |
| 148 | + public readonly attrOrgId: string; |
| 149 | + |
| 150 | + /** |
| 151 | + * Create a new `MongoDB::Atlas::Organization`. |
| 152 | + * |
| 153 | + * @param scope - scope in which this resource is defined |
| 154 | + * @param id - scoped id of the resource |
| 155 | + * @param props - resource properties |
| 156 | + */ |
| 157 | + constructor( |
| 158 | + scope: constructs.Construct, |
| 159 | + id: string, |
| 160 | + props: CfnOrganizationProps |
| 161 | + ) { |
| 162 | + super(scope, id, { |
| 163 | + type: CfnOrganization.CFN_RESOURCE_TYPE_NAME, |
| 164 | + properties: toJson_CfnOrganizationProps(props)!, |
| 165 | + }); |
| 166 | + |
| 167 | + this.props = props; |
| 168 | + |
| 169 | + this.attrOrgId = cdk.Token.asString(this.getAtt("OrgId")); |
| 170 | + } |
| 171 | +} |
0 commit comments