func buildRegionalAdsGrpcService()

in agent/envoy_bootstrap/envoy_bootstrap.go [583:627]


func buildRegionalAdsGrpcService(endpoint string, region string, signingName string) (*core.GrpcService, error) {
	channelArgs := core.GrpcService_GoogleGrpc_ChannelArgs{
		Args: map[string]*core.GrpcService_GoogleGrpc_ChannelArgs_Value{
			"grpc.http2.max_pings_without_data": buildGoogleGrpcIntChannelArg(GRPC_MAX_PINGS_WITHOUT_DATA),
			"grpc.keepalive_time_ms":            buildGoogleGrpcIntChannelArg(GRPC_KEEPALIVE_TIME_MS),
			"grpc.keepalive_timeout_ms":         buildGoogleGrpcIntChannelArg(GRPC_KEEPALIVE_TIMEOUT_MS),
		},
	}
	iamConfig, err := anypb.New(&grpc_cred.AwsIamConfig{
		ServiceName: signingName,
		Region:      region,
	})
	if err != nil {
		return nil, err
	}
	return &core.GrpcService{
		TargetSpecifier: &core.GrpcService_GoogleGrpc_{
			GoogleGrpc: &core.GrpcService_GoogleGrpc{
				StatPrefix: "ads",
				TargetUri:  endpoint,
				ChannelCredentials: &core.GrpcService_GoogleGrpc_ChannelCredentials{
					CredentialSpecifier: &core.GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials{
						SslCredentials: &core.GrpcService_GoogleGrpc_SslCredentials{
							RootCerts: buildFileDataSource("/etc/pki/tls/cert.pem"),
						},
					},
				},
				CredentialsFactoryName: "envoy.grpc_credentials.aws_iam",
				CallCredentials: []*core.GrpcService_GoogleGrpc_CallCredentials{
					&core.GrpcService_GoogleGrpc_CallCredentials{
						CredentialSpecifier: &core.GrpcService_GoogleGrpc_CallCredentials_FromPlugin{
							FromPlugin: &core.GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin{
								Name: "envoy.grpc_credentials.aws_iam",
								ConfigType: &core.GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_TypedConfig{
									TypedConfig: iamConfig,
								},
							},
						},
					},
				},
				ChannelArgs: &channelArgs,
			},
		},
	}, nil
}