public addManagedEndpoint()

in core/src/emr-eks-platform/emr-eks-cluster.ts [523:562]


  public addManagedEndpoint(scope: Construct, id: string, options: EmrManagedEndpointOptions) {

    if (options.managedEndpointName.length > 64) {
      throw new Error(`error managed endpoint name length is greater than 64 ${id}`);
    }

    if (options.emrOnEksVersion && ! EmrEksCluster.EMR_VERSIONS.includes(options.emrOnEksVersion)) {
      throw new Error(`error unsupported EMR version ${options.emrOnEksVersion}`);
    }

    if (this.notebookDefaultConfig == undefined) {
      throw new Error('error empty configuration override is not supported on non-default nodegroups');
    }

    let jsonConfigurationOverrides: string | undefined;

    try {
      //Check if the configOverride provided by user is valid
      let isConfigOverrideValid: boolean = validateSchema(JSON.stringify(configOverrideSchema), options.configurationOverrides);

      jsonConfigurationOverrides = isConfigOverrideValid ? options.configurationOverrides : this.notebookDefaultConfig;

    } catch (error) {
      throw new Error(`The configuration override is not valid JSON : ${options.configurationOverrides}`);
    }
    // Create custom resource with async waiter until the Amazon EMR Managed Endpoint is created
    const cr = new CustomResource(scope, id, {
      serviceToken: this.managedEndpointProviderServiceToken,
      properties: {
        clusterId: options.virtualClusterId,
        executionRoleArn: options.executionRole.roleArn,
        endpointName: options.managedEndpointName,
        releaseLabel: options.emrOnEksVersion || EmrEksCluster.DEFAULT_EMR_VERSION,
        configurationOverrides: jsonConfigurationOverrides,
      },
    });
    cr.node.addDependency(this.eksCluster);

    return cr;
  }