Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit for farmbeats service. #17337

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5fe6592
Initial commit for farmbeats client
agniveshadhikari Mar 11, 2021
3ee382b
Added placeholder readme for azure-farmbeats-ds
agniveshadhikari Mar 11, 2021
486f9a6
Updated swagger, autogen code.
agniveshadhikari Mar 12, 2021
b3dfdd6
restructuring
agniveshadhikari Mar 15, 2021
7145caf
Add ci.yml
agniveshadhikari Mar 15, 2021
7c9d862
Adding readmes, should fix readme validation issue
agniveshadhikari Mar 18, 2021
feaba8b
Bumping a header to h2 to hopefully resolve readme check
agniveshadhikari Mar 21, 2021
732780c
Deleting top level readme
agniveshadhikari Mar 21, 2021
777a82a
Specifying dep versions in setup.py
agniveshadhikari Mar 21, 2021
e76be9a
Removing wrapper
agniveshadhikari Mar 29, 2021
8ac675f
LROs should be sorted now
agniveshadhikari Mar 29, 2021
8d74a58
autorest level rename of client
agniveshadhikari Mar 30, 2021
f5a094e
March Swagger updates (not final)
agniveshadhikari Apr 15, 2021
b0994d5
Intermediate checking, LROs probably work
agniveshadhikari Apr 20, 2021
65d7b0f
Manually updated swagger
agniveshadhikari Apr 20, 2021
b3f9b3e
Adding msrest to deps for package
agniveshadhikari Apr 22, 2021
ef1f724
Updates, added an example script for now.
agniveshadhikari May 6, 2021
1491922
Adding a helper script to wrap the generation command
agniveshadhikari May 10, 2021
4ad9af5
deleting the ds dir
agniveshadhikari May 10, 2021
e41f714
Added final version info to setup
agniveshadhikari May 10, 2021
0c205ae
Generated client form latest swagger. This breaks base url. Yet to ma…
agniveshadhikari May 10, 2021
95cf84d
Added default scope
agniveshadhikari May 11, 2021
b344a8a
Adding back baseurl manually
agniveshadhikari May 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions sdk/farmbeats/azure-farmbeats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Azure Farnbeats API client library for Python

TODO

## Getting started

### Key concepts

### Prerequisites

* Azure subscription
* Azure Farmbeats instance
* Python 2.7 or 3.5.3+ TODO figure out supported versions

If you need a Cosmos DB SQL API account, you can follow this link TODO

### Install the package

```bash
pip install azure-farmbeats
```

#### Configure a virtual environment (optional)

Although not required, you can keep your base system and Azure SDK environments isolated from one another if you use a virtual environment. Execute the following commands to configure and then enter a virtual environment with venv:

```Bash
python3 -m venv farmbeats-test-env
source farmbeats-test-env/bin/activate
```
### Authenticate the client

TODO

### Create the client

TODO

## Examples

Here are some common use case scenarios:

TODO

## Troubleshooting

TODO


## Next steps

TODO

<!-- LINKS -->
[azure_cli]: https://docs.microsoft.com/cli/azure

## Contributing

This project welcomes contributions and suggestions.
Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that
you have the right to, and actually do, grant us
the rights to use your contribution.

For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will
automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment).
Simply follow the instructions provided by the bot.
You will only need to do this once across all repos using our CLA.

This project has adopted the
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [[email protected]](mailto:[email protected])
with any additional questions or comments.
1 change: 1 addition & 0 deletions sdk/farmbeats/azure-farmbeats/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
17 changes: 17 additions & 0 deletions sdk/farmbeats/azure-farmbeats/azure/farmbeats/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.1.3, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._farm_beats_client import FarmBeatsClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['FarmBeatsClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
62 changes: 62 additions & 0 deletions sdk/farmbeats/azure-farmbeats/azure/farmbeats/_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.1.3, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential


class FarmBeatsClientConfiguration(Configuration):
"""Configuration for FarmBeatsClient.

Note that all parameters used to create this instance are saved as instance
attributes.

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
"""

def __init__(
self,
credential, # type: "TokenCredential"
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
super(FarmBeatsClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.api_version = "2021-03-31-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://farmbeats-dogfood.azure.net/.default'])
kwargs.setdefault('sdk_moniker', 'farmbeatsclient/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
169 changes: 169 additions & 0 deletions sdk/farmbeats/azure-farmbeats/azure/farmbeats/_farm_beats_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.1.3, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core import PipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import FarmBeatsClientConfiguration
from .operations import ApplicationDataOperations
from .operations import AttachmentsOperations
from .operations import BoundariesOperations
from .operations import CropsOperations
from .operations import CropVarietiesOperations
from .operations import FarmersOperations
from .operations import FarmOperationsOperations
from .operations import FarmsOperations
from .operations import FieldsOperations
from .operations import HarvestDataOperations
from .operations import ImageProcessingOperations
from .operations import OAuthProvidersOperations
from .operations import OAuthTokensOperations
from .operations import PlantingDataOperations
from .operations import ScenesOperations
from .operations import SeasonalFieldsOperations
from .operations import SeasonsOperations
from .operations import TillageDataOperations
from .operations import WeatherOperations
from . import models


class FarmBeatsClient(object):
"""APIs documentation for Azure AgPlatform DataPlane Service.

:ivar application_data: ApplicationDataOperations operations
:vartype application_data: azure.farmbeats.operations.ApplicationDataOperations
:ivar attachments: AttachmentsOperations operations
:vartype attachments: azure.farmbeats.operations.AttachmentsOperations
:ivar boundaries: BoundariesOperations operations
:vartype boundaries: azure.farmbeats.operations.BoundariesOperations
:ivar crops: CropsOperations operations
:vartype crops: azure.farmbeats.operations.CropsOperations
:ivar crop_varieties: CropVarietiesOperations operations
:vartype crop_varieties: azure.farmbeats.operations.CropVarietiesOperations
:ivar farmers: FarmersOperations operations
:vartype farmers: azure.farmbeats.operations.FarmersOperations
:ivar farm_operations: FarmOperationsOperations operations
:vartype farm_operations: azure.farmbeats.operations.FarmOperationsOperations
:ivar farms: FarmsOperations operations
:vartype farms: azure.farmbeats.operations.FarmsOperations
:ivar fields: FieldsOperations operations
:vartype fields: azure.farmbeats.operations.FieldsOperations
:ivar harvest_data: HarvestDataOperations operations
:vartype harvest_data: azure.farmbeats.operations.HarvestDataOperations
:ivar image_processing: ImageProcessingOperations operations
:vartype image_processing: azure.farmbeats.operations.ImageProcessingOperations
:ivar oauth_providers: OAuthProvidersOperations operations
:vartype oauth_providers: azure.farmbeats.operations.OAuthProvidersOperations
:ivar oauth_tokens: OAuthTokensOperations operations
:vartype oauth_tokens: azure.farmbeats.operations.OAuthTokensOperations
:ivar planting_data: PlantingDataOperations operations
:vartype planting_data: azure.farmbeats.operations.PlantingDataOperations
:ivar scenes: ScenesOperations operations
:vartype scenes: azure.farmbeats.operations.ScenesOperations
:ivar seasonal_fields: SeasonalFieldsOperations operations
:vartype seasonal_fields: azure.farmbeats.operations.SeasonalFieldsOperations
:ivar seasons: SeasonsOperations operations
:vartype seasons: azure.farmbeats.operations.SeasonsOperations
:ivar tillage_data: TillageDataOperations operations
:vartype tillage_data: azure.farmbeats.operations.TillageDataOperations
:ivar weather: WeatherOperations operations
:vartype weather: azure.farmbeats.operations.WeatherOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param str base_url: Service URL
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

def __init__(
self,
base_url,
credential, # type: "TokenCredential"
**kwargs # type: Any
):
# type: (...) -> None
self._config = FarmBeatsClientConfiguration(credential, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.application_data = ApplicationDataOperations(
self._client, self._config, self._serialize, self._deserialize)
self.attachments = AttachmentsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.boundaries = BoundariesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.crops = CropsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.crop_varieties = CropVarietiesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.farmers = FarmersOperations(
self._client, self._config, self._serialize, self._deserialize)
self.farm_operations = FarmOperationsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.farms = FarmsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.fields = FieldsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.harvest_data = HarvestDataOperations(
self._client, self._config, self._serialize, self._deserialize)
self.image_processing = ImageProcessingOperations(
self._client, self._config, self._serialize, self._deserialize)
self.oauth_providers = OAuthProvidersOperations(
self._client, self._config, self._serialize, self._deserialize)
self.oauth_tokens = OAuthTokensOperations(
self._client, self._config, self._serialize, self._deserialize)
self.planting_data = PlantingDataOperations(
self._client, self._config, self._serialize, self._deserialize)
self.scenes = ScenesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.seasonal_fields = SeasonalFieldsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.seasons = SeasonsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.tillage_data = TillageDataOperations(
self._client, self._config, self._serialize, self._deserialize)
self.weather = WeatherOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.

:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
http_request.url = self._client.format_url(http_request.url)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> FarmBeatsClient
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
7 changes: 7 additions & 0 deletions sdk/farmbeats/azure-farmbeats/azure/farmbeats/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.1.3, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0b1"
8 changes: 8 additions & 0 deletions sdk/farmbeats/azure-farmbeats/azure/farmbeats/aio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.1.3, generator: {generator})
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._farm_beats_client import FarmBeatsClient
__all__ = ['FarmBeatsClient']
Loading