Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drops old facade versions. #1086

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions api/jimm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@ func NewClient(c APICaller) *Client {

// AddCloudToController adds the specified cloud to a specific controller in JIMM.
func (c *Client) AddCloudToController(req *params.AddCloudToControllerRequest) error {
return c.caller.APICall("JIMM", 3, "", "AddCloudToController", req, nil)
return c.caller.APICall("JIMM", 4, "", "AddCloudToController", req, nil)
}

// AddController adds a new controller to JIMM.
func (c *Client) AddController(req *params.AddControllerRequest) (params.ControllerInfo, error) {
var info params.ControllerInfo
err := c.caller.APICall("JIMM", 3, "", "AddController", req, &info)
err := c.caller.APICall("JIMM", 4, "", "AddController", req, &info)
return info, err
}

// DisableControllerUUIDMasking disables UUID the masking of the real
// controller UUID with JIMM's UUID in those response.
func (c *Client) DisableControllerUUIDMasking() error {
return c.caller.APICall("JIMM", 3, "", "DisableControllerUUIDMasking", nil, nil)
return c.caller.APICall("JIMM", 4, "", "DisableControllerUUIDMasking", nil, nil)
}

// FindAuditEvents finds audit events that match the requested filters.
func (c *Client) FindAuditEvents(req *params.FindAuditEventsRequest) (params.AuditEvents, error) {
var resp params.AuditEvents
if err := c.caller.APICall("JIMM", 3, "", "FindAuditEvents", req, &resp); err != nil {
if err := c.caller.APICall("JIMM", 4, "", "FindAuditEvents", req, &resp); err != nil {
return params.AuditEvents{}, err
}
return resp, nil
Expand All @@ -56,20 +56,20 @@ func (c *Client) FindAuditEvents(req *params.FindAuditEventsRequest) (params.Aud
// GrantAuditLogAccess grants the given access to the audit log to the
// given user.
func (c *Client) GrantAuditLogAccess(req *params.AuditLogAccessRequest) error {
return c.caller.APICall("JIMM", 3, "", "GrantAuditLogAccess", req, nil)
return c.caller.APICall("JIMM", 4, "", "GrantAuditLogAccess", req, nil)
}

// ListControllers returns controller info for all controllers known to
// JIMM.
func (c *Client) ListControllers() ([]params.ControllerInfo, error) {
var resp params.ListControllersResponse
err := c.caller.APICall("JIMM", 3, "", "ListControllers", nil, &resp)
err := c.caller.APICall("JIMM", 4, "", "ListControllers", nil, &resp)
return resp.Controllers, err
}

// RemoveCloudFromController removes the specified cloud from a specific controller.
func (c *Client) RemoveCloudFromController(req *params.RemoveCloudFromControllerRequest) error {
return c.caller.APICall("JIMM", 3, "", "RemoveCloudFromController", req, nil)
return c.caller.APICall("JIMM", 4, "", "RemoveCloudFromController", req, nil)
}

// RemoveController removes a controller from the JAAS system. Only
Expand All @@ -78,39 +78,39 @@ func (c *Client) RemoveCloudFromController(req *params.RemoveCloudFromController
// removed.
func (c *Client) RemoveController(req *params.RemoveControllerRequest) (params.ControllerInfo, error) {
var info params.ControllerInfo
err := c.caller.APICall("JIMM", 3, "", "RemoveController", req, &info)
err := c.caller.APICall("JIMM", 4, "", "RemoveController", req, &info)
return info, err
}

// RevokeAuditLogAccess revokes the given access to the audit log from the
// given user.
func (c *Client) RevokeAuditLogAccess(req *params.AuditLogAccessRequest) error {
return c.caller.APICall("JIMM", 3, "", "RevokeAuditLogAccess", req, nil)
return c.caller.APICall("JIMM", 4, "", "RevokeAuditLogAccess", req, nil)
}

// SetControllerDeprecated sets the deprecated status of a controller.
func (c *Client) SetControllerDeprecated(req *params.SetControllerDeprecatedRequest) (params.ControllerInfo, error) {
var info params.ControllerInfo
err := c.caller.APICall("JIMM", 3, "", "SetControllerDeprecated", req, &info)
err := c.caller.APICall("JIMM", 4, "", "SetControllerDeprecated", req, &info)
return info, err
}

// FullModelStatus returns the full status of the juju model.
func (c *Client) FullModelStatus(req *params.FullModelStatusRequest) (jujuparams.FullStatus, error) {
var status jujuparams.FullStatus
err := c.caller.APICall("JIMM", 3, "", "FullModelStatus", req, &status)
err := c.caller.APICall("JIMM", 4, "", "FullModelStatus", req, &status)
return status, err
}

// ImportModel imports a model running on a controller.
func (c *Client) ImportModel(req *params.ImportModelRequest) error {
return c.caller.APICall("JIMM", 3, "", "ImportModel", req, nil)
return c.caller.APICall("JIMM", 4, "", "ImportModel", req, nil)
}

// UpdateMigratedModel updates which controller a model is running on
// following an external migration operation.
func (c *Client) UpdateMigratedModel(req *params.UpdateMigratedModelRequest) error {
return c.caller.APICall("JIMM", 3, "", "UpdateMigratedModel", req, nil)
return c.caller.APICall("JIMM", 4, "", "UpdateMigratedModel", req, nil)
}

// Authorisation RPC commands
Expand Down
45 changes: 3 additions & 42 deletions internal/jujuapi/applicationoffers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,21 @@ func init() {
facadeInit["ApplicationOffers"] = func(r *controllerRoot) []int {
offerMethod := rpc.Method(r.Offer)
getConsumeDetailsMethod := rpc.Method(r.GetConsumeDetails)
getConsumeDetailsMethodV3 := rpc.Method(r.GetConsumeDetailsV3)
listOffersMethod := rpc.Method(r.ListApplicationOffers)
modifyOfferAccessMethod := rpc.Method(r.ModifyOfferAccess)
destroyOffersMethod := rpc.Method(r.DestroyOffers)
findOffersMethod := rpc.Method(r.FindApplicationOffers)
applicationOffersMethod := rpc.Method(r.ApplicationOffers)

r.AddMethod("ApplicationOffers", 1, "Offer", offerMethod)
r.AddMethod("ApplicationOffers", 1, "GetConsumeDetails", getConsumeDetailsMethod)
r.AddMethod("ApplicationOffers", 1, "ListApplicationOffers", listOffersMethod)
r.AddMethod("ApplicationOffers", 1, "ModifyOfferAccess", modifyOfferAccessMethod)
r.AddMethod("ApplicationOffers", 1, "DestroyOffers", destroyOffersMethod)
r.AddMethod("ApplicationOffers", 1, "FindApplicationOffers", findOffersMethod)
r.AddMethod("ApplicationOffers", 1, "ApplicationOffers", applicationOffersMethod)

r.AddMethod("ApplicationOffers", 2, "Offer", offerMethod)
r.AddMethod("ApplicationOffers", 2, "GetConsumeDetails", getConsumeDetailsMethod)
r.AddMethod("ApplicationOffers", 2, "ListApplicationOffers", listOffersMethod)
r.AddMethod("ApplicationOffers", 2, "ModifyOfferAccess", modifyOfferAccessMethod)
r.AddMethod("ApplicationOffers", 2, "DestroyOffers", destroyOffersMethod)
r.AddMethod("ApplicationOffers", 2, "FindApplicationOffers", findOffersMethod)
r.AddMethod("ApplicationOffers", 2, "ApplicationOffers", applicationOffersMethod)

r.AddMethod("ApplicationOffers", 3, "Offer", offerMethod)
r.AddMethod("ApplicationOffers", 3, "GetConsumeDetails", getConsumeDetailsMethodV3)
r.AddMethod("ApplicationOffers", 3, "ListApplicationOffers", listOffersMethod)
r.AddMethod("ApplicationOffers", 3, "ModifyOfferAccess", modifyOfferAccessMethod)
r.AddMethod("ApplicationOffers", 3, "DestroyOffers", destroyOffersMethod)
r.AddMethod("ApplicationOffers", 3, "FindApplicationOffers", findOffersMethod)
r.AddMethod("ApplicationOffers", 3, "ApplicationOffers", applicationOffersMethod)

r.AddMethod("ApplicationOffers", 4, "Offer", offerMethod)
r.AddMethod("ApplicationOffers", 4, "GetConsumeDetails", getConsumeDetailsMethodV3)
r.AddMethod("ApplicationOffers", 4, "GetConsumeDetails", getConsumeDetailsMethod)
r.AddMethod("ApplicationOffers", 4, "ListApplicationOffers", listOffersMethod)
r.AddMethod("ApplicationOffers", 4, "ModifyOfferAccess", modifyOfferAccessMethod)
r.AddMethod("ApplicationOffers", 4, "DestroyOffers", destroyOffersMethod)
r.AddMethod("ApplicationOffers", 4, "FindApplicationOffers", findOffersMethod)
r.AddMethod("ApplicationOffers", 4, "ApplicationOffers", applicationOffersMethod)

return []int{1, 2, 3, 4}
return []int{4}
}
}

Expand Down Expand Up @@ -101,22 +76,8 @@ func (r *controllerRoot) offer(ctx context.Context, args jujuparams.AddApplicati
}

// GetConsumeDetails implements the GetConsumeDetails procedure of the
// ApplicationOffers facade (version 1 & 2).
func (r *controllerRoot) GetConsumeDetails(ctx context.Context, args jujuparams.OfferURLs) (jujuparams.ConsumeOfferDetailsResults, error) {
results := jujuparams.ConsumeOfferDetailsResults{
Results: make([]jujuparams.ConsumeOfferDetailsResult, len(args.OfferURLs)),
}
for i, offerURL := range args.OfferURLs {
var err error
results.Results[i].ConsumeOfferDetails, err = r.getConsumeDetails(ctx, r.user, args.BakeryVersion, offerURL)
results.Results[i].Error = mapError(err)
}
return results, nil
}

// GetConsumeDetailsV3 implements the GetConsumeDetails procedure of the
// ApplicationOffers facade (version 3).
func (r *controllerRoot) GetConsumeDetailsV3(ctx context.Context, args jujuparams.ConsumeOfferDetailsArg) (jujuparams.ConsumeOfferDetailsResults, error) {
func (r *controllerRoot) GetConsumeDetails(ctx context.Context, args jujuparams.ConsumeOfferDetailsArg) (jujuparams.ConsumeOfferDetailsResults, error) {
results := jujuparams.ConsumeOfferDetailsResults{
Results: make([]jujuparams.ConsumeOfferDetailsResult, len(args.OfferURLs.OfferURLs)),
}
Expand Down
93 changes: 1 addition & 92 deletions internal/jujuapi/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,105 +29,14 @@ func init() {
cloudsMethod := rpc.Method(r.Clouds)
credentialMethod := rpc.Method(r.Credential)
credentialContentsMethod := rpc.Method(r.CredentialContents)
defaultCloudMethod := rpc.Method(r.DefaultCloud)
listCloudInfoMethod := rpc.Method(r.ListCloudInfo)
modifyCloudAccessMethod := rpc.Method(r.ModifyCloudAccess)
removeCloudsMethod := rpc.Method(r.RemoveClouds)
revokeCredentialsMethod := rpc.Method(r.RevokeCredentials)
revokeCredentialsCheckModelsMethod := rpc.Method(r.RevokeCredentialsCheckModels)
updateCloudMethod := rpc.Method(r.UpdateCloud)
updateCredentialsCheckModelsMethod := rpc.Method(r.UpdateCredentialsCheckModels)
userCredentialsMethod := rpc.Method(r.UserCredentials)

r.AddMethod("Cloud", 1, "Cloud", cloudMethod)
r.AddMethod("Cloud", 1, "Clouds", cloudsMethod)
r.AddMethod("Cloud", 1, "Credential", credentialMethod)
r.AddMethod("Cloud", 1, "DefaultCloud", defaultCloudMethod)
r.AddMethod("Cloud", 1, "RevokeCredentials", revokeCredentialsMethod)
// In JIMM UpdateCredentials behaves in the way AddCredentials is
// documented to. Presumably in juju UpdateCredentials works
// slightly differently.
r.AddMethod("Cloud", 1, "UpdateCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 1, "UserCredentials", userCredentialsMethod)

r.AddMethod("Cloud", 2, "AddCloud", addCloudMethod)
r.AddMethod("Cloud", 2, "AddCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 2, "Cloud", cloudMethod)
r.AddMethod("Cloud", 2, "Clouds", cloudsMethod)
r.AddMethod("Cloud", 2, "Credential", credentialMethod)
r.AddMethod("Cloud", 2, "CredentialContents", credentialContentsMethod)
r.AddMethod("Cloud", 2, "DefaultCloud", defaultCloudMethod)
r.AddMethod("Cloud", 2, "RemoveClouds", removeCloudsMethod)
r.AddMethod("Cloud", 2, "RevokeCredentials", revokeCredentialsMethod)
// In JIMM UpdateCredentials behaves in the way AddCredentials is
// documented to. Presumably in juju UpdateCredentials works
// slightly differently.
r.AddMethod("Cloud", 2, "UpdateCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 2, "UserCredentials", userCredentialsMethod)

r.AddMethod("Cloud", 3, "AddCloud", addCloudMethod)
r.AddMethod("Cloud", 3, "AddCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 3, "CheckCredentialsModels", checkCredentialsModelsMethod)
r.AddMethod("Cloud", 3, "Cloud", cloudMethod)
r.AddMethod("Cloud", 3, "Clouds", cloudsMethod)
r.AddMethod("Cloud", 3, "Credential", credentialMethod)
r.AddMethod("Cloud", 3, "CredentialContents", credentialContentsMethod)
r.AddMethod("Cloud", 3, "ModifyCloudAccess", modifyCloudAccessMethod)
r.AddMethod("Cloud", 3, "DefaultCloud", defaultCloudMethod)
r.AddMethod("Cloud", 3, "RemoveClouds", removeCloudsMethod)
r.AddMethod("Cloud", 3, "RevokeCredentialsCheckModels", revokeCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 3, "UpdateCredentialsCheckModels", updateCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 3, "UserCredentials", userCredentialsMethod)

r.AddMethod("Cloud", 4, "AddCloud", addCloudMethod)
r.AddMethod("Cloud", 4, "AddCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 4, "CheckCredentialsModels", checkCredentialsModelsMethod)
r.AddMethod("Cloud", 4, "Cloud", cloudMethod)
r.AddMethod("Cloud", 4, "Clouds", cloudsMethod)
r.AddMethod("Cloud", 4, "Credential", credentialMethod)
r.AddMethod("Cloud", 4, "CredentialContents", credentialContentsMethod)
r.AddMethod("Cloud", 4, "DefaultCloud", defaultCloudMethod)
r.AddMethod("Cloud", 4, "ModifyCloudAccess", modifyCloudAccessMethod)
r.AddMethod("Cloud", 4, "RemoveClouds", removeCloudsMethod)
r.AddMethod("Cloud", 4, "RevokeCredentialsCheckModels", revokeCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 4, "UpdateCloud", updateCloudMethod)

r.AddMethod("Cloud", 4, "UpdateCredentialsCheckModels", updateCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 4, "UserCredentials", userCredentialsMethod)

r.AddMethod("Cloud", 5, "AddCloud", addCloudMethod)
r.AddMethod("Cloud", 5, "AddCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 5, "CheckCredentialsModels", checkCredentialsModelsMethod)
r.AddMethod("Cloud", 5, "Cloud", cloudMethod)
r.AddMethod("Cloud", 5, "CloudInfo", cloudInfoMethod)
r.AddMethod("Cloud", 5, "Clouds", cloudsMethod)
r.AddMethod("Cloud", 5, "Credential", credentialMethod)
r.AddMethod("Cloud", 5, "CredentialContents", credentialContentsMethod)
// Version 5 removed DefaultCloud
r.AddMethod("Cloud", 5, "ListCloudInfo", listCloudInfoMethod)
r.AddMethod("Cloud", 5, "ModifyCloudAccess", modifyCloudAccessMethod)
r.AddMethod("Cloud", 5, "RemoveClouds", removeCloudsMethod)
r.AddMethod("Cloud", 5, "RevokeCredentialsCheckModels", revokeCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 5, "UpdateCloud", updateCloudMethod)
r.AddMethod("Cloud", 5, "UpdateCredentialsCheckModels", updateCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 5, "UserCredentials", userCredentialsMethod)

r.AddMethod("Cloud", 6, "AddCloud", addCloudMethod)
r.AddMethod("Cloud", 6, "AddCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 6, "CheckCredentialsModels", checkCredentialsModelsMethod)
r.AddMethod("Cloud", 6, "Cloud", cloudMethod)
r.AddMethod("Cloud", 6, "CloudInfo", cloudInfoMethod)
r.AddMethod("Cloud", 6, "Clouds", cloudsMethod)
r.AddMethod("Cloud", 6, "Credential", credentialMethod)
r.AddMethod("Cloud", 6, "CredentialContents", credentialContentsMethod)
r.AddMethod("Cloud", 6, "ListCloudInfo", listCloudInfoMethod)
r.AddMethod("Cloud", 6, "ModifyCloudAccess", modifyCloudAccessMethod)
r.AddMethod("Cloud", 6, "RemoveClouds", removeCloudsMethod)
r.AddMethod("Cloud", 6, "RevokeCredentialsCheckModels", revokeCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 6, "UpdateCloud", updateCloudMethod)
r.AddMethod("Cloud", 6, "UpdateCredentialsCheckModels", updateCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 6, "UserCredentials", userCredentialsMethod)

r.AddMethod("Cloud", 7, "AddCloud", addCloudMethod)
r.AddMethod("Cloud", 7, "AddCredentials", addCredentialsMethod)
r.AddMethod("Cloud", 7, "CheckCredentialsModels", checkCredentialsModelsMethod)
Expand All @@ -144,7 +53,7 @@ func init() {
r.AddMethod("Cloud", 7, "UpdateCredentialsCheckModels", updateCredentialsCheckModelsMethod)
r.AddMethod("Cloud", 7, "UserCredentials", userCredentialsMethod)

return []int{1, 2, 3, 4, 5, 6, 7}
return []int{7}
}
}

Expand Down
Loading