diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index 5b83bc06bc58..6f55775d3d17 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -848,14 +848,6 @@ var microgenGapicConfigs = []*microgenConfig{ apiServiceConfigPath: "transcoder_v1.yaml", releaseLevel: "ga", }, - { - inputDirectoryPath: "google/cloud/video/transcoder/v1beta1", - pkg: "transcoder", - importPath: "cloud.google.com/go/video/transcoder/apiv1beta1", - gRPCServiceConfigPath: "transcoder_grpc_service_config.json", - apiServiceConfigPath: "transcoder_v1beta1.yaml", - releaseLevel: "beta", - }, { inputDirectoryPath: "google/cloud/workflows/v1beta", pkg: "workflows", diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/CreateJob/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/CreateJob/main.go deleted file mode 100644 index 7bef4b0d39a2..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/CreateJob/main.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_CreateJob_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#CreateJobRequest. - } - resp, err := c.CreateJob(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -// [END transcoder_v1beta1_generated_TranscoderService_CreateJob_sync] diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/CreateJobTemplate/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/CreateJobTemplate/main.go deleted file mode 100644 index 40a6c97aaa1f..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/CreateJobTemplate/main.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_CreateJobTemplate_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#CreateJobTemplateRequest. - } - resp, err := c.CreateJobTemplate(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -// [END transcoder_v1beta1_generated_TranscoderService_CreateJobTemplate_sync] diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/DeleteJob/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/DeleteJob/main.go deleted file mode 100644 index b47bc639c226..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/DeleteJob/main.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_DeleteJob_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#DeleteJobRequest. - } - err = c.DeleteJob(ctx, req) - if err != nil { - // TODO: Handle error. - } -} - -// [END transcoder_v1beta1_generated_TranscoderService_DeleteJob_sync] diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/DeleteJobTemplate/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/DeleteJobTemplate/main.go deleted file mode 100644 index 935d89c2f689..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/DeleteJobTemplate/main.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_DeleteJobTemplate_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#DeleteJobTemplateRequest. - } - err = c.DeleteJobTemplate(ctx, req) - if err != nil { - // TODO: Handle error. - } -} - -// [END transcoder_v1beta1_generated_TranscoderService_DeleteJobTemplate_sync] diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/GetJob/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/GetJob/main.go deleted file mode 100644 index 873b5db3eb29..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/GetJob/main.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_GetJob_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#GetJobRequest. - } - resp, err := c.GetJob(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -// [END transcoder_v1beta1_generated_TranscoderService_GetJob_sync] diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/GetJobTemplate/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/GetJobTemplate/main.go deleted file mode 100644 index a745871ebe59..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/GetJobTemplate/main.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_GetJobTemplate_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#GetJobTemplateRequest. - } - resp, err := c.GetJobTemplate(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -// [END transcoder_v1beta1_generated_TranscoderService_GetJobTemplate_sync] diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/ListJobTemplates/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/ListJobTemplates/main.go deleted file mode 100644 index 640b649315d8..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/ListJobTemplates/main.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_ListJobTemplates_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - "google.golang.org/api/iterator" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#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 - } -} - -// [END transcoder_v1beta1_generated_TranscoderService_ListJobTemplates_sync] diff --git a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/ListJobs/main.go b/internal/generated/snippets/video/transcoder/apiv1beta1/Client/ListJobs/main.go deleted file mode 100644 index da2a55971d28..000000000000 --- a/internal/generated/snippets/video/transcoder/apiv1beta1/Client/ListJobs/main.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. - -// [START transcoder_v1beta1_generated_TranscoderService_ListJobs_sync] - -package main - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - "google.golang.org/api/iterator" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func main() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#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 - } -} - -// [END transcoder_v1beta1_generated_TranscoderService_ListJobs_sync] diff --git a/video/transcoder/apiv1beta1/doc.go b/video/transcoder/apiv1beta1/doc.go deleted file mode 100644 index 407e4874c4ba..000000000000 --- a/video/transcoder/apiv1beta1/doc.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by protoc-gen-go_gapic. DO NOT EDIT. - -// Package transcoder is an auto-generated package for the -// Transcoder API. -// -// This API converts video files into formats suitable for consumer -// distribution. -// -// NOTE: This package is in beta. It is not stable, and may be subject to changes. -// -// Example usage -// -// To get started with this package, create a client. -// ctx := context.Background() -// c, 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. -// -// ctx := context.Background() -// c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#CreateJobRequest. -// } -// resp, err := c.CreateJob(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context -// -// The ctx passed to NewClient is used for authentication requests and -// for 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. -// -// For information about setting deadlines, reusing contexts, and more -// please visit https://pkg.go.dev/cloud.google.com/go. -package transcoder // import "cloud.google.com/go/video/transcoder/apiv1beta1" - -import ( - "context" - "os" - "runtime" - "strconv" - "strings" - "unicode" - - "google.golang.org/api/option" - "google.golang.org/grpc/metadata" -) - -// For more information on implementing a client constructor hook, see -// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. -type clientHookParams struct{} -type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) - -const versionClient = "20220205" - -func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { - out, _ := metadata.FromOutgoingContext(ctx) - out = out.Copy() - for _, md := range mds { - for k, v := range md { - out[k] = append(out[k], v...) - } - } - return metadata.NewOutgoingContext(ctx, out) -} - -func checkDisableDeadlines() (bool, error) { - raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") - if !ok { - return false, nil - } - - b, err := strconv.ParseBool(raw) - return b, err -} - -// DefaultAuthScopes reports the default set of authentication scopes to use with this package. -func DefaultAuthScopes() []string { - return []string{ - "https://www.googleapis.com/auth/cloud-platform", - } -} - -// versionGo returns the Go runtime version. The returned string -// has no whitespace, suitable for reporting in header. -func versionGo() string { - const develPrefix = "devel +" - - s := runtime.Version() - if strings.HasPrefix(s, develPrefix) { - s = s[len(develPrefix):] - if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { - s = s[:p] - } - return s - } - - notSemverRune := func(r rune) bool { - return !strings.ContainsRune("0123456789.", r) - } - - if strings.HasPrefix(s, "go1") { - s = s[2:] - var prerelease string - if p := strings.IndexFunc(s, notSemverRune); p >= 0 { - s, prerelease = s[:p], s[p:] - } - if strings.HasSuffix(s, ".") { - s += "0" - } else if strings.Count(s, ".") < 2 { - s += ".0" - } - if prerelease != "" { - s += "-" + prerelease - } - return s - } - return "UNKNOWN" -} diff --git a/video/transcoder/apiv1beta1/gapic_metadata.json b/video/transcoder/apiv1beta1/gapic_metadata.json deleted file mode 100644 index 4a92159ad674..000000000000 --- a/video/transcoder/apiv1beta1/gapic_metadata.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.cloud.video.transcoder.v1beta1", - "libraryPackage": "cloud.google.com/go/video/transcoder/apiv1beta1", - "services": { - "TranscoderService": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "CreateJob": { - "methods": [ - "CreateJob" - ] - }, - "CreateJobTemplate": { - "methods": [ - "CreateJobTemplate" - ] - }, - "DeleteJob": { - "methods": [ - "DeleteJob" - ] - }, - "DeleteJobTemplate": { - "methods": [ - "DeleteJobTemplate" - ] - }, - "GetJob": { - "methods": [ - "GetJob" - ] - }, - "GetJobTemplate": { - "methods": [ - "GetJobTemplate" - ] - }, - "ListJobTemplates": { - "methods": [ - "ListJobTemplates" - ] - }, - "ListJobs": { - "methods": [ - "ListJobs" - ] - } - } - } - } - } - } -} diff --git a/video/transcoder/apiv1beta1/transcoder_client.go b/video/transcoder/apiv1beta1/transcoder_client.go deleted file mode 100644 index 75a32cc83cfe..000000000000 --- a/video/transcoder/apiv1beta1/transcoder_client.go +++ /dev/null @@ -1,557 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by protoc-gen-go_gapic. DO NOT EDIT. - -package transcoder - -import ( - "context" - "fmt" - "math" - "net/url" - "time" - - gax "github.com/googleapis/gax-go/v2" - "google.golang.org/api/iterator" - "google.golang.org/api/option" - "google.golang.org/api/option/internaloption" - gtransport "google.golang.org/api/transport/grpc" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" - "google.golang.org/protobuf/proto" -) - -var newClientHook clientHook - -// CallOptions contains the retry settings for each method of Client. -type CallOptions struct { - CreateJob []gax.CallOption - ListJobs []gax.CallOption - GetJob []gax.CallOption - DeleteJob []gax.CallOption - CreateJobTemplate []gax.CallOption - ListJobTemplates []gax.CallOption - GetJobTemplate []gax.CallOption - DeleteJobTemplate []gax.CallOption -} - -func defaultGRPCClientOptions() []option.ClientOption { - return []option.ClientOption{ - internaloption.WithDefaultEndpoint("transcoder.googleapis.com:443"), - internaloption.WithDefaultMTLSEndpoint("transcoder.mtls.googleapis.com:443"), - internaloption.WithDefaultAudience("https://transcoder.googleapis.com/"), - internaloption.WithDefaultScopes(DefaultAuthScopes()...), - internaloption.EnableJwtWithScope(), - option.WithGRPCDialOption(grpc.WithDefaultCallOptions( - grpc.MaxCallRecvMsgSize(math.MaxInt32))), - } -} - -func defaultCallOptions() *CallOptions { - return &CallOptions{ - CreateJob: []gax.CallOption{}, - ListJobs: []gax.CallOption{}, - GetJob: []gax.CallOption{}, - DeleteJob: []gax.CallOption{}, - CreateJobTemplate: []gax.CallOption{}, - ListJobTemplates: []gax.CallOption{}, - GetJobTemplate: []gax.CallOption{}, - DeleteJobTemplate: []gax.CallOption{}, - } -} - -// internalClient is an interface that defines the methods availaible from Transcoder API. -type internalClient interface { - Close() error - setGoogleClientInfo(...string) - Connection() *grpc.ClientConn - CreateJob(context.Context, *transcoderpb.CreateJobRequest, ...gax.CallOption) (*transcoderpb.Job, error) - ListJobs(context.Context, *transcoderpb.ListJobsRequest, ...gax.CallOption) *JobIterator - GetJob(context.Context, *transcoderpb.GetJobRequest, ...gax.CallOption) (*transcoderpb.Job, error) - DeleteJob(context.Context, *transcoderpb.DeleteJobRequest, ...gax.CallOption) error - CreateJobTemplate(context.Context, *transcoderpb.CreateJobTemplateRequest, ...gax.CallOption) (*transcoderpb.JobTemplate, error) - ListJobTemplates(context.Context, *transcoderpb.ListJobTemplatesRequest, ...gax.CallOption) *JobTemplateIterator - GetJobTemplate(context.Context, *transcoderpb.GetJobTemplateRequest, ...gax.CallOption) (*transcoderpb.JobTemplate, error) - DeleteJobTemplate(context.Context, *transcoderpb.DeleteJobTemplateRequest, ...gax.CallOption) error -} - -// 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 transcoding -// media into various output formats. Output formats may include different -// streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive -// Streaming over HTTP (DASH). You can also customize jobs using advanced -// features such as Digital Rights Management (DRM), audio equalization, content -// concatenation, and digital ad-stitch ready content generation. -// -// Deprecated: TranscoderService may be removed in a future version. -type Client struct { - // The internal transport-dependent client. - internalClient internalClient - - // The call options for this service. - CallOptions *CallOptions -} - -// Wrapper methods routed to the internal client. - -// Close closes the connection to the API service. The user should invoke this when -// the client is no longer required. -func (c *Client) Close() error { - return c.internalClient.Close() -} - -// setGoogleClientInfo sets the name and version of the application in -// the `x-goog-api-client` header passed on each request. Intended for -// use by Google-written clients. -func (c *Client) setGoogleClientInfo(keyval ...string) { - c.internalClient.setGoogleClientInfo(keyval...) -} - -// Connection returns a connection to the API service. -// -// Deprecated. -func (c *Client) Connection() *grpc.ClientConn { - return c.internalClient.Connection() -} - -// CreateJob creates a job in the specified region. -func (c *Client) CreateJob(ctx context.Context, req *transcoderpb.CreateJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { - return c.internalClient.CreateJob(ctx, req, opts...) -} - -// ListJobs lists jobs in the specified region. -func (c *Client) ListJobs(ctx context.Context, req *transcoderpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { - return c.internalClient.ListJobs(ctx, req, opts...) -} - -// GetJob returns the job data. -func (c *Client) GetJob(ctx context.Context, req *transcoderpb.GetJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { - return c.internalClient.GetJob(ctx, req, opts...) -} - -// DeleteJob deletes a job. -func (c *Client) DeleteJob(ctx context.Context, req *transcoderpb.DeleteJobRequest, opts ...gax.CallOption) error { - return c.internalClient.DeleteJob(ctx, req, opts...) -} - -// CreateJobTemplate creates a job template in the specified region. -func (c *Client) CreateJobTemplate(ctx context.Context, req *transcoderpb.CreateJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { - return c.internalClient.CreateJobTemplate(ctx, req, opts...) -} - -// ListJobTemplates lists job templates in the specified region. -func (c *Client) ListJobTemplates(ctx context.Context, req *transcoderpb.ListJobTemplatesRequest, opts ...gax.CallOption) *JobTemplateIterator { - return c.internalClient.ListJobTemplates(ctx, req, opts...) -} - -// GetJobTemplate returns the job template data. -func (c *Client) GetJobTemplate(ctx context.Context, req *transcoderpb.GetJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { - return c.internalClient.GetJobTemplate(ctx, req, opts...) -} - -// DeleteJobTemplate deletes a job template. -func (c *Client) DeleteJobTemplate(ctx context.Context, req *transcoderpb.DeleteJobTemplateRequest, opts ...gax.CallOption) error { - return c.internalClient.DeleteJobTemplate(ctx, req, opts...) -} - -// gRPCClient is a client for interacting with Transcoder API over gRPC transport. -// -// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. -type gRPCClient struct { - // Connection pool of gRPC connections to the service. - connPool gtransport.ConnPool - - // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE - disableDeadlines bool - - // Points back to the CallOptions field of the containing Client - CallOptions **CallOptions - - // The gRPC API client. - client transcoderpb.TranscoderServiceClient - - // The x-goog-* metadata to be sent with each request. - xGoogMetadata metadata.MD -} - -// 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 transcoding -// media into various output formats. Output formats may include different -// streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive -// Streaming over HTTP (DASH). You can also customize jobs using advanced -// features such as Digital Rights Management (DRM), audio equalization, content -// concatenation, and digital ad-stitch ready content generation. -// -// Deprecated: TranscoderService may be removed in a future version. -func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { - clientOpts := defaultGRPCClientOptions() - if newClientHook != nil { - hookOpts, err := newClientHook(ctx, clientHookParams{}) - if err != nil { - return nil, err - } - clientOpts = append(clientOpts, hookOpts...) - } - - disableDeadlines, err := checkDisableDeadlines() - if err != nil { - return nil, err - } - - connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) - if err != nil { - return nil, err - } - client := Client{CallOptions: defaultCallOptions()} - - c := &gRPCClient{ - connPool: connPool, - disableDeadlines: disableDeadlines, - client: transcoderpb.NewTranscoderServiceClient(connPool), - CallOptions: &client.CallOptions, - } - c.setGoogleClientInfo() - - client.internalClient = c - - return &client, nil -} - -// Connection returns a connection to the API service. -// -// Deprecated. -func (c *gRPCClient) Connection() *grpc.ClientConn { - return c.connPool.Conn() -} - -// setGoogleClientInfo sets the name and version of the application in -// the `x-goog-api-client` header passed on each request. Intended for -// use by Google-written clients. -func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { - kv := append([]string{"gl-go", versionGo()}, keyval...) - kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) - c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) -} - -// Close closes the connection to the API service. The user should invoke this when -// the client is no longer required. -func (c *gRPCClient) Close() error { - return c.connPool.Close() -} - -func (c *gRPCClient) CreateJob(ctx context.Context, req *transcoderpb.CreateJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { - if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) - defer cancel() - ctx = cctx - } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).CreateJob[0:len((*c.CallOptions).CreateJob):len((*c.CallOptions).CreateJob)], opts...) - var resp *transcoderpb.Job - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.client.CreateJob(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *gRPCClient) ListJobs(ctx context.Context, req *transcoderpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).ListJobs[0:len((*c.CallOptions).ListJobs):len((*c.CallOptions).ListJobs)], opts...) - it := &JobIterator{} - req = proto.Clone(req).(*transcoderpb.ListJobsRequest) - it.InternalFetch = func(pageSize int, pageToken string) ([]*transcoderpb.Job, string, error) { - resp := &transcoderpb.ListJobsResponse{} - if pageToken != "" { - req.PageToken = pageToken - } - if pageSize > math.MaxInt32 { - req.PageSize = math.MaxInt32 - } else if pageSize != 0 { - req.PageSize = int32(pageSize) - } - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.client.ListJobs(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, "", err - } - - it.Response = resp - return resp.GetJobs(), resp.GetNextPageToken(), nil - } - fetch := func(pageSize int, pageToken string) (string, error) { - items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) - if err != nil { - return "", err - } - it.items = append(it.items, items...) - return nextPageToken, nil - } - - it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) - it.pageInfo.MaxSize = int(req.GetPageSize()) - it.pageInfo.Token = req.GetPageToken() - - return it -} - -func (c *gRPCClient) GetJob(ctx context.Context, req *transcoderpb.GetJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { - if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) - defer cancel() - ctx = cctx - } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).GetJob[0:len((*c.CallOptions).GetJob):len((*c.CallOptions).GetJob)], opts...) - var resp *transcoderpb.Job - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.client.GetJob(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *gRPCClient) DeleteJob(ctx context.Context, req *transcoderpb.DeleteJobRequest, opts ...gax.CallOption) error { - if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) - defer cancel() - ctx = cctx - } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).DeleteJob[0:len((*c.CallOptions).DeleteJob):len((*c.CallOptions).DeleteJob)], opts...) - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - _, err = c.client.DeleteJob(ctx, req, settings.GRPC...) - return err - }, opts...) - return err -} - -func (c *gRPCClient) CreateJobTemplate(ctx context.Context, req *transcoderpb.CreateJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { - if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) - defer cancel() - ctx = cctx - } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).CreateJobTemplate[0:len((*c.CallOptions).CreateJobTemplate):len((*c.CallOptions).CreateJobTemplate)], opts...) - var resp *transcoderpb.JobTemplate - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.client.CreateJobTemplate(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *gRPCClient) ListJobTemplates(ctx context.Context, req *transcoderpb.ListJobTemplatesRequest, opts ...gax.CallOption) *JobTemplateIterator { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).ListJobTemplates[0:len((*c.CallOptions).ListJobTemplates):len((*c.CallOptions).ListJobTemplates)], opts...) - it := &JobTemplateIterator{} - req = proto.Clone(req).(*transcoderpb.ListJobTemplatesRequest) - it.InternalFetch = func(pageSize int, pageToken string) ([]*transcoderpb.JobTemplate, string, error) { - resp := &transcoderpb.ListJobTemplatesResponse{} - if pageToken != "" { - req.PageToken = pageToken - } - if pageSize > math.MaxInt32 { - req.PageSize = math.MaxInt32 - } else if pageSize != 0 { - req.PageSize = int32(pageSize) - } - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.client.ListJobTemplates(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, "", err - } - - it.Response = resp - return resp.GetJobTemplates(), resp.GetNextPageToken(), nil - } - fetch := func(pageSize int, pageToken string) (string, error) { - items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) - if err != nil { - return "", err - } - it.items = append(it.items, items...) - return nextPageToken, nil - } - - it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) - it.pageInfo.MaxSize = int(req.GetPageSize()) - it.pageInfo.Token = req.GetPageToken() - - return it -} - -func (c *gRPCClient) GetJobTemplate(ctx context.Context, req *transcoderpb.GetJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { - if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) - defer cancel() - ctx = cctx - } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).GetJobTemplate[0:len((*c.CallOptions).GetJobTemplate):len((*c.CallOptions).GetJobTemplate)], opts...) - var resp *transcoderpb.JobTemplate - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - resp, err = c.client.GetJobTemplate(ctx, req, settings.GRPC...) - return err - }, opts...) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *gRPCClient) DeleteJobTemplate(ctx context.Context, req *transcoderpb.DeleteJobTemplateRequest, opts ...gax.CallOption) error { - if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { - cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) - defer cancel() - ctx = cctx - } - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) - ctx = insertMetadata(ctx, c.xGoogMetadata, md) - opts = append((*c.CallOptions).DeleteJobTemplate[0:len((*c.CallOptions).DeleteJobTemplate):len((*c.CallOptions).DeleteJobTemplate)], opts...) - err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { - var err error - _, err = c.client.DeleteJobTemplate(ctx, req, settings.GRPC...) - return err - }, opts...) - return err -} - -// JobIterator manages a stream of *transcoderpb.Job. -type JobIterator struct { - items []*transcoderpb.Job - pageInfo *iterator.PageInfo - nextFunc func() error - - // 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(pageSize int, pageToken string) (results []*transcoderpb.Job, nextPageToken string, err error) -} - -// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. -func (it *JobIterator) PageInfo() *iterator.PageInfo { - return it.pageInfo -} - -// Next returns the next result. Its second return value is iterator.Done if there are no more -// results. Once Next returns Done, all subsequent calls will return Done. -func (it *JobIterator) Next() (*transcoderpb.Job, error) { - var item *transcoderpb.Job - if err := it.nextFunc(); err != nil { - return item, err - } - item = it.items[0] - it.items = it.items[1:] - return item, nil -} - -func (it *JobIterator) bufLen() int { - return len(it.items) -} - -func (it *JobIterator) takeBuf() interface{} { - b := it.items - it.items = nil - return b -} - -// JobTemplateIterator manages a stream of *transcoderpb.JobTemplate. -type JobTemplateIterator struct { - items []*transcoderpb.JobTemplate - pageInfo *iterator.PageInfo - nextFunc func() error - - // 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(pageSize int, pageToken string) (results []*transcoderpb.JobTemplate, nextPageToken string, err error) -} - -// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. -func (it *JobTemplateIterator) PageInfo() *iterator.PageInfo { - return it.pageInfo -} - -// Next returns the next result. Its second return value is iterator.Done if there are no more -// results. Once Next returns Done, all subsequent calls will return Done. -func (it *JobTemplateIterator) Next() (*transcoderpb.JobTemplate, error) { - var item *transcoderpb.JobTemplate - if err := it.nextFunc(); err != nil { - return item, err - } - item = it.items[0] - it.items = it.items[1:] - return item, nil -} - -func (it *JobTemplateIterator) bufLen() int { - return len(it.items) -} - -func (it *JobTemplateIterator) takeBuf() interface{} { - b := it.items - it.items = nil - return b -} diff --git a/video/transcoder/apiv1beta1/transcoder_client_example_test.go b/video/transcoder/apiv1beta1/transcoder_client_example_test.go deleted file mode 100644 index 45ccdc47f3fa..000000000000 --- a/video/transcoder/apiv1beta1/transcoder_client_example_test.go +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by protoc-gen-go_gapic. DO NOT EDIT. - -package transcoder_test - -import ( - "context" - - transcoder "cloud.google.com/go/video/transcoder/apiv1beta1" - "google.golang.org/api/iterator" - transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" -) - -func ExampleNewClient() { - ctx := context.Background() - c, err := transcoder.NewClient(ctx) - if err != nil { - // TODO: Handle error. - } - defer c.Close() - - // TODO: Use client. - _ = c -} - -func ExampleClient_CreateJob() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#CreateJobRequest. - } - resp, err := c.CreateJob(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -func ExampleClient_ListJobs() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#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 - } -} - -func ExampleClient_GetJob() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#GetJobRequest. - } - resp, err := c.GetJob(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -func ExampleClient_DeleteJob() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#DeleteJobRequest. - } - err = c.DeleteJob(ctx, req) - if err != nil { - // TODO: Handle error. - } -} - -func ExampleClient_CreateJobTemplate() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#CreateJobTemplateRequest. - } - resp, err := c.CreateJobTemplate(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -func ExampleClient_ListJobTemplates() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#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 - } -} - -func ExampleClient_GetJobTemplate() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#GetJobTemplateRequest. - } - resp, err := c.GetJobTemplate(ctx, req) - if err != nil { - // TODO: Handle error. - } - // TODO: Use resp. - _ = resp -} - -func ExampleClient_DeleteJobTemplate() { - ctx := context.Background() - c, 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/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1#DeleteJobTemplateRequest. - } - err = c.DeleteJobTemplate(ctx, req) - if err != nil { - // TODO: Handle error. - } -}