You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.9 KiB
74 lines
1.9 KiB
|
5 years ago
|
/*
|
||
|
|
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||
|
|
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||
|
|
|
||
|
|
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.
|
||
|
|
*/
|
||
|
|
|
||
|
5 years ago
|
package decort
|
||
|
5 years ago
|
|
||
|
|
import (
|
||
|
5 years ago
|
log "github.com/sirupsen/logrus"
|
||
|
5 years ago
|
|
||
|
5 years ago
|
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||
|
|
// "github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||
|
5 years ago
|
)
|
||
|
|
|
||
|
4 years ago
|
func parseOsUsers(logins []OsUserRecord) []interface{} {
|
||
|
5 years ago
|
var result = make([]interface{}, len(logins))
|
||
|
|
|
||
|
|
elem := make(map[string]interface{})
|
||
|
|
|
||
|
|
for index, value := range logins {
|
||
|
|
elem["guid"] = value.Guid
|
||
|
|
elem["login"] = value.Login
|
||
|
|
elem["password"] = value.Password
|
||
|
5 years ago
|
elem["public_key"] = value.PubKey
|
||
|
5 years ago
|
result[index] = elem
|
||
|
4 years ago
|
log.Debugf("parseOsUsers: parsed element %d - login %q", index, value.Login)
|
||
|
5 years ago
|
}
|
||
|
|
|
||
|
|
return result
|
||
|
|
}
|
||
|
|
|
||
|
4 years ago
|
func osUsersSubresourceSchemaMake() map[string]*schema.Schema {
|
||
|
5 years ago
|
rets := map[string]*schema.Schema{
|
||
|
5 years ago
|
"guid": {
|
||
|
|
Type: schema.TypeString,
|
||
|
4 years ago
|
Computed: true,
|
||
|
5 years ago
|
Description: "GUID of this guest OS user.",
|
||
|
5 years ago
|
},
|
||
|
|
|
||
|
|
"login": {
|
||
|
|
Type: schema.TypeString,
|
||
|
4 years ago
|
Computed: true,
|
||
|
5 years ago
|
Description: "Login name of this guest OS user.",
|
||
|
5 years ago
|
},
|
||
|
|
|
||
|
|
"password": {
|
||
|
|
Type: schema.TypeString,
|
||
|
4 years ago
|
Computed: true,
|
||
|
5 years ago
|
Sensitive: true,
|
||
|
5 years ago
|
Description: "Password of this guest OS user.",
|
||
|
|
},
|
||
|
|
|
||
|
|
"public_key": {
|
||
|
|
Type: schema.TypeString,
|
||
|
4 years ago
|
Computed: true,
|
||
|
|
Description: "SSH public key of this guest OS user.",
|
||
|
5 years ago
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
return rets
|
||
|
|
}
|