Documentation
¶
Overview ¶
Copyright The KubeVault Authors.
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 The KubeVault Authors.
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 The KubeVault Authors.
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 ¶
- func GetServicePrincipalToken(config *AzureAuthConfig, env *azure.Environment, resource string) (*adal.ServicePrincipalToken, error)
- func NewKVService(opts *Options) (kv.Service, error)
- func ParseAzureEnvironment(cloudName string) (*azure.Environment, error)
- type AzureAuthConfig
- type KVService
- func (k *KVService) CheckWriteAccess() error
- func (k *KVService) Get(key string) ([]byte, error)
- func (k *KVService) GetLatestVersionOfSecret(vaultBaseUrl, secretName string) (string, error)
- func (k *KVService) GetSecret(secretName string) (*string, error)
- func (k *KVService) Set(key string, value []byte) error
- func (k *KVService) SetSecret(secretName, value string) error
- func (k *KVService) Test(key string) error
- type OAuthGrantType
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetServicePrincipalToken ¶
func GetServicePrincipalToken(config *AzureAuthConfig, env *azure.Environment, resource string) (*adal.ServicePrincipalToken, error)
GetServicePrincipalToken creates a new service principal token based on the configuration
func ParseAzureEnvironment ¶
func ParseAzureEnvironment(cloudName string) (*azure.Environment, error)
ParseAzureEnvironment returns azure environment by name
Types ¶
type AzureAuthConfig ¶
type AzureAuthConfig struct { // The cloud environment identifier. Takes values from https://github.com/Azure/go-autorest/blob/ec5f4903f77ed9927ac95b19ab8e44ada64c1356/autorest/azure/environments.go#L13 Cloud string `json:"cloud"` // The AAD Tenant ID for the Subscription that the cluster is deployed in TenantID string `json:"tenantId"` //The ClientID for an AAD application with RBAC access to talk to Azure RM APIs AADClientID string `json:"aadClientId"` // The ClientSecret for an AAD application with RBAC access to talk to Azure RM APIs AADClientSecret string `json:"aadClientSecret"` // The path of a client certificate for an AAD application with RBAC access to talk to Azure RM APIs AADClientCertPath string `json:"aadClientCertPath"` // The password of the client certificate for an AAD application with RBAC access to talk to Azure RM APIs AADClientCertPassword string `json:"aadClientCertPassword"` // Use managed service identity for the virtual machine to access Azure ARM APIs UseManagedIdentityExtension bool `json:"useManagedIdentityExtension"` }
AzureAuthConfig holds auth related part of cloud config
func GetConfigFromFile ¶
func GetConfigFromFile(configFilePath string) (*AzureAuthConfig, error)
func NewAzureAuthConfig ¶
func NewAzureAuthConfig() *AzureAuthConfig
func (*AzureAuthConfig) AddFlags ¶
func (o *AzureAuthConfig) AddFlags(fs *pflag.FlagSet)
func (*AzureAuthConfig) GetKeyVaultToken ¶
func (c *AzureAuthConfig) GetKeyVaultToken(grantType OAuthGrantType) (authorizer autorest.Authorizer, err error)
func (*AzureAuthConfig) Validate ¶
func (o *AzureAuthConfig) Validate() []error
type KVService ¶
type KVService struct { KeyClient azurekv.BaseClient Ctx context.Context VaultBaseUrl string SecretPrefix string }
func (*KVService) CheckWriteAccess ¶
func (*KVService) GetLatestVersionOfSecret ¶
GetLatestVersionOfSecret will give latest version of secret according to created time
type OAuthGrantType ¶
type OAuthGrantType int
OAuthGrantType specifies which grant type to use.
const ( // OAuthGrantTypeServicePrincipal for client credentials flow OAuthGrantTypeServicePrincipal OAuthGrantType = iota // OAuthGrantTypeDeviceFlow for device-auth flow OAuthGrantTypeDeviceFlow )
func AuthGrantType ¶
func AuthGrantType() OAuthGrantType
type Options ¶
type Options struct { VaultBaseUrl string AuthConfig *AzureAuthConfig // TODO: should make it auto generated SecretPrefix string // prefix to use in secret name for azure key vault }
func NewOptions ¶
func NewOptions() *Options