Amazon EventBridge

2020/11/19 - Amazon EventBridge - 3 updated api methods

Changes  Update events client to latest version

DescribeRule (updated) Link ¶
Changes (response)
{'CreatedBy': 'string'}

Describes the specified rule.

DescribeRule does not list the targets of a rule. To see the targets associated with a rule, use ListTargetsByRule.

See also: AWS API Documentation

Request Syntax

client.describe_rule(
    Name='string',
    EventBusName='string'
)
type Name:

string

param Name:

[REQUIRED]

The name of the rule.

type EventBusName:

string

param EventBusName:

The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.

rtype:

dict

returns:

Response Syntax

{
    'Name': 'string',
    'Arn': 'string',
    'EventPattern': 'string',
    'ScheduleExpression': 'string',
    'State': 'ENABLED'|'DISABLED',
    'Description': 'string',
    'RoleArn': 'string',
    'ManagedBy': 'string',
    'EventBusName': 'string',
    'CreatedBy': 'string'
}

Response Structure

  • (dict) --

    • Name (string) --

      The name of the rule.

    • Arn (string) --

      The Amazon Resource Name (ARN) of the rule.

    • EventPattern (string) --

      The event pattern. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide.

    • ScheduleExpression (string) --

      The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)".

    • State (string) --

      Specifies whether the rule is enabled or disabled.

    • Description (string) --

      The description of the rule.

    • RoleArn (string) --

      The Amazon Resource Name (ARN) of the IAM role associated with the rule.

    • ManagedBy (string) --

      If this is a managed rule, created by an AWS service on your behalf, this field displays the principal name of the AWS service that created the rule.

    • EventBusName (string) --

      The name of the event bus associated with the rule.

    • CreatedBy (string) --

      The account ID of the user that created the rule. If you use PutRule to put a rule on an event bus in another account, the other account is the owner of the rule, and the rule ARN includes the account ID for that account. However, the value for CreatedBy is the account ID as the account that created the rule in the other account.

PutPermission (updated) Link ¶
Changes (request)
{'Policy': 'string'}

Running PutPermission permits the specified AWS account or AWS organization to put events to the specified event bus. Amazon EventBridge (CloudWatch Events) rules in your account are triggered by these events arriving to an event bus in your account.

For another account to send events to your account, that external account must have an EventBridge rule with your account's event bus as a target.

To enable multiple AWS accounts to put events to your event bus, run PutPermission once for each of these accounts. Or, if all the accounts are members of the same AWS organization, you can run PutPermission once specifying Principal as "*" and specifying the AWS organization ID in Condition, to grant permissions to all accounts in that organization.

If you grant permissions using an organization, then accounts in that organization must specify a RoleArn with proper permissions when they use PutTarget to add your account's event bus as a target. For more information, see Sending and Receiving Events Between AWS Accounts in the Amazon EventBridge User Guide.

The permission policy on the default event bus cannot exceed 10 KB in size.

See also: AWS API Documentation

Request Syntax

client.put_permission(
    EventBusName='string',
    Action='string',
    Principal='string',
    StatementId='string',
    Condition={
        'Type': 'string',
        'Key': 'string',
        'Value': 'string'
    },
    Policy='string'
)
type EventBusName:

string

param EventBusName:

The name of the event bus associated with the rule. If you omit this, the default event bus is used.

type Action:

string

param Action:

The action that you are enabling the other account to perform. Currently, this must be events:PutEvents.

type Principal:

string

param Principal:

The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify "*" to permit any account to put events to your default event bus.

If you specify "*" without specifying Condition, avoid creating rules that may match undesirable events. To create more secure rules, make sure that the event pattern for each rule contains an account field with a specific account ID from which to receive events. Rules with an account field do not match any events sent from other accounts.

type StatementId:

string

param StatementId:

An identifier string for the external account that you are granting permissions to. If you later want to revoke the permission for this external account, specify this StatementId when you run RemovePermission.

type Condition:

dict

param Condition:

This parameter enables you to limit the permission to accounts that fulfill a certain condition, such as being a member of a certain AWS organization. For more information about AWS Organizations, see What Is AWS Organizations in the AWS Organizations User Guide.

If you specify Condition with an AWS organization ID, and specify "*" as the value for Principal, you grant permission to all the accounts in the named organization.

The Condition is a JSON string which must contain Type, Key, and Value fields.

  • Type (string) -- [REQUIRED]

    Specifies the type of condition. Currently the only supported value is StringEquals.

  • Key (string) -- [REQUIRED]

    Specifies the key for the condition. Currently the only supported key is aws:PrincipalOrgID.

  • Value (string) -- [REQUIRED]

    Specifies the value for the key. Currently, this must be the ID of the organization.

type Policy:

string

param Policy:

A JSON string that describes the permission policy statement. You can include a Policy parameter in the request instead of using the StatementId, Action, Principal, or Condition parameters.

returns:

None

RemovePermission (updated) Link ¶
Changes (request)
{'RemoveAllPermissions': 'boolean'}

Revokes the permission of another AWS account to be able to put events to the specified event bus. Specify the account to revoke by the StatementId value that you associated with the account when you granted it permission with PutPermission. You can find the StatementId by using DescribeEventBus.

See also: AWS API Documentation

Request Syntax

client.remove_permission(
    StatementId='string',
    RemoveAllPermissions=True|False,
    EventBusName='string'
)
type StatementId:

string

param StatementId:

The statement ID corresponding to the account that is no longer allowed to put events to the default event bus.

type RemoveAllPermissions:

boolean

param RemoveAllPermissions:

Specifies whether to remove all permissions.

type EventBusName:

string

param EventBusName:

The name of the event bus to revoke permissions for. If you omit this, the default event bus is used.

returns:

None