def create_endpoint()

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


def create_endpoint(config):
    if config.get('EndPoint') == 'HLS':
        response = mediapackage.create_origin_endpoint(
        	ChannelId=config['ChannelId'],
        	Id=config['ChannelId']+'-hls',
        	Description='SO00013 Live Streaming on AWS',
        	HlsPackage={
        		'IncludeIframeOnlyStream': False,
        		'PlaylistType': 'NONE',
        		'PlaylistWindowSeconds': 60,
        		'ProgramDateTimeIntervalSeconds': 0,
        		'SegmentDurationSeconds': int(config['SegmentDurationSeconds']),
        		'UseAudioRenditionGroup': False,
                'AdMarkers':'PASSTHROUGH'
        	},
        	ManifestName='index',
        	StartoverWindowSeconds=0,
        	TimeDelaySeconds=0,
        )
    elif config.get('EndPoint') == 'DASH':
        response = mediapackage.create_origin_endpoint(
        	ChannelId=config['ChannelId'],
        	Id=config['ChannelId']+'-dash',
        	Description='SO00013 Live Streaming on AWS',
        	DashPackage={
    			'ManifestWindowSeconds': 60,
    			'MinBufferTimeSeconds': 30,
    			'MinUpdatePeriodSeconds': 15,
    			'Profile': 'NONE',
    			'SegmentDurationSeconds': 2,
    			'SuggestedPresentationDelaySeconds': 25
        	},
        	ManifestName='index',
        	StartoverWindowSeconds=0,
        	TimeDelaySeconds=0,
        )
    elif config.get('EndPoint') == 'MSS':
        response = mediapackage.create_origin_endpoint(
        	ChannelId=config['ChannelId'],
        	Id=config['ChannelId']+'-mss',
        	Description='SO00013 Live Streaming on AWS',
        	MssPackage={
    			'ManifestWindowSeconds': 60,
    			'SegmentDurationSeconds': 2,
        	},
        	ManifestName='index',
        	StartoverWindowSeconds=0,
        	TimeDelaySeconds=0,
        )
    elif config.get('EndPoint') == 'CMAF':
        response = mediapackage.create_origin_endpoint(
        	ChannelId=config['ChannelId'],
        	Id=config['ChannelId']+'-cmaf',
        	Description='SO00013 Live Streaming on AWS',
            CmafPackage={
            	'HlsManifests':[{
            	    'Id': config['ChannelId']+'-cmaf-hls',
            		'IncludeIframeOnlyStream': False,
            		'PlaylistType': 'NONE',
            		'PlaylistWindowSeconds': 60,
            		'ProgramDateTimeIntervalSeconds': 0,
                    'AdMarkers':'PASSTHROUGH'
            	}],
                'SegmentDurationSeconds':6
            },
        	ManifestName='index',
        	StartoverWindowSeconds=0,
        	TimeDelaySeconds=0,
        )
    else:
        print('RESPONSE:: EndPoint type [HLS,DASH,MSS] not defined')
        return


    if config.get('EndPoint') == 'CMAF':
        url= urlparse(response['CmafPackage']['HlsManifests'][0]['Url'])
    else:
        url = urlparse(response['Url'])

    responseData['Id'] = response['Id']
    responseData['DomainName']=url.hostname
    responseData['Path']='/'+url.path.split('/')[-3]
    responseData['Manifest'] = url.path[7:]
    print('RESPONSE::{}'.format(responseData))
    return responseData