blob: 8b2948978afba36a90132756d479b452b19f0a5c [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
Lorenz Brunaa6b7342019-12-12 02:55:02 +010024 "github.com/gogo/protobuf/proto"
25 "google.golang.org/grpc"
Hendrik Hofstadt8efe51e2020-02-28 12:53:41 +010026
27 "git.monogon.dev/source/nexantic.git/core/generated/api"
Lorenz Brunaa6b7342019-12-12 02:55:02 +010028)
29
30func 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}