{
  "openapi": "3.0.1",
  "info": {
    "title": "CCM User Context Service",
    "description": "Cloud Core Management Services: User Context Service  \nAPIs that support Access Token:\n  - /v1/currentContext \n\n{% admonition type=\"info\" name=\"\" %}\n  No whitelisting required.\n{% /admonition %}\n\n```plain {% title=\"ClientID\" %}\nccm-user-context-cfsservice.slbservice.com\n```  \n",
    "version": "1.0.0.0",
    "x-product-id": "CCM-User-Context-Service"
  },
  "security": [
    {
      "bearer": [],
      "appkey": []
    }
  ],
  "tags": [
    {
      "name": "user-context-service",
      "description": "Query user context information."
    }
  ],
  "paths": {
    "/v1/currentContext": {
      "get": {
        "tags": [
          "user-context-service"
        ],
        "summary": "Get the current context of the user.",
        "description": "- Retrieve the current context of the user.\n- The user is identified through their user-principal, as indicated by the email claim in the JWT token within the authorization header.\n- The API caller is authenticated via the service principal, as indicated by the azp (Authorized Party) claim in the JWT token within the authorization header.\n- If your application must be scoped to specific billing accounts, the client ID needs the `ccm.billingaccount.read`  (e.g., the controlPlaneAdmin role) permission to get the context of user. Please raise the request with the CSI team.\n- If user's context contains a data partition, then the client ID in the service principal must also possess the `ccm.datapartition.read`(e.g., the controlPlaneAdmin role) to access the context associated with the user.\n- The API enforces a request rate limit of 10 requests per minute per caller.\n",
        "operationId": "GetCurrentUserContext",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetContext"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [],
            "appkey": []
          }
        ]
      },
      "put": {
        "tags": [
          "user-context-service"
        ],
        "summary": "Update context for a given user",
        "description": "- Update the context of the user.\n- The user is identified through their user-principal, as indicated by the email claim in the JWT token within the authorization header.\n- The API caller is authenticated via the service principal, as indicated by the azp (Authorized Party) claim in the JWT token within the authorization header.\n- If your application must be scoped to specific billing accounts, the client ID needs the `ccm.billingaccount.read`  (e.g., the controlPlaneAdmin role) permission to update the context of user. Please raise the request with the CSI team.\n- If slbPartitionId value is provided while updating the user's context, then the client ID  must also possess the `ccm.datapartition.read`(e.g., the controlPlaneAdmin role).\n- The API enforces a request rate limit of 10 requests per minute per caller.\n",
        "operationId": "PutCurrentUserContext",
        "requestBody": {
          "description": "billingAccountId and contractId is the CRM ID for the BillingAccount and Contract. departmentId and datapartitionId is the CCM Auto-Generated ID for the department and DataPartition.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutContext"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimpleResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [],
            "appkey": []
          }
        ],
        "x-codegen-request-body-name": "body"
      }
    }
  },
  "components": {
    "schemas": {
      "Account": {
        "type": "object",
        "properties": {
          "billingAccountId": {
            "type": "string",
            "description": "ID of the billing account representing client's legal entity with which a contract was signed.",
            "example": "DIGITAL2020"
          },
          "name": {
            "type": "string"
          },
          "countryId": {
            "type": "string"
          }
        },
        "description": "billingAccountId is generated by the Business System for the BillingAccount."
      },
      "Department": {
        "type": "object",
        "properties": {
          "departmentId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "description": "departmentId is the CCM Auto-Generated ID for the Department."
      },
      "Contract": {
        "type": "object",
        "properties": {
          "contractId": {
            "type": "string"
          },
          "contractName": {
            "type": "string"
          },
          "countryId": {
            "type": "string"
          }
        },
        "description": "contractId is the generated by the Business System for the Contract."
      },
      "DataPartition": {
        "type": "object",
        "properties": {
          "dataPartitionId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slbPartitionId": {
            "type": "string"
          },
          "endpointId": {
            "type": "string"
          },
          "endpointName": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          }
        },
        "description": "dataPartitionId is the CCM Auto-Generated ID for the DataPartition."
      },
      "GetContext": {
        "type": "object",
        "properties": {
          "account": {
            "$ref": "#/components/schemas/Account"
          },
          "department": {
            "$ref": "#/components/schemas/Department"
          },
          "contract": {
            "$ref": "#/components/schemas/Contract"
          },
          "dataPartition": {
            "$ref": "#/components/schemas/DataPartition"
          }
        }
      },
      "PutContext": {
        "required": [
          "billingAccountId"
        ],
        "type": "object",
        "properties": {
          "billingAccountId": {
            "type": "string"
          },
          "departmentId": {
            "type": "string"
          },
          "contractId": {
            "type": "string"
          },
          "dataPartitionId": {
            "type": "string"
          },
          "slbPartitionId": {
            "type": "string"
          }
        }
      },
      "SimpleResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "User Token from SLB Authenticator Service"
      },
      "appkey": {
        "type": "apiKey",
        "description": "AppKey/ConsumerKey from your App on Developer Portal",
        "name": "appkey",
        "in": "header"
      }
    }
  },
  "x-google-endpoints": [
    {
      "name": "user-context-service"
    }
  ],
  "servers": [
    {
      "url": "https://api.delfi.slb.com/ccm/userContext",
      "description": "US"
    },
    {
      "url": "https://eu-api.delfi.slb.com/ccm/userContext",
      "description": "EU"
    }
  ]
}