Documentation ¶
Overview ¶
Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2021-2022 Nikita Ivanovski info@slnt-opp.xyz
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CreateCmd = &cobra.Command{ Use: "create [title]", Aliases: []string{"crt", "c"}, Short: "Create NoCloud Namespace", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { ctx, client := MakeNamespacesServiceClientOrFail() req := namespacespb.CreateRequest{ Title: args[0], } res, err := client.Create(ctx, &req) if err != nil { return err } if printJson, _ := cmd.Flags().GetBool("json"); printJson { data, err := json.Marshal(res) if err != nil { return err } fmt.Println(string(data)) } else { fmt.Println("UUID:", res.GetUuid()) } return nil }, }
CreateCmd represents the create command
var DeleteCmd = &cobra.Command{ Use: "delete [UUID]", Aliases: []string{"del", "d"}, Short: "Delete NoCloud Namespace", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { ctx, client := MakeNamespacesServiceClientOrFail() res, err := client.Delete(ctx, &namespacespb.DeleteRequest{ Uuid: args[0], }) if err != nil { return err } if printJson, _ := cmd.Flags().GetBool("json"); printJson { data, err := json.Marshal(res) if err != nil { return err } fmt.Println(string(data)) } else { fmt.Printf("Result: %t\n", res.GetResult()) } return nil }, }
DeleteCmd represents the delete command
var ListCmd = &cobra.Command{ Use: "list [[flags]]", Aliases: []string{"l"}, Short: "List NoCloud Namespaces", RunE: func(cmd *cobra.Command, args []string) error { ctx, client := MakeNamespacesServiceClientOrFail() request := namespacespb.ListRequest{} d, _ := cmd.Flags().GetInt32("depth") request.Depth = &d res, err := client.List(ctx, &request) if err != nil { return err } if printJson, _ := cmd.Flags().GetBool("json"); printJson { data, err := json.Marshal(res) if err != nil { return err } fmt.Println(string(data)) } else { PrintNamespacesPool(res.Pool) } return nil }, }
ListCmd represents the list command
Functions ¶
func MakeNamespacesServiceClientOrFail ¶
func MakeNamespacesServiceClientOrFail() (context.Context, regpb.NamespacesServiceClient)
func PrintNamespacesPool ¶
Types ¶
This section is empty.