fleetengine

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package fleetengine is an auto-generated package for the Local Rides and Deliveries API.

Enables Fleet Engine for access to the On Demand Rides and Deliveries and Last Mile Fleet Solution APIs. Customer’s use of Google Maps Content in the Cloud Logging Services is subject to the Google Maps Platform Terms of Service located at https://cloud.google.com/maps-platform/terms (at https://cloud.google.com/maps-platform/terms).

General documentation

For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:

Example usage

To get started with this package, create a client.

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_Options
c, err := fleetengine.NewTripClient(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()
// 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_Options
c, err := fleetengine.NewTripClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

req := &fleetenginepb.CreateTripRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#CreateTripRequest.
}
resp, err := c.CreateTrip(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewTripClient 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.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type TripCallOptions

type TripCallOptions struct {
	CreateTrip         []gax.CallOption
	GetTrip            []gax.CallOption
	ReportBillableTrip []gax.CallOption
	SearchTrips        []gax.CallOption
	UpdateTrip         []gax.CallOption
}

TripCallOptions contains the retry settings for each method of TripClient.

type TripClient

type TripClient struct {

	// The call options for this service.
	CallOptions *TripCallOptions
	// contains filtered or unexported fields
}

TripClient is a client for interacting with Local Rides and Deliveries API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Trip management service.

func NewTripClient

func NewTripClient(ctx context.Context, opts ...option.ClientOption) (*TripClient, error)

NewTripClient creates a new trip service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Trip management service.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/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_Options
	c, err := fleetengine.NewTripClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*TripClient) Close

func (c *TripClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*TripClient) Connection deprecated

func (c *TripClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*TripClient) CreateTrip

CreateTrip creates a trip in the Fleet Engine and returns the new trip.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewTripClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.CreateTripRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#CreateTripRequest.
	}
	resp, err := c.CreateTrip(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*TripClient) GetTrip

GetTrip get information about a single trip.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewTripClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.GetTripRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#GetTripRequest.
	}
	resp, err := c.GetTrip(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*TripClient) ReportBillableTrip

func (c *TripClient) ReportBillableTrip(ctx context.Context, req *fleetenginepb.ReportBillableTripRequest, opts ...gax.CallOption) error

ReportBillableTrip report billable trip usage.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewTripClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.ReportBillableTripRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#ReportBillableTripRequest.
	}
	err = c.ReportBillableTrip(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*TripClient) SearchTrips

SearchTrips get all the trips for a specific vehicle.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
	"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_Options
	c, err := fleetengine.NewTripClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.SearchTripsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#SearchTripsRequest.
	}
	it := c.SearchTrips(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.(*fleetenginepb.SearchTripsResponse)
	}
}
Output:

func (*TripClient) UpdateTrip

UpdateTrip updates trip data.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewTripClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.UpdateTripRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#UpdateTripRequest.
	}
	resp, err := c.UpdateTrip(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type TripIterator

type TripIterator 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(pageSize int, pageToken string) (results []*fleetenginepb.Trip, nextPageToken string, err error)
	// contains filtered or unexported fields
}

TripIterator manages a stream of *fleetenginepb.Trip.

func (*TripIterator) Next

func (it *TripIterator) Next() (*fleetenginepb.Trip, error)

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 (*TripIterator) PageInfo

func (it *TripIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type VehicleCallOptions

type VehicleCallOptions struct {
	CreateVehicle           []gax.CallOption
	GetVehicle              []gax.CallOption
	UpdateVehicle           []gax.CallOption
	UpdateVehicleLocation   []gax.CallOption
	UpdateVehicleAttributes []gax.CallOption
	ListVehicles            []gax.CallOption
	SearchVehicles          []gax.CallOption
	SearchFuzzedVehicles    []gax.CallOption
}

VehicleCallOptions contains the retry settings for each method of VehicleClient.

type VehicleClient

type VehicleClient struct {

	// The call options for this service.
	CallOptions *VehicleCallOptions
	// contains filtered or unexported fields
}

VehicleClient is a client for interacting with Local Rides and Deliveries API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Vehicle management service.

func NewVehicleClient

func NewVehicleClient(ctx context.Context, opts ...option.ClientOption) (*VehicleClient, error)

NewVehicleClient creates a new vehicle service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Vehicle management service.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*VehicleClient) Close

func (c *VehicleClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*VehicleClient) Connection deprecated

func (c *VehicleClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*VehicleClient) CreateVehicle

CreateVehicle instantiates a new vehicle associated with an on-demand rideshare or deliveries provider. Each Vehicle must have a unique vehicle ID.

The following Vehicle fields are required when creating a Vehicle:

vehicleState

supportedTripTypes

maximumCapacity

vehicleType

The following Vehicle fields are ignored when creating a Vehicle:

name

currentTrips

availableCapacity

current_route_segment

current_route_segment_end_point

current_route_segment_version

current_route_segment_traffic

route

waypoints

waypoints_version

remaining_distance_meters

remaining_time_seconds

eta_to_next_waypoint

navigation_status

All other fields are optional and used if provided.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.CreateVehicleRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#CreateVehicleRequest.
	}
	resp, err := c.CreateVehicle(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*VehicleClient) GetVehicle

GetVehicle returns a vehicle from the Fleet Engine.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.GetVehicleRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#GetVehicleRequest.
	}
	resp, err := c.GetVehicle(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*VehicleClient) ListVehicles

ListVehicles returns a paginated list of vehicles associated with a provider that match the request options.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
	"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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.ListVehiclesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#ListVehiclesRequest.
	}
	it := c.ListVehicles(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.(*fleetenginepb.ListVehiclesResponse)
	}
}
Output:

func (*VehicleClient) SearchFuzzedVehicles deprecated

SearchFuzzedVehicles deprecated: Use SearchVehicles instead.

Deprecated: SearchFuzzedVehicles may be removed in a future version.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.SearchVehiclesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#SearchVehiclesRequest.
	}
	resp, err := c.SearchFuzzedVehicles(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*VehicleClient) SearchVehicles

SearchVehicles returns a list of vehicles that match the request options.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.SearchVehiclesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#SearchVehiclesRequest.
	}
	resp, err := c.SearchVehicles(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*VehicleClient) UpdateVehicle

UpdateVehicle writes updated vehicle data to the Fleet Engine.

When updating a Vehicle, the following fields cannot be updated since they are managed by the server:

currentTrips

availableCapacity

current_route_segment_version

waypoints_version

The vehicle name also cannot be updated.

If the attributes field is updated, all the vehicle’s attributes are replaced with the attributes provided in the request. If you want to update only some attributes, see the UpdateVehicleAttributes method. Likewise, the waypoints field can be updated, but must contain all the waypoints currently on the vehicle, and no other waypoints.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.UpdateVehicleRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#UpdateVehicleRequest.
	}
	resp, err := c.UpdateVehicle(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*VehicleClient) UpdateVehicleAttributes

UpdateVehicleAttributes partially updates a vehicle’s attributes. Only the attributes mentioned in the request will be updated, other attributes will NOT be altered. Note: this is different in UpdateVehicle, where the whole attributes field will be replaced by the one in UpdateVehicleRequest, attributes not in the request would be removed.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.UpdateVehicleAttributesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#UpdateVehicleAttributesRequest.
	}
	resp, err := c.UpdateVehicleAttributes(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*VehicleClient) UpdateVehicleLocation deprecated

UpdateVehicleLocation deprecated: Use the UpdateVehicle method instead. UpdateVehicleLocation updates the location of the vehicle.

Deprecated: UpdateVehicleLocation may be removed in a future version.

Example
package main

import (
	"context"

	fleetengine "cloud.google.com/go/maps/fleetengine/apiv1"
	fleetenginepb "cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb"
)

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_Options
	c, err := fleetengine.NewVehicleClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &fleetenginepb.UpdateVehicleLocationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/fleetengine/apiv1/fleetenginepb#UpdateVehicleLocationRequest.
	}
	resp, err := c.UpdateVehicleLocation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type VehicleIterator

type VehicleIterator 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(pageSize int, pageToken string) (results []*fleetenginepb.Vehicle, nextPageToken string, err error)
	// contains filtered or unexported fields
}

VehicleIterator manages a stream of *fleetenginepb.Vehicle.

func (*VehicleIterator) Next

func (it *VehicleIterator) Next() (*fleetenginepb.Vehicle, error)

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 (*VehicleIterator) PageInfo

func (it *VehicleIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL