def create_channel()

in source/customresources/custom-resource-py/lib/mediapackage.py [0:0]


def create_channel(config):
    response = mediapackage.create_channel(
        Description='live-streaming-on-aws',
        Id=config['ChannelId']
    )
    responseData['Arn'] = response['Arn']
    responseData['ChannelId'] = config['ChannelId']
    responseData['PrimaryUrl'] = response['HlsIngest']['IngestEndpoints'][0]['Url']
    responseData['PrimaryUser'] = response['HlsIngest']['IngestEndpoints'][0]['Username']
    responseData['PrimaryPassParam'] = response['HlsIngest']['IngestEndpoints'][0]['Username']
    # Also Add in the Domain and Path for this URL. 
    primaryUrlParsed = urlparse(response['HlsIngest']['IngestEndpoints'][0]['Url'])
    responseData['PrimaryUrlHostName'] = primaryUrlParsed.hostname
    responseData['PrimaryUrlPath'] = primaryUrlParsed.path

    # Adding Primary U/P to SSM Parameter store
    ssm.put_parameter(
        Name=response['HlsIngest']['IngestEndpoints'][0]['Username'],
        Description='live-streaming-on-aws MediaPackage Primary Ingest Username',
        Value=response['HlsIngest']['IngestEndpoints'][0]['Password'],
        Type='String'
    )

    return responseData