# Provision

<a id="opengate_data.provision.devices.provision_device"></a>

## opengate\_data.provision.devices.provision\_device

ProvisionDeviceBuilder

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder"></a>

### ProvisionDeviceBuilder Objects

```python
class ProvisionDeviceBuilder()
```

Class Provision builder

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_organization_name"></a>

---
#### with\_organization\_name

```python
def with_organization_name(organization_name: str) -> "ProvisionDeviceBuilder"
```

Specify the organization for the device.

**Arguments**:

- `organization_name` _str_ - The organization for the device.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name')
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_identifier"></a>

---
#### with\_identifier

```python
def with_identifier(identifier: str) -> "ProvisionDeviceBuilder"
```

Specify the identifier for the device.

**Arguments**:

- `identifier` _str_ - The identifier for the device.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_identifier('identifier')
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_flattened"></a>

---
#### with\_flattened

```python
def with_flattened() -> "ProvisionDeviceBuilder"
```

Flatten the data

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_flattened()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_utc"></a>

---
#### with\_utc

```python
def with_utc() -> "ProvisionDeviceBuilder"
```

Set UTC flag

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_utc()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_provision_identifier"></a>

---
#### with\_provision\_identifier

```python
def with_provision_identifier(identifier: str) -> "ProvisionDeviceBuilder"
```

Set provision identifier

**Arguments**:

- `identifier` _str_ - The identifier to provision the device with.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_identifier("identifier")
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_provision_channel"></a>

---
#### with\_provision\_channel

```python
def with_provision_channel(channel: str) -> "ProvisionDeviceBuilder"
```

Set provision channel

**Arguments**:

- `channel` _str_ - The channel to provision the device into.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_channel("channel")
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_provision_service_group"></a>

---
#### with\_provision\_service\_group

```python
def with_provision_service_group(
        service_group: str) -> "ProvisionDeviceBuilder"
```

Set provision servicegroup

**Arguments**:

- `service_group` _str_ - The service group to provision the device into.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_service_group("emptyServiceGroup")
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.with_provision_organization"></a>

---
#### with\_provision\_organization

```python
def with_provision_organization(organization: str) -> "ProvisionDeviceBuilder"
```

Set provision organization

**Arguments**:

- `organization` _str_ - The organization to provision the device into.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_service_group("organization_name")
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.add_provision_datastream_value"></a>

---
#### add\_provision\_datastream\_value

```python
def add_provision_datastream_value(datastream: str,
                                   value: Any) -> "ProvisionDeviceBuilder"
```

Add a datastream value to the payload.

**Arguments**:

- `datastream` _str_ - The datastream identifier.
- `value` _Any_ - The value to be added. It Can be a primitive type or a complex object.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  location_value = {
- `"position"` - {
- `"coordinates"` - [
  -3.66131084,
  40.458442
  ]
  }
  }
  builder.add_provision_datastream_value("provision.device.location", location_value)
  builder.add_provision_datastream_value("provision.device.name", "Name")
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.from_dict"></a>

---
#### from\_dict

```python
def from_dict(dct: dict[str, Any]) -> "ProvisionDeviceBuilder"
```

Loads data as a python dictionary. If you want to enter the dictionary in flattened mode, you need to use with_flattened().

**Arguments**:

- `dct` _dict_ - The dictionary variable.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  # Mode flattened
  builder.with_flattened().from_dict(
  {"resourceType":{"_value":{"_current":{"value":"entity.device"}}},
  "provision.device.identifier":{"_value":{"_current":{"value":"identifier"}}},
  "provision.administration.organization":{"_value":{"_current":{"value":"organization"}}},
  "provision.administration.channel":{"_value":{"_current":{"value":"default_channel"}}},
  "provision.administration.serviceGroup":{"_value":{"_current":{"value":"emptyServiceGroup"}}},
  "provision.device.location":{"_value":{"_current":{"value":{"position":{"coordinates":[-3.66131084,40.458442]}}}}},
  
  # Mode without flattened
  builder.from_dict({
- `"resourceType"` - {
- `"_current"` - {
- `"value"` - "entity.device"
  }
  },
- `"provision"` - {
- `"administration"` - {
- `"channel"` - {
- `"_current"` - {
- `"value"` - "battery_channel"
  }
  },
- `"organization"` - {
- `"_current"` - {
- `"value"` - "battery_organization"
  }
  },
- `"serviceGroup"` - {
- `"_current"` - {
- `"value"` - "emptyServiceGroup"
  }
  }
  },
- `"device"` - {
- `"identifier"` - {
- `"_current"` - {
- `"value"` - "worker_battery_id"
  }
  }
  }
  }
  })
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.from_dataframe"></a>

---
#### from\_dataframe

```python
def from_dataframe(df: pd.DataFrame) -> "ProvisionDeviceBuilder"
```

Loads data as a pandas DataFrame.
Columns must be the names of the datastreams separated with '_' or '.'.

**Arguments**:

- `df` _pd.DataFrame_ - The DataFrame variable.
  

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  import pandas as pd
  data = {
- `'provision_administration_organization_current_value'` - ['base_organization','test_organization'],
- `'provision_device_location_current_value_position_type'` - ['Point','Other_Point'],
- `'provision_device_location_current_value_position_coordinates'` - [[-3.7028,40.41675],[-5.7028,47.41675]],
- `'provision_device_location_current_value_postal'` - ['28013','28050']
  }
  df = pd.DataFrame(df)
  builder.from_dataframe(df)
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.find_one"></a>

---
#### find\_one

```python
def find_one() -> "ProvisionDeviceBuilder"
```

Retrieve a single device.

This method sets up the ProvisionDeviceBuilder instance to retrieve a specific assey associated with the specified organization and identifier.

**Returns**:

- `ProvisionDeviceBuilder` - The instance of the ProvisionDeviceBuilder class itself, allowing for method chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name("organization_name").with_identifier("model_identifier").find_one()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.create"></a>

---
#### create

```python
def create() -> "ProvisionDeviceBuilder"
```

Initiates the creation process of a new device.

This method prepares the ProvisionDeviceBuilder instance to create a new device.

**Returns**:

- `ProvisionDeviceBuilder` - The instance of the ProvisionDeviceBuilder class itself, allowing for method chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name("organization_name")
  .with_provision_identifier("provision_identifier")
  .with_provision_organization("provision_organization")
  .with_provision_channel("provision_channel")
  .with_provision_service_group("provision_service_group")
  .add_provision_datastream_value("provision.device.name", "Name")
  .create()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.update"></a>

---
#### update

```python
def update() -> "ProvisionDeviceBuilder"
```

Update an existing device.

This method sets up the ProvisionDeviceBuilder instance to update a specific device associated with the specified organization and identifier.

You can update a device with a flattened format sending a PUT request using the URL above. You must replace {identifier} with the identifier of the device you want to update. Also, it is sent a boolean parameter, flattened, to allow sending a flattened JSON format

**Returns**:

- `ProvisionDeviceBuilder` - The instance of the ProvisionDeviceBuilder class itself, allowing for method chaining.
  

**Example**:

  dict_flatenned = {"resourceType":{"_value":{"_current":{"value":"entity.device"}}},
  "provision.device.identifier":{"_value":{"_current":{"value":"ManuEntityTests"}}},
  "provision.administration.organization":{"_value":{"_current":{"value":"orgnization_name"}}},
  "provision.administration.channel":{"_value":{"_current":{"value":"default_channel"}}},
  "provision.administration.serviceGroup":{"_value":{"_current":{"value":"emptyServiceGroup"}}},
  
  ~~~python
  builder.with_organization_name("organization_name").with_identifier("model_identifier").with_flattened().from_dict(dict_flatenned).update()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.delete"></a>

---
#### delete

```python
def delete() -> "ProvisionDeviceBuilder"
```

Delete an existing device.

This method sets up the ProvisionDeviceBuilder instance to delete a specific device associated with the specified organization and identifier.

**Returns**:

- `ProvisionDeviceBuilder` - The instance of the ProvisionDeviceBuilder class itself, allowing for method chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name').with_identifier("identifier").delete()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.build"></a>

---
#### build

```python
def build() -> "ProvisionDeviceBuilder"
```

Finalizes the construction of the device configuration.

This method prepares the builder to execute the collection by ensuring all necessary configurations are set and validates the overall integrity of the build. It should be called before executing the collection to ensure that the configuration is complete and valid.

The build process involves checking that mandatory fields such as the device identifier are set. It also ensures that method calls that are incompatible with each other (like `build` and `build_execute`) are not both used.

**Returns**:

- `ProvisionDeviceBuilder` - Returns itself to allow for method chaining, enabling further actions like `execute`.
  

**Raises**:

- `ValueError` - If required configurations are missing or if incompatible methods are used together.
  

**Example**:

  ~~~python
  builder.build()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.build_execute"></a>

---
#### build\_execute

```python
def build_execute()
```

Executes the data sets search immediately after building the configuration.

This method is a shortcut that combines building and executing in a single step.

**Returns**:

- `dict` - A dictionary containing the execution response which includes the status code and potentially other metadata about the execution.
  

**Raises**:

- `ValueError` - If `build` has already been called on this builder instance.
  

**Example**:

  ~~~python
  builder.build_execute()
  ~~~

<a id="opengate_data.provision.devices.provision_device.ProvisionDeviceBuilder.execute"></a>

---
#### execute

```python
def execute() -> str | dict[str, str | int]
```

Execute the configured device and return the response.

This method executes the operation that has been configured using the builder pattern. It ensures that the `build` method has been called and that it is the last method invoked before `execute`. Depending on the configured method (e.g., create, find, update, delete), it calls the appropriate internal execution method.

**Returns**:

- `requests.Response` - The response object from the executed request.
  

**Raises**:

- `Exception` - If the `build` method has not been called or if it is not the last method invoked before `execute`.
- `ValueError` - If the configured method is unsupported.
  

**Example**:

  ~~~python
  builder.execute()
  ~~~

<a id="opengate_data.provision.devices"></a>

## opengate\_data.provision.devices

<a id="opengate_data.provision.bulk.provision_bulk"></a>

## opengate\_data.provision.bulk.provision\_bulk

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder"></a>

### ProvisionBulkBuilder Objects

```python
class ProvisionBulkBuilder()
```

Provision Bulk Builder

Provisions many entities in a single request, which is the way to go when a
per-entity call would mean thousands of them. The payload can come from a
file — `from_json()`, `from_csv()`, `from_excel()` — or from memory, with
`from_dataframe()` or `from_dict()`.

`with_bulk_action()` chooses what to do with the rows — CREATE by default,
UPDATE, PATCH or DELETE — and `with_bulk_type()` what they are, ENTITIES by
default or TICKETS. Close the chain with `build()` and `execute()`, or with
`build_execute()`.

**Example**:

  ~~~python
  builder = client.new_provision_bulk_builder()
  builder.with_organization_name("organization").from_csv(
  "entities.csv"
  ).with_bulk_action("CREATE").build().execute()
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.with_organization_name"></a>

---
#### with\_organization\_name

```python
def with_organization_name(organization_name: str) -> "ProvisionBulkBuilder"
```

Specify the organization name.

**Arguments**:

- `organization_name` _str_ - The name of the organization name that we want to bulk data.
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name')
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.with_bulk_action"></a>

---
#### with\_bulk\_action

```python
def with_bulk_action(bulk_action: str) -> "ProvisionBulkBuilder"
```

Adds the bulk action to the constructor and validates the type.

**Arguments**:

- `bulk_action` _str_ - The bulk action. You can choose between these actions:
  - CREATE (default)
  - UPDATE
  - PATCH
  - DELETE
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Raises**:

- `ValueError` - If the bulk action isn't one of the mentioned above.
  

**Example**:

  ~~~python
  builder.with_bulk_action('bulk_action')
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.with_bulk_type"></a>

---
#### with\_bulk\_type

```python
def with_bulk_type(bulk_type: str) -> "ProvisionBulkBuilder"
```

Adds the bulk type to the constructor and validates the type.

**Arguments**:

- `bulk_type` _str_ - The bulk type. You can choose between these types:
  - ENTITIES (default)
  - TICKETS
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Raises**:

- `ValueError` - If the bulk type isn't one of the mentioned above.
  

**Example**:

  ~~~python
  builder.with_bulk_type('bulk_type')
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.from_json"></a>

---
#### from\_json

```python
def from_json(path: str) -> "ProvisionBulkBuilder"
```

Loads data as a json file.

**Arguments**:

- `path` _str_ - The path to the json file.
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Raises**:

- `FileNotFoundError` - If the path isn't correct or the file doesn't exist in the selected folder.
  

**Example**:

  ~~~python
  builder.from_json('path_to_json.json')
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.from_csv"></a>

---
#### from\_csv

```python
def from_csv(path: str) -> "ProvisionBulkBuilder"
```

Loads data as a csv file.

**Arguments**:

- `path` _str_ - The path to the csv file.
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Raises**:

- `FileNotFoundError` - If the path isn't correct or the file doesn't exist in the selected folder.
  

**Example**:

  ~~~python
  builder.from_csv('path_to_csv.csv')
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.from_excel"></a>

---
#### from\_excel

```python
def from_excel(path: str) -> "ProvisionBulkBuilder"
```

Loads data as an Excel file (supports xls and xlsx).

**Arguments**:

- `path` _str_ - The path to the Excel file.
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Raises**:

- `FileNotFoundError` - If the path isn't correct or the file doesn't exist in the selected folder.
  

**Example**:

  ~~~python
  builder.from_excel('path_to_excel.xls')
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.from_dataframe"></a>

---
#### from\_dataframe

```python
def from_dataframe(df: pd.DataFrame) -> "ProvisionBulkBuilder"
```

Loads data as a pandas DataFrame.
Columns must be the names of the datastreams separated with '_' or '.'.

**Arguments**:

- `df` _pd.DataFrame_ - The DataFrame variable.
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  import pandas as pd
  data = {
- `'provision_administration_organization_current_value'` - ['base_organization','test_organization'],
- `'provision_device_location_current_value_position_type'` - ['Point','Other_Point'],
- `'provision_device_location_current_value_position_coordinates'` - [[-3.7028,40.41675],[-5.7028,47.41675]],
- `'provision_device_location_current_value_postal'` - ['28013','28050']
  }
  df = pd.DataFrame(df)
  builder.from_dataframe(df)
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.from_dict"></a>

---
#### from\_dict

```python
def from_dict(dct: dict[str, Any]) -> "ProvisionBulkBuilder"
```

Loads data as a python dictionary (same structure as 'from_json').

**Arguments**:

- `dct` _dict_ - The dictionary variable.
  

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  >>> builder.from_dict({
  ...     "entities": [
  ...         {
  ...             "provision": {
  ...                 "administration": {
  ...                     "organization": {"_current": {"value": "my_org"}}
  ...                 },
  ...                 "asset": {
  ...                     "identifier": {"_current": {"value": "asset_123"}}
  ...                 }
  ...             }
  ...         }
  ...     ]
  ... })

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.build"></a>

---
#### build

```python
def build() -> "ProvisionBulkBuilder"
```

Finalizes the construction of the provision bulk configuration.

This method prepares the builder to execute the request by ensuring all necessary configurations are set and validates the overall integrity of the build. It should be called before executing the request to ensure that the configuration is complete and valid.

The build process involves checking that mandatory fields such as the organization name are set. It also ensures that method calls that are incompatible with each other (like `build` and `build_execute`) are not both used.

**Returns**:

- `ProvisionBulkBuilder` - Returns itself to allow for method chaining, enabling further actions like `execute`.
  

**Raises**:

- `ValueError` - If required configurations are missing or if incompatible methods are used together.
  

**Example**:

  ~~~python
  builder.build()
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.build_execute"></a>

---
#### build\_execute

```python
def build_execute(include_payload=False)
```

Executes the provision bulk immediately after building the configuration.

This method is a shortcut that combines building and executing in a single step. It should be used when you want to build and execute the configuration without modifying the builder state in between these operations.

It first validates the build configuration and then executes the request if the validation is successful.

**Arguments**:

- `include_payload` _bool_ - Determine if the payload should be included in the response.
  

**Returns**:

- `dict` - A dictionary containing the execution response which includes the status code and potentially other metadata about the execution.
  

**Raises**:

- `ValueError` - If `build` has already been called on this builder instance, indicating that `build_execute` is being incorrectly used after `build`.
- `Exception` - If there are issues during the execution process, including network or API errors.
  

**Example**:

  ~~~python
  response = builder.build_execute()
  ~~~

<a id="opengate_data.provision.bulk.provision_bulk.ProvisionBulkBuilder.execute"></a>

---
#### execute

```python
def execute(include_payload=False)
```

Executes the provision bulk based on the current configuration of the builder.

**Arguments**:

- `include_payload` _bool_ - Determine if the payload should be included in the response.
  

**Returns**:

- `Dict` - A dictionary containing the execution response which includes the status code and,
  optionally, the payload. If an error occurs, a string describing the error is returned.
  

**Raises**:

- `Exception` - If `build()` has not been called before `execute()`, or if it was not the last method invoked prior to `execute()`.
  

**Example**:

  ~~~python
  builder.build()
  response = builder.execute(True)
  ~~~

<a id="opengate_data.provision.bulk"></a>

## opengate\_data.provision.bulk

<a id="opengate_data.provision.processor"></a>

## opengate\_data.provision.processor

<a id="opengate_data.provision.processor.provision_processor"></a>

## opengate\_data.provision.processor.provision\_processor

ProvisionProcessorBuilder

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder"></a>

### ProvisionProcessorBuilder Objects

```python
class ProvisionProcessorBuilder()
```

Provision Processor Builder

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.with_organization_name"></a>

---
#### with\_organization\_name

```python
def with_organization_name(
        organization_name: str) -> "ProvisionProcessorBuilder"
```

Specify the organization name.

**Arguments**:

- `organization_name` _str_ - The name of the organization.
  

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name')
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.with_identifier"></a>

---
#### with\_identifier

```python
def with_identifier(
        provision_processor_id: str) -> "ProvisionProcessorBuilder"
```

Specify the identifier for the provision processor.

**Arguments**:

- `provision_processor_id` _str_ - The identifier for the pipeline.
  

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_identifier('identifier')
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.with_name"></a>

---
#### with\_name

```python
def with_name(provision_processor_name: str) -> "ProvisionProcessorBuilder"
```

Specify the name for the provision processor.

**Arguments**:

- `provision_processor_name` _str_ - The name for the provision processor.
  

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_name('name')
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.with_bulk_file"></a>

---
#### with\_bulk\_file

```python
def with_bulk_file(bulk_file: str) -> "ProvisionProcessorBuilder"
```

Specify the file for bulk processing.

**Arguments**:

- `bulk_file` _str_ - The path to the file to be uploaded for bulk processing.
  

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  bulk_file_path = os.path.join(os.path.dirname(__file__), 'file.xlsx')
  builder.with_bulk_file('bulk_file_path')
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.with_bulk_process_identitifer"></a>

---
#### with\_bulk\_process\_identitifer

```python
def with_bulk_process_identitifer(
        bulk_process_id: str) -> "ProvisionProcessorBuilder"
```

Specify the identifier for the bulk process identifier.

**Arguments**:

- `bulk_process_id` _str_ - The identifier for the bulk process.
  

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_bulk_process_identitifer('identifier')
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.bulk"></a>

---
#### bulk

```python
def bulk() -> "ProvisionProcessorBuilder"
```

Configure the builder for bulk provisioning.

This method sets the necessary headers and URL for performing a bulk provisioning operation.

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  bulk_file_path = os.path.join(os.path.dirname(__file__), 'file.xlsx')
  builder.with_organization_name('organization_name').with_identifier('identifier').with_bulk_file(bulk_file_path).bulk()
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.find_by_name"></a>

---
#### find\_by\_name

```python
def find_by_name() -> "ProvisionProcessorBuilder"
```

Configure the builder to find a provision processor by name.

This method sets the necessary headers and URL for finding a provision processor by its name.

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name').with_name('provision_processor_name').find_by_name()
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.bulk_status"></a>

---
#### bulk\_status

```python
def bulk_status() -> "ProvisionProcessorBuilder"
```

Configure the builder to check the status of a bulk process.

This method sets the necessary headers and URL for checking the status of a bulk process.

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name').with_bulk_process_identitifer('bulk_process_id').bulk_status()
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.bulk_details"></a>

---
#### bulk\_details

```python
def bulk_details() -> "ProvisionProcessorBuilder"
```

Configure the builder to get the details of a bulk process.

This method sets the necessary headers and URL for retrieving the details of a bulk process.

**Returns**:

- `ProvisionProcessorBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name').with_bulk_process_identitifer('bulk_process_id').bulk_details()
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.build"></a>

---
#### build

```python
def build() -> "ProvisionProcessorBuilder"
```

Finalizes the construction of the IoT collection configuration.

This method prepares the builder to execute the collection by ensuring all necessary configurations are set and validates the overall integrity of the build. It should be called before executing the collection to ensure that the configuration is complete and valid.

The build process involves checking that mandatory fields such as the device identifier are set. It also ensures that method calls that are incompatible with each other (like `build` and `build_execute`) are not both used.

**Returns**:

- `ProvisionProcessorBuilder` - Returns itself to allow for method chaining, enabling further actions like `execute`.
  

**Raises**:

- `ValueError` - If required configurations are missing or if incompatible methods are used together.
  

**Example**:

  ~~~python
  builder.build()
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.build_execute"></a>

---
#### build\_execute

```python
def build_execute()
```

Executes the data sets search immediately after building the configuration.

This method is a shortcut that combines building and executing in a single step.

**Returns**:

- `dict` - A dictionary containing the execution response which includes the status code and potentially other metadata about the execution.
  

**Raises**:

- `ValueError` - If `build` has already been called on this builder instance.
  

**Example**:

  ~~~python
  builder.build_execute()
  ~~~

<a id="opengate_data.provision.processor.provision_processor.ProvisionProcessorBuilder.execute"></a>

---
#### execute

```python
def execute() -> requests.Response
```

Execute the configured operation and return the response.

This method executes the operation that has been configured using the builder pattern. It ensures that the `build` method has been called and that it is the last method invoked before `execute`. Depending on the configured method (e.g., create, find, update, delete), it calls the appropriate internal execution method.

**Returns**:

- `requests.Response` - The response object from the executed request.
  

**Raises**:

- `Exception` - If the `build` method has not been called or if it is not the last method invoked before `execute`.
- `ValueError` - If the configured method is unsupported.
  

**Example**:

  ~~~python
  builder.build_execute()
  ~~~

<a id="opengate_data.provision.asset.provision_asset"></a>

## opengate\_data.provision.asset.provision\_asset

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder"></a>

### ProvisionAssetBuilder Objects

```python
class ProvisionAssetBuilder()
```

Provision Asset Builder

Provisions assets: creates them, reads one, updates and deletes. Describe
the asset with the `with_provision_*` setters and
`add_provision_datastream_value()`, or hand over a whole payload with
`from_dict()` or `from_dataframe()`. Then pick the operation — `create()`,
`find_one()`, `update()`, `delete()` — and close the chain with `build()`
and `execute()`, or with `build_execute()`.

**Example**:

  ~~~python
  builder = client.new_provision_asset_builder()
  builder.with_organization_name("organization").with_provision_identifier(
  "asset_identifier"
  ).with_provision_channel("channel").create().build().execute()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_organization_name"></a>

---
#### with\_organization\_name

```python
def with_organization_name(organization_name: str) -> "ProvisionAssetBuilder"
```

Specify the organization for the asset.

**Arguments**:

- `organization_name` _str_ - The organization for the asset.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name')
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_identifier"></a>

---
#### with\_identifier

```python
def with_identifier(identifier: str) -> "ProvisionAssetBuilder"
```

Specify the identifier for the asset.

**Arguments**:

- `identifier` _str_ - The identifier for the asset.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns self for chaining.
  

**Example**:

  ~~~python
  builder.with_identifier('identifier')
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_flattened"></a>

---
#### with\_flattened

```python
def with_flattened() -> "ProvisionAssetBuilder"
```

Flatten the data

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_flattened()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_utc"></a>

---
#### with\_utc

```python
def with_utc() -> "ProvisionAssetBuilder"
```

Set UTC flag

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_utc()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_provision_identifier"></a>

---
#### with\_provision\_identifier

```python
def with_provision_identifier(identifier: str) -> "ProvisionAssetBuilder"
```

Set provision identifier

**Arguments**:

- `identifier` _str_ - The identifier to provision the asset with.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_identifier("identifier")
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_provision_channel"></a>

---
#### with\_provision\_channel

```python
def with_provision_channel(channel: str) -> "ProvisionAssetBuilder"
```

Set provision channel

**Arguments**:

- `channel` _str_ - The channel to provision the asset into.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_channel("channel")
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_provision_service_group"></a>

---
#### with\_provision\_service\_group

```python
def with_provision_service_group(
        service_group: str) -> "ProvisionAssetBuilder"
```

Set provision servicegroup

**Arguments**:

- `service_group` _str_ - The service group to provision the asset into.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_service_group("emptyServiceGroup")
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.with_provision_organization"></a>

---
#### with\_provision\_organization

```python
def with_provision_organization(organization: str) -> "ProvisionAssetBuilder"
```

Set provision organization

**Arguments**:

- `organization` _str_ - The organization to provision the asset into.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  builder.with_provision_service_group("organization_name")
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.add_provision_datastream_value"></a>

---
#### add\_provision\_datastream\_value

```python
def add_provision_datastream_value(datastream: str,
                                   value: Any) -> "ProvisionAssetBuilder"
```

Add a datastream value to the payload.

**Arguments**:

- `datastream` _str_ - The datastream identifier.
- `value` _Any_ - The value to be added. It Can be a primitive type or a complex object.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  location_value = {
- `"position"` - {
- `"coordinates"` - [
  -3.66131084,
  40.458442
  ]
  }
  }
  builder.add_provision_datastream_value("provision.asset.location", location_value)
  builder.add_provision_datastream_value("provision.asset.name", "Name")
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.from_dict"></a>

---
#### from\_dict

```python
def from_dict(dct: dict[str, Any]) -> "ProvisionAssetBuilder"
```

Loads data as a python dictionary. If you want to enter the dictionary in flattened mode, you need to use with_flattened().

**Arguments**:

- `dct` _dict_ - The dictionary variable.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  # Mode flattened
  builder.with_flattened().from_dict(
  {"resourceType":{"_value":{"_current":{"value":"entity.asset"}}},
  "provision.asset.identifier":{"_value":{"_current":{"value":"identifier"}}},
  "provision.administration.organization":{"_value":{"_current":{"value":"organization"}}},
  "provision.asset.description":{"_value":{"_current":{"value":"Descripcion"}}},
  "provision.administration.channel":{"_value":{"_current":{"value":"default_channel"}}},
  "provision.administration.serviceGroup":{"_value":{"_current":{"value":"emptyServiceGroup"}}},
  "provision.asset.location":{"_value":{"_current":{"value":{"position":{"coordinates":[-3.66131084,40.458442]}}}}},
  "provision.human.name":{"_value":{"_current":{"value":"Name"}}},
  "provision.human.surname":{"_value":{"_current":{"value":"Surname"}}}})
  
  # Mode without flattened
  builder.from_dict({
- `"resourceType"` - {
- `"_current"` - {
- `"value"` - "entity.asset"
  }
  },
- `"provision"` - {
- `"administration"` - {
- `"channel"` - {
- `"_current"` - {
- `"value"` - "battery_channel"
  }
  },
- `"organization"` - {
- `"_current"` - {
- `"value"` - "battery_organization"
  }
  },
- `"serviceGroup"` - {
- `"_current"` - {
- `"value"` - "emptyServiceGroup"
  }
  }
  },
- `"asset"` - {
- `"identifier"` - {
- `"_current"` - {
- `"value"` - "worker_battery_id"
  }
  }
  }
  }
  })
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.from_dataframe"></a>

---
#### from\_dataframe

```python
def from_dataframe(df: pd.DataFrame) -> "ProvisionAssetBuilder"
```

Loads data as a pandas DataFrame.
Columns must be the names of the datastreams separated with '_' or '.'.

**Arguments**:

- `df` _pd.DataFrame_ - The DataFrame variable.
  

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining.
  

**Example**:

  ~~~python
  import pandas as pd
  data = {
- `'provision_administration_organization_current_value'` - ['base_organization','test_organization'],
- `'provision_device_location_current_value_position_type'` - ['Point','Other_Point'],
- `'provision_device_location_current_value_position_coordinates'` - [[-3.7028,40.41675],[-5.7028,47.41675]],
- `'provision_device_location_current_value_postal'` - ['28013','28050']
  }
  df = pd.DataFrame(df)
  builder.from_dataframe(df)
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.find_one"></a>

---
#### find\_one

```python
def find_one() -> "ProvisionAssetBuilder"
```

Retrieve a single asset.

This method sets up the ProvisionAssetBuilder instance to retrieve a specific assey associated with the specified organization and identifier.

**Returns**:

- `ProvisionAssetBuilder` - The instance of the ProvisionDeviceBuilder class itself, allowing for method chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name("organization_name").with_identifier("model_identifier").find_one()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.create"></a>

---
#### create

```python
def create() -> "ProvisionAssetBuilder"
```

Initiates the creation process of a new asset.

This method prepares the ProvisionAssetBuilder instance to create a new asset.

**Returns**:

- `ProvisionAssetBuilder` - The instance of the ProvisionAssetBuilder class itself, allowing for method chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name("organization_name")
  .with_provision_identifier("provision_identifier")
  .with_provision_organization("provision_organization")
  .with_provision_channel("provision_channel")
  .with_provision_service_group("provision_service_group")
  .add_provision_datastream_value("provision.asset.name", "Name")
  .create()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.update"></a>

---
#### update

```python
def update() -> "ProvisionAssetBuilder"
```

Update an existing asset.

This method sets up the ProvisionAssetBuilder instance to update a specific asset associated with the specified organization and identifier.

You can update an asset with a flattened format sending a PUT request using the URL above. You must replace {identifier} with the identifier of the asset you want to update. Also, it is sent a boolean parameter, flattened, to allow sending a flattened JSON format

**Returns**:

- `ProvisionAssetBuilder` - The instance of the ProvisionAssetBuilder class itself, allowing for method chaining.
  

**Example**:

  dict_flatenned = {"resourceType":{"_value":{"_current":{"value":"entity.asset"}}},
  "provision.asset.identifier":{"_value":{"_current":{"value":"EntityTest"}}},
  "provision.administration.organization":{"_value":{"_current":{"value":"orgnization_name"}}},
  "provision.administration.channel":{"_value":{"_current":{"value":"default_channel"}}},
  "provision.administration.serviceGroup":{"_value":{"_current":{"value":"emptyServiceGroup" }}},
  
  ~~~python
  builder.with_organization_name("organization_name").with_identifier("model_identifier").with_flattened().from_dict(dict_flatenned).update()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.delete"></a>

---
#### delete

```python
def delete() -> "ProvisionAssetBuilder"
```

Delete an existing asset.

This method sets up the ProvisionAssetBuilder instance to delete a specific asset associated with the specified organization and identifier.

**Returns**:

- `ProvisionAssetBuilder` - The instance of the ProvisionAssetBuilder class itself, allowing for method chaining.
  

**Example**:

  ~~~python
  builder.with_organization_name('organization_name').with_identifier("identifier").delete()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.modify"></a>

---
#### modify

```python
def modify() -> "ProvisionAssetBuilder"
```

Modify an existing asset.

This method sets up the ProvisionAssetBuilder instance to update a specific asset associated with the specified organization and identifier.

You can update an asset with a flattened format sending a Patch request using the URL above. You must replace {identifier} with the identifier of the asset you want to update. Also, it is sent a boolean parameter, flattened, to allow sending a flattened JSON format

**Returns**:

- `ProvisionAssetBuilder` - The instance of the ProvisionAssetBuilder class itself, allowing for method chaining.
  

**Example**:

  ~~~python
  dict_flatenned = {"resourceType":{"_value":{"_current":{"value":"entity.asset"}}},
  "provision.asset.identifier":{"_value":{"_current":{"value":"EntityTest"}}},
  "provision.administration.organization":{"_value":{"_current":{"value":"orgnization_name"}}},
  "provision.administration.channel":{"_value":{"_current":{"value":"default_channel"}}},
  "provision.administration.serviceGroup":{"_value":{"_current":{"value":"emptyServiceGroup" }}},
  
  
  builder.with_organization_name("organization_name").with_identifier("model_identifier").with_flattened().from_dict(dict_flatenned).modify()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.build"></a>

---
#### build

```python
def build() -> "ProvisionAssetBuilder"
```

Finalizes the construction of the asset configuration.

This method prepares the builder to execute the collection by ensuring all necessary configurations are set and validates the overall integrity of the build. It should be called before executing the collection to ensure that the configuration is complete and valid.

The build process involves checking that mandatory fields such as the device identifier are set. It also ensures that method calls that are incompatible with each other (like `build` and `build_execute`) are not both used.

**Returns**:

- `ProvisionAssetBuilder` - Returns itself to allow for method chaining, enabling further actions like `execute`.
  

**Raises**:

- `ValueError` - If required configurations are missing or if incompatible methods are used together.
  

**Example**:

  ~~~python
  builder.build()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.build_execute"></a>

---
#### build\_execute

```python
def build_execute()
```

Executes the data sets search immediately after building the configuration.

This method is a shortcut that combines building and executing in a single step.

**Returns**:

- `dict` - A dictionary containing the execution response which includes the status code and potentially other metadata about the execution.
  

**Raises**:

- `ValueError` - If `build` has already been called on this builder instance.
  

**Example**:

  ~~~python
  builder.build_execute()
  ~~~

<a id="opengate_data.provision.asset.provision_asset.ProvisionAssetBuilder.execute"></a>

---
#### execute

```python
def execute() -> str | dict[str, str | int]
```

Execute the configured asset and return the response.

This method executes the operation that has been configured using the builder pattern. It ensures that the `build` method has been called and that it is the last method invoked before `execute`. Depending on the configured method (e.g., create, find, update, delete), it calls the appropriate internal execution method.

**Returns**:

- `requests.Response` - The response object from the executed request.
  

**Raises**:

- `Exception` - If the `build` method has not been called or if it is not the last method invoked before `execute`.
- `ValueError` - If the configured method is unsupported.
  

**Example**:

  ~~~python
  builder.execute()
  ~~~

<a id="opengate_data.provision.asset"></a>

## opengate\_data.provision.asset

<a id="opengate_data.provision"></a>

## opengate\_data.provision

