aws / aws-sdk-go

AWS SDK for the Go programming language.

Home Page:http://aws.amazon.com/sdk-for-go/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create a MediaTailor configuration using the API

Shaharbad opened this issue · comments

Describe the bug

Hey everyone,

I kindly need your help with creating a MediaTailor configuration using the API, I am completely lost with this, after looking at the documentation I couldn't find a proper method to create a configuration.

Expected Behavior

what I'm looking for is creating a configuration using a content source url, ad decision server url and a configuration name, and then log the generated HLS when it's done.

Current Behavior

It's my first time working with the aws api and I've successfully installed Aws CLI in the meanwhile.

Reproduction Steps

I would appreciate any help! thanks.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1

Environment details (Version of Go (go version)? OS name and version, etc.)

go

Hi @Shaharbad ,

There you go:

package main

import (
	"context"
	"fmt"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/mediatailor"
)

func main() {
	sess, err := session.NewSession(&aws.Config{
		Region: aws.String("us-east-1"),
	})
	if err != nil {
		panic(err)
	}

	client := mediatailor.New(sess)

	out, err := client.PutPlaybackConfigurationWithContext(context.Background(), &mediatailor.PutPlaybackConfigurationInput{
		Name:                  aws.String("foo"),
		AdDecisionServerUrl:   aws.String("https://bazz.ads.com"),
		VideoContentSourceUrl: aws.String("https://foo.bar.com"),
	})
	if err != nil {
		panic(err)
	}

	fmt.Println(out.HlsConfiguration.String())
}

Thanks,
Ran~

This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

Hi @Shaharbad ,

There you go:

package main

import (
	"context"
	"fmt"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/mediatailor"
)

func main() {
	sess, err := session.NewSession(&aws.Config{
		Region: aws.String("us-east-1"),
	})
	if err != nil {
		panic(err)
	}

	client := mediatailor.New(sess)

	out, err := client.PutPlaybackConfigurationWithContext(context.Background(), &mediatailor.PutPlaybackConfigurationInput{
		Name:                  aws.String("foo"),
		AdDecisionServerUrl:   aws.String("https://bazz.ads.com"),
		VideoContentSourceUrl: aws.String("https://foo.bar.com"),
	})
	if err != nil {
		panic(err)
	}

	fmt.Println(out.HlsConfiguration.String())
}

Thanks, Ran~

Thank you! That solved it

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.