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

Add support for Groups #47

Merged
merged 9 commits into from
Jul 25, 2022
Merged

Add support for Groups #47

merged 9 commits into from
Jul 25, 2022

Conversation

mcwarman
Copy link
Contributor

@mcwarman mcwarman commented Jun 10, 2022

Issue #, if available: N/A

Description of changes:

Adds the support for Groups. Some example usage below.

Groups

@startuml
'Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
'SPDX-License-Identifier: MIT (For details, see https://github.com/awslabs/aws-icons-for-plantuml/blob/master/LICENSE)

!define AWSPuml https://raw.githubusercontent.com/mcwarman/aws-icons-for-plantuml/groups/dist

!include AWSPuml/AWSCommon.puml
!include AWSPuml/AWSSimplified.puml
!include AWSPuml/AWSGroups.puml

!include AWSPuml/GroupIcons/all.puml

CloudGroup(CloudGroup, "AWS Cloud")
CloudaltGroup(CloudaltGroup, "AWS Cloud")
RegionGroup(RegionGroup, "Region")
AvailabilityZoneGroup(something, "Availability Zone")
SecurityGroupGroup(SecurityGroupGroup, "Security Group")
AutoScalingGroupGroup(AutoScalingGroupGroup, "Auto Scaling Group")
VirtualPrivateCloudVPCGroup(VirtualPrivateCloudVPCGroup, "VPC")
VPCSubnetPrivateGroup(VPCSubnetPrivateGroup, "Private Subnet")
VPCSubnetPublicGroup(VPCSubnetPublicGroup, "Public Subnet")
ServerContentsGroup(ServerContentsGroup, "Server Contents")
CorporateDataCenterGroup(CorporateDataCenterGroup, "Corporate Data Center")
EC2InstanceContainerGroup(EC2InstanceContainerGroup, "EC2 Instance Container")
SpotFleetGroup(SpotFleetGroup, "Spot Fleet")
ElasticBeanstalkContainerGroup(ElasticBeanstalkContainerGroup, "Elastic Beanstalk Container")
StepFunctionGroup(StepFunctionGroup, "AWS Step Functions workflow")
GenericGroup(GenericGroup, "Generic group")
GenericAltGroup(GenericAltGroup, "Generic group")
@enduml

Examples

VPC

VPC

@startuml
'Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
'SPDX-License-Identifier: MIT (For details, see https://github.com/awslabs/aws-icons-for-plantuml/blob/master/LICENSE)

!define AWSPuml https://raw.githubusercontent.com/mcwarman/aws-icons-for-plantuml/groups/dist

!include AWSPuml/AWSCommon.puml
!include AWSPuml/AWSSimplified.puml
!include AWSPuml/AWSGroups.puml

!include AWSPuml/Compute/EC2.puml

!include AWSPuml/GroupIcons/Cloud.puml
!include AWSPuml/GroupIcons/VirtualPrivateCloudVPC.puml
!include AWSPuml/GroupIcons/VPCSubnetPublic.puml
!include AWSPuml/GroupIcons/VPCSubnetPrivate.puml

!include AWSPuml/NetworkingContentDelivery/VPCNATGateway.puml
!include AWSPuml/NetworkingContentDelivery/VPCInternetGateway.puml

CloudGroup(cloud, "AWS Cloud") {
  VirtualPrivateCloudVPCGroup(vpc, "VPC") {

    VPCInternetGateway(internet_gateway, "Internet Gateway", "")

    AvailabilityZoneGroup(az_1, "Availability Zone 1") {
      VPCSubnetPublicGroup(az_1_public, "Public Subnet") {
        VPCNATGateway(az_1_nat_gateway, "NAT Gateway", "")
      }
      VPCSubnetPrivateGroup(az_1_private, "Private Subnet") {
        EC2(az_1_ec2_1, "EC2", "")
      }

      az_1_ec2_1 .u..> az_1_nat_gateway
    }

    AvailabilityZoneGroup(az_2, "Availability Zone 2") {
      VPCSubnetPublicGroup(az_2_public, "Public Subnet") {
        VPCNATGateway(az_2_nat_gateway, "NAT Gateway", "")
      }
      VPCSubnetPrivateGroup(az_2_private, "Private Subnet") {
        EC2(az_2_ec2_1, "EC2", "")
      }

      az_2_ec2_1 .u..> az_2_nat_gateway
    }

    az_2_nat_gateway .u..> internet_gateway
    az_1_nat_gateway .u..> internet_gateway

  }
}
@enduml

Auto Scaling Groups

Auto Scaling Groups

@startuml
'Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
'SPDX-License-Identifier: MIT (For details, see https://github.com/awslabs/aws-icons-for-plantuml/blob/master/LICENSE)

!define AWSPuml https://raw.githubusercontent.com/mcwarman/aws-icons-for-plantuml/groups/dist

!include AWSPuml/AWSCommon.puml
!include AWSPuml/AWSSimplified.puml
!include AWSPuml/AWSGroups.puml


!include AWSPuml/Compute/EC2AutoScaling.puml
!include AWSPuml/Compute/EC2Instance.puml

!include AWSPuml/GroupIcons/Cloud.puml
!include AWSPuml/GroupIcons/VirtualPrivateCloudVPC.puml
!include AWSPuml/GroupIcons/AutoScalingGroup.puml

!include AWSPuml/NetworkingContentDelivery/VPCNATGateway.puml

skinparam rectangle<<hidden>> {
  shadowing false
  BackgroundColor transparent
  BorderColor transparent
}

!unquoted procedure LayoutRectangle($p_alias)
rectangle " " as $p_alias <<hidden>>
!endprocedure

CloudGroup(cloud, "AWS Cloud") {
  VirtualPrivateCloudVPCGroup(vpc, "VPC") {

    AvailabilityZoneGroup(az_2, "Availability Zone 2") {
      VPCNATGateway(az_2_nat_gateway, "NAT Gateway", "")
      EC2Instance(az_2_ec2_1, "Instance", "")
      EC2Instance(az_2_ec2_2, "Instance", "")
      az_2_nat_gateway -[hidden]d- az_2_ec2_1
      az_2_ec2_1 -[hidden]d- az_2_ec2_2
    }

    LayoutRectangle(layout_rectangle) {
      EC2AutoScaling(ec2_auto_scaling, "Amazon EC2 Auto Scaling", "")
      AutoScalingGroup(asg_1, "Auto Scaling Group", "")
      AutoScalingGroup(asg_2, "Auto Scaling Group", "")
      ec2_auto_scaling -[hidden]d- asg_1
      asg_1 -[hidden]d- asg_2
    }

    AvailabilityZoneGroup(az_1, "Availability Zone 1") {
      VPCNATGateway(az_1_nat_gateway, "NAT Gateway", "")
      EC2Instance(az_1_ec2_1, "Instance", "")
      EC2Instance(az_1_ec2_2, "Instance", "")
      az_1_nat_gateway -[hidden]d- az_1_ec2_1
      az_1_ec2_1 -[hidden]d- az_1_ec2_2
    }

    ec2_auto_scaling -[hidden]l- az_1_nat_gateway
    ec2_auto_scaling -[hidden]r- az_2_nat_gateway

    asg_1 -[dashed,#D86613]l- az_1_ec2_1
    asg_1 -[dashed,#D86613]r- az_2_ec2_1

    asg_2 -[dashed,#D86613]l- az_1_ec2_2
    asg_2 -[dashed,#D86613]r- az_2_ec2_2

  }
}
@enduml

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mcwarman
Copy link
Contributor Author

Rebase of #40

source/AWSCommon.puml Outdated Show resolved Hide resolved
@mcwarman mcwarman marked this pull request as draft June 10, 2022 08:53
@mcwarman mcwarman marked this pull request as ready for review June 10, 2022 09:14
@hakanson
Copy link
Contributor

I noticed a typo/spelling error with Avalability - one example is AvalabilityZoneGroup(az_1, "Availability Zone 1") { but I think there were a couple more.

@mcwarman
Copy link
Contributor Author

I've update the spelling on Avalability.

@hakanson
Copy link
Contributor

hakanson commented Jun 10, 2022

With the last release, we made new config.yml generation easier - look for create_config_template() in icon-builder.py - can you see if you can also add the new BorderStyle, BorderColor, BackgroundColor subproperties of Group similar to how Color is added?

if category == "GroupIcons" and target in GROUPICONS_COLORS:
icon_entry["Color"] = GROUPICONS_COLORS[target]

Can you also add the Color updates you made in config.yml to the embedded template in icon-builder.py? https://github.com/awslabs/aws-icons-for-plantuml/blob/main/scripts/icon-builder.py#L161 ?

Feel free to use defaults of these, and only config overrides in a data structure similar to GROUPICONS_COLORS

      Group:
        BorderStyle: Plain
        BorderColor: SquidInk
        BackgroundColor: White

@mcwarman
Copy link
Contributor Author

mcwarman commented Jun 15, 2022

@hakanson I've made some updates to the code around --create-config-template and updated how it works slightly to use defaults.

@hakanson
Copy link
Contributor

@mcwarman thanks for the update. This is still on my radar, but it might be another week before I can take a look.

@hakanson
Copy link
Contributor

hakanson commented Jul 4, 2022

Thanks again for this PR. I spent time over the weekend building some diagrams and made some code changes. Can you select the "Allow edits from maintainers" checkbox (see https://github.blog/2016-09-07-improving-collaboration-with-forks/) so I can push these changes into your branch so they will flow back into this PR?

As I was experimenting with example diagrams, I didn't love the macro names for creating the groups (not your fault, since you used the existing icon names). I also noticed some Group icons from the most recent AWS icons deck (like AWS Account) were missing so I extracted those images. I wanted to add default labels so just AWSAccountGroup(account) could work but still allow label as the second parameter. I created a way to use a zero-length file to trigger creation of the empty groups (Available Zone, Security Group) instead of putting them in AWSGroups.yaml. In the end, there were config overrides for every Group icon, so it ended up being easier to pre-configure all of the Groups category in YAML vs Python code + extra .puml file.

Those were great Groups examples, which I had to update with my renamed macros among other tweaks. I did end up renaming the files to be prefixed with "Groups - " and added a couple more so I could fight with PlantUML rendering. Please let me know what you think of these changes.

@hakanson
Copy link
Contributor

hakanson commented Jul 8, 2022

@mcwarman have you had a chance to see my comment above? I'd like to get this committed next week, either on this PR, or I can also create my own PR if you don't want to grant access.

@mcwarman
Copy link
Contributor Author

@hakanson sorry I missed this, it was already turned on, I've toggled it though.

@hakanson
Copy link
Contributor

Maybe user error on my part? I was getting this error message. I'll look at the docs and see what I'm doing wrong.

To https://github.com/mcwarman/aws-icons-for-plantuml.git
! [remote rejected] mcwarman-groups -> mcwarman-groups (permission denied)
error: failed to push some refs to 'https://github.com/mcwarman/aws-icons-for-plantuml.git'

@hakanson
Copy link
Contributor

hakanson commented Jul 12, 2022

It was user error specifying branch name :( - the command below will push to the properly named groups branch

git push mcwarman mcwarman-groups:groups

@mcwarman
Copy link
Contributor Author

mcwarman commented Jul 12, 2022

I think its push to origin looking at these docs:

Actually I've just reread the instructions, I'm not sure, but this might help:

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/committing-changes-to-a-pull-request-branch-created-from-a-fork

@hakanson
Copy link
Contributor

It looks like my commits are appearing on this PR now - take a look and let me know what you think.

README.md Outdated Show resolved Hide resolved
@mcwarman
Copy link
Contributor Author

Looks good to me.

@gadams999 gadams999 added the enhancement New feature or request label Jul 25, 2022
@gadams999
Copy link
Contributor

Reviewed and discussed, ship it!

@hakanson hakanson merged commit 73a66e4 into awslabs:main Jul 25, 2022
@mcwarman mcwarman deleted the groups branch July 26, 2022 10:55
@mcwarman
Copy link
Contributor Author

FYI @jfrconley

@hakanson
Copy link
Contributor

@mcwarman - thanks again for the PR. We pushed a release with this yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants