Skip to content

add CloudWatchLogsClient::describeLogGroups() #1914

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"methods": [
"CreateLogGroup",
"CreateLogStream",
"DescribeLogGroups",
"DescribeLogStreams",
"FilterLogEvents",
"PutLogEvents"
Expand Down
46 changes: 46 additions & 0 deletions src/Service/CloudWatchLogs/src/CloudWatchLogsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
use AsyncAws\CloudWatchLogs\Exception\UnrecognizedClientException;
use AsyncAws\CloudWatchLogs\Input\CreateLogGroupRequest;
use AsyncAws\CloudWatchLogs\Input\CreateLogStreamRequest;
use AsyncAws\CloudWatchLogs\Input\DescribeLogGroupsRequest;
use AsyncAws\CloudWatchLogs\Input\DescribeLogStreamsRequest;
use AsyncAws\CloudWatchLogs\Input\FilterLogEventsRequest;
use AsyncAws\CloudWatchLogs\Input\PutLogEventsRequest;
use AsyncAws\CloudWatchLogs\Result\DescribeLogGroupsResponse;
use AsyncAws\CloudWatchLogs\Result\DescribeLogStreamsResponse;
use AsyncAws\CloudWatchLogs\Result\FilterLogEventsResponse;
use AsyncAws\CloudWatchLogs\Result\PutLogEventsResponse;
Expand Down Expand Up @@ -130,6 +132,50 @@ public function createLogStream($input): Result
return new Result($response);
}

/**
* Returns information about log groups. You can return all your log groups or filter the results by prefix. The results
* are ASCII-sorted by log group name.
*
* CloudWatch Logs doesn't support IAM policies that control access to the `DescribeLogGroups` action by using the
* `aws:ResourceTag/*key-name*` condition key. Other CloudWatch Logs actions do support the use of the
* `aws:ResourceTag/*key-name*` condition key to control access. For more information about using tags to control
* access, see Controlling access to Amazon Web Services resources using tags [^1].
*
* If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view
* data from the linked source accounts. For more information, see CloudWatch cross-account observability [^2].
*
* [^1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html
* [^2]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html
*
* @see https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogGroups.html
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-logs-2014-03-28.html#describeloggroups
*
* @param array{
* accountIdentifiers?: null|string[],
* logGroupNamePrefix?: null|string,
* logGroupNamePattern?: null|string,
* nextToken?: null|string,
* limit?: null|int,
* includeLinkedAccounts?: null|bool,
* logGroupClass?: null|LogGroupClass::*,
* logGroupIdentifiers?: null|string[],
* '@region'?: string|null,
* }|DescribeLogGroupsRequest $input
*
* @throws InvalidParameterException
* @throws ServiceUnavailableException
*/
public function describeLogGroups($input = []): DescribeLogGroupsResponse
{
$input = DescribeLogGroupsRequest::create($input);
$response = $this->getResponse($input->request(), new RequestContext(['operation' => 'DescribeLogGroups', 'region' => $input->getRegion(), 'exceptionMapping' => [
'InvalidParameterException' => InvalidParameterException::class,
'ServiceUnavailableException' => ServiceUnavailableException::class,
]]));

return new DescribeLogGroupsResponse($response, $this, $input);
}

/**
* Lists the log streams for the specified log group. You can list all the log streams or filter the results by prefix.
* You can also control how the results are ordered.
Expand Down
21 changes: 21 additions & 0 deletions src/Service/CloudWatchLogs/src/Enum/DataProtectionStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace AsyncAws\CloudWatchLogs\Enum;

final class DataProtectionStatus
{
public const ACTIVATED = 'ACTIVATED';
public const ARCHIVED = 'ARCHIVED';
public const DELETED = 'DELETED';
public const DISABLED = 'DISABLED';

public static function exists(string $value): bool
{
return isset([
self::ACTIVATED => true,
self::ARCHIVED => true,
self::DELETED => true,
self::DISABLED => true,
][$value]);
}
}
15 changes: 15 additions & 0 deletions src/Service/CloudWatchLogs/src/Enum/InheritedProperty.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace AsyncAws\CloudWatchLogs\Enum;

final class InheritedProperty
{
public const ACCOUNT_DATA_PROTECTION = 'ACCOUNT_DATA_PROTECTION';

public static function exists(string $value): bool
{
return isset([
self::ACCOUNT_DATA_PROTECTION => true,
][$value]);
}
}
Loading
Loading