Lorenz Brun | aa6b734 | 2019-12-12 02:55:02 +0100 | [diff] [blame] | 1 | // Copyright 2020 The Monogon Project Authors. |
| 2 | // |
| 3 | // SPDX-License-Identifier: Apache-2.0 |
| 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 | package main |
| 18 | |
| 19 | import ( |
| 20 | "context" |
| 21 | "io/ioutil" |
| 22 | "os" |
| 23 | |
Lorenz Brun | aa6b734 | 2019-12-12 02:55:02 +0100 | [diff] [blame] | 24 | "github.com/gogo/protobuf/proto" |
| 25 | "google.golang.org/grpc" |
Hendrik Hofstadt | 8efe51e | 2020-02-28 12:53:41 +0100 | [diff] [blame^] | 26 | |
| 27 | "git.monogon.dev/source/nexantic.git/core/generated/api" |
Lorenz Brun | aa6b734 | 2019-12-12 02:55:02 +0100 | [diff] [blame] | 28 | ) |
| 29 | |
| 30 | func main() { |
| 31 | conn, err := grpc.Dial(os.Args[1], grpc.WithInsecure()) |
| 32 | if err != nil { |
| 33 | panic(err) |
| 34 | } |
| 35 | defer conn.Close() |
| 36 | cmc := api.NewClusterManagementClient(conn) |
| 37 | res, err := cmc.NewEnrolmentConfig(context.Background(), &api.NewEnrolmentConfigRequest{ |
| 38 | Name: "test", |
| 39 | }) |
| 40 | |
| 41 | if err != nil { |
| 42 | panic(err) |
| 43 | } |
| 44 | enrolmentConfigRaw, err := proto.Marshal(res.EnrolmentConfig) |
| 45 | ioutil.WriteFile("enrolment.pb", enrolmentConfigRaw, 0644) |
| 46 | } |