1// Copyright 2021 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Code generated by protoc-gen-go_gapic. DO NOT EDIT. 16 17package transcoder 18 19import ( 20 "context" 21 "fmt" 22 "math" 23 "net/url" 24 "time" 25 26 gax "github.com/googleapis/gax-go/v2" 27 "google.golang.org/api/iterator" 28 "google.golang.org/api/option" 29 "google.golang.org/api/option/internaloption" 30 gtransport "google.golang.org/api/transport/grpc" 31 transcoderpb "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1beta1" 32 "google.golang.org/grpc" 33 "google.golang.org/grpc/metadata" 34 "google.golang.org/protobuf/proto" 35) 36 37var newClientHook clientHook 38 39// CallOptions contains the retry settings for each method of Client. 40type CallOptions struct { 41 CreateJob []gax.CallOption 42 ListJobs []gax.CallOption 43 GetJob []gax.CallOption 44 DeleteJob []gax.CallOption 45 CreateJobTemplate []gax.CallOption 46 ListJobTemplates []gax.CallOption 47 GetJobTemplate []gax.CallOption 48 DeleteJobTemplate []gax.CallOption 49} 50 51func defaultGRPCClientOptions() []option.ClientOption { 52 return []option.ClientOption{ 53 internaloption.WithDefaultEndpoint("transcoder.googleapis.com:443"), 54 internaloption.WithDefaultMTLSEndpoint("transcoder.mtls.googleapis.com:443"), 55 internaloption.WithDefaultAudience("https://transcoder.googleapis.com/"), 56 internaloption.WithDefaultScopes(DefaultAuthScopes()...), 57 internaloption.EnableJwtWithScope(), 58 option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), 59 option.WithGRPCDialOption(grpc.WithDefaultCallOptions( 60 grpc.MaxCallRecvMsgSize(math.MaxInt32))), 61 } 62} 63 64func defaultCallOptions() *CallOptions { 65 return &CallOptions{ 66 CreateJob: []gax.CallOption{}, 67 ListJobs: []gax.CallOption{}, 68 GetJob: []gax.CallOption{}, 69 DeleteJob: []gax.CallOption{}, 70 CreateJobTemplate: []gax.CallOption{}, 71 ListJobTemplates: []gax.CallOption{}, 72 GetJobTemplate: []gax.CallOption{}, 73 DeleteJobTemplate: []gax.CallOption{}, 74 } 75} 76 77// internalClient is an interface that defines the methods availaible from Transcoder API. 78type internalClient interface { 79 Close() error 80 setGoogleClientInfo(...string) 81 Connection() *grpc.ClientConn 82 CreateJob(context.Context, *transcoderpb.CreateJobRequest, ...gax.CallOption) (*transcoderpb.Job, error) 83 ListJobs(context.Context, *transcoderpb.ListJobsRequest, ...gax.CallOption) *JobIterator 84 GetJob(context.Context, *transcoderpb.GetJobRequest, ...gax.CallOption) (*transcoderpb.Job, error) 85 DeleteJob(context.Context, *transcoderpb.DeleteJobRequest, ...gax.CallOption) error 86 CreateJobTemplate(context.Context, *transcoderpb.CreateJobTemplateRequest, ...gax.CallOption) (*transcoderpb.JobTemplate, error) 87 ListJobTemplates(context.Context, *transcoderpb.ListJobTemplatesRequest, ...gax.CallOption) *JobTemplateIterator 88 GetJobTemplate(context.Context, *transcoderpb.GetJobTemplateRequest, ...gax.CallOption) (*transcoderpb.JobTemplate, error) 89 DeleteJobTemplate(context.Context, *transcoderpb.DeleteJobTemplateRequest, ...gax.CallOption) error 90} 91 92// Client is a client for interacting with Transcoder API. 93// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 94// 95// Using the Transcoder API, you can queue asynchronous jobs for transcoding 96// media into various output formats. Output formats may include different 97// streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive 98// Streaming over HTTP (DASH). You can also customize jobs using advanced 99// features such as Digital Rights Management (DRM), audio equalization, content 100// concatenation, and digital ad-stitch ready content generation. 101// 102// Deprecated: TranscoderService may be removed in a future version. 103type Client struct { 104 // The internal transport-dependent client. 105 internalClient internalClient 106 107 // The call options for this service. 108 CallOptions *CallOptions 109} 110 111// Wrapper methods routed to the internal client. 112 113// Close closes the connection to the API service. The user should invoke this when 114// the client is no longer required. 115func (c *Client) Close() error { 116 return c.internalClient.Close() 117} 118 119// setGoogleClientInfo sets the name and version of the application in 120// the `x-goog-api-client` header passed on each request. Intended for 121// use by Google-written clients. 122func (c *Client) setGoogleClientInfo(keyval ...string) { 123 c.internalClient.setGoogleClientInfo(keyval...) 124} 125 126// Connection returns a connection to the API service. 127// 128// Deprecated. 129func (c *Client) Connection() *grpc.ClientConn { 130 return c.internalClient.Connection() 131} 132 133// CreateJob creates a job in the specified region. 134func (c *Client) CreateJob(ctx context.Context, req *transcoderpb.CreateJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { 135 return c.internalClient.CreateJob(ctx, req, opts...) 136} 137 138// ListJobs lists jobs in the specified region. 139func (c *Client) ListJobs(ctx context.Context, req *transcoderpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { 140 return c.internalClient.ListJobs(ctx, req, opts...) 141} 142 143// GetJob returns the job data. 144func (c *Client) GetJob(ctx context.Context, req *transcoderpb.GetJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { 145 return c.internalClient.GetJob(ctx, req, opts...) 146} 147 148// DeleteJob deletes a job. 149func (c *Client) DeleteJob(ctx context.Context, req *transcoderpb.DeleteJobRequest, opts ...gax.CallOption) error { 150 return c.internalClient.DeleteJob(ctx, req, opts...) 151} 152 153// CreateJobTemplate creates a job template in the specified region. 154func (c *Client) CreateJobTemplate(ctx context.Context, req *transcoderpb.CreateJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { 155 return c.internalClient.CreateJobTemplate(ctx, req, opts...) 156} 157 158// ListJobTemplates lists job templates in the specified region. 159func (c *Client) ListJobTemplates(ctx context.Context, req *transcoderpb.ListJobTemplatesRequest, opts ...gax.CallOption) *JobTemplateIterator { 160 return c.internalClient.ListJobTemplates(ctx, req, opts...) 161} 162 163// GetJobTemplate returns the job template data. 164func (c *Client) GetJobTemplate(ctx context.Context, req *transcoderpb.GetJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { 165 return c.internalClient.GetJobTemplate(ctx, req, opts...) 166} 167 168// DeleteJobTemplate deletes a job template. 169func (c *Client) DeleteJobTemplate(ctx context.Context, req *transcoderpb.DeleteJobTemplateRequest, opts ...gax.CallOption) error { 170 return c.internalClient.DeleteJobTemplate(ctx, req, opts...) 171} 172 173// gRPCClient is a client for interacting with Transcoder API over gRPC transport. 174// 175// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. 176type gRPCClient struct { 177 // Connection pool of gRPC connections to the service. 178 connPool gtransport.ConnPool 179 180 // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE 181 disableDeadlines bool 182 183 // Points back to the CallOptions field of the containing Client 184 CallOptions **CallOptions 185 186 // The gRPC API client. 187 client transcoderpb.TranscoderServiceClient 188 189 // The x-goog-* metadata to be sent with each request. 190 xGoogMetadata metadata.MD 191} 192 193// NewClient creates a new transcoder service client based on gRPC. 194// The returned client must be Closed when it is done being used to clean up its underlying connections. 195// 196// Using the Transcoder API, you can queue asynchronous jobs for transcoding 197// media into various output formats. Output formats may include different 198// streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive 199// Streaming over HTTP (DASH). You can also customize jobs using advanced 200// features such as Digital Rights Management (DRM), audio equalization, content 201// concatenation, and digital ad-stitch ready content generation. 202// 203// Deprecated: TranscoderService may be removed in a future version. 204func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { 205 clientOpts := defaultGRPCClientOptions() 206 if newClientHook != nil { 207 hookOpts, err := newClientHook(ctx, clientHookParams{}) 208 if err != nil { 209 return nil, err 210 } 211 clientOpts = append(clientOpts, hookOpts...) 212 } 213 214 disableDeadlines, err := checkDisableDeadlines() 215 if err != nil { 216 return nil, err 217 } 218 219 connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) 220 if err != nil { 221 return nil, err 222 } 223 client := Client{CallOptions: defaultCallOptions()} 224 225 c := &gRPCClient{ 226 connPool: connPool, 227 disableDeadlines: disableDeadlines, 228 client: transcoderpb.NewTranscoderServiceClient(connPool), 229 CallOptions: &client.CallOptions, 230 } 231 c.setGoogleClientInfo() 232 233 client.internalClient = c 234 235 return &client, nil 236} 237 238// Connection returns a connection to the API service. 239// 240// Deprecated. 241func (c *gRPCClient) Connection() *grpc.ClientConn { 242 return c.connPool.Conn() 243} 244 245// setGoogleClientInfo sets the name and version of the application in 246// the `x-goog-api-client` header passed on each request. Intended for 247// use by Google-written clients. 248func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { 249 kv := append([]string{"gl-go", versionGo()}, keyval...) 250 kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) 251 c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) 252} 253 254// Close closes the connection to the API service. The user should invoke this when 255// the client is no longer required. 256func (c *gRPCClient) Close() error { 257 return c.connPool.Close() 258} 259 260func (c *gRPCClient) CreateJob(ctx context.Context, req *transcoderpb.CreateJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { 261 if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { 262 cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) 263 defer cancel() 264 ctx = cctx 265 } 266 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) 267 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 268 opts = append((*c.CallOptions).CreateJob[0:len((*c.CallOptions).CreateJob):len((*c.CallOptions).CreateJob)], opts...) 269 var resp *transcoderpb.Job 270 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 271 var err error 272 resp, err = c.client.CreateJob(ctx, req, settings.GRPC...) 273 return err 274 }, opts...) 275 if err != nil { 276 return nil, err 277 } 278 return resp, nil 279} 280 281func (c *gRPCClient) ListJobs(ctx context.Context, req *transcoderpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator { 282 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) 283 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 284 opts = append((*c.CallOptions).ListJobs[0:len((*c.CallOptions).ListJobs):len((*c.CallOptions).ListJobs)], opts...) 285 it := &JobIterator{} 286 req = proto.Clone(req).(*transcoderpb.ListJobsRequest) 287 it.InternalFetch = func(pageSize int, pageToken string) ([]*transcoderpb.Job, string, error) { 288 resp := &transcoderpb.ListJobsResponse{} 289 if pageToken != "" { 290 req.PageToken = pageToken 291 } 292 if pageSize > math.MaxInt32 { 293 req.PageSize = math.MaxInt32 294 } else if pageSize != 0 { 295 req.PageSize = int32(pageSize) 296 } 297 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 298 var err error 299 resp, err = c.client.ListJobs(ctx, req, settings.GRPC...) 300 return err 301 }, opts...) 302 if err != nil { 303 return nil, "", err 304 } 305 306 it.Response = resp 307 return resp.GetJobs(), resp.GetNextPageToken(), nil 308 } 309 fetch := func(pageSize int, pageToken string) (string, error) { 310 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 311 if err != nil { 312 return "", err 313 } 314 it.items = append(it.items, items...) 315 return nextPageToken, nil 316 } 317 318 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 319 it.pageInfo.MaxSize = int(req.GetPageSize()) 320 it.pageInfo.Token = req.GetPageToken() 321 322 return it 323} 324 325func (c *gRPCClient) GetJob(ctx context.Context, req *transcoderpb.GetJobRequest, opts ...gax.CallOption) (*transcoderpb.Job, error) { 326 if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { 327 cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) 328 defer cancel() 329 ctx = cctx 330 } 331 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) 332 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 333 opts = append((*c.CallOptions).GetJob[0:len((*c.CallOptions).GetJob):len((*c.CallOptions).GetJob)], opts...) 334 var resp *transcoderpb.Job 335 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 336 var err error 337 resp, err = c.client.GetJob(ctx, req, settings.GRPC...) 338 return err 339 }, opts...) 340 if err != nil { 341 return nil, err 342 } 343 return resp, nil 344} 345 346func (c *gRPCClient) DeleteJob(ctx context.Context, req *transcoderpb.DeleteJobRequest, opts ...gax.CallOption) error { 347 if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { 348 cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) 349 defer cancel() 350 ctx = cctx 351 } 352 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) 353 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 354 opts = append((*c.CallOptions).DeleteJob[0:len((*c.CallOptions).DeleteJob):len((*c.CallOptions).DeleteJob)], opts...) 355 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 356 var err error 357 _, err = c.client.DeleteJob(ctx, req, settings.GRPC...) 358 return err 359 }, opts...) 360 return err 361} 362 363func (c *gRPCClient) CreateJobTemplate(ctx context.Context, req *transcoderpb.CreateJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { 364 if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { 365 cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) 366 defer cancel() 367 ctx = cctx 368 } 369 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) 370 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 371 opts = append((*c.CallOptions).CreateJobTemplate[0:len((*c.CallOptions).CreateJobTemplate):len((*c.CallOptions).CreateJobTemplate)], opts...) 372 var resp *transcoderpb.JobTemplate 373 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 374 var err error 375 resp, err = c.client.CreateJobTemplate(ctx, req, settings.GRPC...) 376 return err 377 }, opts...) 378 if err != nil { 379 return nil, err 380 } 381 return resp, nil 382} 383 384func (c *gRPCClient) ListJobTemplates(ctx context.Context, req *transcoderpb.ListJobTemplatesRequest, opts ...gax.CallOption) *JobTemplateIterator { 385 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) 386 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 387 opts = append((*c.CallOptions).ListJobTemplates[0:len((*c.CallOptions).ListJobTemplates):len((*c.CallOptions).ListJobTemplates)], opts...) 388 it := &JobTemplateIterator{} 389 req = proto.Clone(req).(*transcoderpb.ListJobTemplatesRequest) 390 it.InternalFetch = func(pageSize int, pageToken string) ([]*transcoderpb.JobTemplate, string, error) { 391 resp := &transcoderpb.ListJobTemplatesResponse{} 392 if pageToken != "" { 393 req.PageToken = pageToken 394 } 395 if pageSize > math.MaxInt32 { 396 req.PageSize = math.MaxInt32 397 } else if pageSize != 0 { 398 req.PageSize = int32(pageSize) 399 } 400 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 401 var err error 402 resp, err = c.client.ListJobTemplates(ctx, req, settings.GRPC...) 403 return err 404 }, opts...) 405 if err != nil { 406 return nil, "", err 407 } 408 409 it.Response = resp 410 return resp.GetJobTemplates(), resp.GetNextPageToken(), nil 411 } 412 fetch := func(pageSize int, pageToken string) (string, error) { 413 items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) 414 if err != nil { 415 return "", err 416 } 417 it.items = append(it.items, items...) 418 return nextPageToken, nil 419 } 420 421 it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) 422 it.pageInfo.MaxSize = int(req.GetPageSize()) 423 it.pageInfo.Token = req.GetPageToken() 424 425 return it 426} 427 428func (c *gRPCClient) GetJobTemplate(ctx context.Context, req *transcoderpb.GetJobTemplateRequest, opts ...gax.CallOption) (*transcoderpb.JobTemplate, error) { 429 if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { 430 cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) 431 defer cancel() 432 ctx = cctx 433 } 434 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) 435 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 436 opts = append((*c.CallOptions).GetJobTemplate[0:len((*c.CallOptions).GetJobTemplate):len((*c.CallOptions).GetJobTemplate)], opts...) 437 var resp *transcoderpb.JobTemplate 438 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 439 var err error 440 resp, err = c.client.GetJobTemplate(ctx, req, settings.GRPC...) 441 return err 442 }, opts...) 443 if err != nil { 444 return nil, err 445 } 446 return resp, nil 447} 448 449func (c *gRPCClient) DeleteJobTemplate(ctx context.Context, req *transcoderpb.DeleteJobTemplateRequest, opts ...gax.CallOption) error { 450 if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { 451 cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) 452 defer cancel() 453 ctx = cctx 454 } 455 md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) 456 ctx = insertMetadata(ctx, c.xGoogMetadata, md) 457 opts = append((*c.CallOptions).DeleteJobTemplate[0:len((*c.CallOptions).DeleteJobTemplate):len((*c.CallOptions).DeleteJobTemplate)], opts...) 458 err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { 459 var err error 460 _, err = c.client.DeleteJobTemplate(ctx, req, settings.GRPC...) 461 return err 462 }, opts...) 463 return err 464} 465 466// JobIterator manages a stream of *transcoderpb.Job. 467type JobIterator struct { 468 items []*transcoderpb.Job 469 pageInfo *iterator.PageInfo 470 nextFunc func() error 471 472 // Response is the raw response for the current page. 473 // It must be cast to the RPC response type. 474 // Calling Next() or InternalFetch() updates this value. 475 Response interface{} 476 477 // InternalFetch is for use by the Google Cloud Libraries only. 478 // It is not part of the stable interface of this package. 479 // 480 // InternalFetch returns results from a single call to the underlying RPC. 481 // The number of results is no greater than pageSize. 482 // If there are no more results, nextPageToken is empty and err is nil. 483 InternalFetch func(pageSize int, pageToken string) (results []*transcoderpb.Job, nextPageToken string, err error) 484} 485 486// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 487func (it *JobIterator) PageInfo() *iterator.PageInfo { 488 return it.pageInfo 489} 490 491// Next returns the next result. Its second return value is iterator.Done if there are no more 492// results. Once Next returns Done, all subsequent calls will return Done. 493func (it *JobIterator) Next() (*transcoderpb.Job, error) { 494 var item *transcoderpb.Job 495 if err := it.nextFunc(); err != nil { 496 return item, err 497 } 498 item = it.items[0] 499 it.items = it.items[1:] 500 return item, nil 501} 502 503func (it *JobIterator) bufLen() int { 504 return len(it.items) 505} 506 507func (it *JobIterator) takeBuf() interface{} { 508 b := it.items 509 it.items = nil 510 return b 511} 512 513// JobTemplateIterator manages a stream of *transcoderpb.JobTemplate. 514type JobTemplateIterator struct { 515 items []*transcoderpb.JobTemplate 516 pageInfo *iterator.PageInfo 517 nextFunc func() error 518 519 // Response is the raw response for the current page. 520 // It must be cast to the RPC response type. 521 // Calling Next() or InternalFetch() updates this value. 522 Response interface{} 523 524 // InternalFetch is for use by the Google Cloud Libraries only. 525 // It is not part of the stable interface of this package. 526 // 527 // InternalFetch returns results from a single call to the underlying RPC. 528 // The number of results is no greater than pageSize. 529 // If there are no more results, nextPageToken is empty and err is nil. 530 InternalFetch func(pageSize int, pageToken string) (results []*transcoderpb.JobTemplate, nextPageToken string, err error) 531} 532 533// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. 534func (it *JobTemplateIterator) PageInfo() *iterator.PageInfo { 535 return it.pageInfo 536} 537 538// Next returns the next result. Its second return value is iterator.Done if there are no more 539// results. Once Next returns Done, all subsequent calls will return Done. 540func (it *JobTemplateIterator) Next() (*transcoderpb.JobTemplate, error) { 541 var item *transcoderpb.JobTemplate 542 if err := it.nextFunc(); err != nil { 543 return item, err 544 } 545 item = it.items[0] 546 it.items = it.items[1:] 547 return item, nil 548} 549 550func (it *JobTemplateIterator) bufLen() int { 551 return len(it.items) 552} 553 554func (it *JobTemplateIterator) takeBuf() interface{} { 555 b := it.items 556 it.items = nil 557 return b 558} 559