├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── THIRD_PARTY_LICENCES.txt ├── charts └── oci-service-broker │ ├── Chart.yaml │ ├── README.md │ ├── config │ └── jul-config.properties │ ├── docs │ ├── adw.md │ ├── atp.md │ ├── installation.md │ ├── object-storage.md │ ├── oss.md │ ├── security.md │ ├── services.md │ └── troubleshoot.md │ ├── samples │ ├── adw │ │ ├── adw-binding-plain.yaml │ │ ├── adw-binding.yaml │ │ ├── adw-demo-secret.yaml │ │ ├── adw-demo.yaml │ │ ├── adw-existing-instance.yaml │ │ ├── adw-instance-plain.yaml │ │ ├── adw-instance.yaml │ │ └── adw-secret.yaml │ ├── atp │ │ ├── atp-binding-plain.yaml │ │ ├── atp-binding.yaml │ │ ├── atp-demo-secret.yaml │ │ ├── atp-demo.yaml │ │ ├── atp-existing-instance.yaml │ │ ├── atp-instance-plain.yaml │ │ ├── atp-instance.yaml │ │ └── atp-secret.yaml │ ├── network-policy │ │ ├── allow-all-pods-from-namespace.yaml │ │ ├── allow-sc-any-namespace.yaml │ │ └── allow-sc-same-namespace.yaml │ ├── objectstore │ │ ├── create-bucket.yaml │ │ ├── create-existing-bucket.yaml │ │ └── pre-auth.yaml │ ├── oci-service-broker.yaml │ ├── oss │ │ ├── create-existing-oss.yaml │ │ ├── create-oss-binding.yaml │ │ └── create-oss-instance.yaml │ └── rbac │ │ ├── allow-full-access.yaml │ │ └── allow-read-only-access.yaml │ ├── templates │ ├── _helpers.tpl │ ├── deployment.yaml │ ├── logConfig.yaml │ ├── role-binding.yaml │ ├── role.yaml │ ├── service-account.yaml │ └── service.yaml │ ├── tools │ └── diagnostics_tool.sh │ └── values.yaml └── oci-service-broker ├── build.gradle ├── copyright-files ├── copyright_java_style └── copyright_script_style ├── deploy ├── docker │ └── Dockerfile └── scripts │ ├── install_openssl.sh │ └── start-broker.sh ├── download_SDK_libs.sh └── src └── main ├── java └── com │ └── oracle │ └── oci │ └── osb │ ├── Broker.java │ ├── adapter │ └── ServiceAdapter.java │ ├── adapters │ ├── adb │ │ ├── ADBUtils.java │ │ ├── AutonomousDatabaseAdapter.java │ │ ├── AutonomousDatabaseInstance.java │ │ ├── AutonomousDatabaseOCIClient.java │ │ ├── adw │ │ │ └── ADWServiceAdapter.java │ │ └── atp │ │ │ └── ATPServiceAdapter.java │ ├── objectstorage │ │ └── ObjectStorageServiceAdapter.java │ └── oss │ │ └── OSSServiceAdapter.java │ ├── api │ └── OSBV2API.java │ ├── jackson │ └── OSBObjectMapperProvider.java │ ├── mbean │ ├── BrokerMetrics.java │ └── BrokerMetricsMBean.java │ ├── model │ ├── AbstractResponse.java │ ├── AsyncOperation.java │ ├── Catalog.java │ ├── Context.java │ ├── DashboardClient.java │ ├── Error.java │ ├── ErrorResponse.java │ ├── Identity.java │ ├── LastOperationResource.java │ ├── Metadata.java │ ├── Plan.java │ ├── SchemaParameters.java │ ├── SchemasObject.java │ ├── Service.java │ ├── ServiceBinding.java │ ├── ServiceBindingRequest.java │ ├── ServiceBindingResource.java │ ├── ServiceBindingResourceObject.java │ ├── ServiceBindingSchemaObject.java │ ├── ServiceBindingVolumeMount.java │ ├── ServiceBindingVolumeMountDevice.java │ ├── ServiceInstanceAsyncOperation.java │ ├── ServiceInstancePreviousValues.java │ ├── ServiceInstanceProvision.java │ ├── ServiceInstanceProvisionRequest.java │ ├── ServiceInstanceResource.java │ ├── ServiceInstanceSchemaObject.java │ └── ServiceInstanceUpdateRequest.java │ ├── ociclient │ ├── AuthProvider.java │ └── SystemPropsAuthProvider.java │ ├── rest │ ├── Health.java │ ├── MetricsResponseFilter.java │ ├── OCIOSBApplication.java │ ├── OCIOSBApplicationBinder.java │ ├── OSBAPI.java │ └── RequestValidationFilter.java │ ├── store │ ├── BindingData.java │ ├── DataStore.java │ ├── DataStoreFactory.java │ ├── EtcdStore.java │ ├── MemoryStore.java │ ├── ObjectStorageStore.java │ └── ServiceData.java │ └── util │ ├── BrokerHttpException.java │ ├── Constants.java │ ├── Errors.java │ ├── OriginatingIdentity.java │ ├── RequestUtil.java │ └── Utils.java └── resources ├── META-INF └── services │ └── com.oracle.oci.osb.adapter.ServiceAdapter ├── adw-catalog.json ├── atp-catalog.json ├── broker_oe.json ├── enabledCiphers ├── objectstore-catalog.json └── oss-catalog.json /.gitignore: -------------------------------------------------------------------------------- 1 | oci-service-broker/.gradle/ 2 | oci-service-broker/.classpath 3 | oci-service-broker/.project 4 | oci-service-broker/.settings/ 5 | oci-service-broker/bin/ 6 | /oci-service-broker/out/ 7 | /oci-service-broker/libs/ 8 | **/.gradle/ 9 | **/.idea/ 10 | **/.vscode/ 11 | **/*.iml 12 | **/build/ 13 | **/oci_api_key.pem 14 | **/gradle.properties -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). 6 | This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 7 | 8 | [1.6.0] 9 | 10 | - Adding support for Vinhedo (VCP) region 11 | 12 | [1.5.2] 13 | 14 | - Adding support for Santiago (SCL) region 15 | 16 | [1.5.1] 17 | 18 | - Adding support for Chiyoda (NJA) and Dubai (DXB) regions 19 | - Minor Bug Fixes 20 | 21 | [1.5.0] 22 | 23 | - Adding support for Chuncheon (YNY), Hyderabad (HYD) and Sanjose (SJC) regions 24 | - Minor Bug Fix to make OCI Service Broker compatible with 1.16+ 25 | 26 | [1.4.0] 27 | 28 | - Adding support for Osaka (KIX), Melbourne (MEL), Amsterdam (AMS), Jeddah (JED), Montreal (YUL) regions 29 | - Adding support to update admin password in ATP and ADW Services 30 | - Adding support to create and associate streams with streampool Ocid 31 | - Minor Bug Fixes 32 | 33 | [1.3.3] 34 | 35 | - Minor documentation fixes 36 | 37 | [1.3.2] 38 | 39 | - Minor documentation fixes 40 | 41 | [1.3.1] 42 | 43 | - Minor Bug Fixes 44 | 45 | [1.3.0] 46 | 47 | - Adding support for Mumbai (BOM), Zurich (ZRH), Sao Paulo (GRU), Sydney (SYD) regions 48 | - Adding support to update license type in ATP and ADW Service 49 | - Adding support for autoscaling in ATP and ADW Service 50 | 51 | [1.2.1] 52 | 53 | - Minor Update to use unified API for ATP/ADW service. Internal change with no customer impact 54 | 55 | [1.2.0] 56 | 57 | - Adding Support to Bind Existing Service Instance for all supported services 58 | - Adding Diagnostic Tool to help identify the common issues during installation 59 | - Minor Document Fixes 60 | 61 | [1.1.1] 62 | 63 | - Adding support for Seoul (ICN) region 64 | - Minor Document Fixes 65 | - Bug Fixes 66 | 67 | [1.1.0] 68 | 69 | - Adding support for Oracle Streaming Service (OSS) 70 | - Bug fixes 71 | 72 | [1.0.1] 73 | 74 | - Minor Document Fixes 75 | 76 | [1.0.0] 77 | 78 | - The initial release of oci-service-broker supports following services: 79 | 80 | - Object Storage Service. 81 | - Autonomous Transaction Processing. 82 | - Autonomous Data Warehouse. 83 | 84 | - Helm chart for deploying oci-service-broker in Kubernetes. 85 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to this repository 2 | 3 | We welcome your contributions! There are multiple ways to contribute. 4 | 5 | ## Opening issues 6 | 7 | For bugs or enhancement requests, please file a GitHub issue unless it's 8 | security related. When filing a bug remember that the better written the bug is, 9 | the more likely it is to be fixed. If you think you've found a security 10 | vulnerability, do not raise a GitHub issue and follow the instructions in our 11 | [security policy](./SECURITY.md). 12 | 13 | ## Contributing code 14 | 15 | We welcome your code contributions. Before submitting code via a pull request, 16 | you will need to have signed the [Oracle Contributor Agreement][OCA] (OCA) and 17 | your commits need to include the following line using the name and e-mail 18 | address you used to sign the OCA: 19 | 20 | ```text 21 | Signed-off-by: Your Name 22 | ``` 23 | 24 | This can be automatically added to pull requests by committing with `--sign-off` 25 | or `-s`, e.g. 26 | 27 | ```text 28 | git commit --signoff 29 | ``` 30 | 31 | Only pull requests from committers that can be verified as having signed the OCA 32 | can be accepted. 33 | 34 | ## Pull request process 35 | 36 | 1. Ensure there is an issue created to track and discuss the fix or enhancement 37 | you intend to submit. 38 | 1. Fork this repository. 39 | 1. Create a branch in your fork to implement the changes. We recommend using 40 | the issue number as part of your branch name, e.g. `1234-fixes`. 41 | 1. Ensure that any documentation is updated with the changes that are required 42 | by your change. 43 | 1. Ensure that any samples are updated if the base image has been changed. 44 | 1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly 45 | what your changes are meant to do and provide simple steps on how to validate. 46 | your changes. Ensure that you reference the issue you created as well. 47 | 1. We will assign the pull request to 2-3 people for review before it is merged. 48 | 49 | ## Code of conduct 50 | 51 | Follow the [Golden Rule](https://en.wikipedia.org/wiki/Golden_Rule). If you'd 52 | like more specific guidelines, see the [Contributor Covenant Code of Conduct][COC]. 53 | 54 | [OCA]: https://oca.opensource.oracle.com 55 | [COC]: https://www.contributor-covenant.org/version/1/4/code-of-conduct/ 56 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019, 2023 Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OCI Service Broker 2 | 3 | ## Introduction 4 | 5 | The OCI Service Broker is an open source implementation of [Open service broker API Spec](https://github.com/openservicebrokerapi/servicebroker/blob/v2.14/spec.md) for OCI services. Customers can use this implementation to install Open Service Broker in [Oracle Container Engine for Kubernetes](https://docs.cloud.oracle.com/iaas/Content/ContEng/Concepts/contengoverview.htm) or in other Kubernetes clusters. This implementation is targeted to achieve: 6 | 7 | * Easy installation. 8 | * Easy extension. 9 | * Provide OOTB implementations for common OCI services. 10 | * OCI Service Broker Installation. 11 | 12 | **Services Supported** 13 | 14 | 1. [Object Storage](https://docs.cloud.oracle.com/iaas/Content/Object/Concepts/objectstorageoverview.htm) 15 | 1. [Autonomous Transaction Processing](https://www.oracle.com/in/database/autonomous-transaction-processing.html) 16 | 1. [Autonomous Data Warehouse](https://www.oracle.com/in/database/data-warehouse.html) 17 | 1. [Oracle Streaming Service](https://docs.cloud.oracle.com/iaas/Content/Streaming/Concepts/streamingoverview.htm) 18 | 19 | ## Installation 20 | 21 | See the [Installation](charts/oci-service-broker/docs/installation.md) instructions for detailed installation and configuration of OCI Service Broker. 22 | 23 | ## Documentation 24 | 25 | See the [Documentation](charts/oci-service-broker/README.md#oci-service-broker) for complete details on installation, security and service related configurations of OCI Service Broker. 26 | 27 | ## Charts 28 | 29 | The OCI Service Broker is packaged as Helm chart for making it easy to install in Kubernetes Clusters. The chart can be downloaded from below URL. 30 | 31 | ``` 32 | https://github.com/oracle/oci-service-broker/releases/download/v1.6.0/oci-service-broker-1.6.0.tgz 33 | ``` 34 | 35 | ## Samples 36 | 37 | Samples for creating Service Instances and Bindings using `oci-service-broker`, can be found [here](charts/oci-service-broker/samples). 38 | 39 | ## Troubleshooting 40 | 41 | You can use the [diagnostics tool](charts/oci-service-broker/tools/diagnostics_tool.sh) to help identify the common issues in the installation. 42 | 43 | Also see [Troubleshooting](charts/oci-service-broker/docs/troubleshoot.md#troubleshooting-guide-for-oci-service-broker) document for details on debugging common and known issues. 44 | 45 | ## Changes 46 | 47 | See [CHANGELOG](CHANGELOG.md). 48 | 49 | ## Contributing 50 | 51 | This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md) 52 | 53 | ## Security 54 | 55 | Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process 56 | 57 | ## License 58 | 59 | Copyright (c) 2019, Oracle and/or its affiliates. 60 | 61 | This software is available under the [Universal Permissive License v 1.0](http://oss.oracle.com/licenses/upl) 62 | 63 | See [LICENSE.txt](LICENSE.txt) for more details. 64 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting security vulnerabilities 2 | 3 | Oracle values the independent security research community and believes that 4 | responsible disclosure of security vulnerabilities helps us ensure the security 5 | and privacy of all our users. 6 | 7 | Please do NOT raise a GitHub Issue to report a security vulnerability. If you 8 | believe you have found a security vulnerability, please submit a report to 9 | [secalert_us@oracle.com][1] preferably with a proof of concept. Please review 10 | some additional information on [how to report security vulnerabilities to Oracle][2]. 11 | We encourage people who contact Oracle Security to use email encryption using 12 | [our encryption key][3]. 13 | 14 | We ask that you do not use other channels or contact the project maintainers 15 | directly. 16 | 17 | Non-vulnerability related security issues including ideas for new or improved 18 | security features are welcome on GitHub Issues. 19 | 20 | ## Security updates, alerts and bulletins 21 | 22 | Security updates will be released on a regular cadence. Many of our projects 23 | will typically release security fixes in conjunction with the 24 | [Oracle Critical Patch Update][3] program. Additional 25 | information, including past advisories, is available on our [security alerts][4] 26 | page. 27 | 28 | ## Security-related information 29 | 30 | We will provide security related information such as a threat model, considerations 31 | for secure use, or any known security issues in our documentation. Please note 32 | that labs and sample code are intended to demonstrate a concept and may not be 33 | sufficiently hardened for production use. 34 | 35 | [1]: mailto:secalert_us@oracle.com 36 | [2]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html 37 | [3]: https://www.oracle.com/security-alerts/encryptionkey.html 38 | [4]: https://www.oracle.com/security-alerts/ 39 | -------------------------------------------------------------------------------- /THIRD_PARTY_LICENCES.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oracle/oci-service-broker/a8daaf030ba1177448769b92888a3f4972d5a04e/THIRD_PARTY_LICENCES.txt -------------------------------------------------------------------------------- /charts/oci-service-broker/Chart.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | description: A Helm chart for installing OCI Service Broker into a Kubernetes cluster 7 | name: oci-service-broker 8 | version: 1.6.0 9 | -------------------------------------------------------------------------------- /charts/oci-service-broker/config/jul-config.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | handlers=java.util.logging.ConsoleHandler 6 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 7 | java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL|%4$s|%3$s|%5$s %6$s%n 8 | 9 | java.util.logging.ConsoleHandler.level=INFO 10 | .level=INFO -------------------------------------------------------------------------------- /charts/oci-service-broker/docs/oss.md: -------------------------------------------------------------------------------- 1 | # Oracle Streaming OCI Service Broker 2 | 3 | - [Introduction](#introduction) 4 | - [Plans](#plans) 5 | - [OCI User Permission requirement](#oci-user-permission-requirement) 6 | - [Service Provision Request Parameters](#service-provision-request-parameters) 7 | - [Provisioning a new OSS Service Instance](#provisioning-a-new-oss-service-instance) 8 | - [Using an Existing OSS Service Instance](#using-an-existing-oss-service-instance) 9 | - [Service Binding](#service-binding) 10 | - [Request Parameters](#request-parameters) 11 | - [Response Credentials](#response-credentials) 12 | - [Example](#example) 13 | - [Kubernetes](#kubernetes) 14 | - [Creating a New OSS Instance](#creating-a-new-oss-instance) 15 | - [Using an Existing OSS Instance](#using-an-existing-oss-instance) 16 | - [Binding](#binding) 17 | 18 | ## Introduction 19 | 20 | OCI Streaming Service (OSS) provides a fully managed, scalable, and durable storage solution for ingesting continuous, high-volume streams of data that users can consume and process in real time. OSS service is also offered via OCI Service Broker thereby making it easy for applications to provision and integrate seamlessly with OSS. 21 | 22 | ## Plans 23 | 24 | The supported plans for this service are 25 | 26 | 1. standard 27 | 28 | ## OCI User Permission requirement 29 | 30 | The OCI user for OCI Service Broker should have permission `manage` for resource type `streams` 31 | 32 | **Sample Policy:** 33 | 34 | ```plain 35 | Allow group to manage streams in compartment 36 | ``` 37 | 38 | ## Service Provision Request Parameters 39 | 40 | ### Provisioning a new OSS Service Instance 41 | 42 | The request parameters for Service provisioning are 43 | 44 | | Parameter | Description | Type | Mandatory | 45 | | ------------- | ------------------------------------------------------------- | ------ | --------- | 46 | | name | The name of the stream | string | Yes | 47 | | compartmentId | The OCID of the compartment to which the stream should belong | string | Yes | 48 | | partitions | The number of partitions of the stream | number | Yes | 49 | | freeFormTags | The free form tags of the bucket | object | No | 50 | | definedTags | The defined tags of the bucket | object | No | 51 | 52 | ## Using an Existing OSS Service Instance 53 | 54 | For more information about binding to an existing OSS service instance, see [Using an Existing Service Instance](services.md#using-an-existing-service-instance). 55 | 56 | The request parameters for the existing Service provisioning are: 57 | 58 | | Parameter | Description | Type | Mandatory | 59 | | ---------------- | ------------------------------------------------------------ | ------ | --------- | 60 | | `ocid` | The OCID for existing stream. | string | yes | 61 | | `provisioning` | Set provisioning flag value as false. | boolean | yes | 62 | 63 | OCI Service broker will not provision the new instance or manage the lifecycle of instance. 64 | 65 | ## Service Binding 66 | 67 | ### Request Parameters 68 | 69 | The Service Binding Request does not have any parameters. 70 | 71 | ### Response Credentials 72 | 73 | | Parameter | Description | Type | 74 | | --------- | ------------------------------------------------------------------------------ | ------ | 75 | | streamId | The unique identifier of the stream, this can be used to connect to the stream | string | 76 | 77 | An OCI user credential can be used to connect to the stream using streamId. The binding request does not create the user. 78 | 79 | ## Example 80 | 81 | ### Kubernetes 82 | 83 | #### Creating a New OSS Instance 84 | 85 | Create a stream 86 | 87 | ```yaml 88 | apiVersion: servicecatalog.k8s.io/v1beta1 89 | kind: ServiceInstance 90 | metadata: 91 | name: "InstanceName" 92 | namespace: "Namespace" 93 | spec: 94 | clusterServiceClassExternalName: "oss-service" 95 | clusterServicePlanExternalName: "standard" 96 | parameters: 97 | name: "StreamName" 98 | compartmentId: "CompartmentOCID" 99 | partitions: "5" 100 | ``` 101 | 102 | #### Using an Existing OSS Instance 103 | 104 | Provision Existing stream 105 | 106 | ```yaml 107 | apiVersion: servicecatalog.k8s.io/v1beta1 108 | kind: ServiceInstance 109 | metadata: 110 | name: "StreamName" 111 | spec: 112 | clusterServiceClassExternalName: "oss-service" 113 | clusterServicePlanExternalName: "standard" 114 | parameters: 115 | name: "StreamName" 116 | ocid: "OCIDStream" 117 | provisioning: false 118 | ``` 119 | 120 | #### Binding 121 | 122 | Create a Request binding 123 | 124 | ```yaml 125 | apiVersion: servicecatalog.k8s.io/v1beta1 126 | kind: ServiceBinding 127 | metadata: 128 | name: "BindingName" 129 | namespace: "Namespace" 130 | spec: 131 | instanceRef: 132 | name: "InstanceName" 133 | ``` 134 | -------------------------------------------------------------------------------- /charts/oci-service-broker/docs/services.md: -------------------------------------------------------------------------------- 1 | # Services 2 | 3 | The OCI Service Brokers supports the following services 4 | 5 | 1. [Object Storage Service](object-storage.md#object-storage-oci-service-broker). 6 | 1. [Autonomous Transaction Processing](atp.md#autonomous-transaction-processing-service). 7 | 1. [Autonomous Data Warehouse](adw.md#autonomous-data-warehouse-service). 8 | 1. [Oracle Streaming Service](oss.md#oracle-streaming-oci-service-broker). 9 | 10 | ### Using an Existing Service Instance 11 | 12 | One of the common use cases is to have the applications use the existing service instance instead of creating a new instance every time. 13 | 14 | For example 15 | 1. An organization want to have a shared service instance that many applications can use. 16 | 2. Teams might want to have the infrastructure provisioning process separate from the deployment process of the application that uses that infrastructure. 17 | 18 | In these cases, the application just needs the details/credentials to connect to the existing instance. However, the Open Service Broker specification allows creating a service binding only to instances that were created through the Service Broker. To overcome this, OCI Service Broker allows you to perform the provisioning process without actually provisioning a service. Instead, you pass in the details required to identify the existing instance. The result is that the existing instance is effectively registered with OSB, and you can then create Service Bindings to that existing instance. 19 | 20 | Note that OCI Service Broker will not manage the lifecycle of an existing instance that is “provisioned” or registered this way. You cannot update any parameters of the existing service instance using OCI Service Broker. You can unbind and deprovision the existing service instance. However, during deprovisioning, the existing service instance will not be deleted by OCI Service Broker. It is simply unregistered with Service Broker. -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-binding-plain.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceBinding 7 | metadata: 8 | name: adw-demo-binding 9 | spec: 10 | instanceRef: 11 | name: osb-adw-demo-1 12 | parameters: 13 | walletPassword: "Welcome_123" -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-binding.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceBinding 7 | metadata: 8 | name: adw-demo-binding 9 | spec: 10 | instanceRef: 11 | name: osb-adw-demo-1 12 | parametersFrom: 13 | - secretKeyRef: 14 | name: adw-secret 15 | key: walletPassword 16 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-demo-secret.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | kind: Secret 7 | metadata: 8 | name: adw-user-cred 9 | data: 10 | # "s123456789S@" 11 | password: czEyMzQ1Njc4OVNACg== 12 | # "Welcome_123" 13 | walletPassword: V2VsY29tZV8xMjMK -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-demo.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: extensions/v1beta1 6 | kind: Deployment 7 | metadata: 8 | name: adw-demo 9 | spec: 10 | replicas: 1 11 | template: 12 | metadata: 13 | labels: 14 | app: adw-demo 15 | spec: 16 | # The credential files in the secret are base64 encoded twice and hence they need to be decoded for the programs to use them. 17 | # This decode-creds initContainer takes care of decoding the files and writing them to a shared volume from which db-app container 18 | # can read them and use it for connecting to ADW. 19 | initContainers: 20 | - name: decode-creds 21 | command: 22 | - bash 23 | - -c 24 | - "for i in `ls -1 /tmp/creds | grep -v user_name`; do cat /tmp/creds/$i | base64 --decode > /creds/$i; done; ls -l /creds/*;" 25 | image: oraclelinux:7.4 26 | volumeMounts: 27 | - name: creds-raw 28 | mountPath: /tmp/creds 29 | readOnly: false 30 | - name: creds 31 | mountPath: /creds 32 | containers: 33 | # User application that uses credential files to connect to ADW. 34 | - name: db-app 35 | image: 36 | env: 37 | # Pass DB ADMIN user name that is part of the secret created by the binding request. 38 | - name: DB_ADMIN_USER 39 | valueFrom: 40 | secretKeyRef: 41 | name: adw-demo-binding 42 | key: user_name 43 | # Pass DB ADMIN password. The password is managed by the user and hence not part of the secret created by the binding request. 44 | # In this example we read the password form secret adw-user-cred that is required to be created by the user. 45 | - name: DB_ADMIN_PWD 46 | valueFrom: 47 | secretKeyRef: 48 | name: adw-user-cred 49 | key: password 50 | # Pass Wallet password to enable application to read Oracle wallet. The password is managed by the user and hence not part of the secret created by the binding request. 51 | # In this example we read the password form secret adw-user-cred that is required to be created by the user. 52 | - name: WALLET_PWD 53 | valueFrom: 54 | secretKeyRef: 55 | name: adw-user-cred 56 | key: walletPassword 57 | volumeMounts: 58 | - name: creds 59 | mountPath: /db-demo/creds 60 | volumes: 61 | # Volume for mouting the credentials file from Secret created by binding request. 62 | - name: creds-raw 63 | secret: 64 | secretName: adw-demo-binding 65 | # Shared Volume in which initContainer will save the decoded credential files and the db-app container reads. 66 | - name: creds 67 | emptyDir: {} -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-existing-instance.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: osb-adw-existing-instance 9 | spec: 10 | clusterServiceClassExternalName: adw-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: osb-adw-existing-instance 14 | ocid: "CHANGE_EXISTING_SERVICEINSTANCE_OCID_HERE" 15 | compartmentId: "CHANGE_COMPARTMENT_OCID_HERE" 16 | provisioning: false 17 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-instance-plain.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: osb-adw-demo-1 9 | spec: 10 | clusterServiceClassExternalName: adw-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: osbdemo 14 | compartmentId: "CHANGE_COMPARTMENT_OCID_HERE" 15 | dbName: osbdemo 16 | cpuCount: 1 17 | storageSizeTBs: 1 18 | password: s123456789S@ 19 | licenseType: NEW 20 | autoScaling: false 21 | freeFormTags: 22 | testtag: demo 23 | # definedTags: 24 | # your-tag-namespace: 25 | # your-defined-key: some_value 26 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-instance.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: osb-adw-demo-1 9 | spec: 10 | clusterServiceClassExternalName: adw-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: osbdemo 14 | compartmentId: "CHANGE_COMPARTMENT_OCID_HERE" 15 | dbName: osbdemo 16 | cpuCount: 1 17 | storageSizeTBs: 1 18 | licenseType: new 19 | autoScaling: false 20 | freeFormTags: 21 | testtag: demo 22 | # definedTags: 23 | # your-tag-namespace: 24 | # your-defined-key: some_value 25 | parametersFrom: 26 | - secretKeyRef: 27 | name: adw-secret 28 | key: password 29 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/adw/adw-secret.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | kind: Secret 7 | metadata: 8 | name: adw-secret 9 | data: 10 | # {"password":"s123456789S@"} 11 | password: eyJwYXNzd29yZCI6InMxMjM0NTY3ODlTQCJ9 12 | # {"walletPassword":"Welcome_123"} 13 | walletPassword: eyJ3YWxsZXRQYXNzd29yZCI6IldlbGNvbWVfMTIzIn0K 14 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-binding-plain.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceBinding 7 | metadata: 8 | name: atp-demo-binding 9 | spec: 10 | instanceRef: 11 | name: osb-atp-demo-1 12 | parameters: 13 | walletPassword: "Welcome_123" -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-binding.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceBinding 7 | metadata: 8 | name: atp-demo-binding 9 | spec: 10 | instanceRef: 11 | name: osb-atp-demo-1 12 | parametersFrom: 13 | - secretKeyRef: 14 | name: atp-secret 15 | key: walletPassword 16 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-demo-secret.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | kind: Secret 7 | metadata: 8 | name: atp-user-cred 9 | data: 10 | # "s123456789S@" 11 | password: czEyMzQ1Njc4OVNACg== 12 | # "Welcome_123" 13 | walletPassword: V2VsY29tZV8xMjMK -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-demo.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: extensions/v1beta1 6 | kind: Deployment 7 | metadata: 8 | name: atp-demo 9 | spec: 10 | replicas: 1 11 | template: 12 | metadata: 13 | labels: 14 | app: atp-demo 15 | spec: 16 | # The credential files in the secret are base64 encoded twice and hence they need to be decoded for the programs to use them. 17 | # This decode-creds initContainer takes care of decoding the files and writing them to a shared volume from which db-app container 18 | # can read them and use it for connecting to ATP. 19 | initContainers: 20 | - name: decode-creds 21 | command: 22 | - bash 23 | - -c 24 | - "for i in `ls -1 /tmp/creds | grep -v user_name`; do cat /tmp/creds/$i | base64 --decode > /creds/$i; done; ls -l /creds/*;" 25 | image: oraclelinux:7.4 26 | volumeMounts: 27 | - name: creds-raw 28 | mountPath: /tmp/creds 29 | readOnly: false 30 | - name: creds 31 | mountPath: /creds 32 | containers: 33 | # User application that uses credential files to connect to ATP. 34 | - name: db-app 35 | image: 36 | env: 37 | # Pass DB ADMIN user name that is part of the secret created by the binding request. 38 | - name: DB_ADMIN_USER 39 | valueFrom: 40 | secretKeyRef: 41 | name: atp-demo-binding 42 | key: user_name 43 | # Pass DB ADMIN password. The password is managed by the user and hence not part of the secret created by the binding request. 44 | # In this example we read the password form secret atp-user-cred that is required to be created by the user. 45 | - name: DB_ADMIN_PWD 46 | valueFrom: 47 | secretKeyRef: 48 | name: atp-user-cred 49 | key: password 50 | # Pass Wallet password to enable application to read Oracle wallet. The password is managed by the user and hence not part of the secret created by the binding request. 51 | # In this example we read the password form secret atp-user-cred that is required to be created by the user. 52 | - name: WALLET_PWD 53 | valueFrom: 54 | secretKeyRef: 55 | name: atp-user-cred 56 | key: walletPassword 57 | volumeMounts: 58 | - name: creds 59 | mountPath: /db-demo/creds 60 | volumes: 61 | # Volume for mouting the credentials file from Secret created by binding request. 62 | - name: creds-raw 63 | secret: 64 | secretName: atp-demo-binding 65 | # Shared Volume in which initContainer will save the decoded credential files and the db-app container reads. 66 | - name: creds 67 | emptyDir: {} -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-existing-instance.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: osb-atp-existing-instance 9 | spec: 10 | clusterServiceClassExternalName: atp-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: osb-atp-existing-instance 14 | ocid: "CHANGE_EXISTING_SERVICEINSTANCE_OCID_HERE" 15 | compartmentId: "CHANGE_COMPARTMENT_OCID_HERE" 16 | provisioning: false 17 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-instance-plain.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: osb-atp-demo-1 9 | spec: 10 | clusterServiceClassExternalName: atp-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: osbdemo 14 | compartmentId: "CHANGE_COMPARTMENT_OCID_HERE" 15 | dbName: osbdemo 16 | cpuCount: 1 17 | storageSizeTBs: 1 18 | password: s123456789S@ 19 | licenseType: NEW 20 | autoScaling: false 21 | freeFormTags: 22 | testtag: demo 23 | # definedTags: 24 | # your-tag-namespace: 25 | # your-defined-key: some_value 26 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-instance.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: osb-atp-demo-1 9 | spec: 10 | clusterServiceClassExternalName: atp-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: osbdemo 14 | compartmentId: "CHANGE_COMPARTMENT_OCID_HERE" 15 | dbName: osbdemo 16 | cpuCount: 1 17 | storageSizeTBs: 1 18 | licenseType: NEW 19 | autoScaling: false 20 | freeFormTags: 21 | testtag: demo 22 | # definedTags: 23 | # your-tag-namespace: 24 | # your-defined-key: some_value 25 | parametersFrom: 26 | - secretKeyRef: 27 | name: atp-secret 28 | key: password 29 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/atp/atp-secret.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | kind: Secret 7 | metadata: 8 | name: atp-secret 9 | data: 10 | # {"password":"s123456789S@"} 11 | password: eyJwYXNzd29yZCI6InMxMjM0NTY3ODlTQCJ9 12 | # {"walletPassword":"Welcome_123"} 13 | walletPassword: eyJ3YWxsZXRQYXNzd29yZCI6IldlbGNvbWVfMTIzIn0K 14 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/network-policy/allow-all-pods-from-namespace.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | # Allow access to OCI Service Broker from "any" pods running in the namespace that 6 | # contians label "app=service-catalog". 7 | kind: NetworkPolicy 8 | apiVersion: networking.k8s.io/v1 9 | metadata: 10 | name: allow-catalog-from-any-nm 11 | spec: 12 | podSelector: 13 | matchLabels: 14 | app: oci-service-broker 15 | ingress: 16 | - from: 17 | - namespaceSelector: 18 | matchLabels: 19 | app: service-catalog 20 | podSelector: 21 | matchLabels: 22 | app: catalog-catalog-controller-manager 23 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/network-policy/allow-sc-any-namespace.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | # Allow access to OCI Service Broker only from Service Catalog.The Service Catalog 6 | # can be run from any namespace. Other Pods including the ones in the same namespace 7 | # cannot access OCI Service Broker. 8 | apiVersion: networking.k8s.io/v1 9 | kind: NetworkPolicy 10 | metadata: 11 | name: allow-service-catalog 12 | spec: 13 | podSelector: 14 | matchLabels: 15 | app: oci-service-broker 16 | ingress: 17 | - from: 18 | - namespaceSelector: {} 19 | - podSelector: 20 | matchLabels: 21 | app: catalog-catalog-controller-manager 22 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/network-policy/allow-sc-same-namespace.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | # Allow access to OCI Service Broker only from Service Catalog running in the same namespace. 6 | # Other Pods running even in the same namespace cannot access OCI Service Broker. 7 | apiVersion: networking.k8s.io/v1 8 | kind: NetworkPolicy 9 | metadata: 10 | name: allow-service-catalog-same-nm 11 | spec: 12 | podSelector: 13 | matchLabels: 14 | app: oci-service-broker 15 | ingress: 16 | - from: 17 | - podSelector: 18 | matchLabels: 19 | app: catalog-catalog-controller-manager 20 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/objectstore/create-bucket.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: testbucket 9 | spec: 10 | clusterServiceClassExternalName: object-store-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: testbucket 14 | compartmentId: CHANGE_COMPARTMENT_OCID_HERE 15 | namespace: CHANGE_NAMESPACE_HERE 16 | freeformTags: 17 | Created: demo -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/objectstore/create-existing-bucket.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: "CHANGE_EXISTING_BUCKETNAME_HERE" 9 | spec: 10 | clusterServiceClassExternalName: object-store-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: "CHANGE_EXISTING_BUCKETNAME_HERE" 14 | namespace: "CHANGE_NAMESPACE_HERE" 15 | provisioning: false 16 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/objectstore/pre-auth.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceBinding 7 | metadata: 8 | name: test-bucket-binding 9 | namespace: default 10 | spec: 11 | instanceRef: 12 | name: testbucket 13 | parameters: 14 | generatePreAuth : true 15 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/oci-service-broker.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ClusterServiceBroker 7 | metadata: 8 | name: oci-service-broker 9 | spec: 10 | # Make sure to replace with suitable namespace if OCI Service Broker and Service Catalog are installed in different namespaces. 11 | # Please remove from below URL attribute If both OCI Service Broker and Service Catalog are installed in the same namespace. 12 | url: http://oci-service-broker.:8080 13 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/oss/create-existing-oss.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: teststream 9 | spec: 10 | clusterServiceClassExternalName: oss-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: teststream 14 | ocid: CHANGE_STREAM_OCID_HERE 15 | provisioning: false 16 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/oss/create-oss-binding.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceBinding 7 | metadata: 8 | name: test-stream-binding 9 | spec: 10 | instanceRef: 11 | name: teststream 12 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/oss/create-oss-instance.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: servicecatalog.k8s.io/v1beta1 6 | kind: ServiceInstance 7 | metadata: 8 | name: teststream 9 | spec: 10 | clusterServiceClassExternalName: oss-service 11 | clusterServicePlanExternalName: standard 12 | parameters: 13 | name: teststream 14 | compartmentId: CHANGE_COMPARTMENT_OCID_HERE 15 | partitions: CHANGE_PARTITION_COUNT_HERE 16 | # Use streampoolId for creating stream associated with a streampool. Do not use compartmentId when using streampoolId 17 | # streampoolId: CHANGE_STREAM_POOL_OCID_HERE 18 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/rbac/allow-full-access.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | # Allow full access for ServiceInstance and ServiceBinding resources. 6 | # Any users with this role will have the ability to trigger instance 7 | # creation/update, deleting of the OCI Services managed by OCI Service Broker. 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | name: servicecatalog.k8s.io:service:all 12 | rules: 13 | - apiGroups: ["servicecatalog.k8s.io"] 14 | resources: ["ServiceInstance","ServiceBinding"] 15 | verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] 16 | -------------------------------------------------------------------------------- /charts/oci-service-broker/samples/rbac/allow-read-only-access.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | # Allow read-only access for ServiceInstance and ServiceBinding resources. 6 | # User with this roles will only be able list/view the resource details including 7 | # the status of the resource. 8 | apiVersion: rbac.authorization.k8s.io/v1 9 | kind: ClusterRole 10 | metadata: 11 | name: servicecatalog.k8s.io:service:read-only 12 | rules: 13 | - apiGroups: ["servicecatalog.k8s.io"] 14 | resources: ["ServiceInstance","ServiceBinding"] 15 | verbs: ["get", "list", "watch"] -------------------------------------------------------------------------------- /charts/oci-service-broker/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | {{/* vim: set filetype=mustache: */}} 6 | {{/* 7 | Expand the name of the chart. 8 | */}} 9 | {{- define "oci-service-broker-chart.name" -}} 10 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 11 | {{- end -}} 12 | 13 | {{/* 14 | Create a default fully qualified app name. 15 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 16 | */}} 17 | {{- define "oci-service-broker-chart.fullname" -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 20 | {{- end -}} 21 | -------------------------------------------------------------------------------- /charts/oci-service-broker/templates/logConfig.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | kind: ConfigMap 7 | metadata: 8 | name: log-config-{{ .Release.Name }} 9 | labels: 10 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" 11 | release: {{ .Release.Name | quote }} 12 | data: 13 | {{ (.Files.Glob "config/jul-config.properties").AsConfig | indent 2 }} -------------------------------------------------------------------------------- /charts/oci-service-broker/templates/role-binding.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | kind: ClusterRoleBinding 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | metadata: 8 | name: oci-osb-binding-{{ .Release.Name }} 9 | subjects: 10 | - kind: ServiceAccount 11 | name: oci-osb 12 | namespace: "{{ .Release.Namespace }}" 13 | roleRef: 14 | kind: ClusterRole 15 | name: oci-osb-role-{{ .Release.Name }} 16 | apiGroup: rbac.authorization.k8s.io 17 | -------------------------------------------------------------------------------- /charts/oci-service-broker/templates/role.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | kind: ClusterRole 6 | apiVersion: rbac.authorization.k8s.io/v1 7 | metadata: 8 | name: oci-osb-role-{{ .Release.Name }} 9 | rules: 10 | - apiGroups: [""] 11 | resources: ["nodes"] 12 | verbs: ["get", "watch", "list"] 13 | -------------------------------------------------------------------------------- /charts/oci-service-broker/templates/service-account.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | kind: ServiceAccount 7 | metadata: 8 | name: oci-osb 9 | -------------------------------------------------------------------------------- /charts/oci-service-broker/templates/service.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: {{ .Release.Name }} 9 | labels: 10 | app: {{ template "oci-service-broker-chart.name" . }} 11 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} 12 | release: {{ .Release.Name }} 13 | heritage: {{ .Release.Service }} 14 | spec: 15 | type: {{ .Values.service.type }} 16 | ports: 17 | - port: {{ .Values.service.servicePort }} 18 | targetPort: {{ .Values.service.containerPort }} 19 | protocol: TCP 20 | name: {{ .Values.service.name }} 21 | selector: 22 | app: {{ template "oci-service-broker-chart.name" . }} 23 | release: {{ .Release.Name }} 24 | -------------------------------------------------------------------------------- /charts/oci-service-broker/values.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | 6 | # Default values for oci-service-broker-chart. Please read the installation docs for more information about below parameters 7 | 8 | # Number of replicas of the broker 9 | replicaCount: 1 10 | 11 | # Image of the broker 12 | image: 13 | # Repository of the image 14 | repository: iad.ocir.io/oracle/oci-service-broker 15 | 16 | # Tag of the image 17 | tag: 1.6.0 18 | 19 | # The image pull policy 20 | pullPolicy: Always 21 | 22 | # OCI Service Broker is exposed as a Kubernetes Service, the details of which are configured below 23 | service: 24 | # Name of the service 25 | name: service-broker 26 | # Type of the Kubernetes Service 27 | type: ClusterIP 28 | # The port in the container to which the service is mapped, typically this needs not be changed 29 | containerPort: 9998 30 | # The Service port 31 | servicePort: 8080 32 | 33 | # OCI Service Broker requires the credentials of an OCI user which is used to connect to the various OCI Services 34 | ociCredentials: 35 | secretName: "" 36 | 37 | # The storage type for service metadata 38 | storage: 39 | # Use etcd as storage type, other storege types may be supported in the future 40 | type: etcd 41 | etcd: 42 | # Use an embedded etcd container in the OCI Service Broker pod. 43 | # DO NOT use this in PRODUCTION 44 | useEmbedded: false 45 | # The etcd image to use 46 | image: quay.io/coreos/etcd:latest 47 | # imagePullPolicy for the etcd; valid values are "IfNotPresent", 48 | # "Never", and "Always" 49 | imagePullPolicy: Always 50 | # Configure the comma separated etcd server URLs here 51 | servers: 52 | # Configure tls related parameters below 53 | tls: 54 | # Set to true if tls needs to be used to talk to the etcd server 55 | enabled: true 56 | # If etcd tls is enabled you need to provide name of secret which stores 3 keys: 57 | # etcd-client-ca.crt - SSL Certificate Authority file used to secure etcd communication. 58 | # etcd-client.crt - SSL certification file used to secure etcd communication. 59 | # etcd-client.key - SSL key file used to secure etcd communication. 60 | clientCertSecretName: 61 | 62 | # Any key value pair under the serviceTags section will be added as tags in the 63 | serviceTags: 64 | # It is recommended to set the ClusterId as this will be tagged in the services 65 | # created by OCI Service Broker. In case of Oracle Clusters(OKE), the ClusterId 66 | # is automatically discovered and hence the property need not be set explictly. 67 | # ClusterId: 68 | 69 | # TLS related parameters 70 | tls: 71 | # Change this parameter to true if the Broker needs to be TLS enabled 72 | enabled: true 73 | # The Kubernetes secret which contains the PKCS#12 file and password required to configure TLS 74 | secretName: "" 75 | 76 | # Log Levels are configured below 77 | logLevel: 78 | ociSDK: INFO 79 | broker: INFO 80 | -------------------------------------------------------------------------------- /oci-service-broker/copyright-files/copyright_java_style: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | -------------------------------------------------------------------------------- /oci-service-broker/copyright-files/copyright_script_style: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | -------------------------------------------------------------------------------- /oci-service-broker/deploy/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | FROM openjdk:12.0.1-jdk-oracle 6 | USER root 7 | RUN yum -y install unzip &&\ 8 | yum clean all &&\ 9 | rm -f /var/log/yum.log 10 | 11 | RUN mkdir -p /oci-service-broker/config && \ 12 | mkdir /oci-service-broker/lib 13 | 14 | ADD install_openssl.sh /tmp 15 | RUN bash -e /tmp/install_openssl.sh 16 | 17 | ADD start-broker.sh /oci-service-broker 18 | ADD *.jar /oci-service-broker/lib/ 19 | RUN groupadd -g 999 svcbroker && \ 20 | useradd -r -u 999 -g svcbroker svcbroker 21 | RUN chown -R svcbroker:svcbroker /oci-service-broker 22 | USER svcbroker 23 | ENTRYPOINT ["/oci-service-broker/start-broker.sh"] -------------------------------------------------------------------------------- /oci-service-broker/deploy/scripts/install_openssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 4 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 5 | # 6 | 7 | # Install build tools 8 | yum install -y \ 9 | autoconf.noarch 0:2.69-11.el7.x86_64 \ 10 | libtool.x86_64 0:2.4.2-22.el7_3.x86_64 \ 11 | make.x86_64 1:3.82-23.el7.x86_64 \ 12 | 13 | OPEN_SSL_PACKAGE="openssl-1.1.1a.tar.gz" 14 | OPEN_SSL_PACKAGE_SHA256="fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41" 15 | APR_PACKAGE="apr-1.6.5.tar.gz" 16 | APR_PACKAGE_SHA256="70dcf9102066a2ff2ffc47e93c289c8e54c95d8dda23b503f9e61bb0cbd2d105" 17 | 18 | mkdir /apr-build 19 | cd /apr-build 20 | curl -L http://archive.apache.org/dist/apr/${APR_PACKAGE} -o ${APR_PACKAGE} 21 | sha256sum ${APR_PACKAGE} | grep ${APR_PACKAGE_SHA256} 22 | tar zxvf ${APR_PACKAGE} 23 | cd apr* 24 | ./configure 25 | 26 | make 27 | make install 28 | 29 | 30 | mkdir /openssl-build 31 | mkdir /openssl 32 | cd /openssl-build 33 | # Build openssl 34 | cd /openssl-build 35 | 36 | curl -L https://www.openssl.org/source/${OPEN_SSL_PACKAGE} -o ${OPEN_SSL_PACKAGE} 37 | sha256sum ${OPEN_SSL_PACKAGE} | grep ${OPEN_SSL_PACKAGE_SHA256} 38 | tar zxvf ${OPEN_SSL_PACKAGE} 39 | cd openssl* 40 | ./config shared --prefix=/openssl --openssldir=/openssl 41 | make depend 42 | make 43 | make install 44 | 45 | # Delete all non-English locale 46 | localedef --list-archive | grep -v -i ^en | xargs localedef --delete-from-archive 47 | rm -rf /usr/lib/locale/locale-archive.tmpl 48 | rm -rf /openssl-build 49 | rm -rf /apr-build 50 | 51 | mv /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl 52 | build-locale-archive 53 | 54 | # First yum installs 61 packages. But remove deletes only 30 packages or so due to common dependencies. 55 | # Hence we delete the dependencies installed earlier explicitly. 56 | yum remove -y autoconf make git ruby libtool perl \ 57 | gcc cpp kernel-headers libgomp mpfr groff-base libgnome-keyring libyaml m4 rsync ruby-libs 58 | 59 | yum clean all 60 | rm -rf /var/cache/yum 61 | rm -f /var/log/yum.log 62 | 63 | -------------------------------------------------------------------------------- /oci-service-broker/deploy/scripts/start-broker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 4 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 5 | # 6 | 7 | set -x 8 | TAGS="" 9 | 10 | init() { 11 | while (( $# > 0 )); do 12 | case "${1}" in 13 | "--port" ) 14 | PORT="${2}" 15 | shift 16 | ;; 17 | "--privatekey" ) 18 | PRIVATEKEY="${2}" 19 | shift 20 | ;; 21 | "--log.configfile" ) 22 | LOG_CONFIG_FILE="${2}" 23 | shift 24 | ;; 25 | "--logLevel" ) 26 | LOG_LEVEL="${2}" 27 | shift 28 | ;; 29 | "--ociSdkLogLevel" ) 30 | OCI_SDK_LOG_LEVEL="${2}" 31 | shift 32 | ;; 33 | "--jvmProps" ) 34 | JVM_PROPS="${2}" 35 | shift 36 | ;; 37 | "--tlsEnabled" ) 38 | TLS_ENABLED="${2}" 39 | shift 40 | ;; 41 | "--etcd.servers" ) 42 | ETCD_SERVERS="${2}" 43 | shift 44 | ;; 45 | "--storeType" ) 46 | STORE_TYPE="${2}" 47 | shift 48 | ;; 49 | "--apiServerCaCerts" ) 50 | API_SERVER_CA_CERTS="${2}" 51 | shift 52 | ;; 53 | "--etcd.client.tls.enabled" ) 54 | ETCD_CLIENT_TLS_ENABLED="${2}" 55 | shift 56 | ;; 57 | "--serviceTag" ) 58 | key="${2%%=*}"; value="${2#*=}" 59 | TAGS="$TAGS -DserviceTag.${key}=${value}" 60 | shift 61 | ;; 62 | esac 63 | shift 64 | done 65 | } 66 | 67 | init "$@" 68 | 69 | export LD_LIBRARY_PATH="/openssl/lib" 70 | 71 | if [ ${TLS_ENABLED} = true ] 72 | then 73 | KEYSTORE_PASSWORD=$(cat /oci-service-broker/tlsBundle/keyStore.password) 74 | TLS_PROPS="-DkeyStore=/oci-service-broker/tlsBundle/keyStore -DkeyStorePassword=${KEYSTORE_PASSWORD}" 75 | fi 76 | 77 | LIB_DIR="/oci-service-broker/lib" 78 | if ! ls /oci-service-broker/lib/oci-java-sdk* &> /dev/null; then 79 | # Donwload OCI java SDK jar 80 | SDK_VERSION="1.3.1" 81 | TEMP_DIR="/tmp/oci-java-sdk" 82 | rm -rf ${TEMP_DIR} 83 | mkdir -p ${TEMP_DIR} 84 | mkdir -p ${LIB_DIR} 85 | curl -LsS https://github.com/oracle/oci-java-sdk/releases/download/v${SDK_VERSION}/oci-java-sdk.zip -o ${TEMP_DIR}/oci-java-sdk.zip 86 | unzip -qq ${TEMP_DIR}/oci-java-sdk.zip -d ${TEMP_DIR} 87 | cp ${TEMP_DIR}/lib/oci-java-sdk-full-${SDK_VERSION}.jar ${LIB_DIR}/ 88 | rm -rf ${TEMP_DIR} 89 | fi 90 | 91 | exec java -cp "${LIB_DIR}/*" ${JVM_PROPS} -Dport="$PORT" -Dtenancy=${TENANCY} -Dfingerprint=${FINGERPRINT} -Duser=${USER}\ 92 | -Dpassphrase=${PASSPHRASE} -Dprivatekey="$PRIVATEKEY" -DregionId=${REGION} -Djava.util.logging.config.file="${LOG_CONFIG_FILE}"\ 93 | -DlogLevel="${LOG_LEVEL}" -Dorg.slf4j.simpleLogger.defaultLogLevel="${OCI_SDK_LOG_LEVEL}" -Dio.netty.noUnsafe="true"\ 94 | -DapiServerCaCert="${API_SERVER_CA_CERTS}" -DtlsEnabled="${TLS_ENABLED}" ${TLS_PROPS} -DstoreType="${STORE_TYPE}" -Detcd.servers="${ETCD_SERVERS}"\ 95 | -DetcdTlsEnabled="${ETCD_CLIENT_TLS_ENABLED}" -DCAPath="/oci-service-broker/etcdTlsSecret/etcd-client-ca.crt"\ 96 | -DetcdClientCert="/oci-service-broker/etcdTlsSecret/etcd-client.crt"\ 97 | -DetcdClientKey="/oci-service-broker/etcdTlsSecret/etcd-client.key" ${TAGS} -Dk8sApiTokenFile="/var/run/secrets/kubernetes.io/serviceaccount/token" \ 98 | -Djdk.tls.client.protocols=TLSv1.2 \ 99 | com.oracle.oci.osb.Broker 100 | 101 | -------------------------------------------------------------------------------- /oci-service-broker/download_SDK_libs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 4 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 5 | # 6 | 7 | #oci-java-sdk is not published to any public maven repo yet. In order to build the project users are required 8 | #to download oci-java-sdk and the dependent libraries to libs directory. This scripts takes care of downloading 9 | #sdk jars and their dependency jars. The jars are written to libs directory. 10 | 11 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 12 | SDK_VERSION="2.0.2" 13 | TEMP_DIR="/tmp/oci-java-sdk" 14 | rm -rf ${TEMP_DIR} 15 | mkdir -p ${TEMP_DIR} 16 | mkdir -p ${SCRIPT_DIR}/libs 17 | echo "Downloading oci-java-sdk version v${SDK_VERSION} and the dependent libraries..." 18 | curl -sSL https://github.com/oracle/oci-java-sdk/releases/download/v${SDK_VERSION}/oci-java-sdk-${SDK_VERSION}.zip -o ${TEMP_DIR}/oci-java-sdk.zip 19 | unzip -qq ${TEMP_DIR}/oci-java-sdk.zip -d ${TEMP_DIR} 20 | cp ${TEMP_DIR}/lib/oci-java-sdk-full-2.0.2.jar ${SCRIPT_DIR}/libs/ 21 | cp ${TEMP_DIR}/third-party/lib/*.jar ${SCRIPT_DIR}/libs/ 22 | rm -rf ${TEMP_DIR} 23 | echo "oci-java-sdk and the dependent libraries are downloaded to ${SCRIPT_DIR}/libs directory" 24 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/adapters/adb/ADBUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.adapters.adb; 7 | 8 | import com.oracle.oci.osb.util.Utils; 9 | 10 | import java.io.FileInputStream; 11 | import java.io.FileOutputStream; 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | import java.nio.file.Files; 15 | import java.nio.file.Path; 16 | import java.util.Base64; 17 | import java.util.HashMap; 18 | import java.util.Map; 19 | import java.util.zip.ZipEntry; 20 | import java.util.zip.ZipInputStream; 21 | 22 | 23 | public class ADBUtils { 24 | 25 | /** 26 | * generateCredentialsMap reads credential/configuration files for connecting to an ATP/ADW instance from passed 27 | * InputStream and builds and returns a MAP with filename as key and base64 encoded content of the 28 | * credential/configuration file as value. 29 | * 30 | * @param dbName name of the database. 31 | * @param in inputStream of the Credentials Zip file. 32 | * @return Map with filename/attribute name as keys and filename/attribute base64 encoded contents as values. 33 | * @throws IOException if downloading credential zip file fails. 34 | */ 35 | public static Map generateCredentialsMap(String dbName, InputStream in) throws IOException { 36 | Path tempDir = Files.createTempDirectory(dbName); 37 | Path tmpFile = Files.createTempFile(tempDir, dbName, ".zip"); 38 | FileOutputStream out = null; 39 | try { 40 | out = new FileOutputStream(tmpFile.toFile()); 41 | byte[] b = new byte[1024]; 42 | int count; 43 | while ((count = in.read(b)) >= 0) { 44 | out.write(b, 0, count); 45 | } 46 | } finally { 47 | if (out != null) { 48 | out.close(); 49 | } 50 | } 51 | 52 | Map credMap = new HashMap<>(); 53 | //unzip file 54 | try (FileInputStream fip = new FileInputStream(tmpFile.toFile()); ZipInputStream zis = new ZipInputStream 55 | (fip)) { 56 | ZipEntry ze = zis.getNextEntry(); 57 | while (ze != null) { 58 | byte[] data = Utils.toByteArray(zis); 59 | String b64Data = Base64.getEncoder().encodeToString(data); 60 | credMap.put(ze.getName(), b64Data); 61 | zis.closeEntry(); 62 | ze = zis.getNextEntry(); 63 | } 64 | } finally { 65 | Files.delete(tmpFile); 66 | Files.delete(tempDir); 67 | } 68 | return credMap; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/adapters/adb/AutonomousDatabaseInstance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.adapters.adb; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * AutonomousDatabaseInstance represents Autonomous Database Instance (ATP or ADW). 12 | */ 13 | public class AutonomousDatabaseInstance { 14 | private String id; 15 | private AutonomousDatabaseAdapter.DBWorkloadType dbWorkloadType; 16 | private String displayName; 17 | private int cpuCoreCount; 18 | private int storageSizeInGBs; 19 | private String dbName; 20 | private AutonomousDatabaseAdapter.LicenseModel licenseModel; 21 | private boolean autoScalingEnabled; 22 | private Map freeformTags; 23 | private LifecycleState lifecycleState; 24 | 25 | public AutonomousDatabaseAdapter.LicenseModel getLicenseModel() { 26 | return licenseModel; 27 | } 28 | 29 | public enum TYPE { 30 | ATP, ADW; 31 | } 32 | 33 | 34 | public AutonomousDatabaseInstance(String id, AutonomousDatabaseAdapter.DBWorkloadType dbWorkloadType, String displayName, int cpuCoreCount, int 35 | storageSizeInGBs, String dbName, AutonomousDatabaseAdapter.LicenseModel licenseModel, boolean autoScalingEnabled, 36 | Map freeformTags, LifecycleState lifecycleState) { 37 | this.id = id; 38 | this.dbWorkloadType = dbWorkloadType; 39 | this.displayName = displayName; 40 | this.cpuCoreCount = cpuCoreCount; 41 | this.storageSizeInGBs = storageSizeInGBs; 42 | this.dbName = dbName; 43 | this.licenseModel = licenseModel; 44 | this.freeformTags = freeformTags; 45 | this.lifecycleState = lifecycleState; 46 | this.autoScalingEnabled = autoScalingEnabled; 47 | } 48 | 49 | public static LifecycleState lifecycleState(String lifecycleStateStr) { 50 | for (LifecycleState lstate : LifecycleState.values()) { 51 | if (lifecycleStateStr.equalsIgnoreCase(lstate.getValue())) { 52 | return lstate; 53 | } 54 | } 55 | return LifecycleState.UnknownEnumValue; 56 | } 57 | 58 | public String getId() { 59 | return id; 60 | } 61 | 62 | public AutonomousDatabaseAdapter.DBWorkloadType getDbWorkloadType() { 63 | return dbWorkloadType; 64 | } 65 | 66 | public String getDbName() { 67 | return dbName; 68 | } 69 | 70 | public String getDisplayName() { 71 | return displayName; 72 | } 73 | 74 | public int getCpuCoreCount() { 75 | return cpuCoreCount; 76 | } 77 | 78 | public int getStorageSizeInGBs() { 79 | return storageSizeInGBs; 80 | } 81 | 82 | public boolean isAutoScalingEnabled() { return autoScalingEnabled; } 83 | 84 | public LifecycleState getLifecycleState() { 85 | return lifecycleState; 86 | } 87 | 88 | public Map getFreeformTags() { 89 | return freeformTags; 90 | } 91 | 92 | /** 93 | * LifecycleState of the Autonomous Database Instance 94 | */ 95 | public enum LifecycleState { 96 | Provisioning("PROVISIONING"), 97 | Available("AVAILABLE"), 98 | Stopping("STOPPING"), 99 | Stopped("STOPPED"), 100 | Starting("STARTING"), 101 | Terminating("TERMINATING"), 102 | Terminated("TERMINATED"), 103 | Unavailable("UNAVAILABLE"), 104 | RestoreInProgress("RESTORE_IN_PROGRESS"), 105 | BackupInProgress("BACKUP_IN_PROGRESS"), 106 | ScaleInProgress("SCALE_IN_PROGRESS"), 107 | AvailableNeedsAttention("AVAILABLE_NEEDS_ATTENTION"), 108 | UnknownEnumValue(null); 109 | 110 | private final String value; 111 | 112 | LifecycleState(String value) { 113 | this.value = value; 114 | } 115 | 116 | public String getValue() { 117 | return value; 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/adapters/adb/adw/ADWServiceAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.adapters.adb.adw; 7 | 8 | import com.oracle.bmc.auth.AuthenticationDetailsProvider; 9 | import com.oracle.oci.osb.adapters.adb.AutonomousDatabaseAdapter; 10 | import com.oracle.oci.osb.adapters.adb.AutonomousDatabaseInstance; 11 | import com.oracle.oci.osb.adapters.adb.AutonomousDatabaseOCIClient; 12 | import com.oracle.oci.osb.util.Constants; 13 | 14 | /** 15 | * ADWServiceAdapter provides implementation to provision and manage 16 | * Data Warehouse Service instance. 17 | */ 18 | public class ADWServiceAdapter extends AutonomousDatabaseAdapter { 19 | 20 | @Override 21 | protected String getInstanceTypeString() { 22 | return AutonomousDatabaseAdapter.DBWorkloadType.ADW.name(); 23 | } 24 | 25 | @Override 26 | protected String getCatalogFileName() { 27 | return Constants.ADW_CATALOG_JSON; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/adapters/adb/atp/ATPServiceAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.adapters.adb.atp; 7 | 8 | import com.oracle.bmc.auth.AuthenticationDetailsProvider; 9 | import com.oracle.oci.osb.adapters.adb.AutonomousDatabaseAdapter; 10 | import com.oracle.oci.osb.adapters.adb.AutonomousDatabaseInstance; 11 | import com.oracle.oci.osb.adapters.adb.AutonomousDatabaseOCIClient; 12 | import com.oracle.oci.osb.util.Constants; 13 | 14 | /** 15 | * ATPServiceAdapter provides implementation to provision and manage 16 | * Autonomous Transaction Processor Service instance. 17 | */ 18 | public class ATPServiceAdapter extends AutonomousDatabaseAdapter { 19 | 20 | @Override 21 | protected String getInstanceTypeString() { 22 | return AutonomousDatabaseAdapter.DBWorkloadType.ATP.name(); 23 | 24 | } 25 | 26 | @Override 27 | protected String getCatalogFileName() { 28 | return Constants.ATP_CATALOG_JSON; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/jackson/OSBObjectMapperProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.jackson; 7 | 8 | import com.fasterxml.jackson.databind.DeserializationFeature; 9 | import com.fasterxml.jackson.databind.ObjectMapper; 10 | import com.fasterxml.jackson.databind.SerializationFeature; 11 | 12 | import javax.ws.rs.ext.ContextResolver; 13 | 14 | public class OSBObjectMapperProvider implements ContextResolver { 15 | 16 | private final ObjectMapper objMapper; 17 | 18 | public OSBObjectMapperProvider() { 19 | objMapper = new ObjectMapper(); 20 | objMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); 21 | objMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); 22 | 23 | } 24 | 25 | @Override 26 | public ObjectMapper getContext(Class type) { 27 | return objMapper; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/mbean/BrokerMetricsMBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.mbean; 7 | 8 | /** 9 | * MBean interface for exposing OCI OSB specific metrics. 10 | */ 11 | public interface BrokerMetricsMBean { 12 | 13 | /** 14 | * @return the total number of requests 15 | */ 16 | long getRequestCount(); 17 | 18 | /** 19 | * @return the total number of failed requests 20 | */ 21 | long getFailedRequestCount(); 22 | 23 | /** 24 | * @return the total number of provision requests 25 | */ 26 | long getProvisionRequestCount(); 27 | 28 | /** 29 | * @return the total number of failed provision requests 30 | */ 31 | long getFailedProvisionRequestCount(); 32 | 33 | /** 34 | * @return the total number of binding requests 35 | */ 36 | long getBindingRequestCount(); 37 | 38 | /** 39 | * @return the total number of failed binding requests 40 | */ 41 | long getFailedBindingRequestCount(); 42 | 43 | /** 44 | * @return the total number of deprovision requests 45 | */ 46 | long getDeprovisionRequestCount(); 47 | 48 | /** 49 | * @return the total number of failed deprovision requests 50 | */ 51 | long getFailedDeprovisionRequestCount(); 52 | 53 | /** 54 | * @return the total number of unbind requests 55 | */ 56 | long getUnbindRequestCount(); 57 | 58 | /** 59 | * @return the total number of failed unbind requests 60 | */ 61 | long getFailedUnbindRequestCount(); 62 | 63 | /** 64 | * @return the total number of update requests 65 | */ 66 | long getUpdateRequestCount(); 67 | 68 | /** 69 | * @return the total number of failed update requests 70 | */ 71 | long getFailedUpdateRequestCount(); 72 | 73 | /** 74 | * @return the total number of GetInstance requests 75 | */ 76 | long getGetInstanceRequestCount(); 77 | 78 | /** 79 | * @return the total number of failed GetInstance requests 80 | */ 81 | long getFailedGetInstanceRequestCount(); 82 | 83 | /** 84 | * @return the total number of GetBinding requests 85 | */ 86 | long getGetBindingRequestCount(); 87 | 88 | /** 89 | * @return the total number of failed GetBinding requests 90 | */ 91 | long getFailedGetBindingRequestCount(); 92 | 93 | /** 94 | * @return the total number of last operation requests for instance specific operations 95 | */ 96 | long getLastOperationInstanceRequestCount(); 97 | 98 | /** 99 | * @return the total number of failed last operation requests for instance specific operations 100 | */ 101 | long getFailedLastOperationInstanceRequestCount(); 102 | 103 | /** 104 | * @return the total number of last operation requests for binding specific operations 105 | */ 106 | long getLastOperationBindingRequestCount(); 107 | 108 | /** 109 | * @return the total number of failed last operation requests for binding specific operations 110 | */ 111 | long getFailedLastOperationBindingRequestCount(); 112 | 113 | } 114 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/AbstractResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonIgnore; 9 | 10 | public class AbstractResponse { 11 | 12 | @JsonIgnore 13 | transient private int statusCode; 14 | 15 | public int getStatusCode() { 16 | return statusCode; 17 | } 18 | 19 | public void setStatusCode(int statusCode) { 20 | this.statusCode = statusCode; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/AsyncOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.Objects; 13 | 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | public class AsyncOperation extends AbstractResponse { 16 | 17 | private @Valid 18 | String operation = null; 19 | 20 | /** 21 | **/ 22 | public AsyncOperation operation(String operation) { 23 | this.operation = operation; 24 | return this; 25 | } 26 | 27 | @JsonProperty("operation") 28 | public String getOperation() { 29 | return operation; 30 | } 31 | 32 | public void setOperation(String operation) { 33 | this.operation = operation; 34 | } 35 | 36 | public boolean equals(Object o) { 37 | if (this == o) { 38 | return true; 39 | } 40 | if (o == null || getClass() != o.getClass()) { 41 | return false; 42 | } 43 | AsyncOperation asyncOperation = (AsyncOperation) o; 44 | return Objects.equals(operation, asyncOperation.operation); 45 | } 46 | 47 | @Override 48 | public int hashCode() { 49 | return Objects.hash(operation); 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | StringBuilder sb = new StringBuilder(); 55 | sb.append("class AsyncOperation {\n"); 56 | 57 | sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); 58 | sb.append("}"); 59 | return sb.toString(); 60 | } 61 | 62 | /** 63 | * Convert the given object to string with each line indented by 4 spaces 64 | * (except the first line). 65 | */ 66 | private String toIndentedString(Object o) { 67 | if (o == null) { 68 | return "null"; 69 | } 70 | return o.toString().replace("\n", "\n "); 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/Catalog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import java.util.Objects; 15 | 16 | @JsonInclude(JsonInclude.Include.NON_NULL) 17 | public class Catalog { 18 | 19 | private @Valid 20 | List services = new ArrayList(); 21 | 22 | /** 23 | **/ 24 | public Catalog services(List services) { 25 | this.services = services; 26 | return this; 27 | } 28 | 29 | @JsonProperty("services") 30 | public List getServices() { 31 | return services; 32 | } 33 | 34 | public void setServices(List services) { 35 | this.services = services; 36 | } 37 | 38 | @Override 39 | public boolean equals(Object o) { 40 | if (this == o) { 41 | return true; 42 | } 43 | if (o == null || getClass() != o.getClass()) { 44 | return false; 45 | } 46 | Catalog catalog = (Catalog) o; 47 | return Objects.equals(services, catalog.services); 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | return Objects.hash(services); 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | StringBuilder sb = new StringBuilder(); 58 | sb.append("class Catalog {\n"); 59 | 60 | sb.append(" services: ").append(toIndentedString(services)).append("\n"); 61 | sb.append("}"); 62 | return sb.toString(); 63 | } 64 | 65 | /** 66 | * Convert the given object to string with each line indented by 4 spaces 67 | * (except the first line). 68 | */ 69 | private String toIndentedString(Object o) { 70 | if (o == null) { 71 | return "null"; 72 | } 73 | return o.toString().replace("\n", "\n "); 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/Context.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import java.util.Objects; 9 | 10 | public class Context { 11 | 12 | @Override 13 | public boolean equals(Object o) { 14 | if (this == o) { 15 | return true; 16 | } 17 | if (o == null || getClass() != o.getClass()) { 18 | return false; 19 | } 20 | return true; 21 | } 22 | 23 | @Override 24 | public int hashCode() { 25 | return Objects.hash(); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | StringBuilder sb = new StringBuilder(); 31 | sb.append("class Context {\n"); 32 | 33 | sb.append("}"); 34 | return sb.toString(); 35 | } 36 | 37 | /** 38 | * Convert the given object to string with each line indented by 4 spaces 39 | * (except the first line). 40 | */ 41 | private String toIndentedString(Object o) { 42 | if (o == null) { 43 | return "null"; 44 | } 45 | return o.toString().replace("\n", "\n "); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/DashboardClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import java.util.Objects; 12 | 13 | public class DashboardClient { 14 | 15 | private @Valid 16 | String id = null; 17 | 18 | private @Valid 19 | String secret = null; 20 | 21 | private @Valid 22 | String redirectUri = null; 23 | 24 | /** 25 | **/ 26 | public DashboardClient id(String id) { 27 | this.id = id; 28 | return this; 29 | } 30 | 31 | @JsonProperty("id") 32 | public String getId() { 33 | return id; 34 | } 35 | 36 | public void setId(String id) { 37 | this.id = id; 38 | } 39 | 40 | /** 41 | **/ 42 | public DashboardClient secret(String secret) { 43 | this.secret = secret; 44 | return this; 45 | } 46 | 47 | @JsonProperty("secret") 48 | public String getSecret() { 49 | return secret; 50 | } 51 | 52 | public void setSecret(String secret) { 53 | this.secret = secret; 54 | } 55 | 56 | /** 57 | **/ 58 | public DashboardClient redirectUri(String redirectUri) { 59 | this.redirectUri = redirectUri; 60 | return this; 61 | } 62 | 63 | @JsonProperty("redirect_uri") 64 | public String getRedirectUri() { 65 | return redirectUri; 66 | } 67 | 68 | public void setRedirectUri(String redirectUri) { 69 | this.redirectUri = redirectUri; 70 | } 71 | 72 | @Override 73 | public boolean equals(Object o) { 74 | if (this == o) { 75 | return true; 76 | } 77 | if (o == null || getClass() != o.getClass()) { 78 | return false; 79 | } 80 | DashboardClient dashboardClient = (DashboardClient) o; 81 | return Objects.equals(id, dashboardClient.id) && Objects.equals(secret, dashboardClient.secret) && Objects 82 | .equals(redirectUri, dashboardClient.redirectUri); 83 | } 84 | 85 | @Override 86 | public int hashCode() { 87 | return Objects.hash(id, secret, redirectUri); 88 | } 89 | 90 | @Override 91 | public String toString() { 92 | StringBuilder sb = new StringBuilder(); 93 | sb.append("class DashboardClient {\n"); 94 | 95 | sb.append(" id: ").append(toIndentedString(id)).append("\n"); 96 | sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); 97 | sb.append(" redirectUri: ").append(toIndentedString(redirectUri)).append("\n"); 98 | sb.append("}"); 99 | return sb.toString(); 100 | } 101 | 102 | /** 103 | * Convert the given object to string with each line indented by 4 spaces 104 | * (except the first line). 105 | */ 106 | private String toIndentedString(Object o) { 107 | if (o == null) { 108 | return "null"; 109 | } 110 | return o.toString().replace("\n", "\n "); 111 | } 112 | } 113 | 114 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/Error.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 4 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 5 | */ 6 | 7 | package com.oracle.oci.osb.model; 8 | 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.Objects; 13 | 14 | public class Error { 15 | 16 | private @Valid 17 | String error = null; 18 | 19 | private @Valid 20 | String description = null; 21 | 22 | /** 23 | **/ 24 | public Error error(String error) { 25 | this.error = error; 26 | return this; 27 | } 28 | 29 | @JsonProperty("error") 30 | public String getError() { 31 | return error; 32 | } 33 | 34 | public void setError(String error) { 35 | this.error = error; 36 | } 37 | 38 | /** 39 | **/ 40 | public Error description(String description) { 41 | this.description = description; 42 | return this; 43 | } 44 | 45 | @JsonProperty("description") 46 | public String getDescription() { 47 | return description; 48 | } 49 | 50 | public void setDescription(String description) { 51 | this.description = description; 52 | } 53 | 54 | @Override 55 | public boolean equals(Object o) { 56 | if (this == o) { 57 | return true; 58 | } 59 | if (o == null || getClass() != o.getClass()) { 60 | return false; 61 | } 62 | Error error = (Error) o; 63 | return Objects.equals(this.error, error.error) && Objects.equals(description, error.description); 64 | } 65 | 66 | @Override 67 | public int hashCode() { 68 | return Objects.hash(error, description); 69 | } 70 | 71 | @Override 72 | public String toString() { 73 | StringBuilder sb = new StringBuilder(); 74 | sb.append("class Error {\n"); 75 | 76 | sb.append(" error: ").append(toIndentedString(error)).append("\n"); 77 | sb.append(" description: ").append(toIndentedString(description)).append("\n"); 78 | sb.append("}"); 79 | return sb.toString(); 80 | } 81 | 82 | /** 83 | * Convert the given object to string with each line indented by 4 spaces 84 | * (except the first line). 85 | */ 86 | private String toIndentedString(Object o) { 87 | if (o == null) { 88 | return "null"; 89 | } 90 | return o.toString().replace("\n", "\n "); 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ErrorResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | public class ErrorResponse { 9 | 10 | private String error; 11 | 12 | private String description; 13 | 14 | public ErrorResponse() { 15 | 16 | } 17 | 18 | public ErrorResponse(String error, String description) { 19 | this.error = error; 20 | this.description = description; 21 | } 22 | 23 | public String getError() { 24 | return error; 25 | } 26 | 27 | public void setError(String error) { 28 | this.error = error; 29 | } 30 | 31 | public String getDescription() { 32 | return description; 33 | } 34 | 35 | public void setDescription(String description) { 36 | this.description = description; 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/Identity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | public class Identity { 16 | 17 | @JsonProperty("username") 18 | private String username; 19 | @JsonProperty("uid") 20 | private String uid; 21 | @JsonProperty("groups") 22 | private List groups = null; 23 | @JsonProperty("extra") 24 | private Map> extra; 25 | 26 | @JsonProperty("username") 27 | public String getUsername() { 28 | return username; 29 | } 30 | 31 | @JsonProperty("username") 32 | public void setUsername(String username) { 33 | this.username = username; 34 | } 35 | 36 | @JsonProperty("uid") 37 | public String getUid() { 38 | return uid; 39 | } 40 | 41 | @JsonProperty("uid") 42 | public void setUid(String uid) { 43 | this.uid = uid; 44 | } 45 | 46 | @JsonProperty("groups") 47 | public List getGroups() { 48 | return groups; 49 | } 50 | 51 | @JsonProperty("groups") 52 | public void setGroups(List groups) { 53 | this.groups = groups; 54 | } 55 | 56 | @JsonProperty("extra") 57 | public Map> getExtra() { 58 | return extra; 59 | } 60 | 61 | @JsonProperty("extra") 62 | public void setExtra(Map> extra) { 63 | this.extra = extra; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/LastOperationResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | import com.fasterxml.jackson.annotation.JsonInclude; 10 | import com.fasterxml.jackson.annotation.JsonProperty; 11 | import com.fasterxml.jackson.annotation.JsonValue; 12 | 13 | import javax.validation.Valid; 14 | import javax.validation.constraints.NotNull; 15 | import java.util.Objects; 16 | 17 | @JsonInclude(JsonInclude.Include.NON_NULL) 18 | public class LastOperationResource extends AbstractResponse { 19 | 20 | private @Valid 21 | StateEnum state = null; 22 | 23 | private @Valid 24 | String description = null; 25 | 26 | /** 27 | **/ 28 | public LastOperationResource state(StateEnum state) { 29 | this.state = state; 30 | return this; 31 | } 32 | 33 | @JsonProperty("state") 34 | @NotNull 35 | public StateEnum getState() { 36 | return state; 37 | } 38 | 39 | public void setState(StateEnum state) { 40 | this.state = state; 41 | } 42 | 43 | /** 44 | **/ 45 | public LastOperationResource description(String description) { 46 | this.description = description; 47 | return this; 48 | } 49 | 50 | @JsonProperty("description") 51 | public String getDescription() { 52 | return description; 53 | } 54 | 55 | public void setDescription(String description) { 56 | this.description = description; 57 | } 58 | 59 | @Override 60 | public boolean equals(Object o) { 61 | if (this == o) { 62 | return true; 63 | } 64 | if (o == null || getClass() != o.getClass()) { 65 | return false; 66 | } 67 | LastOperationResource lastOperationResource = (LastOperationResource) o; 68 | return Objects.equals(state, lastOperationResource.state) && Objects.equals(description, 69 | lastOperationResource.description); 70 | } 71 | 72 | @Override 73 | public int hashCode() { 74 | return Objects.hash(state, description); 75 | } 76 | 77 | @Override 78 | public String toString() { 79 | StringBuilder sb = new StringBuilder(); 80 | sb.append("class LastOperationResource {\n"); 81 | 82 | sb.append(" state: ").append(toIndentedString(state)).append("\n"); 83 | sb.append(" description: ").append(toIndentedString(description)).append("\n"); 84 | sb.append("}"); 85 | return sb.toString(); 86 | } 87 | 88 | /** 89 | * Convert the given object to string with each line indented by 4 spaces 90 | * (except the first line). 91 | */ 92 | private String toIndentedString(Object o) { 93 | if (o == null) { 94 | return "null"; 95 | } 96 | return o.toString().replace("\n", "\n "); 97 | } 98 | 99 | @JsonFormat(shape = JsonFormat.Shape.OBJECT) 100 | public enum StateEnum { 101 | 102 | IN_PROGRESS(String.valueOf("in progress")), SUCCEEDED(String.valueOf("succeeded")), FAILED(String.valueOf 103 | ("failed")); 104 | 105 | private String value; 106 | 107 | StateEnum(String v) { 108 | value = v; 109 | } 110 | 111 | public static StateEnum fromValue(String v) { 112 | for (StateEnum b : StateEnum.values()) { 113 | if (String.valueOf(b.value).equals(v)) { 114 | return b; 115 | } 116 | } 117 | return null; 118 | } 119 | 120 | @JsonValue 121 | public String value() { 122 | return value; 123 | } 124 | 125 | @Override 126 | public String toString() { 127 | return String.valueOf(value); 128 | } 129 | } 130 | } 131 | 132 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/Metadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import java.util.Objects; 9 | 10 | public class Metadata { 11 | 12 | @Override 13 | public boolean equals(Object o) { 14 | if (this == o) { 15 | return true; 16 | } 17 | if (o == null || getClass() != o.getClass()) { 18 | return false; 19 | } 20 | return true; 21 | } 22 | 23 | @Override 24 | public int hashCode() { 25 | return Objects.hash(); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | StringBuilder sb = new StringBuilder(); 31 | sb.append("class ServiceData {\n"); 32 | 33 | sb.append("}"); 34 | return sb.toString(); 35 | } 36 | 37 | /** 38 | * Convert the given object to string with each line indented by 4 spaces 39 | * (except the first line). 40 | */ 41 | private String toIndentedString(Object o) { 42 | if (o == null) { 43 | return "null"; 44 | } 45 | return o.toString().replace("\n", "\n "); 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/Plan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import javax.validation.constraints.NotNull; 13 | import java.util.Objects; 14 | 15 | @JsonInclude(JsonInclude.Include.NON_NULL) 16 | public class Plan { 17 | 18 | private @Valid 19 | String id = null; 20 | 21 | private @Valid 22 | String name = null; 23 | 24 | private @Valid 25 | String description = null; 26 | 27 | private @Valid 28 | Metadata metadata = null; 29 | 30 | private @Valid 31 | Boolean free = true; 32 | 33 | private @Valid 34 | Boolean bindable = null; 35 | 36 | private @Valid 37 | SchemasObject schemas = null; 38 | 39 | /** 40 | **/ 41 | public Plan id(String id) { 42 | this.id = id; 43 | return this; 44 | } 45 | 46 | @JsonProperty("id") 47 | @NotNull 48 | public String getId() { 49 | return id; 50 | } 51 | 52 | public void setId(String id) { 53 | this.id = id; 54 | } 55 | 56 | /** 57 | **/ 58 | public Plan name(String name) { 59 | this.name = name; 60 | return this; 61 | } 62 | 63 | @JsonProperty("name") 64 | @NotNull 65 | public String getName() { 66 | return name; 67 | } 68 | 69 | public void setName(String name) { 70 | this.name = name; 71 | } 72 | 73 | /** 74 | **/ 75 | public Plan description(String description) { 76 | this.description = description; 77 | return this; 78 | } 79 | 80 | @JsonProperty("description") 81 | @NotNull 82 | public String getDescription() { 83 | return description; 84 | } 85 | 86 | public void setDescription(String description) { 87 | this.description = description; 88 | } 89 | 90 | /** 91 | **/ 92 | public Plan metadata(Metadata metadata) { 93 | this.metadata = metadata; 94 | return this; 95 | } 96 | 97 | @JsonProperty("metadata") 98 | public Metadata getMetadata() { 99 | return metadata; 100 | } 101 | 102 | public void setMetadata(Metadata metadata) { 103 | this.metadata = metadata; 104 | } 105 | 106 | /** 107 | **/ 108 | public Plan free(Boolean free) { 109 | this.free = free; 110 | return this; 111 | } 112 | 113 | @JsonProperty("free") 114 | public Boolean isFree() { 115 | return free; 116 | } 117 | 118 | public void setFree(Boolean free) { 119 | this.free = free; 120 | } 121 | 122 | /** 123 | **/ 124 | public Plan bindable(Boolean bindable) { 125 | this.bindable = bindable; 126 | return this; 127 | } 128 | 129 | @JsonProperty("bindable") 130 | public Boolean isBindable() { 131 | return bindable; 132 | } 133 | 134 | public void setBindable(Boolean bindable) { 135 | this.bindable = bindable; 136 | } 137 | 138 | /** 139 | **/ 140 | public Plan schemas(SchemasObject schemas) { 141 | this.schemas = schemas; 142 | return this; 143 | } 144 | 145 | @JsonProperty("schemas") 146 | public SchemasObject getSchemas() { 147 | return schemas; 148 | } 149 | 150 | public void setSchemas(SchemasObject schemas) { 151 | this.schemas = schemas; 152 | } 153 | 154 | @Override 155 | public boolean equals(java.lang.Object o) { 156 | if (this == o) { 157 | return true; 158 | } 159 | if (o == null || getClass() != o.getClass()) { 160 | return false; 161 | } 162 | Plan plan = (Plan) o; 163 | return Objects.equals(id, plan.id) && Objects.equals(name, plan.name) && Objects.equals(description, plan 164 | .description) && Objects.equals(metadata, plan.metadata) && Objects.equals(free, plan.free) && 165 | Objects.equals(bindable, plan.bindable) && Objects.equals(schemas, plan.schemas); 166 | } 167 | 168 | @Override 169 | public int hashCode() { 170 | return Objects.hash(id, name, description, metadata, free, bindable, schemas); 171 | } 172 | 173 | @Override 174 | public String toString() { 175 | StringBuilder sb = new StringBuilder(); 176 | sb.append("class Plan {\n"); 177 | 178 | sb.append(" id: ").append(toIndentedString(id)).append("\n"); 179 | sb.append(" name: ").append(toIndentedString(name)).append("\n"); 180 | sb.append(" description: ").append(toIndentedString(description)).append("\n"); 181 | sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); 182 | sb.append(" free: ").append(toIndentedString(free)).append("\n"); 183 | sb.append(" bindable: ").append(toIndentedString(bindable)).append("\n"); 184 | sb.append(" schemas: ").append(toIndentedString(schemas)).append("\n"); 185 | sb.append("}"); 186 | return sb.toString(); 187 | } 188 | 189 | /** 190 | * Convert the given object to string with each line indented by 4 spaces 191 | * (except the first line). 192 | */ 193 | private String toIndentedString(java.lang.Object o) { 194 | if (o == null) { 195 | return "null"; 196 | } 197 | return o.toString().replace("\n", "\n "); 198 | } 199 | } 200 | 201 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/SchemaParameters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.Map; 13 | import java.util.Objects; 14 | 15 | @JsonInclude(JsonInclude.Include.NON_NULL) 16 | public class SchemaParameters { 17 | 18 | private @Valid 19 | Map parameters = null; 20 | 21 | /** 22 | **/ 23 | public SchemaParameters parameters(Map parameters) { 24 | this.parameters = parameters; 25 | return this; 26 | } 27 | 28 | @JsonProperty("parameters") 29 | public Map getParameters() { 30 | return parameters; 31 | } 32 | 33 | public void setParameters(Map parameters) { 34 | this.parameters = parameters; 35 | } 36 | 37 | @Override 38 | public boolean equals(java.lang.Object o) { 39 | if (this == o) { 40 | return true; 41 | } 42 | if (o == null || getClass() != o.getClass()) { 43 | return false; 44 | } 45 | SchemaParameters schemaParameters = (SchemaParameters) o; 46 | return Objects.equals(parameters, schemaParameters.parameters); 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | return Objects.hash(parameters); 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | StringBuilder sb = new StringBuilder(); 57 | sb.append("class SchemaParameters {\n"); 58 | 59 | sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); 60 | sb.append("}"); 61 | return sb.toString(); 62 | } 63 | 64 | /** 65 | * Convert the given object to string with each line indented by 4 spaces 66 | * (except the first line). 67 | */ 68 | private String toIndentedString(java.lang.Object o) { 69 | if (o == null) { 70 | return "null"; 71 | } 72 | return o.toString().replace("\n", "\n "); 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/SchemasObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.Objects; 13 | 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | public class SchemasObject { 16 | 17 | private @Valid 18 | ServiceInstanceSchemaObject serviceInstance = null; 19 | 20 | private @Valid 21 | ServiceBindingSchemaObject serviceBinding = null; 22 | 23 | /** 24 | **/ 25 | public SchemasObject serviceInstance(ServiceInstanceSchemaObject serviceInstance) { 26 | this.serviceInstance = serviceInstance; 27 | return this; 28 | } 29 | 30 | @JsonProperty("service_instance") 31 | public ServiceInstanceSchemaObject getServiceInstance() { 32 | return serviceInstance; 33 | } 34 | 35 | public void setServiceInstance(ServiceInstanceSchemaObject serviceInstance) { 36 | this.serviceInstance = serviceInstance; 37 | } 38 | 39 | /** 40 | **/ 41 | public SchemasObject serviceBinding(ServiceBindingSchemaObject serviceBinding) { 42 | this.serviceBinding = serviceBinding; 43 | return this; 44 | } 45 | 46 | @JsonProperty("service_binding") 47 | public ServiceBindingSchemaObject getServiceBinding() { 48 | return serviceBinding; 49 | } 50 | 51 | public void setServiceBinding(ServiceBindingSchemaObject serviceBinding) { 52 | this.serviceBinding = serviceBinding; 53 | } 54 | 55 | @Override 56 | public boolean equals(java.lang.Object o) { 57 | if (this == o) { 58 | return true; 59 | } 60 | if (o == null || getClass() != o.getClass()) { 61 | return false; 62 | } 63 | SchemasObject schemasObject = (SchemasObject) o; 64 | return Objects.equals(serviceInstance, schemasObject.serviceInstance) && Objects.equals(serviceBinding, 65 | schemasObject.serviceBinding); 66 | } 67 | 68 | @Override 69 | public int hashCode() { 70 | return Objects.hash(serviceInstance, serviceBinding); 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | StringBuilder sb = new StringBuilder(); 76 | sb.append("class SchemasObject {\n"); 77 | 78 | sb.append(" serviceInstance: ").append(toIndentedString(serviceInstance)).append("\n"); 79 | sb.append(" serviceBinding: ").append(toIndentedString(serviceBinding)).append("\n"); 80 | sb.append("}"); 81 | return sb.toString(); 82 | } 83 | 84 | /** 85 | * Convert the given object to string with each line indented by 4 spaces 86 | * (except the first line). 87 | */ 88 | private String toIndentedString(java.lang.Object o) { 89 | if (o == null) { 90 | return "null"; 91 | } 92 | return o.toString().replace("\n", "\n "); 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceBinding.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonIgnore; 9 | import com.fasterxml.jackson.annotation.JsonInclude; 10 | import com.fasterxml.jackson.annotation.JsonProperty; 11 | import com.oracle.oci.osb.store.BindingData; 12 | 13 | import javax.validation.Valid; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | import java.util.Objects; 17 | 18 | @JsonInclude(JsonInclude.Include.NON_NULL) 19 | public class ServiceBinding extends AbstractResponse { 20 | 21 | private @Valid 22 | java.lang.Object credentials = null; 23 | 24 | private @Valid 25 | String syslogDrainUrl = null; 26 | 27 | private @Valid 28 | String routeServiceUrl = null; 29 | 30 | private @Valid 31 | List volumeMounts = new ArrayList(); 32 | 33 | @JsonIgnore 34 | transient private BindingData bindingData; 35 | 36 | /** 37 | **/ 38 | public ServiceBinding credentials(java.lang.Object credentials) { 39 | this.credentials = credentials; 40 | return this; 41 | } 42 | 43 | @JsonProperty("credentials") 44 | public java.lang.Object getCredentials() { 45 | return credentials; 46 | } 47 | 48 | public void setCredentials(java.lang.Object credentials) { 49 | this.credentials = credentials; 50 | } 51 | 52 | /** 53 | **/ 54 | public ServiceBinding syslogDrainUrl(String syslogDrainUrl) { 55 | this.syslogDrainUrl = syslogDrainUrl; 56 | return this; 57 | } 58 | 59 | @JsonProperty("syslog_drain_url") 60 | public String getSyslogDrainUrl() { 61 | return syslogDrainUrl; 62 | } 63 | 64 | public void setSyslogDrainUrl(String syslogDrainUrl) { 65 | this.syslogDrainUrl = syslogDrainUrl; 66 | } 67 | 68 | /** 69 | **/ 70 | public ServiceBinding routeServiceUrl(String routeServiceUrl) { 71 | this.routeServiceUrl = routeServiceUrl; 72 | return this; 73 | } 74 | 75 | @JsonProperty("route_service_url") 76 | public String getRouteServiceUrl() { 77 | return routeServiceUrl; 78 | } 79 | 80 | public void setRouteServiceUrl(String routeServiceUrl) { 81 | this.routeServiceUrl = routeServiceUrl; 82 | } 83 | 84 | /** 85 | **/ 86 | public ServiceBinding volumeMounts(List volumeMounts) { 87 | this.volumeMounts = volumeMounts; 88 | return this; 89 | } 90 | 91 | @JsonProperty("volume_mounts") 92 | public List getVolumeMounts() { 93 | return volumeMounts; 94 | } 95 | 96 | public void setVolumeMounts(List volumeMounts) { 97 | this.volumeMounts = volumeMounts; 98 | } 99 | 100 | @Override 101 | public boolean equals(java.lang.Object o) { 102 | if (this == o) { 103 | return true; 104 | } 105 | if (o == null || getClass() != o.getClass()) { 106 | return false; 107 | } 108 | ServiceBinding serviceBinding = (ServiceBinding) o; 109 | return Objects.equals(credentials, serviceBinding.credentials) && Objects.equals(syslogDrainUrl, 110 | serviceBinding.syslogDrainUrl) && Objects.equals(routeServiceUrl, serviceBinding.routeServiceUrl) && 111 | Objects.equals(volumeMounts, serviceBinding.volumeMounts); 112 | } 113 | 114 | @Override 115 | public int hashCode() { 116 | return Objects.hash(credentials, syslogDrainUrl, routeServiceUrl, volumeMounts); 117 | } 118 | 119 | @Override 120 | public String toString() { 121 | StringBuilder sb = new StringBuilder(); 122 | sb.append("class ServiceBinding {\n"); 123 | 124 | sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); 125 | sb.append(" syslogDrainUrl: ").append(toIndentedString(syslogDrainUrl)).append("\n"); 126 | sb.append(" routeServiceUrl: ").append(toIndentedString(routeServiceUrl)).append("\n"); 127 | sb.append(" volumeMounts: ").append(toIndentedString(volumeMounts)).append("\n"); 128 | sb.append("}"); 129 | return sb.toString(); 130 | } 131 | 132 | /** 133 | * Convert the given object to string with each line indented by 4 spaces 134 | * (except the first line). 135 | */ 136 | private String toIndentedString(java.lang.Object o) { 137 | if (o == null) { 138 | return "null"; 139 | } 140 | return o.toString().replace("\n", "\n "); 141 | } 142 | 143 | public BindingData getBindingData() { 144 | return bindingData; 145 | } 146 | 147 | public void setBindingData(BindingData bindingData) { 148 | this.bindingData = bindingData; 149 | } 150 | } 151 | 152 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceBindingRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import javax.validation.constraints.NotNull; 12 | import java.util.Objects; 13 | 14 | public class ServiceBindingRequest { 15 | 16 | private @Valid 17 | Context context = null; 18 | 19 | private @Valid 20 | String serviceId = null; 21 | 22 | private @Valid 23 | String planId = null; 24 | 25 | private @Valid 26 | String appGuid = null; 27 | 28 | private @Valid 29 | ServiceBindingResourceObject bindResource = null; 30 | 31 | private @Valid 32 | java.lang.Object parameters = null; 33 | 34 | /** 35 | **/ 36 | public ServiceBindingRequest context(Context context) { 37 | this.context = context; 38 | return this; 39 | } 40 | 41 | @JsonProperty("context") 42 | public Context getContext() { 43 | return context; 44 | } 45 | 46 | public void setContext(Context context) { 47 | this.context = context; 48 | } 49 | 50 | /** 51 | **/ 52 | public ServiceBindingRequest serviceId(String serviceId) { 53 | this.serviceId = serviceId; 54 | return this; 55 | } 56 | 57 | @JsonProperty("service_id") 58 | @NotNull 59 | public String getServiceId() { 60 | return serviceId; 61 | } 62 | 63 | public void setServiceId(String serviceId) { 64 | this.serviceId = serviceId; 65 | } 66 | 67 | /** 68 | **/ 69 | public ServiceBindingRequest planId(String planId) { 70 | this.planId = planId; 71 | return this; 72 | } 73 | 74 | @JsonProperty("plan_id") 75 | @NotNull 76 | public String getPlanId() { 77 | return planId; 78 | } 79 | 80 | public void setPlanId(String planId) { 81 | this.planId = planId; 82 | } 83 | 84 | /** 85 | **/ 86 | public ServiceBindingRequest appGuid(String appGuid) { 87 | this.appGuid = appGuid; 88 | return this; 89 | } 90 | 91 | @JsonProperty("app_guid") 92 | public String getAppGuid() { 93 | return appGuid; 94 | } 95 | 96 | public void setAppGuid(String appGuid) { 97 | this.appGuid = appGuid; 98 | } 99 | 100 | /** 101 | **/ 102 | public ServiceBindingRequest bindResource(ServiceBindingResourceObject bindResource) { 103 | this.bindResource = bindResource; 104 | return this; 105 | } 106 | 107 | @JsonProperty("bind_resource") 108 | public ServiceBindingResourceObject getBindResource() { 109 | return bindResource; 110 | } 111 | 112 | public void setBindResource(ServiceBindingResourceObject bindResource) { 113 | this.bindResource = bindResource; 114 | } 115 | 116 | /** 117 | **/ 118 | public ServiceBindingRequest parameters(java.lang.Object parameters) { 119 | this.parameters = parameters; 120 | return this; 121 | } 122 | 123 | @JsonProperty("parameters") 124 | public java.lang.Object getParameters() { 125 | return parameters; 126 | } 127 | 128 | public void setParameters(java.lang.Object parameters) { 129 | this.parameters = parameters; 130 | } 131 | 132 | @Override 133 | public boolean equals(java.lang.Object o) { 134 | if (this == o) { 135 | return true; 136 | } 137 | if (o == null || getClass() != o.getClass()) { 138 | return false; 139 | } 140 | ServiceBindingRequest serviceBindingRequest = (ServiceBindingRequest) o; 141 | return Objects.equals(context, serviceBindingRequest.context) && Objects.equals(serviceId, 142 | serviceBindingRequest.serviceId) && Objects.equals(planId, serviceBindingRequest.planId) && Objects 143 | .equals(appGuid, serviceBindingRequest.appGuid) && Objects.equals(bindResource, serviceBindingRequest 144 | .bindResource) && Objects.equals(parameters, serviceBindingRequest.parameters); 145 | } 146 | 147 | @Override 148 | public int hashCode() { 149 | return Objects.hash(context, serviceId, planId, appGuid, bindResource, parameters); 150 | } 151 | 152 | @Override 153 | public String toString() { 154 | StringBuilder sb = new StringBuilder(); 155 | sb.append("class ServiceBindingRequest {\n"); 156 | 157 | sb.append(" context: ").append(toIndentedString(context)).append("\n"); 158 | sb.append(" serviceId: ").append(toIndentedString(serviceId)).append("\n"); 159 | sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); 160 | sb.append(" appGuid: ").append(toIndentedString(appGuid)).append("\n"); 161 | sb.append(" bindResource: ").append(toIndentedString(bindResource)).append("\n"); 162 | sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); 163 | sb.append("}"); 164 | return sb.toString(); 165 | } 166 | 167 | /** 168 | * Convert the given object to string with each line indented by 4 spaces 169 | * (except the first line). 170 | */ 171 | private String toIndentedString(java.lang.Object o) { 172 | if (o == null) { 173 | return "null"; 174 | } 175 | return o.toString().replace("\n", "\n "); 176 | } 177 | } 178 | 179 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceBindingResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import java.util.Objects; 15 | 16 | @JsonInclude(JsonInclude.Include.NON_NULL) 17 | public class ServiceBindingResource extends AbstractResponse { 18 | 19 | private @Valid 20 | java.lang.Object credentials = null; 21 | 22 | private @Valid 23 | String syslogDrainUrl = null; 24 | 25 | private @Valid 26 | String routeServiceUrl = null; 27 | 28 | private @Valid 29 | List volumeMounts = new ArrayList(); 30 | 31 | private @Valid 32 | java.lang.Object parameters = null; 33 | 34 | /** 35 | **/ 36 | public ServiceBindingResource credentials(java.lang.Object credentials) { 37 | this.credentials = credentials; 38 | return this; 39 | } 40 | 41 | @JsonProperty("credentials") 42 | public java.lang.Object getCredentials() { 43 | return credentials; 44 | } 45 | 46 | public void setCredentials(java.lang.Object credentials) { 47 | this.credentials = credentials; 48 | } 49 | 50 | /** 51 | **/ 52 | public ServiceBindingResource syslogDrainUrl(String syslogDrainUrl) { 53 | this.syslogDrainUrl = syslogDrainUrl; 54 | return this; 55 | } 56 | 57 | @JsonProperty("syslog_drain_url") 58 | public String getSyslogDrainUrl() { 59 | return syslogDrainUrl; 60 | } 61 | 62 | public void setSyslogDrainUrl(String syslogDrainUrl) { 63 | this.syslogDrainUrl = syslogDrainUrl; 64 | } 65 | 66 | /** 67 | **/ 68 | public ServiceBindingResource routeServiceUrl(String routeServiceUrl) { 69 | this.routeServiceUrl = routeServiceUrl; 70 | return this; 71 | } 72 | 73 | @JsonProperty("route_service_url") 74 | public String getRouteServiceUrl() { 75 | return routeServiceUrl; 76 | } 77 | 78 | public void setRouteServiceUrl(String routeServiceUrl) { 79 | this.routeServiceUrl = routeServiceUrl; 80 | } 81 | 82 | /** 83 | **/ 84 | public ServiceBindingResource volumeMounts(List volumeMounts) { 85 | this.volumeMounts = volumeMounts; 86 | return this; 87 | } 88 | 89 | @JsonProperty("volume_mounts") 90 | public List getVolumeMounts() { 91 | return volumeMounts; 92 | } 93 | 94 | public void setVolumeMounts(List volumeMounts) { 95 | this.volumeMounts = volumeMounts; 96 | } 97 | 98 | /** 99 | **/ 100 | public ServiceBindingResource parameters(java.lang.Object parameters) { 101 | this.parameters = parameters; 102 | return this; 103 | } 104 | 105 | @JsonProperty("parameters") 106 | public java.lang.Object getParameters() { 107 | return parameters; 108 | } 109 | 110 | public void setParameters(java.lang.Object parameters) { 111 | this.parameters = parameters; 112 | } 113 | 114 | @Override 115 | public boolean equals(java.lang.Object o) { 116 | if (this == o) { 117 | return true; 118 | } 119 | if (o == null || getClass() != o.getClass()) { 120 | return false; 121 | } 122 | ServiceBindingResource serviceBindingResource = (ServiceBindingResource) o; 123 | return Objects.equals(credentials, serviceBindingResource.credentials) && Objects.equals(syslogDrainUrl, 124 | serviceBindingResource.syslogDrainUrl) && Objects.equals(routeServiceUrl, serviceBindingResource 125 | .routeServiceUrl) && Objects.equals(volumeMounts, serviceBindingResource.volumeMounts) && Objects 126 | .equals(parameters, serviceBindingResource.parameters); 127 | } 128 | 129 | @Override 130 | public int hashCode() { 131 | return Objects.hash(credentials, syslogDrainUrl, routeServiceUrl, volumeMounts, parameters); 132 | } 133 | 134 | @Override 135 | public String toString() { 136 | StringBuilder sb = new StringBuilder(); 137 | sb.append("class ServiceBindingResource {\n"); 138 | 139 | sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); 140 | sb.append(" syslogDrainUrl: ").append(toIndentedString(syslogDrainUrl)).append("\n"); 141 | sb.append(" routeServiceUrl: ").append(toIndentedString(routeServiceUrl)).append("\n"); 142 | sb.append(" volumeMounts: ").append(toIndentedString(volumeMounts)).append("\n"); 143 | sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); 144 | sb.append("}"); 145 | return sb.toString(); 146 | } 147 | 148 | /** 149 | * Convert the given object to string with each line indented by 4 spaces 150 | * (except the first line). 151 | */ 152 | private String toIndentedString(java.lang.Object o) { 153 | if (o == null) { 154 | return "null"; 155 | } 156 | return o.toString().replace("\n", "\n "); 157 | } 158 | } 159 | 160 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceBindingResourceObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import java.util.Objects; 12 | 13 | public class ServiceBindingResourceObject { 14 | 15 | private @Valid 16 | String appGuid = null; 17 | 18 | private @Valid 19 | String route = null; 20 | 21 | /** 22 | **/ 23 | public ServiceBindingResourceObject appGuid(String appGuid) { 24 | this.appGuid = appGuid; 25 | return this; 26 | } 27 | 28 | @JsonProperty("app_guid") 29 | public String getAppGuid() { 30 | return appGuid; 31 | } 32 | 33 | public void setAppGuid(String appGuid) { 34 | this.appGuid = appGuid; 35 | } 36 | 37 | /** 38 | **/ 39 | public ServiceBindingResourceObject route(String route) { 40 | this.route = route; 41 | return this; 42 | } 43 | 44 | @JsonProperty("route") 45 | public String getRoute() { 46 | return route; 47 | } 48 | 49 | public void setRoute(String route) { 50 | this.route = route; 51 | } 52 | 53 | @Override 54 | public boolean equals(java.lang.Object o) { 55 | if (this == o) { 56 | return true; 57 | } 58 | if (o == null || getClass() != o.getClass()) { 59 | return false; 60 | } 61 | ServiceBindingResourceObject serviceBindingResourceObject = (ServiceBindingResourceObject) o; 62 | return Objects.equals(appGuid, serviceBindingResourceObject.appGuid) && Objects.equals(route, 63 | serviceBindingResourceObject.route); 64 | } 65 | 66 | @Override 67 | public int hashCode() { 68 | return Objects.hash(appGuid, route); 69 | } 70 | 71 | @Override 72 | public String toString() { 73 | StringBuilder sb = new StringBuilder(); 74 | sb.append("class ServiceBindingResourceObject {\n"); 75 | 76 | sb.append(" appGuid: ").append(toIndentedString(appGuid)).append("\n"); 77 | sb.append(" route: ").append(toIndentedString(route)).append("\n"); 78 | sb.append("}"); 79 | return sb.toString(); 80 | } 81 | 82 | /** 83 | * Convert the given object to string with each line indented by 4 spaces 84 | * (except the first line). 85 | */ 86 | private String toIndentedString(java.lang.Object o) { 87 | if (o == null) { 88 | return "null"; 89 | } 90 | return o.toString().replace("\n", "\n "); 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceBindingSchemaObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.Objects; 13 | 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | public class ServiceBindingSchemaObject { 16 | 17 | private @Valid 18 | SchemaParameters create = null; 19 | 20 | /** 21 | **/ 22 | public ServiceBindingSchemaObject create(SchemaParameters create) { 23 | this.create = create; 24 | return this; 25 | } 26 | 27 | @JsonProperty("create") 28 | public SchemaParameters getCreate() { 29 | return create; 30 | } 31 | 32 | public void setCreate(SchemaParameters create) { 33 | this.create = create; 34 | } 35 | 36 | @Override 37 | public boolean equals(java.lang.Object o) { 38 | if (this == o) { 39 | return true; 40 | } 41 | if (o == null || getClass() != o.getClass()) { 42 | return false; 43 | } 44 | ServiceBindingSchemaObject serviceBindingSchemaObject = (ServiceBindingSchemaObject) o; 45 | return Objects.equals(create, serviceBindingSchemaObject.create); 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return Objects.hash(create); 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | StringBuilder sb = new StringBuilder(); 56 | sb.append("class ServiceBindingSchemaObject {\n"); 57 | 58 | sb.append(" create: ").append(toIndentedString(create)).append("\n"); 59 | sb.append("}"); 60 | return sb.toString(); 61 | } 62 | 63 | /** 64 | * Convert the given object to string with each line indented by 4 spaces 65 | * (except the first line). 66 | */ 67 | private String toIndentedString(java.lang.Object o) { 68 | if (o == null) { 69 | return "null"; 70 | } 71 | return o.toString().replace("\n", "\n "); 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceBindingVolumeMount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import javax.validation.constraints.NotNull; 12 | import java.util.Objects; 13 | 14 | public class ServiceBindingVolumeMount { 15 | 16 | private @Valid 17 | String driver = null; 18 | 19 | private @Valid 20 | String containerDir = null; 21 | 22 | private @Valid 23 | ModeEnum mode = null; 24 | 25 | private @Valid 26 | DeviceTypeEnum deviceType = null; 27 | 28 | private @Valid 29 | ServiceBindingVolumeMountDevice device = null; 30 | 31 | /** 32 | **/ 33 | public ServiceBindingVolumeMount driver(String driver) { 34 | this.driver = driver; 35 | return this; 36 | } 37 | 38 | @JsonProperty("driver") 39 | @NotNull 40 | public String getDriver() { 41 | return driver; 42 | } 43 | 44 | public void setDriver(String driver) { 45 | this.driver = driver; 46 | } 47 | 48 | /** 49 | **/ 50 | public ServiceBindingVolumeMount containerDir(String containerDir) { 51 | this.containerDir = containerDir; 52 | return this; 53 | } 54 | 55 | @JsonProperty("container_dir") 56 | @NotNull 57 | public String getContainerDir() { 58 | return containerDir; 59 | } 60 | 61 | public void setContainerDir(String containerDir) { 62 | this.containerDir = containerDir; 63 | } 64 | 65 | /** 66 | **/ 67 | public ServiceBindingVolumeMount mode(ModeEnum mode) { 68 | this.mode = mode; 69 | return this; 70 | } 71 | 72 | @JsonProperty("mode") 73 | @NotNull 74 | public ModeEnum getMode() { 75 | return mode; 76 | } 77 | 78 | public void setMode(ModeEnum mode) { 79 | this.mode = mode; 80 | } 81 | 82 | /** 83 | **/ 84 | public ServiceBindingVolumeMount deviceType(DeviceTypeEnum deviceType) { 85 | this.deviceType = deviceType; 86 | return this; 87 | } 88 | 89 | @JsonProperty("device_type") 90 | @NotNull 91 | public DeviceTypeEnum getDeviceType() { 92 | return deviceType; 93 | } 94 | 95 | public void setDeviceType(DeviceTypeEnum deviceType) { 96 | this.deviceType = deviceType; 97 | } 98 | 99 | /** 100 | **/ 101 | public ServiceBindingVolumeMount device(ServiceBindingVolumeMountDevice device) { 102 | this.device = device; 103 | return this; 104 | } 105 | 106 | @JsonProperty("device") 107 | @NotNull 108 | public ServiceBindingVolumeMountDevice getDevice() { 109 | return device; 110 | } 111 | 112 | public void setDevice(ServiceBindingVolumeMountDevice device) { 113 | this.device = device; 114 | } 115 | 116 | @Override 117 | public boolean equals(java.lang.Object o) { 118 | if (this == o) { 119 | return true; 120 | } 121 | if (o == null || getClass() != o.getClass()) { 122 | return false; 123 | } 124 | ServiceBindingVolumeMount serviceBindingVolumeMount = (ServiceBindingVolumeMount) o; 125 | return Objects.equals(driver, serviceBindingVolumeMount.driver) && Objects.equals(containerDir, 126 | serviceBindingVolumeMount.containerDir) && Objects.equals(mode, serviceBindingVolumeMount.mode) && 127 | Objects.equals(deviceType, serviceBindingVolumeMount.deviceType) && Objects.equals(device, 128 | serviceBindingVolumeMount.device); 129 | } 130 | 131 | @Override 132 | public int hashCode() { 133 | return Objects.hash(driver, containerDir, mode, deviceType, device); 134 | } 135 | 136 | @Override 137 | public String toString() { 138 | StringBuilder sb = new StringBuilder(); 139 | sb.append("class ServiceBindingVolumeMount {\n"); 140 | 141 | sb.append(" driver: ").append(toIndentedString(driver)).append("\n"); 142 | sb.append(" containerDir: ").append(toIndentedString(containerDir)).append("\n"); 143 | sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); 144 | sb.append(" deviceType: ").append(toIndentedString(deviceType)).append("\n"); 145 | sb.append(" device: ").append(toIndentedString(device)).append("\n"); 146 | sb.append("}"); 147 | return sb.toString(); 148 | } 149 | 150 | /** 151 | * Convert the given object to string with each line indented by 4 spaces 152 | * (except the first line). 153 | */ 154 | private String toIndentedString(java.lang.Object o) { 155 | if (o == null) { 156 | return "null"; 157 | } 158 | return o.toString().replace("\n", "\n "); 159 | } 160 | 161 | public enum ModeEnum { 162 | 163 | R(String.valueOf("r")), RW(String.valueOf("rw")); 164 | 165 | private String value; 166 | 167 | ModeEnum(String v) { 168 | value = v; 169 | } 170 | 171 | public static ModeEnum fromValue(String v) { 172 | for (ModeEnum b : ModeEnum.values()) { 173 | if (String.valueOf(b.value).equals(v)) { 174 | return b; 175 | } 176 | } 177 | return null; 178 | } 179 | 180 | public String value() { 181 | return value; 182 | } 183 | 184 | @Override 185 | public String toString() { 186 | return String.valueOf(value); 187 | } 188 | } 189 | 190 | public enum DeviceTypeEnum { 191 | 192 | SHARED(String.valueOf("shared")); 193 | 194 | private String value; 195 | 196 | DeviceTypeEnum(String v) { 197 | value = v; 198 | } 199 | 200 | public static DeviceTypeEnum fromValue(String v) { 201 | for (DeviceTypeEnum b : DeviceTypeEnum.values()) { 202 | if (String.valueOf(b.value).equals(v)) { 203 | return b; 204 | } 205 | } 206 | return null; 207 | } 208 | 209 | public String value() { 210 | return value; 211 | } 212 | 213 | @Override 214 | public String toString() { 215 | return String.valueOf(value); 216 | } 217 | } 218 | } 219 | 220 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceBindingVolumeMountDevice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import javax.validation.constraints.NotNull; 12 | import java.util.Objects; 13 | 14 | public class ServiceBindingVolumeMountDevice { 15 | 16 | private @Valid 17 | String volumeId = null; 18 | 19 | private @Valid 20 | java.lang.Object mountConfig = null; 21 | 22 | /** 23 | **/ 24 | public ServiceBindingVolumeMountDevice volumeId(String volumeId) { 25 | this.volumeId = volumeId; 26 | return this; 27 | } 28 | 29 | @JsonProperty("volume_id") 30 | @NotNull 31 | public String getVolumeId() { 32 | return volumeId; 33 | } 34 | 35 | public void setVolumeId(String volumeId) { 36 | this.volumeId = volumeId; 37 | } 38 | 39 | /** 40 | **/ 41 | public ServiceBindingVolumeMountDevice mountConfig(java.lang.Object mountConfig) { 42 | this.mountConfig = mountConfig; 43 | return this; 44 | } 45 | 46 | @JsonProperty("mount_config") 47 | public java.lang.Object getMountConfig() { 48 | return mountConfig; 49 | } 50 | 51 | public void setMountConfig(java.lang.Object mountConfig) { 52 | this.mountConfig = mountConfig; 53 | } 54 | 55 | @Override 56 | public boolean equals(java.lang.Object o) { 57 | if (this == o) { 58 | return true; 59 | } 60 | if (o == null || getClass() != o.getClass()) { 61 | return false; 62 | } 63 | ServiceBindingVolumeMountDevice serviceBindingVolumeMountDevice = (ServiceBindingVolumeMountDevice) o; 64 | return Objects.equals(volumeId, serviceBindingVolumeMountDevice.volumeId) && Objects.equals(mountConfig, 65 | serviceBindingVolumeMountDevice.mountConfig); 66 | } 67 | 68 | @Override 69 | public int hashCode() { 70 | return Objects.hash(volumeId, mountConfig); 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | StringBuilder sb = new StringBuilder(); 76 | sb.append("class ServiceBindingVolumeMountDevice {\n"); 77 | 78 | sb.append(" volumeId: ").append(toIndentedString(volumeId)).append("\n"); 79 | sb.append(" mountConfig: ").append(toIndentedString(mountConfig)).append("\n"); 80 | sb.append("}"); 81 | return sb.toString(); 82 | } 83 | 84 | /** 85 | * Convert the given object to string with each line indented by 4 spaces 86 | * (except the first line). 87 | */ 88 | private String toIndentedString(java.lang.Object o) { 89 | if (o == null) { 90 | return "null"; 91 | } 92 | return o.toString().replace("\n", "\n "); 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceInstanceAsyncOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonIgnore; 9 | import com.fasterxml.jackson.annotation.JsonInclude; 10 | import com.fasterxml.jackson.annotation.JsonProperty; 11 | import com.oracle.oci.osb.store.ServiceData; 12 | 13 | import javax.validation.Valid; 14 | import java.util.Objects; 15 | 16 | @JsonInclude(JsonInclude.Include.NON_NULL) 17 | public class ServiceInstanceAsyncOperation extends AbstractResponse { 18 | 19 | @Valid 20 | private String dashboardUrl = null; 21 | 22 | @Valid 23 | private String operation = null; 24 | 25 | @JsonIgnore 26 | private ServiceData svcData; 27 | 28 | /** 29 | **/ 30 | public ServiceInstanceAsyncOperation dashboardUrl(String dashboardUrl) { 31 | this.dashboardUrl = dashboardUrl; 32 | return this; 33 | } 34 | 35 | @JsonProperty("dashboard_url") 36 | public String getDashboardUrl() { 37 | return dashboardUrl; 38 | } 39 | 40 | public void setDashboardUrl(String dashboardUrl) { 41 | this.dashboardUrl = dashboardUrl; 42 | } 43 | 44 | /** 45 | **/ 46 | public ServiceInstanceAsyncOperation operation(String operation) { 47 | this.operation = operation; 48 | return this; 49 | } 50 | 51 | @JsonProperty("operation") 52 | public String getOperation() { 53 | return operation; 54 | } 55 | 56 | public void setOperation(String operation) { 57 | this.operation = operation; 58 | } 59 | 60 | public ServiceData getSvcData() { 61 | return svcData; 62 | } 63 | 64 | public void setSvcData(ServiceData svcData) { 65 | this.svcData = svcData; 66 | } 67 | 68 | @Override 69 | public boolean equals(java.lang.Object o) { 70 | if (this == o) { 71 | return true; 72 | } 73 | if (o == null || getClass() != o.getClass()) { 74 | return false; 75 | } 76 | ServiceInstanceAsyncOperation serviceInstanceAsyncOperation = (ServiceInstanceAsyncOperation) o; 77 | return Objects.equals(dashboardUrl, serviceInstanceAsyncOperation.dashboardUrl) && Objects.equals(operation, 78 | serviceInstanceAsyncOperation.operation); 79 | } 80 | 81 | @Override 82 | public int hashCode() { 83 | return Objects.hash(dashboardUrl, operation); 84 | } 85 | 86 | @Override 87 | public String toString() { 88 | StringBuilder sb = new StringBuilder(); 89 | sb.append("class ServiceInstanceAsyncOperation {\n"); 90 | 91 | sb.append(" dashboardUrl: ").append(toIndentedString(dashboardUrl)).append("\n"); 92 | sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); 93 | sb.append("}"); 94 | return sb.toString(); 95 | } 96 | 97 | /** 98 | * Convert the given object to string with each line indented by 4 spaces 99 | * (except the first line). 100 | */ 101 | private String toIndentedString(java.lang.Object o) { 102 | if (o == null) { 103 | return "null"; 104 | } 105 | return o.toString().replace("\n", "\n "); 106 | } 107 | } 108 | 109 | 110 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceInstancePreviousValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import java.util.Objects; 12 | 13 | public class ServiceInstancePreviousValues { 14 | 15 | private @Valid 16 | String serviceId = null; 17 | 18 | private @Valid 19 | String planId = null; 20 | 21 | private @Valid 22 | String organizationId = null; 23 | 24 | private @Valid 25 | String spaceId = null; 26 | 27 | /** 28 | **/ 29 | public ServiceInstancePreviousValues serviceId(String serviceId) { 30 | this.serviceId = serviceId; 31 | return this; 32 | } 33 | 34 | @JsonProperty("service_id") 35 | public String getServiceId() { 36 | return serviceId; 37 | } 38 | 39 | public void setServiceId(String serviceId) { 40 | this.serviceId = serviceId; 41 | } 42 | 43 | /** 44 | **/ 45 | public ServiceInstancePreviousValues planId(String planId) { 46 | this.planId = planId; 47 | return this; 48 | } 49 | 50 | @JsonProperty("plan_id") 51 | public String getPlanId() { 52 | return planId; 53 | } 54 | 55 | public void setPlanId(String planId) { 56 | this.planId = planId; 57 | } 58 | 59 | /** 60 | **/ 61 | public ServiceInstancePreviousValues organizationId(String organizationId) { 62 | this.organizationId = organizationId; 63 | return this; 64 | } 65 | 66 | @JsonProperty("organization_id") 67 | public String getOrganizationId() { 68 | return organizationId; 69 | } 70 | 71 | public void setOrganizationId(String organizationId) { 72 | this.organizationId = organizationId; 73 | } 74 | 75 | /** 76 | **/ 77 | public ServiceInstancePreviousValues spaceId(String spaceId) { 78 | this.spaceId = spaceId; 79 | return this; 80 | } 81 | 82 | @JsonProperty("space_id") 83 | public String getSpaceId() { 84 | return spaceId; 85 | } 86 | 87 | public void setSpaceId(String spaceId) { 88 | this.spaceId = spaceId; 89 | } 90 | 91 | @Override 92 | public boolean equals(java.lang.Object o) { 93 | if (this == o) { 94 | return true; 95 | } 96 | if (o == null || getClass() != o.getClass()) { 97 | return false; 98 | } 99 | ServiceInstancePreviousValues serviceInstancePreviousValues = (ServiceInstancePreviousValues) o; 100 | return Objects.equals(serviceId, serviceInstancePreviousValues.serviceId) && Objects.equals(planId, 101 | serviceInstancePreviousValues.planId) && Objects.equals(organizationId, serviceInstancePreviousValues 102 | .organizationId) && Objects.equals(spaceId, serviceInstancePreviousValues.spaceId); 103 | } 104 | 105 | @Override 106 | public int hashCode() { 107 | return Objects.hash(serviceId, planId, organizationId, spaceId); 108 | } 109 | 110 | @Override 111 | public String toString() { 112 | StringBuilder sb = new StringBuilder(); 113 | sb.append("class ServiceInstancePreviousValues {\n"); 114 | 115 | sb.append(" serviceId: ").append(toIndentedString(serviceId)).append("\n"); 116 | sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); 117 | sb.append(" organizationId: ").append(toIndentedString(organizationId)).append("\n"); 118 | sb.append(" spaceId: ").append(toIndentedString(spaceId)).append("\n"); 119 | sb.append("}"); 120 | return sb.toString(); 121 | } 122 | 123 | /** 124 | * Convert the given object to string with each line indented by 4 spaces 125 | * (except the first line). 126 | */ 127 | private String toIndentedString(java.lang.Object o) { 128 | if (o == null) { 129 | return "null"; 130 | } 131 | return o.toString().replace("\n", "\n "); 132 | } 133 | } 134 | 135 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceInstanceProvision.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonIgnore; 9 | import com.fasterxml.jackson.annotation.JsonInclude; 10 | import com.fasterxml.jackson.annotation.JsonProperty; 11 | import com.oracle.oci.osb.store.ServiceData; 12 | 13 | import javax.validation.Valid; 14 | import java.util.Objects; 15 | 16 | @JsonInclude(JsonInclude.Include.NON_NULL) 17 | public class ServiceInstanceProvision extends AsyncOperation { 18 | 19 | private @Valid 20 | String dashboardUrl = null; 21 | 22 | private @Valid 23 | String operation = null; 24 | 25 | @JsonIgnore 26 | transient private int statusCode; 27 | 28 | @JsonIgnore 29 | transient private ServiceData svcData; 30 | 31 | /** 32 | **/ 33 | public ServiceInstanceProvision dashboardUrl(String dashboardUrl) { 34 | this.dashboardUrl = dashboardUrl; 35 | return this; 36 | } 37 | 38 | @JsonProperty("dashboard_url") 39 | public String getDashboardUrl() { 40 | return dashboardUrl; 41 | } 42 | 43 | public void setDashboardUrl(String dashboardUrl) { 44 | this.dashboardUrl = dashboardUrl; 45 | } 46 | 47 | @JsonProperty("operation") 48 | public String getOperation() { 49 | return operation; 50 | } 51 | 52 | public void setOperation(String operation) { 53 | this.operation = operation; 54 | } 55 | 56 | @Override 57 | public boolean equals(java.lang.Object o) { 58 | if (this == o) { 59 | return true; 60 | } 61 | if (o == null || getClass() != o.getClass()) { 62 | return false; 63 | } 64 | ServiceInstanceProvision serviceInstanceProvision = (ServiceInstanceProvision) o; 65 | return Objects.equals(dashboardUrl, serviceInstanceProvision.dashboardUrl) && Objects.equals(operation, 66 | serviceInstanceProvision.operation); 67 | } 68 | 69 | public int getStatusCode() { 70 | return statusCode; 71 | } 72 | 73 | public void setStatusCode(int statusCode) { 74 | this.statusCode = statusCode; 75 | } 76 | 77 | @Override 78 | public int hashCode() { 79 | return Objects.hash(dashboardUrl); 80 | } 81 | 82 | @Override 83 | public String toString() { 84 | StringBuilder sb = new StringBuilder(); 85 | sb.append("class ServiceInstanceProvision {\n"); 86 | 87 | sb.append(" dashboardUrl: ").append(toIndentedString(dashboardUrl)).append("\n"); 88 | sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); 89 | sb.append("}"); 90 | return sb.toString(); 91 | } 92 | 93 | /** 94 | * Convert the given object to string with each line indented by 4 spaces 95 | * (except the first line). 96 | */ 97 | private String toIndentedString(java.lang.Object o) { 98 | if (o == null) { 99 | return "null"; 100 | } 101 | return o.toString().replace("\n", "\n "); 102 | } 103 | 104 | public ServiceData getSvcData() { 105 | return svcData; 106 | } 107 | 108 | public void setSvcData(ServiceData svcData) { 109 | this.svcData = svcData; 110 | } 111 | } 112 | 113 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceInstanceProvisionRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import javax.validation.constraints.NotNull; 12 | import java.util.Objects; 13 | 14 | public class ServiceInstanceProvisionRequest { 15 | 16 | private @Valid 17 | String serviceId = null; 18 | 19 | private @Valid 20 | String planId = null; 21 | 22 | private @Valid 23 | Context context = null; 24 | 25 | private @Valid 26 | String organizationGuid = null; 27 | 28 | private @Valid 29 | String spaceGuid = null; 30 | 31 | private @Valid 32 | java.lang.Object parameters = null; 33 | 34 | /** 35 | **/ 36 | public ServiceInstanceProvisionRequest serviceId(String serviceId) { 37 | this.serviceId = serviceId; 38 | return this; 39 | } 40 | 41 | @JsonProperty("service_id") 42 | @NotNull 43 | public String getServiceId() { 44 | return serviceId; 45 | } 46 | 47 | public void setServiceId(String serviceId) { 48 | this.serviceId = serviceId; 49 | } 50 | 51 | /** 52 | **/ 53 | public ServiceInstanceProvisionRequest planId(String planId) { 54 | this.planId = planId; 55 | return this; 56 | } 57 | 58 | @JsonProperty("plan_id") 59 | @NotNull 60 | public String getPlanId() { 61 | return planId; 62 | } 63 | 64 | public void setPlanId(String planId) { 65 | this.planId = planId; 66 | } 67 | 68 | /** 69 | **/ 70 | public ServiceInstanceProvisionRequest context(Context context) { 71 | this.context = context; 72 | return this; 73 | } 74 | 75 | @JsonProperty("context") 76 | public Context getContext() { 77 | return context; 78 | } 79 | 80 | public void setContext(Context context) { 81 | this.context = context; 82 | } 83 | 84 | /** 85 | **/ 86 | public ServiceInstanceProvisionRequest organizationGuid(String organizationGuid) { 87 | this.organizationGuid = organizationGuid; 88 | return this; 89 | } 90 | 91 | @JsonProperty("organization_guid") 92 | @NotNull 93 | public String getOrganizationGuid() { 94 | return organizationGuid; 95 | } 96 | 97 | public void setOrganizationGuid(String organizationGuid) { 98 | this.organizationGuid = organizationGuid; 99 | } 100 | 101 | /** 102 | **/ 103 | public ServiceInstanceProvisionRequest spaceGuid(String spaceGuid) { 104 | this.spaceGuid = spaceGuid; 105 | return this; 106 | } 107 | 108 | @JsonProperty("space_guid") 109 | @NotNull 110 | public String getSpaceGuid() { 111 | return spaceGuid; 112 | } 113 | 114 | public void setSpaceGuid(String spaceGuid) { 115 | this.spaceGuid = spaceGuid; 116 | } 117 | 118 | /** 119 | **/ 120 | public ServiceInstanceProvisionRequest parameters(java.lang.Object parameters) { 121 | this.parameters = parameters; 122 | return this; 123 | } 124 | 125 | @JsonProperty("parameters") 126 | public java.lang.Object getParameters() { 127 | return parameters; 128 | } 129 | 130 | public void setParameters(java.lang.Object parameters) { 131 | this.parameters = parameters; 132 | } 133 | 134 | @Override 135 | public boolean equals(java.lang.Object o) { 136 | if (this == o) { 137 | return true; 138 | } 139 | if (o == null || getClass() != o.getClass()) { 140 | return false; 141 | } 142 | ServiceInstanceProvisionRequest serviceInstanceProvisionRequest = (ServiceInstanceProvisionRequest) o; 143 | return Objects.equals(serviceId, serviceInstanceProvisionRequest.serviceId) && Objects.equals(planId, 144 | serviceInstanceProvisionRequest.planId) && Objects.equals(context, serviceInstanceProvisionRequest 145 | .context) && Objects.equals(organizationGuid, serviceInstanceProvisionRequest.organizationGuid) && 146 | Objects.equals(spaceGuid, serviceInstanceProvisionRequest.spaceGuid) && Objects.equals(parameters, 147 | serviceInstanceProvisionRequest.parameters); 148 | } 149 | 150 | @Override 151 | public int hashCode() { 152 | return Objects.hash(serviceId, planId, context, organizationGuid, spaceGuid, parameters); 153 | } 154 | 155 | @Override 156 | public String toString() { 157 | StringBuilder sb = new StringBuilder(); 158 | sb.append("class ServiceInstanceProvisionRequest {\n"); 159 | 160 | sb.append(" serviceId: ").append(toIndentedString(serviceId)).append("\n"); 161 | sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); 162 | sb.append(" context: ").append(toIndentedString(context)).append("\n"); 163 | sb.append(" organizationGuid: ").append(toIndentedString(organizationGuid)).append("\n"); 164 | sb.append(" spaceGuid: ").append(toIndentedString(spaceGuid)).append("\n"); 165 | sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); 166 | sb.append("}"); 167 | return sb.toString(); 168 | } 169 | 170 | /** 171 | * Convert the given object to string with each line indented by 4 spaces 172 | * (except the first line). 173 | */ 174 | private String toIndentedString(java.lang.Object o) { 175 | if (o == null) { 176 | return "null"; 177 | } 178 | return o.toString().replace("\n", "\n "); 179 | } 180 | } 181 | 182 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceInstanceResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.Objects; 13 | 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | public class ServiceInstanceResource extends AbstractResponse { 16 | 17 | private @Valid 18 | String serviceId = null; 19 | 20 | private @Valid 21 | String planId = null; 22 | 23 | private @Valid 24 | String dashboardUrl = null; 25 | 26 | private @Valid 27 | java.lang.Object parameters = null; 28 | 29 | /** 30 | **/ 31 | public ServiceInstanceResource serviceId(String serviceId) { 32 | this.serviceId = serviceId; 33 | return this; 34 | } 35 | 36 | @JsonProperty("service_id") 37 | public String getServiceId() { 38 | return serviceId; 39 | } 40 | 41 | public void setServiceId(String serviceId) { 42 | this.serviceId = serviceId; 43 | } 44 | 45 | /** 46 | **/ 47 | public ServiceInstanceResource planId(String planId) { 48 | this.planId = planId; 49 | return this; 50 | } 51 | 52 | @JsonProperty("plan_id") 53 | public String getPlanId() { 54 | return planId; 55 | } 56 | 57 | public void setPlanId(String planId) { 58 | this.planId = planId; 59 | } 60 | 61 | /** 62 | **/ 63 | public ServiceInstanceResource dashboardUrl(String dashboardUrl) { 64 | this.dashboardUrl = dashboardUrl; 65 | return this; 66 | } 67 | 68 | @JsonProperty("dashboard_url") 69 | public String getDashboardUrl() { 70 | return dashboardUrl; 71 | } 72 | 73 | public void setDashboardUrl(String dashboardUrl) { 74 | this.dashboardUrl = dashboardUrl; 75 | } 76 | 77 | /** 78 | **/ 79 | public ServiceInstanceResource parameters(java.lang.Object parameters) { 80 | this.parameters = parameters; 81 | return this; 82 | } 83 | 84 | @JsonProperty("parameters") 85 | public java.lang.Object getParameters() { 86 | return parameters; 87 | } 88 | 89 | public void setParameters(java.lang.Object parameters) { 90 | this.parameters = parameters; 91 | } 92 | 93 | @Override 94 | public boolean equals(java.lang.Object o) { 95 | if (this == o) { 96 | return true; 97 | } 98 | if (o == null || getClass() != o.getClass()) { 99 | return false; 100 | } 101 | ServiceInstanceResource serviceInstanceResource = (ServiceInstanceResource) o; 102 | return Objects.equals(serviceId, serviceInstanceResource.serviceId) && Objects.equals(planId, 103 | serviceInstanceResource.planId) && Objects.equals(dashboardUrl, serviceInstanceResource.dashboardUrl) 104 | && Objects.equals(parameters, serviceInstanceResource.parameters); 105 | } 106 | 107 | @Override 108 | public int hashCode() { 109 | return Objects.hash(serviceId, planId, dashboardUrl, parameters); 110 | } 111 | 112 | @Override 113 | public String toString() { 114 | StringBuilder sb = new StringBuilder(); 115 | sb.append("class ServiceInstanceResource {\n"); 116 | 117 | sb.append(" serviceId: ").append(toIndentedString(serviceId)).append("\n"); 118 | sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); 119 | sb.append(" dashboardUrl: ").append(toIndentedString(dashboardUrl)).append("\n"); 120 | sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); 121 | sb.append("}"); 122 | return sb.toString(); 123 | } 124 | 125 | /** 126 | * Convert the given object to string with each line indented by 4 spaces 127 | * (except the first line). 128 | */ 129 | private String toIndentedString(java.lang.Object o) { 130 | if (o == null) { 131 | return "null"; 132 | } 133 | return o.toString().replace("\n", "\n "); 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceInstanceSchemaObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonInclude; 9 | import com.fasterxml.jackson.annotation.JsonProperty; 10 | 11 | import javax.validation.Valid; 12 | import java.util.Objects; 13 | 14 | @JsonInclude(JsonInclude.Include.NON_NULL) 15 | public class ServiceInstanceSchemaObject { 16 | 17 | private @Valid 18 | SchemaParameters create = null; 19 | 20 | private @Valid 21 | SchemaParameters update = null; 22 | 23 | /** 24 | **/ 25 | public ServiceInstanceSchemaObject create(SchemaParameters create) { 26 | this.create = create; 27 | return this; 28 | } 29 | 30 | @JsonProperty("create") 31 | public SchemaParameters getCreate() { 32 | return create; 33 | } 34 | 35 | public void setCreate(SchemaParameters create) { 36 | this.create = create; 37 | } 38 | 39 | /** 40 | **/ 41 | public ServiceInstanceSchemaObject update(SchemaParameters update) { 42 | this.update = update; 43 | return this; 44 | } 45 | 46 | @JsonProperty("update") 47 | public SchemaParameters getUpdate() { 48 | return update; 49 | } 50 | 51 | public void setUpdate(SchemaParameters update) { 52 | this.update = update; 53 | } 54 | 55 | @Override 56 | public boolean equals(java.lang.Object o) { 57 | if (this == o) { 58 | return true; 59 | } 60 | if (o == null || getClass() != o.getClass()) { 61 | return false; 62 | } 63 | ServiceInstanceSchemaObject serviceInstanceSchemaObject = (ServiceInstanceSchemaObject) o; 64 | return Objects.equals(create, serviceInstanceSchemaObject.create) && Objects.equals(update, 65 | serviceInstanceSchemaObject.update); 66 | } 67 | 68 | @Override 69 | public int hashCode() { 70 | return Objects.hash(create, update); 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | StringBuilder sb = new StringBuilder(); 76 | sb.append("class ServiceInstanceSchemaObject {\n"); 77 | 78 | sb.append(" create: ").append(toIndentedString(create)).append("\n"); 79 | sb.append(" update: ").append(toIndentedString(update)).append("\n"); 80 | sb.append("}"); 81 | return sb.toString(); 82 | } 83 | 84 | /** 85 | * Convert the given object to string with each line indented by 4 spaces 86 | * (except the first line). 87 | */ 88 | private String toIndentedString(java.lang.Object o) { 89 | if (o == null) { 90 | return "null"; 91 | } 92 | return o.toString().replace("\n", "\n "); 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/model/ServiceInstanceUpdateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.model; 7 | 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | 10 | import javax.validation.Valid; 11 | import javax.validation.constraints.NotNull; 12 | import java.util.Objects; 13 | 14 | public class ServiceInstanceUpdateRequest { 15 | 16 | private @Valid 17 | Context context = null; 18 | 19 | private @Valid 20 | String serviceId = null; 21 | 22 | private @Valid 23 | String planId = null; 24 | 25 | private @Valid 26 | java.lang.Object parameters = null; 27 | 28 | private @Valid 29 | ServiceInstancePreviousValues previousValues = null; 30 | 31 | /** 32 | **/ 33 | public ServiceInstanceUpdateRequest context(Context context) { 34 | this.context = context; 35 | return this; 36 | } 37 | 38 | @JsonProperty("context") 39 | public Context getContext() { 40 | return context; 41 | } 42 | 43 | public void setContext(Context context) { 44 | this.context = context; 45 | } 46 | 47 | /** 48 | **/ 49 | public ServiceInstanceUpdateRequest serviceId(String serviceId) { 50 | this.serviceId = serviceId; 51 | return this; 52 | } 53 | 54 | @JsonProperty("service_id") 55 | @NotNull 56 | public String getServiceId() { 57 | return serviceId; 58 | } 59 | 60 | public void setServiceId(String serviceId) { 61 | this.serviceId = serviceId; 62 | } 63 | 64 | /** 65 | **/ 66 | public ServiceInstanceUpdateRequest planId(String planId) { 67 | this.planId = planId; 68 | return this; 69 | } 70 | 71 | @JsonProperty("plan_id") 72 | public String getPlanId() { 73 | return planId; 74 | } 75 | 76 | public void setPlanId(String planId) { 77 | this.planId = planId; 78 | } 79 | 80 | /** 81 | **/ 82 | public ServiceInstanceUpdateRequest parameters(java.lang.Object parameters) { 83 | this.parameters = parameters; 84 | return this; 85 | } 86 | 87 | @JsonProperty("parameters") 88 | public java.lang.Object getParameters() { 89 | return parameters; 90 | } 91 | 92 | public void setParameters(java.lang.Object parameters) { 93 | this.parameters = parameters; 94 | } 95 | 96 | /** 97 | **/ 98 | public ServiceInstanceUpdateRequest previousValues(ServiceInstancePreviousValues previousValues) { 99 | this.previousValues = previousValues; 100 | return this; 101 | } 102 | 103 | @JsonProperty("previous_values") 104 | public ServiceInstancePreviousValues getPreviousValues() { 105 | return previousValues; 106 | } 107 | 108 | public void setPreviousValues(ServiceInstancePreviousValues previousValues) { 109 | this.previousValues = previousValues; 110 | } 111 | 112 | @Override 113 | public boolean equals(java.lang.Object o) { 114 | if (this == o) { 115 | return true; 116 | } 117 | if (o == null || getClass() != o.getClass()) { 118 | return false; 119 | } 120 | ServiceInstanceUpdateRequest serviceInstanceUpdateRequest = (ServiceInstanceUpdateRequest) o; 121 | return Objects.equals(context, serviceInstanceUpdateRequest.context) && Objects.equals(serviceId, 122 | serviceInstanceUpdateRequest.serviceId) && Objects.equals(planId, serviceInstanceUpdateRequest 123 | .planId) && Objects.equals(parameters, serviceInstanceUpdateRequest.parameters) && Objects.equals 124 | (previousValues, serviceInstanceUpdateRequest.previousValues); 125 | } 126 | 127 | @Override 128 | public int hashCode() { 129 | return Objects.hash(context, serviceId, planId, parameters, previousValues); 130 | } 131 | 132 | @Override 133 | public String toString() { 134 | StringBuilder sb = new StringBuilder(); 135 | sb.append("class ServiceInstanceUpdateRequest {\n"); 136 | 137 | sb.append(" context: ").append(toIndentedString(context)).append("\n"); 138 | sb.append(" serviceId: ").append(toIndentedString(serviceId)).append("\n"); 139 | sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); 140 | sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); 141 | sb.append(" previousValues: ").append(toIndentedString(previousValues)).append("\n"); 142 | sb.append("}"); 143 | return sb.toString(); 144 | } 145 | 146 | /** 147 | * Convert the given object to string with each line indented by 4 spaces 148 | * (except the first line). 149 | */ 150 | private String toIndentedString(java.lang.Object o) { 151 | if (o == null) { 152 | return "null"; 153 | } 154 | return o.toString().replace("\n", "\n "); 155 | } 156 | } 157 | 158 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/ociclient/AuthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.ociclient; 7 | 8 | import com.oracle.bmc.auth.AuthenticationDetailsProvider; 9 | 10 | /** 11 | * Interface for obtaining Authentication Provider for interacting with OCI 12 | * Services. 13 | */ 14 | public interface AuthProvider { 15 | /** 16 | * Returns instance of {@code AuthenticationDetailsProvider} 17 | * 18 | * @return AuthenticationDetailsProvider 19 | */ 20 | AuthenticationDetailsProvider getAuthProvider(); 21 | } 22 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/ociclient/SystemPropsAuthProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.ociclient; 7 | 8 | import com.oracle.bmc.auth.AuthenticationDetailsProvider; 9 | import com.oracle.bmc.auth.SimpleAuthenticationDetailsProvider; 10 | import com.oracle.oci.osb.util.Utils; 11 | import com.oracle.oci.osb.util.Constants; 12 | 13 | import java.io.FileInputStream; 14 | import java.io.FileNotFoundException; 15 | 16 | /** 17 | * SystemPropsAuthProvider constructs the {@code AuthenticationDetailsProvider} 18 | * by gathering the required details from the system properties. 19 | */ 20 | public class SystemPropsAuthProvider implements AuthProvider { 21 | 22 | private final AuthenticationDetailsProvider authDetails; 23 | 24 | public SystemPropsAuthProvider() { 25 | SimpleAuthenticationDetailsProvider.SimpleAuthenticationDetailsProviderBuilder authBuilder = 26 | SimpleAuthenticationDetailsProvider.builder().fingerprint(System.getProperty(Constants.FINGERPRINT)) 27 | .tenantId(System.getProperty(Constants.TENANCY)) 28 | .userId(System.getProperty(Constants.USER)) 29 | .privateKeySupplier(() -> { 30 | try { 31 | return new FileInputStream(System.getProperty(Constants.PRIVATEKEY)); 32 | } catch (FileNotFoundException e) { 33 | throw new RuntimeException(e); 34 | } 35 | }); 36 | 37 | String passphrase = System.getProperty(Constants.PASSPHRASE); 38 | if (!Utils.isNullOrEmptyString(passphrase)) { 39 | authBuilder.passphraseCharacters(passphrase.toCharArray()); 40 | } 41 | authDetails = authBuilder.build(); 42 | } 43 | 44 | @Override 45 | public AuthenticationDetailsProvider getAuthProvider() { 46 | return authDetails; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/rest/Health.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.rest; 7 | 8 | import com.oracle.oci.osb.store.DataStoreFactory; 9 | 10 | import javax.inject.Singleton; 11 | import javax.ws.rs.GET; 12 | import javax.ws.rs.Path; 13 | import javax.ws.rs.core.Response; 14 | 15 | @Path("/health") 16 | @Singleton 17 | public class Health { 18 | @GET 19 | public Response get() { 20 | boolean isDataStoreHealthy = DataStoreFactory.getDataStore().isStoreHealthy(); 21 | if (!isDataStoreHealthy) { 22 | return Response.status(Response.Status.SERVICE_UNAVAILABLE.getStatusCode()).build(); 23 | } 24 | return Response.ok().build(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/rest/MetricsResponseFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.rest; 7 | 8 | import com.oracle.oci.osb.mbean.BrokerMetrics; 9 | 10 | import javax.ws.rs.container.ContainerRequestContext; 11 | import javax.ws.rs.container.ContainerResponseContext; 12 | import javax.ws.rs.container.ContainerResponseFilter; 13 | import javax.ws.rs.ext.Provider; 14 | import java.io.IOException; 15 | 16 | /** 17 | * {@link ContainerResponseFilter} to update the broker metrics. 18 | */ 19 | @Provider 20 | @OSBAPI 21 | public class MetricsResponseFilter implements ContainerResponseFilter { 22 | 23 | /** 24 | * The {@link com.oracle.oci.osb.mbean.BrokerMetricsMBean} to update. 25 | */ 26 | private final BrokerMetrics brokerMBean; 27 | 28 | public MetricsResponseFilter(BrokerMetrics brokerMBean) { 29 | this.brokerMBean = brokerMBean; 30 | } 31 | 32 | @Override 33 | public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) 34 | throws IOException { 35 | String uri = requestContext.getUriInfo().getPath(); 36 | switch (requestContext.getMethod().toLowerCase()) { 37 | case "put": 38 | addToPutMetrics(uri, responseContext); 39 | break; 40 | case "delete": 41 | addToDeleteMetrics(uri, responseContext); 42 | break; 43 | case "patch": 44 | addToPatchMetrics(uri, responseContext); 45 | break; 46 | case "get": 47 | addToGetMetrics(uri, responseContext); 48 | break; 49 | default: 50 | break; 51 | } 52 | // increment total request count 53 | brokerMBean.incrementTotalRequestCount(); 54 | int responseCode = responseContext.getStatus(); 55 | if (isFailed(responseCode)) { 56 | brokerMBean.incrementFailedTotalRequestCount(); 57 | } 58 | } 59 | 60 | private void addToGetMetrics(String uri, ContainerResponseContext responseContext) { 61 | int responseCode = responseContext.getStatus(); 62 | // there are types of get operations, last_operation for for binding/instances 63 | // and also get operation for bindings/instances. Increment the correct metrics 64 | // based on the request uri 65 | if (uri.contains("last_operation")) { 66 | if (uri.contains("service_bindings")) { 67 | brokerMBean.incrementServiceBindingLastOperationCount(); 68 | if (isFailed(responseCode)) { 69 | brokerMBean.incrementFailedServiceBindingLastOperationCount(); 70 | } 71 | } else if (uri.contains("service_instances")){ 72 | brokerMBean.incrementServiceLastOperationCount(); 73 | if (isFailed(responseCode)) { 74 | brokerMBean.incrementFailedServiceLastOperationCount(); 75 | } 76 | } 77 | } else { 78 | if (uri.contains("service_bindings")) { 79 | brokerMBean.incrementServiceBindingGetOperationCount(); 80 | if (isFailed(responseCode)) { 81 | brokerMBean.incrementFailedServiceBindinGetOperationCount(); 82 | } 83 | } else if (uri.contains("service_instances")){ 84 | brokerMBean.incrementInstanceGetOperationCount(); 85 | if (isFailed(responseCode)) { 86 | brokerMBean.incrementFailedInstanceGetOperationCount(); 87 | } 88 | } 89 | } 90 | } 91 | 92 | private void addToPutMetrics(String uri, ContainerResponseContext responseContext) { 93 | // there are 2 types of put operation, create an instance or create a binding 94 | int responseCode = responseContext.getStatus(); 95 | if (uri.contains("service_bindings")) { 96 | brokerMBean.incrementServiceBindingRequestCount(); 97 | if (isFailed(responseCode)) { 98 | brokerMBean.incrementFailedServiceBindingRequestCount(); 99 | } 100 | } else if (uri.contains("service_instances")) { 101 | brokerMBean.incrementProvisionRequestCount(); 102 | if (isFailed(responseCode)) { 103 | brokerMBean.incrementFailedProvisionRequestCount(); 104 | } 105 | 106 | } 107 | } 108 | 109 | private void addToDeleteMetrics(String uri, ContainerResponseContext responseContext) { 110 | // 2 types of delete operation, delete instance or delete binding 111 | int responseCode = responseContext.getStatus(); 112 | if (uri.contains("service_bindings")) { 113 | brokerMBean.incrementUnBindRequestCount(); 114 | if (isFailed(responseCode)) { 115 | brokerMBean.incrementFailedUnBindRequestCount(); 116 | } 117 | } else if (uri.contains("service_instances")) { 118 | brokerMBean.incrementDeprovisionRequestCount(); 119 | if (isFailed(responseCode)) { 120 | brokerMBean.incrementFailedDeprovisionRequestCount(); 121 | } 122 | 123 | } 124 | } 125 | 126 | private void addToPatchMetrics(String uri, ContainerResponseContext responseContext) { 127 | // only one type of patch operation, which is to update an instance 128 | int responseCode = responseContext.getStatus(); 129 | brokerMBean.incrementUpdateRequestCount(); 130 | if (isFailed(responseCode)) { 131 | brokerMBean.incrementFailedUpdateRequestCount(); 132 | } 133 | } 134 | 135 | 136 | private boolean isFailed(int responseCode) { 137 | return responseCode < 200 || responseCode >= 300; 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/rest/OCIOSBApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.rest; 7 | 8 | import com.oracle.oci.osb.api.OSBV2API; 9 | import com.oracle.oci.osb.jackson.OSBObjectMapperProvider; 10 | import com.oracle.oci.osb.mbean.BrokerMetrics; 11 | import com.oracle.oci.osb.util.Constants; 12 | import org.glassfish.jersey.jackson.JacksonFeature; 13 | import org.glassfish.jersey.logging.LoggingFeature; 14 | import org.glassfish.jersey.server.ResourceConfig; 15 | 16 | import javax.management.MBeanServer; 17 | import javax.management.ObjectName; 18 | import java.lang.management.ManagementFactory; 19 | 20 | public class OCIOSBApplication extends ResourceConfig { 21 | public OCIOSBApplication() { 22 | super(OSBV2API.class, Health.class, OSBObjectMapperProvider.class, JacksonFeature.class, LoggingFeature.class); 23 | BrokerMetrics brokerMBean = new BrokerMetrics(); 24 | registerBrokerMBean(brokerMBean); 25 | register(new OCIOSBApplicationBinder()); 26 | register(new RequestValidationFilter()); 27 | register(new MetricsResponseFilter(brokerMBean)); 28 | } 29 | 30 | 31 | private void registerBrokerMBean(BrokerMetrics brokerMBean) { 32 | try { 33 | String objectName = Constants.METRICS_MBEAN_OBJ_NAME; 34 | MBeanServer server = ManagementFactory.getPlatformMBeanServer(); 35 | ObjectName mbeanName = new ObjectName(objectName); 36 | server.registerMBean(brokerMBean, mbeanName); 37 | } catch (Exception e) { 38 | throw new RuntimeException(e); 39 | } 40 | } 41 | 42 | /** 43 | * Stop the application, this includes any cleanup activities. 44 | */ 45 | public void stop() { 46 | try { 47 | ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(Constants.METRICS_MBEAN_OBJ_NAME)); 48 | } catch (Exception e) { 49 | throw new RuntimeException(e); 50 | } 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/rest/OCIOSBApplicationBinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.rest; 7 | 8 | import com.oracle.oci.osb.ociclient.AuthProvider; 9 | import com.oracle.oci.osb.ociclient.SystemPropsAuthProvider; 10 | import com.oracle.oci.osb.store.DataStore; 11 | import com.oracle.oci.osb.store.MemoryStore; 12 | import org.glassfish.hk2.utilities.binding.AbstractBinder; 13 | 14 | import javax.inject.Singleton; 15 | 16 | public class OCIOSBApplicationBinder extends AbstractBinder { 17 | @Override 18 | protected void configure() { 19 | bind(SystemPropsAuthProvider.class).to(AuthProvider.class); 20 | bind(MemoryStore.class).to(DataStore.class).in(Singleton.class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/rest/OSBAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.rest; 7 | 8 | import javax.ws.rs.NameBinding; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | 12 | /** 13 | * The {@link NameBinding} that needs to be applied to filters interceptors 14 | * or resource classes which are related to OSB API related calls. Any no OSB API 15 | * related applications or filters should not use this. 16 | */ 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @NameBinding 19 | public @interface OSBAPI 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/rest/RequestValidationFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.rest; 7 | 8 | import com.fasterxml.jackson.databind.ObjectReader; 9 | import com.oracle.oci.osb.model.Identity; 10 | import com.oracle.oci.osb.util.Constants; 11 | import com.oracle.oci.osb.util.Errors; 12 | import com.oracle.oci.osb.util.OriginatingIdentity; 13 | 14 | import javax.ws.rs.container.ContainerRequestContext; 15 | import javax.ws.rs.container.ContainerRequestFilter; 16 | import javax.ws.rs.ext.Provider; 17 | import java.io.IOException; 18 | import java.nio.charset.StandardCharsets; 19 | import java.util.Base64; 20 | import java.util.logging.Logger; 21 | 22 | import static com.oracle.oci.osb.util.RequestUtil.abortWithError; 23 | import static com.oracle.oci.osb.util.Utils.getLogger; 24 | import static com.oracle.oci.osb.util.Utils.getReader; 25 | 26 | 27 | /** 28 | * RequestValidationFilter is the global request validation filter. 29 | */ 30 | @Provider 31 | @OSBAPI 32 | public class RequestValidationFilter implements ContainerRequestFilter { 33 | private static final Logger LOGGER = getLogger(ContainerRequestContext.class); 34 | 35 | @Override 36 | public void filter(ContainerRequestContext ctx) throws IOException { 37 | try { 38 | validAPIVersion(ctx); 39 | setOriginatingEntity(ctx); 40 | } catch (RuntimeException e) { 41 | LOGGER.finest(e.getMessage()); 42 | } 43 | } 44 | 45 | private void validAPIVersion(ContainerRequestContext ctx) { 46 | String version = ctx.getHeaderString(Constants.BROKER_API_VERSION_HEADER); 47 | if (version != null) { 48 | String[] tks = version.split("\\."); 49 | if (tks.length > 1) { 50 | try { 51 | int majorVer = Integer.parseInt(tks[0]); 52 | int minorVer = Integer.parseInt(tks[1]); 53 | 54 | if (majorVer != Constants.BROKER_API_VERSION_MAJOR || minorVer > Constants 55 | .BROKER_API_VERSION_MINOR) { 56 | abortWithError(ctx, Errors.brokerAPIVersionUnSupported(), 57 | "Broker API Version " + version + " not supported. Current Broker Version: " + 58 | Constants.CURRENT_API_VERSION); 59 | } 60 | LOGGER.finest("Global Request validation successful."); 61 | return; 62 | } catch (NumberFormatException x) { 63 | //Ignore as error will be thrown further down. 64 | } 65 | } 66 | LOGGER.fine("Invalid value for Broker API version: " + version); 67 | abortWithError(ctx, Errors.brokerAPIVersionHeaderInvalid(), 68 | "Invalid value for Broker API version: " + version); 69 | } else { 70 | LOGGER.fine("Broker API Version header missing in request"); 71 | abortWithError(ctx, Errors.brokerAPIVersionHeaderMissing(), 72 | "Broker API Version header missing in request"); 73 | } 74 | } 75 | 76 | private void setOriginatingEntity(ContainerRequestContext ctx) { 77 | //check if path is excluded 78 | if (isExcludedPath(ctx.getUriInfo().getPath())) { 79 | return; 80 | } 81 | String originatingIdentity = ctx.getHeaderString(Constants.IDENTITY_HEADER); 82 | if (originatingIdentity == null) { 83 | LOGGER.fine("Broker Originating Identity header missing in request"); 84 | abortWithError(ctx, Errors.brokerOriginatingIdentityHeaderMissing(), 85 | "Broker Originating Identity header missing in request"); 86 | } 87 | Identity identity = parseIdentity(originatingIdentity); 88 | if (identity == null) { 89 | LOGGER.fine("Invalid value for header Broker Originating Identity: " + originatingIdentity); 90 | abortWithError(ctx, Errors.brokerOriginatingIdentityHeaderInvalid(), 91 | "Invalid value for Broker Originating Identity: " + originatingIdentity); 92 | } 93 | //Set the identity in thread. 94 | OriginatingIdentity.setIdentity(identity); 95 | } 96 | 97 | private boolean isExcludedPath(String path) { 98 | return (path != null && (path.endsWith("/catalog") || path.endsWith("/last_operation"))) ? true : false; 99 | } 100 | 101 | private static Identity parseIdentity(String identityHeader) { 102 | if (identityHeader != null && !identityHeader.isEmpty() 103 | && identityHeader.startsWith(Constants.PLATFORM_KUBERNETES)) { 104 | try { 105 | String base64 = identityHeader.replaceFirst(Constants.PLATFORM_KUBERNETES, ""); 106 | byte[] bytes = Base64.getDecoder().decode(base64.trim()); 107 | String json = new String(bytes, StandardCharsets.UTF_8); 108 | LOGGER.finest("Originating Identity json : " + json); 109 | ObjectReader reader = getReader(Identity.class); 110 | return reader.readValue(json); 111 | } catch (Exception e) { 112 | LOGGER.finest(e.getMessage()); 113 | } 114 | } 115 | return null; 116 | } 117 | } -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/store/BindingData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.store; 7 | 8 | import java.util.HashMap; 9 | 10 | /** 11 | * BindingData class holds the Binding related metedata for all Services. 12 | */ 13 | public class BindingData { 14 | 15 | private String instanceId; 16 | 17 | private String serviceId; 18 | 19 | private String planId; 20 | 21 | private String bindingId; 22 | 23 | // Used for storing service specific attributes. 24 | private HashMap metadata = new HashMap<>(); 25 | 26 | 27 | public String getInstanceId() { 28 | return instanceId; 29 | } 30 | 31 | public void setInstanceId(String instanceId) { 32 | this.instanceId = instanceId; 33 | } 34 | 35 | public String getServiceId() { 36 | return serviceId; 37 | } 38 | 39 | public void setServiceId(String serviceId) { 40 | this.serviceId = serviceId; 41 | } 42 | 43 | public String getPlanId() { 44 | return planId; 45 | } 46 | 47 | public void setPlanId(String planId) { 48 | this.planId = planId; 49 | } 50 | 51 | public String getBindingId() { 52 | return bindingId; 53 | } 54 | 55 | public void setBindingId(String bindingId) { 56 | this.bindingId = bindingId; 57 | } 58 | 59 | /** 60 | * Add service specific metadata 61 | * 62 | * @param key 63 | * @param value 64 | */ 65 | public void putMetadata(String key, String value) { 66 | metadata.put(key, value); 67 | } 68 | 69 | /** 70 | * Fetch a metadata value. 71 | * 72 | * @param key 73 | * @return metadata value. 74 | */ 75 | public String getMetadata(String key) { 76 | return metadata.get(key); 77 | } 78 | 79 | /** 80 | * Remove a metadata value. 81 | * 82 | * @param key 83 | * @return removed metadata value. 84 | */ 85 | public String removeMetadata(String key) { 86 | return metadata.remove(key); 87 | } 88 | 89 | public HashMap getMetadata() { 90 | return metadata; 91 | } 92 | 93 | public void setMetadata(HashMap metadata) { 94 | this.metadata = metadata; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/store/DataStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.store; 7 | 8 | /** 9 | * DataStore provides interface for the Services to store and retreive 10 | * service and binding related metadata. 11 | */ 12 | public interface DataStore { 13 | 14 | /** 15 | * Store service related metadata for an Service instance. 16 | * 17 | * @param instanceId unique id of the service instance. 18 | * @param svcData service metadata 19 | */ 20 | void storeServiceData(String instanceId, ServiceData svcData); 21 | 22 | /** 23 | * Fetch service metadata for an Service Instance. 24 | * 25 | * @param instanceId unique id of the service instance. 26 | * @return service metadata 27 | */ 28 | ServiceData getServiceData(String instanceId); 29 | 30 | /** 31 | * Store binding related metadata for an Service instance. 32 | * 33 | * @param bindingId unique binding id . 34 | * @param bindingData binding metadata. 35 | */ 36 | void storeBinding(String bindingId, BindingData bindingData); 37 | 38 | /** 39 | * Fetch binding metadata for an Service Instance. 40 | * 41 | * @param bindingId unique binding id. 42 | * @return bindingData 43 | */ 44 | BindingData getBindingData(String bindingId); 45 | 46 | /** 47 | * Remove service metadata related to an Service Instance. 48 | * 49 | * @param instanceId unique id of the service instance. 50 | */ 51 | void removeServiceData(String instanceId); 52 | 53 | /** 54 | * Remove binding metadata related to an Service Instance. 55 | * 56 | * @param bindingId 57 | */ 58 | void removeBindingData(String bindingId); 59 | 60 | /** 61 | * Checks if the store is healthy. 62 | * 63 | * @return true if the store is healthy, false otherwise 64 | */ 65 | boolean isStoreHealthy(); 66 | } 67 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/store/DataStoreFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.store; 7 | 8 | import com.oracle.oci.osb.util.Constants; 9 | import com.oracle.oci.osb.util.Errors; 10 | 11 | public class DataStoreFactory { 12 | 13 | private static DataStore dataStore = createDataStore(); 14 | 15 | 16 | /** 17 | * Returns the DataStore instance. 18 | * 19 | * @return DataStore 20 | */ 21 | public static DataStore getDataStore() { 22 | return dataStore; 23 | } 24 | 25 | /** 26 | * Creates a new instance of DataStore. 27 | * 28 | * @return DataStore 29 | */ 30 | public static DataStore createDataStore() { 31 | String storeType = System.getProperty(Constants.STORE_TYPE, Constants.OBJECT_STORE_TYPE); 32 | switch (storeType) { 33 | case Constants.MEMORY_TYPE: 34 | return new MemoryStore(); 35 | case Constants.OBJECT_STORE_TYPE: 36 | return new ObjectStorageStore(); 37 | case Constants.ETCD_TYPE: 38 | return new EtcdStore(); 39 | default: 40 | throw Errors.invalidStoreTypeError(); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/store/MemoryStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.store; 7 | 8 | import java.util.HashMap; 9 | 10 | /** 11 | * MemoryStore is Memory backed implementation of the Datastore. The data is 12 | * not persisted anywhere and kept only in the memory. 13 | */ 14 | public class MemoryStore implements DataStore { 15 | 16 | private final HashMap store = new HashMap<>(); 17 | 18 | private final HashMap svcBindingStore = new HashMap<>(); 19 | 20 | @Override 21 | public void storeServiceData(String instanceId, ServiceData svcData) { 22 | store.put(instanceId, svcData); 23 | } 24 | 25 | @Override 26 | public ServiceData getServiceData(String instanceId) { 27 | return store.get(instanceId); 28 | } 29 | 30 | @Override 31 | public void storeBinding(String bindingId, BindingData bindingData) { 32 | svcBindingStore.put(bindingId, bindingData); 33 | } 34 | 35 | @Override 36 | public BindingData getBindingData(String bindingId) { 37 | return svcBindingStore.get(bindingId); 38 | } 39 | 40 | @Override 41 | public void removeServiceData(String instanceId) { 42 | store.remove(instanceId); 43 | } 44 | 45 | @Override 46 | public void removeBindingData(String instanceId) { 47 | svcBindingStore.remove(instanceId); 48 | } 49 | 50 | @Override 51 | public boolean isStoreHealthy() { 52 | return true; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/store/ServiceData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.store; 7 | 8 | import java.util.HashMap; 9 | 10 | /** 11 | * ServiceData class holds the Binding related metedata for all Services. 12 | */ 13 | public class ServiceData { 14 | 15 | private String instanceId; 16 | 17 | private String serviceId; 18 | 19 | private String planId; 20 | 21 | private String ocid; 22 | 23 | private String compartmentId; 24 | 25 | private Boolean provisioning = Boolean.TRUE; 26 | 27 | // Used for storing service specific attributes. 28 | private HashMap metadata = new HashMap<>(); 29 | 30 | public String getInstanceId() { 31 | return instanceId; 32 | } 33 | 34 | public void setInstanceId(String instanceId) { 35 | this.instanceId = instanceId; 36 | } 37 | 38 | public String getServiceId() { 39 | return serviceId; 40 | } 41 | 42 | public void setServiceId(String serviceId) { 43 | this.serviceId = serviceId; 44 | } 45 | 46 | public String getPlanId() { 47 | return planId; 48 | } 49 | 50 | public void setPlanId(String planId) { 51 | this.planId = planId; 52 | } 53 | 54 | public String getOcid() { 55 | return ocid; 56 | } 57 | 58 | public void setOcid(String ocid) { 59 | this.ocid = ocid; 60 | } 61 | 62 | public String getCompartmentId() { 63 | return compartmentId; 64 | } 65 | 66 | public void setCompartmentId(String compartmentId) { 67 | this.compartmentId = compartmentId; 68 | } 69 | 70 | public Boolean getProvisioning() { 71 | return provisioning; 72 | } 73 | 74 | public void setProvisioning(Boolean provisioning) { 75 | this.provisioning = provisioning; 76 | } 77 | 78 | /** 79 | * Add service specific metadata 80 | * 81 | * @param key 82 | * @param value 83 | */ 84 | public void putMetadata(String key, String value) { 85 | metadata.put(key, value); 86 | } 87 | 88 | /** 89 | * Fetch a metadata value. 90 | * 91 | * @param key 92 | * @return metadata value. 93 | */ 94 | public String getMetadata(String key) { 95 | return metadata.get(key); 96 | } 97 | 98 | /** 99 | * Remove a metadata. 100 | * 101 | * @param key 102 | * @return removed metadata value. 103 | */ 104 | public String removeMetadata(String key) { 105 | return metadata.remove(key); 106 | } 107 | 108 | @Deprecated 109 | public HashMap getMetadata() { 110 | return metadata; 111 | } 112 | 113 | @Deprecated 114 | public void setMetadata(HashMap metadata) { 115 | this.metadata = metadata; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/util/BrokerHttpException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.util; 7 | 8 | import javax.ws.rs.WebApplicationException; 9 | 10 | public class BrokerHttpException extends WebApplicationException { 11 | 12 | private final String message; 13 | 14 | private final String errorCode; 15 | 16 | /** 17 | * Constructor for the HTTPException 18 | * 19 | * @param statusCode {@code int} for the HTTP status code 20 | **/ 21 | public BrokerHttpException(int statusCode, String message, String errorCode) { 22 | super(statusCode); 23 | this.message = message; 24 | this.errorCode = errorCode; 25 | } 26 | 27 | @Override 28 | public String getMessage() { 29 | return message; 30 | } 31 | 32 | public String getErrorCode() { 33 | return errorCode; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/util/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.util; 7 | 8 | import java.util.Arrays; 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | public class Constants { 13 | public static final String PROVISION_OPERATION = "provision"; 14 | public static final String DELETE_OPERATION = "delete"; 15 | public static final String UPDATE_OPERATION = "update"; 16 | public static final String FREE_FORM_TAGS = "freeFormTags"; 17 | public static final String DEFINED_TAGS = "definedTags"; 18 | public static final String METADATA = "metadata"; 19 | public static final String OSB_INSTANCE_ID_LABEL = "OCIOSBServiceInstanceId"; 20 | public static final String COMPARTMENT_ID = "compartmentId"; 21 | public static final String DB_WORKLOAD_TYPE = "workloadType"; 22 | public static final String REGION_ID = "regionId"; 23 | public static final String NAME = "name"; 24 | public static final String FINGERPRINT = "fingerprint"; 25 | public static final String USER = "user"; 26 | public static final String TENANCY = "tenancy"; 27 | public static final String PRIVATEKEY = "privatekey"; 28 | public static final String PASSPHRASE = "passphrase"; 29 | public static final String CHARSET_UTF8 = "UTF-8"; 30 | public static final String TLS_ENABLED = "tlsEnabled"; 31 | public static final String KEY_STORE = "keyStore"; 32 | public static final String KEY_STORE_PASSWORD = "keyStorePassword"; 33 | public static final String KEY_STORE_TYPE = "pkcs12"; 34 | public static final String SSL_VERSION ="TLS"; 35 | public static final String KEY_MGR_TYPE = "SunX509"; 36 | public static final String ADW_CATALOG_JSON = "adw-catalog.json"; 37 | public static final String ATP_CATALOG_JSON = "atp-catalog.json"; 38 | public static final String SVC_BROKER_PREFIX = "oci-osb/"; 39 | public static final String ETCD_SERVERS = "etcd.servers"; 40 | public static final String STORE_TYPE = "storeType"; 41 | public static final String OBJECT_STORE_TYPE = "objectStorage"; 42 | public static final String ETCD_TYPE = "etcd"; 43 | public static final String MEMORY_TYPE = "memory"; 44 | public static final String ETCD_CA_PATH = "CAPath"; 45 | public static final String CLIENT_CERT = "etcdClientCert"; 46 | public static final String CLIENT_KEY = "etcdClientKey"; 47 | public static final String ETCD_TLS_ENABLED = "etcdTlsEnabled"; 48 | public static final String SERVICE_TAG = "serviceTag."; 49 | public static final String CREATED_BY = "CreatedBy"; 50 | public static final String CREATED_ON_BEHALF = "CreatedOnBehalfOf"; 51 | public static final String OCI_OSB_BROKER = "OCIOpenServiceBroker"; 52 | public static final String KUBERNETES_BEARER_API_TOKEN_FILE = "k8sApiTokenFile"; 53 | public static final String KUBERNETES_SERVICE_HOST = "KUBERNETES_SERVICE_HOST"; 54 | public static final String KUBERNETES_SERVICE_PORT = "KUBERNETES_SERVICE_PORT"; 55 | public static final String NODE_NAME = "NODE_NAME"; 56 | public static final String NODE_API = "https://%s:%s/api/v1/nodes/%s"; 57 | public static final String AUTHORIZATION_HEADER = "Authorization"; 58 | public static final String AUTHORIZATION_BEARER = "Bearer"; 59 | public static final Object K8S_METADATA = "metadata"; 60 | public static final Object K8S_LABELS = "labels"; 61 | public static final Object K8S_DISPLAYNAME = "displayName"; 62 | public static final String OKE_PREFIX = "oke-"; 63 | public static final String CLUSTER_ID_TAG = "ClusterId"; 64 | public static final String BROKER_API_VERSION_HEADER = "X-Broker-API-Version"; 65 | public static final String IDENTITY_HEADER = "X-Broker-API-Originating-Identity"; 66 | public static final String PLATFORM_KUBERNETES = "kubernetes "; 67 | public static final int BROKER_API_VERSION_MAJOR = 2; 68 | public static final int BROKER_API_VERSION_MINOR = 14; 69 | public static final String CURRENT_API_VERSION = Integer.toString(BROKER_API_VERSION_MAJOR) + "." + Integer 70 | .toString(BROKER_API_VERSION_MINOR); 71 | public static final String API_SERVER_CA_CERT = "apiServerCaCert"; 72 | public static final String METRICS_MBEAN_OBJ_NAME = "OCIOpenServiceBroker:type=BrokerMetrics"; 73 | public static final List TLS_PROTOOLS = Collections.unmodifiableList(Arrays.asList("TLSv1.2","TLSv1.2")); 74 | public static final String ENABLED_CIPHERS_RESOURCE = "enabledCiphers"; 75 | public static final String POD_NAME = "POD_NAME"; 76 | public static final String PROVISIONING = "provisioning"; 77 | public static final String OCID = "ocid"; 78 | public static final String AUTOSCALING_ENABLED = "autoScaling"; 79 | public static final String STREAM_POOL_ID = "streampoolId"; 80 | } 81 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/util/OriginatingIdentity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.util; 7 | 8 | import com.oracle.oci.osb.model.Identity; 9 | 10 | public class OriginatingIdentity { 11 | private static ThreadLocal threadLocal = new ThreadLocal(); 12 | 13 | public static void setIdentity(Identity identity) { 14 | threadLocal.set(identity); 15 | } 16 | 17 | public static String getUserName() { 18 | Identity identity = threadLocal.get(); 19 | if (identity != null) { 20 | return identity.getUsername(); 21 | } 22 | return null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/java/com/oracle/oci/osb/util/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | * Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | package com.oracle.oci.osb.util; 7 | 8 | import com.fasterxml.jackson.core.JsonProcessingException; 9 | import com.fasterxml.jackson.databind.ObjectMapper; 10 | import com.fasterxml.jackson.databind.ObjectReader; 11 | import com.fasterxml.jackson.databind.ObjectWriter; 12 | 13 | import java.io.ByteArrayOutputStream; 14 | import java.io.IOException; 15 | import java.io.InputStream; 16 | import java.util.logging.Level; 17 | import java.util.logging.Logger; 18 | 19 | /** 20 | * Utils class provides common utility methods. 21 | */ 22 | public class Utils { 23 | 24 | private static final Logger LOGGER = getLogger(Utils.class); 25 | private static final ObjectMapper mapper = new ObjectMapper(); 26 | private static String K8S_MASTER_URL = null; 27 | 28 | /** 29 | * Return Logger for a given class 30 | * @param loggerClass class that requires the logger. 31 | * @return instance of Logger. 32 | */ 33 | public static Logger getLogger(Class loggerClass){ 34 | return Logger.getLogger(loggerClass.getName()); 35 | } 36 | 37 | /** 38 | * Returns true if passed string is either empty or an empty string. 39 | * @param value string to be checked. 40 | * @return true if passed string is either empty or an empty string. 41 | */ 42 | public static boolean isNullOrEmptyString(String value){ 43 | if(value == null) { 44 | return true; 45 | } else { 46 | if("".equals(value.trim())) { 47 | return true; 48 | } 49 | } 50 | return false; 51 | } 52 | 53 | /** 54 | * Log debug message using the given logger. 55 | * @param logger logger to use log the message. 56 | * @param format log message format 57 | * @param level log level 58 | * @param logArgs log arguments 59 | */ 60 | public static void debugLog(Logger logger, String format, Level level, Object... logArgs){ 61 | if(logger.isLoggable(level)) { 62 | logger.log(level, String.format(format, logArgs)); 63 | } 64 | } 65 | 66 | /** 67 | * Read data from a Inputstream and return it as byte array. 68 | * @param is Inputstream from which data needs to be read. 69 | * @return byte array with the data read from Inputstream. 70 | * @throws IOException If error reading data from InputStream. 71 | */ 72 | public static byte[] toByteArray(InputStream is) throws IOException { 73 | ByteArrayOutputStream bos = new ByteArrayOutputStream(); 74 | if(is != null) { 75 | byte[] chunk = new byte[4096]; 76 | int read; 77 | while ((read = is.read(chunk, 0, chunk.length)) != -1) { 78 | bos.write(chunk, 0, read); 79 | } 80 | } 81 | return bos.toByteArray(); 82 | } 83 | 84 | /** 85 | * Returns the k8s master url by reading environment variables set by k8s. 86 | * 87 | * @return String k8s master url 88 | */ 89 | public static String getK8sMasterUrl() { 90 | if (K8S_MASTER_URL == null) { 91 | StringBuilder sb = new StringBuilder("https://"); 92 | String k8sHost = System.getenv("KUBERNETES_SERVICE_HOST"); 93 | String k8sPort = System.getenv("KUBERNETES_SERVICE_PORT"); 94 | sb.append(k8sHost).append(":").append(k8sPort); 95 | K8S_MASTER_URL = sb.toString(); 96 | } 97 | return K8S_MASTER_URL; 98 | } 99 | 100 | public static ObjectReader getReader(Class type) { 101 | return mapper.readerFor(type); 102 | } 103 | 104 | public static String serializeToJson(Object obj) { 105 | if (obj != null) { 106 | ObjectWriter writer = mapper.writerFor(obj.getClass()); 107 | try { 108 | return writer.writeValueAsString(obj); 109 | } catch (JsonProcessingException e) { 110 | LOGGER.finest(e.getMessage()); 111 | } 112 | } 113 | return null; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/resources/META-INF/services/com.oracle.oci.osb.adapter.ServiceAdapter: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 | # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. 4 | # 5 | 6 | com.oracle.oci.osb.adapters.objectstorage.ObjectStorageServiceAdapter 7 | com.oracle.oci.osb.adapters.adb.atp.ATPServiceAdapter 8 | com.oracle.oci.osb.adapters.adb.adw.ADWServiceAdapter 9 | com.oracle.oci.osb.adapters.oss.OSSServiceAdapter 10 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/resources/adw-catalog.json: -------------------------------------------------------------------------------- 1 | { 2 | "services": [ 3 | { 4 | "name": "adw-service", 5 | "id": "adw45fe6-fqxe-261g-k172-a7d1x277112d", 6 | "description": "Autonomous Data Warehouse Service", 7 | "tags": [ 8 | "adw" 9 | ], 10 | "bindable": true, 11 | "instances_retrievable": true, 12 | "bindings_retrievable": false, 13 | "asyncProvision": true, 14 | "asyncBinding": false, 15 | "asyncUpdate": true, 16 | "asyncDelete": true, 17 | "metadata": { 18 | "provider": { 19 | "name": "Oracle Cloud Infrastructure" 20 | }, 21 | "listing": { 22 | "imageUrl": "https://cloud.oracle.com/opc/paas/images/autonomous-database_w_72.png", 23 | "longDescription": "OCI Autonomous Data Warehouse service" 24 | }, 25 | "displayName": "Oracle Autonomous Data Warehouse Service" 26 | }, 27 | "plan_updateable": true, 28 | "plans": [ 29 | { 30 | "name": "standard", 31 | "id": "35678215-23xq-n373-fsls-cbf782ams8kp", 32 | "description": "OCI Autonomous Data Warehouse", 33 | "free": false, 34 | "schemas": { 35 | "service_instance": { 36 | "create": { 37 | "parameters": { 38 | "$schema": "http://json-schema.org/draft-04/schema#", 39 | "type": "Database", 40 | "properties": { 41 | "name": { 42 | "description": "Display Name or the ADW instance", 43 | "type": "string" 44 | }, 45 | "compartmentId": { 46 | "description": "The OCID of the compartment", 47 | "type": "string" 48 | }, 49 | "dbName": { 50 | "description": "Database Name", 51 | "type": "string" 52 | }, 53 | "cpuCount": { 54 | "description": "CPU Count", 55 | "type": "integer" 56 | }, 57 | "storageSizeTBs": { 58 | "description": "Storage Size In TBs", 59 | "type": "integer" 60 | }, 61 | "password": { 62 | "description": "Password for Admin User", 63 | "type": "string" 64 | }, 65 | "licenseType": { 66 | "description": "Use your existing database software licenses(BYOL) or Subscribe to new database software licenses and the Database Cloud Service", 67 | "type": "string", 68 | "pattern": "^(byol|new)$" 69 | }, 70 | "freeFormTags": { 71 | "description": "Free form tags", 72 | "type": "object", 73 | "additionalProperties": { 74 | "type": "string" 75 | } 76 | }, 77 | "definedTags":{ 78 | "description":"Defined Tags", 79 | "type":"object", 80 | "additionalProperties":{ 81 | "type":"object", 82 | "additionalProperties":{ 83 | "type":"string" 84 | } 85 | } 86 | }, 87 | "autoScaling": { 88 | "description": "AutoScaling Enabled", 89 | "type": "boolean" 90 | } 91 | } 92 | } 93 | }, 94 | "update": { 95 | "parameters": { 96 | "$schema": "http://json-schema.org/draft-04/schema#", 97 | "type": "object", 98 | "properties": { 99 | "name": { 100 | "description": "Display Name or the ADW instance", 101 | "type": "string" 102 | }, 103 | "password": { 104 | "description": "Password for Admin User", 105 | "type": "string" 106 | }, 107 | "cpuCount": { 108 | "description": "CPU Count", 109 | "type": "integer" 110 | }, 111 | "storageSizeTBs": { 112 | "description": "Storage Size In TBs", 113 | "type": "integer" 114 | }, 115 | "licenseType": { 116 | "description": "Use your existing database software licenses(BYOL) or Subscribe to new database software licenses and the Database Cloud Service", 117 | "type": "string", 118 | "pattern": "^(byol|new)$" 119 | }, 120 | "freeFormTags": { 121 | "description": "Free form tags", 122 | "type": "object", 123 | "additionalProperties": { 124 | "type": "string" 125 | } 126 | }, 127 | "definedTags":{ 128 | "description":"Defined Tags", 129 | "type":"object", 130 | "additionalProperties":{ 131 | "type":"object", 132 | "additionalProperties":{ 133 | "type":"string" 134 | } 135 | } 136 | }, 137 | "autoScaling": { 138 | "description": "AutoScaling Enabled", 139 | "type": "boolean" 140 | } 141 | } 142 | } 143 | } 144 | }, 145 | "service_binding": { 146 | "create": { 147 | "parameters": { 148 | "$schema": "http://json-schema.org/draft-04/schema#", 149 | "type": "object", 150 | "properties": { 151 | "walletPassword": { 152 | "description": "Password for the oracle wallet", 153 | "type": "string" 154 | } 155 | } 156 | } 157 | } 158 | } 159 | } 160 | } 161 | ] 162 | } 163 | ] 164 | } 165 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/resources/broker_oe.json: -------------------------------------------------------------------------------- 1 | { 2 | "Identity": [ 3 | { 4 | "username": "", 5 | "uid": "", 6 | "groups": [ 7 | "" 8 | ], 9 | "extra": { 10 | "contexttype": [ 11 | "" 12 | ], 13 | "tenancyid": [ 14 | "" 15 | ] 16 | } 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/resources/enabledCiphers: -------------------------------------------------------------------------------- 1 | TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 2 | TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 3 | TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 4 | TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 5 | TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 6 | TLS_AES_128_GCM_SHA256 7 | TLS_AES_256_GCM_SHA384 8 | TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 9 | TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 10 | TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 11 | TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 12 | TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 13 | TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 14 | TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 15 | TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 16 | TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 17 | TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 18 | TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 19 | TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 20 | TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 21 | TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 22 | TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 23 | TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 24 | TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 25 | TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 26 | TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 27 | -------------------------------------------------------------------------------- /oci-service-broker/src/main/resources/oss-catalog.json: -------------------------------------------------------------------------------- 1 | { 2 | "services": [ 3 | { 4 | "name": "oss-service", 5 | "id": "f28894d0-cf40-4cff-a19a-a6893f88dd67", 6 | "description": "Oracle Streaming Service", 7 | "tags": [ 8 | "stream", 9 | "topic" 10 | ], 11 | "bindable": true, 12 | "instances_retrievable": true, 13 | "bindings_retrievable": true, 14 | "asyncProvision": true, 15 | "asyncBinding": false, 16 | "asyncUpdate": false, 17 | "asyncDelete": true, 18 | "metadata": { 19 | "provider": { 20 | "name": "Oracle Cloud Infrastructure" 21 | }, 22 | "listing": { 23 | "imageUrl": "", 24 | "longDescription": "Provision and use an Oracle Streaming Service" 25 | }, 26 | "displayName": "Oracle Streaming Service" 27 | }, 28 | "plan_updateable": true, 29 | "plans": [ 30 | { 31 | "name": "standard", 32 | "id": "831ab2a8-97e4-4f34-a26b-2bfd61617b61", 33 | "description": "Oracle Streaming Service", 34 | "free": false, 35 | "schemas": { 36 | "service_instance": { 37 | "create": { 38 | "parameters": { 39 | "$schema": "http://json-schema.org/draft-04/schema#", 40 | "type": "object", 41 | "properties": { 42 | "name": { 43 | "description": "Name of the stream", 44 | "type": "string" 45 | }, 46 | "compartmentId": { 47 | "description": "The OCID of the compartment to which the stream should belong to", 48 | "type": "string" 49 | }, 50 | "partitions": { 51 | "description": "The number of partition in the stream", 52 | "type": "integer" 53 | }, 54 | "streampoolId": { 55 | "description": "The OCID of the stream pool that contains the stream", 56 | "type": "string" 57 | }, 58 | "freeFormTags": { 59 | "description": "Free form tags", 60 | "type": "object", 61 | "additionalProperties": { 62 | "type": "string" 63 | } 64 | }, 65 | "definedTags": { 66 | "description": "Defined Tags", 67 | "type": "object" 68 | } 69 | } 70 | } 71 | }, 72 | "update": { 73 | "parameters": { 74 | "$schema": "http://json-schema.org/draft-04/schema#", 75 | "type": "object", 76 | "properties": { 77 | "freeFormTags": { 78 | "description": "Free form tags", 79 | "type": "object", 80 | "additionalProperties": { 81 | "type": "string" 82 | } 83 | }, 84 | "definedTags": { 85 | "description": "Defined Tags", 86 | "type": "object" 87 | } 88 | } 89 | } 90 | } 91 | }, 92 | "service_binding": { 93 | "create": { 94 | "parameters": { 95 | "$schema": "http://json-schema.org/draft-04/schema#", 96 | "type": "object", 97 | "properties": { 98 | } 99 | } 100 | } 101 | } 102 | } 103 | } 104 | ] 105 | } 106 | ] 107 | } 108 | --------------------------------------------------------------------------------