Skip to content

Commit

Permalink
Merge branch 'main' into grpc-storage-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyn authored Aug 22, 2024
2 parents e422ebc + 5f06ae1 commit ae16ca8
Show file tree
Hide file tree
Showing 37 changed files with 393 additions and 186 deletions.
4 changes: 2 additions & 2 deletions .release-please-manifest-individual.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ai": "0.8.2",
"aiplatform": "1.68.0",
"auth": "0.9.0",
"auth": "0.9.1",
"auth/oauth2adapt": "0.2.4",
"bigquery": "1.62.0",
"bigtable": "1.29.0",
Expand All @@ -14,5 +14,5 @@
"pubsublite": "1.8.2",
"spanner": "1.67.0",
"storage": "1.43.0",
"vertexai": "0.12.0"
"vertexai": "0.13.0"
}
7 changes: 7 additions & 0 deletions auth/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.9.1](https://github.com/googleapis/google-cloud-go/compare/auth/v0.9.0...auth/v0.9.1) (2024-08-22)


### Bug Fixes

* **auth:** Setting expireEarly to default when the value is 0 ([#10732](https://github.com/googleapis/google-cloud-go/issues/10732)) ([5e67869](https://github.com/googleapis/google-cloud-go/commit/5e67869a31e9e8ecb4eeebd2cfa11a761c3b1948))

## [0.9.0](https://github.com/googleapis/google-cloud-go/compare/auth/v0.8.1...auth/v0.9.0) (2024-08-16)


Expand Down
2 changes: 1 addition & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (ctpo *CachedTokenProviderOptions) autoRefresh() bool {
}

func (ctpo *CachedTokenProviderOptions) expireEarly() time.Duration {
if ctpo == nil {
if ctpo == nil || ctpo.ExpireEarly == 0 {
return defaultExpiryDelta
}
return ctpo.ExpireEarly
Expand Down
4 changes: 1 addition & 3 deletions bigtable/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ func NewClientWithConfig(ctx context.Context, project, instance string, config C
)

// Allow non-default service account in DirectPath.
o = append(o,
internaloption.AllowNonDefaultServiceAccount(true),
internaloption.EnableNewAuthLibrary())
o = append(o, internaloption.AllowNonDefaultServiceAccount(true))
o = append(o, opts...)
connPool, err := gtransport.DialPool(ctx, o...)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions bigtable/conformance_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ trap cleanup EXIT

# Run the conformance tests
cd $conformanceTestsHome
# Tests in https://github.com/googleapis/cloud-bigtable-clients-test/tree/main/tests can only be run on go1.20.2
go install golang.org/dl/go1.20.2@latest
go1.20.2 download
go1.20.2 test -v -proxy_addr=:$testProxyPort | tee -a $sponge_log
# Tests in https://github.com/googleapis/cloud-bigtable-clients-test/tree/main/tests can only be run on go1.22.5
go install golang.org/dl/go1.22.5@latest
go1.22.5 download
go1.22.5 test -v -proxy_addr=:$testProxyPort | tee -a $sponge_log
RETURN_CODE=$?

echo "exiting with ${RETURN_CODE}"
Expand Down
49 changes: 47 additions & 2 deletions bigtable/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,40 @@ limitations under the License.

package bigtable

import btapb "cloud.google.com/go/bigtable/admin/apiv2/adminpb"
import (
btapb "cloud.google.com/go/bigtable/admin/apiv2/adminpb"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)

// Type wraps the protobuf representation of a type. See the protobuf definition
// for more details on types.
type Type interface {
proto() *btapb.Type
}

var marshalOptions = protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}
var unmarshalOptions = protojson.UnmarshalOptions{AllowPartial: true}

// MarshalJSON returns the string representation of the Type protobuf.
func MarshalJSON(t Type) ([]byte, error) {
return marshalOptions.Marshal(t.proto())
}

// UnmarshalJSON returns a Type object from json bytes.
func UnmarshalJSON(data []byte) (Type, error) {
result := &btapb.Type{}
if err := unmarshalOptions.Unmarshal(data, result); err != nil {
return nil, err
}
return ProtoToType(result), nil
}

// Equal compares Type objects.
func Equal(a, b Type) bool {
return proto.Equal(a.proto(), b.proto())
}

type unknown[T interface{}] struct {
wrapped *T
}
Expand Down Expand Up @@ -205,6 +231,8 @@ func ProtoToType(pb *btapb.Type) Type {
return int64ProtoToType(t.Int64Type)
case *btapb.Type_BytesType:
return bytesProtoToType(t.BytesType)
case *btapb.Type_StringType:
return stringProtoToType(t.StringType)
case *btapb.Type_AggregateType:
return aggregateProtoToType(t.AggregateType)
default:
Expand All @@ -229,6 +257,23 @@ func bytesProtoToType(b *btapb.Type_Bytes) BytesType {
return BytesType{Encoding: bytesEncodingProtoToType(b.Encoding)}
}

func stringEncodingProtoToType(se *btapb.Type_String_Encoding) StringEncoding {
if se == nil {
return unknown[btapb.Type_String_Encoding]{wrapped: se}
}

switch se.Encoding.(type) {
case *btapb.Type_String_Encoding_Utf8Raw_:
return StringUtf8Encoding{}
default:
return unknown[btapb.Type_String_Encoding]{wrapped: se}
}
}

func stringProtoToType(s *btapb.Type_String) Type {
return StringType{Encoding: stringEncodingProtoToType(s.Encoding)}
}

func int64EncodingProtoToEncoding(ie *btapb.Type_Int64_Encoding) Int64Encoding {
if ie == nil {
return unknown[btapb.Type_Int64_Encoding]{wrapped: ie}
Expand All @@ -246,7 +291,7 @@ func int64ProtoToType(i *btapb.Type_Int64) Type {
return Int64Type{Encoding: int64EncodingProtoToEncoding(i.Encoding)}
}

func aggregateProtoToType(agg *btapb.Type_Aggregate) Type {
func aggregateProtoToType(agg *btapb.Type_Aggregate) AggregateType {
if agg == nil {
return AggregateType{Input: nil, Aggregator: unknownAggregator{wrapped: agg}}
}
Expand Down
Loading

0 comments on commit ae16ca8

Please sign in to comment.