onepassword
Module onepassword
API
ballerinax/onepassword Ballerina library
Overview
This is a generated connector from 1Password Connect API v1.3.0 OpenAPI specification.
1Password is the easiest way to store and use strong passwords. Log in to sites and fill forms securely with a single click.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a 1Password account
- Obtain tokens by following this guide
Quickstart
To use the 1Password connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the ballerinax/onepassword
module into the Ballerina project.
import ballerinax/onepassword;
Step 2: Create a new connector instance
Create a shippit:ClientConfig
with the API key
obtained, and initialize the connector with it.
onepassword:ClientConfig clientConfig = { auth : { token: <ACCESS_TOKEN> } }; onepassword:Client baseClient = check new Client(clientConfig);
Step 3: Invoke connector operation
-
Now you can use the operations available within the connector. Note that they are in the form of remote operations.
Following is an example on how to get API activity using the connector.
public function main() { onepassword:APIRequest[]|error response = baseClient->getApiActivity(); if (response is onepassword:APIRequest[]) { log:printInfo(response.toString()); } else { log:printError(response.message()); } }
-
Use
bal run
command to compile and run the Ballerina program.
Clients
onepassword: Client
This is a generated connector from 1Password Connect API v1.0 OpenAPI specification. 1Password is the easiest way to store and use strong passwords. Log in to sites and fill forms securely with a single click.
Constructor
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create a 1Password account and obtain OAuth tokens following this guide.
init (ConnectionConfig config, string serviceUrl)
- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "http://localhost:8080/v1" - URL of the target service
getApiActivity
function getApiActivity(int 'limit, int offset) returns APIRequest[]|error
Retrieve a list of API Requests that have been made.
Parameters
- 'limit int (default 50) - How many API Events should be retrieved in a single request.
- offset int (default 0) - How far into the collection of API Events should the response start
Return Type
- APIRequest[]|error - OK
getVaults
Get all Vaults
Parameters
- filter string? (default ()) - Filter the Vault collection based on Vault name using SCIM eq filter
getVaultById
Get Vault details and metadata
Parameters
- vaultUuid string - The UUID of the Vault to fetch Items from
getVaultItems
Get all items for inside a Vault
Parameters
- vaultUuid string - The UUID of the Vault to fetch Items from
- filter string? (default ()) - Filter the Item collection based on Item name using SCIM eq filter
createVaultItem
Create a new Item
Parameters
- vaultUuid string - The UUID of the Vault to create an Item in
- payload FullItem - Object containing the information to create the item.
getVaultItemById
Get the details of an Item
Parameters
- vaultUuid string - The UUID of the Vault to fetch Item from
- itemUuid string - The UUID of the Item to fetch
updateVaultItem
function updateVaultItem(string vaultUuid, string itemUuid, FullItem payload) returns FullItem|error
Update an Item
Parameters
- vaultUuid string - The UUID of the Item's Vault
- itemUuid string - The UUID of the Item to update
- payload FullItem - Object containing the information to update in item.
deleteVaultItem
Delete an Item
Parameters
- vaultUuid string - The UUID of the Vault the item is in
- itemUuid string - The UUID of the Item to update
patchVaultItem
Update a subset of Item attributes
Parameters
- vaultUuid string - The UUID of the Vault the item is in
- itemUuid string - The UUID of the Item to update
- payload Patch - Object containing the subset of information to patch the item.
Return Type
getItemFiles
Get all the files inside an Item
Parameters
- vaultUuid string - The UUID of the Vault to fetch Items from
- itemUuid string - The UUID of the Item to fetch files from
- inlineFiles boolean? (default ()) - Tells server to return the base64-encoded file contents in the response.
getDetailsOfFileById
function getDetailsOfFileById(string vaultUuid, string itemUuid, string fileUuid, boolean? inlineFiles) returns File|error
Get the details of a File
Parameters
- vaultUuid string - The UUID of the Vault to fetch Item from
- itemUuid string - The UUID of the Item to fetch File from
- fileUuid string - The UUID of the File to fetch
- inlineFiles boolean? (default ()) - Tells server to return the base64-encoded file contents in the response.
downloadFileByID
Get the content of a File
Parameters
- vaultUuid string - The UUID of the Vault the item is in
- itemUuid string - The UUID of the Item the File is in
- fileUuid string - UUID of the file to get content from
getHeartbeat
Ping the server for liveness
getPrometheusMetrics
Query server for exposed Prometheus metrics
Records
onepassword: APIRequest
Represents a request that was made to the API. Including what Token was used and what resource was accessed.
Fields
- requestId string? - The unique id used to identify a single request.
- timestamp string? - The time at which the request was processed by the server.
- action string? - The action taken. One of: "READ" "CREATE" "UPDATE" "DELETE"
- result string? - The result of the action. One of: "SUCCESS" "DENY"
- actor ApirequestActor? - An Actor object.
- 'resource ApirequestResource? - A Resource object.
onepassword: ApirequestActor
An Actor object.
Fields
- id string? - The UUID of the Connect server that made the request.
- account string? - The UUID of the 1Password account the request went to.
- jti string? - The UUID of the access token used to authenticate the request.
- userAgent string? - The user agent string specified in the request.
- requestIp string? - The IP address the request originated from.
onepassword: ApirequestResource
A Resource object.
Fields
- 'type string? - The resource requested. One of: "ITEM" "VAULT"
- vault ApirequestResourceVault? - An object containing an id property with the value of the UUID of the vault requested.
- item ApirequestResourceItem? - An object containing an id property with the value of the UUID of the item requested.
- itemVersion int? - The version of the item.
onepassword: ApirequestResourceItem
An object containing an id property with the value of the UUID of the item requested.
Fields
- id string? - Id property with the value of the UUID of the item requested.
onepassword: ApirequestResourceVault
An object containing an id property with the value of the UUID of the vault requested.
Fields
- id string? - Id property with the value of the UUID of the vault requested.
onepassword: ClientHttp1Settings
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
onepassword: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
onepassword: ErrorResponse
Fields
- status int? - HTTP Status Code
- message string? - A message detailing the error
onepassword: Field
A field object which contain fields to include with the item.
Fields
- id string - Field ID.
- section FieldSection? - An object containing the UUID of a section in the item.
- 'type string - Use type for all other fields. Possible values are: "STRING" "EMAIL" "CONCEALED" "URL" "OTP" "DATE"
- purpose string? - Some item types, Login and Password, have fields used for autofill. This property indicates that purpose and is required for some item types.
- label string? - The label for the field.
- value string? - The value of the field.
- generate boolean(default false) - If value is not present then a new value should be generated for this field
- recipe GeneratorRecipe? - The recipe is used in conjunction with the "generate" property to set the character set used to generate a new secure value
- entropy decimal? - For fields with a purpose of
PASSWORD
this is the entropy of the value
onepassword: FieldSection
An object containing the UUID of a section in the item.
Fields
- id string? - The UUID of a section in the item.
onepassword: File
Fields
- id string? - ID of the file
- name string? - Name of the file
- size int? - Size in bytes of the file
- content_path string? - Path of the Connect API that can be used to download the contents of this file.
- section FileSection? - For files that are in a section, this field describes the section.
- content string? - Base64-encoded contents of the file. Only set if size <= OP_MAX_INLINE_FILE_SIZE_KB kb and
inline_files
is set totrue
.
onepassword: FileSection
For files that are in a section, this field describes the section.
Fields
- id string? - The UUID of a section in the item.
onepassword: FullItem
Object containing the item information.
Fields
- Fields Included from *Item
- sections FullitemSections[]? - An array of Section objects of the sections to include with the item.
- fields Field[]? - An array of Field objects of the fields to include with the item.
- files File[]? - Information about files.
onepassword: FullitemSections
Fields
- id string? - A unique identifier for the section.
- label string? - The label for the section.
onepassword: GeneratorRecipe
The recipe is used in conjunction with the "generate" property to set the character set used to generate a new secure value
Fields
- length int? - Length of the generated value
- characterSets string[]? - An array containing of the kinds of characters to include. Optional. Possible values: "LETTERS" "DIGITS" "SYMBOLS"
onepassword: Item
Fields
- id string? - The UUID of the item.
- title string? - The title of the item.
- vault ItemVault - An object containing an id property whose value is the UUID of the vault the item is in.
- category string - The category of the item.
- urls ItemUrls[]? - Array of URL objects containing URLs for the item.
- favorite boolean(default false) - Whether the item is marked as a favorite.
- tags string[]? - An array of strings of the tags assigned to the item.
- 'version int? - The version of the item.
- state string? - The state of the item. One of: "ARCHIVED" "DELETED"
- createdAt string? - Date and time when the item was created.
- updatedAt string? - Date and time when the vault or its contents were last changed.
- lastEditedBy string? - UUID of the account that last changed the item.
onepassword: ItemUrls
Fields
- primary boolean? - Whether this is the primary URL for the item.
- href string - The address.
onepassword: ItemVault
An object containing an id property whose value is the UUID of the vault the item is in.
Fields
- id string - Id property whose value is the UUID of the vault the item is in.
onepassword: PatchInner
Fields
- op string - The kind of operation to perform. One of: add remove replace
- path string - An RFC6901 JSON Pointer pointing to the Item document, an Item Attribute, and Item Field by Field ID, or an Item Field Attribute
- value record {}? - The new value to apply at the path.
onepassword: ProxyConfig
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
onepassword: Vault
Fields
- id string? - The UUID of the vault.
- name string? - The name of the vault.
- description string? - The description for the vault.
- attributeVersion int? - The vault version
- contentVersion int? - The version of the vault contents
- items int? - Number of active items in the vault
- 'type string? - The type of vault. One of: "EVERYONE": The team Shared vault. "PERSONAL": The Private vault for the Connect server. "USER_CREATED": A vault created by a user.
- createdAt string? - Date and time when the vault was created.
- updatedAt string? - Date and time when the vault or its contents were last changed.
Import
import ballerinax/onepassword;
Metadata
Released date: over 1 year ago
Version: 1.5.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 1
Weekly downloads
Keywords
IT Operations/Security & Identity Tools
Cost/Paid
Contributors