github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/apiserver/params/cloud.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  // Cloud holds information about a cloud.
     7  type Cloud struct {
     8  	Type             string        `json:"type"`
     9  	AuthTypes        []string      `json:"auth-types,omitempty"`
    10  	Endpoint         string        `json:"endpoint,omitempty"`
    11  	IdentityEndpoint string        `json:"identity-endpoint,omitempty"`
    12  	StorageEndpoint  string        `json:"storage-endpoint,omitempty"`
    13  	Regions          []CloudRegion `json:"regions,omitempty"`
    14  }
    15  
    16  // CloudRegion holds information about a cloud region.
    17  type CloudRegion struct {
    18  	Name             string `json:"name"`
    19  	Endpoint         string `json:"endpoint,omitempty"`
    20  	IdentityEndpoint string `json:"identity-endpoint,omitempty"`
    21  	StorageEndpoint  string `json:"storage-endpoint,omitempty"`
    22  }
    23  
    24  // CloudResult contains a cloud definition or an error.
    25  type CloudResult struct {
    26  	Cloud *Cloud `json:"cloud,omitempty"`
    27  	Error *Error `json:"error,omitempty"`
    28  }
    29  
    30  // CloudResults contains a set of CloudResults.
    31  type CloudResults struct {
    32  	Results []CloudResult `json:"results,omitempty"`
    33  }
    34  
    35  // CloudsResult contains a set of Clouds.
    36  type CloudsResult struct {
    37  	// Clouds is a map of clouds, keyed by cloud tag.
    38  	Clouds map[string]Cloud `json:"clouds,omitempty"`
    39  }
    40  
    41  // CloudCredential contains a cloud credential
    42  // possibly with secrets redacted.
    43  type CloudCredential struct {
    44  	// AuthType is the authentication type.
    45  	AuthType string `json:"auth-type"`
    46  
    47  	// Attributes contains non-secret credential values.
    48  	Attributes map[string]string `json:"attrs,omitempty"`
    49  
    50  	// Redacted is a list of redacted attributes
    51  	Redacted []string `json:"redacted,omitempty"`
    52  }
    53  
    54  // CloudCredentialResult contains a CloudCredential or an error.
    55  type CloudCredentialResult struct {
    56  	Result *CloudCredential `json:"result,omitempty"`
    57  	Error  *Error           `json:"error,omitempty"`
    58  }
    59  
    60  // CloudCredentialResults contains a set of CloudCredentialResults.
    61  type CloudCredentialResults struct {
    62  	Results []CloudCredentialResult `json:"results,omitempty"`
    63  }
    64  
    65  // UserCloud contains a user/cloud tag pair, typically used for identifying
    66  // a user's credentials for a cloud.
    67  type UserCloud struct {
    68  	UserTag  string `json:"user-tag"`
    69  	CloudTag string `json:"cloud-tag"`
    70  }
    71  
    72  // UserClouds contains a set of UserClouds.
    73  type UserClouds struct {
    74  	UserClouds []UserCloud `json:"user-clouds,omitempty"`
    75  }
    76  
    77  // UpdateCloudCredentials contains a set of tagged cloud credentials.
    78  type UpdateCloudCredentials struct {
    79  	Credentials []UpdateCloudCredential `json:"credentials,omitempty"`
    80  }
    81  
    82  // UpdateCloudCredential contains a cloud credential and its tag,
    83  // for updating in state.
    84  type UpdateCloudCredential struct {
    85  	Tag        string          `json:"tag"`
    86  	Credential CloudCredential `json:"credential"`
    87  }
    88  
    89  // CloudSpec holds a cloud specification.
    90  type CloudSpec struct {
    91  	Type             string           `json:"type"`
    92  	Name             string           `json:"name"`
    93  	Region           string           `json:"region,omitempty"`
    94  	Endpoint         string           `json:"endpoint,omitempty"`
    95  	IdentityEndpoint string           `json:"identity-endpoint,omitempty"`
    96  	StorageEndpoint  string           `json:"storage-endpoint,omitempty"`
    97  	Credential       *CloudCredential `json:"credential,omitempty"`
    98  }
    99  
   100  // CloudSpecResult contains a CloudSpec or an error.
   101  type CloudSpecResult struct {
   102  	Result *CloudSpec `json:"result,omitempty"`
   103  	Error  *Error     `json:"error,omitempty"`
   104  }
   105  
   106  // CloudSpecResults contains a set of CloudSpecResults.
   107  type CloudSpecResults struct {
   108  	Results []CloudSpecResult `json:"results,omitempty"`
   109  }