google.golang.org/grpc@v1.74.2/xds/internal/xdsclient/resource_types.go (about)

     1  /*
     2   *
     3   * Copyright 2025 gRPC authors.
     4   *
     5   * Licensed under the Apache License, Version 2.0 (the "License");
     6   * you may not use this file except in compliance with the License.
     7   * You may obtain a copy of the License at
     8   *
     9   *     http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  
    18  package xdsclient
    19  
    20  import (
    21  	"google.golang.org/grpc/internal/xds/bootstrap"
    22  	"google.golang.org/grpc/xds/internal/clients/xdsclient"
    23  	"google.golang.org/grpc/xds/internal/xdsclient/xdsresource"
    24  	"google.golang.org/grpc/xds/internal/xdsclient/xdsresource/version"
    25  )
    26  
    27  func supportedResourceTypes(config *bootstrap.Config, gServerCfgMap map[xdsclient.ServerConfig]*bootstrap.ServerConfig) map[string]xdsclient.ResourceType {
    28  	return map[string]xdsclient.ResourceType{
    29  		version.V3ListenerURL: {
    30  			TypeURL:                    version.V3ListenerURL,
    31  			TypeName:                   xdsresource.ListenerResourceTypeName,
    32  			AllResourcesRequiredInSotW: true,
    33  			Decoder:                    xdsresource.NewGenericListenerResourceTypeDecoder(config),
    34  		},
    35  		version.V3RouteConfigURL: {
    36  			TypeURL:                    version.V3RouteConfigURL,
    37  			TypeName:                   xdsresource.RouteConfigTypeName,
    38  			AllResourcesRequiredInSotW: false,
    39  			Decoder:                    xdsresource.NewGenericRouteConfigResourceTypeDecoder(),
    40  		},
    41  		version.V3ClusterURL: {
    42  			TypeURL:                    version.V3ClusterURL,
    43  			TypeName:                   xdsresource.ClusterResourceTypeName,
    44  			AllResourcesRequiredInSotW: true,
    45  			Decoder:                    xdsresource.NewGenericClusterResourceTypeDecoder(config, gServerCfgMap),
    46  		},
    47  		version.V3EndpointsURL: {
    48  			TypeURL:                    version.V3EndpointsURL,
    49  			TypeName:                   xdsresource.EndpointsResourceTypeName,
    50  			AllResourcesRequiredInSotW: false,
    51  			Decoder:                    xdsresource.NewGenericEndpointsResourceTypeDecoder(),
    52  		},
    53  	}
    54  }