本文整理汇总了Golang中github.com/jen20/riviera/azure.Client类的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createResourceGroup
func createResourceGroup(azureClient *azure.Client) (string, error) {
name := fmt.Sprintf("riviera_resource_group_%d", rand.Intn(8999)+1000)
r := azureClient.NewRequest()
r.Command = azure.CreateResourceGroup{
Name: name,
Location: azure.WestUS,
Tags: map[string]*string{
"Key1": azure.String("value1"),
"Key2": azure.String("value2"),
},
}
response, err := r.Execute()
if err != nil {
return "", err
}
if !response.IsSuccessful() {
return "", fmt.Errorf("Error creating resource group %q", name)
}
return name, nil
}
示例2: registerProviderWithSubscription
func registerProviderWithSubscription(providerName string, client *riviera.Client) error {
request := client.NewRequest()
request.Command = riviera.RegisterResourceProvider{
Namespace: providerName,
}
response, err := request.Execute()
if err != nil {
return fmt.Errorf("Cannot request provider registration for Azure Resource Manager: %s.", err)
}
if !response.IsSuccessful() {
return fmt.Errorf("Credentials for accessing the Azure Resource Manager API are likely " +
"to be incorrect, or\n the service principal does not have permission to use " +
"the Azure Service Management\n API.")
}
return nil
}