go.ligato.io/vpp-agent/v3@v3.5.0/examples/tutorials/08_grpc/plugins/grpc/options.go (about) 1 // Copyright (c) 2019 Cisco and/or its affiliates. 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 // http://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 package grpc 16 17 // Default instance of the plugin (e.g. without custom dependencies) 18 var DefaultPlugin = *NewPlugin() 19 20 // Method to retrieve plugin instance with options (if defined) 21 func NewPlugin(opts ...Option) *Client { 22 p := &Client{} 23 24 // Unique plugin identification 25 p.PluginName = "GRPC-client" 26 27 // All custom options are set at this point 28 for _, o := range opts { 29 o(p) 30 } 31 32 // Initialize plugin infrastructure dependencies (logger) 33 p.PluginDeps.Setup() 34 35 return p 36 } 37 38 type Option func(*Client)