github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/params/crossmodel.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  import (
     7  	"gopkg.in/juju/charm.v6"
     8  	"gopkg.in/macaroon.v2-unstable"
     9  )
    10  
    11  // ExternalControllerInfoResults contains the results of querying
    12  // the information for a set of external controllers.
    13  type ExternalControllerInfoResults struct {
    14  	Results []ExternalControllerInfoResult `json:"results"`
    15  }
    16  
    17  // ExternalControllerInfoResult contains the result of querying
    18  // the information of external controllers.
    19  type ExternalControllerInfoResult struct {
    20  	Result *ExternalControllerInfo `json:"result"`
    21  	Error  *Error                  `json:"error"`
    22  }
    23  
    24  // SetControllersInfoParams contains the parameters for setting the
    25  // info for a set of external controllers.
    26  type SetExternalControllersInfoParams struct {
    27  	Controllers []SetExternalControllerInfoParams `json:"controllers"`
    28  }
    29  
    30  // SetExternalControllerInfoParams contains the parameters for setting
    31  // the info for an external controller.
    32  type SetExternalControllerInfoParams struct {
    33  	Info ExternalControllerInfo `json:"info"`
    34  }
    35  
    36  // EndpointFilterAttributes is used to filter offers matching the
    37  // specified endpoint criteria.
    38  type EndpointFilterAttributes struct {
    39  	Role      charm.RelationRole `json:"role"`
    40  	Interface string             `json:"interface"`
    41  	Name      string             `json:"name"`
    42  }
    43  
    44  // OfferFilters is used to query offers.
    45  // Offers matching any of the filters are returned.
    46  type OfferFilters struct {
    47  	Filters []OfferFilter
    48  }
    49  
    50  // OfferFilter is used to query offers.
    51  type OfferFilter struct {
    52  	// OwnerName is the owner of the model hosting the offer.
    53  	OwnerName string `json:"owner-name"`
    54  
    55  	// ModelName is the name of the model hosting the offer.
    56  	ModelName string `json:"model-name"`
    57  
    58  	OfferName              string                     `json:"offer-name"`
    59  	ApplicationName        string                     `json:"application-name"`
    60  	ApplicationDescription string                     `json:"application-description"`
    61  	ApplicationUser        string                     `json:"application-user"`
    62  	Endpoints              []EndpointFilterAttributes `json:"endpoints"`
    63  	ConnectedUserTags      []string                   `json:"connected-users"`
    64  	AllowedConsumerTags    []string                   `json:"allowed-users"`
    65  }
    66  
    67  // ApplicationOfferDetails represents an application offering from an external model.
    68  type ApplicationOfferDetails struct {
    69  	SourceModelTag         string             `json:"source-model-tag"`
    70  	OfferUUID              string             `json:"offer-uuid"`
    71  	OfferURL               string             `json:"offer-url"`
    72  	OfferName              string             `json:"offer-name"`
    73  	ApplicationDescription string             `json:"application-description"`
    74  	Endpoints              []RemoteEndpoint   `json:"endpoints,omitempty"`
    75  	Spaces                 []RemoteSpace      `json:"spaces,omitempty"`
    76  	Bindings               map[string]string  `json:"bindings,omitempty"`
    77  	Users                  []OfferUserDetails `json:"users,omitempty"`
    78  }
    79  
    80  // OfferUserDetails represents an offer consumer and their permission on the offer.
    81  type OfferUserDetails struct {
    82  	UserName    string `json:"user"`
    83  	DisplayName string `json:"display-name"`
    84  	Access      string `json:"access"`
    85  }
    86  
    87  // ApplicationOfferAdminDetails represents an application offering,
    88  // including details about how it has been deployed.
    89  type ApplicationOfferAdminDetails struct {
    90  	ApplicationOfferDetails
    91  	ApplicationName string            `json:"application-name"`
    92  	CharmURL        string            `json:"charm-url"`
    93  	Connections     []OfferConnection `json:"connections,omitempty"`
    94  }
    95  
    96  // OfferConnection holds details about a connection to an offer.
    97  type OfferConnection struct {
    98  	SourceModelTag string       `json:"source-model-tag"`
    99  	RelationId     int          `json:"relation-id"`
   100  	Username       string       `json:"username"`
   101  	Endpoint       string       `json:"endpoint"`
   102  	Status         EntityStatus `json:"status"`
   103  	IngressSubnets []string     `json:"ingress-subnets"`
   104  }
   105  
   106  // QueryApplicationOffersResults is a result of searching application offers.
   107  type QueryApplicationOffersResults struct {
   108  	// Results contains application offers matching each filter.
   109  	Results []ApplicationOfferAdminDetails `json:"results"`
   110  }
   111  
   112  // AddApplicationOffers is used when adding offers to a application directory.
   113  type AddApplicationOffers struct {
   114  	Offers []AddApplicationOffer
   115  }
   116  
   117  // AddApplicationOffer values are used to create an application offer.
   118  type AddApplicationOffer struct {
   119  	ModelTag               string            `json:"model-tag"`
   120  	OfferName              string            `json:"offer-name"`
   121  	ApplicationName        string            `json:"application-name"`
   122  	ApplicationDescription string            `json:"application-description"`
   123  	Endpoints              map[string]string `json:"endpoints"`
   124  }
   125  
   126  // DestroyApplicationOffers holds parameters for the DestroyOffers call.
   127  type DestroyApplicationOffers struct {
   128  	OfferURLs []string `json:"offer-urls"`
   129  	Force     bool     `json:"force,omitempty"`
   130  }
   131  
   132  // RemoteEndpoint represents a remote application endpoint.
   133  type RemoteEndpoint struct {
   134  	Name      string             `json:"name"`
   135  	Role      charm.RelationRole `json:"role"`
   136  	Interface string             `json:"interface"`
   137  	Limit     int                `json:"limit"`
   138  }
   139  
   140  // RemoteSpace represents a space in some remote model.
   141  type RemoteSpace struct {
   142  	CloudType          string                 `json:"cloud-type"`
   143  	Name               string                 `json:"name"`
   144  	ProviderId         string                 `json:"provider-id"`
   145  	ProviderAttributes map[string]interface{} `json:"provider-attributes"`
   146  	Subnets            []Subnet               `json:"subnets"`
   147  }
   148  
   149  // ApplicationOfferResult is a result of querying a remote
   150  // application offer based on its URL.
   151  type ApplicationOfferResult struct {
   152  	// Result contains application offer information.
   153  	Result *ApplicationOfferAdminDetails `json:"result,omitempty"`
   154  
   155  	// Error contains related error.
   156  	Error *Error `json:"error,omitempty"`
   157  }
   158  
   159  // ApplicationOffersResults is a result of listing remote application offers.
   160  type ApplicationOffersResults struct {
   161  	// Results contains collection of remote application results.
   162  	Results []ApplicationOfferResult `json:"results,omitempty"`
   163  }
   164  
   165  // OfferURLs is a collection of remote offer URLs
   166  type OfferURLs struct {
   167  	// OfferURLs contains collection of urls for applications that are to be shown.
   168  	OfferURLs []string `json:"offer-urls,omitempty"`
   169  }
   170  
   171  // ConsumeApplicationArg holds the arguments for consuming a remote application.
   172  type ConsumeApplicationArg struct {
   173  	// The offer to be consumed.
   174  	ApplicationOfferDetails
   175  
   176  	// Macaroon is used for authentication.
   177  	Macaroon *macaroon.Macaroon `json:"macaroon,omitempty"`
   178  
   179  	// ControllerInfo contains connection details to the controller
   180  	// hosting the offer.
   181  	ControllerInfo *ExternalControllerInfo `json:"external-controller,omitempty"`
   182  
   183  	// ApplicationAlias is the name of the alias to use for the application name.
   184  	ApplicationAlias string `json:"application-alias,omitempty"`
   185  }
   186  
   187  // ConsumeApplicationArgs is a collection of arg for consuming applications.
   188  type ConsumeApplicationArgs struct {
   189  	Args []ConsumeApplicationArg `json:"args,omitempty"`
   190  }
   191  
   192  // TokenResult holds a token and an error.
   193  type TokenResult struct {
   194  	Token string `json:"token,omitempty"`
   195  	Error *Error `json:"error,omitempty"`
   196  }
   197  
   198  // TokenResults has a set of token results.
   199  type TokenResults struct {
   200  	Results []TokenResult `json:"results,omitempty"`
   201  }
   202  
   203  // RemoteRelation describes the current state of a cross-model relation from
   204  // the perspective of the local model.
   205  type RemoteRelation struct {
   206  	Life                  Life           `json:"life"`
   207  	Suspended             bool           `json:"suspended"`
   208  	Id                    int            `json:"id"`
   209  	Key                   string         `json:"key"`
   210  	ApplicationName       string         `json:"application-name"`
   211  	Endpoint              RemoteEndpoint `json:"endpoint"`
   212  	RemoteApplicationName string         `json:"remote-application-name"`
   213  	RemoteEndpointName    string         `json:"remote-endpoint-name"`
   214  	SourceModelUUID       string         `json:"source-model-uuid"`
   215  }
   216  
   217  // RemoteRelationResult holds a remote relation and an error.
   218  type RemoteRelationResult struct {
   219  	Error  *Error          `json:"error,omitempty"`
   220  	Result *RemoteRelation `json:"result,omitempty"`
   221  }
   222  
   223  // RemoteRelationResults holds the result of an API call that returns
   224  // information about multiple remote relations.
   225  type RemoteRelationResults struct {
   226  	Results []RemoteRelationResult `json:"results"`
   227  }
   228  
   229  // RemoteApplication describes the current state of an application involved in a cross-
   230  // model relation, from the perspective of the local model.
   231  type RemoteApplication struct {
   232  	// Name is the name of the application.
   233  	Name string `json:"name"`
   234  
   235  	// OfferUUID is the uuid of the application offer.
   236  	OfferUUID string `json:"offer-uuid"`
   237  
   238  	// Life is the current lifecycle state of the application.
   239  	Life Life `json:"life,omitempty"`
   240  
   241  	// Status is the current status of the application.
   242  	Status string `json:"status,omitempty"`
   243  
   244  	// ModelUUID is the UUId of the model hosting the application.
   245  	ModelUUID string `json:"model-uuid"`
   246  
   247  	// IsConsumerProxy returns if the application is created
   248  	// from a registration operation by a consuming model.
   249  	IsConsumerProxy bool `json:"is-consumer-proxy"`
   250  
   251  	// Macaroon is used for authentication.
   252  	Macaroon *macaroon.Macaroon `json:"macaroon,omitempty"`
   253  }
   254  
   255  // GetTokenArgs holds the arguments to a GetTokens API call.
   256  type GetTokenArgs struct {
   257  	Args []GetTokenArg
   258  }
   259  
   260  // GetTokenArg holds the model and entity for which we want a token.
   261  type GetTokenArg struct {
   262  	// Tag is the tag of the entity for which we want the token.
   263  	Tag string `json:"tag"`
   264  }
   265  
   266  // RemoteEntityTokenArgs holds the arguments to an API call dealing with
   267  // remote entities and their tokens.
   268  type RemoteEntityTokenArgs struct {
   269  	Args []RemoteEntityTokenArg
   270  }
   271  
   272  // RemoteEntityTokenArg holds the entity and token to be operated on.
   273  type RemoteEntityTokenArg struct {
   274  	// Tag is the tag of the entity.
   275  	Tag string `json:"tag"`
   276  
   277  	// Token is the token of the entity.
   278  	Token string `json:"token,omitempty"`
   279  }
   280  
   281  // EntityMacaroonArgs holds the arguments to a SaveMacaroons API call.
   282  type EntityMacaroonArgs struct {
   283  	Args []EntityMacaroonArg
   284  }
   285  
   286  // EntityMacaroonArg holds a macaroon and entity which we want to save.
   287  type EntityMacaroonArg struct {
   288  	Macaroon *macaroon.Macaroon `json:"macaroon"`
   289  	Tag      string             `json:"tag"`
   290  }
   291  
   292  // RemoteApplicationResult holds a remote application and an error.
   293  type RemoteApplicationResult struct {
   294  	Result *RemoteApplication `json:"result,omitempty"`
   295  	Error  *Error             `json:"error,omitempty"`
   296  }
   297  
   298  // RemoteApplicationResults holds a set of remote application results.
   299  type RemoteApplicationResults struct {
   300  	Results []RemoteApplicationResult `json:"results,omitempty"`
   301  }
   302  
   303  // RemoteApplicationWatchResult holds a RemoteApplicationWatcher id,
   304  // changes and an error (if any).
   305  type RemoteApplicationWatchResult struct {
   306  	RemoteApplicationWatcherId string                   `json:"id"`
   307  	Change                     *RemoteApplicationChange `json:"change,omitempty"`
   308  	Error                      *Error                   `json:"error,omitempty"`
   309  }
   310  
   311  // RemoteApplicationWatchResults holds the results for any API call which ends
   312  // up returning a list of RemoteServiceWatchers.
   313  type RemoteApplicationWatchResults struct {
   314  	Results []RemoteApplicationWatchResult `json:"results,omitempty"`
   315  }
   316  
   317  // RemoteApplicationChange describes changes to an application.
   318  type RemoteApplicationChange struct {
   319  	// ApplicationTag is the tag of the application.
   320  	ApplicationTag string `json:"application-tag"`
   321  
   322  	// Life is the current lifecycle state of the application.
   323  	Life Life `json:"life"`
   324  
   325  	// TODO(wallyworld) - status etc
   326  }
   327  
   328  // RemoteApplicationChanges describes a set of changes to remote
   329  // applications.
   330  type RemoteApplicationChanges struct {
   331  	Changes []RemoteApplicationChange `json:"changes,omitempty"`
   332  }
   333  
   334  // RemoteRelationsChanges holds a set of RemoteRelationsChange structures.
   335  type RemoteRelationsChanges struct {
   336  	Changes []RemoteRelationChangeEvent `json:"changes,omitempty"`
   337  }
   338  
   339  // RemoteRelationUnitChange describes a relation unit change
   340  // which has occurred in a remote model.
   341  type RemoteRelationUnitChange struct {
   342  	// UnitId uniquely identifies the remote unit.
   343  	UnitId int `json:"unit-id"`
   344  
   345  	// Settings is the current settings for the relation unit.
   346  	Settings map[string]interface{} `json:"settings,omitempty"`
   347  }
   348  
   349  // RemoteRelationChangeEvent is pushed to the remote model to communicate
   350  // changes to relation units from the local model.
   351  type RemoteRelationChangeEvent struct {
   352  	// RelationToken is the token of the relation.
   353  	RelationToken string `json:"relation-token"`
   354  
   355  	// ApplicationToken is the token of the application.
   356  	ApplicationToken string `json:"application-token"`
   357  
   358  	// Life is the current lifecycle state of the relation.
   359  	Life Life `json:"life"`
   360  
   361  	// ForceCleanup is true if the offering side should forcibly
   362  	// ensure that all relation units have left scope.
   363  	ForceCleanup *bool `json:"force-cleanup,omitempty"`
   364  
   365  	// Suspended is the current suspended status of the relation.
   366  	Suspended *bool `json:"suspended,omitempty"`
   367  
   368  	SuspendedReason string `json:"suspended-reason,omitempty"`
   369  
   370  	// ChangedUnits maps unit tokens to relation unit changes.
   371  	ChangedUnits []RemoteRelationUnitChange `json:"changed-units,omitempty"`
   372  
   373  	// DepartedUnits contains the ids of units that have departed
   374  	// the relation since the last change.
   375  	DepartedUnits []int `json:"departed-units,omitempty"`
   376  
   377  	// Macaroons are used for authentication.
   378  	Macaroons macaroon.Slice `json:"macaroons,omitempty"`
   379  }
   380  
   381  // RelationLifeSuspendedStatusChange describes the life
   382  // and suspended status of a relation.
   383  type RelationLifeSuspendedStatusChange struct {
   384  	// Key is the relation key of the changed relation.
   385  	Key string `json:"key"`
   386  
   387  	// Life is the life of the relation.
   388  	Life Life `json:"life"`
   389  
   390  	// Suspended is the suspended status of the relation.
   391  	Suspended bool `json:"suspended"`
   392  
   393  	// SuspendedReason is an optional message to explain why suspended is true.
   394  	SuspendedReason string `json:"suspended-reason"`
   395  }
   396  
   397  // RelationLifeSuspendedStatusWatchResult holds a RelationStatusWatcher id, baseline state
   398  // (in the Changes field), and an error (if any).
   399  type RelationLifeSuspendedStatusWatchResult struct {
   400  	RelationStatusWatcherId string                              `json:"watcher-id"`
   401  	Changes                 []RelationLifeSuspendedStatusChange `json:"changes"`
   402  	Error                   *Error                              `json:"error,omitempty"`
   403  }
   404  
   405  // RelationStatusWatchResults holds the results for any API call which ends up
   406  // returning a list of RelationStatusWatchers.
   407  type RelationStatusWatchResults struct {
   408  	Results []RelationLifeSuspendedStatusWatchResult `json:"results"`
   409  }
   410  
   411  // OfferStatusChange describes the status of an offer.
   412  type OfferStatusChange struct {
   413  	// OfferName is the name of the offer.
   414  	OfferName string `json:"offer-name"`
   415  
   416  	// Status is the status of the offer.
   417  	Status EntityStatus `json:"status"`
   418  }
   419  
   420  // OfferStatusWatchResult holds a OfferStatusWatcher id, baseline state
   421  // (in the Changes field), and an error (if any).
   422  type OfferStatusWatchResult struct {
   423  	OfferStatusWatcherId string              `json:"watcher-id"`
   424  	Changes              []OfferStatusChange `json:"changes"`
   425  	Error                *Error              `json:"error,omitempty"`
   426  }
   427  
   428  // OfferStatusWatchResults holds the results for any API call which ends up
   429  // returning a list of OfferStatusWatchers.
   430  type OfferStatusWatchResults struct {
   431  	Results []OfferStatusWatchResult `json:"results"`
   432  }
   433  
   434  // IngressNetworksChanges holds a set of IngressNetworksChangeEvent structures.
   435  type IngressNetworksChanges struct {
   436  	Changes []IngressNetworksChangeEvent `json:"changes,omitempty"`
   437  }
   438  
   439  type IngressNetworksChangeEvent struct {
   440  	// RelationToken is the token of the relation.
   441  	RelationToken string `json:"relation-token"`
   442  
   443  	// ApplicationToken is the token of the application.
   444  	ApplicationToken string `json:"application-token"`
   445  
   446  	// Networks are the CIDRs for which ingress is required.
   447  	Networks []string `json:"networks,omitempty"`
   448  
   449  	// IngressRequired is true if ingress is needed, otherwise
   450  	// ingress should be disabled.
   451  	IngressRequired bool `json:"ingress-required"`
   452  
   453  	// Macaroons are used for authentication.
   454  	Macaroons macaroon.Slice `json:"macaroons,omitempty"`
   455  }
   456  
   457  // RegisterRemoteRelationArg holds attributes used to register a remote relation.
   458  type RegisterRemoteRelationArg struct {
   459  	// ApplicationToken is the application token on the remote model.
   460  	ApplicationToken string `json:"application-token"`
   461  
   462  	// SourceModelTag is the tag of the model hosting the application.
   463  	SourceModelTag string `json:"source-model-tag"`
   464  
   465  	// RelationToken is the relation token on the remote model.
   466  	RelationToken string `json:"relation-token"`
   467  
   468  	// RemoteEndpoint contains info about the endpoint in the remote model.
   469  	RemoteEndpoint RemoteEndpoint `json:"remote-endpoint"`
   470  
   471  	// RemoteSpace contains provider-level info about the space the
   472  	// endpoint is bound to in the remote model.
   473  	RemoteSpace RemoteSpace `json:"remote-space"`
   474  
   475  	// OfferUUID is the UUID of the offer.
   476  	OfferUUID string `json:"offer-uuid"`
   477  
   478  	// LocalEndpointName is the name of the endpoint in the local model.
   479  	LocalEndpointName string `json:"local-endpoint-name"`
   480  
   481  	// Macaroons are used for authentication.
   482  	Macaroons macaroon.Slice `json:"macaroons,omitempty"`
   483  }
   484  
   485  // RegisterRemoteRelationArgs holds args used to add remote relations.
   486  type RegisterRemoteRelationArgs struct {
   487  	Relations []RegisterRemoteRelationArg `json:"relations"`
   488  }
   489  
   490  // RegisterRemoteRelationResult holds a remote relation details and an error.
   491  type RegisterRemoteRelationResult struct {
   492  	Result *RemoteRelationDetails `json:"result,omitempty"`
   493  	Error  *Error                 `json:"error,omitempty"`
   494  }
   495  
   496  // RemoteRemoteRelationResults has a set of remote relation results.
   497  type RegisterRemoteRelationResults struct {
   498  	Results []RegisterRemoteRelationResult `json:"results,omitempty"`
   499  }
   500  
   501  // RemoteRelationDetails holds a remote relation token and corresponding macaroon.
   502  type RemoteRelationDetails struct {
   503  	Token    string             `json:"relation-token"`
   504  	Macaroon *macaroon.Macaroon `json:"macaroon,omitempty"`
   505  }
   506  
   507  // RemoteEntityArgs holds arguments to an API call dealing with remote relations.
   508  type RemoteEntityArgs struct {
   509  	Args []RemoteEntityArg `json:"args"`
   510  }
   511  
   512  // RemoteEntityArg holds a remote relation token corresponding macaroons.
   513  type RemoteEntityArg struct {
   514  	Token     string         `json:"relation-token"`
   515  	Macaroons macaroon.Slice `json:"macaroons,omitempty"`
   516  }
   517  
   518  // OfferArgs holds arguments to an API call dealing with offers.
   519  type OfferArgs struct {
   520  	Args []OfferArg `json:"args"`
   521  }
   522  
   523  // OfferArg holds an offer uuid and corresponding macaroons.
   524  type OfferArg struct {
   525  	OfferUUID string         `json:"offer-uuid"`
   526  	Macaroons macaroon.Slice `json:"macaroons,omitempty"`
   527  }
   528  
   529  // RemoteApplicationInfo has attributes for a remote application.
   530  type RemoteApplicationInfo struct {
   531  	ModelTag    string `json:"model-tag"`
   532  	Name        string `json:"name"`
   533  	Description string `json:"description"`
   534  	OfferURL    string `json:"offer-url"`
   535  	// SourceModelLabel is only populated if the application
   536  	// originates from another model on the same controller
   537  	// rather than via an offer URL.
   538  	SourceModelLabel string           `json:"source-model-label,omitempty"`
   539  	Endpoints        []RemoteEndpoint `json:"endpoints"`
   540  	// IconURLPath is relative to the model api endpoint
   541  	IconURLPath string `json:"icon-url-path"`
   542  }
   543  
   544  // RemoteApplicationInfoResult holds the result of loading
   545  // remote application info at a URL.
   546  type RemoteApplicationInfoResult struct {
   547  	Result *RemoteApplicationInfo `json:"result,omitempty"`
   548  	Error  *Error                 `json:"error,omitempty"`
   549  }
   550  
   551  // RemoteApplicationInfoResults represents the result of a RemoteApplicationInfo call.
   552  type RemoteApplicationInfoResults struct {
   553  	Results []RemoteApplicationInfoResult `json:"results"`
   554  }
   555  
   556  // ConsumeOfferDetails contains the details necessary to
   557  // consume an application offer.
   558  type ConsumeOfferDetails struct {
   559  	Offer          *ApplicationOfferDetails `json:"offer,omitempty"`
   560  	Macaroon       *macaroon.Macaroon       `json:"macaroon,omitempty"`
   561  	ControllerInfo *ExternalControllerInfo  `json:"external-controller,omitempty"`
   562  }
   563  
   564  // ConsumeOfferDetailsResult contains the details necessary to
   565  // consume an application offer or an error.
   566  type ConsumeOfferDetailsResult struct {
   567  	ConsumeOfferDetails
   568  	Error *Error `json:"error,omitempty"`
   569  }
   570  
   571  // ConsumeOfferDetailsResults represents the result of a
   572  // ConsumeOfferDetails call.
   573  type ConsumeOfferDetailsResults struct {
   574  	Results []ConsumeOfferDetailsResult `json:"results,omitempty"`
   575  }
   576  
   577  // RemoteEntities identifies multiple remote entities.
   578  type RemoteEntities struct {
   579  	Tokens []string `json:"tokens"`
   580  }
   581  
   582  // RelationUnit holds a remote relation token and a unit tag.
   583  type RemoteRelationUnit struct {
   584  	RelationToken string         `json:"relation-token"`
   585  	Unit          string         `json:"unit"`
   586  	Macaroons     macaroon.Slice `json:"macaroons,omitempty"`
   587  }
   588  
   589  // RemoteRelationUnits identifies multiple remote relation units.
   590  type RemoteRelationUnits struct {
   591  	RelationUnits []RemoteRelationUnit `json:"relation-units"`
   592  }
   593  
   594  // ModifyModelAccessRequest holds the parameters for making grant and revoke offer calls.
   595  type ModifyOfferAccessRequest struct {
   596  	Changes []ModifyOfferAccess `json:"changes"`
   597  }
   598  
   599  // ModifyOfferAccess contains parameters to grant and revoke access to an offer.
   600  type ModifyOfferAccess struct {
   601  	UserTag  string                `json:"user-tag"`
   602  	Action   OfferAction           `json:"action"`
   603  	Access   OfferAccessPermission `json:"access"`
   604  	OfferURL string                `json:"offer-url"`
   605  }
   606  
   607  // OfferAction is an action that can be performed on an offer.
   608  type OfferAction string
   609  
   610  // Actions that can be preformed on an offer.
   611  const (
   612  	GrantOfferAccess  OfferAction = "grant"
   613  	RevokeOfferAccess OfferAction = "revoke"
   614  )
   615  
   616  // OfferAccessPermission defines a type for an access permission on an offer.
   617  type OfferAccessPermission string
   618  
   619  // Access permissions that may be set on an offer.
   620  const (
   621  	OfferAdminAccess   OfferAccessPermission = "admin"
   622  	OfferConsumeAccess OfferAccessPermission = "consume"
   623  	OfferReadAccess    OfferAccessPermission = "read"
   624  )
   625  
   626  // ExternalControllerInfo holds addressed and other information
   627  // needed to make a connection to an external controller.
   628  type ExternalControllerInfo struct {
   629  	ControllerTag string   `json:"controller-tag"`
   630  	Alias         string   `json:"controller-alias"`
   631  	Addrs         []string `json:"addrs"`
   632  	CACert        string   `json:"ca-cert"`
   633  }