provider/azurerm: Container Registry (#10973)
* Fixing the indentation * Adding the Container Registry SDK * Implementing the container registry * Enabling the provider / registering the Resource Provider * Acceptance Tests * Documentation for Container Registry * Fixing the name validation * Validation for the Container Registry Name * Added Import support for Containr Registry * Storage Account is no longer optional * Updating the docs * Forcing a re-run in Travis
This commit is contained in:
parent
de414eefbf
commit
874ec8b5cf
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/Azure/azure-sdk-for-go/arm/cdn"
|
||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
||||
"github.com/Azure/azure-sdk-for-go/arm/containerregistry"
|
||||
"github.com/Azure/azure-sdk-for-go/arm/eventhub"
|
||||
"github.com/Azure/azure-sdk-for-go/arm/keyvault"
|
||||
"github.com/Azure/azure-sdk-for-go/arm/network"
|
||||
|
@ -63,6 +64,8 @@ type ArmClient struct {
|
|||
cdnProfilesClient cdn.ProfilesClient
|
||||
cdnEndpointsClient cdn.EndpointsClient
|
||||
|
||||
containerRegistryClient containerregistry.RegistriesClient
|
||||
|
||||
eventHubClient eventhub.EventHubsClient
|
||||
eventHubConsumerGroupClient eventhub.ConsumerGroupsClient
|
||||
eventHubNamespacesClient eventhub.NamespacesClient
|
||||
|
@ -221,6 +224,12 @@ func (c *Config) getArmClient() (*ArmClient, error) {
|
|||
agc.Sender = autorest.CreateSender(withRequestLogging())
|
||||
client.appGatewayClient = agc
|
||||
|
||||
crc := containerregistry.NewRegistriesClient(c.SubscriptionID)
|
||||
setUserAgent(&crc.Client)
|
||||
crc.Authorizer = spt
|
||||
crc.Sender = autorest.CreateSender(withRequestLogging())
|
||||
client.containerRegistryClient = crc
|
||||
|
||||
ehc := eventhub.NewEventHubsClient(c.SubscriptionID)
|
||||
setUserAgent(&ehc.Client)
|
||||
ehc.Authorizer = spt
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package azurerm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccAzureRMContainerRegistry_importBasic(t *testing.T) {
|
||||
resourceName := "azurerm_container_registry.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
rs := acctest.RandString(4)
|
||||
config := fmt.Sprintf(testAccAzureRMContainerRegistry_basic, ri, rs, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMContainerRegistryDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"storage_account"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMContainerRegistry_importComplete(t *testing.T) {
|
||||
resourceName := "azurerm_container_registry.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
rs := acctest.RandString(4)
|
||||
config := fmt.Sprintf(testAccAzureRMContainerRegistry_complete, ri, rs, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMContainerRegistryDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"storage_account"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -51,9 +51,10 @@ func Provider() terraform.ResourceProvider {
|
|||
|
||||
ResourcesMap: map[string]*schema.Resource{
|
||||
// These resources use the Azure ARM SDK
|
||||
"azurerm_availability_set": resourceArmAvailabilitySet(),
|
||||
"azurerm_cdn_endpoint": resourceArmCdnEndpoint(),
|
||||
"azurerm_cdn_profile": resourceArmCdnProfile(),
|
||||
"azurerm_availability_set": resourceArmAvailabilitySet(),
|
||||
"azurerm_cdn_endpoint": resourceArmCdnEndpoint(),
|
||||
"azurerm_cdn_profile": resourceArmCdnProfile(),
|
||||
"azurerm_container_registry": resourceArmContainerRegistry(),
|
||||
|
||||
"azurerm_eventhub": resourceArmEventHub(),
|
||||
"azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(),
|
||||
|
@ -209,6 +210,7 @@ func registerAzureResourceProvidersWithSubscription(client *riviera.Client) erro
|
|||
// We register Microsoft.Compute during client initialization
|
||||
providers := []string{
|
||||
"Microsoft.Cache",
|
||||
"Microsoft.ContainerRegistry",
|
||||
"Microsoft.Network",
|
||||
"Microsoft.Cdn",
|
||||
"Microsoft.Storage",
|
||||
|
|
|
@ -0,0 +1,236 @@
|
|||
package azurerm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"net/http"
|
||||
|
||||
"regexp"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/arm/containerregistry"
|
||||
"github.com/hashicorp/terraform/helper/hashcode"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/jen20/riviera/azure"
|
||||
)
|
||||
|
||||
func resourceArmContainerRegistry() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
Create: resourceArmContainerRegistryCreate,
|
||||
Read: resourceArmContainerRegistryRead,
|
||||
Update: resourceArmContainerRegistryCreate,
|
||||
Delete: resourceArmContainerRegistryDelete,
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
ValidateFunc: validateAzureRMContainerRegistryName,
|
||||
},
|
||||
|
||||
"resource_group_name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"location": locationSchema(),
|
||||
|
||||
"admin_enabled": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
|
||||
"storage_account": {
|
||||
Type: schema.TypeSet,
|
||||
Required: true,
|
||||
MaxItems: 1,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
},
|
||||
|
||||
"access_key": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Sensitive: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
"login_server": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"admin_username": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"admin_password": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"tags": tagsSchema(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func resourceArmContainerRegistryCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
client := meta.(*ArmClient).containerRegistryClient
|
||||
log.Printf("[INFO] preparing arguments for AzureRM Container Registry creation.")
|
||||
|
||||
resourceGroup := d.Get("resource_group_name").(string)
|
||||
name := d.Get("name").(string)
|
||||
location := d.Get("location").(string)
|
||||
|
||||
adminUserEnabled := d.Get("admin_enabled").(bool)
|
||||
tags := d.Get("tags").(map[string]interface{})
|
||||
|
||||
parameters := containerregistry.Registry{
|
||||
Location: &location,
|
||||
RegistryProperties: &containerregistry.RegistryProperties{
|
||||
AdminUserEnabled: &adminUserEnabled,
|
||||
},
|
||||
Tags: expandTags(tags),
|
||||
}
|
||||
|
||||
accounts := d.Get("storage_account").(*schema.Set).List()
|
||||
account := accounts[0].(map[string]interface{})
|
||||
storageAccountName := account["name"].(string)
|
||||
storageAccountAccessKey := account["access_key"].(string)
|
||||
parameters.RegistryProperties.StorageAccount = &containerregistry.StorageAccountProperties{
|
||||
Name: azure.String(storageAccountName),
|
||||
AccessKey: azure.String(storageAccountAccessKey),
|
||||
}
|
||||
|
||||
_, err := client.CreateOrUpdate(resourceGroup, name, parameters)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
read, err := client.GetProperties(resourceGroup, name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if read.ID == nil {
|
||||
return fmt.Errorf("Cannot read Container Registry %s (resource group %s) ID", name, resourceGroup)
|
||||
}
|
||||
|
||||
d.SetId(*read.ID)
|
||||
|
||||
return resourceArmContainerRegistryRead(d, meta)
|
||||
}
|
||||
|
||||
func resourceArmContainerRegistryRead(d *schema.ResourceData, meta interface{}) error {
|
||||
client := meta.(*ArmClient).containerRegistryClient
|
||||
|
||||
id, err := parseAzureResourceID(d.Id())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resourceGroup := id.ResourceGroup
|
||||
name := id.Path["registries"]
|
||||
|
||||
resp, err := client.GetProperties(resourceGroup, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error making Read request on Azure Container Registry %s: %s", name, err)
|
||||
}
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
d.SetId("")
|
||||
return nil
|
||||
}
|
||||
|
||||
d.Set("name", resp.Name)
|
||||
d.Set("resource_group_name", resourceGroup)
|
||||
d.Set("location", azureRMNormalizeLocation(*resp.Location))
|
||||
d.Set("admin_enabled", resp.AdminUserEnabled)
|
||||
d.Set("login_server", resp.LoginServer)
|
||||
|
||||
if resp.StorageAccount != nil {
|
||||
flattenArmContainerRegistryStorageAccount(d, resp.StorageAccount)
|
||||
}
|
||||
|
||||
if *resp.AdminUserEnabled {
|
||||
credsResp, err := client.GetCredentials(resourceGroup, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error making Read request on Azure Container Registry %s for Credentials: %s", name, err)
|
||||
}
|
||||
|
||||
d.Set("admin_username", credsResp.Username)
|
||||
d.Set("admin_password", credsResp.Password)
|
||||
} else {
|
||||
d.Set("admin_username", "")
|
||||
d.Set("admin_password", "")
|
||||
}
|
||||
|
||||
flattenAndSetTags(d, resp.Tags)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceArmContainerRegistryDelete(d *schema.ResourceData, meta interface{}) error {
|
||||
client := meta.(*ArmClient).containerRegistryClient
|
||||
|
||||
id, err := parseAzureResourceID(d.Id())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resourceGroup := id.ResourceGroup
|
||||
name := id.Path["registries"]
|
||||
|
||||
resp, err := client.Delete(resourceGroup, name)
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("Error issuing Azure ARM delete request of Container Registry '%s': %s", name, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func flattenArmContainerRegistryStorageAccount(d *schema.ResourceData, properties *containerregistry.StorageAccountProperties) {
|
||||
storageAccounts := schema.Set{
|
||||
F: resourceAzureRMContainerRegistryStorageAccountHash,
|
||||
}
|
||||
|
||||
storageAccount := map[string]interface{}{}
|
||||
storageAccount["name"] = properties.Name
|
||||
storageAccounts.Add(storageAccount)
|
||||
|
||||
d.Set("storage_account", &storageAccounts)
|
||||
}
|
||||
|
||||
func resourceAzureRMContainerRegistryStorageAccountHash(v interface{}) int {
|
||||
m := v.(map[string]interface{})
|
||||
name := m["name"].(*string)
|
||||
return hashcode.String(*name)
|
||||
}
|
||||
|
||||
func validateAzureRMContainerRegistryName(v interface{}, k string) (ws []string, errors []error) {
|
||||
value := v.(string)
|
||||
if !regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString(value) {
|
||||
errors = append(errors, fmt.Errorf(
|
||||
"alpha numeric characters only are allowed in %q: %q", k, value))
|
||||
}
|
||||
|
||||
if 5 > len(value) {
|
||||
errors = append(errors, fmt.Errorf("%q cannot be less than 5 characters: %q", k, value))
|
||||
}
|
||||
|
||||
if len(value) >= 50 {
|
||||
errors = append(errors, fmt.Errorf("%q cannot be longer than 50 characters: %q %d", k, value, len(value)))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
package azurerm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccAzureRMContainerRegistryName_validation(t *testing.T) {
|
||||
cases := []struct {
|
||||
Value string
|
||||
ErrCount int
|
||||
}{
|
||||
{
|
||||
Value: "four",
|
||||
ErrCount: 1,
|
||||
},
|
||||
{
|
||||
Value: "5five",
|
||||
ErrCount: 0,
|
||||
},
|
||||
{
|
||||
Value: "hello-world",
|
||||
ErrCount: 1,
|
||||
},
|
||||
{
|
||||
Value: "hello_world",
|
||||
ErrCount: 1,
|
||||
},
|
||||
{
|
||||
Value: "helloWorld",
|
||||
ErrCount: 0,
|
||||
},
|
||||
{
|
||||
Value: "helloworld12",
|
||||
ErrCount: 0,
|
||||
},
|
||||
{
|
||||
Value: "hello@world",
|
||||
ErrCount: 1,
|
||||
},
|
||||
{
|
||||
Value: "qfvbdsbvipqdbwsbddbdcwqffewsqwcdw21ddwqwd3324120",
|
||||
ErrCount: 0,
|
||||
},
|
||||
{
|
||||
Value: "qfvbdsbvipqdbwsbddbdcwqffewsqwcdw21ddwqwd33241202",
|
||||
ErrCount: 0,
|
||||
},
|
||||
{
|
||||
Value: "qfvbdsbvipqdbwsbddbdcwqfjjfewsqwcdw21ddwqwd3324120",
|
||||
ErrCount: 1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
_, errors := validateAzureRMContainerRegistryName(tc.Value, "azurerm_container_registry")
|
||||
|
||||
if len(errors) != tc.ErrCount {
|
||||
t.Fatalf("Expected the Azure RM Container Registry Name to trigger a validation error: %v", errors)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccAzureRMContainerRegistry_basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
rs := acctest.RandString(4)
|
||||
config := fmt.Sprintf(testAccAzureRMContainerRegistry_basic, ri, rs, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMContainerRegistryDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testCheckAzureRMContainerRegistryExists("azurerm_container_registry.test"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMContainerRegistry_complete(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
rs := acctest.RandString(4)
|
||||
config := fmt.Sprintf(testAccAzureRMContainerRegistry_complete, ri, rs, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMContainerRegistryDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testCheckAzureRMContainerRegistryExists("azurerm_container_registry.test"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testCheckAzureRMContainerRegistryDestroy(s *terraform.State) error {
|
||||
conn := testAccProvider.Meta().(*ArmClient).containerRegistryClient
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "azurerm_container_registry" {
|
||||
continue
|
||||
}
|
||||
|
||||
name := rs.Primary.Attributes["name"]
|
||||
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
||||
|
||||
resp, err := conn.GetProperties(resourceGroup, name)
|
||||
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusNotFound {
|
||||
return fmt.Errorf("Container Registry still exists:\n%#v", resp)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testCheckAzureRMContainerRegistryExists(name string) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
// Ensure we have enough information in state to look up in API
|
||||
rs, ok := s.RootModule().Resources[name]
|
||||
if !ok {
|
||||
return fmt.Errorf("Not found: %s", name)
|
||||
}
|
||||
|
||||
name := rs.Primary.Attributes["name"]
|
||||
resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"]
|
||||
if !hasResourceGroup {
|
||||
return fmt.Errorf("Bad: no resource group found in state for Container Registry: %s", name)
|
||||
}
|
||||
|
||||
conn := testAccProvider.Meta().(*ArmClient).containerRegistryClient
|
||||
|
||||
resp, err := conn.GetProperties(resourceGroup, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Bad: Get on containerRegistryClient: %s", err)
|
||||
}
|
||||
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
return fmt.Errorf("Bad: Container Registry %q (resource group: %q) does not exist", name, resourceGroup)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
var testAccAzureRMContainerRegistry_basic = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "testAccRg-%d"
|
||||
location = "West US"
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "test" {
|
||||
name = "testaccsa%s"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
account_type = "Standard_LRS"
|
||||
}
|
||||
|
||||
resource "azurerm_container_registry" "test" {
|
||||
name = "testacccr%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
|
||||
storage_account {
|
||||
name = "${azurerm_storage_account.test.name}"
|
||||
access_key = "${azurerm_storage_account.test.primary_access_key}"
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var testAccAzureRMContainerRegistry_complete = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "testAccRg-%d"
|
||||
location = "West US"
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "test" {
|
||||
name = "testaccsa%s"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
account_type = "Standard_LRS"
|
||||
}
|
||||
|
||||
resource "azurerm_container_registry" "test" {
|
||||
name = "testacccr%d"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
admin_enabled = false
|
||||
|
||||
storage_account {
|
||||
name = "${azurerm_storage_account.test.name}"
|
||||
access_key = "${azurerm_storage_account.test.primary_access_key}"
|
||||
}
|
||||
|
||||
tags {
|
||||
environment = "production"
|
||||
}
|
||||
}
|
||||
`
|
57
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go
generated
vendored
Normal file
57
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/client.go
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Package containerregistry implements the Azure ARM Containerregistry
|
||||
// service API version 2016-06-27-preview.
|
||||
//
|
||||
package containerregistry
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
// APIVersion is the version of the Containerregistry
|
||||
APIVersion = "2016-06-27-preview"
|
||||
|
||||
// DefaultBaseURI is the default URI used for the service Containerregistry
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
)
|
||||
|
||||
// ManagementClient is the base client for Containerregistry.
|
||||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
APIVersion string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the ManagementClient client.
|
||||
func New(subscriptionID string) ManagementClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the ManagementClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
|
||||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
APIVersion: APIVersion,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
118
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go
generated
vendored
Normal file
118
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/models.go
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
package containerregistry
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Registry is an object that represents a container registry.
|
||||
type Registry struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
*RegistryProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// RegistryCredentials is the result of a request to get the administrator
|
||||
// login credentials for a container registry.
|
||||
type RegistryCredentials struct {
|
||||
autorest.Response `json:"-"`
|
||||
Username *string `json:"username,omitempty"`
|
||||
Password *string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// RegistryListResult is the result of a request to list container registries.
|
||||
type RegistryListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Registry `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// RegistryListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client RegistryListResult) RegistryListResultPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// RegistryNameCheckRequest is a request to check whether the container
|
||||
// registry name is available.
|
||||
type RegistryNameCheckRequest struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// RegistryNameStatus is the result of a request to check the availability of
|
||||
// a container registry name.
|
||||
type RegistryNameStatus struct {
|
||||
autorest.Response `json:"-"`
|
||||
NameAvailable *bool `json:"nameAvailable,omitempty"`
|
||||
Reason *string `json:"reason,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// RegistryProperties is the properties of a container registry.
|
||||
type RegistryProperties struct {
|
||||
LoginServer *string `json:"loginServer,omitempty"`
|
||||
CreationDate *date.Time `json:"creationDate,omitempty"`
|
||||
AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
|
||||
StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
|
||||
}
|
||||
|
||||
// RegistryPropertiesUpdateParameters is the parameters for updating the
|
||||
// properties of a container registry.
|
||||
type RegistryPropertiesUpdateParameters struct {
|
||||
AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"`
|
||||
StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
|
||||
}
|
||||
|
||||
// RegistryUpdateParameters is the parameters for updating a container
|
||||
// registry.
|
||||
type RegistryUpdateParameters struct {
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
*RegistryPropertiesUpdateParameters `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// Resource is an Azure resource.
|
||||
type Resource struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// StorageAccountProperties is the properties of a storage account for a
|
||||
// container registry.
|
||||
type StorageAccountProperties struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AccessKey *string `json:"accessKey,omitempty"`
|
||||
}
|
685
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go
generated
vendored
Normal file
685
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/registries.go
generated
vendored
Normal file
|
@ -0,0 +1,685 @@
|
|||
package containerregistry
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// RegistriesClient is the client for the Registries methods of the
|
||||
// Containerregistry service.
|
||||
type RegistriesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewRegistriesClient creates an instance of the RegistriesClient client.
|
||||
func NewRegistriesClient(subscriptionID string) RegistriesClient {
|
||||
return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient
|
||||
// client.
|
||||
func NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient {
|
||||
return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CheckNameAvailability checks whether the container registry name is
|
||||
// available for use. The name must contain only alphanumeric characters, be
|
||||
// globally unique, and between 5 and 60 characters in length.
|
||||
//
|
||||
// registryNameCheckRequest is the object containing information for the
|
||||
// availability request.
|
||||
func (client RegistriesClient) CheckNameAvailability(registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: registryNameCheckRequest,
|
||||
Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CheckNameAvailability")
|
||||
}
|
||||
|
||||
req, err := client.CheckNameAvailabilityPreparer(registryNameCheckRequest)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.CheckNameAvailabilitySender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.CheckNameAvailabilityResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
|
||||
func (client RegistriesClient) CheckNameAvailabilityPreparer(registryNameCheckRequest RegistryNameCheckRequest) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters),
|
||||
autorest.WithJSON(registryNameCheckRequest),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates a container registry with the specified
|
||||
// parameters.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to which the container
|
||||
// registry belongs. registryName is the name of the container registry.
|
||||
// registry is the parameters for creating or updating a container registry.
|
||||
func (client RegistriesClient) CreateOrUpdate(resourceGroupName string, registryName string, registry Registry) (result Registry, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: registry,
|
||||
Constraints: []validation.Constraint{{Target: "registry.RegistryProperties", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.Name", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "registry.RegistryProperties.StorageAccount.AccessKey", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}},
|
||||
{Target: "registry.RegistryProperties.LoginServer", Name: validation.ReadOnly, Rule: true, Chain: nil},
|
||||
{Target: "registry.RegistryProperties.CreationDate", Name: validation.ReadOnly, Rule: true, Chain: nil},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "containerregistry.RegistriesClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, registryName, registry)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client RegistriesClient) CreateOrUpdatePreparer(resourceGroupName string, registryName string, registry Registry) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"registryName": autorest.Encode("path", registryName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
|
||||
autorest.WithJSON(registry),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) CreateOrUpdateResponder(resp *http.Response) (result Registry, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes a container registry.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to which the container
|
||||
// registry belongs. registryName is the name of the container registry.
|
||||
func (client RegistriesClient) Delete(resourceGroupName string, registryName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(resourceGroupName, registryName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client RegistriesClient) DeletePreparer(resourceGroupName string, registryName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"registryName": autorest.Encode("path", registryName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// GetCredentials gets the administrator login credentials for the specified
|
||||
// container registry.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to which the container
|
||||
// registry belongs. registryName is the name of the container registry.
|
||||
func (client RegistriesClient) GetCredentials(resourceGroupName string, registryName string) (result RegistryCredentials, err error) {
|
||||
req, err := client.GetCredentialsPreparer(resourceGroupName, registryName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.GetCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.GetCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetCredentialsPreparer prepares the GetCredentials request.
|
||||
func (client RegistriesClient) GetCredentialsPreparer(resourceGroupName string, registryName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"registryName": autorest.Encode("path", registryName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getCredentials", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetCredentialsSender sends the GetCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) GetCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetCredentialsResponder handles the response to the GetCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) GetCredentialsResponder(resp *http.Response) (result RegistryCredentials, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetProperties gets the properties of the specified container registry.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to which the container
|
||||
// registry belongs. registryName is the name of the container registry.
|
||||
func (client RegistriesClient) GetProperties(resourceGroupName string, registryName string) (result Registry, err error) {
|
||||
req, err := client.GetPropertiesPreparer(resourceGroupName, registryName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.GetPropertiesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.GetPropertiesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetProperties", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPropertiesPreparer prepares the GetProperties request.
|
||||
func (client RegistriesClient) GetPropertiesPreparer(resourceGroupName string, registryName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"registryName": autorest.Encode("path", registryName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetPropertiesSender sends the GetProperties request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetPropertiesResponder handles the response to the GetProperties request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) GetPropertiesResponder(resp *http.Response) (result Registry, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List lists all the available container registries under the specified
|
||||
// subscription.
|
||||
func (client RegistriesClient) List() (result RegistryListResult, err error) {
|
||||
req, err := client.ListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client RegistriesClient) ListPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextResults retrieves the next set of results, if any.
|
||||
func (client RegistriesClient) ListNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) {
|
||||
req, err := lastResults.RegistryListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroup lists all the available container registries under the
|
||||
// specified resource group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to which the container
|
||||
// registry belongs.
|
||||
func (client RegistriesClient) ListByResourceGroup(resourceGroupName string) (result RegistryListResult, err error) {
|
||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client RegistriesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupNextResults retrieves the next set of results, if any.
|
||||
func (client RegistriesClient) ListByResourceGroupNextResults(lastResults RegistryListResult) (result RegistryListResult, err error) {
|
||||
req, err := lastResults.RegistryListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// RegenerateCredentials regenerates the administrator login credentials for
|
||||
// the specified container registry.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to which the container
|
||||
// registry belongs. registryName is the name of the container registry.
|
||||
func (client RegistriesClient) RegenerateCredentials(resourceGroupName string, registryName string) (result RegistryCredentials, err error) {
|
||||
req, err := client.RegenerateCredentialsPreparer(resourceGroupName, registryName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.RegenerateCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.RegenerateCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// RegenerateCredentialsPreparer prepares the RegenerateCredentials request.
|
||||
func (client RegistriesClient) RegenerateCredentialsPreparer(resourceGroupName string, registryName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"registryName": autorest.Encode("path", registryName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/regenerateCredentials", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// RegenerateCredentialsSender sends the RegenerateCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) RegenerateCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// RegenerateCredentialsResponder handles the response to the RegenerateCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) RegenerateCredentialsResponder(resp *http.Response) (result RegistryCredentials, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Update updates a container registry with the specified parameters.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to which the container
|
||||
// registry belongs. registryName is the name of the container registry.
|
||||
// registryUpdateParameters is the parameters for updating a container
|
||||
// registry.
|
||||
func (client RegistriesClient) Update(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result Registry, err error) {
|
||||
req, err := client.UpdatePreparer(resourceGroupName, registryName, registryUpdateParameters)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client RegistriesClient) UpdatePreparer(resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"registryName": autorest.Encode("path", registryName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", pathParameters),
|
||||
autorest.WithJSON(registryUpdateParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client RegistriesClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateResponder handles the response to the Update request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
43
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go
generated
vendored
Normal file
43
vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry/version.go
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
package containerregistry
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const (
|
||||
major = "7"
|
||||
minor = "0"
|
||||
patch = "1"
|
||||
// Always begin a "tag" with a dash (as per http://semver.org)
|
||||
tag = "-beta"
|
||||
semVerFormat = "%s.%s.%s%s"
|
||||
userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
|
||||
)
|
||||
|
||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||
func UserAgent() string {
|
||||
return fmt.Sprintf(userAgentFormat, Version(), "containerregistry", "2016-06-27-preview")
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
|
||||
}
|
|
@ -11,6 +11,15 @@
|
|||
"version": "v7.0.1-beta",
|
||||
"versionExact": "v7.0.1-beta"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "duGYYmAIPryWG256C+VrJgNy1uU=",
|
||||
"comment": "v2.1.1-beta-8-gca4d906",
|
||||
"path": "github.com/Azure/azure-sdk-for-go/arm/containerregistry",
|
||||
"revision": "0984e0641ae43b89283223034574d6465be93bf4",
|
||||
"revisionTime": "2016-11-30T22:29:01Z",
|
||||
"version": "v7.0.1-beta",
|
||||
"versionExact": "v7.0.1-beta"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "duGYYmAIPryWG256C+VrJgNy1uU=",
|
||||
"comment": "v2.1.1-beta-8-gca4d906",
|
||||
|
|
|
@ -25,8 +25,8 @@ resource "azurerm_cdn_profile" "test" {
|
|||
sku = "Standard_Verizon"
|
||||
|
||||
tags {
|
||||
environment = "Production"
|
||||
cost_center = "MSFT"
|
||||
environment = "Production"
|
||||
cost_center = "MSFT"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -45,7 +45,7 @@ The following arguments are supported:
|
|||
|
||||
* `sku` - (Required) The pricing related information of current CDN profile. Accepted values are `Standard_Verizon`, `Standard_Akamai` or `Premium_Verizon`.
|
||||
|
||||
* `tags` - (Optional) A mapping of tags to assign to the resource.
|
||||
* `tags` - (Optional) A mapping of tags to assign to the resource.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
|
@ -55,8 +55,8 @@ The following attributes are exported:
|
|||
|
||||
## Import
|
||||
|
||||
CDN Profiles can be imported using the `resource id`, e.g.
|
||||
CDN Profiles can be imported using the `resource id`, e.g.
|
||||
|
||||
```
|
||||
terraform import azurerm_cdn_profile.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Cdn/profiles/myprofile1
|
||||
```
|
||||
```
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
---
|
||||
layout: "azurerm"
|
||||
page_title: "Azure Resource Manager: azurerm_container_registry"
|
||||
sidebar_current: "docs-azurerm-resource-container-registry"
|
||||
description: |-
|
||||
Create as an Azure Container Registry instance.
|
||||
---
|
||||
|
||||
# azurerm\_container\_registry
|
||||
|
||||
Create as an Azure Container Registry instance.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "resourceGroup1"
|
||||
location = "West US"
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "test" {
|
||||
name = "storageAccount1"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
account_type = "Standard_GRS"
|
||||
}
|
||||
|
||||
resource "azurerm_container_registry" "test" {
|
||||
name = "containerRegistry1"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
location = "${azurerm_resource_group.test.location}"
|
||||
admin_enabled = true
|
||||
|
||||
storage_account {
|
||||
name = "${azurerm_storage_account.test.name}"
|
||||
access_key = "${azurerm_storage_account.test.primary_access_key}"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) Specifies the name of the Container Registry. Changing this forces a
|
||||
new resource to be created.
|
||||
|
||||
* `resource_group_name` - (Required) The name of the resource group in which to
|
||||
create the Container Registry.
|
||||
|
||||
* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
|
||||
|
||||
* `admin_enabled` - (Optional) Specifies whether the admin user is enabled. Defaults to `false`.
|
||||
|
||||
* `storage_account` - (Required) A Storage Account block as documented below - which must be located in the same data center as the Container Registry.
|
||||
|
||||
* `tags` - (Optional) A mapping of tags to assign to the resource.
|
||||
|
||||
`storage_account` supports the following:
|
||||
|
||||
* `name` - (Required) The name of the storage account, which must be in the same physical location as the Container Registry.
|
||||
* `access_key` - (Required) The access key to the storage account.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
The following attributes are exported:
|
||||
|
||||
* `id` - The Container Registry ID.
|
||||
|
||||
* `login_server` - The URL that can be used to log into the container registry.
|
||||
|
||||
* `admin_username` - The Username associated with the Container Registry Admin account - if the admin account is enabled.
|
||||
|
||||
* `admin_password` - The Password associated with the Container Registry Admin account - if the admin account is enabled.
|
||||
|
||||
## Import
|
||||
|
||||
Container Registries can be imported using the `resource id`, e.g.
|
||||
|
||||
```
|
||||
terraform import azurerm_container_registry.test /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/mygroup1/providers/Microsoft.ContainerRegistry/registries/myregistry1
|
||||
```
|
|
@ -44,6 +44,17 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current(/^docs-azurerm-resource-container/) %>>
|
||||
<a href="#">Container Resources</a>
|
||||
<ul class="nav nav-visible">
|
||||
|
||||
<li<%= sidebar_current("docs-azurerm-resource-container-registry") %>>
|
||||
<a href="/docs/providers/azurerm/r/container_registry.html">azurerm_container_registry</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current(/^docs-azurerm-resource-dns/) %>>
|
||||
<a href="#">DNS Resources</a>
|
||||
<ul class="nav nav-visible">
|
||||
|
|
Loading…
Reference in New Issue