blob: a3254e09c983345dac37e12d198336c14a5ba87c [file] [log] [blame]
Lorenz Brunaa6b7342019-12-12 02:55:02 +01001// 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
17package main
18
19import (
20 "context"
21 "io/ioutil"
22 "os"
23
24 "git.monogon.dev/source/nexantic.git/core/generated/api"
25 "github.com/gogo/protobuf/proto"
26 "google.golang.org/grpc"
27)
28
29func main() {
30 conn, err := grpc.Dial(os.Args[1], grpc.WithInsecure())
31 if err != nil {
32 panic(err)
33 }
34 defer conn.Close()
35 cmc := api.NewClusterManagementClient(conn)
36 res, err := cmc.NewEnrolmentConfig(context.Background(), &api.NewEnrolmentConfigRequest{
37 Name: "test",
38 })
39
40 if err != nil {
41 panic(err)
42 }
43 enrolmentConfigRaw, err := proto.Marshal(res.EnrolmentConfig)
44 ioutil.WriteFile("enrolment.pb", enrolmentConfigRaw, 0644)
45}