transcoder
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package transcoder is an auto-generated package for theTranscoder API.
This API converts video files into formats suitable for consumerdistribution. For more information, see the TranscoderAPI overview (athttps://cloud.google.com/transcoder/docs/concepts/overview).
General documentation¶
For information that is relevant for all client libraries please referencehttps://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on thispage includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage¶
To get started with this package, create a client.
// go get cloud.google.com/go/video/transcoder/apiv1@latestctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()The client will use your default application credentials. Clients should be reused instead of created as needed.The methods of Client are safe for concurrent use by multiple goroutines.The returned client must be Closed when it is done being used.
Using the Client¶
The following is an example of making an API call with the newly created client, mentioned above.
req := &transcoderpb.CreateJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#CreateJobRequest.}resp, err := c.CreateJob(ctx, req)if err != nil {// TODO: Handle error.}// TODO: Use resp._ = respUse of Context¶
The ctx passed to NewClient is used for authentication requests andfor creating the underlying connection, but is not used for subsequent calls.Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index¶
- func DefaultAuthScopes() []string
- type CallOptions
- type Client
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConndeprecated
- func (c *Client) CreateJob(ctx context.Context, req *transcoderpb.CreateJobRequest, ...) (*transcoderpb.Job, error)
- func (c *Client) CreateJobTemplate(ctx context.Context, req *transcoderpb.CreateJobTemplateRequest, ...) (*transcoderpb.JobTemplate, error)
- func (c *Client) DeleteJob(ctx context.Context, req *transcoderpb.DeleteJobRequest, ...) error
- func (c *Client) DeleteJobTemplate(ctx context.Context, req *transcoderpb.DeleteJobTemplateRequest, ...) error
- func (c *Client) GetJob(ctx context.Context, req *transcoderpb.GetJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error)
- func (c *Client) GetJobTemplate(ctx context.Context, req *transcoderpb.GetJobTemplateRequest, ...) (*transcoderpb.JobTemplate, error)
- func (c *Client) ListJobTemplates(ctx context.Context, req *transcoderpb.ListJobTemplatesRequest, ...) *JobTemplateIterator
- func (c *Client) ListJobs(ctx context.Context, req *transcoderpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator
- type JobIterator
- type JobTemplateIterator
Examples¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcDefaultAuthScopes¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types¶
typeCallOptions¶
type CallOptions struct {CreateJob []gax.CallOptionListJobs []gax.CallOptionGetJob []gax.CallOptionDeleteJob []gax.CallOptionCreateJobTemplate []gax.CallOptionListJobTemplates []gax.CallOptionGetJobTemplate []gax.CallOptionDeleteJobTemplate []gax.CallOption}CallOptions contains the retry settings for each method of Client.
typeClient¶
type Client struct {// The call options for this service.CallOptions *CallOptions// contains filtered or unexported fields}Client is a client for interacting with Transcoder API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Using the Transcoder API, you can queue asynchronous jobs for transcodingmedia into various output formats. Output formats may include differentstreaming standards such as HTTP Live Streaming (HLS) and Dynamic AdaptiveStreaming over HTTP (DASH). You can also customize jobs using advancedfeatures such as Digital Rights Management (DRM), audio equalization, contentconcatenation, and digital ad-stitch ready content generation.
funcNewClient¶
NewClient creates a new transcoder service client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Using the Transcoder API, you can queue asynchronous jobs for transcodingmedia into various output formats. Output formats may include differentstreaming standards such as HTTP Live Streaming (HLS) and Dynamic AdaptiveStreaming over HTTP (DASH). You can also customize jobs using advancedfeatures such as Digital Rights Management (DRM), audio equalization, contentconcatenation, and digital ad-stitch ready content generation.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()// TODO: Use client._ = c}funcNewRESTClient¶added inv1.12.0
NewRESTClient creates a new transcoder service rest client.
Using the Transcoder API, you can queue asynchronous jobs for transcodingmedia into various output formats. Output formats may include differentstreaming standards such as HTTP Live Streaming (HLS) and Dynamic AdaptiveStreaming over HTTP (DASH). You can also customize jobs using advancedfeatures such as Digital Rights Management (DRM), audio equalization, contentconcatenation, and digital ad-stitch ready content generation.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewRESTClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()// TODO: Use client._ = c}func (*Client)Close¶
Close closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*Client)Connectiondeprecated
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*Client)CreateJob¶
func (c *Client) CreateJob(ctxcontext.Context, req *transcoderpb.CreateJobRequest, opts ...gax.CallOption) (*transcoderpb.Job,error)
CreateJob creates a job in the specified region.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.CreateJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#CreateJobRequest.}resp, err := c.CreateJob(ctx, req)if err != nil {// TODO: Handle error.}// TODO: Use resp._ = resp}func (*Client)CreateJobTemplate¶
func (c *Client) CreateJobTemplate(ctxcontext.Context, req *transcoderpb.CreateJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate,error)
CreateJobTemplate creates a job template in the specified region.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.CreateJobTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#CreateJobTemplateRequest.}resp, err := c.CreateJobTemplate(ctx, req)if err != nil {// TODO: Handle error.}// TODO: Use resp._ = resp}func (*Client)DeleteJob¶
func (c *Client) DeleteJob(ctxcontext.Context, req *transcoderpb.DeleteJobRequest, opts ...gax.CallOption)error
DeleteJob deletes a job.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.DeleteJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#DeleteJobRequest.}err = c.DeleteJob(ctx, req)if err != nil {// TODO: Handle error.}}func (*Client)DeleteJobTemplate¶
func (c *Client) DeleteJobTemplate(ctxcontext.Context, req *transcoderpb.DeleteJobTemplateRequest, opts ...gax.CallOption)error
DeleteJobTemplate deletes a job template.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.DeleteJobTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#DeleteJobTemplateRequest.}err = c.DeleteJobTemplate(ctx, req)if err != nil {// TODO: Handle error.}}func (*Client)GetJob¶
func (c *Client) GetJob(ctxcontext.Context, req *transcoderpb.GetJobRequest, opts ...gax.CallOption) (*transcoderpb.Job,error)
GetJob returns the job data.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.GetJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#GetJobRequest.}resp, err := c.GetJob(ctx, req)if err != nil {// TODO: Handle error.}// TODO: Use resp._ = resp}func (*Client)GetJobTemplate¶
func (c *Client) GetJobTemplate(ctxcontext.Context, req *transcoderpb.GetJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate,error)
GetJobTemplate returns the job template data.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.GetJobTemplateRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#GetJobTemplateRequest.}resp, err := c.GetJobTemplate(ctx, req)if err != nil {// TODO: Handle error.}// TODO: Use resp._ = resp}func (*Client)ListJobTemplates¶
func (c *Client) ListJobTemplates(ctxcontext.Context, req *transcoderpb.ListJobTemplatesRequest, opts ...gax.CallOption) *JobTemplateIterator
ListJobTemplates lists job templates in the specified region.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb""google.golang.org/api/iterator")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.ListJobTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#ListJobTemplatesRequest.}it := c.ListJobTemplates(ctx, req)for {resp, err := it.Next()if err == iterator.Done {break}if err != nil {// TODO: Handle error.}// TODO: Use resp._ = resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._ = it.Response.(*transcoderpb.ListJobTemplatesResponse)}}Example (All)¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.ListJobTemplatesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#ListJobTemplatesRequest.}for resp, err := range c.ListJobTemplates(ctx, req).All() {if err != nil {// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._ = resp}}func (*Client)ListJobs¶
func (c *Client) ListJobs(ctxcontext.Context, req *transcoderpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator
ListJobs lists jobs in the specified region.
Example¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb""google.golang.org/api/iterator")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.ListJobsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#ListJobsRequest.}it := c.ListJobs(ctx, req)for {resp, err := it.Next()if err == iterator.Done {break}if err != nil {// TODO: Handle error.}// TODO: Use resp._ = resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._ = it.Response.(*transcoderpb.ListJobsResponse)}}Example (All)¶
package mainimport ("context"transcoder "cloud.google.com/go/video/transcoder/apiv1"transcoderpb "cloud.google.com/go/video/transcoder/apiv1/transcoderpb")func main() {ctx := context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc, err := transcoder.NewClient(ctx)if err != nil {// TODO: Handle error.}defer c.Close()req := &transcoderpb.ListJobsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/video/transcoder/apiv1/transcoderpb#ListJobsRequest.}for resp, err := range c.ListJobs(ctx, req).All() {if err != nil {// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._ = resp}}typeJobIterator¶
type JobIterator struct {// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Response interface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetch func(pageSizeint, pageTokenstring) (results []*transcoderpb.Job, nextPageTokenstring, errerror)// contains filtered or unexported fields}JobIterator manages a stream of *transcoderpb.Job.
func (*JobIterator)All¶added inv1.23.1
func (it *JobIterator) All()iter.Seq2[*transcoderpb.Job,error]
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*JobIterator)Next¶
func (it *JobIterator) Next() (*transcoderpb.Job,error)
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*JobIterator)PageInfo¶
func (it *JobIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See thegoogle.golang.org/api/iterator package for details.
typeJobTemplateIterator¶
type JobTemplateIterator struct {// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Response interface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetch func(pageSizeint, pageTokenstring) (results []*transcoderpb.JobTemplate, nextPageTokenstring, errerror)// contains filtered or unexported fields}JobTemplateIterator manages a stream of *transcoderpb.JobTemplate.
func (*JobTemplateIterator)All¶added inv1.23.1
func (it *JobTemplateIterator) All()iter.Seq2[*transcoderpb.JobTemplate,error]
All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*JobTemplateIterator)Next¶
func (it *JobTemplateIterator) Next() (*transcoderpb.JobTemplate,error)
Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*JobTemplateIterator)PageInfo¶
func (it *JobTemplateIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See thegoogle.golang.org/api/iterator package for details.