mantle/auth/azure: delete unused fields; unexport internal code
@@ -47,42 +47,26 @@ type Options struct {
StorageEndpointSuffix string
}
-type AzureEnvironment struct {
- ActiveDirectoryEndpointURL string `json:"activeDirectoryEndpointUrl"`
- ActiveDirectoryGraphAPIVersion string `json:"activeDirectoryGraphApiVersion"`
- ActiveDirectoryGraphResourceID string `json:"activeDirectoryGraphResourceId"`
- ActiveDirectoryResourceID string `json:"activeDirectoryResourceId"`
- AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix string `json:"azureDataLakeAnalyticsCatalogAndJobEndpointSuffix"`
- AzureDataLakeStoreFileSystemEndpointSuffix string `json:"azureDataLakeStoreFileSystemEndpointSuffix"`
- GalleryEndpointURL string `json:"galleryEndpointUrl"`
- KeyVaultDNSSuffix string `json:"keyVaultDnsSuffix"`
+type azureEnvironment struct {
Name string `json:"name"`
- PortalURL string `json:"portalUrl"`
- PublishingProfileURL string `json:"publishingProfileUrl"`
- ResourceManagerEndpointURL string `json:"resourceManagerEndpointUrl"`
- SqlManagementEndpointURL string `json:"sqlManagementEndpointUrl"`
- SqlServerHostnameSuffix string `json:"sqlServerHostnameSuffix"`
StorageEndpointSuffix string `json:"storageEndpointSuffix"`
}
-type AzureSubscription struct {
+type azureSubscription struct {
EnvironmentName string `json:"environmentName"`
ID string `json:"id"`
- IsDefault bool `json:"isDefault"`
Name string `json:"name"`
- RegisteredProviders []string `json:"registeredProviders"`
- State string `json:"state"`
}
// AzureProfile represents a parsed Azure Profile Configuration File.
type AzureProfile struct {
- Environments []AzureEnvironment `json:"environments"`
- Subscriptions []AzureSubscription `json:"subscriptions"`
+ Environments []azureEnvironment `json:"environments"`
+ Subscriptions []azureSubscription `json:"subscriptions"`
}
// AsOptions converts all subscriptions into a slice of Options.
// If there is an environment with a name matching the subscription, that environment's storage endpoint will be copied to the options.
-func (ap *AzureProfile) AsOptions() []Options {
+func (ap *AzureProfile) asOptions() []Options {
var o []Options
for _, sub := range ap.Subscriptions {
@@ -109,7 +93,7 @@ func (ap *AzureProfile) AsOptions() []Options {
// If the subscription name is "", the first subscription is returned.
// If there are no subscriptions or the named subscription is not found, SubscriptionOptions returns nil.
func (ap *AzureProfile) SubscriptionOptions(name string) *Options {
- opts := ap.AsOptions()
+ opts := ap.asOptions()
if len(opts) == 0 {
return nil
@@ -118,7 +102,7 @@ func (ap *AzureProfile) SubscriptionOptions(name string) *Options {
if name == "" {
return &opts[0]
} else {
- for _, o := range ap.AsOptions() {
+ for _, o := range opts {
if o.SubscriptionName == name {
return &o
}
@@ -141,7 +125,7 @@ func ReadAzureProfile(path string) (*AzureProfile, error) {
path = filepath.Join(user.HomeDir, AzureProfilePath)
}
- contents, err := DecodeBOMFile(path)
+ contents, err := decodeBOMFile(path)
if err != nil {
return nil, err
}
@@ -158,7 +142,7 @@ func ReadAzureProfile(path string) (*AzureProfile, error) {
return &ap, nil
}
-func DecodeBOMFile(path string) ([]byte, error) {
+func decodeBOMFile(path string) ([]byte, error) {
f, err := os.Open(path)
if err != nil {
return nil, err
