Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-armah committed Dec 3, 2024
2 parents 2e65ce4 + a700b11 commit 17c9cdf
Show file tree
Hide file tree
Showing 30 changed files with 608 additions and 128 deletions.
10 changes: 9 additions & 1 deletion integrations/aws/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- towncrier release notes start -->

## 0.2.64 (2024-11-28)
## 0.2.65 (2024-12-03)


### Bug Fixes

- Fixed a bug where token refresh fails because its triggered while an active session was still using the old token.


## 0.2.64 (2024-11-27)


### Bug Fixes

- Fixed an issue where the region policy was not properly handled for global resources. Now, when a region policy is specified, it strictly adheres to the allowed regions only.


## 0.2.63 (2024-11-25)


Expand Down
2 changes: 1 addition & 1 deletion integrations/aws/aws/aws_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ async def create_session_for_each_region(
) -> AsyncIterator[aioboto3.Session]:
regions = allowed_regions or self.enabled_regions
for region in regions:
yield await self.create_session(region)
yield await self.create_session(region)
1 change: 0 additions & 1 deletion integrations/aws/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from utils.aws import (
describe_accessible_accounts,
get_accounts,
get_default_region_from_credentials,
get_sessions,
update_available_access_credentials,
validate_request,
Expand Down
7 changes: 6 additions & 1 deletion integrations/azure/.port/resources/blueprints.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
"title": "Azure Subscription",
"icon": "Azure",
"schema": {
"properties": {},
"properties": {
"tags": {
"title": "Tags",
"type": "object"
}
},
"required": []
},
"mirrorProperties": {},
Expand Down
3 changes: 2 additions & 1 deletion integrations/azure/.port/resources/port-app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ resources:
identifier: .id
title: .display_name
blueprint: '"azureSubscription"'
properties: {}
properties:
tags: .tags
- kind: Microsoft.Resources/resourceGroups
selector:
query: 'true'
Expand Down
11 changes: 11 additions & 0 deletions integrations/azure/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
0.1.108 (2024-11-28)

### Improvements

- Bumped azure-mgmt-resource to `23.2.0` and aiohttp

### Bug Fixes

- Fixed the listing of azure subscription resource to use latest version of the SDK, this fixes the issue where some keys were not being returned in the response


0.1.107 (2024-11-25)

### Improvements
Expand Down
4 changes: 2 additions & 2 deletions integrations/azure/azure_integration/azure_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import azure.mgmt.resource.resources.v2022_09_01.aio.operations._operations
from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient
from azure.core.rest import HttpRequest
from azure.mgmt.resource.resources.v2022_09_01.operations._operations import ( # type: ignore
_format_url_section,
from azure.mgmt.resource.resources.v2022_09_01.operations._operations import (
_SERIALIZER,
)
from azure.mgmt.subscription._vendor import _format_url_section
from loguru import logger


Expand Down
6 changes: 5 additions & 1 deletion integrations/azure/azure_integration/ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from port_ocean.utils.async_iterators import stream_async_iterators_tasks
from azure.identity.aio import DefaultAzureCredential
from azure.core.exceptions import ResourceNotFoundError
from azure.mgmt.subscription.aio import SubscriptionClient
from azure.mgmt.resource.subscriptions.aio import SubscriptionClient

from azure_integration.utils import (
ResourceKindsWithSpecialHandling,
Expand Down Expand Up @@ -93,10 +93,14 @@ async def resync_subscriptions(kind: str) -> ASYNC_GENERATOR_RESYNC_TYPE:
"""
Re-syncs subscriptions, this is done separately because the subscriptions api is different from the other apis
"""
resource_selector = typing.cast(
AzureSpecificKindSelector, get_current_resource_config().selector
)
async with DefaultAzureCredential() as credential:
async with SubscriptionClient(credential=credential) as subscription_client:
async for subscriptions_batch in batch_resources_iterator(
subscription_client.subscriptions.list,
api_version=resource_selector.api_version,
):
yield subscriptions_batch

Expand Down
198 changes: 94 additions & 104 deletions integrations/azure/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions integrations/azure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "azure"
version = "0.1.107"
version = "0.1.108"
description = "Azure integration"
authors = ["Tom Tankilevitch <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.12"
port_ocean = {version = "^0.14.3", extras = ["cli"]}
# due to patching the azure-mgmt-resource package, we need to use a specific version
azure-mgmt-resource = "23.0.1"
azure-mgmt-resource = "23.2.0"
azure-identity = "^1.13.0"
aiohttp = "^3.9.4"
cloudevents = "^1.9.0"
Expand Down
64 changes: 64 additions & 0 deletions integrations/datadog/.port/resources/blueprints.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,5 +345,69 @@
"many": false
}
}
},
{
"identifier": "datadogCloudResource",
"description": "This blueprint represents a cloud resource in Datadog",
"title": "Datadog Cloud Resource",
"icon": "Datadog",
"schema": {
"properties": {
"up": {
"type": "boolean",
"title": "Is Running?",
"description": "Is the host up?"
},
"host_name": {
"type": "string",
"title": "Host Name",
"description": "the name of the host"
},
"description": {
"type": "string",
"title": "Description",
"description": "the host description"
},
"platform": {
"type": "string",
"title": "Platform",
"description": "the host platform"
},
"machine": {
"type": "string",
"title": "Machine",
"description": "The CPU architecture of the host machine (e.g., amd64, x86, x64, arm, arm64)."
},
"cpu_cores": {
"type": "number",
"title": "CPU Cores",
"description": "the host CPU cores"
},
"agent_version": {
"type": "string",
"title": "Datadog Agent Version",
"description": "the Datadog agent version installed on the host"
},
"is_muted": {
"type": "boolean",
"title": "Is Host Muted?",
"description": "Indicates whether alerts for that specific host are temporarily suppressed."
},
"sources": {
"title": "Sources",
"type": "array",
"description": "Source or cloud provider associated with your host."
},
"tags": {
"title": "Tags",
"type": "object",
"description": "Tags associated with the host."
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
}
]
24 changes: 23 additions & 1 deletion integrations/datadog/.port/resources/port-app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ resources:
selector:
query: "true"
timeframe: 30
period_of_time_in_years: 12
periodOfTimeInMonths: 6
port:
entity:
mappings:
Expand All @@ -102,3 +102,25 @@ resources:
timeframe: .__timeframe
relations:
slo: .slo.id
- kind: host
selector:
query: >-
[.sources[] | . as $source | ["azure", "gcp", "gce", "aws"] |
contains([$source])] | any(.)
port:
entity:
mappings:
blueprint: '"datadogCloudResource"'
identifier: .id | tostring
title: .aws_name // .host_name
properties:
up: .up
host_name: .host_name
platform: .meta.platform
is_muted: .is_muted
machine: .meta.machine
description: .description
sources: .sources
cpu_cores: .meta.cpuCores
agent_version: .meta.agent_version
tags: .tags_by_source
21 changes: 21 additions & 0 deletions integrations/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- towncrier release notes start -->

## 0.1.59 (2024-12-2)


### Improvements

- Added support for syncing cloud resources from Datadog.
- Included blueprints and entity mappings for cloud resource ingestion.

## 0.1.58 (2024-11-28)


### Bug Fixes

- Fixed SLO history configuration parsing and improved error handling:
- Added descriptive field documentation for configuration parameters
- Changed validation to use warnings instead of errors
- Fixed field alias to match schema
- Added detailed warning messages for troubleshooting
- Updated default period from 12 to 6 months for better performance


## 0.1.57 (2024-11-25)


Expand Down
20 changes: 15 additions & 5 deletions integrations/datadog/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Selector,
)
from pydantic import Field, validator, BaseModel

from loguru import logger
from port_ocean.core.integrations.base import BaseIntegration


Expand All @@ -18,13 +18,23 @@ class SLOHistorySelector(Selector):
@validator("timeframe")
def validate_timeframe_field(cls, v: int) -> int:
if v < 1:
raise ValueError("timeframe must be greater than 0")
logger.warning(
f"The selector value 'timeframe' ({v}) must be greater than 0. "
f"This value determines the time window in days for each SLO history data point. "
f"Using default value of 7 days."
)
return 7
return v

@validator("period_of_time_in_months")
def validate_period_of_time_in_years(cls, v: int) -> int:
if v > 1:
raise ValueError("period_of_time_in_months must be less or equal to 12")
def validate_period_of_time_in_months(cls, v: int) -> int:
if v < 1 or v > 12:
logger.warning(
f"The selector value 'periodOfTimeInMonths' ({v}) must be between 1 and 12. "
f"This value determines how far back in time to fetch SLO history. "
f"Using default value of 6 months."
)
return 6
return v


Expand Down
2 changes: 1 addition & 1 deletion integrations/datadog/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "datadog"
version = "0.1.57"
version = "0.1.59"
description = "Datadog Ocean Integration"
authors = ["Albert Luganga <[email protected]>"]

Expand Down
40 changes: 40 additions & 0 deletions integrations/dynatrace/.port/resources/blueprints.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,45 @@
"mirrorProperties": {},
"calculationProperties": {},
"relations": {}
},
{
"identifier": "dynatraceEntityCloudResource",
"description": "This blueprint represents a Dynatrace Entity",
"title": "Dynatrace Cloud Resource",
"icon": "Dynatrace",
"schema": {
"properties": {
"firstSeen": {
"type": "string",
"title": "First Seen",
"description": "The timestamp at which the entity was first seen, in UTC milliseconds.",
"format": "date-time"
},
"lastSeen": {
"type": "string",
"title": "Last Seen",
"description": "The timestamp at which the entity was last seen, in UTC milliseconds.",
"format": "date-time"
},
"type": {
"type": "string",
"title": "Type",
"description": "The type of the entity."
},
"tags": {
"type": "array",
"title": "Tags",
"description": "A list of tags of the entity.",
"items": {
"type": "string"
}
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
}
]
31 changes: 31 additions & 0 deletions integrations/dynatrace/.port/resources/port-app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,34 @@ resources:
evaluatedPercentage: .evaluatedPercentage
evaluationType: .evaluationType
filter: .filter

- kind: entity
selector:
query: 'true'
entityTypes:
- "cloud:gcp:k8s_cluster"
- "cloud:gcp:pubsub_subscription"
- "cloud:gcp:pubsub_topic"
- "cloud:gcp:gcs_bucket"
- "cloud:gcp:gae_app"
- "cloud:aws:acmprivateca"
- "cloud:aws:api_gateway"
- "cloud:aws:app_runner"
- "cloud:aws:appstream"
- "cloud:aws:appsync"
- "cloud:azure:apimanagement:service"
- "cloud:azure:app:containerapps"
- "cloud:azure:app:managedenvironments"
- "cloud:azure:appconfiguration:configurationstores"
- "cloud:azure:appplatform:spring"
port:
entity:
mappings:
identifier: .displayName | gsub(" "; "-")
title: .displayName
blueprint: '"dynatraceEntityCloudResource"'
properties:
firstSeen: .firstSeenTms / 1000 | todate
lastSeen: .lastSeenTms / 1000 | todate
type: .type
tags: .tags[].stringRepresentation
Loading

0 comments on commit 17c9cdf

Please sign in to comment.