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

Service broker update instance schemas #865

Merged
merged 15 commits into from
Aug 2, 2017

Conversation

lurraca
Copy link
Contributor

@lurraca lurraca commented Aug 2, 2017

Why

The Open Service Broker API is proposing allowing brokers to define JSON schema for their configuration parameters. This will allow tooling to validate parameters and UIs to auto generate forms.

Schemas are to be defined as part of the catalog on a plan and support create/update parameters on a service instance and create parameters on a service binding (update does not exist yet).

The updated spec can be found here.

Example of what a new catalog with schemas will look like:

{
     ....
    "plans": [{
      "name": "fake-plan-1",
      "id": "d3031751-XXXX-XXXX-XXXX-a42377d3320e",
      "description": "Shared fake Server, 5tb persistent disk, 40 max concurrent connections",
      "schemas": {
        "service_instance": {
          "create": {
            "parameters": {
              "$schema": "http://json-schema.org/draft-04/schema#",
              "type": "object",
              "properties": {
                "billing-account": {
                  "description": "Billing account number used to charge use of shared fake server.",
                  "type": "string"
                }
              }
            }
          },
           "update": {
            "parameters": {
              "$schema": "http://json-schema.org/draft-04/schema#",
              "type": "object",
              "properties": {
                "billing-account": {
                  "description": "Billing account number used to charge use of shared fake server.",
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }]
}

What

This PR just adds basic support for update instance schemas (create instance schemas functionality already merged in #834). Schemas are parsed during registration, stored in the service plan model and retrieved on the /v2/service_plan/:guid api endpoint. If a broker does not provide a schema, then we default to an empty schema.

  • Add update_instance_schema to plan model object
  • Add migration to service_plans to include text blob for update_instance_schema
  • Add support for Update schema to catalog objects retrieved from broker.
  • Change service_plans presenter to support update schemas
  • Added update schema tests to the 2.13 service broker api spec
  • Schema is now a separate object for simpler validation

Notable things that are not in this PR but are addressed in future stories are:

  1. Support create binding schema

Notes

  1. This PR implements feedback given as part of merging Service Broker Create Service Instance Schema Validation #847
    1. Schemas now use ActiveModel validation
    2. CatalogSchema no longer conditionally creates objects as part of validations
    3. CatalogSchema still validates structure during initialisation as it is required for setting up schema objects
    4. While Schema uses ActiveModel validations, CatalogSchema is the bridge between this world and the custom validation used previously, this can be refactored with the rest of the catalog_* objects later.
  2. This PR is an extension of the Service broker create instance schemas #834 and Service Broker Create Service Instance Schema Validation #847
  3. We have no updated the docs yet as this is still an experimental change.
    Feedback appreciated!

PR

  • I have viewed signed and have submitted the Contributor License Agreement
  • I have made this pull request to the master branch
  • I have run all the unit tests using bundle exec rake
  • I have run CF Acceptance Tests on bosh lite
    Luis & @Samze

Albertoimpl and others added 15 commits August 2, 2017 14:52
[#146082145]

Signed-off-by: Luis Urraca <[email protected]>
[#146082145]

Signed-off-by: Alex Blease <[email protected]>
[#146082137]

Signed-off-by: Alberto Rios <[email protected]>
[#146082133]

Signed-off-by: Alberto Rios <[email protected]>
[#149395975]

Signed-off-by: Alberto Rios <[email protected]>
[#149550919]

Signed-off-by: Luis Urraca <[email protected]>
* Change Schema length validation to use ActiveModel

[#149550919]

Signed-off-by: Sam Gunaratne <[email protected]>
[#149550919]

Signed-off-by: Sam Gunaratne <[email protected]>
[#149550919]

Signed-off-by: Luis Urraca <[email protected]>
@cfdreddbot
Copy link

Hey lurraca!

Thanks for submitting this pull request!

All pull request submitters and commit authors must have a Contributor License Agreement (CLA) on-file with us. Please sign the appropriate CLA (individual or corporate).

When sending signed CLA please provide your github username in case of individual CLA or the list of github usernames that can make pull requests on behalf of your organization.

If you are confident that you're covered under a Corporate CLA, please make sure you've publicized your membership in the appropriate Github Org, per these instructions.

Once you've publicized your membership, one of the owners of this repository can close and reopen this pull request, and dreddbot will take another look.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/149890266

The labels on this github issue will be updated when the story is started.

@cfdreddbot
Copy link

Hey lurraca!

Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/149894190

The labels on this github issue will be updated when the story is started.

@tusing tusing merged commit 04b6955 into cloudfoundry:master Aug 2, 2017
@tusing
Copy link
Contributor

tusing commented Aug 2, 2017

Thanks for the PR @lurraca!

@tusing && @ericpromislow - CF CAPI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants