-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
652 changed files
with
50,570 additions
and
4,720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
issues: | ||
max-per-linter: 0 | ||
max-same-issues: 0 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- deadcode | ||
- errcheck | ||
- gofmt | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- interfacer | ||
- nakedret | ||
- misspell | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unused | ||
- unconvert | ||
- varcheck | ||
- vet | ||
- vetshadow | ||
|
||
linters-settings: | ||
errcheck: | ||
ignore: github.com/hashicorp/terraform/helper/schema:ForceNew|Set,fmt:.*,io:Close | ||
|
||
run: | ||
modules-download-mode: vendor |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package azurerm | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" | ||
) | ||
|
||
func dataSourceApiManagementGroup() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: dataSourceApiManagementGroupRead, | ||
|
||
Schema: map[string]*schema.Schema{ | ||
"name": azure.SchemaApiManagementChildDataSourceName(), | ||
|
||
"resource_group_name": resourceGroupNameForDataSourceSchema(), | ||
|
||
"api_management_name": azure.SchemaApiManagementDataSourceName(), | ||
|
||
"display_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
|
||
"description": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
|
||
"external_id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
|
||
"type": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceApiManagementGroupRead(d *schema.ResourceData, meta interface{}) error { | ||
client := meta.(*ArmClient).apiManagementGroupClient | ||
ctx := meta.(*ArmClient).StopContext | ||
|
||
resourceGroup := d.Get("resource_group_name").(string) | ||
serviceName := d.Get("api_management_name").(string) | ||
name := d.Get("name").(string) | ||
|
||
resp, err := client.Get(ctx, resourceGroup, serviceName, name) | ||
if err != nil { | ||
if utils.ResponseWasNotFound(resp.Response) { | ||
log.Printf("[DEBUG] Group %q (Resource Group %q / API Management Service %q) was not found - removing from state!", name, resourceGroup, serviceName) | ||
d.SetId("") | ||
return nil | ||
} | ||
|
||
return fmt.Errorf("Error making Read request for Group %q (Resource Group %q / API Management Service %q): %+v", name, resourceGroup, serviceName, err) | ||
} | ||
|
||
d.SetId(*resp.ID) | ||
|
||
d.Set("name", resp.Name) | ||
d.Set("resource_group_name", resourceGroup) | ||
d.Set("api_management_name", serviceName) | ||
|
||
if properties := resp.GroupContractProperties; properties != nil { | ||
d.Set("display_name", properties.DisplayName) | ||
d.Set("description", properties.Description) | ||
d.Set("external_id", properties.ExternalID) | ||
d.Set("type", string(properties.Type)) | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.